Hi,

I am looking for some tips on how to incorporate known measurement error into 
the comparison of slopes in an analysis of covariance. Specifically, if I 
know that each measurement comes with a 5% error, is it possible to 'expand' 
the confidence intervals around the estimates for the slope of the line 
passing through the data defined by the grouping variable? With standard 
linear regression the confidence intervals are probably too narrow for the 
slope and intercept estimates.

# example data:
# these are measured with error, by an analytical machine

x.1 <- rnorm(100, mean=1, sd=1)
x.2 <- rnorm(100, mean=1, sd=1)
y.1 <- (x.1 / 9) + rnorm(100, mean=0, sd=0.05)
y.2 <- (x.2 / 11) + rnorm(100, mean=0, sd=0.05)

# combine and add group labels
d <- rbind(data.frame(x=x.1, y=y.1), data.frame(x=x.2, y=y.2))
d$id <- gl(n=2, k=100, labels=c('run 1', 'run 2'))

# plot:
library(lattice)
xyplot(y ~ x, data=d, groups=id, type=c('p','r'))

# ANCOVA
summary(l <- lm(y ~ x * id, data=d))

# plot confidence intervals
dotplot(confint(l), col=1, xlab='95% Conf. Int.')

Is there any way to tell if these two populations have different slopes, given 
the measurement errors?

Thanks in advance,
Dylan

-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341

______________________________________________
R-help@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.

Reply via email to