[R] Confidence Intervals for slopes

BXC (Bendix Carstensen) bxc at steno.dk
Mon Mar 29 21:04:15 CEST 2004


You may want:

lm( y ~ x:z )

This is the same model you fitted, but prametrized differently.
But please check that what you REALLY want is not
  
lm( y ~ z + x:z )

This is the model with different intercepts as well.

Bendix Carstensen
----------------------
Bendix Carstensen
Senior Statistician
Steno Diabetes Center
Niels Steensens Vej 2
DK-2820 Gentofte
Denmark
tel: +45 44 43 87 38
mob: +45 30 75 87 38
fax: +45 44 43 07 06
bxc at steno.dk
www.biostat.ku.dk/~bxc
----------------------





> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of David Orme
> Sent: Monday, March 29, 2004 4:44 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Confidence Intervals for slopes
> 
> 
> Hi,
> 
> I'm trying to get confidence intervals to slopes from a linear model 
> and I can't figure out how to get at them. As a cut 'n' paste example:
> 
> #################
> # dummy dataset - regression data for 3 treatments, each 
> treatment with 
> different (normal) variance
> x <- rep(1:10, length=30)
> y <- 10 - (rep(c(0.2,0.5,0.8), each=10)*x)+c(rnorm(10, sd=0.1), 
> rnorm(10, sd=0.6),rnorm(10, sd=1.1))
> z <- gl(3,10)
> plot(y~x, pch=unclass(z))
> 
> # model as three slopes with common intercept
> options(contrasts=c("contr.treatment","contr.poly"))
> model <- lm(y~x+x:z)
> 
> # coefficient table in summary gives the intercept, first 
> slope and the 
> difference in slopes
> summary(model)
> 
> # confint gives the confidence interval for the intercept and first 
> slope,
> # and the CIs for the _differences_
> confint(model)
> #################
> 
> What I'd like to report are the actual CI's for the slopes for the 
> second and third treatments, in the same way that confint returns the 
> parameter estimates for the first treatment. Can anyone point 
> me in the 
> right direction?
> 
> Thanks,
> David
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list 
> https://www.stat.math.ethz.ch/mailman/listinfo> /r-help
> PLEASE 
> do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list