[R] simple test on slope of lm()
Yves Brostaux
brostaux.y at fsagx.ac.be
Mon Nov 25 09:32:06 CET 2002
Hello,
To test the slope of your linear model against an arbitrary value, you can
use lm() directly with a little trick. Let b1 be the value of the slope you
want to test your model against, then use lm(y-b1*x~x). The significance
test of the slope for this lm model gives the answer you need.
> x <- rnorm(10)
> y <- 2*x + rnorm(10)
> lm(y~x)
> lm(y-2*x~x)
Hope this helped,
Yves Brostaux.
At 04:01 23/11/02, you wrote:
>Date: Fri, 22 Nov 2002 22:08:43 +0100
>From: Fred JEAN <frederic.jean at univ-brest.fr>
>Subject: [R] simple test on slope of lm()
>
>Hello
>
>I want to compare the slope (let's say 'b') of a linear model obtained
>with lm() to a theoretical value (let's say 'th').
>
>To do so, I think I should compute a 't value' using
>something like :
>
>(b - 'th')/standard.deviation(b)
>
>and then look at the p-value of this computed t.
>
>I don't understand how to do this in a simple way, just using lm()
>outputs for example.
>
>I'm sorry of such a naive/newbie question, and thank you so much for
>taking time to answer.
>
>Fred
--
Ir. Yves Brostaux - Statistics and Computer Science Dpt.
Gembloux Agricultural University
8, avenue de la Faculté B-5030 Gembloux (Belgium)
Tél : +32 (0)81 62 24 69
E-mail : brostaux.y at fsagx.ac.be
Web : http://www.fsagx.ac.be/si/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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