[R] testing diff for slopes and intercepts

John Fox jfox at mcmaster.ca
Mon Oct 8 19:35:23 CEST 2001


Dear Bill,

At 11:58 AM 08/10/2001 +0100, Bill Simpson wrote:
>I fit the model
>
>fit<-lm(thresh~cond*Ne)
>where
>thresh is the reponse
>cond is a factor with levels a, b, and c
>Ne is a continuous indep var
>
>I think of this full model as having three lines: thresh as a function of
>Ne for each condition. Thus we have slopea, slopeb, slopec, inta, intb,
>intc.
>lm output       my params
>-------------------------
>(Intercept)   inta
>condb         intb - inta
>condc         intc - inta
>Ne            slopea
>condb:Ne      slopeb - slopea
>condc:Ne      slopec - slopea
>
>This parametrization automatically compares
>inta vs intb
>inta vs intc
>But how to get test for diff of intb vs intc?
>
>Same question for slope: I already have
>slopea vs slopeb
>slopea vs slopec
>But how to get test for diff of slopeb vs slopec?
>
>Thanks for any help.

Using the covariance matrix for the coefficients and the 
coefficient-estimates, you can test the linear hypotheses that condb - 
condc = 0, and condb:Ne - condc:Ne = 0. The linear.hypothesis function in 
the car package does this, but it's also not hard to work directly with the 
estimates and their covariance matrix. An alternative (producing the same 
test) is to refit the model, reparametrizing to set a different baseline 
category for the factor.

Finally, by doing these additional tests, you're using up more df than you 
have for comparisons among slopes and among intercepts. You might consider 
adjusting the tests for simultaneous inference.

John


-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
-----------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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