Displaying 1 result from an estimated 1 matches for "bydata".
Did you mean:
mydata
2013 Jan 17
3
Colors in interaction plots
...nce <- read.csv("http://www.ats.ucla.edu/stat/r/examples/alda/data/tolerance1.txt")
tolerance.pp <-
read.csv("http://www.ats.ucla.edu/stat/r/examples/alda/data/tolerance1_pp.txt")
attach(tolerance.pp)
# fitting the linear model by id
fit <- by(tolerance.pp, id, function(bydata)
fitted.values(lm(tolerance ~ time, data=bydata)))
fit <- unlist(fit)
# plotting the linear fit by id
interaction.plot(age, id, fit, xlab="age", ylab="tolerance")
# plots red for female and green for male
interaction.plot(age, id, fit, xlab="age", ylab="toler...