l0 <- lm(Sepal.Length ~ Sepal.Width,iris)
summary(l0)
tt <- tablefreq(iris[,1:2])
lf <- lmfreq(Sepal.Length ~ Sepal.Width,tt)
summary(lf)
all.equal(coef(lf),coef(l0))
all.equal(AIC(lf),AIC(l0))
newdata <- data.frame(Sepal.Width=c(1,NA,7))
predict(lf, newdata)
if(require(MASS)){
stepAIC(lf)
}
Run the code above in your browser using DataLab