# Stats are giving me a headache, stat!

January 29, 2010 7:25 PM Subscribe

Need help with stats and/or SAS (or your favorite free stats package).

I'm trying to run an analysis and having some trouble 1) figuring out exactly what sort of analysis I want to be running and 2) how to code it up in SAS or some other (free) stat package.

Here's the deal. So this isn't precisely the situation but it is analgous. You have a group of subjects and you are looking at their performance on a task (dependent variable), as you vary two things, what they drink (beer or coffee) and how much they drink (a little, medium amount, or a lot), so that you have 6 conditions: a little beer, med beer, a lot beer, little coffee med coffee med beer. Each subject's performance is measured for each condition, so you have a within subject comparison on drink type and drink amount (right?). I know I need to do an ANOVA to get this information out (with some post-hoc t-tests to follow up) to look for a main effect of drink, a main effect of amount, and an interaction between them. I also want to see if there is an effect of amount of drink for each drink type, and an effect of drink type for each amount.

Here's where I get a bit lost 1) should I be using a random or fixed effects model and 2) is this a repeated measures ANOVA?

Using SAS, I know how to do a ANOVA and look for the main effects and interaction effects above (but not the effect of amount for each type), but I don't know how to do a within subject or repeat measure ANOVA and what I found on the internets was not really helping make more sense. Also I don't know how fixed and random effects plays into that and how to vary my SAS code to reflect that. I'm open to using a different statistical package than SAS, but I have never used R and don't have access to SPSS.

Any help you could give I would appreciate!

I'm trying to run an analysis and having some trouble 1) figuring out exactly what sort of analysis I want to be running and 2) how to code it up in SAS or some other (free) stat package.

Here's the deal. So this isn't precisely the situation but it is analgous. You have a group of subjects and you are looking at their performance on a task (dependent variable), as you vary two things, what they drink (beer or coffee) and how much they drink (a little, medium amount, or a lot), so that you have 6 conditions: a little beer, med beer, a lot beer, little coffee med coffee med beer. Each subject's performance is measured for each condition, so you have a within subject comparison on drink type and drink amount (right?). I know I need to do an ANOVA to get this information out (with some post-hoc t-tests to follow up) to look for a main effect of drink, a main effect of amount, and an interaction between them. I also want to see if there is an effect of amount of drink for each drink type, and an effect of drink type for each amount.

Here's where I get a bit lost 1) should I be using a random or fixed effects model and 2) is this a repeated measures ANOVA?

Using SAS, I know how to do a ANOVA and look for the main effects and interaction effects above (but not the effect of amount for each type), but I don't know how to do a within subject or repeat measure ANOVA and what I found on the internets was not really helping make more sense. Also I don't know how fixed and random effects plays into that and how to vary my SAS code to reflect that. I'm open to using a different statistical package than SAS, but I have never used R and don't have access to SPSS.

Any help you could give I would appreciate!

Response by poster: that's what I thought (this is psychology, not economy, so random fits better. However, the link you gave for SAS is the one I wasworking off of and was confused. At least I know I'm on the right track I guess.

posted by katers890 at 3:50 AM on January 30, 2010

posted by katers890 at 3:50 AM on January 30, 2010

I'd code this as regression instead of ANOVA, because regression is easier for most people to understand and do model checking on.

Depending on the sample size, I'd probably fit the fixed effects model. You aren't interested in the population that the subjects come from. The interaction model isn't saturated, and if the factors are ordered (like the amount of drink) you can get even more residual df. I have no a-priori confidence in the distributional assumption for the random effects.

You can code the random / fixed model up in proc mixed easily.

Either

proc mixed data=MYDATA;

title2 "Fixed effects" ;

class id drink_type;

model outcome = id drink_type*drink_amount / s CL;

run;

or

proc mixed data=MYDATA;

title2 "random effects" ;

class id drink_type;

model outcome = drink_type*drink_amount / s CL;

random intercept / subject=id s CL;

run;

I'd also think about the order that experiments were done in, since often times that's easy to ignore.

posted by a robot made out of meat at 11:47 AM on January 30, 2010

Depending on the sample size, I'd probably fit the fixed effects model. You aren't interested in the population that the subjects come from. The interaction model isn't saturated, and if the factors are ordered (like the amount of drink) you can get even more residual df. I have no a-priori confidence in the distributional assumption for the random effects.

You can code the random / fixed model up in proc mixed easily.

Either

proc mixed data=MYDATA;

title2 "Fixed effects" ;

class id drink_type;

model outcome = id drink_type*drink_amount / s CL;

run;

or

proc mixed data=MYDATA;

title2 "random effects" ;

class id drink_type;

model outcome = drink_type*drink_amount / s CL;

random intercept / subject=id s CL;

run;

I'd also think about the order that experiments were done in, since often times that's easy to ignore.

posted by a robot made out of meat at 11:47 AM on January 30, 2010

This thread is closed to new comments.

(2) You can use a repeated measures ANOVA to analyze these data because you've collected the same set of observations from every participant, i.e., your data comes from a 2x3 within-subjects experimental design. I'm not a SAS person, but it looks like UCLA has a pretty good tutorial for running this mode: http://www.ats.ucla.edu/stat/SAS/library/repeated_ut.htm. If you decide to use R, there are lots of tutorials available (e.g., http://www.personality-project.org/R/r.anova.html).

posted by eisenkr at 8:52 PM on January 29, 2010