[R] Standard deviation from MANOVA??
BrutishFruit
brutishfruit at hotmail.com
Tue Aug 28 21:44:13 CEST 2012
Thanks for all help so far!
And I seems as you are correct Peter (and Jean too).
And I have now investigated and found how it is connected with the standard
errors:
If use the following code (taking from Jeans example code), where we have
one manova and two individual models (continue read comments in code):
# ------- code starts -------- #
mydata <- data.frame(y1=rnorm(50), y2=rnorm(50), x1=rnorm(50),
x2=rnorm(50), x3=rnorm(50))
myfit <- manova(cbind(y1, y2) ~ x1 + x2 + x3, data=mydata)
myfit1 <- lm(y1 ~ x1 + x2 + x3, data=mydata)
myfit2 <- lm(y2 ~ x1 + x2 + x3, data=mydata)
# And then gets the standard error for each of the three models:
stderr <- predict.lm(myfit, type="response", se.fit=TRUE)[[2]]
stderr1 <- predict.lm(myfit1, type="response", se.fit=TRUE)[[2]]
stderr2 <- predict.lm(myfit2, type="response", se.fit=TRUE)[[2]]
# Will we get that stderr = sqrt(stderr1^2+stderr2^2)
print(cbind(stderr,sqrt(stderr1^2 + stderr2^2)))
# ------- code ends -------- #
So, the reason why the output only gave one standard error when I was
writing:
“But if I type: predict.lm(myfit, type="response", se.fit=TRUE)
I get the predicted values and standard deviation, but only for y1 (and
nothing from y2...). “
was because the output gave the combined error for both y1 and y2 by using
the following formula:
sqrt(stderr1^2 + stderr2^2). So it wasn't standard error for just y1 as I
thought.
You can test the provided code above and see that relationship is as
described.
So then my problem is solved as I can get the individual standard error for
y1 and y2. Even if I don’t understand how you could/should use the combined
standard error you get from the manova model (myfit)…
//BF
Mattias Siljestam
Uppsala University
--
View this message in context: http://r.789695.n4.nabble.com/Standard-deviation-from-MANOVA-tp4641322p4641622.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list