Data source: Harris, Kathleen Mullan, and Udry, J. Richard. National Longitudinal Study of Adolescent to Adult Health (Add Health), 1994-2008 [Public Use]. Carolina Population Center, University of North Carolina-Chapel Hill [distributor], Inter-university Consortium for Political and Social Research [distributor], 2018-08-06. https://doi.org/10.3886/ICPSR21600.v21

Data for this analysis was downloaded from : https://dataverse.unc.edu/dataverse/addhealth

Data Management

Load Packages

library(haven)
library(dplyr)
library(tidyr)
library(psych)
library(table1)
library(nlme)
library(lmerTest)

Import add health data

dat_context <- read_sas('AddHealthEP964/w1context.sas7bdat')
dat_inhome <- read_sas('AddHealthEP964/w1inhome.sas7bdat')
dat_weight <- read_sas('AddHealthEP964/w1weight.sas7bdat')

Select variables we want and merge into one dataset

cols_1 <- c("AID", #student id
            paste0("H1FS", 1:19), # emotional problems 
            "PA56", #enough money to pay bill 
            paste0("PA57", LETTERS[1:6])) #access to 6 types of safety net programs
dat_1 <- dat_inhome[, cols_1]

cols_2 <- c("AID", 
            "BST90P01", #urbanity
            "BST90P02", #modal race in the census tract (CZ)
            "BST90P04", #% of hispanic by low, medium, high in the CZ
            "BST90P15", # median household income ($) in the census tract
            "BST90P19", #% persons living in poverty by low, medium, high in the CZ
            "BST90P23", #% unemployment by low, medium, high in the CZ
            "BST90P26", #tenue of housing by three levels in the CZ
            "BST90P20") #education by three levels in the CZ
dat_2 <- dat_context[, cols_2]

dat <- merge(merge(dat_1, dat_2, by = "AID", all = TRUE), dat_weight, by = "AID", all = TRUE)

Adjust for missingness and recode items

dat[, paste0("H1FS", 1:19)][dat[, paste0("H1FS", 1:19)] > 3 | dat[, paste0("H1FS", 1:19)] < 0] <- NA # Replace values greater than 3 or less than 0 with NA
sum(is.na(dat[, paste0("H1FS", 1:19)])) # Total number of NA
## [1] 370
(row_na <- sum(apply(dat[, paste0("H1FS", 1:19)], 1, function(x) any(is.na(x))))) # Total number of rows with at least 1 NA
## [1] 47
dat[, "H1FS4"] <- 3-dat[, "H1FS4"] 
dat[, "H1FS8"] <- 3-dat[, "H1FS8"] 
dat[, "H1FS11"] <- 3-dat[, "H1FS11"] 
dat[, "H1FS15"] <- 3-dat[, "H1FS15"] # recode reverse items 

dat[,"PA56"] <- 1 - dat[,"PA56"] # money problem 

#money problem & safety net programs
dat[, c("PA56", paste0("PA57",LETTERS[1:6]))] [dat[, c("PA56", paste0("PA57",LETTERS[1:6]))] < 0 | dat[, c("PA56", paste0("PA57",LETTERS[1:6]))] > 1] <- NA # Replace values greater than 1 or less than 0 with NA
sum(is.na(dat[, c("PA56", paste0("PA57",LETTERS[1:6]))])) # Total number of NA
## [1] 6553
(row_na <- sum(apply(dat[, c("PA56", paste0("PA57",LETTERS[1:6]))], 1, function(x) any(is.na(x))))) # Total number of rows with at least 1 NA
## [1] 1105
dat[,"BST90P01"][dat[,"BST90P01"]>2] <- NA # urbanicity
sum(is.na(dat[,"BST90P01"]))
## [1] 76
dat[,"BST90P02"][dat[,"BST90P02"]>3] <- NA # race 
sum(is.na(dat[,"BST90P02"]))
## [1] 84
dat[,"BST90P04"][dat[,"BST90P04"]>4] <- NA # % Hispanic 
sum(is.na(dat[,"BST90P04"]))
## [1] 76
dat[,"BST90P15"][dat[,"BST90P15"]==999998 |dat[,"BST90P15"]==999999] <- NA # median household income 
sum(is.na(dat[,"BST90P15"]))
## [1] 284
dat[,"BST90P19"][dat[,"BST90P19"]==8 |dat[,"BST90P19"]==9] <- NA # poverty 
dat[,"BST90P23"][dat[,"BST90P23"]==8 |dat[,"BST90P23"]==9] <- NA # unemployment rate
dat[,"BST90P26"][dat[,"BST90P26"]==8 |dat[,"BST90P26"]==9] <- NA # housing 
dat[,"BST90P20"][dat[,"BST90P20"]==8 |dat[,"BST90P20"]==9] <- NA # education  

(row_na <- sum(apply(dat[,c("BST90P01", #urbanity
            "BST90P02", #modal race in the census tract (CZ)
            "BST90P04", #% of hispanic by low, medium, high in the CZ
            "BST90P15", # median household income ($) in the census tract
            "BST90P19", #% persons living in poverty by low, medium, high in the CZ
            "BST90P23", #% unemployment by low, medium, high in the CZ
            "BST90P26", #tenue of housing by three levels in the CZ
            "BST90P20")] #education by three levels in the CZ)] 
            , 1, function(x) any(is.na(x))))) # Total number of rows with at least 1 NA
## [1] 308
sum(is.na(dat_weight)) # NA = 0
## [1] 0
str(dat)
## 'data.frame':    6504 obs. of  37 variables:
##  $ AID     : chr  "57100270" "57101310" "57103171" "57103869" ...
##  $ H1FS1   : num  1 1 0 2 0 1 1 0 0 0 ...
##  $ H1FS2   : num  0 1 0 1 0 0 0 1 1 0 ...
##  $ H1FS3   : num  1 0 0 2 0 0 0 0 0 0 ...
##  $ H1FS4   : num  0 1 0 3 2 1 2 1 2 1 ...
##  $ H1FS5   : num  1 3 0 3 0 2 0 0 2 0 ...
##  $ H1FS6   : num  1 0 0 1 0 0 0 0 0 1 ...
##  $ H1FS7   : num  1 1 1 1 0 2 1 1 1 0 ...
##  $ H1FS8   : num  0 0 0 1 1 0 0 2 1 2 ...
##  $ H1FS9   : num  1 0 0 0 0 1 0 0 1 0 ...
##  $ H1FS10  : num  0 1 0 1 0 0 0 0 0 0 ...
##  $ H1FS11  : num  0 0 0 1 0 3 2 1 2 1 ...
##  $ H1FS12  : num  1 0 0 1 2 1 0 0 0 0 ...
##  $ H1FS13  : num  1 0 0 0 1 0 0 0 0 0 ...
##  $ H1FS14  : num  0 1 0 1 0 0 1 0 0 0 ...
##  $ H1FS15  : num  0 0 0 2 1 1 3 0 0 0 ...
##  $ H1FS16  : num  1 0 0 0 1 0 0 0 1 1 ...
##  $ H1FS17  : num  0 1 0 1 0 1 0 1 0 0 ...
##  $ H1FS18  : num  0 1 0 1 0 0 1 1 0 0 ...
##  $ H1FS19  : num  1 0 0 0 0 1 0 0 0 0 ...
##  $ PA56    : num  0 NA 0 0 1 0 0 1 0 0 ...
##  $ PA57A   : num  1 NA 0 0 0 0 0 0 0 0 ...
##  $ PA57B   : num  0 NA 0 1 0 0 0 0 0 0 ...
##  $ PA57C   : num  0 NA 0 1 0 0 0 0 1 0 ...
##  $ PA57D   : num  0 NA 0 1 0 0 0 0 1 0 ...
##  $ PA57E   : num  0 NA 0 0 0 0 0 1 0 0 ...
##  $ PA57F   : num  0 NA 0 0 0 0 0 0 0 0 ...
##  $ BST90P01: num  1 2 2 1 1 1 1 2 1 2 ...
##  $ BST90P02: num  2 1 1 2 2 2 2 1 2 1 ...
##  $ BST90P04: num  1 1 1 1 1 1 1 1 1 1 ...
##  $ BST90P15: num  56000 14000 NA 17000 7000 58000 58000 45000 26000 34000 ...
##  $ BST90P19: num  1 3 2 3 3 1 1 1 1 1 ...
##  $ BST90P23: num  1 3 NA 3 3 2 2 1 3 1 ...
##  $ BST90P26: num  3 3 3 2 1 3 3 3 2 3 ...
##  $ BST90P20: num  2 2 2 2 1 2 2 2 2 2 ...
##  $ CLUSTER2: num  178 108 115 167 142 278 278 224 256 185 ...
##  $ GSWGT1  : num  448 2527 3401 5822 2815 ...
dat1 <- na.omit(dat) # listwise deletion 
summary(dat1) #n = 5120 students
##      AID                H1FS1            H1FS2            H1FS3       
##  Length:5120        Min.   :0.0000   Min.   :0.0000   Min.   :0.0000  
##  Class :character   1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:0.0000  
##  Mode  :character   Median :0.0000   Median :0.0000   Median :0.0000  
##                     Mean   :0.4793   Mean   :0.4525   Mean   :0.3717  
##                     3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:1.0000  
##                     Max.   :3.0000   Max.   :3.0000   Max.   :3.0000  
##      H1FS4           H1FS5            H1FS6            H1FS7       
##  Min.   :0.000   Min.   :0.0000   Min.   :0.0000   Min.   :0.0000  
##  1st Qu.:0.000   1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:0.0000  
##  Median :1.000   Median :1.0000   Median :0.0000   Median :1.0000  
##  Mean   :1.057   Mean   :0.8061   Mean   :0.5012   Mean   :0.7201  
##  3rd Qu.:2.000   3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:1.0000  
##  Max.   :3.000   Max.   :3.0000   Max.   :3.0000   Max.   :3.0000  
##      H1FS8           H1FS9            H1FS10          H1FS11      
##  Min.   :0.000   Min.   :0.0000   Min.   :0.000   Min.   :0.0000  
##  1st Qu.:0.000   1st Qu.:0.0000   1st Qu.:0.000   1st Qu.:0.0000  
##  Median :1.000   Median :0.0000   Median :0.000   Median :1.0000  
##  Mean   :1.151   Mean   :0.1973   Mean   :0.315   Mean   :0.8609  
##  3rd Qu.:2.000   3rd Qu.:0.0000   3rd Qu.:1.000   3rd Qu.:1.0000  
##  Max.   :3.000   Max.   :3.0000   Max.   :3.000   Max.   :3.0000  
##      H1FS12           H1FS13           H1FS14           H1FS15      
##  Min.   :0.0000   Min.   :0.0000   Min.   :0.0000   Min.   :0.0000  
##  1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:0.0000  
##  Median :0.0000   Median :0.0000   Median :0.0000   Median :1.0000  
##  Mean   :0.5455   Mean   :0.4547   Mean   :0.3939   Mean   :0.7383  
##  3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:1.0000  
##  Max.   :3.0000   Max.   :3.0000   Max.   :3.0000   Max.   :3.0000  
##      H1FS16           H1FS17           H1FS18           H1FS19     
##  Min.   :0.0000   Min.   :0.0000   Min.   :0.0000   Min.   :0.000  
##  1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:0.000  
##  Median :0.0000   Median :0.0000   Median :1.0000   Median :0.000  
##  Mean   :0.5621   Mean   :0.4121   Mean   :0.6092   Mean   :0.149  
##  3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:0.000  
##  Max.   :3.0000   Max.   :3.0000   Max.   :3.0000   Max.   :3.000  
##       PA56            PA57A             PA57B             PA57C        
##  Min.   :0.0000   Min.   :0.00000   Min.   :0.00000   Min.   :0.00000  
##  1st Qu.:0.0000   1st Qu.:0.00000   1st Qu.:0.00000   1st Qu.:0.00000  
##  Median :0.0000   Median :0.00000   Median :0.00000   Median :0.00000  
##  Mean   :0.1791   Mean   :0.09805   Mean   :0.05977   Mean   :0.07109  
##  3rd Qu.:0.0000   3rd Qu.:0.00000   3rd Qu.:0.00000   3rd Qu.:0.00000  
##  Max.   :1.0000   Max.   :1.00000   Max.   :1.00000   Max.   :1.00000  
##      PA57D            PA57E             PA57F           BST90P01    
##  Min.   :0.0000   Min.   :0.00000   Min.   :0.0000   Min.   :1.000  
##  1st Qu.:0.0000   1st Qu.:0.00000   1st Qu.:0.0000   1st Qu.:1.000  
##  Median :0.0000   Median :0.00000   Median :0.0000   Median :1.000  
##  Mean   :0.1178   Mean   :0.04609   Mean   :0.0334   Mean   :1.488  
##  3rd Qu.:0.0000   3rd Qu.:0.00000   3rd Qu.:0.0000   3rd Qu.:2.000  
##  Max.   :1.0000   Max.   :1.00000   Max.   :1.0000   Max.   :2.000  
##     BST90P02        BST90P04        BST90P15         BST90P19   
##  Min.   :1.000   Min.   :1.000   Min.   :  4999   Min.   :1.00  
##  1st Qu.:1.000   1st Qu.:1.000   1st Qu.: 20000   1st Qu.:1.00  
##  Median :1.000   Median :1.000   Median : 29000   Median :1.00  
##  Mean   :1.214   Mean   :1.137   Mean   : 30701   Mean   :1.65  
##  3rd Qu.:1.000   3rd Qu.:1.000   3rd Qu.: 39000   3rd Qu.:2.00  
##  Max.   :3.000   Max.   :4.000   Max.   :100001   Max.   :3.00  
##     BST90P23        BST90P26        BST90P20       CLUSTER2    
##  Min.   :1.000   Min.   :1.000   Min.   :1.00   Min.   :102.0  
##  1st Qu.:1.000   1st Qu.:2.000   1st Qu.:2.00   1st Qu.:134.0  
##  Median :1.000   Median :3.000   Median :2.00   Median :169.0  
##  Mean   :1.668   Mean   :2.444   Mean   :1.94   Mean   :186.2  
##  3rd Qu.:2.000   3rd Qu.:3.000   3rd Qu.:2.00   3rd Qu.:224.0  
##  Max.   :3.000   Max.   :3.000   Max.   :3.00   Max.   :472.0  
##      GSWGT1       
##  Min.   :  256.1  
##  1st Qu.: 2250.6  
##  Median : 3287.3  
##  Mean   : 3450.1  
##  3rd Qu.: 4359.6  
##  Max.   :18385.5
length(unique(dat1$CLUSTER2)) # k = 132 schools
## [1] 132

save clean data

write.csv(dat, "AddHealthEP964.csv", row.names = FALSE)

Refining dataset

Create a composite score for the outcome variable - students emotional problems

dat1$EmoProblem <- rowSums(dat1[, paste0("H1FS", 1:19)])
results <- alpha(dat1[, paste0("H1FS", 1:19)])
print(results$total$std.alpha) # calculating alpha
## [1] 0.8719335
summary(dat1$EmoProblem)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.00    5.00    9.00   10.78   15.00   50.00

Create a dichotomized indicator for any ss program

