From: John Fox <jfox_at_mcmaster.ca>

Date: Sat, 07 Jun 2008 20:12:42 -0400

John Fox, Professor

Department of Sociology

McMaster University

Hamilton, Ontario, Canada

web: socserv.mcmaster.ca/jfox

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 08 Jun 2008 - 00:19:56 GMT

Date: Sat, 07 Jun 2008 20:12:42 -0400

Dear Christoph,

To answer your question directly, F statistics are ratios of mean squares, not of sums of squares. You have to divide the hypothesis and error sums of squares by their respective degrees of freedom to form the mean squares before computing the F statistic for each test. Assuming that x is a quantitative variable (not a factor), the error (denominator) df will be 78 = 80 - 2 and the df for each hypothesis (numerator df) will be 1.

That said, there are a couple of things that you said that trouble me: First, you mention that you scaled the response variables to [0, 1], but that doesn't imply that the variables are on the same scale in any meaningful sense, possibly rendering the hypotheses uninterpretable. Second, you have 7 responses variables but only 4 hypotheses. You aren't therefore using all 6 df for differences among the responses (not necessarily a problem), but you apparently ignore the last response variable entirely (which almost surely doesn't make sense).

Regards,

John

John Fox, Professor

Department of Sociology

McMaster University

Hamilton, Ontario, Canada

web: socserv.mcmaster.ca/jfox

> -----Original Message-----

*> From: r-help-bounces_at_r-project.org [mailto:r-help-bounces_at_r-project.org]
*

On

*> Behalf Of Dr. Christoph Scherber
**> Sent: June-07-08 4:39 PM
**> To: r-help_at_r-project.org
**> Subject: [R] Multivariate LM: calculating F-values after calling
**> linear.hypothesis
**>
*

> Dear R users,

*>
**> I am analyzing several response variables (all scaled to [0;1]) using a
**> multivariate linear model.
**>
**> After fitting the model, I set up a hypothesis matrix to test specific
**> contrasts for these response variables; for example: "a always increases
**> significantly more than b when regressed against x".
**>
**> What I am stuck with now is how to calculate the correct F-values (and
**> against how many d.f. to test them) after calling linear.hypothesis from
**> the car package:
**>
**> (assuming there are 80 observations)
**>
**> ##
**>
**> mult=lm(cbind(a,b,c,d,e,f,g)~x)
**>
**> summary(mult)
**> library(car)
**>
**> P <- cbind(
**> c(-1,1,0,0,0,0,0),
**> c(-3,-3,6,6,-3,-3,0),
**> c(0,0,2,0,-1,-1,0),
**> c(0,0,-1,0,1,0,0))
**>
**> P
**> [,1] [,2] [,3]
**> [1,] -1 -3 0
**> [2,] 1 -3 0
**> [3,] 0 6 2
**> [4,] 0 6 0
**> [5,] 0 -3 -1
**> [6,] 0 -3 -1
**> [7,] 0 0 0
**>
**> summary(mult)
**>
**> linhyp=linear.hypothesis(mult, "x", P=P)
**>
**> linhyp
**>
**> Response transformation matrix:
**> [,1] [,2] [,3] [,4]
**> [1,] -1 -3 0 0
**> [2,] 1 -3 0 0
**> [3,] 0 6 2 -1
**> [4,] 0 6 0 0
**> [5,] 0 -3 -1 1
**> [6,] 0 -3 -1 0
**> [7,] 0 0 0 0
**>
**> Sum of squares and products for the hypothesis:
**> [,1] [,2] [,3] [,4]
**> [1,] 0.06744438 -2.065499 -0.5790014 0.3233393
**> [2,] -2.06549912 63.256374 17.7320486 -9.9023380
**> [3,] -0.57900143 17.732049 4.9706540 -2.7758268
**> [4,] 0.32333928 -9.902338 -2.7758268 1.5501410
**>
**> Sum of squares and products for error:
**> [,1] [,2] [,3] [,4]
**> [1,] 4.4957632 1.084781 2.196134 -0.7621832
**> [2,] 1.0847809 173.494183 20.425963 -7.7303319
**> [3,] 2.1961336 20.425963 8.584237 -3.8182268
**> [4,] -0.7621832 -7.730332 -3.818227 2.3045286
**>
**>
**> 1-pf(diag(linhyp2$SSPH)/diag(linhyp2$SSPE),1,79)
**> 1-pt(sqrt(diag(linhyp2$SSPH)/diag(linhyp2$SSPE)),79)
**>
**> ##
**>
**> The last two lines of code are what I am stuck with; I thought using
**> diag() on the SSPH and SSPE matrices should give me the sums of squares
**> for hypothesis and error; so division should yield the F values?
**>
**> I would be most grateful for any help!
**>
**> Best wishes
**> Christoph
**>
**>
**>
**>
**>
**> --
**> Dr. Christoph Scherber
**> University of Goettingen
**> DNPW, Agroecology
**> Waldweg 26
**> D-37073 Goettingen, Germany
**> www.gwdg.de/~cscherb1
**>
**> ______________________________________________
**> 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 08 Jun 2008 - 00:19:56 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 08 Jun 2008 - 03:30:43 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.
*