Skip to content

Standard deviation from MANOVA??

6 messages · BrutishFruit, Jean V Adams, David Winsemius +1 more

#
Hi,
I have problem getting the standard deviation from the manova output.

I have used the manova function:          myfit <- manova(cbind(y1, y2) ~ x1
+ x2 + x3, data=mydata) .
I tried to get the predicted values and their standard deviation by using:         
predict(myfit, type="response", se.fit=TRUE)

But the problem is that I don't get the standard deviation values, I only
get the predicted values for y1 and y2.

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...).

//BF



--
View this message in context: http://r.789695.n4.nabble.com/Standard-deviation-from-MANOVA-tp4641322.html
Sent from the R help mailing list archive at Nabble.com.
1 day later
#
On Aug 27, 2012, at 6:37 AM, Jean V Adams wrote:

            
I'm guessing this was supposed to be:
   myfit2 <- lm(y2 ~ x1 + x2 + x3, data=mydata)
I suppose it is possible that what was desired were the standard  
errors around the fitted mean estimates (which I think is what this  
would deliver), but what was asked were for "standard deviations". I  
admit to being puzzled that `manova` was being thought of as a method,  
since the sample or population standard deviations should be derived  
from three applications of `tapply`. I think BruitishFruit should tell  
us what he means by "... don't get the standard deviation values" in  
sufficient detail that we get an unambiguous description what  
"standard deviations" are being requested. (Or he can pose a small  
test case with the "correct answer".)
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
#
Hi David.
I mean that I want to get the *standard error of the predicted means* (which
is a type standard deviation, if I have understand everything right), which
the se.fit switch mentioned above should require from the "predict()"
function.
But the se.fit switch doesn't seem to work for manova object for some
reason, which is my problem.

Thanks for a suggestion of solution Jean.
But i don't think that the standard error for the individual models will be
the same as for the manova model.



--
View this message in context: http://r.789695.n4.nabble.com/Standard-deviation-from-MANOVA-tp4641322p4641441.html
Sent from the R help mailing list archive at Nabble.com.
#
On Aug 27, 2012, at 19:15 , BrutishFruit wrote:

            
I suspect that they actually are the same, at least until you start messing with patterned covariance matrices or different models for different responses. Check the theory, though!
#
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.