dat1$AnySS <- ifelse(rowSums(dat1[, paste0("PA57", LETTERS[1:6])]) > 0, 1, 0)
head(dat1[,c(paste0("PA57", LETTERS[1:6]), "AnySS")])
##   PA57A PA57B PA57C PA57D PA57E PA57F AnySS
## 1     1     0     0     0     0     0     1
## 4     0     1     1     1     0     0     1
## 5     0     0     0     0     0     0     0
## 6     0     0     0     0     0     0     0
## 7     0     0     0     0     0     0     0
## 8     0     0     0     0     1     0     1

Create a composite score for ss programs

dat1$SumSS <- rowSums(dat1[, paste0("PA57", LETTERS[1:6])])
head(dat1[,c(paste0("PA57", LETTERS[1:6]), "SumSS")])
##   PA57A PA57B PA57C PA57D PA57E PA57F SumSS
## 1     1     0     0     0     0     0     1
## 4     0     1     1     1     0     0     3
## 5     0     0     0     0     0     0     0
## 6     0     0     0     0     0     0     0
## 7     0     0     0     0     0     0     0
## 8     0     0     0     0     1     0     1

Create level 2 predictors from census tract data

CZ_mode <- dat1[, c( "BST90P02", 
                    "BST90P04",
                    "BST90P19",
                    "BST90P23",
                    "BST90P26",
                    "BST90P01",
                    "BST90P20")]
CZ_mean <- dat1[, "BST90P15"]
temp1 <- aggregate(CZ_mean, list(dat1$CLUSTER2), function(x) mean(x, na.rm = TRUE))

get_mode <- function(x) {
  x <- unlist(x)  # Unlist if it's a list
  ux <- unique(x)
  ux[which.max(tabulate(match(x, ux)))]
}

temp2 <- aggregate(CZ_mode, list(dat1$CLUSTER2), get_mode)
names(temp1) <- c('CLUSTER2',"BST90P15")
names(temp2)[1] <- 'CLUSTER2'

dim(temp1)
## [1] 132   2
dim(temp2)
## [1] 132   8
Level2_dat<- merge(temp1,temp2,by = "CLUSTER2")
dat2 <- merge(dat1, Level2_dat, by = "CLUSTER2")
names(dat2)
##  [1] "CLUSTER2"   "AID"        "H1FS1"      "H1FS2"      "H1FS3"     
##  [6] "H1FS4"      "H1FS5"      "H1FS6"      "H1FS7"      "H1FS8"     
## [11] "H1FS9"      "H1FS10"     "H1FS11"     "H1FS12"     "H1FS13"    
## [16] "H1FS14"     "H1FS15"     "H1FS16"     "H1FS17"     "H1FS18"    
## [21] "H1FS19"     "PA56"       "PA57A"      "PA57B"      "PA57C"     
## [26] "PA57D"      "PA57E"      "PA57F"      "BST90P01.x" "BST90P02.x"
## [31] "BST90P04.x" "BST90P15.x" "BST90P19.x" "BST90P23.x" "BST90P26.x"
## [36] "BST90P20.x" "GSWGT1"     "EmoProblem" "AnySS"      "SumSS"     
## [41] "BST90P15.y" "BST90P02.y" "BST90P04.y" "BST90P19.y" "BST90P23.y"
## [46] "BST90P26.y" "BST90P01.y" "BST90P20.y"
# rename variables
names(Level2_dat) <- c("CLUSTERID",
                       "MedianHHIncome_L2",
                "ModalRace_bylevels_L2", 
                "PerHispanic_bylevels_L2",
                "PerPoverty_bylevels_L2",
                "PerUnemploy_bylevels_L2",
                "TenureHousing_bylevels_L2",
                                "Urbanicity_L2",
                "ModalEducation_bylevels_L2")
names(dat2) <- c("CLUSTERID","AID", 
                "H1FS1","H1FS2","H1FS3","H1FS4","H1FS5","H1FS6","H1FS7","H1FS8","H1FS9","H1FS10","H1FS11",
                "H1FS12","H1FS13","H1FS14","H1FS15","H1FS16","H1FS17","H1FS18","H1FS19",                     
                "MoneyProblem",
                "SocialSecurity","SSI","AFDC","FoodStamp","Unemploy","Housing",
                "Urbanicity_CZ",
                "ModalRace_bylevels_CZ", 
                "PerHispanic_bylevels_CZ", 
                "MedianHHIncome_CZ",
                "PerPoverty_bylevels_CZ",
                "PerUnemploy_bylevels_CZ",
                "TenureHousing_bylevels_CZ",
                "ModalEducation_bylevels_CZ",
                "GSWGT1", "EmoProblem", "AnySS", "SumSS",
                "MedianHHIncome_L2",
                "ModalRace_bylevels_L2", 
                "PerHispanic_bylevels_L2",
                "PerPoverty_bylevels_L2",
                "PerUnemploy_bylevels_L2",
                "TenureHousing_bylevels_L2",
                                "Urbanicity_L2",
                "ModalEducation_bylevels_L2")

Data Inspection

Check normal distribution

hist(dat2$EmoProblem)

hist(sqrt(dat2$EmoProblem)) #will check this in sensitivity analysis 

hist(scale(dat2$SumSS))

hist(scale(dat2$MedianHHIncome_CZ))

hist(scale(dat2$MedianHHIncome_L2))

Calculate ICC

mod0 <- lme(EmoProblem ~ 1, random = ~ 1|CLUSTERID,
               data = dat2, method = "ML", 
               control = list(opt = "optim"))
VarCorr(mod0)
## CLUSTERID = pdLogChol(1) 
##             Variance  StdDev  
## (Intercept)  1.728875 1.314867
## Residual    53.689732 7.327328
(mod0.ICC = 1.728875/(1.728875 + 53.689732)) # ICC = 3.12%
## [1] 0.03119665

Check necessity of using HLM

mod.gls <- gls(EmoProblem ~ 1, data = dat2, method = "ML", control = list(opt = "optim"))
anova(mod.gls, mod0) # p <.001, RIM fit better than mean prediction 
##         Model df      AIC      BIC    logLik   Test  L.Ratio p-value
## mod.gls     1  2 35092.39 35105.47 -17544.19                        
## mod0        2  3 35033.42 35053.05 -17513.71 1 vs 2 60.96728  <.0001

Summary Statistics

Level 1 descriptives by neighborhood poverty level

dat.temp <- dat2
dat.temp <- dat2 %>%
  mutate(across(c("EmoProblem", "SumSS"), as.numeric))
dat.temp <- dat.temp %>%
  mutate(across(c("MoneyProblem", "SocialSecurity", "SSI", "AFDC", 
                  "FoodStamp", "Unemploy", "Housing", "AnySS"), 
                ~factor(.x, levels= c(0,1), labels = c("No", "Yes"))))
dat.temp$PerPoverty_bylevels_L2 <- as.factor(dat.temp$PerPoverty_bylevels_L2)
levels(dat.temp$PerPoverty_bylevels_L2) <- c("Poverty_Low", "Medium", "High")
level1_byPoverty <- table1(~ EmoProblem + MoneyProblem + 
         SocialSecurity + SSI + AFDC + FoodStamp + Unemploy + Housing +
         AnySS + SumSS
         | PerPoverty_bylevels_L2, data = dat.temp, na.rm = TRUE); level1_byPoverty
Poverty_Low
(N=3565)
Medium
(N=593)
High
(N=962)
Overall
(N=5120)
EmoProblem
Mean (SD) 10.5 (7.23) 10.9 (7.97) 11.8 (7.81) 10.8 (7.45)
Median [Min, Max] 9.00 [0, 47.0] 9.00 [0, 46.0] 11.0 [0, 50.0] 9.00 [0, 50.0]
MoneyProblem
No 2980 (83.6%) 492 (83.0%) 731 (76.0%) 4203 (82.1%)
Yes 585 (16.4%) 101 (17.0%) 231 (24.0%) 917 (17.9%)
SocialSecurity
No 3268 (91.7%) 525 (88.5%) 825 (85.8%) 4618 (90.2%)
Yes 297 (8.3%) 68 (11.5%) 137 (14.2%) 502 (9.8%)
SSI
No 3396 (95.3%) 566 (95.4%) 852 (88.6%) 4814 (94.0%)
Yes 169 (4.7%) 27 (4.6%) 110 (11.4%) 306 (6.0%)
AFDC
No 3401 (95.4%) 549 (92.6%) 806 (83.8%) 4756 (92.9%)
Yes 164 (4.6%) 44 (7.4%) 156 (16.2%) 364 (7.1%)
FoodStamp
No 3300 (92.6%) 512 (86.3%) 705 (73.3%) 4517 (88.2%)
Yes 265 (7.4%) 81 (13.7%) 257 (26.7%) 603 (11.8%)
Unemploy
No 3390 (95.1%) 565 (95.3%) 929 (96.6%) 4884 (95.4%)
Yes 175 (4.9%) 28 (4.7%) 33 (3.4%) 236 (4.6%)
Housing
No 3475 (97.5%) 572 (96.5%) 902 (93.8%) 4949 (96.7%)
Yes 90 (2.5%) 21 (3.5%) 60 (6.2%) 171 (3.3%)
AnySS
No 2818 (79.0%) 421 (71.0%) 540 (56.1%) 3779 (73.8%)
Yes 747 (21.0%) 172 (29.0%) 422 (43.9%) 1341 (26.2%)
SumSS
Mean (SD) 0.325 (0.742) 0.454 (0.829) 0.783 (1.06) 0.426 (0.841)
Median [Min, Max] 0 [0, 6.00] 0 [0, 5.00] 0 [0, 5.00] 0 [0, 6.00]

Level 2 descriptives by neighborhood poverty level

l2vars <- dat2[,c("PerPoverty_bylevels_L2",
                  "MedianHHIncome_L2",  "Urbanicity_L2" , 
                             "ModalRace_bylevels_L2" , "PerHispanic_bylevels_L2" ,
                             "PerUnemploy_bylevels_L2" , "TenureHousing_bylevels_L2" ,
                             "ModalEducation_bylevels_L2")]
dat.temp.l2 <- aggregate(l2vars, by = list (dat2$CLUSTERID), FUN = unique)

label(dat.temp.l2$PerPoverty_bylevels_L2) <- "Neighborhood Poverty Level"
dat.temp.l2$PerPoverty_bylevels_L2 <- as.factor(dat.temp.l2$PerPoverty_bylevels_L2)
levels(dat.temp.l2$PerPoverty_bylevels_L2) <- c("Poverty_Low", "Medium", "High")

label(dat.temp.l2$MedianHHIncome_L2) <- "Neighborhood Median Household Income"
dat.temp.l2$MedianHHIncome_L2 <- as.numeric(dat.temp.l2$MedianHHIncome_L2)
units(dat.temp.l2$MedianHHIncome_L2) <- ("US $")

label(dat.temp.l2$Urbanicity_L2) <- "Neighborhood Urbanicity"
dat.temp.l2$Urbanicity_L2 <- as.factor(dat.temp.l2$Urbanicity_L2)
levels(dat.temp.l2$Urbanicity_L2) <- c("Urban", "No Completely Urban")

label(dat.temp.l2$ModalRace_bylevels_L2) <- "Neighborhood Modal Race"
dat.temp.l2$ModalRace_bylevels_L2 <- as.factor(dat.temp.l2$ModalRace_bylevels_L2)
levels(dat.temp.l2$ModalRace_bylevels_L2) <- c("White", "Black", "Other")

label(dat.temp.l2$PerHispanic_bylevels_L2) <- "Neighborhood Hispanic Pop. Level"
dat.temp.l2$PerHispanic_bylevels_L2 <- as.factor(dat.temp.l2$PerHispanic_bylevels_L2)
levels(dat.temp.l2$PerHispanic_bylevels_L2) <- c("Low", "Medium", "High", "Very High")

label(dat.temp.l2$PerUnemploy_bylevels_L2) <- "Neighborhood Unemployment Pop. Level"
dat.temp.l2$PerUnemploy_bylevels_L2 <- as.factor(dat.temp.l2$PerUnemploy_bylevels_L2)
levels(dat.temp.l2$PerUnemploy_bylevels_L2) <- c("Low", "Medium", "High")

label(dat.temp.l2$TenureHousing_bylevels_L2) <- "Neighborhood Housing Tenure Type"
dat.temp.l2$TenureHousing_bylevels_L2 <- as.factor(dat.temp.l2$TenureHousing_bylevels_L2)
levels(dat.temp.l2$TenureHousing_bylevels_L2) <- c("Heavily renter occupied", "Mixed tenure", "Heavily owner occupied")

label(dat.temp.l2$ModalEducation_bylevels_L2) <- "Neighborhood Modal Education Level"
dat.temp.l2$ModalEducation_bylevels_L2 <- as.factor(dat.temp.l2$ModalEducation_bylevels_L2)
levels(dat.temp.l2$ModalEducation_bylevels_L2) <- c("No high school degree or equivalency", "High school degree, no college degree", "College degree or more")

level2_byPoverty <- table1(~ MedianHHIncome_L2 + Urbanicity_L2 + 
                             ModalRace_bylevels_L2 + PerHispanic_bylevels_L2 +
                             PerUnemploy_bylevels_L2 + TenureHousing_bylevels_L2 +
                             ModalEducation_bylevels_L2
         | PerPoverty_bylevels_L2, data = dat.temp.l2, na.rm = TRUE); level2_byPoverty
Poverty_Low
(N=90)
Medium
(N=14)
High
(N=28)
Overall
(N=132)
MedianHHIncome_L2 (US $)
Mean (SD) 35500 (8390) 23000 (2910) 18100 (3140) 30500 (10300)
Median [Min, Max] 34200 [21500, 57300] 22000 [19000, 28500] 17900 [11500, 24500] 30000 [11500, 57300]
Urbanicity_L2
Urban 54 (60.0%) 6 (42.9%) 12 (42.9%) 72 (54.5%)
No Completely Urban 36 (40.0%) 8 (57.1%) 16 (57.1%) 60 (45.5%)
ModalRace_bylevels_L2
White 83 (92.2%) 14 (100%) 17 (60.7%) 114 (86.4%)
Black 6 (6.7%) 0 (0%) 10 (35.7%) 16 (12.1%)
Other 1 (1.1%) 0 (0%) 1 (3.6%) 2 (1.5%)
PerHispanic_bylevels_L2
Low 87 (96.7%) 14 (100%) 23 (82.1%) 124 (93.9%)
Medium 2 (2.2%) 0 (0%) 1 (3.6%) 3 (2.3%)
High 1 (1.1%) 0 (0%) 1 (3.6%) 2 (1.5%)
Very High 0 (0%) 0 (0%) 3 (10.7%) 3 (2.3%)
PerUnemploy_bylevels_L2
Low 73 (81.1%) 8 (57.1%) 2 (7.1%) 83 (62.9%)
Medium 10 (11.1%) 2 (14.3%) 4 (14.3%) 16 (12.1%)
High 7 (7.8%) 4 (28.6%) 22 (78.6%) 33 (25.0%)
TenureHousing_bylevels_L2
Heavily renter occupied 0 (0%) 0 (0%) 3 (10.7%) 3 (2.3%)
Mixed tenure 40 (44.4%) 8 (57.1%) 16 (57.1%) 64 (48.5%)
Heavily owner occupied 50 (55.6%) 6 (42.9%) 9 (32.1%) 65 (49.2%)
ModalEducation_bylevels_L2
No high school degree or equivalency 0 (0%) 1 (7.1%) 15 (53.6%) 16 (12.1%)
High school degree, no college degree 84 (93.3%) 13 (92.9%) 13 (46.4%) 110 (83.3%)
College degree or more 6 (6.7%) 0 (0%) 0 (0%) 6 (4.5%)

