1
$\begingroup$

I have a dataset with different purchases for two different items from the same users. So the users purchased the two items at different points in time. I also have 3 different variables: High, Mid, and Low twice (Low, Mid,High for each product) within this dataset. So the product are broken up into these categories. For example, suppose I bought item X and its classified as a High price item. I then want to see if the same user bought an item Y at the same classification level (High). My end goal is to see if there is an association of a customer buying items at the same classification level across different items.

My first thought was to use a Chi square test but I am not sure this is the best way to do it. I am doing this in R. All of the data are binary variables. Here is an example of what the dataset looks like.

User      Type             High  Mid  Low        
1         Product 1        0     1    0       
1         Product 2        1     0    0       
2         Product 1        0     1    0
2         Product 2        0     1    0
3         Product 1        0     0    1
3         Product 2        0     1    0
$\endgroup$
  • $\begingroup$ Are your datasets paired observations? E.g., is one object being rated High/Mid/Low by two raters for whom you're interested in quantifying agreement? $\endgroup$ – Nick Stauner Feb 27 '14 at 19:24
  • 1
    $\begingroup$ The dataset are tier leves of purchases. So trying to see if the same person are buying items in each tier level. So the data was merged on an indiv_id who had purchases in both categories. I am trying to see if there is a relationship between the levels. For example, if they buy a Mid tier item in one level does that mean that they are are likely to buy an item in the Mid tier for another product. Sorry for the confusion $\endgroup$ – user3120266 Feb 27 '14 at 22:25
  • 1
    $\begingroup$ I'm afraid confusion is bound to occur in matters of statistics. Your continuing efforts to clarify are most appreciated and unfortunately rare in our population of new users! We'll get to the bottom of this yet – I'll mull it over, keep an eye on answers, and offer my own if I have anything to add in the end. $\endgroup$ – Nick Stauner Feb 27 '14 at 22:31
  • $\begingroup$ You seem to have an important choice to make: do you want to consider User 1's purchases of Products 1 and 2 more similar than the purchases of a User who selects one Product from the High price category and one from the Low category? BTW, if so, and if you have actual prices for the Products, it would be wise to use those instead of trichotomizing the price data. If you prefer not to consider Products of High price more similar to Mid than Low, you'd want to treat your price data as nominal, not ordinal. Your choice will greatly affect what results you'll get $\endgroup$ – Nick Stauner Mar 2 '14 at 17:01
2
$\begingroup$

Are you sure association is what you're trying to answer here? Is it possible that you might be interested in interrater agreement?

At any rate, there are two approaches to handling these data: one in which frequencies are treated as unordered (suboptimal) and the other in which you borrow information across trends (low/mid/high immediately suggests an ordinal nature to these data). The plain-vanilla approach to option 1 is to create a $3 \times 3$ contingency table of frequencies and conduct a Pearson $\chi^2$ test of independence with 4 degrees of freedom. The test statistic is the squared differences between observed and expected values based on marginal frequencies of tabular data. The R syntax would be chisq.test(table(dat$rate1, dat$rate2)).

Alternately, for approach number 2, there have been several methods proposed to analyze such data. A perfectly valid test of association for this circumstance is a simple linear regression model treating ordinal values as numeric quantities: 0:low, 1:mid, 2:high and regressing the rate2 variable upon rate1 (or vice versa, depending on the nature of the quesiton). R syntax would require casting these variables to numeric lm(as.numeric(rate2) ~ as.numeric(rate1)) ensuring that levels(rate1) == levels(rate2) and levels(rate1) == c('low', 'mid', 'high').

$\endgroup$
  • $\begingroup$ Wouldn't your option 1 test associations among low, mid, high within a single (or the combined) dataset? What if these are unordered, and the overall association between frequencies of each across datasets is desired? That's how I understood the OP...but I'm suspicious of treating these variables as unordered too. As for that option 2, wouldn't a rank correlation like Kendall's $\tau$ be more perfectly valid? $\endgroup$ – Nick Stauner Feb 27 '14 at 18:41
  • 1
    $\begingroup$ @NickStauner OP mentioned that the results come from merged data, so there should be a 1-1 correspondence between observations. However, the question as stated does not suggest that these data are paired outcome data, but more a traditional predictor/outcome relationship. I too was confused, which is why I prefaced my answer with a nod to agreement as a possible secondary measure. In that case, a kappa or weighted kappa would be preferable. Personally, I disagree rank statistics methods, I think their hypotheses are difficult to state and are often of less power than traditional tests. $\endgroup$ – AdamO Feb 27 '14 at 19:15
  • $\begingroup$ @user3120266 Can you restate your first sentence? I'm lost. $\endgroup$ – AdamO Feb 27 '14 at 19:17
  • $\begingroup$ the merge is on another id variable that they share. This is based on item classification of customers who bought the same item. For example, looking to find the strength of association that items on mid tiers correspond with items on other tiers. $\endgroup$ – user3120266 Feb 27 '14 at 22:13
  • 1
    $\begingroup$ @user3120266 what you claim to want measure makes little sense to me. Are you trying to infer whether, given a product has an average rating of $p$ (based on 0/1/2 codes) that the distribution of ratings are homogeneous among products with similar ratings? Do you have exactly two ratings on each product (n=1700)? Or are you aggregating a number of possible ratings together for products to find the "average rating"? $\endgroup$ – AdamO Feb 27 '14 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.