data(eqslo)
eqsloObj <- sla(eqslo)
eqsloObj
summary(eqsloObj)
attributes(eqsloObj)
eqsloObj$Mod.C # best fitting reduced model, equivalent slopes, different intercepts
summary(eqsloObj$Mod.C) # lm summary of Model C
plot(eqsloObj, mod = 'C') # plot of data eqslo, fitted lines with equal slopes, different intercepts
##
data(eqint)
eqintObj <- sla(eqint)
eqintObj
summary(eqintObj)
attributes(eqintObj)
eqintObj$Mod.D # best fitting reduced model, equivalent intercepts, different slopes
summary(eqintObj$Mod.D) # lm summary of Model D
plot(eqintObj, mod = 'D') # plot of data eqint, fitted lines with equal intercepts, different slopes
##
## See MASS, 4th ed., pp 139-144 for ANCOVA of whiteside data
##
library(MASS)
data(whiteside)
whitesideObj <- sla(whiteside)
summary(whitesideObj) # See MASS, 4th ed., pp 139-144 for ANCOVA of whiteside data
par(mfrow = c(2,2))
plot(whitesideObj, "A") # different intercepts and different slopes
plot(whitesideObj, "B") # common intercept and common slope
plot(whitesideObj, "C") # different intercepts, common slope
plot(whitesideObj, "D") # different slopes, common intercept
##
## See Dalgaard, pp. 172-182 for ANCOVA of (log10) hellung data
##
data(hellunglog)
hellunglogObj <- sla(hellunglog)
hellunglogObj
summary(hellunglogObj) # See Dalgaard, pp. 172-182 for ANCOVA of (log10) hellung data
par(mfrow = c(2,2))
plot(hellunglogObj, "A") # different intercepts and different slopes
plot(hellunglogObj, "B") # common intercept and common slope
plot(hellunglogObj, "C") # different intercepts, common slope
plot(hellunglogObj, "D") # different slopes, common intercept
##
## Simulate data for common slope, different intercepts
##
group <- c(rep('A', 50), rep('B', 50))
x <- rep(1:50, 2)
set.seed(50) #
y1 <- rnorm(50) + 4*.05*x[1:50]
set.seed(100)
y2 <- rnorm(50) + 7 + y1
y <- c(y1, y2)
esdf <- data.frame(group, x, y)
esdfObj <- sla(esdf)
esdfObj
summary(esdfObj)
par(mfrow = c(2,2))
plot(esdfObj, mod = 'A')
plot(esdfObj, mod = 'B')
plot(esdfObj, mod = 'C')
plot(esdfObj, mod = 'D')
##
## Simulate data for common intercept, different slopes
##
group <- c(rep('A', 50), rep('B', 50))
x <- rep(1:50, 2)
set.seed(49) #
y1 <- rnorm(50) + 1*.03*x[1:50]
set.seed(99) #
y2 <- rnorm(50) + 1*.25*x[51:100]
y <- c(y1, y2)
eidf <- data.frame(group, x, y)
eidfObj <- sla(eidf)
eidfObj
summary(eidfObj)
par(mfrow = c(2,2))
plot(eidfObj, mod = 'A')
plot(eidfObj, mod = 'B')
plot(eidfObj, mod = 'C')
plot(eidfObj, mod = 'D')
Run the code above in your browser using DataLab