Re: [R] summary(object, test=c("Roy", "Wilks", "Pillai", ....) AND ellipse(object, center=....)

From: Michael Friendly <friendly_at_yorku.ca>
Date: Sun, 06 Apr 2008 18:48:31 -0400

You may be interested in the heplots package for multivariate linear models. For a multivariate regression, it plots a data ellipse of the predicted values (H matrix) together with a data ellipse of the residuals (E ellipse). H is scaled so that it protrudes outside the E ellipse iff the hypothesis is significant by Roy's test.

-Michael

Ray Haraf wrote:
> 2). My next struggle is to construct prediction ellipse. Both ellipse() and ellipse.lm() are not giving me the solution to "Sampling from multivariate multiple regression prediction regions" posted by Iain Pardoe, Mon May 9 18:43:46 2005. I am working on the same problem and performed all the steps he suggested
>

>> ex7.10 <- 

> + data.frame(y1 = c(141.5, 168.9, 154.8, 146.5, 172.8, 160.1, 108.5),
> + y2 = c(301.8, 396.1, 328.2, 307.4, 362.4, 369.5, 229.1),
> + z1 = c(123.5, 146.1, 133.9, 128.5, 151.5, 136.2, 92),
> + z2 = c(2.108, 9.213, 1.905, .815, 1.061, 8.603, 1.125))
>> attach(ex7.10) 
>> f.mlm <- lm(cbind(y1,y2)~z1+z2) 
>> y.hat <- c(1, 130, 7.5) %*% coef(f.mlm) 
>> round(y.hat, 2) 

> y1 y2
> [1,] 151.84 349.63
>> qf.z <- t(c(1, 130, 7.5)) %*% 

> + solve(t(cbind(1,z1,z2)) %*% cbind(1,z1,z2)) %*%
> + c(1, 130, 7.5)
>> round(qf.z, 5) 

> [,1]
> [1,] 0.36995
>> n.sigma.hat <- SSD(f.mlm)$SSD # same as t(resid(f.mlm)) %*%resid(f.mlm) 
>> round(n.sigma.hat, 2) 

> y1 y2
> y1 5.80 5.22
> y2 5.22 12.57
>> F.quant <- qf(.95,2,3) 
>> round(F.quant, 2) 

> [1] 9.55
>
>
>>From here how could I calculate a 95% prediction ellipse for y=(y1,y2) at (z1,z2)=(130,7.5) using either ellipse or ellipse.lm? y1 would be the x-axis and y2, the y-axis. The center is different from (0,0) and I don't know what would be the appropriate x (the lm object). Should I used predicted values or residuals? In both cases I have vectors which is different from the example given with ellipse.lm

>
> 3). Lastly but not the least, would be too ambitious to draw the axes (i.e, the eigenvalues) to the ellipse?
>
> Thanks and very kind regards,
> Ray
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sun 06 Apr 2008 - 22:55:23 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 06 Apr 2008 - 23:30:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive