[R] Test if beta is different from something other than 0

Liaw, Andy andy_liaw at merck.com
Thu Jan 10 16:10:14 CET 2002


More generally, I believe linear.hypothesis in the package `car' can be
used:

linear.hypothesis(lm(y~x), matrix(c(0,1), 1, 2), 1)

[I hope this is the right way to call linear.hypothesis?]

Andy

> -----Original Message-----
> From: Peter Dalgaard BSA [mailto:p.dalgaard at biostat.ku.dk]
> Sent: Thursday, January 10, 2002 9:20 AM
> To: Moffet, Corey
> Cc: 'r-help at stat.math.ethz.ch'
> Subject: Re: [R] Test if beta is different from something other than 0
> 
> 
> "Moffet, Corey" <Corey.Moffet at ttu.edu> writes:
> 
> > Is there a function/package that will allow you to test the 
> hypothesis beta1
> > = x in a
> > simple linear regression, where x is a constant?  The AOV 
> tests if beta1 in
> > different from
> > 0 but what if I want to know if beta1 one is different from 1?
> 
> (Slightly unfortunate choice of variable names there.)
> 
> Say that y are responses and x the *predictor*:
> 
> > x<-1:10 
> > y <- x+rnorm(10)
> > summary(lm(y~x))
> 
> Call:
> lm(formula = y ~ x)
> 
> Residuals:
>     Min      1Q  Median      3Q     Max 
> -2.5600 -0.1918  0.2597  0.4870  1.1106 
> 
> Coefficients:
>             Estimate Std. Error t value Pr(>|t|)    
> (Intercept)  -0.3347     0.7225  -0.463    0.655    
> x             1.0557     0.1164   9.067 1.76e-05 ***
> ---
> Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 
> 
> Residual standard error: 1.058 on 8 degrees of freedom
> Multiple R-Squared: 0.9113,     Adjusted R-squared: 0.9002 
> F-statistic:  82.2 on 1 and 8 DF,  p-value: 1.755e-05 
> 
> > summary(lm(y-x~x))
> 
> Call:
> lm(formula = y - x ~ x)
> 
> Residuals:
>     Min      1Q  Median      3Q     Max 
> -2.5600 -0.1918  0.2597  0.4870  1.1106 
> 
> Coefficients:
>             Estimate Std. Error t value Pr(>|t|)
> (Intercept) -0.33475    0.72250  -0.463    0.655
> x            0.05572    0.11644   0.478    0.645
> 
> Residual standard error: 1.058 on 8 degrees of freedom
> Multiple R-Squared: 0.02782,    Adjusted R-squared: -0.0937 
> F-statistic: 0.229 on 1 and 8 DF,  p-value: 0.6451 
> 
> 
> -- 
>    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
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
> -.-.-.-.-.-.-.-.-
> r-help mailing list -- Read 
http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list