big20 <- read.fwf("http://www.stat.ufl.edu/~winner/sta6208/reg_ex/big20_air_samp.prn", width=c(3,8,13,8,8), col.names=c("city1", "city2", "market", "revenue", "year")) attach(big20) market <- factor(market) library(nlme) big20.rcr <- lme(log(revenue)~year,random=~year|market, control=lmeControl(opt="optim")) summary(big20.rcr) random.effects(big20.rcr) library(lmerTest) big20.rcr1 <- lmer(log(revenue)~year + (year|market) summary(big20.rcr1) ranef(big20.rcr1)