Exploratory Analysis

Outcome: self-reported social emotional problems, ranged 0-50.
Primary predictors:
Level 1: Social safety programs participated (sum of programs (ranged 0-6) & any program (0,1))
Level 2: Neighborhood poverty level (1 = low, 2 = medium, 3 = high)
Covariates:
Level 1: Current money problem in the family
Level 2: Neighborhood urbanicity, modal race, modal education
Panel plot of emotional problem score plotted by each predictor variable - lines are connecting school mean (outcome cluster means vs level-1 predictors).
The purpose of this viusalization is to see if we should add any random slope/quadratic effect to our model.

Interaction plots between Level 1 predictors and Level 2 predictors.
The purpose of this viusalization is to see if we should add any cross-level interaction term to our model.

Main Analysis Using lmer() Function

Determine the baseline model:Try to include all Lv1 and Lv2 predictors:

summary(RIM.Any.Sum.cat <- lmer(EmoProblem ~ 
                          SocialSecurity + SSI + AFDC + FoodStamp + Unemploy + Housing + 
                          AnySS + 
                          SumSS +
                          MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                          (1 | CLUSTERID), data = dat2))
## fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: EmoProblem ~ SocialSecurity + SSI + AFDC + FoodStamp + Unemploy +  
##     Housing + AnySS + SumSS + MoneyProblem + PerPoverty_bylevels_L2 +  
##     ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +  
##     (1 | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 34920.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.9984 -0.7185 -0.1835  0.5085  5.5004 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  CLUSTERID (Intercept)  1.113   1.055   
##  Residual              52.958   7.277   
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                             Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)                  11.2277     1.2834  118.2025   8.749 1.77e-14 ***
## SocialSecurity               -0.6201     0.4985 5090.8266  -1.244  0.21364    
## SSI                           0.8857     0.4948 5090.0928   1.790  0.07352 .  
## AFDC                          0.4642     0.5211 5106.1763   0.891  0.37316    
## FoodStamp                     0.5888     0.5185 5105.5185   1.136  0.25621    
## Unemploy                      0.4010     0.6167 5084.4677   0.650  0.51553    
## Housing                       0.7801     0.6267 5099.7273   1.245  0.21322    
## AnySS                         1.4196     0.5182 5087.9132   2.740  0.00617 ** 
## MoneyProblem                  0.4128     0.2786 5097.6258   1.482  0.13852    
## PerPoverty_bylevels_L2        0.1568     0.2213  130.3052   0.708  0.47991    
## ModalRace_bylevels_L2         0.4969     0.3593  101.7262   1.383  0.16966    
## Urbanicity_L2                -0.3485     0.2896  124.0409  -1.203  0.23120    
## ModalEducation_bylevels_L2   -0.7083     0.4411  116.6082  -1.606  0.11103    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 13 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
## fit warnings:
## fixed-effect model matrix is rank deficient so dropping 1 column / coefficient

The fixed part has collinearity issue -> SumSS and the SS program categories cannot coexist in a model!

