# load 'gammi' package
library(gammi)
# load data
data(exam)
# header of data
head(exam)
# fit model
mod <- gammi(Exam.score ~ VRQ.score, data = exam,
random = ~ (1 | Primary.school) + (1 | Secondary.school))
# plot terms
plot(mod)
# refit model with Secondary.school as penalized nominal effect
mod <- gammi(Exam.score ~ Secondary.school + VRQ.score, data = exam,
random = ~ (1 | Primary.school))
# plot terms
plot(mod)
Run the code above in your browser using DataLab