[R] Confidence Intervals for slopes

Andrew Robinson andrewr at uidaho.edu
Mon Mar 29 17:36:10 CEST 2004


David,

try the estimable() function in the gregmisc package.

Andrew

On Monday 29 March 2004 06:44, David Orme wrote:
> 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

-- 
Andrew Robinson                      Ph: 208 885 7115
Department of Forest Resources       Fa: 208 885 6226
University of Idaho                  E : andrewr at uidaho.edu
PO Box 441133                        W : http://www.uidaho.edu/~andrewr
Moscow ID 83843                      Or: http://www.biometrics.uidaho.edu
No statement above necessarily represents my employer's opinion.




More information about the R-help mailing list