summary(RIM.Any <- lmer(EmoProblem ~ 
                              #SocialSecurity + SSI + AFDC + FoodStamp + Unemploy + Housing + 
                              AnySS +
                              # SumSS + 
                              MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                              (1 | CLUSTERID), data = dat2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: EmoProblem ~ AnySS + MoneyProblem + PerPoverty_bylevels_L2 +  
##     ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +  
##     (1 | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 34939.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.9104 -0.7150 -0.1906  0.5113  5.4913 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  CLUSTERID (Intercept)  1.135   1.066   
##  Residual              53.053   7.284   
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                             Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)                  11.1814     1.2893  119.1174   8.672 2.54e-14 ***
## AnySS                         1.8997     0.2457 5083.7268   7.731 1.28e-14 ***
## MoneyProblem                  0.5217     0.2759 5105.2692   1.891   0.0587 .  
## PerPoverty_bylevels_L2        0.2101     0.2211  128.8209   0.950   0.3439    
## ModalRace_bylevels_L2         0.5269     0.3605  102.0672   1.462   0.1469    
## Urbanicity_L2                -0.4125     0.2900  123.6653  -1.423   0.1573    
## ModalEducation_bylevels_L2   -0.6970     0.4433  117.6721  -1.572   0.1186    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) AnySS  MnyPrb PP__L2 MR__L2 Urb_L2
## AnySS       -0.044                                   
## MoneyProblm -0.070 -0.183                            
## PrPvrty__L2 -0.528 -0.093 -0.005                     
## MdlRc_by_L2 -0.403 -0.038  0.005 -0.134              
## Urbancty_L2 -0.373  0.035  0.040 -0.101  0.001       
## MdlEdct__L2 -0.894  0.038  0.041  0.528  0.174  0.103
summary(RIM.Any.cat <- lmer(EmoProblem ~ 
                              SocialSecurity + SSI + AFDC + FoodStamp + Unemploy + Housing + 
                              AnySS +
                              # SumSS + 
                              MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                              (1 | CLUSTERID), data = dat2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: EmoProblem ~ SocialSecurity + SSI + AFDC + FoodStamp + Unemploy +  
##     Housing + AnySS + MoneyProblem + PerPoverty_bylevels_L2 +  
##     ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +  
##     (1 | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 34920.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.9984 -0.7185 -0.1835  0.5085  5.5004 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  CLUSTERID (Intercept)  1.113   1.055   
##  Residual              52.958   7.277   
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                             Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)                  11.2277     1.2834  118.2025   8.749 1.77e-14 ***
## SocialSecurity               -0.6201     0.4985 5090.8266  -1.244  0.21364    
## SSI                           0.8857     0.4948 5090.0928   1.790  0.07352 .  
## AFDC                          0.4642     0.5211 5106.1763   0.891  0.37316    
## FoodStamp                     0.5888     0.5185 5105.5185   1.136  0.25621    
## Unemploy                      0.4010     0.6167 5084.4677   0.650  0.51553    
## Housing                       0.7801     0.6267 5099.7273   1.245  0.21322    
## AnySS                         1.4196     0.5182 5087.9132   2.740  0.00617 ** 
## MoneyProblem                  0.4128     0.2786 5097.6258   1.482  0.13852    
## PerPoverty_bylevels_L2        0.1568     0.2213  130.3052   0.708  0.47991    
## ModalRace_bylevels_L2         0.4969     0.3593  101.7262   1.383  0.16966    
## Urbanicity_L2                -0.3485     0.2896  124.0409  -1.203  0.23120    
## ModalEducation_bylevels_L2   -0.7083     0.4411  116.6082  -1.606  0.11103    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 13 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
summary(RIM.Sum <- lmer(EmoProblem ~ 
                              # SocialSecurity + SSI + AFDC + FoodStamp + Unemploy + Housing + 
                              # AnySS +
                              SumSS + 
                              MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                              (1 | CLUSTERID), data = dat2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: EmoProblem ~ SumSS + MoneyProblem + PerPoverty_bylevels_L2 +  
##     ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +  
##     (1 | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 34937.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.9275 -0.7160 -0.1851  0.5099  5.4892 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  CLUSTERID (Intercept)  1.124   1.060   
##  Residual              53.024   7.282   
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                             Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)                  11.3131     1.2855  118.3052   8.801 1.33e-14 ***
## SumSS                         1.0291     0.1295 5018.4752   7.947 2.35e-15 ***
## MoneyProblem                  0.4846     0.2765 5103.3794   1.753   0.0797 .  
## PerPoverty_bylevels_L2        0.1831     0.2209  128.8333   0.829   0.4088    
## ModalRace_bylevels_L2         0.4949     0.3597  101.6569   1.376   0.1719    
## Urbanicity_L2                -0.3559     0.2896  123.4913  -1.229   0.2213    
## ModalEducation_bylevels_L2   -0.7346     0.4420  116.9243  -1.662   0.0992 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SumSS  MnyPrb PP__L2 MR__L2 Urb_L2
## SumSS       -0.031                                   
## MoneyProblm -0.072 -0.194                            
## PrPvrty__L2 -0.528 -0.106 -0.001                     
## MdlRc_by_L2 -0.403 -0.048  0.007 -0.132              
## Urbancty_L2 -0.373  0.058  0.035 -0.103 -0.001       
## MdlEdct__L2 -0.894  0.027  0.043  0.528  0.174  0.103
summary(RIM.Sum.Any <- lmer(EmoProblem ~ 
                          #SocialSecurity + SSI + AFDC + FoodStamp + Unemploy + Housing + 
                          AnySS +
                          SumSS + 
                          MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                          (1 | CLUSTERID), data = dat2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: EmoProblem ~ AnySS + SumSS + MoneyProblem + PerPoverty_bylevels_L2 +  
##     ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +  
##     (1 | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 34933.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.9229 -0.7162 -0.1902  0.5119  5.4974 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  CLUSTERID (Intercept)  1.12    1.058   
##  Residual              52.99    7.280   
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                             Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)                  11.2259     1.2850  118.6343   8.736 1.85e-14 ***
## AnySS                         0.8937     0.4449 5094.5538   2.009  0.04462 *  
## SumSS                         0.6363     0.2345 5111.9844   2.713  0.00669 ** 
## MoneyProblem                  0.4645     0.2766 5103.2477   1.679  0.09312 .  
## PerPoverty_bylevels_L2        0.1788     0.2207  128.8653   0.810  0.41932    
## ModalRace_bylevels_L2         0.4976     0.3593  101.6526   1.385  0.16914    
## Urbanicity_L2                -0.3705     0.2894  123.6363  -1.280  0.20287    
## ModalEducation_bylevels_L2   -0.7094     0.4418  117.1568  -1.606  0.11100    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) AnySS  SumSS  MnyPrb PP__L2 MR__L2 Urb_L2
## AnySS       -0.034                                          
## SumSS        0.011 -0.834                                   
## MoneyProblm -0.070 -0.036 -0.077                            
## PrPvrty__L2 -0.528 -0.009 -0.051 -0.001                     
## MdlRc_by_L2 -0.403  0.004 -0.030  0.007 -0.132              
## Urbancty_L2 -0.372 -0.025  0.053  0.036 -0.103 -0.001       
## MdlEdct__L2 -0.894  0.029 -0.009  0.042  0.527  0.174  0.102
anova(RIM.Any.cat, RIM.Any)[1:8] #nested, sig., support RIM.Any.cat
## refitting model(s) with ML (instead of REML)
##             npar   AIC   BIC logLik deviance  Chisq Df Pr(>Chisq)  
## RIM.Any        9 34951 35010 -17467    34933                       
## RIM.Any.cat   15 34947 35045 -17459    34917 16.189  6    0.01278 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(RIM.Sum.Any, RIM.Sum)[1:8] #nested, sig., support RIM.Sum.Any
## refitting model(s) with ML (instead of REML)
##             npar   AIC   BIC logLik deviance  Chisq Df Pr(>Chisq)  
## RIM.Sum        9 34948 35007 -17465    34930                       
## RIM.Sum.Any   10 34946 35011 -17463    34926 4.0454  1    0.04429 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(RIM.Any.cat, RIM.Sum.Any)[1:8] #non-nested, BIC support the more parsimonious model: RIM.Sum.Any
## refitting model(s) with ML (instead of REML)
##             npar   AIC   BIC logLik deviance  Chisq Df Pr(>Chisq)
## RIM.Sum.Any   10 34946 35011 -17463    34926                     
## RIM.Any.cat   15 34947 35045 -17459    34917 8.7957  5     0.1175
Baseline model therefore is RIM.Sum.Any
RIM <- RIM.Sum.Any
Step 1: Add quadratic effect to SumSS
summary(RIM.quad <- lmer(EmoProblem ~ 
                           AnySS +
                           SumSS + 
                           I(SumSS^2) + 
                           MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                           (1 | CLUSTERID), data = dat2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## EmoProblem ~ AnySS + SumSS + I(SumSS^2) + MoneyProblem + PerPoverty_bylevels_L2 +  
##     ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +  
##     (1 | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 34927.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.0007 -0.7146 -0.1900  0.5100  5.5044 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  CLUSTERID (Intercept)  1.116   1.056   
##  Residual              52.934   7.276   
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                             Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)                  11.2709     1.2836  118.5910   8.781 1.45e-14 ***
## AnySS                        -1.2260     0.9162 5088.2710  -1.338  0.18093    
## SumSS                         3.1184     0.9669 5086.5090   3.225  0.00127 ** 
## I(SumSS^2)                   -0.5618     0.2123 5089.4157  -2.646  0.00817 ** 
## MoneyProblem                  0.4265     0.2768 5101.9137   1.541  0.12337    
## PerPoverty_bylevels_L2        0.1688     0.2205  128.8813   0.765  0.44540    
## ModalRace_bylevels_L2         0.4724     0.3590  101.6951   1.316  0.19117    
## Urbanicity_L2                -0.3785     0.2891  123.5476  -1.309  0.19282    
## ModalEducation_bylevels_L2   -0.7013     0.4413  117.0521  -1.589  0.11470    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) AnySS  SumSS  I(SSS^ MnyPrb PP__L2 MR__L2 Urb_L2
## AnySS       -0.028                                                 
## SumSS        0.015 -0.946                                          
## I(SumSS^2)  -0.013  0.874 -0.970                                   
## MoneyProblm -0.071  0.028 -0.069  0.052                            
## PrPvrty__L2 -0.528  0.010 -0.029  0.017  0.000                     
## MdlRc_by_L2 -0.403  0.025 -0.033  0.026  0.008 -0.131              
## Urbancty_L2 -0.372 -0.003  0.003  0.011  0.036 -0.103 -0.001       
## MdlEdct__L2 -0.894  0.008  0.005 -0.007  0.041  0.527  0.174  0.102
anova(RIM.quad, RIM)[1:8]
## refitting model(s) with ML (instead of REML)
##          npar   AIC   BIC logLik deviance  Chisq Df Pr(>Chisq)   
## RIM        10 34946 35011 -17463    34926                        
## RIM.quad   11 34941 35013 -17459    34919 7.0143  1   0.008086 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

RIM.quad fit significantly better than RIM. p=.008086

Step 2: Add interaction term to SumSS
summary(RIM.quad.int_urban <- lmer(EmoProblem ~ 
                              AnySS +
                              SumSS*Urbanicity_L2 +
                              SumSS + 
                              I(SumSS^2) + 
                              MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                              (1 | CLUSTERID), data = dat2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: EmoProblem ~ AnySS + SumSS * Urbanicity_L2 + SumSS + I(SumSS^2) +  
##     MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 +  
##     Urbanicity_L2 + ModalEducation_bylevels_L2 + (1 | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 34925.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.9601 -0.7092 -0.1939  0.5046  5.5179 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  CLUSTERID (Intercept)  1.146   1.071   
##  Residual              52.899   7.273   
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                             Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)                  11.5215     1.3005  122.7859   8.859 7.57e-15 ***
## AnySS                        -1.0906     0.9195 5087.8029  -1.186   0.2356    
## SumSS                         2.2781     1.0863 5109.8788   2.097   0.0360 *  
## Urbanicity_L2                -0.5623     0.3102  155.0179  -1.812   0.0719 .  
## I(SumSS^2)                   -0.5020     0.2152 5089.2835  -2.333   0.0197 *  
## MoneyProblem                  0.4187     0.2768 5101.6588   1.513   0.1304    
## PerPoverty_bylevels_L2        0.1711     0.2218  129.2444   0.771   0.4418    
## ModalRace_bylevels_L2         0.4590     0.3615  102.4482   1.270   0.2070    
## ModalEducation_bylevels_L2   -0.6845     0.4440  117.4942  -1.542   0.1258    
## SumSS:Urbanicity_L2           0.4408     0.2601 4722.9191   1.694   0.0903 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) AnySS  SumSS  Urb_L2 I(SSS^ MnyPrb PP__L2 MR__L2 ME__L2
## AnySS       -0.017                                                        
## SumSS       -0.041 -0.879                                                 
## Urbancty_L2 -0.388 -0.033  0.161                                          
## I(SumSS^2)   0.007  0.874 -0.926 -0.047                                   
## MoneyProblm -0.072  0.026 -0.055  0.039  0.049                            
## PrPvrty__L2 -0.524  0.010 -0.026 -0.097  0.017  0.000                     
## MdlRc_by_L2 -0.403  0.023 -0.019  0.007  0.022  0.009 -0.132              
## MdlEdct__L2 -0.886  0.009 -0.003  0.090 -0.004  0.041  0.527  0.173       
## SmSS:Urb_L2  0.118  0.087 -0.456 -0.349  0.164 -0.015  0.001 -0.023  0.017
summary(RIM.quad.int_educ <- lmer(EmoProblem ~ 
                                AnySS +
                                SumSS*ModalEducation_bylevels_L2 + 
                                SumSS + 
                                I(SumSS^2) + 
                                MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                                (1 | CLUSTERID), data = dat2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: EmoProblem ~ AnySS + SumSS * ModalEducation_bylevels_L2 + SumSS +  
##     I(SumSS^2) + MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 +  
##     Urbanicity_L2 + ModalEducation_bylevels_L2 + (1 | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 34924.9
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.0530 -0.7164 -0.1830  0.5075  5.5087 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  CLUSTERID (Intercept)  1.154   1.074   
##  Residual              52.892   7.273   
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                                   Estimate Std. Error        df t value
## (Intercept)                        10.7694     1.3219  124.8540   8.147
## AnySS                              -0.9837     0.9260 5092.3070  -1.062
## SumSS                               3.8337     1.0466 5109.7153   3.663
## ModalEducation_bylevels_L2         -0.4243     0.4700  135.2830  -0.903
## I(SumSS^2)                         -0.5124     0.2141 5091.3383  -2.393
## MoneyProblem                        0.4294     0.2767 5102.2356   1.551
## PerPoverty_bylevels_L2              0.1600     0.2222  128.3167   0.720
## ModalRace_bylevels_L2               0.4442     0.3623  101.6081   1.226
## Urbanicity_L2                      -0.3801     0.2912  122.6510  -1.305
## SumSS:ModalEducation_bylevels_L2   -0.5209     0.2917 4231.4651  -1.785
##                                  Pr(>|t|)    
## (Intercept)                       3.3e-13 ***
## AnySS                            0.288142    
## SumSS                            0.000252 ***
## ModalEducation_bylevels_L2       0.368322    
## I(SumSS^2)                       0.016729 *  
## MoneyProblem                     0.120857    
## PerPoverty_bylevels_L2           0.472613    
## ModalRace_bylevels_L2            0.222999    
## Urbanicity_L2                    0.194254    
## SumSS:ModalEducation_bylevels_L2 0.074259 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) AnySS  SumSS  ME__L2 I(SSS^ MnyPrb PP__L2 MR__L2 Urb_L2
## AnySS       -0.057                                                        
## SumSS       -0.066 -0.808                                                 
## MdlEdct__L2 -0.894  0.054  0.129                                          
## I(SumSS^2)  -0.039  0.877 -0.839  0.035                                   
## MoneyProblm -0.071  0.029 -0.061  0.041  0.053                            
## PrPvrty__L2 -0.511  0.006 -0.037  0.490  0.013  0.000                     
## MdlRc_by_L2 -0.385  0.018 -0.047  0.149  0.020  0.008 -0.130              
## Urbancty_L2 -0.364 -0.003  0.002  0.096  0.010  0.036 -0.102  0.000       
## SmSS:ME__L2  0.207 -0.146 -0.383 -0.324 -0.129 -0.008  0.028  0.045  0.002
### Other Lv2 covariates are also tested, but only urbanicity and education are significant.
### Construct of a model with both interaction terms: 
summary(RIM.quad.int <- lmer(EmoProblem ~ 
                              AnySS +
                              SumSS*Urbanicity_L2 + SumSS*ModalEducation_bylevels_L2 + 
                              SumSS + 
                              I(SumSS^2) + 
                              MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                              (1 | CLUSTERID), data = dat2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## EmoProblem ~ AnySS + SumSS * Urbanicity_L2 + SumSS * ModalEducation_bylevels_L2 +  
##     SumSS + I(SumSS^2) + MoneyProblem + PerPoverty_bylevels_L2 +  
##     ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +  
##     (1 | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 34924
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.0117 -0.7150 -0.1896  0.5068  5.5184 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  CLUSTERID (Intercept)  1.173   1.083   
##  Residual              52.875   7.271   
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                                   Estimate Std. Error        df t value
## (Intercept)                        11.0575     1.3459  132.7950   8.216
## AnySS                              -0.9194     0.9271 5091.8413  -0.992
## SumSS                               3.0377     1.2113 5099.3051   2.508
## Urbanicity_L2                      -0.5260     0.3128  156.3076  -1.682
## ModalEducation_bylevels_L2         -0.4602     0.4726  137.0581  -0.974
## I(SumSS^2)                         -0.4737     0.2161 5091.5300  -2.192
## MoneyProblem                        0.4225     0.2768 5101.6340   1.527
## PerPoverty_bylevels_L2              0.1636     0.2230  128.7143   0.734
## ModalRace_bylevels_L2               0.4387     0.3638  102.1820   1.206
## SumSS:Urbanicity_L2                 0.3504     0.2680 4832.6414   1.307
## SumSS:ModalEducation_bylevels_L2   -0.4276     0.3006 4384.6165  -1.423
##                                  Pr(>|t|)    
## (Intercept)                      1.66e-13 ***
## AnySS                              0.3214    
## SumSS                              0.0122 *  
## Urbanicity_L2                      0.0946 .  
## ModalEducation_bylevels_L2         0.3319    
## I(SumSS^2)                         0.0284 *  
## MoneyProblem                       0.1269    
## PerPoverty_bylevels_L2             0.4645    
## ModalRace_bylevels_L2              0.2306    
## SumSS:Urbanicity_L2                0.1912    
## SumSS:ModalEducation_bylevels_L2   0.1549    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) AnySS  SumSS  Urb_L2 ME__L2 I(SSS^ MnyPrb PP__L2 MR__L2
## AnySS       -0.047                                                        
## SumSS       -0.141 -0.724                                                 
## Urbancty_L2 -0.395 -0.022  0.181                                          
## MdlEdct__L2 -0.891  0.051  0.143  0.112                                   
## I(SumSS^2)  -0.015  0.874 -0.787 -0.039  0.026                            
## MoneyProblm -0.072  0.028 -0.044  0.039  0.042  0.050                     
## PrPvrty__L2 -0.502  0.006 -0.036 -0.098  0.489  0.014  0.000              
## MdlRc_by_L2 -0.382  0.017 -0.035  0.004  0.150  0.018  0.008 -0.131       
## SmSS:Urb_L2  0.168  0.052 -0.504 -0.356 -0.063  0.136 -0.017  0.008 -0.012
## SmSS:ME__L2  0.238 -0.129 -0.443 -0.084 -0.329 -0.091 -0.012  0.029  0.040
##             SSS:U_
## AnySS             
## SumSS             
## Urbancty_L2       
## MdlEdct__L2       
## I(SumSS^2)        
## MoneyProblm       
## PrPvrty__L2       
## MdlRc_by_L2       
## SmSS:Urb_L2       
## SmSS:ME__L2  0.240
anova(RIM.quad.int_urban, RIM.quad)[1:8] # ns but p<.1
## refitting model(s) with ML (instead of REML)
##                    npar   AIC   BIC logLik deviance  Chisq Df Pr(>Chisq)  
## RIM.quad             11 34941 35013 -17459    34919                       
## RIM.quad.int_urban   12 34940 35019 -17458    34916 2.8045  1      0.094 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(RIM.quad.int_educ, RIM.quad)[1:8] # ns but p<.1
## refitting model(s) with ML (instead of REML)
##                   npar   AIC   BIC logLik deviance  Chisq Df Pr(>Chisq)  
## RIM.quad            11 34941 35013 -17459    34919                       
## RIM.quad.int_educ   12 34940 35018 -17458    34916 3.1038  1    0.07811 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(RIM.quad.int, RIM.quad)[1:8] # ns but p<.1 
## refitting model(s) with ML (instead of REML)
##              npar   AIC   BIC logLik deviance  Chisq Df Pr(>Chisq)  
## RIM.quad       11 34941 35013 -17459    34919                       
## RIM.quad.int   13 34940 35025 -17457    34914 4.7747  2    0.09187 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(RIM.quad.int_educ, RIM.quad.int_urban)[1:8] # these two models are almost identical in fit, but the one with education interaction has a slightly lower BIC
## refitting model(s) with ML (instead of REML)
##                    npar   AIC   BIC logLik deviance Chisq Df Pr(>Chisq)
## RIM.quad.int_educ    12 34940 35018 -17458    34916                    
## RIM.quad.int_urban   12 34940 35019 -17458    34916     0  0

We cannot decide whether to include interaction term. Will revisit this issue later.

Step 3: Add random slope to SumSS (I also tested for AnySS, but model won’t converge)
summary(RSM.quad.int_urban <- lmer(EmoProblem ~ 
                                     AnySS +
                                     #SumSS*ModalEducation_bylevels_L2 + 
                                     SumSS*Urbanicity_L2 +
                                     SumSS + 
                                     I(SumSS^2) + 
                                     MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                           (1 + SumSS| CLUSTERID), data = dat2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: EmoProblem ~ AnySS + SumSS * Urbanicity_L2 + SumSS + I(SumSS^2) +  
##     MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 +  
##     Urbanicity_L2 + ModalEducation_bylevels_L2 + (1 + SumSS |      CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 34922.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.9775 -0.7149 -0.1892  0.5035  5.5217 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev. Corr
##  CLUSTERID (Intercept)  0.9794  0.9896       
##            SumSS        0.2427  0.4926   0.29
##  Residual              52.7378  7.2621       
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                             Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)                  11.3762     1.2927  120.4647   8.800 1.18e-14 ***
## AnySS                        -1.1142     0.9314 2885.4588  -1.196   0.2317    
## SumSS                         2.2246     1.1167  993.7271   1.992   0.0466 *  
## Urbanicity_L2                -0.5600     0.3011  121.9906  -1.860   0.0653 .  
## I(SumSS^2)                   -0.5222     0.2203 1406.7269  -2.371   0.0179 *  
## MoneyProblem                  0.4197     0.2772 5058.2912   1.514   0.1301    
## PerPoverty_bylevels_L2        0.1733     0.2227  131.5614   0.778   0.4378    
## ModalRace_bylevels_L2         0.4644     0.3647  105.4777   1.273   0.2057    
## ModalEducation_bylevels_L2   -0.6156     0.4431  115.8271  -1.389   0.1674    
## SumSS:Urbanicity_L2           0.5013     0.2838  109.9791   1.766   0.0801 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) AnySS  SumSS  Urb_L2 I(SSS^ MnyPrb PP__L2 MR__L2 ME__L2
## AnySS       -0.018                                                        
## SumSS       -0.030 -0.871                                                 
## Urbancty_L2 -0.380 -0.030  0.142                                          
## I(SumSS^2)   0.004  0.874 -0.917 -0.046                                   
## MoneyProblm -0.071  0.027 -0.053  0.041  0.047                            
## PrPvrty__L2 -0.522  0.005 -0.024 -0.103  0.018 -0.005                     
## MdlRc_by_L2 -0.403  0.016 -0.015  0.006  0.016  0.011 -0.135              
## MdlEdct__L2 -0.888  0.014 -0.008  0.093  0.001  0.039  0.523  0.167       
## SmSS:Urb_L2  0.091  0.080 -0.467 -0.284  0.150 -0.014  0.007 -0.010  0.013
summary(RSM.quad.int_educ <- lmer(EmoProblem ~ 
                           AnySS +
                           SumSS*ModalEducation_bylevels_L2 + 
                           #SumSS*Urbanicity_L2 +
                           SumSS + 
                           I(SumSS^2) + 
                           MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                           (1 + SumSS| CLUSTERID), data = dat2)) 
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: EmoProblem ~ AnySS + SumSS * ModalEducation_bylevels_L2 + SumSS +  
##     I(SumSS^2) + MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 +  
##     Urbanicity_L2 + ModalEducation_bylevels_L2 + (1 + SumSS |      CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 34922.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.0488 -0.7202 -0.1835  0.5098  5.5110 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev. Corr
##  CLUSTERID (Intercept)  0.9883  0.9941       
##            SumSS        0.1856  0.4308   0.35
##  Residual              52.7704  7.2643       
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                                   Estimate Std. Error        df t value
## (Intercept)                        10.8184     1.3080  120.5871   8.271
## AnySS                              -1.0259     0.9357 2924.4937  -1.096
## SumSS                               3.8722     1.0819  403.0787   3.579
## ModalEducation_bylevels_L2         -0.4331     0.4599  118.0033  -0.942
## I(SumSS^2)                         -0.5351     0.2184 1255.6589  -2.450
## MoneyProblem                        0.4294     0.2771 5047.1212   1.549
## PerPoverty_bylevels_L2              0.1609     0.2230  130.6049   0.722
## ModalRace_bylevels_L2               0.4533     0.3653  104.3786   1.241
## Urbanicity_L2                      -0.4079     0.2893  122.2365  -1.410
## SumSS:ModalEducation_bylevels_L2   -0.5135     0.3153   85.5780  -1.629
##                                  Pr(>|t|)    
## (Intercept)                      2.04e-13 ***
## AnySS                            0.272976    
## SumSS                            0.000387 ***
## ModalEducation_bylevels_L2       0.348202    
## I(SumSS^2)                       0.014404 *  
## MoneyProblem                     0.121353    
## PerPoverty_bylevels_L2           0.471833    
## ModalRace_bylevels_L2            0.217441    
## Urbanicity_L2                    0.161022    
## SumSS:ModalEducation_bylevels_L2 0.107063    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) AnySS  SumSS  ME__L2 I(SSS^ MnyPrb PP__L2 MR__L2 Urb_L2
## AnySS       -0.049                                                        
## SumSS       -0.058 -0.793                                                 
## MdlEdct__L2 -0.893  0.050  0.108                                          
## I(SumSS^2)  -0.030  0.877 -0.825  0.030                                   
## MoneyProblm -0.071  0.029 -0.057  0.041  0.051                            
## PrPvrty__L2 -0.512  0.001 -0.033  0.497  0.013 -0.005                     
## MdlRc_by_L2 -0.392  0.013 -0.033  0.153  0.015  0.010 -0.134              
## Urbancty_L2 -0.366 -0.007  0.011  0.098 -0.002  0.038 -0.106  0.003       
## SmSS:ME__L2  0.169 -0.141 -0.416 -0.264 -0.119 -0.010  0.029  0.030 -0.003
summary(RSM.quad.int <- lmer(EmoProblem ~ 
                               AnySS +
                               SumSS*ModalEducation_bylevels_L2 + 
                               SumSS*Urbanicity_L2 +
                               SumSS + 
                               I(SumSS^2) +  
                               MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                           (1 + SumSS| CLUSTERID), data = dat2)) 
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: EmoProblem ~ AnySS + SumSS * ModalEducation_bylevels_L2 + SumSS *  
##     Urbanicity_L2 + SumSS + I(SumSS^2) + MoneyProblem + PerPoverty_bylevels_L2 +  
##     ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +  
##     (1 + SumSS | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 34921.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.0103 -0.7180 -0.1877  0.5049  5.5212 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev. Corr
##  CLUSTERID (Intercept)  0.9879  0.9939       
##            SumSS        0.2032  0.4508   0.38
##  Residual              52.7428  7.2624       
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                                   Estimate Std. Error        df t value
## (Intercept)                        11.0618     1.3209  122.0832   8.374
## AnySS                              -0.9618     0.9375 3030.2026  -1.026
## SumSS                               2.9496     1.2593  346.8280   2.342
## ModalEducation_bylevels_L2         -0.4631     0.4607  118.1663  -1.005
## Urbanicity_L2                      -0.5361     0.3023  121.4762  -1.773
## I(SumSS^2)                         -0.4960     0.2205 1418.5354  -2.250
## MoneyProblem                        0.4219     0.2772 5051.0469   1.522
## PerPoverty_bylevels_L2              0.1663     0.2237  131.4434   0.743
## ModalRace_bylevels_L2               0.4528     0.3667  105.5354   1.235
## SumSS:ModalEducation_bylevels_L2   -0.4064     0.3261   91.7904  -1.247
## SumSS:Urbanicity_L2                 0.4185     0.2885  110.5361   1.451
##                                  Pr(>|t|)    
## (Intercept)                      1.09e-13 ***
## AnySS                              0.3050    
## SumSS                              0.0197 *  
## ModalEducation_bylevels_L2         0.3168    
## Urbanicity_L2                      0.0787 .  
## I(SumSS^2)                         0.0246 *  
## MoneyProblem                       0.1281    
## PerPoverty_bylevels_L2             0.4587    
## ModalRace_bylevels_L2              0.2196    
## SumSS:ModalEducation_bylevels_L2   0.2157    
## SumSS:Urbanicity_L2                0.1497    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) AnySS  SumSS  ME__L2 Urb_L2 I(SSS^ MnyPrb PP__L2 MR__L2
## AnySS       -0.042                                                        
## SumSS       -0.113 -0.706                                                 
## MdlEdct__L2 -0.891  0.047  0.115                                          
## Urbancty_L2 -0.384 -0.021  0.153  0.107                                   
## I(SumSS^2)  -0.013  0.875 -0.768  0.023 -0.039                            
## MoneyProblm -0.072  0.028 -0.041  0.042  0.041  0.049                     
## PrPvrty__L2 -0.506  0.001 -0.036  0.497 -0.105  0.015 -0.006              
## MdlRc_by_L2 -0.390  0.012 -0.026  0.154  0.005  0.014  0.010 -0.134       
## SmSS:ME__L2  0.188 -0.125 -0.468 -0.260 -0.068 -0.085 -0.014  0.031  0.027
## SmSS:Urb_L2  0.126  0.049 -0.508 -0.047 -0.283  0.128 -0.017  0.015 -0.003
##             SSS:ME
## AnySS             
## SumSS             
## MdlEdct__L2       
## Urbancty_L2       
## I(SumSS^2)        
## MoneyProblm       
## PrPvrty__L2       
## MdlRc_by_L2       
## SmSS:ME__L2       
## SmSS:Urb_L2  0.229
summary(RSM.quad <- lmer(EmoProblem ~ 
                      AnySS +
                      SumSS + 
                      I(SumSS^2) + 
                      MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                      (1 + SumSS| CLUSTERID), data = dat2)) 
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## EmoProblem ~ AnySS + SumSS + I(SumSS^2) + MoneyProblem + PerPoverty_bylevels_L2 +  
##     ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +  
##     (1 + SumSS | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 34924.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.0140 -0.7147 -0.1906  0.5092  5.5090 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev. Corr
##  CLUSTERID (Intercept)  0.9781  0.9890       
##            SumSS        0.2489  0.4989   0.22
##  Residual              52.7675  7.2641       
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                             Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)                  11.1747     1.2820  118.0167   8.717 2.12e-14 ***
## AnySS                        -1.2459     0.9287 2714.8884  -1.342  0.17985    
## SumSS                         3.1485     0.9877 1525.2055   3.188  0.00146 ** 
## I(SumSS^2)                   -0.5803     0.2179 1190.6118  -2.664  0.00783 ** 
## MoneyProblem                  0.4285     0.2772 5055.4336   1.546  0.12225    
## PerPoverty_bylevels_L2        0.1698     0.2217  130.7193   0.766  0.44500    
## ModalRace_bylevels_L2         0.4702     0.3626  104.0257   1.297  0.19756    
## Urbanicity_L2                -0.4029     0.2877  122.7265  -1.401  0.16383    
## ModalEducation_bylevels_L2   -0.6328     0.4412  115.5004  -1.434  0.15419    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) AnySS  SumSS  I(SSS^ MnyPrb PP__L2 MR__L2 Urb_L2
## AnySS       -0.026                                                 
## SumSS        0.014 -0.946                                          
## I(SumSS^2)  -0.010  0.875 -0.968                                   
## MoneyProblm -0.070  0.028 -0.067  0.050                            
## PrPvrty__L2 -0.525  0.006 -0.025  0.017 -0.005                     
## MdlRc_by_L2 -0.403  0.017 -0.024  0.019  0.010 -0.134              
## Urbancty_L2 -0.370 -0.008  0.010 -0.002  0.038 -0.106  0.003       
## MdlEdct__L2 -0.893  0.013 -0.001 -0.001  0.040  0.524  0.168  0.100
summary(RSM <- lmer(EmoProblem ~ 
                          AnySS +
                          SumSS + 
                          MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                          (1 + SumSS| CLUSTERID), data = dat2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: EmoProblem ~ AnySS + SumSS + MoneyProblem + PerPoverty_bylevels_L2 +  
##     ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +  
##     (1 + SumSS | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 34930.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.9200 -0.7212 -0.1893  0.5112  5.5020 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev. Corr
##  CLUSTERID (Intercept)  0.9837  0.9918       
##            SumSS        0.2423  0.4922   0.21
##  Residual              52.8339  7.2687       
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                             Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)                  11.1403     1.2828  118.0825   8.685 2.51e-14 ***
## AnySS                         0.9181     0.4498 2998.2155   2.041   0.0413 *  
## SumSS                         0.6015     0.2461  317.8559   2.444   0.0151 *  
## MoneyProblem                  0.4654     0.2770 5049.3680   1.680   0.0930 .  
## PerPoverty_bylevels_L2        0.1800     0.2217  130.6769   0.812   0.4184    
## ModalRace_bylevels_L2         0.4886     0.3626  103.8615   1.347   0.1808    
## Urbanicity_L2                -0.4032     0.2879  122.7819  -1.401   0.1639    
## ModalEducation_bylevels_L2   -0.6362     0.4415  115.6377  -1.441   0.1523    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) AnySS  SumSS  MnyPrb PP__L2 MR__L2 Urb_L2
## AnySS       -0.035                                          
## SumSS        0.015 -0.820                                   
## MoneyProblm -0.070 -0.033 -0.077                            
## PrPvrty__L2 -0.525 -0.019 -0.033 -0.005                     
## MdlRc_by_L2 -0.403  0.002 -0.022  0.009 -0.134              
## Urbancty_L2 -0.370 -0.012  0.034  0.038 -0.106  0.003       
## MdlEdct__L2 -0.893  0.029 -0.011  0.040  0.524  0.168  0.100
# Modal comparisons 
anova(RIM.quad.int, RSM.quad.int)[1:8] # ns, nested, RIM fit better 
## refitting model(s) with ML (instead of REML)
##              npar   AIC   BIC logLik deviance  Chisq Df Pr(>Chisq)
## RIM.quad.int   13 34940 35025 -17457    34914                     
## RSM.quad.int   15 34942 35040 -17456    34912 2.3473  2     0.3092
anova(RIM.quad.int_educ, RSM.quad.int_educ)[1:8] # ns, nested, RIM fit better
## refitting model(s) with ML (instead of REML)
##                   npar   AIC   BIC logLik deviance  Chisq Df Pr(>Chisq)
## RIM.quad.int_educ   12 34940 35018 -17458    34916                     
## RSM.quad.int_educ   14 34942 35033 -17457    34914 1.9654  2     0.3743
anova(RIM.quad.int_urban, RSM.quad.int_urban)[1:8] # ns, nested, RIM fit better
## refitting model(s) with ML (instead of REML)
##                    npar   AIC   BIC logLik deviance  Chisq Df Pr(>Chisq)
## RIM.quad.int_urban   12 34940 35019 -17458    34916                     
## RSM.quad.int_urban   14 34941 35033 -17457    34913 2.7562  2     0.2521
anova(RIM.quad, RSM.quad)[1:8] # ns, nested, RIM fit better
## refitting model(s) with ML (instead of REML)
##          npar   AIC   BIC logLik deviance  Chisq Df Pr(>Chisq)
## RIM.quad   11 34941 35013 -17459    34919                     
## RSM.quad   13 34942 35027 -17458    34916 2.4909  2     0.2878
anova(RIM, RSM)[1:8] # ns, nested, RIM fit better
## refitting model(s) with ML (instead of REML)
##     npar   AIC   BIC logLik deviance  Chisq Df Pr(>Chisq)
## RIM   10 34946 35011 -17463    34926                     
## RSM   12 34947 35026 -17462    34923 2.4059  2     0.3003

Explore if any RSM fit better than any RIM with quad and int effects

anova(RSM.quad, RIM.quad.int)[1:8] # not supported by BIC, RIM fit better 
## refitting model(s) with ML (instead of REML)
##              npar   AIC   BIC logLik deviance  Chisq Df Pr(>Chisq)
## RSM.quad       13 34942 35027 -17458    34916                     
## RIM.quad.int   13 34940 35025 -17457    34914 2.2837  0
anova(RSM, RIM.quad.int)[1:8] # RSM fit better than RIM.quad.int, supported by BIC
## refitting model(s) with ML (instead of REML)
##              npar   AIC   BIC logLik deviance  Chisq Df Pr(>Chisq)   
## RSM            12 34947 35026 -17462    34923                        
## RIM.quad.int   13 34940 35025 -17457    34914 9.3831  1    0.00219 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(RSM, RIM.quad.int_urban)[1:8] # not supported by BIC, RIM fit better 
## refitting model(s) with ML (instead of REML)
##                    npar   AIC   BIC logLik deviance Chisq Df Pr(>Chisq)
## RSM                  12 34947 35026 -17462    34923                    
## RIM.quad.int_urban   12 34940 35019 -17458    34916 7.413  0
anova(RSM, RIM.quad.int_educ)[1:8] # not supported by BIC, RIM fit better 
## refitting model(s) with ML (instead of REML)
##                   npar   AIC   BIC logLik deviance  Chisq Df Pr(>Chisq)
## RSM                 12 34947 35026 -17462    34923                     
## RIM.quad.int_educ   12 34940 35018 -17458    34916 7.7122  0

Explore if RSM fit better than RIM with quad only

anova(RSM, RIM.quad) # RIM.quad fit better than RSM, supported by BIC
## refitting model(s) with ML (instead of REML)
## Data: dat2
## Models:
## RIM.quad: EmoProblem ~ AnySS + SumSS + I(SumSS^2) + MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 + (1 | CLUSTERID)
## RSM: EmoProblem ~ AnySS + SumSS + MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 + (1 + SumSS | CLUSTERID)
##          npar   AIC   BIC logLik deviance Chisq Df Pr(>Chisq)
## RIM.quad   11 34941 35013 -17459    34919                    
## RSM        12 34947 35026 -17462    34923     0  1          1

Final model

Recall that RIM.quad fit better with any RIM with interaction term, ns, p<.10. So, the final model is RIM.quad

Final.out <- RIM.quad 
summary(Final.out)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## EmoProblem ~ AnySS + SumSS + I(SumSS^2) + MoneyProblem + PerPoverty_bylevels_L2 +  
##     ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +  
##     (1 | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 34927.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.0007 -0.7146 -0.1900  0.5100  5.5044 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  CLUSTERID (Intercept)  1.116   1.056   
##  Residual              52.934   7.276   
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                             Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)                  11.2709     1.2836  118.5910   8.781 1.45e-14 ***
## AnySS                        -1.2260     0.9162 5088.2710  -1.338  0.18093    
## SumSS                         3.1184     0.9669 5086.5090   3.225  0.00127 ** 
## I(SumSS^2)                   -0.5618     0.2123 5089.4157  -2.646  0.00817 ** 
## MoneyProblem                  0.4265     0.2768 5101.9137   1.541  0.12337    
## PerPoverty_bylevels_L2        0.1688     0.2205  128.8813   0.765  0.44540    
## ModalRace_bylevels_L2         0.4724     0.3590  101.6951   1.316  0.19117    
## Urbanicity_L2                -0.3785     0.2891  123.5476  -1.309  0.19282    
## ModalEducation_bylevels_L2   -0.7013     0.4413  117.0521  -1.589  0.11470    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) AnySS  SumSS  I(SSS^ MnyPrb PP__L2 MR__L2 Urb_L2
## AnySS       -0.028                                                 
## SumSS        0.015 -0.946                                          
## I(SumSS^2)  -0.013  0.874 -0.970                                   
## MoneyProblm -0.071  0.028 -0.069  0.052                            
## PrPvrty__L2 -0.528  0.010 -0.029  0.017  0.000                     
## MdlRc_by_L2 -0.403  0.025 -0.033  0.026  0.008 -0.131              
## Urbancty_L2 -0.372 -0.003  0.003  0.011  0.036 -0.103 -0.001       
## MdlEdct__L2 -0.894  0.008  0.005 -0.007  0.041  0.527  0.174  0.102
anova(Final.out, RIM.quad.int_urban, RIM.quad.int_educ, RSM)[1:8]
## refitting model(s) with ML (instead of REML)
##                    npar   AIC   BIC logLik deviance  Chisq Df Pr(>Chisq)  
## Final.out            11 34941 35013 -17459    34919                       
## RIM.quad.int_urban   12 34940 35019 -17458    34916 2.8045  1      0.094 .
## RIM.quad.int_educ    12 34940 35018 -17458    34916 0.2993  0             
## RSM                  12 34947 35026 -17462    34923 0.0000  0             
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Sensitivity analysis - sqrt transformation of EmoProblem applied

Since our outcome variable EmoProblem is apparently not normally distributed, we transfrom the dv by taking the sqrt of the raw data.

summary(RIM.Any.Sum.cat <- lmer(sqrt(EmoProblem) ~ 
                          SocialSecurity + SSI + AFDC + FoodStamp + Unemploy + Housing + 
                          AnySS + 
                          SumSS +
                          MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                          (1 | CLUSTERID), data = dat2))
## fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: sqrt(EmoProblem) ~ SocialSecurity + SSI + AFDC + FoodStamp +  
##     Unemploy + Housing + AnySS + SumSS + MoneyProblem + PerPoverty_bylevels_L2 +  
##     ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +  
##     (1 | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 15998.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.1988 -0.6558 -0.0118  0.6399  3.6289 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  CLUSTERID (Intercept) 0.03174  0.1782  
##  Residual              1.30060  1.1404  
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                              Estimate Std. Error         df t value Pr(>|t|)
## (Intercept)                   3.18097    0.20833  118.66563  15.269   <2e-16
## SocialSecurity               -0.07352    0.07817 5086.95283  -0.941   0.3470
## SSI                           0.12436    0.07763 5094.58008   1.602   0.1092
## AFDC                          0.04938    0.08173 5104.47222   0.604   0.5457
## FoodStamp                     0.11714    0.08131 5103.47773   1.441   0.1498
## Unemploy                      0.07331    0.09668 5080.29549   0.758   0.4483
## Housing                       0.13397    0.09830 5103.73996   1.363   0.1730
## AnySS                         0.19475    0.08124 5084.21319   2.397   0.0166
## MoneyProblem                  0.09039    0.04371 5102.37736   2.068   0.0387
## PerPoverty_bylevels_L2        0.01612    0.03587  130.16603   0.449   0.6538
## ModalRace_bylevels_L2         0.07417    0.05848  103.02982   1.268   0.2076
## Urbanicity_L2                -0.06014    0.04698  124.11781  -1.280   0.2029
## ModalEducation_bylevels_L2   -0.12080    0.07162  117.31871  -1.687   0.0943
##                               
## (Intercept)                ***
## SocialSecurity                
## SSI                           
## AFDC                          
## FoodStamp                     
## Unemploy                      
## Housing                       
## AnySS                      *  
## MoneyProblem               *  
## PerPoverty_bylevels_L2        
## ModalRace_bylevels_L2         
## Urbanicity_L2                 
## ModalEducation_bylevels_L2 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 13 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
## fit warnings:
## fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
## Again, the fixed part has collinearity issue -> SumSS and the SS program categories cannot coexist in a model
summary(RIM.Any.cat <- lmer(sqrt(EmoProblem) ~ 
                              SocialSecurity + SSI + AFDC + FoodStamp + Unemploy + Housing + 
                              AnySS +
                              # SumSS + 
                              MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                              (1 | CLUSTERID), data = dat2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: sqrt(EmoProblem) ~ SocialSecurity + SSI + AFDC + FoodStamp +  
##     Unemploy + Housing + AnySS + MoneyProblem + PerPoverty_bylevels_L2 +  
##     ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +  
##     (1 | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 15998.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.1988 -0.6558 -0.0118  0.6399  3.6289 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  CLUSTERID (Intercept) 0.03174  0.1782  
##  Residual              1.30060  1.1404  
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                              Estimate Std. Error         df t value Pr(>|t|)
## (Intercept)                   3.18097    0.20833  118.66563  15.269   <2e-16
## SocialSecurity               -0.07352    0.07817 5086.95283  -0.941   0.3470
## SSI                           0.12436    0.07763 5094.58008   1.602   0.1092
## AFDC                          0.04938    0.08173 5104.47222   0.604   0.5457
## FoodStamp                     0.11714    0.08131 5103.47773   1.441   0.1498
## Unemploy                      0.07331    0.09668 5080.29549   0.758   0.4483
## Housing                       0.13397    0.09830 5103.73996   1.363   0.1730
## AnySS                         0.19475    0.08124 5084.21319   2.397   0.0166
## MoneyProblem                  0.09039    0.04371 5102.37736   2.068   0.0387
## PerPoverty_bylevels_L2        0.01612    0.03587  130.16603   0.449   0.6538
## ModalRace_bylevels_L2         0.07417    0.05848  103.02982   1.268   0.2076
## Urbanicity_L2                -0.06014    0.04698  124.11781  -1.280   0.2029
## ModalEducation_bylevels_L2   -0.12080    0.07162  117.31871  -1.687   0.0943
##                               
## (Intercept)                ***
## SocialSecurity                
## SSI                           
## AFDC                          
## FoodStamp                     
## Unemploy                      
## Housing                       
## AnySS                      *  
## MoneyProblem               *  
## PerPoverty_bylevels_L2        
## ModalRace_bylevels_L2         
## Urbanicity_L2                 
## ModalEducation_bylevels_L2 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 13 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
summary(RIM.Sum <- lmer(sqrt(EmoProblem) ~ 
                              # SocialSecurity + SSI + AFDC + FoodStamp + Unemploy + Housing + 
                              # AnySS +
                              SumSS + 
                              MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                              (1 | CLUSTERID), data = dat2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: sqrt(EmoProblem) ~ SumSS + MoneyProblem + PerPoverty_bylevels_L2 +  
##     ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +  
##     (1 | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 15991.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.1220 -0.6610 -0.0095  0.6368  3.6202 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  CLUSTERID (Intercept) 0.03193  0.1787  
##  Residual              1.30171  1.1409  
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                              Estimate Std. Error         df t value Pr(>|t|)
## (Intercept)                   3.19311    0.20852  118.68438  15.314  < 2e-16
## SumSS                         0.15490    0.02032 5039.42052   7.623 2.93e-14
## MoneyProblem                  0.10199    0.04336 5108.14992   2.352   0.0187
## PerPoverty_bylevels_L2        0.02010    0.03578  128.68456   0.562   0.5753
## ModalRace_bylevels_L2         0.07304    0.05850  102.87528   1.249   0.2146
## Urbanicity_L2                -0.06080    0.04694  123.50698  -1.295   0.1976
## ModalEducation_bylevels_L2   -0.12461    0.07171  117.52996  -1.738   0.0849
##                               
## (Intercept)                ***
## SumSS                      ***
## MoneyProblem               *  
## PerPoverty_bylevels_L2        
## ModalRace_bylevels_L2         
## Urbanicity_L2                 
## ModalEducation_bylevels_L2 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SumSS  MnyPrb PP__L2 MR__L2 Urb_L2
## SumSS       -0.030                                   
## MoneyProblm -0.069 -0.194                            
## PrPvrty__L2 -0.529 -0.103 -0.001                     
## MdlRc_by_L2 -0.403 -0.047  0.007 -0.134              
## Urbancty_L2 -0.374  0.057  0.033 -0.101  0.001       
## MdlEdct__L2 -0.894  0.026  0.041  0.529  0.173  0.103
summary(RIM.Sum.Any <- lmer(sqrt(EmoProblem) ~ 
                          #SocialSecurity + SSI + AFDC + FoodStamp + Unemploy + Housing + 
                          AnySS +
                          SumSS + 
                          MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                          (1 | CLUSTERID), data = dat2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## sqrt(EmoProblem) ~ AnySS + SumSS + MoneyProblem + PerPoverty_bylevels_L2 +  
##     ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +  
##     (1 | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 15991.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.1239 -0.6531 -0.0148  0.6415  3.6268 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  CLUSTERID (Intercept) 0.03182  0.1784  
##  Residual              1.30116  1.1407  
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                              Estimate Std. Error         df t value Pr(>|t|)
## (Intercept)                   3.18077    0.20843  119.01725  15.260  < 2e-16
## AnySS                         0.12731    0.06975 5090.85660   1.825  0.06800
## SumSS                         0.09895    0.03678 5111.80253   2.690  0.00716
## MoneyProblem                  0.09915    0.04338 5107.71350   2.286  0.02232
## PerPoverty_bylevels_L2        0.01948    0.03575  128.75137   0.545  0.58682
## ModalRace_bylevels_L2         0.07344    0.05844  102.89615   1.257  0.21173
## Urbanicity_L2                -0.06288    0.04691  123.67964  -1.340  0.18255
## ModalEducation_bylevels_L2   -0.12105    0.07167  117.77348  -1.689  0.09387
##                               
## (Intercept)                ***
## AnySS                      .  
## SumSS                      ** 
## MoneyProblem               *  
## PerPoverty_bylevels_L2        
## ModalRace_bylevels_L2         
## Urbanicity_L2                 
## ModalEducation_bylevels_L2 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) AnySS  SumSS  MnyPrb PP__L2 MR__L2 Urb_L2
## AnySS       -0.033                                          
## SumSS        0.011 -0.834                                   
## MoneyProblm -0.068 -0.036 -0.077                            
## PrPvrty__L2 -0.528 -0.009 -0.050 -0.001                     
## MdlRc_by_L2 -0.403  0.004 -0.029  0.007 -0.134              
## Urbancty_L2 -0.373 -0.024  0.052  0.034 -0.101  0.000       
## MdlEdct__L2 -0.894  0.028 -0.009  0.040  0.528  0.173  0.102
summary(RIM.Any <- lmer(sqrt(EmoProblem) ~ 
                          #SocialSecurity + SSI + AFDC + FoodStamp + Unemploy + Housing + 
                          AnySS +
                          #SumSS + 
                          MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                          (1 | CLUSTERID), data = dat2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: sqrt(EmoProblem) ~ AnySS + MoneyProblem + PerPoverty_bylevels_L2 +  
##     ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +  
##     (1 | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 15994.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.1117 -0.6516 -0.0144  0.6419  3.6216 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  CLUSTERID (Intercept) 0.03211  0.1792  
##  Residual              1.30264  1.1413  
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                              Estimate Std. Error         df t value Pr(>|t|)
## (Intercept)                   3.17413    0.20893  119.52372  15.192  < 2e-16
## AnySS                         0.28370    0.03855 5093.42447   7.359 2.14e-13
## MoneyProblem                  0.10809    0.04328 5109.31434   2.498   0.0125
## PerPoverty_bylevels_L2        0.02431    0.03579  128.77004   0.679   0.4982
## ModalRace_bylevels_L2         0.07804    0.05857  103.30174   1.333   0.1856
## Urbanicity_L2                -0.06947    0.04696  123.74609  -1.479   0.1416
## ModalEducation_bylevels_L2   -0.11920    0.07185  118.30248  -1.659   0.0997
##                               
## (Intercept)                ***
## AnySS                      ***
## MoneyProblem               *  
## PerPoverty_bylevels_L2        
## ModalRace_bylevels_L2         
## Urbanicity_L2                 
## ModalEducation_bylevels_L2 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) AnySS  MnyPrb PP__L2 MR__L2 Urb_L2
## AnySS       -0.043                                   
## MoneyProblm -0.067 -0.182                            
## PrPvrty__L2 -0.529 -0.091 -0.005                     
## MdlRc_by_L2 -0.403 -0.037  0.005 -0.136              
## Urbancty_L2 -0.374  0.034  0.038 -0.099  0.002       
## MdlEdct__L2 -0.894  0.037  0.039  0.529  0.173  0.103
anova(RIM.Any.cat, RIM.Any)[1:8] #nested, sig., support RIM.Any.cat
## refitting model(s) with ML (instead of REML)
##             npar   AIC   BIC  logLik deviance  Chisq Df Pr(>Chisq)  
## RIM.Any        9 15980 16039 -7981.1    15962                       
## RIM.Any.cat   15 15978 16076 -7973.8    15948 14.643  6    0.02322 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(RIM.Sum.Any, RIM.Sum)[1:8] #nested, ns, support RIM.Sum
## refitting model(s) with ML (instead of REML)
##             npar   AIC   BIC  logLik deviance  Chisq Df Pr(>Chisq)  
## RIM.Sum        9 15976 16035 -7979.2    15958                       
## RIM.Sum.Any   10 15975 16040 -7977.5    15955 3.3426  1    0.06751 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(RIM.Any, RIM.Sum)[1:8] #non-nested, BIC support RIM.Sum
## refitting model(s) with ML (instead of REML)
##         npar   AIC   BIC  logLik deviance  Chisq Df Pr(>Chisq)
## RIM.Any    9 15980 16039 -7981.1    15962                     
## RIM.Sum    9 15976 16035 -7979.2    15958 3.9194  0
anova(RIM.Any.cat, RIM.Sum)[1:8] #non-nested, BIC support the more parsimonious model: RIM.Sum
## refitting model(s) with ML (instead of REML)
##             npar   AIC   BIC  logLik deviance  Chisq Df Pr(>Chisq)  
## RIM.Sum        9 15976 16035 -7979.2    15958                       
## RIM.Any.cat   15 15978 16076 -7973.8    15948 10.724  6    0.09729 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Baseline model therefore is RIM.Sum.Any

RIM <- RIM.Sum
Step 1: Add quadratic effect to SumSS
summary(RIM.quad <- lmer(sqrt(EmoProblem) ~ 
                           SumSS + 
                           I(SumSS^2) + 
                           MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                           (1 | CLUSTERID), data = dat2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## sqrt(EmoProblem) ~ SumSS + I(SumSS^2) + MoneyProblem + PerPoverty_bylevels_L2 +  
##     ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +  
##     (1 | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 15990.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.1647 -0.6514 -0.0150  0.6407  3.6321 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  CLUSTERID (Intercept) 0.03173  0.1781  
##  Residual              1.30010  1.1402  
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                              Estimate Std. Error         df t value Pr(>|t|)
## (Intercept)                   3.18030    0.20818  118.87872  15.276  < 2e-16
## SumSS                         0.27804    0.04899 5103.21412   5.676 1.46e-08
## I(SumSS^2)                   -0.04462    0.01616 5092.21628  -2.762  0.00577
## MoneyProblem                  0.09521    0.04340 5107.80204   2.194  0.02831
## PerPoverty_bylevels_L2        0.01850    0.03572  128.83186   0.518  0.60549
## ModalRace_bylevels_L2         0.07157    0.05839  102.92022   1.226  0.22309
## Urbanicity_L2                -0.06421    0.04687  123.70674  -1.370  0.17320
## ModalEducation_bylevels_L2   -0.11922    0.07161  117.75817  -1.665  0.09859
##                               
## (Intercept)                ***
## SumSS                      ***
## I(SumSS^2)                 ** 
## MoneyProblem               *  
## PerPoverty_bylevels_L2        
## ModalRace_bylevels_L2         
## Urbanicity_L2                 
## ModalEducation_bylevels_L2 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SumSS  I(SSS^ MnyPrb PP__L2 MR__L2 Urb_L2
## SumSS       -0.033                                          
## I(SumSS^2)   0.023 -0.910                                   
## MoneyProblm -0.068 -0.132  0.057                            
## PrPvrty__L2 -0.528 -0.057  0.016 -0.001                     
## MdlRc_by_L2 -0.403 -0.028  0.009  0.008 -0.134              
## Urbancty_L2 -0.373  0.000  0.026  0.035 -0.101  0.001       
## MdlEdct__L2 -0.894  0.036 -0.028  0.039  0.528  0.173  0.102
anova(RIM.quad, RIM)[1:8]
## refitting model(s) with ML (instead of REML)
##          npar   AIC   BIC  logLik deviance  Chisq Df Pr(>Chisq)   
## RIM         9 15976 16035 -7979.2    15958                        
## RIM.quad   10 15971 16036 -7975.4    15951 7.6448  1   0.005694 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

RIM.quad fit significantly better than RIM. p=.005694

Step 2: Add interaction term to SumSS
summary(RIM.quad.int_urban <- lmer(sqrt(EmoProblem) ~ 
                              #SumSS*ModalEducation_bylevels_L2 + 
                              SumSS*Urbanicity_L2 +
                              SumSS + 
                              I(SumSS^2) + 
                              MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                              (1 | CLUSTERID), data = dat2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: sqrt(EmoProblem) ~ SumSS * Urbanicity_L2 + SumSS + I(SumSS^2) +  
##     MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 +  
##     Urbanicity_L2 + ModalEducation_bylevels_L2 + (1 | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 15991.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.1251 -0.6473 -0.0152  0.6332  3.6458 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  CLUSTERID (Intercept) 0.0325   0.1803  
##  Residual              1.2991   1.1398  
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                              Estimate Std. Error         df t value Pr(>|t|)
## (Intercept)                   3.22549    0.21079  122.98894  15.302   <2e-16
## SumSS                         0.15395    0.08144 4965.86634   1.890   0.0588
## Urbanicity_L2                -0.09658    0.05008  153.44033  -1.928   0.0556
## I(SumSS^2)                   -0.03893    0.01643 5089.57734  -2.370   0.0178
## MoneyProblem                  0.09367    0.04340 5107.20233   2.158   0.0310
## PerPoverty_bylevels_L2        0.01882    0.03591  129.27905   0.524   0.6011
## ModalRace_bylevels_L2         0.06905    0.05876  103.72241   1.175   0.2426
## ModalEducation_bylevels_L2   -0.11640    0.07202  118.27040  -1.616   0.1087
## SumSS:Urbanicity_L2           0.07757    0.04070 4785.58023   1.906   0.0567
##                               
## (Intercept)                ***
## SumSS                      .  
## Urbanicity_L2              .  
## I(SumSS^2)                 *  
## MoneyProblem               *  
## PerPoverty_bylevels_L2        
## ModalRace_bylevels_L2         
## ModalEducation_bylevels_L2    
## SumSS:Urbanicity_L2        .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SumSS  Urb_L2 I(SSS^ MnyPrb PP__L2 MR__L2 ME__L2
## SumSS       -0.112                                                 
## Urbancty_L2 -0.388  0.270                                          
## I(SumSS^2)   0.043 -0.683 -0.037                                   
## MoneyProblm -0.069 -0.066  0.038  0.053                            
## PrPvrty__L2 -0.525 -0.035 -0.095  0.016 -0.001                     
## MdlRc_by_L2 -0.403  0.002  0.009  0.005  0.008 -0.134              
## MdlEdct__L2 -0.886  0.008  0.091 -0.024  0.039  0.528  0.172       
## SmSS:Urb_L2  0.116 -0.799 -0.338  0.181 -0.017  0.001 -0.023  0.017
summary(RIM.quad.int_educ <- lmer(sqrt(EmoProblem) ~ 
                                SumSS*ModalEducation_bylevels_L2 + 
                                #SumSS*Urbanicity_L2
                                SumSS + 
                                I(SumSS^2) + 
                                MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                                (1 | CLUSTERID), data = dat2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: sqrt(EmoProblem) ~ SumSS * ModalEducation_bylevels_L2 + SumSS +  
##     I(SumSS^2) + MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 +  
##     Urbanicity_L2 + ModalEducation_bylevels_L2 + (1 | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 15991.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.2185 -0.6494 -0.0153  0.6392  3.6347 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  CLUSTERID (Intercept) 0.03269  0.1808  
##  Residual              1.29917  1.1398  
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                                    Estimate Std. Error         df t value
## (Intercept)                         3.10718    0.21385  124.62834  14.529
## SumSS                               0.41948    0.09676 4735.21456   4.335
## ModalEducation_bylevels_L2         -0.07818    0.07595  135.14331  -1.029
## I(SumSS^2)                         -0.04457    0.01615 5090.36043  -2.759
## MoneyProblem                        0.09534    0.04340 5107.54886   2.197
## PerPoverty_bylevels_L2              0.01714    0.03598  128.31523   0.476
## ModalRace_bylevels_L2               0.06705    0.05890  102.88425   1.138
## Urbanicity_L2                      -0.06446    0.04720  122.87611  -1.366
## SumSS:ModalEducation_bylevels_L2   -0.07695    0.04536 4369.50066  -1.696
##                                  Pr(>|t|)    
## (Intercept)                       < 2e-16 ***
## SumSS                            1.49e-05 ***
## ModalEducation_bylevels_L2        0.30516    
## I(SumSS^2)                        0.00582 ** 
## MoneyProblem                      0.02807 *  
## PerPoverty_bylevels_L2            0.63456    
## ModalRace_bylevels_L2             0.25760    
## Urbanicity_L2                     0.17452    
## SumSS:ModalEducation_bylevels_L2  0.08989 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SumSS  ME__L2 I(SSS^ MnyPrb PP__L2 MR__L2 Urb_L2
## SumSS       -0.186                                                 
## MdlEdct__L2 -0.894  0.288                                          
## I(SumSS^2)   0.022 -0.459 -0.026                                   
## MoneyProblm -0.067 -0.063  0.038  0.057                            
## PrPvrty__L2 -0.513 -0.052  0.493  0.016 -0.001                     
## MdlRc_by_L2 -0.386 -0.054  0.149  0.009  0.007 -0.133              
## Urbancty_L2 -0.365 -0.002  0.097  0.026  0.035 -0.100  0.001       
## SmSS:ME__L2  0.197 -0.862 -0.314 -0.001 -0.004  0.027  0.046  0.002
### Other Lv2 covariates are also tested, but only urbanicity and education are significant.
summary(RIM.quad.int <- lmer(sqrt(EmoProblem) ~ 
                              AnySS +
                              SumSS*Urbanicity_L2 + SumSS*ModalEducation_bylevels_L2 + 
                              SumSS + 
                              I(SumSS^2) + 
                              MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                              (1 | CLUSTERID), data = dat2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## sqrt(EmoProblem) ~ AnySS + SumSS * Urbanicity_L2 + SumSS * ModalEducation_bylevels_L2 +  
##     SumSS + I(SumSS^2) + MoneyProblem + PerPoverty_bylevels_L2 +  
##     ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +  
##     (1 | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 15995.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.1930 -0.6493 -0.0135  0.6317  3.6446 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  CLUSTERID (Intercept) 0.03303  0.1818  
##  Residual              1.29871  1.1396  
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                                    Estimate Std. Error         df t value
## (Intercept)                         3.17063    0.21763  132.86189  14.569
## AnySS                              -0.13006    0.14537 5088.60473  -0.895
## SumSS                               0.40668    0.19002 5103.15010   2.140
## Urbanicity_L2                      -0.09037    0.05045  154.97206  -1.791
## ModalEducation_bylevels_L2         -0.08871    0.07638  137.53631  -1.161
## I(SumSS^2)                         -0.06635    0.03388 5088.36776  -1.959
## MoneyProblem                        0.09295    0.04342 5105.49222   2.141
## PerPoverty_bylevels_L2              0.01752    0.03607  128.81615   0.486
## ModalRace_bylevels_L2               0.06512    0.05907  103.52792   1.102
## SumSS:Urbanicity_L2                 0.06250    0.04209 4874.74322   1.485
## SumSS:ModalEducation_bylevels_L2   -0.05372    0.04724 4476.34186  -1.137
##                                  Pr(>|t|)    
## (Intercept)                        <2e-16 ***
## AnySS                              0.3710    
## SumSS                              0.0324 *  
## Urbanicity_L2                      0.0752 .  
## ModalEducation_bylevels_L2         0.2475    
## I(SumSS^2)                         0.0502 .  
## MoneyProblem                       0.0323 *  
## PerPoverty_bylevels_L2             0.6280    
## ModalRace_bylevels_L2              0.2729    
## SumSS:Urbanicity_L2                0.1376    
## SumSS:ModalEducation_bylevels_L2   0.2555    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) AnySS  SumSS  Urb_L2 ME__L2 I(SSS^ MnyPrb PP__L2 MR__L2
## AnySS       -0.046                                                        
## SumSS       -0.137 -0.723                                                 
## Urbancty_L2 -0.394 -0.021  0.176                                          
## MdlEdct__L2 -0.891  0.050  0.140  0.111                                   
## I(SumSS^2)  -0.015  0.874 -0.786 -0.038  0.025                            
## MoneyProblm -0.070  0.028 -0.044  0.038  0.041  0.050                     
## PrPvrty__L2 -0.504  0.006 -0.035 -0.097  0.491  0.013 -0.001              
## MdlRc_by_L2 -0.383  0.017 -0.034  0.005  0.151  0.018  0.008 -0.133       
## SmSS:Urb_L2  0.163  0.053 -0.504 -0.347 -0.061  0.136 -0.017  0.009 -0.011
## SmSS:ME__L2  0.233 -0.130 -0.443 -0.081 -0.322 -0.092 -0.012  0.027  0.039
##             SSS:U_
## AnySS             
## SumSS             
## Urbancty_L2       
## MdlEdct__L2       
## I(SumSS^2)        
## MoneyProblm       
## PrPvrty__L2       
## MdlRc_by_L2       
## SmSS:Urb_L2       
## SmSS:ME__L2  0.240
anova(RIM.quad.int_urban, RIM.quad)[1:8] # ns but p<.1
## refitting model(s) with ML (instead of REML)
##                    npar   AIC   BIC  logLik deviance  Chisq Df Pr(>Chisq)  
## RIM.quad             10 15971 16036 -7975.4    15951                       
## RIM.quad.int_urban   11 15969 16041 -7973.6    15947 3.5699  1    0.05884 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(RIM.quad.int_educ, RIM.quad)[1:8] # ns but p<.1
## refitting model(s) with ML (instead of REML)
##                   npar   AIC   BIC  logLik deviance  Chisq Df Pr(>Chisq)  
## RIM.quad            10 15971 16036 -7975.4    15951                       
## RIM.quad.int_educ   11 15970 16042 -7974.0    15948 2.7982  1    0.09437 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(RIM.quad.int, RIM.quad)[1:8] # ns 
## refitting model(s) with ML (instead of REML)
##              npar   AIC   BIC  logLik deviance  Chisq Df Pr(>Chisq)
## RIM.quad       10 15971 16036 -7975.4    15951                     
## RIM.quad.int   13 15971 16056 -7972.4    15945 5.9297  3     0.1151
anova(RIM.quad.int_educ, RIM.quad.int_urban)[1:8] # these two models are almost identical in fit
## refitting model(s) with ML (instead of REML)
##                    npar   AIC   BIC  logLik deviance  Chisq Df Pr(>Chisq)
## RIM.quad.int_educ    11 15970 16042 -7974.0    15948                     
## RIM.quad.int_urban   11 15969 16041 -7973.6    15947 0.7717  0
### should keep the two interaction terms for now 
Step 3: Add random slope to SumSS (AnySS also tried, but model wont converge)
summary(RSM.quad.int_urban <- lmer(sqrt(EmoProblem) ~ 
                                     #SumSS*ModalEducation_bylevels_L2 + 
                                     SumSS*Urbanicity_L2 +
                                     SumSS + 
                                     I(SumSS^2) + 
                                     MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                           (1 + SumSS| CLUSTERID), data = dat2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: sqrt(EmoProblem) ~ SumSS * Urbanicity_L2 + SumSS + I(SumSS^2) +  
##     MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 +  
##     Urbanicity_L2 + ModalEducation_bylevels_L2 + (1 + SumSS |      CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 15990.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.1174 -0.6488 -0.0128  0.6363  3.6467 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev. Corr
##  CLUSTERID (Intercept) 0.029289 0.17114      
##            SumSS       0.001238 0.03519  0.56
##  Residual              1.298268 1.13942      
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                              Estimate Std. Error         df t value Pr(>|t|)
## (Intercept)                   3.22534    0.20999  121.11354  15.360   <2e-16
## SumSS                         0.14680    0.08273  249.43665   1.774   0.0772
## Urbanicity_L2                -0.09648    0.04901  120.46576  -1.968   0.0513
## I(SumSS^2)                   -0.03952    0.01653 1341.57057  -2.391   0.0170
## MoneyProblem                  0.09339    0.04343 5035.78743   2.150   0.0316
## PerPoverty_bylevels_L2        0.01706    0.03604  130.43519   0.474   0.6366
## ModalRace_bylevels_L2         0.06763    0.05918  105.00114   1.143   0.2558
## ModalEducation_bylevels_L2   -0.11388    0.07195  117.06482  -1.583   0.1162
## SumSS:Urbanicity_L2           0.08182    0.04176   98.40920   1.959   0.0529
##                               
## (Intercept)                ***
## SumSS                      .  
## Urbanicity_L2              .  
## I(SumSS^2)                 *  
## MoneyProblem               *  
## PerPoverty_bylevels_L2        
## ModalRace_bylevels_L2         
## ModalEducation_bylevels_L2    
## SumSS:Urbanicity_L2        .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SumSS  Urb_L2 I(SSS^ MnyPrb PP__L2 MR__L2 ME__L2
## SumSS       -0.094                                                 
## Urbancty_L2 -0.382  0.235                                          
## I(SumSS^2)   0.040 -0.673 -0.037                                   
## MoneyProblm -0.068 -0.064  0.039  0.052                            
## PrPvrty__L2 -0.523 -0.040 -0.100  0.023 -0.004                     
## MdlRc_by_L2 -0.403 -0.001  0.008  0.005  0.009 -0.137              
## MdlEdct__L2 -0.887  0.007  0.093 -0.023  0.038  0.526  0.168       
## SmSS:Urb_L2  0.094 -0.804 -0.288  0.176 -0.017  0.007 -0.015  0.016
summary(RSM.quad.int_educ <- lmer(sqrt(EmoProblem) ~ 
                           SumSS*ModalEducation_bylevels_L2 + 
                           #SumSS*Urbanicity_L2 +
                           SumSS + 
                           I(SumSS^2) + 
                           MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                           (1 + SumSS| CLUSTERID), data = dat2)) 
## boundary (singular) fit: see help('isSingular')
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: sqrt(EmoProblem) ~ SumSS * ModalEducation_bylevels_L2 + SumSS +  
##     I(SumSS^2) + MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 +  
##     Urbanicity_L2 + ModalEducation_bylevels_L2 + (1 + SumSS |      CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 15991.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.2058 -0.6467 -0.0171  0.6405  3.6348 
## 
## Random effects:
##  Groups    Name        Variance  Std.Dev. Corr
##  CLUSTERID (Intercept) 0.0296192 0.17210      
##            SumSS       0.0004062 0.02016  1.00
##  Residual              1.2988978 1.13969      
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                                    Estimate Std. Error         df t value
## (Intercept)                         3.12500    0.21249  122.23533  14.706
## SumSS                               0.42277    0.09793  817.66087   4.317
## ModalEducation_bylevels_L2         -0.08163    0.07485  122.30818  -1.091
## I(SumSS^2)                         -0.04512    0.01622 3509.07201  -2.782
## MoneyProblem                        0.09491    0.04342 5079.34840   2.186
## PerPoverty_bylevels_L2              0.01517    0.03610  129.39944   0.420
## ModalRace_bylevels_L2               0.06577    0.05930  103.86637   1.109
## Urbanicity_L2                      -0.06871    0.04704  122.84379  -1.461
## SumSS:ModalEducation_bylevels_L2   -0.07918    0.04606  577.07674  -1.719
##                                  Pr(>|t|)    
## (Intercept)                       < 2e-16 ***
## SumSS                            1.77e-05 ***
## ModalEducation_bylevels_L2        0.27760    
## I(SumSS^2)                        0.00543 ** 
## MoneyProblem                      0.02887 *  
## PerPoverty_bylevels_L2            0.67495    
## ModalRace_bylevels_L2             0.26994    
## Urbanicity_L2                     0.14662    
## SumSS:ModalEducation_bylevels_L2  0.08614 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SumSS  ME__L2 I(SSS^ MnyPrb PP__L2 MR__L2 Urb_L2
## SumSS       -0.162                                                 
## MdlEdct__L2 -0.893  0.250                                          
## I(SumSS^2)   0.023 -0.456 -0.026                                   
## MoneyProblm -0.066 -0.062  0.038  0.056                            
## PrPvrty__L2 -0.514 -0.051  0.499  0.021 -0.003                     
## MdlRc_by_L2 -0.391 -0.044  0.152  0.008  0.009 -0.136              
## Urbancty_L2 -0.368  0.003  0.098  0.016  0.036 -0.102  0.004       
## SmSS:ME__L2  0.169 -0.865 -0.271  0.001 -0.004  0.026  0.038 -0.001
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
summary(RSM.quad.int <- lmer(sqrt(EmoProblem) ~ 
                               SumSS*ModalEducation_bylevels_L2 + 
                               SumSS*Urbanicity_L2 +
                               SumSS + 
                               I(SumSS^2) +  
                               MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                           (1 + SumSS| CLUSTERID), data = dat2)) 
## boundary (singular) fit: see help('isSingular')
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: sqrt(EmoProblem) ~ SumSS * ModalEducation_bylevels_L2 + SumSS *  
##     Urbanicity_L2 + SumSS + I(SumSS^2) + MoneyProblem + PerPoverty_bylevels_L2 +  
##     ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +  
##     (1 + SumSS | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 15993.2
## 
## Scaled residuals: 
##    Min     1Q Median     3Q    Max 
## -3.160 -0.649 -0.016  0.640  3.646 
## 
## Random effects:
##  Groups    Name        Variance  Std.Dev. Corr
##  CLUSTERID (Intercept) 0.0295150 0.17180      
##            SumSS       0.0005676 0.02382  1.00
##  Residual              1.2982315 1.13940      
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                                    Estimate Std. Error         df t value
## (Intercept)                         3.17285    0.21473  124.98390  14.776
## SumSS                               0.27988    0.13293  929.74075   2.105
## ModalEducation_bylevels_L2         -0.08792    0.07496  122.95068  -1.173
## Urbanicity_L2                      -0.09226    0.04921  126.77838  -1.875
## I(SumSS^2)                         -0.04036    0.01651 3708.54242  -2.444
## MoneyProblem                        0.09347    0.04343 5079.95033   2.152
## PerPoverty_bylevels_L2              0.01576    0.03622  130.37982   0.435
## ModalRace_bylevels_L2               0.06506    0.05955  105.28256   1.093
## SumSS:ModalEducation_bylevels_L2   -0.06102    0.04769  561.61949  -1.280
## SumSS:Urbanicity_L2                 0.06855    0.04271  706.57319   1.605
##                                  Pr(>|t|)    
## (Intercept)                        <2e-16 ***
## SumSS                              0.0355 *  
## ModalEducation_bylevels_L2         0.2431    
## Urbanicity_L2                      0.0631 .  
## I(SumSS^2)                         0.0146 *  
## MoneyProblem                       0.0314 *  
## PerPoverty_bylevels_L2             0.6642    
## ModalRace_bylevels_L2              0.2770    
## SumSS:ModalEducation_bylevels_L2   0.2012    
## SumSS:Urbanicity_L2                0.1089    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SumSS  ME__L2 Urb_L2 I(SSS^ MnyPrb PP__L2 MR__L2 SSS:ME
## SumSS       -0.204                                                        
## MdlEdct__L2 -0.891  0.213                                                 
## Urbancty_L2 -0.387  0.196  0.108                                          
## I(SumSS^2)   0.047 -0.455 -0.034 -0.039                                   
## MoneyProblm -0.068 -0.033  0.039  0.040  0.051                            
## PrPvrty__L2 -0.508 -0.048  0.499 -0.102  0.024 -0.004                     
## MdlRc_by_L2 -0.389 -0.028  0.153  0.006  0.007  0.009 -0.136              
## SmSS:ME__L2  0.190 -0.785 -0.266 -0.071  0.047 -0.009  0.029  0.034       
## SmSS:Urb_L2  0.131 -0.674 -0.050 -0.287  0.184 -0.019  0.015 -0.006  0.244
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
summary(RSM.quad <- lmer(sqrt(EmoProblem) ~ 
                      SumSS + 
                      I(SumSS^2) + 
                      MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                      (1 + SumSS| CLUSTERID), data = dat2)) 
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## sqrt(EmoProblem) ~ SumSS + I(SumSS^2) + MoneyProblem + PerPoverty_bylevels_L2 +  
##     ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +  
##     (1 + SumSS | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 15989.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.1567 -0.6530 -0.0159  0.6448  3.6334 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev. Corr
##  CLUSTERID (Intercept) 0.029364 0.17136      
##            SumSS       0.001593 0.03992  0.34
##  Residual              1.299066 1.13977      
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                              Estimate Std. Error         df t value Pr(>|t|)
## (Intercept)                   3.18528    0.20813  118.51817  15.305  < 2e-16
## SumSS                         0.27732    0.04931 1121.58094   5.623 2.36e-08
## I(SumSS^2)                   -0.04519    0.01629 1095.09479  -2.774  0.00563
## MoneyProblem                  0.09521    0.04343 5031.09650   2.192  0.02842
## PerPoverty_bylevels_L2        0.01689    0.03585  129.32817   0.471  0.63831
## ModalRace_bylevels_L2         0.06969    0.05878  103.09244   1.185  0.23855
## Urbanicity_L2                -0.06754    0.04676  123.05672  -1.444  0.15114
## ModalEducation_bylevels_L2   -0.11677    0.07162  116.66106  -1.631  0.10568
##                               
## (Intercept)                ***
## SumSS                      ***
## I(SumSS^2)                 ** 
## MoneyProblem               *  
## PerPoverty_bylevels_L2        
## ModalRace_bylevels_L2         
## Urbanicity_L2                 
## ModalEducation_bylevels_L2    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SumSS  I(SSS^ MnyPrb PP__L2 MR__L2 Urb_L2
## SumSS       -0.032                                          
## I(SumSS^2)   0.024 -0.906                                   
## MoneyProblm -0.067 -0.130  0.055                            
## PrPvrty__L2 -0.527 -0.058  0.021 -0.003                     
## MdlRc_by_L2 -0.403 -0.024  0.008  0.009 -0.136              
## Urbancty_L2 -0.372  0.005  0.017  0.036 -0.102  0.003       
## MdlEdct__L2 -0.893  0.034 -0.026  0.039  0.526  0.169  0.102
summary(RSM <- lmer(sqrt(EmoProblem) ~ 
                          SumSS + 
                          MoneyProblem + PerPoverty_bylevels_L2 + ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +
                          (1 + SumSS| CLUSTERID), data = dat2))
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: sqrt(EmoProblem) ~ SumSS + MoneyProblem + PerPoverty_bylevels_L2 +  
##     ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +  
##     (1 + SumSS | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 15991.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.1093 -0.6557 -0.0077  0.6361  3.6214 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev. Corr
##  CLUSTERID (Intercept) 0.029932 0.17301      
##            SumSS       0.001736 0.04166  0.26
##  Residual              1.300589 1.14043      
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                              Estimate Std. Error         df t value Pr(>|t|)
## (Intercept)                   3.19737    0.20851  118.45995  15.334  < 2e-16
## SumSS                         0.15353    0.02090   91.35954   7.345 8.35e-11
## MoneyProblem                  0.10194    0.04340 5002.33044   2.349   0.0189
## PerPoverty_bylevels_L2        0.01918    0.03590  129.03561   0.534   0.5941
## ModalRace_bylevels_L2         0.07121    0.05886  102.55886   1.210   0.2291
## Urbanicity_L2                -0.06466    0.04686  123.05600  -1.380   0.1701
## ModalEducation_bylevels_L2   -0.12202    0.07174  116.70361  -1.701   0.0917
##                               
## (Intercept)                ***
## SumSS                      ***
## MoneyProblem               *  
## PerPoverty_bylevels_L2        
## ModalRace_bylevels_L2         
## Urbanicity_L2                 
## ModalEducation_bylevels_L2 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SumSS  MnyPrb PP__L2 MR__L2 Urb_L2
## SumSS       -0.026                                   
## MoneyProblm -0.069 -0.189                            
## PrPvrty__L2 -0.528 -0.093 -0.004                     
## MdlRc_by_L2 -0.404 -0.040  0.008 -0.136              
## Urbancty_L2 -0.373  0.049  0.035 -0.102  0.003       
## MdlEdct__L2 -0.893  0.024  0.040  0.527  0.170  0.102
# Modal comparisons 
anova(RIM.quad.int, RSM.quad.int)[1:8] # ns, nested, RIM fit better 
## refitting model(s) with ML (instead of REML)
##              npar   AIC   BIC  logLik deviance Chisq Df Pr(>Chisq)
## RIM.quad.int   13 15971 16056 -7972.4    15945                    
## RSM.quad.int   14 15973 16064 -7972.5    15945     0  1          1
anova(RIM.quad.int_educ, RSM.quad.int_educ)[1:8] # ns, nested, RIM fit better
## refitting model(s) with ML (instead of REML)
##                   npar   AIC   BIC  logLik deviance  Chisq Df Pr(>Chisq)
## RIM.quad.int_educ   11 15970 16042 -7974.0    15948                     
## RSM.quad.int_educ   13 15973 16058 -7973.7    15947 0.4719  2     0.7898
anova(RIM.quad.int_urban, RSM.quad.int_urban) [1:8]# ns, nested, RIM fit better
## refitting model(s) with ML (instead of REML)
##                    npar   AIC   BIC  logLik deviance  Chisq Df Pr(>Chisq)
## RIM.quad.int_urban   11 15969 16041 -7973.6    15947                     
## RSM.quad.int_urban   13 15972 16058 -7973.3    15946 0.6294  2       0.73
anova(RIM.quad, RSM.quad)[1:8] # ns, nested, RIM fit better
## refitting model(s) with ML (instead of REML)
##          npar   AIC   BIC  logLik deviance  Chisq Df Pr(>Chisq)
## RIM.quad   10 15971 16036 -7975.4    15951                     
## RSM.quad   12 15974 16053 -7975.1    15950 0.4223  2     0.8096
anova(RIM, RSM)[1:8] # ns, nested, RIM fit better
## refitting model(s) with ML (instead of REML)
##     npar   AIC   BIC  logLik deviance  Chisq Df Pr(>Chisq)
## RIM    9 15976 16035 -7979.2    15958                     
## RSM   11 15980 16052 -7979.0    15958 0.3555  2     0.8372
# Explore if any RSM fit better than any RIM with quad and int effects
anova(RSM.quad, RIM.quad.int) [1:8]# not supported by BIC, RIM fit better 
## refitting model(s) with ML (instead of REML)
##              npar   AIC   BIC  logLik deviance  Chisq Df Pr(>Chisq)  
## RSM.quad       12 15974 16053 -7975.1    15950                       
## RIM.quad.int   13 15971 16056 -7972.4    15945 5.5074  1    0.01894 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(RSM, RIM.quad.int)[1:8] # RSM fit better than RIM.quad.int, supported by BIC
## refitting model(s) with ML (instead of REML)
##              npar   AIC   BIC  logLik deviance  Chisq Df Pr(>Chisq)   
## RSM            11 15980 16052 -7979.0    15958                        
## RIM.quad.int   13 15971 16056 -7972.4    15945 13.219  2   0.001348 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(RSM, RIM.quad.int_urban)[1:8] # not supported by BIC, RIM fit better 
## refitting model(s) with ML (instead of REML)
##                    npar   AIC   BIC  logLik deviance  Chisq Df Pr(>Chisq)
## RSM                  11 15980 16052 -7979.0    15958                     
## RIM.quad.int_urban   11 15969 16041 -7973.6    15947 10.859  0
anova(RSM, RIM.quad.int_educ)[1:8] # not supported by BIC, RIM fit better 
## refitting model(s) with ML (instead of REML)
##                   npar   AIC   BIC logLik deviance  Chisq Df Pr(>Chisq)
## RSM                 11 15980 16052  -7979    15958                     
## RIM.quad.int_educ   11 15970 16042  -7974    15948 10.088  0
# Explore if RSM fit better than RIM with quad only
anova(RSM, RIM.quad)[1:8] # RIM.quad fit better than RSM, supported by BIC
## refitting model(s) with ML (instead of REML)
##          npar   AIC   BIC  logLik deviance Chisq Df Pr(>Chisq)
## RIM.quad   10 15971 16036 -7975.4    15951                    
## RSM        11 15980 16052 -7979.0    15958     0  1          1
Final model
Final.out <- RIM.quad 
summary(Final.out)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: 
## sqrt(EmoProblem) ~ SumSS + I(SumSS^2) + MoneyProblem + PerPoverty_bylevels_L2 +  
##     ModalRace_bylevels_L2 + Urbanicity_L2 + ModalEducation_bylevels_L2 +  
##     (1 | CLUSTERID)
##    Data: dat2
## 
## REML criterion at convergence: 15990.3
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.1647 -0.6514 -0.0150  0.6407  3.6321 
## 
## Random effects:
##  Groups    Name        Variance Std.Dev.
##  CLUSTERID (Intercept) 0.03173  0.1781  
##  Residual              1.30010  1.1402  
## Number of obs: 5120, groups:  CLUSTERID, 132
## 
## Fixed effects:
##                              Estimate Std. Error         df t value Pr(>|t|)
## (Intercept)                   3.18030    0.20818  118.87872  15.276  < 2e-16
## SumSS                         0.27804    0.04899 5103.21412   5.676 1.46e-08
## I(SumSS^2)                   -0.04462    0.01616 5092.21628  -2.762  0.00577
## MoneyProblem                  0.09521    0.04340 5107.80204   2.194  0.02831
## PerPoverty_bylevels_L2        0.01850    0.03572  128.83186   0.518  0.60549
## ModalRace_bylevels_L2         0.07157    0.05839  102.92022   1.226  0.22309
## Urbanicity_L2                -0.06421    0.04687  123.70674  -1.370  0.17320
## ModalEducation_bylevels_L2   -0.11922    0.07161  117.75817  -1.665  0.09859
##                               
## (Intercept)                ***
## SumSS                      ***
## I(SumSS^2)                 ** 
## MoneyProblem               *  
## PerPoverty_bylevels_L2        
## ModalRace_bylevels_L2         
## Urbanicity_L2                 
## ModalEducation_bylevels_L2 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) SumSS  I(SSS^ MnyPrb PP__L2 MR__L2 Urb_L2
## SumSS       -0.033                                          
## I(SumSS^2)   0.023 -0.910                                   
## MoneyProblm -0.068 -0.132  0.057                            
## PrPvrty__L2 -0.528 -0.057  0.016 -0.001                     
## MdlRc_by_L2 -0.403 -0.028  0.009  0.008 -0.134              
## Urbancty_L2 -0.373  0.000  0.026  0.035 -0.101  0.001       
## MdlEdct__L2 -0.894  0.036 -0.028  0.039  0.528  0.173  0.102
anova(Final.out, RIM.quad.int_urban, RIM.quad.int_educ, RSM)[1:8]
## refitting model(s) with ML (instead of REML)
##                    npar   AIC   BIC  logLik deviance  Chisq Df Pr(>Chisq)  
## Final.out            10 15971 16036 -7975.4    15951                       
## RIM.quad.int_urban   11 15969 16041 -7973.6    15947 3.5699  1    0.05884 .
## RIM.quad.int_educ    11 15970 16042 -7974.0    15948 0.0000  0             
## RSM                  11 15980 16052 -7979.0    15958 0.0000  0             
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1