## Load the data airlinesData <- read.table("Table16_1.csv", header = TRUE) ###---------------------------------------------------------------------------- ### The fixed effect model ###---------------------------------------------------------------------------- ## You can create dummies and estimate the model with OLS ## Or we do it in with lm() airlinesFixed <- lm(C~ factor(I) + Q + PF + LF, data = airlinesData) summary(airlinesFixed) AIC(airlinesFixed) airlinesFixed2 <- lm(C~ Q + PF + LF, data = airlinesData) AIC(airlinesFixed2) ###---------------------------------------------------------------------------- ### The random effect model ###---------------------------------------------------------------------------- ## Install the package (you need Internet connection) ## install.packages("nlme") ## Load the package require(nlme) ## The random effect model airlinesRandom <- lme(C~ Q + PF + LF, random = ~ 1|I, data = airlinesData) summary(airlinesRandom)