[R] Calculating confidence limits for the difference between means

Kingsford Jones kingsfordjones at gmail.com
Thu Oct 23 20:37:25 CEST 2008


On Wed, Oct 22, 2008 at 11:09 AM, Dennis Fisher <fisher at plessthan.com> wrote:
> Colleagues,
>
> I am working on a problem at the edge of my knowledge of statistics.
>
> Basically, I have values for two groups - I am trying to calculate the
> 90% confidence limits for the difference between means.  I can
> implement this without difficulty based on standard equations that are
> available in stat textbooks: (difference between means) / (pooled
> standard error)
>
> My problem arises when I try to correct for the value of a covariate.
> I can do the ANOVA with the covariate as a factor.  But, I don't know
> how to use the output to obtain the confidence limits of the difference.


Generally 'factor' refers to qualitative variables and 'covariate' to
quantitative, but if you are looking to estimate the difference in two
means using an ANCOVA perhaps something like...

fit <- lm(y ~ trt + covar) # trt is a 2-level factor and covar is quantitative
confint(fit, level = .90)

hth,

Kingsford Jones


>
> I suspect that several participants in this board have implemented
> code to so this.  I hope that someone is willing to share the code.
>
> Thanks in advance.
>
> Dennis
>
>
> Dennis Fisher MD
> P < (The "P Less Than" Company)
> Phone: 1-866-PLessThan (1-866-753-7784)
> Fax: 1-415-564-2220
> www.PLessThan.com
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list