[R] Re: testing slopes different than a given value

John Fox jfox at mcmaster.ca
Fri Feb 11 17:05:38 CET 2005


Dear Peter,

> -----Original Message-----
> From: Peter Dalgaard [mailto:p.dalgaard at biostat.ku.dk] 
> Sent: Friday, February 11, 2005 8:57 AM
> To: John Fox
> Cc: 'Vito Ricci'; manuel_gutierrez_lopez at yahoo.es; 
> r-help at stat.math.ethz.ch
> Subject: Re: [R] Re: testing slopes different than a given value
> 
> "John Fox" <jfox at mcmaster.ca> writes:
> 
> > Dear Vito,
> > 
> > Since Manuel says that he wants to "obtain a test" and not 
> "obtain two 
> > tests," I assume that he's interested in the F-test for the 
> hypothesis 
> > that both coefficients are simultaneously equal to the specified 
> > values rather than in the t-tests for the individual hypotheses.
> > 
> > Regards,
> >  John
> 
> ...in which case one answer is this:
> 
> >  y<-3+0.6*x1+0.3*x2 + rnorm(100,sd=.1) # as meant, no?
> >  fm<-lm(y~x1+x2)
> >  anova(fm, lm(y~offset(0.6*x1+0.3*x2)))
> Analysis of Variance Table
> 
> Model 1: y ~ x1 + x2
> Model 2: y ~ offset(0.6 * x1 + 0.3 * x2)
>   Res.Df      RSS Df Sum of Sq      F Pr(>F)
> 1     97  1.06118
> 2     99  1.06184 -2  -0.00066 0.0302 0.9703
> 

Indeed, or as I responded yesterday, to use the linear.hypothesis function
in the car package.

Regards,
 John

> 
> 
> -- 
>    O__  ---- Peter Dalgaard             Blegdamsvej 3  
>   c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
>  (*) \(*) -- University of Copenhagen   Denmark      Ph: 
> (+45) 35327918
> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: 
> (+45) 35327907




More information about the R-help mailing list