Sunday, October 7, 2012
ANOVAs and MANOVAs
# Anova's are frequently used in experimental setting when treatments is a categorical value and there are one or more response variables. Rather than testing the statistical significance of each categorical value with respect to the response variable. We instead test the joint significance.
# Let's see how this works.
# Imagine we are a pharmaceutical company and would like see is the effect on sleep of three different drug combinations at three different levels each.
# In order to test each level for all of the drug combinations we would have 27 combinations. If we tested the individual significance of each combination then without adjusting the alpha value we would over-reject far too many times.
# Let's say each of our subjects on average sleeps a number of hours as a random draw from the poisson distribution.
base.sleep = rpois(1000,8)
sleep.hrs = base.sleep+asbermatimitite/5-zugrimiitosoite/2.5+crealitotiserite*0
# Let's say the most frequent side effect of these drugs is drowsiness. We would also like to know the effect of the drugs on drowsiness levels.
base.drowsiness = runif(1000)
drowsiness = base.drowsiness + asbermatimitite*.01 + zugrimiitosoite*.02 - crealitotiserite*.01
# From this setup we can see that crelitotiserite does not actually increase sleep but does reduce drowsiness.
boxplot(sleep.hrs ~ asbermatimitite+zugrimiitosoite+crelitotiserite, horizontal = T, main="# of hours slept", ylab="Asbermatimitite.ZugrimiitosoiteCcrelitotiserite (Mg)")
# From the box plot it is clear there is movements in the means as the explanatory variables changes. Other that that general statement I am no sure how else to read the grpah.
boxplot(drowsiness ~ asbermatimitite+zugrimiitosoite+crelitotiserite, horizontal = T, main="Self reported drowsiness", ylab="Asbermatimitite.Zugrimiitosoite.Crelitotiserite (Mg)")
# Likewise with drowsiness levels. There is movement but it is hard to tell where and why.
man <- manova(cbind(sleep.hrs,drowsiness)~asbermatimitite+zugrimiitosoite+crelitotiserite)
# This will save the results of the manova in the list called man.
# We can see that all of the explanatory variables are significant. crelitotiserite less so than the other two. Unlike regression analysis we do not know what to do with this information now. All we can say is that given random treatment there are differences in one or more of the dependent variables as a result of the different levels of treatment I next logical approach would be to attempt to estimate the form of the effects. If one of the variables was not significant then it might have been reasonably dropped from the analysis.