nlschools package:MASS R Documentation _E_i_g_h_t_h-_G_r_a_d_e _P_u_p_i_l_s _i_n _t_h_e _N_e_t_h_e_r_l_a_n_d_s _D_e_s_c_r_i_p_t_i_o_n: Snijders and Bosker (1999) use as a running example a study of 2287 eighth-grade pupils (aged about 11) in 132 classes in 131 schools in the Netherlands. Only the variables used in our examples are supplied. _U_s_a_g_e: nlschools _F_o_r_m_a_t: This data frame contains 2287 rows and the following columns: '_l_a_n_g' language test score. '_I_Q' verbal IQ. '_c_l_a_s_s' class ID. '_G_S' class size: number of eighth-grade pupils recorded in the class (there may be others: see 'COMB', and some may have been omitted with missing values). '_S_E_S' social-economic status of pupil's family. '_C_O_M_B' were the pupils taught in a multi-grade class ('0/1')? Classes which contained pupils from grades 7 and 8 are coded '1', but only eighth-graders were tested. _S_o_u_r_c_e: Snijders, T. A. B. and Bosker, R. J. (1999) _Multilevel Analysis. An Introduction to Basic and Advanced Multilevel Modelling._ London: Sage. _R_e_f_e_r_e_n_c_e_s: Venables, W. N. and Ripley, B. D. (2002) _Modern Applied Statistics with S._ Fourth edition. Springer. _E_x_a_m_p_l_e_s: library(nlme) nl1 <- nlschools attach(nl1) classMeans <- tapply(IQ, class, mean) nl1$IQave <- classMeans[as.character(class)] nl1$IQ <- nl1$IQ - nl1$IQave detach() cen <- c("IQ", "IQave", "SES") nl1[cen] <- scale(nl1[cen], center = TRUE, scale = FALSE) nl.lme <- lme(lang ~ IQ*COMB + IQave + SES, random = ~ IQ | class, data = nl1) summary(nl.lme)