DATA ANALYSIS TOOLS WEEK 4 ASSIGNMENT: Testing a Potential Moderator
For the final assignment, I decided to run an Anova using the DIET_EXERCISE dataset, for the sole reason that it is the onlly data set with a variable that can be used as a moderator that has limited number of values (categorical).
The code I run can be seen below, and you can copy and paste it on SAS Code tab to make sure it works.
/*
*
* Task code generated by SAS Studio 3.5
*
* Generated on ’24/1/17 – 4:35 μ.μ.’
* Generated by ‘epanagiotopoulo0’
* Generated on server ‘ODAWS02.ODA.SAS.COM’
* Generated on SAS platform ‘Linux LIN X64 3.10.0-514.2.2.el7.x86_64’
* Generated on SAS version ‘9.04.01M3P06242015’
* Generated on browser ‘Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0’
* Generated on web client ‘https://odamid.oda.sas.com/SASStudio/main?locale=el_GR&zone=GMT%252B02%253A00&https%3A%2F%2Fodamid.oda.sas.com%2FSASStudio%2F=’
*
*/
ods noproctitle;
ods graphics / imagemap=on;
proc glm data=_TEMP0.DIET_EXERCISE;
class Exercise Diet;
model WeightLoss=Exercise Diet Exercise*Diet / ss1 ss3;
lsmeans Exercise*Diet / adjust=tukey pdiff=all alpha=0.05 cl;
quit;
You can see that all of the observations have been used for this analysis.
The f value is 106.19 and is associated with a significant p value. That is, a p value less than .05. While this tells us there is a significant association between diet type and weight loss, to understand that association we need to look at the output generated by the mean statement.
Here we show the finding graphically, as bar chart, with diet, the explanatory variable on the x-axis. And the mean weight loss, our response variable on the y axis. We see that the average one month weight loss for diet A is about 14.7 pounds. And that the average one month weight loss for diet B is about 9.3 pounds.
Here, these results are shown graphically. As you can see, the relationship between diet and weight loss depends on which exercise program is being used. When using cardio, diet A is significantly better for weight loss than diet B. When using weights, diet B is significantly better for weight loss than diet A. Thus, we can say there’s a significant statistical interaction between the variables diet and weight loss. And the type of exercise, our third variable, moderates the association between diet and weigh loss.