Stadium_Waste_Analysis_8

Author

Jingyi Yang

Install Packages

library(readxl)
library("readr")
library("tidyverse")
Warning: package 'ggplot2' was built under R version 4.5.2
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ purrr     1.0.4
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   4.0.1     ✔ tibble    3.2.1
✔ lubridate 1.9.4     ✔ tidyr     1.3.1
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(dplyr)
library(lme4)
Loading required package: Matrix

Attaching package: 'Matrix'

The following objects are masked from 'package:tidyr':

    expand, pack, unpack
library(lmerTest)
Warning: package 'lmerTest' was built under R version 4.5.2

Attaching package: 'lmerTest'

The following object is masked from 'package:lme4':

    lmer

The following object is masked from 'package:stats':

    step
library("effectsize")
Warning: package 'effectsize' was built under R version 4.5.2

Import the Data

Clean the data

data_clean <- data %>% select(`Conference`, `School`, `Area Classification (0-Rural; 1-Urban)`, `Year`, `Tenure Year`, `In-Season_Game`, `S_Diversion`, `Attendance`, `Game Time`,`Game result (Win=1; Loss=0)`,`Athletic Dept Profit`, `Athletic Dept Total Expenses`, `Athletic Dept Total Revenues`) # select the column
data_clean$GameTime_numeric <- as.numeric(format(data_clean$`Game Time`, "%H")) + as.numeric(format(data_clean$`Game Time`, "%M"))/60 # convert game time to numerical variable and create a new column
data_clean$`Game Time`=format(data_clean$`Game Time`, format = "%H:%M") # avoid game time impacted by computer system date
data_clean <- data_clean %>% mutate(`Game Time`= as.character(`Game Time`)) %>% mutate(`Area Classification (0-Rural; 1-Urban)`= as.character(`Area Classification (0-Rural; 1-Urban)`)) %>% mutate(`Attendance`= as.numeric(`Attendance`)) # Convert the variable to its suitable data type. 
Warning: There was 1 warning in `mutate()`.
ℹ In argument: `Attendance = as.numeric(Attendance)`.
Caused by warning:
! NAs introduced by coercion
cols_to_factor <- data_clean%>% select_if(is.character) %>% colnames() 
cols_to_factor
[1] "Conference"                            
[2] "School"                                
[3] "Area Classification (0-Rural; 1-Urban)"
[4] "Game Time"                             
[5] "Game result (Win=1; Loss=0)"           
 data_clean <- data_clean %>% 
  mutate(`Game result (Win=1; Loss=0)` = na_if(`Game result (Win=1; Loss=0)`, "N/A")) %>%
          mutate(across(all_of(cols_to_factor), as.factor)) # Make sure there is no NA level.
data_clean <- subset(data_clean, !is.na(`Game result (Win=1; Loss=0)`)) # Clean the game that is being cancelled.
data_clean$GameTime_numeric_c_1 <- with(data_clean, ifelse(
  GameTime_numeric >= 9 &  GameTime_numeric < 12, 1,  # Morning
  ifelse(GameTime_numeric >= 12 & GameTime_numeric < 15.5, 2,   # noon
  ifelse(GameTime_numeric >= 15.5 & GameTime_numeric < 19, 3,   # afternoon
  ifelse(GameTime_numeric >= 19,  4,   # evening
  NA)))                                
)) # Classify game time into four time slots.
data_clean$GameTime_numeric_c_2 <-  data_clean$GameTime_numeric-12 # centralize game time by 12
data_clean$`In-Season_Game_Centered` <- with(data_clean,
  ifelse(`In-Season_Game` == 1, 0,
  ifelse(`In-Season_Game` == 2, 1,
  ifelse(`In-Season_Game` == 3, 2,
  ifelse(`In-Season_Game` == 4, 3,
  ifelse(`In-Season_Game` == 5, 4,
  ifelse(`In-Season_Game` == 6, 5,
  ifelse(`In-Season_Game` == 7, 6,
  ifelse(`In-Season_Game` == 8, 7,
  ifelse(`In-Season_Game` == 9, 8, NA)))))))))
) # Centralize in the in-season game to 0.
data_clean$`Tenure Year Centered` <- with(data_clean,
  ifelse(`Tenure Year` == 1, 0,
  ifelse(`Tenure Year` == 2, 1,
  ifelse(`Tenure Year` == 3, 2,
  ifelse(`Tenure Year` == 4, 3,
  ifelse(`Tenure Year` == 5, 4,
  ifelse(`Tenure Year` == 6, 5,
  ifelse(`Tenure Year` == 7, 6,
  ifelse(`Tenure Year` == 8, 7,
  ifelse(`Tenure Year` == 9, 8,
  ifelse(`Tenure Year` == 10, 9,
  ifelse(`Tenure Year` == 11, 10,
  ifelse(`Tenure Year` == 12, 11,
  ifelse(`Tenure Year` == 13, 12,
  ifelse(`Tenure Year` == 14, 13,
  ifelse(`Tenure Year` == 15, 14,
  ifelse(`Tenure Year` == 16, 15,
  ifelse(`Tenure Year` == 17, 16,
  ifelse(`Tenure Year` == 18, 17,
  ifelse(`Tenure Year` == 19, 18,
  ifelse(`Tenure Year` == 20, 19,
         NA))))))))))))))))))))
)  # Centralize the tenure year to 0.
data_clean$Year_Centered <- with(data_clean,
  ifelse(`Year` == 2003, 0,
  ifelse(`Year` == 2004, 1,
  ifelse(`Year` == 2005, 2,
  ifelse(`Year` == 2006, 3,
  ifelse(`Year` == 2007, 4,
  ifelse(`Year` == 2008, 5,
  ifelse(`Year` == 2009, 6,
  ifelse(`Year` == 2010, 7,
  ifelse(`Year` == 2011, 8,
  ifelse(`Year` == 2012, 9,
  ifelse(`Year` == 2013, 10,
  ifelse(`Year` == 2014, 11,
  ifelse(`Year` == 2015, 12,
  ifelse(`Year` == 2016, 13,
  ifelse(`Year` == 2017, 14,
  ifelse(`Year` == 2018, 15,
  ifelse(`Year` == 2019, 16,
  ifelse(`Year` == 2020, 17,
  ifelse(`Year` == 2021, 18,
  ifelse(`Year` == 2022, 19,
  ifelse(`Year` == 2023, 20,
  ifelse(`Year` == 2024, 21,
         NA))))))))))))))))))))))
) # centralize year to 0.
data_clean <- data_clean %>% dplyr::rename(`conference`= `Conference`,
                                    `school`= `School`,
                                    `area_classification` = `Area Classification (0-Rural; 1-Urban)`,
                                    `year`= `Year`,
                                    `tenure_year` = `Tenure Year`,
                                    `s_game`= `In-Season_Game`,
                                    `s_diversion`= `S_Diversion`,
                                    `attendance`= `Attendance`,
                                    `game_time`= `Game Time`,
                                    `game_result`= `Game result (Win=1; Loss=0)`,
                                    `profit`= `Athletic Dept Profit`,
                                    `total_expenses`= `Athletic Dept Total Expenses`,
                                    `total_revenues`= `Athletic Dept Total Revenues`,
                                    `game_time_chars_c_1`= `GameTime_numeric_c_1`,
                                    `game_time_num_c_2`= `GameTime_numeric_c_2`,
                                    `s_game_c`= `In-Season_Game_Centered`,
                                    `tenure_year_c`= `Tenure Year Centered`,
                                    `year_c`= `Year_Centered`
                                    ) %>% select(- `GameTime_numeric`) # rename the columns.

data_clean$game_time_chars_c_1 <-as.factor(data_clean$game_time_chars_c_1) # Change the variable into a factor variable.
# 
data_clean %<>%
  group_by(school) %>%
  mutate(attendance_mean_school = mean(attendance, na.rm = TRUE)) %>%
  mutate(attendance_cwc_school = attendance - attendance_mean_school) %>%
  ungroup()
data_clean %<>%
  group_by(school) %>%
  mutate(attendance_mean_school = mean(attendance, na.rm = TRUE)) %>%
  mutate(attendance_school_z = (attendance - attendance_mean_school)/sd(attendance)) %>%
  ungroup()
data_clean %<>%
  group_by(year) %>%
  mutate(attendance_mean_year = mean(attendance, na.rm = TRUE)) %>%
  mutate(attendance_cwc_year = attendance - attendance_mean_year) %>%
  ungroup()
data_clean %<>%
  group_by(year) %>%
  mutate(attendance_mean_school = mean(attendance, na.rm = TRUE)) %>%
  mutate(attendance_year_z = (attendance - attendance_mean_school)/sd(attendance)) %>%
  ungroup()
data_clean %<>%
mutate(total_revenues_mean = mean(total_revenues, na.rm = TRUE)) %>%
mutate(total_revenues_cgm = total_revenues - total_revenues_mean)
data_clean %<>%
mutate(total_revenues_mean = mean(total_revenues, na.rm = TRUE)) %>%
mutate(total_revenues_z = (total_revenues - total_revenues_mean)/sd(total_revenues,na.rm = TRUE))
str(data_clean)
tibble [1,390 × 27] (S3: tbl_df/tbl/data.frame)
 $ conference            : Factor w/ 5 levels "ACC","Big10",..: 4 4 4 4 4 4 4 4 4 4 ...
 $ school                : Factor w/ 31 levels "Arizona State",..: 1 1 1 1 1 1 1 1 1 1 ...
 $ area_classification   : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
 $ year                  : num [1:1390] 2015 2015 2015 2015 2015 ...
 $ tenure_year           : num [1:1390] 1 1 1 1 1 1 1 2 2 2 ...
 $ s_game                : num [1:1390] 1 2 3 4 5 6 7 1 2 3 ...
 $ s_diversion           : num [1:1390] 0.44 0.412 0.315 0.57 0.579 ...
 $ attendance            : num [1:1390] 46500 43310 61904 44157 56534 ...
 $ game_time             : Factor w/ 54 levels "09:00","10:00",..: 49 44 46 44 46 13 15 49 44 44 ...
 $ game_result           : Factor w/ 2 levels "0","1": 2 2 1 2 1 2 2 2 2 2 ...
 $ profit                : num [1:1390] 566524 566524 566524 566524 566524 ...
 $ total_expenses        : num [1:1390] 83873516 83873516 83873516 83873516 83873516 ...
 $ total_revenues        : num [1:1390] 84440040 84440040 84440040 84440040 84440040 ...
 $ game_time_chars_c_1   : Factor w/ 4 levels "1","2","3","4": 4 4 4 4 4 2 2 4 4 4 ...
 $ game_time_num_c_2     : num [1:1390] 8 7 7.5 7 7.5 1 1.5 8 7 7 ...
 $ s_game_c              : num [1:1390] 0 1 2 3 4 5 6 0 1 2 ...
 $ tenure_year_c         : num [1:1390] 0 0 0 0 0 0 0 1 1 1 ...
 $ year_c                : num [1:1390] 12 12 12 12 12 12 12 13 13 13 ...
 $ attendance_mean_school: num [1:1390] 70003 70003 70003 70003 70003 ...
 $ attendance_cwc_school : num [1:1390] -3509 -6699 11895 -5852 6525 ...
 $ attendance_school_z   : num [1:1390] -0.65 -1.24 2.2 -1.08 1.21 ...
 $ attendance_mean_year  : num [1:1390] 70003 70003 70003 70003 70003 ...
 $ attendance_cwc_year   : num [1:1390] -23503 -26693 -8099 -25846 -13469 ...
 $ attendance_year_z     : num [1:1390] -0.856 -0.972 -0.295 -0.941 -0.49 ...
 $ total_revenues_mean   : num [1:1390] 1.25e+08 1.25e+08 1.25e+08 1.25e+08 1.25e+08 ...
 $ total_revenues_cgm    : num [1:1390] -40621158 -40621158 -40621158 -40621158 -40621158 ...
 $ total_revenues_z      : num [1:1390] -0.833 -0.833 -0.833 -0.833 -0.833 ...
summary_df <- summarytools::dfSummary(data_clean,
                                     varnumbers=FALSE,
                                     plain.ascii=FALSE,
                                     style="grid",
                                     graph.col = TRUE,
                                     valid.col=FALSE)

# Print the summary table and suppress warnings
print(summary_df,
      method="render",
      table.classes="table-condensed")

Data Frame Summary

data_clean

Dimensions: 1390 x 27
Duplicates: 0
Variable Stats / Values Freqs (% of Valid) Graph Missing
conference [factor]
1. ACC
2. Big10
3. Big12
4. Pac12
5. SEC
230 ( 16.5% )
594 ( 42.7% )
77 ( 5.5% )
221 ( 15.9% )
268 ( 19.3% )
0 (0.0%)
school [factor]
1. Arizona State
2. Arkansas
3. Auburn
4. Clemson
5. Colorado University
6. Duke
7. Florida
8. Georgia
9. Georgia Tech
10. Illinois
[ 21 others ]
33 ( 2.4% )
6 ( 0.4% )
36 ( 2.6% )
28 ( 2.0% )
59 ( 4.2% )
38 ( 2.7% )
43 ( 3.1% )
36 ( 2.6% )
33 ( 2.4% )
28 ( 2.0% )
1050 ( 75.5% )
0 (0.0%)
area_classification [factor]
1. 0
2. 1
149 ( 10.7% )
1241 ( 89.3% )
0 (0.0%)
year [numeric]
Mean (sd) : 2015.2 (4.6)
min ≤ med ≤ max:
2003 ≤ 2016 ≤ 2024
IQR (CV) : 5 (0)
22 distinct values 0 (0.0%)
tenure_year [numeric]
Mean (sd) : 6 (4.6)
min ≤ med ≤ max:
1 ≤ 4 ≤ 20
IQR (CV) : 7 (0.8)
20 distinct values 0 (0.0%)
s_game [numeric]
Mean (sd) : 3.9 (2)
min ≤ med ≤ max:
1 ≤ 4 ≤ 9
IQR (CV) : 4 (0.5)
1 : 208 ( 15.0% )
2 : 212 ( 15.3% )
3 : 210 ( 15.1% )
4 : 206 ( 14.8% )
5 : 204 ( 14.7% )
6 : 199 ( 14.3% )
7 : 131 ( 9.4% )
8 : 19 ( 1.4% )
9 : 1 ( 0.1% )
0 (0.0%)
s_diversion [numeric]
Mean (sd) : 0.4 (0.3)
min ≤ med ≤ max:
0 ≤ 0.3 ≤ 1
IQR (CV) : 0.5 (0.7)
1300 distinct values 0 (0.0%)
attendance [numeric]
Mean (sd) : 73502.4 (28000.3)
min ≤ med ≤ max:
1275 ≤ 78556 ≤ 115109
IQR (CV) : 53220.2 (0.4)
1200 distinct values 0 (0.0%)
game_time [factor]
1. 09:00
2. 10:00
3. 11:00
4. 11:05
5. 11:30
6. 12:00
7. 12:05
8. 12:10
9. 12:15
10. 12:20
[ 44 others ]
1 ( 0.1% )
2 ( 0.1% )
58 ( 4.2% )
2 ( 0.1% )
7 ( 0.5% )
357 ( 25.7% )
1 ( 0.1% )
2 ( 0.1% )
1 ( 0.1% )
17 ( 1.2% )
942 ( 67.8% )
0 (0.0%)
game_result [factor]
1. 0
2. 1
416 ( 29.9% )
974 ( 70.1% )
0 (0.0%)
profit [numeric]
Mean (sd) : 4402410 (12985885)
min ≤ med ≤ max:
-64721133 ≤ 1763077 ≤ 65413805
IQR (CV) : 8224233 (2.9)
187 distinct values 0 (0.0%)
total_expenses [numeric]
Mean (sd) : 120146058 (46391323)
min ≤ med ≤ max:
48207321 ≤ 115200187 ≤ 327782612
IQR (CV) : 52873412 (0.4)
189 distinct values 145 (10.4%)
total_revenues [numeric]
Mean (sd) : 125061198 (48788850)
min ≤ med ≤ max:
47191240 ≤ 122739052 ≤ 331905866
IQR (CV) : 58431052 (0.4)
189 distinct values 145 (10.4%)
game_time_chars_c_1 [factor]
1. 1
2. 2
3. 3
4. 4
70 ( 5.0% )
574 ( 41.3% )
431 ( 31.0% )
315 ( 22.7% )
0 (0.0%)
game_time_num_c_2 [numeric]
Mean (sd) : 3.2 (3)
min ≤ med ≤ max:
-3 ≤ 3.5 ≤ 9.2
IQR (CV) : 6 (0.9)
54 distinct values 0 (0.0%)
s_game_c [numeric]
Mean (sd) : 2.9 (2)
min ≤ med ≤ max:
0 ≤ 3 ≤ 8
IQR (CV) : 4 (0.7)
0 : 208 ( 15.0% )
1 : 212 ( 15.3% )
2 : 210 ( 15.1% )
3 : 206 ( 14.8% )
4 : 204 ( 14.7% )
5 : 199 ( 14.3% )
6 : 131 ( 9.4% )
7 : 19 ( 1.4% )
8 : 1 ( 0.1% )
0 (0.0%)
tenure_year_c [numeric]
Mean (sd) : 5 (4.6)
min ≤ med ≤ max:
0 ≤ 3 ≤ 19
IQR (CV) : 7 (0.9)
20 distinct values 0 (0.0%)
year_c [numeric]
Mean (sd) : 12.2 (4.6)
min ≤ med ≤ max:
0 ≤ 13 ≤ 21
IQR (CV) : 5 (0.4)
22 distinct values 0 (0.0%)
attendance_mean_school [numeric]
Mean (sd) : 73502.4 (10360.6)
min ≤ med ≤ max:
20174.2 ≤ 69763.8 ≤ 93025.5
IQR (CV) : 10240.1 (0.1)
22 distinct values 0 (0.0%)
attendance_cwc_school [numeric]
Mean (sd) : 0 (9877.2)
min ≤ med ≤ max:
-101691.4 ≤ 1210.8 ≤ 22855.1
IQR (CV) : 5940.6 (7.226692e+15)
1208 distinct values 0 (0.0%)
attendance_school_z [numeric]
Mean (sd) : 0 (1)
min ≤ med ≤ max:
-8.2 ≤ 0.2 ≤ 2.8
IQR (CV) : 1.1 (7.539083e+15)
1208 distinct values 0 (0.0%)
attendance_mean_year [numeric]
Mean (sd) : 73502.4 (10360.6)
min ≤ med ≤ max:
20174.2 ≤ 69763.8 ≤ 93025.5
IQR (CV) : 10240.1 (0.1)
22 distinct values 0 (0.0%)
attendance_cwc_year [numeric]
Mean (sd) : 0 (26012.9)
min ≤ med ≤ max:
-65750.3 ≤ 5471.4 ≤ 46523.8
IQR (CV) : 44927.9 (-9.66019e+16)
1295 distinct values 0 (0.0%)
attendance_year_z [numeric]
Mean (sd) : 0 (1)
min ≤ med ≤ max:
-2.4 ≤ 0.2 ≤ 2.2
IQR (CV) : 1.7 (-6.897379e+16)
1295 distinct values 0 (0.0%)
total_revenues_mean [numeric] 1 distinct value
125061197.78 ! : 1390 ( 100.0% )
! rounded
0 (0.0%)
total_revenues_cgm [numeric]
Mean (sd) : 0 (48788850)
min ≤ med ≤ max:
-77869958 ≤ -2322146 ≤ 206844668
IQR (CV) : 58431052 (1.340132e+16)
189 distinct values 145 (10.4%)
total_revenues_z [numeric]
Mean (sd) : 0 (1)
min ≤ med ≤ max:
-1.6 ≤ 0 ≤ 4.2
IQR (CV) : 1.2 (1.30046e+16)
189 distinct values 145 (10.4%)

Generated by summarytools 1.1.4 (R version 4.5.1)
2025-11-23

Two level Model

Only fix predictors

model_school <- lmer(
s_diversion ~ game_time_num_c_2 + attendance_school_z+ game_result + s_game_c + area_classification + tenure_year_c + total_revenues_z +conference + (1|school),
data = data_clean
)
summary(model_school)
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: s_diversion ~ game_time_num_c_2 + attendance_school_z + game_result +  
    s_game_c + area_classification + tenure_year_c + total_revenues_z +  
    conference + (1 | school)
   Data: data_clean

REML criterion at convergence: -1294.9

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-3.6657 -0.6203 -0.0476  0.5372  4.0629 

Random effects:
 Groups   Name        Variance Std.Dev.
 school   (Intercept) 0.06242  0.2498  
 Residual             0.01774  0.1332  
Number of obs: 1245, groups:  school, 27

Fixed effects:
                       Estimate Std. Error         df t value Pr(>|t|)    
(Intercept)           5.727e-01  2.069e-01  2.123e+01   2.768   0.0115 *  
game_time_num_c_2    -1.009e-03  1.376e-03  1.214e+03  -0.733   0.4635    
attendance_school_z  -2.103e-03  3.908e-03  1.213e+03  -0.538   0.5906    
game_result1          1.138e-03  9.031e-03  1.214e+03   0.126   0.8997    
s_game_c             -4.704e-04  1.969e-03  1.213e+03  -0.239   0.8112    
area_classification1 -1.347e-01  1.637e-01  2.098e+01  -0.823   0.4199    
tenure_year_c         1.363e-02  1.845e-03  1.233e+03   7.389 2.72e-13 ***
total_revenues_z      5.896e-02  1.005e-02  1.233e+03   5.869 5.62e-09 ***
conferenceBig10      -1.389e-01  1.521e-01  2.102e+01  -0.913   0.3717    
conferenceBig12      -2.880e-01  2.178e-01  2.116e+01  -1.322   0.2003    
conferencePac12      -7.775e-02  1.825e-01  2.113e+01  -0.426   0.6743    
conferenceSEC        -2.361e-01  1.576e-01  2.114e+01  -1.498   0.1490    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) g____2 attn__ gm_rs1 s_gm_c ar_cl1 tnr_y_ ttl_r_ cnfB10
gm_tm_nm__2 -0.025                                                        
attndnc_sc_ -0.006 -0.128                                                 
game_reslt1 -0.032  0.032  0.080                                          
s_game_c    -0.035  0.147 -0.050  0.166                                   
ar_clssfct1 -0.791  0.001 -0.002 -0.007 -0.002                            
tenure_yr_c -0.055 -0.048  0.175  0.003  0.020 -0.001                     
totl_rvns_z  0.071 -0.009 -0.113 -0.059 -0.043 -0.014 -0.783              
confrncBg10 -0.673  0.005  0.004  0.003  0.001  0.216  0.033 -0.050       
confrncBg12 -0.354 -0.004  0.007  0.002  0.005  0.001  0.050 -0.070  0.478
confrncPc12 -0.594 -0.009 -0.004  0.006  0.000  0.226 -0.030  0.020  0.614
conferncSEC -0.486 -0.008  0.009  0.003  0.000  0.001  0.052 -0.060  0.659
            cnfB12 cnfP12
gm_tm_nm__2              
attndnc_sc_              
game_reslt1              
s_game_c                 
ar_clssfct1              
tenure_yr_c              
totl_rvns_z              
confrncBg10              
confrncBg12              
confrncPc12  0.394       
conferncSEC  0.462  0.545
performance::icc(model_school)
# Intraclass Correlation Coefficient

    Adjusted ICC: 0.779
  Unadjusted ICC: 0.662
plot(model_school, type=c("p","smooth"))

  1. The line stay close to zero.
  2. Might violate the heteroscedasticity. The spread of residuals is not constant across the range of fitted values.(fitted values < 0.2, variance is small)
plot(model_school,
     form = sqrt(abs(resid(.))) ~ fitted(.),
     type = c("p","smooth"))

The line is not flat, which shows a non-constant variance pattern.

qqnorm(resid(model_school)); qqline(resid(model_school))

  1. The points almost fit on the reference line. (normally distributed)
qqnorm(ranef(model_school)$school[, "(Intercept)"]);qqline(ranef(model_school)$school[, "(Intercept)"])

  1. Mostly linear between -1 to 1, the majority of school random intercepts follow a normal distribution.
mf <- model.frame(model_school)
res <- residuals(model_school)
par(mfrow=c(2,3))
plot(res ~ mf$game_time_num_c_2,
main = "Residuals vs Game Time (num)",
xlab = "Game Time (centered)", ylab = "Residuals")
plot(res ~ mf$attendance_school_z,
main = "Residuals vs Attendance (CWC)",
xlab = "Attendance CWC", ylab = "Residuals")
plot(res ~ mf$total_revenues_z,
main = "Residuals vs Total Revenues",
xlab = "Revenues (Zscoring)", ylab = "Residuals")
plot(res ~ mf$s_game_c,
main = "Residuals vs Season Game",
xlab = "s_game_c", ylab = "Residuals")
plot(res ~ mf$tenure_year_c,
main = "Residuals vs Tenure",
xlab = "Tenure (centered)", ylab = "Residuals")
plot(res ~ mf$area_classification,
main = "Residuals vs Area",
xlab = "Area (0/1)", ylab = "Residuals")

plot(res ~ mf$conference,
main = "Residuals vs Area",
xlab = "Conference", ylab = "Residuals")

Random Slope Models

The model that treats tenure year as a random slope performs better.

Random Slopes for Attendance

model_school_r_1 <- lmer(
s_diversion ~ game_time_num_c_2 + attendance_school_z+ game_result + s_game_c + area_classification + tenure_year_c + total_revenues_z +conference + (1+attendance_school_z|school),
data = data_clean
)
summary(model_school_r_1)
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: s_diversion ~ game_time_num_c_2 + attendance_school_z + game_result +  
    s_game_c + area_classification + tenure_year_c + total_revenues_z +  
    conference + (1 + attendance_school_z | school)
   Data: data_clean

REML criterion at convergence: -1323.6

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-3.7533 -0.6092 -0.0483  0.5221  3.6153 

Random effects:
 Groups   Name                Variance Std.Dev. Corr
 school   (Intercept)         0.062837 0.25067      
          attendance_school_z 0.000872 0.02953  0.00
 Residual                     0.016917 0.13007      
Number of obs: 1245, groups:  school, 27

Fixed effects:
                       Estimate Std. Error         df t value Pr(>|t|)    
(Intercept)           5.718e-01  2.075e-01  2.122e+01   2.755   0.0118 *  
game_time_num_c_2    -7.037e-04  1.357e-03  1.207e+03  -0.519   0.6042    
attendance_school_z  -3.909e-03  7.172e-03  2.651e+01  -0.545   0.5903    
game_result1         -6.826e-04  8.872e-03  1.203e+03  -0.077   0.9387    
s_game_c             -3.757e-04  1.938e-03  1.204e+03  -0.194   0.8463    
area_classification1 -1.374e-01  1.642e-01  2.098e+01  -0.836   0.4124    
tenure_year_c         1.456e-02  1.846e-03  1.232e+03   7.884 6.92e-15 ***
total_revenues_z      5.817e-02  1.005e-02  1.232e+03   5.789 8.97e-09 ***
conferenceBig10      -1.397e-01  1.526e-01  2.103e+01  -0.915   0.3704    
conferenceBig12      -2.881e-01  2.185e-01  2.115e+01  -1.319   0.2014    
conferencePac12      -8.186e-02  1.830e-01  2.112e+01  -0.447   0.6592    
conferenceSEC        -2.351e-01  1.581e-01  2.114e+01  -1.487   0.1518    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) g____2 attn__ gm_rs1 s_gm_c ar_cl1 tnr_y_ ttl_r_ cnfB10
gm_tm_nm__2 -0.024                                                        
attndnc_sc_ -0.004 -0.076                                                 
game_reslt1 -0.032  0.029  0.052                                          
s_game_c    -0.035  0.144 -0.023  0.169                                   
ar_clssfct1 -0.792  0.001  0.000 -0.006 -0.002                            
tenure_yr_c -0.055 -0.045  0.086  0.001  0.026 -0.001                     
totl_rvns_z  0.071 -0.002 -0.066 -0.058 -0.047 -0.014 -0.781              
confrncBg10 -0.673  0.004  0.003  0.003  0.001  0.216  0.033 -0.050       
confrncBg12 -0.354 -0.004  0.004  0.002  0.005  0.001  0.050 -0.070  0.478
confrncPc12 -0.594 -0.009 -0.002  0.006  0.000  0.226 -0.030  0.020  0.614
conferncSEC -0.486 -0.009  0.005  0.003  0.000  0.001  0.051 -0.060  0.659
            cnfB12 cnfP12
gm_tm_nm__2              
attndnc_sc_              
game_reslt1              
s_game_c                 
ar_clssfct1              
tenure_yr_c              
totl_rvns_z              
confrncBg10              
confrncBg12              
confrncPc12  0.394       
conferncSEC  0.462  0.546
performance::icc(model_school_r_1)
Warning: Random slopes not present as fixed effects. This artificially inflates
  the conditional random effect variances.
  Respecify the fixed effects structure of your model (add random slopes
  as fixed effects).
# Intraclass Correlation Coefficient

    Adjusted ICC: 0.790
  Unadjusted ICC: 0.668
plot(model_school_r_1, type=c("p","smooth"))

plot(model_school_r_1,
     form = sqrt(abs(resid(.))) ~ fitted(.),
     type = c("p","smooth"))

qqnorm(resid(model_school_r_1)); qqline(resid(model_school_r_1))

qqnorm(ranef(model_school_r_1)$school[, "(Intercept)"]);qqline(ranef(model_school_r_1)$school[, "(Intercept)"])

Random Slopes for tenure year

model_school_r_2 <- lmer(
s_diversion ~ game_time_num_c_2 + attendance_school_z+ game_result + s_game_c + area_classification + tenure_year_c + total_revenues_z +conference + (1+tenure_year_c|school),
data = data_clean
)
summary(model_school_r_2)
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: s_diversion ~ game_time_num_c_2 + attendance_school_z + game_result +  
    s_game_c + area_classification + tenure_year_c + total_revenues_z +  
    conference + (1 + tenure_year_c | school)
   Data: data_clean

REML criterion at convergence: -1684

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-4.3705 -0.5636 -0.0676  0.4748  3.9509 

Random effects:
 Groups   Name          Variance Std.Dev. Corr 
 school   (Intercept)   0.058179 0.2412        
          tenure_year_c 0.001163 0.0341   -0.20
 Residual               0.012213 0.1105        
Number of obs: 1245, groups:  school, 27

Fixed effects:
                       Estimate Std. Error         df t value Pr(>|t|)  
(Intercept)           5.225e-01  1.965e-01  2.087e+01   2.659   0.0147 *
game_time_num_c_2    -3.605e-04  1.150e-03  1.196e+03  -0.313   0.7540  
attendance_school_z   2.736e-03  3.417e-03  1.209e+03   0.801   0.4234  
game_result1          8.230e-03  7.594e-03  1.196e+03   1.084   0.2787  
s_game_c             -5.605e-04  1.637e-03  1.191e+03  -0.342   0.7321  
area_classification1 -7.620e-02  1.557e-01  2.072e+01  -0.490   0.6296  
tenure_year_c         7.593e-03  7.401e-03  2.509e+01   1.026   0.3148  
total_revenues_z      2.377e-02  9.252e-03  1.221e+03   2.569   0.0103 *
conferenceBig10      -1.402e-01  1.439e-01  2.038e+01  -0.974   0.3415  
conferenceBig12      -2.587e-01  2.064e-01  2.067e+01  -1.253   0.2241  
conferencePac12      -2.896e-03  1.775e-01  2.245e+01  -0.016   0.9871  
conferenceSEC        -2.301e-01  1.492e-01  2.049e+01  -1.543   0.1382  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) g____2 attn__ gm_rs1 s_gm_c ar_cl1 tnr_y_ ttl_r_ cnfB10
gm_tm_nm__2 -0.021                                                        
attndnc_sc_ -0.010 -0.116                                                 
game_reslt1 -0.032  0.040  0.097                                          
s_game_c    -0.032  0.148 -0.046  0.169                                   
ar_clssfct1 -0.792  0.001  0.002 -0.001  0.000                            
tenure_yr_c -0.053 -0.014  0.049 -0.018  0.007 -0.011                     
totl_rvns_z  0.065 -0.004 -0.087 -0.036 -0.032 -0.018 -0.181              
confrncBg10 -0.672  0.005  0.010  0.005  0.001  0.217  0.008 -0.041       
confrncBg12 -0.350 -0.004  0.012  0.005  0.006  0.001  0.007 -0.044  0.475
confrncPc12 -0.593 -0.008  0.004  0.018  0.003  0.242 -0.043  0.013  0.603
conferncSEC -0.484 -0.008  0.005  0.002 -0.001  0.001  0.019 -0.052  0.658
            cnfB12 cnfP12
gm_tm_nm__2              
attndnc_sc_              
game_reslt1              
s_game_c                 
ar_clssfct1              
tenure_yr_c              
totl_rvns_z              
confrncBg10              
confrncBg12              
confrncPc12  0.384       
conferncSEC  0.459  0.531
performance::icc(model_school_r_2)
# Intraclass Correlation Coefficient

    Adjusted ICC: 0.891
  Unadjusted ICC: 0.824
plot(model_school_r_2, type=c("p","smooth"))

plot(model_school_r_2,
     form = sqrt(abs(resid(.))) ~ fitted(.),
     type = c("p","smooth"))

qqnorm(resid(model_school_r_2)); qqline(resid(model_school_r_2))

qqnorm(ranef(model_school_r_2)$school[, "(Intercept)"]);qqline(ranef(model_school_r_2)$school[, "(Intercept)"])

Buildmer function

The buildmer function does not work very well for the model.

library(buildmer)
Warning: package 'buildmer' was built under R version 4.5.2
data_clean_new<-data_clean %>% select(c(game_time_num_c_2,attendance_school_z, game_result,s_game_c,area_classification,tenure_year_c,total_revenues_z,conference))
f <- s_diversion ~ game_time_num_c_2 + attendance_school_z+ game_result + s_game_c + area_classification + tenure_year_c + total_revenues_z +conference + (s_game_c + attendance_school_z + game_time_num_c_2 + game_result|school)
m <- buildmer(
  f,
  data = data_clean,
  buildmerControl = buildmerControl(
    direction = "order",
    args = list(control = lmerControl(optimizer = "bobyqa"))
  )
)
Determining predictor order
Fitting via lm: s_diversion ~ 1
Currently evaluating LRT for: game_time_num_c_2, attendance_school_z,
    game_result, s_game_c, area_classification, tenure_year_c,
    total_revenues_z, conference
Fitting via lm: s_diversion ~ 1 + game_time_num_c_2
Fitting via lm: s_diversion ~ 1 + attendance_school_z
Fitting via lm: s_diversion ~ 1 + game_result
Fitting via lm: s_diversion ~ 1 + s_game_c
Fitting via lm: s_diversion ~ 1 + area_classification
Fitting via lm: s_diversion ~ 1 + tenure_year_c
Fitting via lm: s_diversion ~ 1 + total_revenues_z
Fitting via lm: s_diversion ~ 1 + conference
Updating formula: s_diversion ~ 1 + tenure_year_c
Currently evaluating LRT for: game_time_num_c_2, attendance_school_z,
    game_result, s_game_c, area_classification, total_revenues_z,
    conference
Fitting via lm: s_diversion ~ 1 + tenure_year_c + game_time_num_c_2
Fitting via lm: s_diversion ~ 1 + tenure_year_c + attendance_school_z
Fitting via lm: s_diversion ~ 1 + tenure_year_c + game_result
Fitting via lm: s_diversion ~ 1 + tenure_year_c + s_game_c
Fitting via lm: s_diversion ~ 1 + tenure_year_c + area_classification
Fitting via lm: s_diversion ~ 1 + tenure_year_c + total_revenues_z
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference
Updating formula: s_diversion ~ 1 + tenure_year_c + conference
Currently evaluating LRT for: game_time_num_c_2, attendance_school_z,
    game_result, s_game_c, area_classification, total_revenues_z
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    game_time_num_c_2
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    attendance_school_z
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    game_result
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference + s_game_c
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    area_classification
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z
Currently evaluating LRT for: game_time_num_c_2, attendance_school_z,
    game_result, s_game_c, area_classification
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + attendance_school_z
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_result
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + s_game_c
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + area_classification
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2
Currently evaluating LRT for: attendance_school_z, game_result,
    s_game_c, area_classification
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + game_result
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + s_game_c
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + area_classification
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z
Currently evaluating LRT for: game_result, s_game_c,
    area_classification
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    game_result
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    area_classification
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c
Currently evaluating LRT for: game_result, area_classification
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + game_result
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + area_classification
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + game_result
Currently evaluating LRT for: area_classification
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + game_result + area_classification
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + game_result + area_classification
Fitting via gam, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
Currently evaluating LRT for: 1 | school
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 | school)
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + game_result + area_classification + (1 | school)
Currently evaluating LRT for: s_game_c | school, attendance_school_z |
    school, game_time_num_c_2 | school, game_result | school
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + s_game_c | school)
boundary (singular) fit: see help('isSingular')
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + attendance_school_z | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + game_time_num_c_2 | school)
boundary (singular) fit: see help('isSingular')
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + game_result | school)
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + game_result + area_classification + (1 +
    attendance_school_z | school)
Currently evaluating LRT for: s_game_c | school, game_time_num_c_2 |
    school, game_result | school
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + attendance_school_z + s_game_c | school)
boundary (singular) fit: see help('isSingular')
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + attendance_school_z + game_time_num_c_2 | school)
boundary (singular) fit: see help('isSingular')
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + attendance_school_z + game_result | school)
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + game_result + area_classification + (1 +
    attendance_school_z + game_result | school)
Currently evaluating LRT for: s_game_c | school, game_time_num_c_2 |
    school
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + attendance_school_z + game_result + s_game_c | school)
boundary (singular) fit: see help('isSingular')
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + attendance_school_z + game_result + game_time_num_c_2 |
    school)
boundary (singular) fit: see help('isSingular')
Ending the ordering procedure due to having reached the maximal
    feasible model - all higher models failed to converge. The types of
    convergence failure are: Singular fit
Finalizing by converting the model to lmerTest
final_model_1 <- m@model
summary(final_model_1)
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: s_diversion ~ 1 + tenure_year_c + conference + total_revenues_z +  
    game_time_num_c_2 + attendance_school_z + s_game_c + game_result +  
    area_classification + (1 + attendance_school_z + game_result |      school)
   Data: data_clean
Control: 
structure(list(optimizer = "bobyqa", restart_edge = TRUE, boundary.tol = 1e-05,  
    calc.derivs = TRUE, use.last.params = FALSE, checkControl = list( 
        check.nobs.vs.rankZ = "ignore", check.nobs.vs.nlev = "stop",  
        check.nlev.gtreq.5 = "ignore", check.nlev.gtr.1 = "stop",  
        check.nobs.vs.nRE = "stop", check.rankX = "message+drop.cols",  
        check.scaleX = "warning", check.formula.LHS = "stop"),  
    checkConv = list(check.conv.grad = list(action = "warning",  
        tol = 0.002, relTol = NULL), check.conv.singular = list( 
        action = "message", tol = 1e-04), check.conv.hess = list( 
        action = "warning", tol = 1e-06)), optCtrl = list()), class = c("lmerControl",  
"merControl"))

REML criterion at convergence: -1326.1

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-3.7687 -0.6046 -0.0524  0.5321  3.6688 

Random effects:
 Groups   Name                Variance  Std.Dev. Corr       
 school   (Intercept)         0.0609772 0.24694             
          attendance_school_z 0.0008444 0.02906   0.03      
          game_result1        0.0004855 0.02203   0.24 -0.36
 Residual                     0.0168209 0.12970             
Number of obs: 1245, groups:  school, 27

Fixed effects:
                       Estimate Std. Error         df t value Pr(>|t|)    
(Intercept)           5.787e-01  2.056e-01  2.124e+01   2.815   0.0103 *  
tenure_year_c         1.435e-02  1.843e-03  1.189e+03   7.786 1.49e-14 ***
conferenceBig10      -1.439e-01  1.516e-01  2.124e+01  -0.949   0.3533    
conferenceBig12      -2.832e-01  2.173e-01  2.144e+01  -1.303   0.2063    
conferencePac12      -5.896e-02  1.813e-01  2.115e+01  -0.325   0.7483    
conferenceSEC        -2.255e-01  1.571e-01  2.137e+01  -1.435   0.1656    
total_revenues_z      5.841e-02  1.002e-02  1.213e+03   5.828 7.17e-09 ***
game_time_num_c_2    -6.245e-04  1.356e-03  1.208e+03  -0.460   0.6453    
attendance_school_z  -3.586e-03  7.088e-03  2.604e+01  -0.506   0.6171    
s_game_c             -2.631e-04  1.937e-03  1.204e+03  -0.136   0.8920    
game_result1         -2.147e-03  1.006e-02  3.271e+01  -0.213   0.8324    
area_classification1 -1.489e-01  1.625e-01  2.088e+01  -0.917   0.3698    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) tnr_y_ cnfB10 cnfB12 cnfP12 cnfSEC ttl_r_ g____2 attn__
tenure_yr_c -0.061                                                        
confrncBg10 -0.676  0.041                                                 
confrncBg12 -0.354  0.049  0.477                                          
confrncPc12 -0.593 -0.023  0.615  0.395                                   
conferncSEC -0.487  0.052  0.658  0.461  0.547                            
totl_rvns_z  0.072 -0.781 -0.051 -0.065  0.017 -0.060                     
gm_tm_nm__2 -0.023 -0.046  0.001 -0.001 -0.014 -0.009 -0.001              
attndnc_sc_  0.001  0.089  0.003  0.003  0.000  0.004 -0.068 -0.077       
s_game_c    -0.035  0.025 -0.002  0.006  0.001  0.002 -0.047  0.145 -0.023
game_reslt1 -0.005  0.011  0.004 -0.003  0.003 -0.003 -0.058  0.026 -0.083
ar_clssfct1 -0.791  0.002  0.218  0.001  0.223  0.001 -0.014  0.001  0.001
            s_gm_c gm_rs1
tenure_yr_c              
confrncBg10              
confrncBg12              
confrncPc12              
conferncSEC              
totl_rvns_z              
gm_tm_nm__2              
attndnc_sc_              
s_game_c                 
game_reslt1  0.152       
ar_clssfct1 -0.002 -0.007
model_school_test <- lmer(s_diversion ~ 1 + tenure_year_c + conference + total_revenues_z +  
    game_time_num_c_2 + attendance_school_z + s_game_c + game_result +  
    area_classification + (1 + attendance_school_z+ game_result| school), data = data_clean)
summary(model_school_test)
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: s_diversion ~ 1 + tenure_year_c + conference + total_revenues_z +  
    game_time_num_c_2 + attendance_school_z + s_game_c + game_result +  
    area_classification + (1 + attendance_school_z + game_result |      school)
   Data: data_clean

REML criterion at convergence: -1326.1

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-3.7687 -0.6046 -0.0524  0.5322  3.6688 

Random effects:
 Groups   Name                Variance  Std.Dev. Corr       
 school   (Intercept)         0.0609744 0.24693             
          attendance_school_z 0.0008444 0.02906   0.03      
          game_result1        0.0004856 0.02204   0.24 -0.36
 Residual                     0.0168208 0.12970             
Number of obs: 1245, groups:  school, 27

Fixed effects:
                       Estimate Std. Error         df t value Pr(>|t|)    
(Intercept)           5.787e-01  2.056e-01  2.124e+01   2.815   0.0103 *  
tenure_year_c         1.435e-02  1.843e-03  1.189e+03   7.786 1.49e-14 ***
conferenceBig10      -1.439e-01  1.516e-01  2.124e+01  -0.949   0.3533    
conferenceBig12      -2.832e-01  2.173e-01  2.144e+01  -1.303   0.2063    
conferencePac12      -5.895e-02  1.813e-01  2.115e+01  -0.325   0.7483    
conferenceSEC        -2.255e-01  1.571e-01  2.137e+01  -1.435   0.1656    
total_revenues_z      5.841e-02  1.002e-02  1.213e+03   5.828 7.17e-09 ***
game_time_num_c_2    -6.245e-04  1.356e-03  1.208e+03  -0.460   0.6453    
attendance_school_z  -3.586e-03  7.088e-03  2.604e+01  -0.506   0.6171    
s_game_c             -2.631e-04  1.937e-03  1.204e+03  -0.136   0.8920    
game_result1         -2.147e-03  1.006e-02  3.271e+01  -0.213   0.8323    
area_classification1 -1.489e-01  1.625e-01  2.088e+01  -0.917   0.3697    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) tnr_y_ cnfB10 cnfB12 cnfP12 cnfSEC ttl_r_ g____2 attn__
tenure_yr_c -0.061                                                        
confrncBg10 -0.676  0.041                                                 
confrncBg12 -0.354  0.049  0.477                                          
confrncPc12 -0.593 -0.023  0.615  0.395                                   
conferncSEC -0.487  0.052  0.658  0.461  0.547                            
totl_rvns_z  0.072 -0.781 -0.051 -0.065  0.017 -0.060                     
gm_tm_nm__2 -0.023 -0.046  0.001 -0.001 -0.014 -0.009 -0.001              
attndnc_sc_  0.001  0.089  0.003  0.003  0.000  0.004 -0.068 -0.077       
s_game_c    -0.035  0.025 -0.002  0.006  0.001  0.002 -0.047  0.145 -0.023
game_reslt1 -0.005  0.011  0.004 -0.003  0.003 -0.003 -0.058  0.026 -0.083
ar_clssfct1 -0.791  0.002  0.218  0.001  0.223  0.001 -0.014  0.001  0.001
            s_gm_c gm_rs1
tenure_yr_c              
confrncBg10              
confrncBg12              
confrncPc12              
conferncSEC              
totl_rvns_z              
gm_tm_nm__2              
attndnc_sc_              
s_game_c                 
game_reslt1  0.152       
ar_clssfct1 -0.002 -0.007
performance::icc(model_school_test)
Warning: Can't compute random effect variances. Some variance components equal
  zero. Your model may suffer from singularity (see `?lme4::isSingular`
  and `?performance::check_singularity`).
  Decrease the `tolerance` level to force the calculation of random effect
  variances, or impose priors on your random effects parameters (using
  packages like `brms` or `glmmTMB`).
Warning: Random slopes not present as fixed effects. This artificially inflates
  the conditional random effect variances.
  Respecify the fixed effects structure of your model (add random slopes
  as fixed effects).
[1] NA
plot(model_school_test, type=c("p","smooth"))

plot(model_school_test,
     form = sqrt(abs(resid(.))) ~ fitted(.),
     type = c("p","smooth"))

qqnorm(resid(model_school_test)); qqline(resid(model_school_test))

mf <- model.frame(model_school_test)
res <- residuals(model_school_test)
par(mfrow=c(2,3))
plot(res ~ mf$game_time_num_c_2,
main = "Residuals vs Game Time (num)",
xlab = "Game Time (centered)", ylab = "Residuals")
plot(res ~ mf$attendance_school_z,
main = "Residuals vs Attendance (CWC)",
xlab = "Attendance CWC", ylab = "Residuals")
plot(res ~ mf$total_revenues_z,
main = "Residuals vs Total Revenues",
xlab = "Revenues (Zscoring)", ylab = "Residuals")
plot(res ~ mf$s_game_c,
main = "Residuals vs Season Game",
xlab = "s_game_c", ylab = "Residuals")
plot(res ~ mf$tenure_year_c,
main = "Residuals vs Tenure",
xlab = "Tenure (centered)", ylab = "Residuals")
plot(res ~ mf$area_classification,
main = "Residuals vs Area",
xlab = "Area (0/1)", ylab = "Residuals")

plot(res ~ mf$conference,
main = "Residuals vs Area",
xlab = "Conference", ylab = "Residuals")

qqnorm(ranef(model_school_test)$school[, "(Intercept)"]);qqline(ranef(model_school_test)$school[, "(Intercept)"])

m_2 <- buildmer(f,data=data_clean,buildmerControl=list(direction='backward',
          args=list(control=lmerControl(optimizer='bobyqa'))))
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + conference + (s_game_c +
    attendance_school_z + game_time_num_c_2 + game_result | school)
boundary (singular) fit: see help('isSingular')
Fitting via lmer, with ML: s_diversion ~ game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + conference + (s_game_c +
    attendance_school_z + game_time_num_c_2 + game_result | school)
boundary (singular) fit: see help('isSingular')
Convergence failure. Reducing terms and retrying... The failures were:
    Singular fit
Fitting via lmer, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + conference + (1 + s_game_c +
    attendance_school_z + game_time_num_c_2 | school)
boundary (singular) fit: see help('isSingular')
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + conference + (1 + s_game_c +
    attendance_school_z + game_time_num_c_2 | school)
boundary (singular) fit: see help('isSingular')
Convergence failure. Reducing terms and retrying... The failures were:
    Singular fit
Fitting via lmer, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + conference + (1 + s_game_c +
    attendance_school_z | school)
boundary (singular) fit: see help('isSingular')
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + conference + (1 + s_game_c +
    attendance_school_z | school)
boundary (singular) fit: see help('isSingular')
Convergence failure. Reducing terms and retrying... The failures were:
    Singular fit
Fitting via lmer, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + conference + (1 + s_game_c |
    school)
boundary (singular) fit: see help('isSingular')
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + conference + (1 + s_game_c |
    school)
boundary (singular) fit: see help('isSingular')
Convergence failure. Reducing terms and retrying... The failures were:
    Singular fit
Fitting via lmer, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + conference + (1 | school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + attendance_school_z +
    game_result + s_game_c + area_classification + tenure_year_c +
    total_revenues_z + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    game_result + s_game_c + area_classification + tenure_year_c +
    total_revenues_z + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + s_game_c + area_classification +
    tenure_year_c + total_revenues_z + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + area_classification +
    tenure_year_c + total_revenues_z + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + tenure_year_c +
    total_revenues_z + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + total_revenues_z + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + (1 | school)
Fitting via gam, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + conference
   grouping                term                     block Iteration
1      <NA>                   1                   NA NA 1         1
2      <NA>   game_time_num_c_2   NA NA game_time_num_c_2         1
3      <NA> attendance_school_z NA NA attendance_school_z         1
4      <NA>         game_result         NA NA game_result         1
5      <NA>            s_game_c            NA NA s_game_c         1
6      <NA> area_classification NA NA area_classification         1
7      <NA>       tenure_year_c       NA NA tenure_year_c         1
8      <NA>    total_revenues_z    NA NA total_revenues_z         1
9      <NA>          conference          NA NA conference         1
10   school                   1               NA school 1         1
             LRT
1             NA
2   4.586007e-01
3   5.866681e-01
4   9.001051e-01
5   8.076492e-01
6   3.556987e-01
7   2.768689e-13
8   1.000000e+00
9   4.396317e-01
10 5.429199e-293
Updating formula: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + conference + (1 | school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + conference + (1 | school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + attendance_school_z +
    game_result + s_game_c + area_classification + tenure_year_c +
    conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    game_result + s_game_c + area_classification + tenure_year_c +
    conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + s_game_c + area_classification +
    tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + area_classification +
    tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + tenure_year_c +
    conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + (1 | school)
Fitting via gam, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + conference
   grouping                term                     block Iteration
1      <NA>                   1                   NA NA 1         2
2      <NA>   game_time_num_c_2   NA NA game_time_num_c_2         2
3      <NA> attendance_school_z NA NA attendance_school_z         2
4      <NA>         game_result         NA NA game_result         2
5      <NA>            s_game_c            NA NA s_game_c         2
6      <NA> area_classification NA NA area_classification         2
7      <NA>       tenure_year_c       NA NA tenure_year_c         2
9      <NA>          conference          NA NA conference         2
10   school                   1               NA school 1         2
            LRT
1            NA
2  5.686728e-01
3  8.135263e-01
4  9.944289e-01
5  7.720264e-01
6  6.593879e-01
7  8.163783e-73
9  4.903427e-01
10 0.000000e+00
Updating formula: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + s_game_c + area_classification +
    tenure_year_c + conference + (1 | school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + s_game_c + area_classification +
    tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + s_game_c + area_classification +
    tenure_year_c + conference + (1 | school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + attendance_school_z +
    s_game_c + area_classification + tenure_year_c + conference + (1 |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    s_game_c + area_classification + tenure_year_c + conference + (1 |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + area_classification + tenure_year_c +
    conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + s_game_c + tenure_year_c + conference + (1 |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + s_game_c + area_classification + conference +
    (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + s_game_c + area_classification +
    tenure_year_c + (1 | school)
Fitting via gam, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + s_game_c + area_classification +
    tenure_year_c + conference
   grouping                term                     block Iteration
1      <NA>                   1                   NA NA 1         3
2      <NA>   game_time_num_c_2   NA NA game_time_num_c_2         3
3      <NA> attendance_school_z NA NA attendance_school_z         3
5      <NA>            s_game_c            NA NA s_game_c         3
6      <NA> area_classification NA NA area_classification         3
7      <NA>       tenure_year_c       NA NA tenure_year_c         3
9      <NA>          conference          NA NA conference         3
10   school                   1               NA school 1         3
            LRT
1            NA
2  5.684445e-01
3  8.127934e-01
5  7.695352e-01
6  6.594078e-01
7  5.671962e-73
9  4.903473e-01
10 0.000000e+00
Updating formula: s_diversion ~ 1 + game_time_num_c_2 + s_game_c +
    area_classification + tenure_year_c + conference + (1 | school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    s_game_c + area_classification + tenure_year_c + conference + (1 |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    s_game_c + area_classification + tenure_year_c + conference + (1 |
    school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + s_game_c +
    area_classification + tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    area_classification + tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    s_game_c + tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    s_game_c + area_classification + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    s_game_c + area_classification + tenure_year_c + (1 | school)
Fitting via gam, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    s_game_c + area_classification + tenure_year_c + conference
   grouping                term                     block Iteration
1      <NA>                   1                   NA NA 1         4
2      <NA>   game_time_num_c_2   NA NA game_time_num_c_2         4
5      <NA>            s_game_c            NA NA s_game_c         4
6      <NA> area_classification NA NA area_classification         4
7      <NA>       tenure_year_c       NA NA tenure_year_c         4
9      <NA>          conference          NA NA conference         4
10   school                   1               NA school 1         4
            LRT
1            NA
2  5.405208e-01
5  7.826067e-01
6  6.588291e-01
7  6.340657e-75
9  4.906797e-01
10 0.000000e+00
Updating formula: s_diversion ~ 1 + game_time_num_c_2 +
    area_classification + tenure_year_c + conference + (1 | school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    area_classification + tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    area_classification + tenure_year_c + conference + (1 | school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + area_classification +
    tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    area_classification + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    area_classification + tenure_year_c + (1 | school)
Fitting via gam, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    area_classification + tenure_year_c + conference
   grouping                term                     block Iteration
1      <NA>                   1                   NA NA 1         5
2      <NA>   game_time_num_c_2   NA NA game_time_num_c_2         5
6      <NA> area_classification NA NA area_classification         5
7      <NA>       tenure_year_c       NA NA tenure_year_c         5
9      <NA>          conference          NA NA conference         5
10   school                   1               NA school 1         5
            LRT
1            NA
2  5.139510e-01
6  6.588364e-01
7  6.404532e-75
9  4.908325e-01
10 0.000000e+00
Updating formula: s_diversion ~ 1 + game_time_num_c_2 + tenure_year_c +
    conference + (1 | school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    tenure_year_c + conference + (1 | school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    tenure_year_c + (1 | school)
Fitting via gam, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    tenure_year_c + conference
   grouping              term                   block Iteration          LRT
1      <NA>                 1                 NA NA 1         6           NA
2      <NA> game_time_num_c_2 NA NA game_time_num_c_2         6 5.152554e-01
7      <NA>     tenure_year_c     NA NA tenure_year_c         6 7.044989e-75
9      <NA>        conference        NA NA conference         6 4.619063e-01
10   school                 1             NA school 1         6 0.000000e+00
Updating formula: s_diversion ~ 1 + tenure_year_c + conference + (1 |
    school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + (1 | school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + (1 |
    school)
Fitting via gam, with REML: s_diversion ~ 1 + tenure_year_c +
    conference
   grouping          term               block Iteration          LRT
1      <NA>             1             NA NA 1         7           NA
7      <NA> tenure_year_c NA NA tenure_year_c         7 7.867901e-75
9      <NA>    conference    NA NA conference         7 4.597580e-01
10   school             1         NA school 1         7 0.000000e+00
Updating formula: s_diversion ~ 1 + tenure_year_c + (1 | school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c + (1 |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + (1 |
    school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + (1 | school)
Fitting via gam, with REML: s_diversion ~ 1 + tenure_year_c
   grouping          term               block Iteration          LRT
1      <NA>             1             NA NA 1         8           NA
7      <NA> tenure_year_c NA NA tenure_year_c         8 5.430732e-75
10   school             1         NA school 1         8 0.000000e+00
All terms are significant
Finalizing by converting the model to lmerTest
final_model_2 <- m_2@model
summary(final_model_2)
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: s_diversion ~ 1 + tenure_year_c + (1 | school)
   Data: data_clean
Control: 
structure(list(optimizer = "bobyqa", restart_edge = TRUE, boundary.tol = 1e-05,  
    calc.derivs = TRUE, use.last.params = FALSE, checkControl = list( 
        check.nobs.vs.rankZ = "ignore", check.nobs.vs.nlev = "stop",  
        check.nlev.gtreq.5 = "ignore", check.nlev.gtr.1 = "stop",  
        check.nobs.vs.nRE = "stop", check.rankX = "message+drop.cols",  
        check.scaleX = "warning", check.formula.LHS = "stop"),  
    checkConv = list(check.conv.grad = list(action = "warning",  
        tol = 0.002, relTol = NULL), check.conv.singular = list( 
        action = "message", tol = 1e-04), check.conv.hess = list( 
        action = "warning", tol = 1e-06)), optCtrl = list()), class = c("lmerControl",  
"merControl"))

REML criterion at convergence: -1450.1

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-3.5869 -0.5502 -0.0223  0.5807  4.0197 

Random effects:
 Groups   Name        Variance Std.Dev.
 school   (Intercept) 0.06396  0.2529  
 Residual             0.01833  0.1354  
Number of obs: 1390, groups:  school, 31

Fixed effects:
               Estimate Std. Error        df t value Pr(>|t|)    
(Intercept)   2.966e-01  4.582e-02 3.047e+01   6.474 3.48e-07 ***
tenure_year_c 2.119e-02  1.086e-03 1.370e+03  19.517  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr)
tenure_yr_c -0.085
model_school_test_2 <- lmer(s_diversion ~ 1 + tenure_year_c + (1 | school), data = data_clean)
summary(model_school_test_2)
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: s_diversion ~ 1 + tenure_year_c + (1 | school)
   Data: data_clean

REML criterion at convergence: -1450.1

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-3.5869 -0.5502 -0.0223  0.5807  4.0197 

Random effects:
 Groups   Name        Variance Std.Dev.
 school   (Intercept) 0.06396  0.2529  
 Residual             0.01833  0.1354  
Number of obs: 1390, groups:  school, 31

Fixed effects:
               Estimate Std. Error        df t value Pr(>|t|)    
(Intercept)   2.966e-01  4.582e-02 3.047e+01   6.474 3.48e-07 ***
tenure_year_c 2.119e-02  1.086e-03 1.370e+03  19.517  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr)
tenure_yr_c -0.085
performance::icc(model_school_test_2)
# Intraclass Correlation Coefficient

    Adjusted ICC: 0.777
  Unadjusted ICC: 0.696
plot(model_school_test_2, type=c("p","smooth"))

plot(model_school_test_2,
     form = sqrt(abs(resid(.))) ~ fitted(.),
     type = c("p","smooth"))

qqnorm(resid(model_school_test_2)); qqline(resid(model_school_test_2))

qqnorm(ranef(model_school_test_2)$school[, "(Intercept)"]);qqline(ranef(model_school_test_2)$school[, "(Intercept)"])

mf <- model.frame(model_school_test)
res <- residuals(model_school_test)
plot(res ~ mf$tenure_year_c,
main = "Residuals vs Tenure (center)",
xlab = "Tenure (centered)", ylab = "Residuals")

m_3 <- buildmer(
  f,
  data = data_clean,
  buildmerControl = buildmerControl(
    direction = c("order","backward"),
    args = list(control = lmerControl(optimizer = "bobyqa"))
  )
)
Determining predictor order
Fitting via lm: s_diversion ~ 1
Currently evaluating LRT for: game_time_num_c_2, attendance_school_z,
    game_result, s_game_c, area_classification, tenure_year_c,
    total_revenues_z, conference
Fitting via lm: s_diversion ~ 1 + game_time_num_c_2
Fitting via lm: s_diversion ~ 1 + attendance_school_z
Fitting via lm: s_diversion ~ 1 + game_result
Fitting via lm: s_diversion ~ 1 + s_game_c
Fitting via lm: s_diversion ~ 1 + area_classification
Fitting via lm: s_diversion ~ 1 + tenure_year_c
Fitting via lm: s_diversion ~ 1 + total_revenues_z
Fitting via lm: s_diversion ~ 1 + conference
Updating formula: s_diversion ~ 1 + tenure_year_c
Currently evaluating LRT for: game_time_num_c_2, attendance_school_z,
    game_result, s_game_c, area_classification, total_revenues_z,
    conference
Fitting via lm: s_diversion ~ 1 + tenure_year_c + game_time_num_c_2
Fitting via lm: s_diversion ~ 1 + tenure_year_c + attendance_school_z
Fitting via lm: s_diversion ~ 1 + tenure_year_c + game_result
Fitting via lm: s_diversion ~ 1 + tenure_year_c + s_game_c
Fitting via lm: s_diversion ~ 1 + tenure_year_c + area_classification
Fitting via lm: s_diversion ~ 1 + tenure_year_c + total_revenues_z
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference
Updating formula: s_diversion ~ 1 + tenure_year_c + conference
Currently evaluating LRT for: game_time_num_c_2, attendance_school_z,
    game_result, s_game_c, area_classification, total_revenues_z
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    game_time_num_c_2
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    attendance_school_z
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    game_result
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference + s_game_c
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    area_classification
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z
Currently evaluating LRT for: game_time_num_c_2, attendance_school_z,
    game_result, s_game_c, area_classification
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + attendance_school_z
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_result
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + s_game_c
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + area_classification
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2
Currently evaluating LRT for: attendance_school_z, game_result,
    s_game_c, area_classification
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + game_result
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + s_game_c
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + area_classification
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z
Currently evaluating LRT for: game_result, s_game_c,
    area_classification
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    game_result
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    area_classification
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c
Currently evaluating LRT for: game_result, area_classification
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + game_result
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + area_classification
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + game_result
Currently evaluating LRT for: area_classification
Fitting via lm: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + game_result + area_classification
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + game_result + area_classification
Fitting via gam, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
Currently evaluating LRT for: 1 | school
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 | school)
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + game_result + area_classification + (1 | school)
Currently evaluating LRT for: s_game_c | school, attendance_school_z |
    school, game_time_num_c_2 | school, game_result | school
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + s_game_c | school)
boundary (singular) fit: see help('isSingular')
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + attendance_school_z | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + game_time_num_c_2 | school)
boundary (singular) fit: see help('isSingular')
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + game_result | school)
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + game_result + area_classification + (1 +
    attendance_school_z | school)
Currently evaluating LRT for: s_game_c | school, game_time_num_c_2 |
    school, game_result | school
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + attendance_school_z + s_game_c | school)
boundary (singular) fit: see help('isSingular')
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + attendance_school_z + game_time_num_c_2 | school)
boundary (singular) fit: see help('isSingular')
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + attendance_school_z + game_result | school)
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + game_result + area_classification + (1 +
    attendance_school_z + game_result | school)
Currently evaluating LRT for: s_game_c | school, game_time_num_c_2 |
    school
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + attendance_school_z + game_result + s_game_c | school)
boundary (singular) fit: see help('isSingular')
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + attendance_school_z + game_result + game_time_num_c_2 |
    school)
boundary (singular) fit: see help('isSingular')
Ending the ordering procedure due to having reached the maximal
    feasible model - all higher models failed to converge. The types of
    convergence failure are: Singular fit
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + attendance_school_z + game_result | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + game_result + area_classification + (1 +
    attendance_school_z + game_result | school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + game_result + area_classification + (1 +
    attendance_school_z + game_result | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + game_result + area_classification + (1 +
    attendance_school_z + game_result | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + game_time_num_c_2 + attendance_school_z + s_game_c + game_result
    + area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + total_revenues_z + attendance_school_z + s_game_c + game_result +
    area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + total_revenues_z + game_time_num_c_2 + attendance_school_z +
    game_result + area_classification + (1 + attendance_school_z +
    game_result | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + game_result + (1 + attendance_school_z + game_result |
    school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + game_result | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + attendance_school_z | school)
   grouping                term                         block         score
1      <NA>                   1                       NA NA 1            NA
7      <NA>       tenure_year_c           NA NA tenure_year_c  -55.79996649
9      <NA>          conference              NA NA conference  -44.38429870
8      <NA>    total_revenues_z        NA NA total_revenues_z  -12.62497801
2      <NA>   game_time_num_c_2       NA NA game_time_num_c_2   -2.40863094
3      <NA> attendance_school_z     NA NA attendance_school_z   -0.57063748
5      <NA>            s_game_c                NA NA s_game_c   -0.50082992
4      <NA>         game_result             NA NA game_result   -0.39209673
6      <NA> area_classification     NA NA area_classification   -0.03887656
10   school                   1                   NA school 1 -672.96564072
12   school attendance_school_z NA school attendance_school_z  -14.92658361
14   school         game_result         NA school game_result   -0.94169484
   Iteration          LRT
1          1           NA
7          1 1.945514e-14
9          1 4.584424e-01
8          1 1.000000e+00
2          1 6.406136e-01
3          1           NA
5          1 8.871267e-01
4          1           NA
6          1 3.248220e-01
10         1           NA
12         1 1.381374e-06
14         1 3.899663e-01
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    game_time_num_c_2 + attendance_school_z + s_game_c + game_result +
    area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + game_time_num_c_2 + attendance_school_z + s_game_c +
    game_result + area_classification + (1 + attendance_school_z +
    game_result | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + game_time_num_c_2 + attendance_school_z + s_game_c + game_result
    + area_classification + (1 + attendance_school_z + game_result |
    school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + conference +
    game_time_num_c_2 + attendance_school_z + s_game_c + game_result +
    area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c +
    game_time_num_c_2 + attendance_school_z + s_game_c + game_result +
    area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + attendance_school_z + s_game_c + game_result +
    area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + game_time_num_c_2 + attendance_school_z + game_result +
    area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + game_time_num_c_2 + attendance_school_z + s_game_c + game_result
    + (1 + attendance_school_z + game_result | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + game_time_num_c_2 + attendance_school_z + s_game_c +
    game_result + area_classification + (1 + game_result | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + game_time_num_c_2 + attendance_school_z + s_game_c +
    game_result + area_classification + (1 + attendance_school_z |
    school)
   grouping                term                         block         score
1      <NA>                   1                       NA NA 1            NA
7      <NA>       tenure_year_c           NA NA tenure_year_c  -55.79996649
9      <NA>          conference              NA NA conference  -44.38429870
2      <NA>   game_time_num_c_2       NA NA game_time_num_c_2   -2.40863094
3      <NA> attendance_school_z     NA NA attendance_school_z   -0.57063748
5      <NA>            s_game_c                NA NA s_game_c   -0.50082992
4      <NA>         game_result             NA NA game_result   -0.39209673
6      <NA> area_classification     NA NA area_classification   -0.03887656
10   school                   1                   NA school 1 -672.96564072
12   school attendance_school_z NA school attendance_school_z  -14.92658361
14   school         game_result         NA school game_result   -0.94169484
   Iteration          LRT
1          2           NA
7          2 4.991138e-74
9          2 4.947322e-01
2          2 6.878567e-01
3          2           NA
5          2 7.140154e-01
4          2           NA
6          2 6.183090e-01
10         2           NA
12         2 1.563185e-05
14         2 5.146231e-01
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    game_time_num_c_2 + attendance_school_z + game_result +
    area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + game_time_num_c_2 + attendance_school_z + game_result
    + area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + game_time_num_c_2 + attendance_school_z + game_result +
    area_classification + (1 + attendance_school_z + game_result |
    school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + conference +
    game_time_num_c_2 + attendance_school_z + game_result +
    area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c +
    game_time_num_c_2 + attendance_school_z + game_result +
    area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + attendance_school_z + game_result + area_classification + (1 +
    attendance_school_z + game_result | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + game_time_num_c_2 + attendance_school_z + game_result + (1 +
    attendance_school_z + game_result | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + game_time_num_c_2 + attendance_school_z + game_result
    + area_classification + (1 + game_result | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + game_time_num_c_2 + attendance_school_z + game_result
    + area_classification + (1 + attendance_school_z | school)
   grouping                term                         block         score
1      <NA>                   1                       NA NA 1            NA
7      <NA>       tenure_year_c           NA NA tenure_year_c  -55.79996649
9      <NA>          conference              NA NA conference  -44.38429870
2      <NA>   game_time_num_c_2       NA NA game_time_num_c_2   -2.40863094
3      <NA> attendance_school_z     NA NA attendance_school_z   -0.57063748
4      <NA>         game_result             NA NA game_result   -0.39209673
6      <NA> area_classification     NA NA area_classification   -0.03887656
10   school                   1                   NA school 1 -672.96564072
12   school attendance_school_z NA school attendance_school_z  -14.92658361
14   school         game_result         NA school game_result   -0.94169484
   Iteration          LRT
1          3           NA
7          3 4.244368e-74
9          3 4.943229e-01
2          3 6.473659e-01
3          3           NA
4          3           NA
6          3 6.167397e-01
10         3           NA
12         3 1.563418e-05
14         3 5.194290e-01
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    attendance_school_z + game_result + area_classification + (1 +
    attendance_school_z + game_result | school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + attendance_school_z + game_result +
    area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + attendance_school_z + game_result + area_classification + (1 +
    attendance_school_z + game_result | school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + conference +
    attendance_school_z + game_result + area_classification + (1 +
    attendance_school_z + game_result | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c +
    attendance_school_z + game_result + area_classification + (1 +
    attendance_school_z + game_result | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + attendance_school_z + game_result + (1 + attendance_school_z +
    game_result | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + attendance_school_z + game_result +
    area_classification + (1 + game_result | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + attendance_school_z + game_result +
    area_classification + (1 + attendance_school_z | school)
   grouping                term                         block         score
1      <NA>                   1                       NA NA 1            NA
7      <NA>       tenure_year_c           NA NA tenure_year_c  -55.79996649
9      <NA>          conference              NA NA conference  -44.38429870
3      <NA> attendance_school_z     NA NA attendance_school_z   -0.57063748
4      <NA>         game_result             NA NA game_result   -0.39209673
6      <NA> area_classification     NA NA area_classification   -0.03887656
10   school                   1                   NA school 1 -672.96564072
12   school attendance_school_z NA school attendance_school_z  -14.92658361
14   school         game_result         NA school game_result   -0.94169484
   Iteration          LRT
1          4           NA
7          4 3.323090e-74
9          4 4.929905e-01
3          4           NA
4          4           NA
6          4 6.179382e-01
10         4           NA
12         4 1.452239e-05
14         4 5.139250e-01
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    attendance_school_z + game_result + (1 + attendance_school_z +
    game_result | school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + attendance_school_z + game_result + (1 +
    attendance_school_z + game_result | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + attendance_school_z + game_result + (1 + attendance_school_z +
    game_result | school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + conference +
    attendance_school_z + game_result + (1 + attendance_school_z +
    game_result | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c +
    attendance_school_z + game_result + (1 + attendance_school_z +
    game_result | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + attendance_school_z + game_result + (1 + game_result |
    school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + attendance_school_z + game_result + (1 +
    attendance_school_z | school)
   grouping                term                         block        score
1      <NA>                   1                       NA NA 1           NA
7      <NA>       tenure_year_c           NA NA tenure_year_c  -55.7999665
9      <NA>          conference              NA NA conference  -44.3842987
3      <NA> attendance_school_z     NA NA attendance_school_z   -0.5706375
4      <NA>         game_result             NA NA game_result   -0.3920967
10   school                   1                   NA school 1 -672.9656407
12   school attendance_school_z NA school attendance_school_z  -14.9265836
14   school         game_result         NA school game_result   -0.9416948
   Iteration          LRT
1          5           NA
7          5 3.707979e-74
9          5 4.995785e-01
3          5           NA
4          5           NA
10         5           NA
12         5 1.466189e-05
14         5 5.217608e-01
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    attendance_school_z + game_result + (1 + attendance_school_z |
    school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + attendance_school_z + game_result + (1 +
    attendance_school_z | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + attendance_school_z + game_result + (1 + attendance_school_z |
    school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + conference +
    attendance_school_z + game_result + (1 + attendance_school_z |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c +
    attendance_school_z + game_result + (1 + attendance_school_z |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + attendance_school_z + (1 + attendance_school_z | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + attendance_school_z + game_result + (1 | school)
   grouping                term                         block        score
1      <NA>                   1                       NA NA 1           NA
7      <NA>       tenure_year_c           NA NA tenure_year_c  -55.7999665
9      <NA>          conference              NA NA conference  -44.3842987
3      <NA> attendance_school_z     NA NA attendance_school_z   -0.5706375
4      <NA>         game_result             NA NA game_result   -0.3920967
10   school                   1                   NA school 1 -672.9656407
12   school attendance_school_z NA school attendance_school_z  -14.9265836
   Iteration          LRT
1          6           NA
7          6 7.051497e-75
9          6 5.036033e-01
3          6           NA
4          6 8.787557e-01
10         6           NA
12         6 3.552795e-06
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    attendance_school_z + (1 + attendance_school_z | school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + attendance_school_z + (1 + attendance_school_z |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + attendance_school_z + (1 + attendance_school_z | school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + conference +
    attendance_school_z + (1 + attendance_school_z | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c +
    attendance_school_z + (1 + attendance_school_z | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + attendance_school_z + (1 | school)
   grouping                term                         block        score
1      <NA>                   1                       NA NA 1           NA
7      <NA>       tenure_year_c           NA NA tenure_year_c  -55.7999665
9      <NA>          conference              NA NA conference  -44.3842987
3      <NA> attendance_school_z     NA NA attendance_school_z   -0.5706375
10   school                   1                   NA school 1 -672.9656407
12   school attendance_school_z NA school attendance_school_z  -14.9265836
   Iteration          LRT
1          7           NA
7          7 5.484720e-75
9          7 5.027359e-01
3          7           NA
10         7           NA
12         7 3.542827e-06
Updating formula: s_diversion ~ 1 + tenure_year_c + attendance_school_z
    + (1 + attendance_school_z | school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    attendance_school_z + (1 + attendance_school_z | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c +
    attendance_school_z + (1 + attendance_school_z | school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + attendance_school_z + (1 +
    attendance_school_z | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    attendance_school_z + (1 | school)
   grouping                term                         block        score
1      <NA>                   1                       NA NA 1           NA
7      <NA>       tenure_year_c           NA NA tenure_year_c  -55.7999665
3      <NA> attendance_school_z     NA NA attendance_school_z   -0.5706375
10   school                   1                   NA school 1 -672.9656407
12   school attendance_school_z NA school attendance_school_z  -14.9265836
   Iteration          LRT
1          8           NA
7          8 4.070701e-75
3          8           NA
10         8           NA
12         8 3.097217e-06
All terms are significant
Finalizing by converting the model to lmerTest
final_model_3 <- m_3@model
summary(final_model_3)
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: s_diversion ~ 1 + tenure_year_c + attendance_school_z + (1 +  
    attendance_school_z | school)
   Data: data_clean
Control: 
structure(list(optimizer = "bobyqa", restart_edge = TRUE, boundary.tol = 1e-05,  
    calc.derivs = TRUE, use.last.params = FALSE, checkControl = list( 
        check.nobs.vs.rankZ = "ignore", check.nobs.vs.nlev = "stop",  
        check.nlev.gtreq.5 = "ignore", check.nlev.gtr.1 = "stop",  
        check.nobs.vs.nRE = "stop", check.rankX = "message+drop.cols",  
        check.scaleX = "warning", check.formula.LHS = "stop"),  
    checkConv = list(check.conv.grad = list(action = "warning",  
        tol = 0.002, relTol = NULL), check.conv.singular = list( 
        action = "message", tol = 1e-04), check.conv.hess = list( 
        action = "warning", tol = 1e-06)), optCtrl = list()), class = c("lmerControl",  
"merControl"))

REML criterion at convergence: -1465.1

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-3.6723 -0.5588 -0.0436  0.5664  3.6069 

Random effects:
 Groups   Name                Variance  Std.Dev. Corr 
 school   (Intercept)         0.0640789 0.25314       
          attendance_school_z 0.0007388 0.02718  -0.12
 Residual                     0.0176419 0.13282       
Number of obs: 1390, groups:  school, 31

Fixed effects:
                      Estimate Std. Error         df t value Pr(>|t|)    
(Intercept)          2.955e-01  4.586e-02  3.048e+01   6.444 3.77e-07 ***
tenure_year_c        2.150e-02  1.100e-03  1.369e+03  19.550  < 2e-16 ***
attendance_school_z -2.893e-03  6.386e-03  2.978e+01  -0.453    0.654    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) tnr_y_
tenure_yr_c -0.086       
attndnc_sc_ -0.099  0.073
model_school_test_3 <- lmer(s_diversion ~ 1 + tenure_year_c + attendance_school_z + (1 + attendance_school_z | school), data = data_clean)
summary(model_school_test_3)
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: s_diversion ~ 1 + tenure_year_c + attendance_school_z + (1 +  
    attendance_school_z | school)
   Data: data_clean

REML criterion at convergence: -1465.1

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-3.6723 -0.5588 -0.0436  0.5664  3.6069 

Random effects:
 Groups   Name                Variance  Std.Dev. Corr 
 school   (Intercept)         0.0640816 0.25314       
          attendance_school_z 0.0007387 0.02718  -0.12
 Residual                     0.0176419 0.13282       
Number of obs: 1390, groups:  school, 31

Fixed effects:
                      Estimate Std. Error         df t value Pr(>|t|)    
(Intercept)          2.955e-01  4.586e-02  3.048e+01   6.444 3.78e-07 ***
tenure_year_c        2.150e-02  1.100e-03  1.369e+03  19.550  < 2e-16 ***
attendance_school_z -2.893e-03  6.386e-03  2.978e+01  -0.453    0.654    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) tnr_y_
tenure_yr_c -0.086       
attndnc_sc_ -0.099  0.073
performance::icc(model_school_test_3)
Warning: Random slopes not present as fixed effects. This artificially inflates
  the conditional random effect variances.
  Respecify the fixed effects structure of your model (add random slopes
  as fixed effects).
# Intraclass Correlation Coefficient

    Adjusted ICC: 0.786
  Unadjusted ICC: 0.701
plot(model_school_test_3, type=c("p","smooth"))

plot(model_school_test_3,
     form = sqrt(abs(resid(.))) ~ fitted(.),
     type = c("p","smooth"))

qqnorm(resid(model_school_test_3)); qqline(resid(model_school_test_3))

qqnorm(ranef(model_school_test_3)$school[, "(Intercept)"]);qqline(ranef(model_school_test_3)$school[, "(Intercept)"])

mf <- model.frame(model_school_test_3)
res <- residuals(model_school_test_3)
par(mfrow=c(2,3))
plot(res ~ mf$attendance_school_z,
main = "Residuals vs Attendance (Zscoring)",
xlab = "Attendance(Zscoring)", ylab = "Residuals")
plot(res ~ mf$tenure_year_c,
main = "Residuals vs Tenure (center)",
xlab = "Tenure (centered)", ylab = "Residuals")

 tabulate.formula(f)
   index grouping                term                            code
1   <NA>     <NA>                   1                               1
2   <NA>     <NA>   game_time_num_c_2               game_time_num_c_2
3   <NA>     <NA> attendance_school_z             attendance_school_z
4   <NA>     <NA>         game_result                     game_result
5   <NA>     <NA>            s_game_c                        s_game_c
6   <NA>     <NA> area_classification             area_classification
7   <NA>     <NA>       tenure_year_c                   tenure_year_c
8   <NA>     <NA>    total_revenues_z                total_revenues_z
9   <NA>     <NA>          conference                      conference
10  10 1   school                   1                   10 1 school 1
11  10 1   school            s_game_c            10 1 school s_game_c
12  10 1   school attendance_school_z 10 1 school attendance_school_z
13  10 1   school   game_time_num_c_2   10 1 school game_time_num_c_2
14  10 1   school         game_result         10 1 school game_result
                           block
1                        NA NA 1
2        NA NA game_time_num_c_2
3      NA NA attendance_school_z
4              NA NA game_result
5                 NA NA s_game_c
6      NA NA area_classification
7            NA NA tenure_year_c
8         NA NA total_revenues_z
9               NA NA conference
10                   NA school 1
11            NA school s_game_c
12 NA school attendance_school_z
13   NA school game_time_num_c_2
14         NA school game_result
m_4 <- buildmer(
  formula(m@model),
  data = data_clean,
  buildmerControl = list(
    direction = "backward",
    args = list(control = lmerControl(optimizer = "bobyqa"))
  )
)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + attendance_school_z + game_result | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + game_result + area_classification + (1 +
    attendance_school_z + game_result | school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + conference +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + game_result + area_classification + (1 +
    attendance_school_z + game_result | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c +
    total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + game_result + area_classification + (1 +
    attendance_school_z + game_result | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + game_time_num_c_2 + attendance_school_z + s_game_c + game_result
    + area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + total_revenues_z + attendance_school_z + s_game_c + game_result +
    area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + total_revenues_z + game_time_num_c_2 + attendance_school_z +
    game_result + area_classification + (1 + attendance_school_z +
    game_result | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + total_revenues_z + game_time_num_c_2 + attendance_school_z +
    s_game_c + game_result + (1 + attendance_school_z + game_result |
    school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + game_result | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + total_revenues_z + game_time_num_c_2 +
    attendance_school_z + s_game_c + game_result + area_classification
    + (1 + attendance_school_z | school)
   grouping                term                         block Iteration
1      <NA>                   1                       NA NA 1         1
2      <NA>       tenure_year_c           NA NA tenure_year_c         1
3      <NA>          conference              NA NA conference         1
4      <NA>    total_revenues_z        NA NA total_revenues_z         1
5      <NA>   game_time_num_c_2       NA NA game_time_num_c_2         1
6      <NA> attendance_school_z     NA NA attendance_school_z         1
7      <NA>            s_game_c                NA NA s_game_c         1
8      <NA>         game_result             NA NA game_result         1
9      <NA> area_classification     NA NA area_classification         1
10   school                   1                   NA school 1         1
11   school attendance_school_z NA school attendance_school_z         1
12   school         game_result         NA school game_result         1
            LRT
1            NA
2  1.945514e-14
3  4.584424e-01
4  1.000000e+00
5  6.406136e-01
6            NA
7  8.871267e-01
8            NA
9  3.248220e-01
10           NA
11 1.381374e-06
12 3.899663e-01
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    game_time_num_c_2 + attendance_school_z + s_game_c + game_result +
    area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + game_time_num_c_2 + attendance_school_z + s_game_c +
    game_result + area_classification + (1 + attendance_school_z +
    game_result | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + game_time_num_c_2 + attendance_school_z + s_game_c + game_result
    + area_classification + (1 + attendance_school_z + game_result |
    school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + conference +
    game_time_num_c_2 + attendance_school_z + s_game_c + game_result +
    area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c +
    game_time_num_c_2 + attendance_school_z + s_game_c + game_result +
    area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + attendance_school_z + s_game_c + game_result +
    area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + game_time_num_c_2 + attendance_school_z + game_result +
    area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + game_time_num_c_2 + attendance_school_z + s_game_c + game_result
    + (1 + attendance_school_z + game_result | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + game_time_num_c_2 + attendance_school_z + s_game_c +
    game_result + area_classification + (1 + game_result | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + game_time_num_c_2 + attendance_school_z + s_game_c +
    game_result + area_classification + (1 + attendance_school_z |
    school)
   grouping                term                         block Iteration
1      <NA>                   1                       NA NA 1         2
2      <NA>       tenure_year_c           NA NA tenure_year_c         2
3      <NA>          conference              NA NA conference         2
5      <NA>   game_time_num_c_2       NA NA game_time_num_c_2         2
6      <NA> attendance_school_z     NA NA attendance_school_z         2
7      <NA>            s_game_c                NA NA s_game_c         2
8      <NA>         game_result             NA NA game_result         2
9      <NA> area_classification     NA NA area_classification         2
10   school                   1                   NA school 1         2
11   school attendance_school_z NA school attendance_school_z         2
12   school         game_result         NA school game_result         2
            LRT
1            NA
2  4.991138e-74
3  4.947322e-01
5  6.878567e-01
6            NA
7  7.140154e-01
8            NA
9  6.183090e-01
10           NA
11 1.563185e-05
12 5.146231e-01
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    game_time_num_c_2 + attendance_school_z + game_result +
    area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + game_time_num_c_2 + attendance_school_z + game_result
    + area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + game_time_num_c_2 + attendance_school_z + game_result +
    area_classification + (1 + attendance_school_z + game_result |
    school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + conference +
    game_time_num_c_2 + attendance_school_z + game_result +
    area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c +
    game_time_num_c_2 + attendance_school_z + game_result +
    area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + attendance_school_z + game_result + area_classification + (1 +
    attendance_school_z + game_result | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + game_time_num_c_2 + attendance_school_z + game_result + (1 +
    attendance_school_z + game_result | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + game_time_num_c_2 + attendance_school_z + game_result
    + area_classification + (1 + game_result | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + game_time_num_c_2 + attendance_school_z + game_result
    + area_classification + (1 + attendance_school_z | school)
   grouping                term                         block Iteration
1      <NA>                   1                       NA NA 1         3
2      <NA>       tenure_year_c           NA NA tenure_year_c         3
3      <NA>          conference              NA NA conference         3
5      <NA>   game_time_num_c_2       NA NA game_time_num_c_2         3
6      <NA> attendance_school_z     NA NA attendance_school_z         3
8      <NA>         game_result             NA NA game_result         3
9      <NA> area_classification     NA NA area_classification         3
10   school                   1                   NA school 1         3
11   school attendance_school_z NA school attendance_school_z         3
12   school         game_result         NA school game_result         3
            LRT
1            NA
2  4.244368e-74
3  4.943229e-01
5  6.473659e-01
6            NA
8            NA
9  6.167397e-01
10           NA
11 1.563418e-05
12 5.194290e-01
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    attendance_school_z + game_result + area_classification + (1 +
    attendance_school_z + game_result | school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + attendance_school_z + game_result +
    area_classification + (1 + attendance_school_z + game_result |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + attendance_school_z + game_result + area_classification + (1 +
    attendance_school_z + game_result | school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + conference +
    attendance_school_z + game_result + area_classification + (1 +
    attendance_school_z + game_result | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c +
    attendance_school_z + game_result + area_classification + (1 +
    attendance_school_z + game_result | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + attendance_school_z + game_result + (1 + attendance_school_z +
    game_result | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + attendance_school_z + game_result +
    area_classification + (1 + game_result | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + attendance_school_z + game_result +
    area_classification + (1 + attendance_school_z | school)
   grouping                term                         block Iteration
1      <NA>                   1                       NA NA 1         4
2      <NA>       tenure_year_c           NA NA tenure_year_c         4
3      <NA>          conference              NA NA conference         4
6      <NA> attendance_school_z     NA NA attendance_school_z         4
8      <NA>         game_result             NA NA game_result         4
9      <NA> area_classification     NA NA area_classification         4
10   school                   1                   NA school 1         4
11   school attendance_school_z NA school attendance_school_z         4
12   school         game_result         NA school game_result         4
            LRT
1            NA
2  3.323090e-74
3  4.929905e-01
6            NA
8            NA
9  6.179382e-01
10           NA
11 1.452239e-05
12 5.139250e-01
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    attendance_school_z + game_result + (1 + attendance_school_z +
    game_result | school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + attendance_school_z + game_result + (1 +
    attendance_school_z + game_result | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + attendance_school_z + game_result + (1 + attendance_school_z +
    game_result | school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + conference +
    attendance_school_z + game_result + (1 + attendance_school_z +
    game_result | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c +
    attendance_school_z + game_result + (1 + attendance_school_z +
    game_result | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + attendance_school_z + game_result + (1 + game_result |
    school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + attendance_school_z + game_result + (1 +
    attendance_school_z | school)
   grouping                term                         block Iteration
1      <NA>                   1                       NA NA 1         5
2      <NA>       tenure_year_c           NA NA tenure_year_c         5
3      <NA>          conference              NA NA conference         5
6      <NA> attendance_school_z     NA NA attendance_school_z         5
8      <NA>         game_result             NA NA game_result         5
10   school                   1                   NA school 1         5
11   school attendance_school_z NA school attendance_school_z         5
12   school         game_result         NA school game_result         5
            LRT
1            NA
2  3.707979e-74
3  4.995785e-01
6            NA
8            NA
10           NA
11 1.466189e-05
12 5.217608e-01
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    attendance_school_z + game_result + (1 + attendance_school_z |
    school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + attendance_school_z + game_result + (1 +
    attendance_school_z | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + attendance_school_z + game_result + (1 + attendance_school_z |
    school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + conference +
    attendance_school_z + game_result + (1 + attendance_school_z |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c +
    attendance_school_z + game_result + (1 + attendance_school_z |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + attendance_school_z + (1 + attendance_school_z | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + attendance_school_z + game_result + (1 | school)
   grouping                term                         block Iteration
1      <NA>                   1                       NA NA 1         6
2      <NA>       tenure_year_c           NA NA tenure_year_c         6
3      <NA>          conference              NA NA conference         6
6      <NA> attendance_school_z     NA NA attendance_school_z         6
8      <NA>         game_result             NA NA game_result         6
10   school                   1                   NA school 1         6
11   school attendance_school_z NA school attendance_school_z         6
            LRT
1            NA
2  7.051497e-75
3  5.036033e-01
6            NA
8  8.787557e-01
10           NA
11 3.552795e-06
Updating formula: s_diversion ~ 1 + tenure_year_c + conference +
    attendance_school_z + (1 + attendance_school_z | school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + attendance_school_z + (1 + attendance_school_z |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + attendance_school_z + (1 + attendance_school_z | school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + conference +
    attendance_school_z + (1 + attendance_school_z | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c +
    attendance_school_z + (1 + attendance_school_z | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + attendance_school_z + (1 | school)
   grouping                term                         block Iteration
1      <NA>                   1                       NA NA 1         7
2      <NA>       tenure_year_c           NA NA tenure_year_c         7
3      <NA>          conference              NA NA conference         7
6      <NA> attendance_school_z     NA NA attendance_school_z         7
10   school                   1                   NA school 1         7
11   school attendance_school_z NA school attendance_school_z         7
            LRT
1            NA
2  5.484720e-75
3  5.027359e-01
6            NA
10           NA
11 3.542827e-06
Updating formula: s_diversion ~ 1 + tenure_year_c + attendance_school_z
    + (1 + attendance_school_z | school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    attendance_school_z + (1 + attendance_school_z | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c +
    attendance_school_z + (1 + attendance_school_z | school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + attendance_school_z + (1 +
    attendance_school_z | school)
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    attendance_school_z + (1 | school)
   grouping                term                         block Iteration
1      <NA>                   1                       NA NA 1         8
2      <NA>       tenure_year_c           NA NA tenure_year_c         8
6      <NA> attendance_school_z     NA NA attendance_school_z         8
10   school                   1                   NA school 1         8
11   school attendance_school_z NA school attendance_school_z         8
            LRT
1            NA
2  4.070701e-75
6            NA
10           NA
11 3.097217e-06
All terms are significant
Finalizing by converting the model to lmerTest
final_model_4 <- m_4@model
summary(final_model_4)
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: s_diversion ~ 1 + tenure_year_c + attendance_school_z + (1 +  
    attendance_school_z | school)
   Data: data_clean
Control: 
structure(list(optimizer = "bobyqa", restart_edge = TRUE, boundary.tol = 1e-05,  
    calc.derivs = TRUE, use.last.params = FALSE, checkControl = list( 
        check.nobs.vs.rankZ = "ignore", check.nobs.vs.nlev = "stop",  
        check.nlev.gtreq.5 = "ignore", check.nlev.gtr.1 = "stop",  
        check.nobs.vs.nRE = "stop", check.rankX = "message+drop.cols",  
        check.scaleX = "warning", check.formula.LHS = "stop"),  
    checkConv = list(check.conv.grad = list(action = "warning",  
        tol = 0.002, relTol = NULL), check.conv.singular = list( 
        action = "message", tol = 1e-04), check.conv.hess = list( 
        action = "warning", tol = 1e-06)), optCtrl = list()), class = c("lmerControl",  
"merControl"))

REML criterion at convergence: -1465.1

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-3.6723 -0.5588 -0.0436  0.5664  3.6069 

Random effects:
 Groups   Name                Variance  Std.Dev. Corr 
 school   (Intercept)         0.0640789 0.25314       
          attendance_school_z 0.0007388 0.02718  -0.12
 Residual                     0.0176419 0.13282       
Number of obs: 1390, groups:  school, 31

Fixed effects:
                      Estimate Std. Error         df t value Pr(>|t|)    
(Intercept)          2.955e-01  4.586e-02  3.048e+01   6.444 3.77e-07 ***
tenure_year_c        2.150e-02  1.100e-03  1.369e+03  19.550  < 2e-16 ***
attendance_school_z -2.893e-03  6.386e-03  2.978e+01  -0.453    0.654    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) tnr_y_
tenure_yr_c -0.086       
attndnc_sc_ -0.099  0.073
terms <- tabulate.formula(f, group="^school")
m_5 <- buildmer(
    terms,
    data = data_clean,
    buildmerControl = buildmerControl(
        dep = "s_diversion",
        direction="backward",
        args=list(control=lmerControl(optimizer="bobyqa"))
    )
)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + conference + (1 + s_game_c +
    attendance_school_z + game_time_num_c_2 + game_result | school)
boundary (singular) fit: see help('isSingular')
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + conference + (1 + s_game_c +
    attendance_school_z + game_time_num_c_2 + game_result | school)
boundary (singular) fit: see help('isSingular')
Convergence failure. Reducing terms and retrying... The failures were:
    Singular fit
Fitting via lmer, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + conference + (1 + s_game_c +
    attendance_school_z + game_time_num_c_2 | school)
boundary (singular) fit: see help('isSingular')
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + conference + (1 + s_game_c +
    attendance_school_z + game_time_num_c_2 | school)
boundary (singular) fit: see help('isSingular')
Convergence failure. Reducing terms and retrying... The failures were:
    Singular fit
Fitting via lmer, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + conference + (1 + s_game_c +
    attendance_school_z | school)
boundary (singular) fit: see help('isSingular')
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + conference + (1 + s_game_c +
    attendance_school_z | school)
boundary (singular) fit: see help('isSingular')
Convergence failure. Reducing terms and retrying... The failures were:
    Singular fit
Fitting via lmer, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + conference + (1 + s_game_c |
    school)
boundary (singular) fit: see help('isSingular')
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + conference + (1 + s_game_c |
    school)
boundary (singular) fit: see help('isSingular')
Convergence failure. Reducing terms and retrying... The failures were:
    Singular fit
Fitting via lmer, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + conference + (1 | school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + attendance_school_z +
    game_result + s_game_c + area_classification + tenure_year_c +
    total_revenues_z + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    game_result + s_game_c + area_classification + tenure_year_c +
    total_revenues_z + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + s_game_c + area_classification +
    tenure_year_c + total_revenues_z + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + area_classification +
    tenure_year_c + total_revenues_z + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + tenure_year_c +
    total_revenues_z + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + total_revenues_z + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + (1 | school)
Fitting via gam, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + total_revenues_z + conference
   grouping                term                     block Iteration
1      <NA>                   1                   NA NA 1         1
2      <NA>   game_time_num_c_2   NA NA game_time_num_c_2         1
3      <NA> attendance_school_z NA NA attendance_school_z         1
4      <NA>         game_result         NA NA game_result         1
5      <NA>            s_game_c            NA NA s_game_c         1
6      <NA> area_classification NA NA area_classification         1
7      <NA>       tenure_year_c       NA NA tenure_year_c         1
8      <NA>    total_revenues_z    NA NA total_revenues_z         1
9      <NA>          conference          NA NA conference         1
10   school                   1               NA school 1         1
             LRT
1             NA
2   4.586007e-01
3   5.866681e-01
4   9.001051e-01
5   8.076492e-01
6   3.556987e-01
7   2.768689e-13
8   1.000000e+00
9   4.396317e-01
10 5.429199e-293
Updating formula: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + conference + (1 | school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + conference + (1 | school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + attendance_school_z +
    game_result + s_game_c + area_classification + tenure_year_c +
    conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    game_result + s_game_c + area_classification + tenure_year_c +
    conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + s_game_c + area_classification +
    tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + area_classification +
    tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + tenure_year_c +
    conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + (1 | school)
Fitting via gam, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + game_result + s_game_c + area_classification
    + tenure_year_c + conference
   grouping                term                     block Iteration
1      <NA>                   1                   NA NA 1         2
2      <NA>   game_time_num_c_2   NA NA game_time_num_c_2         2
3      <NA> attendance_school_z NA NA attendance_school_z         2
4      <NA>         game_result         NA NA game_result         2
5      <NA>            s_game_c            NA NA s_game_c         2
6      <NA> area_classification NA NA area_classification         2
7      <NA>       tenure_year_c       NA NA tenure_year_c         2
9      <NA>          conference          NA NA conference         2
10   school                   1               NA school 1         2
            LRT
1            NA
2  5.686728e-01
3  8.135263e-01
4  9.944289e-01
5  7.720264e-01
6  6.593879e-01
7  8.163783e-73
9  4.903427e-01
10 0.000000e+00
Updating formula: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + s_game_c + area_classification +
    tenure_year_c + conference + (1 | school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + s_game_c + area_classification +
    tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + s_game_c + area_classification +
    tenure_year_c + conference + (1 | school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + attendance_school_z +
    s_game_c + area_classification + tenure_year_c + conference + (1 |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    s_game_c + area_classification + tenure_year_c + conference + (1 |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + area_classification + tenure_year_c +
    conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + s_game_c + tenure_year_c + conference + (1 |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + s_game_c + area_classification + conference +
    (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + s_game_c + area_classification +
    tenure_year_c + (1 | school)
Fitting via gam, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    attendance_school_z + s_game_c + area_classification +
    tenure_year_c + conference
   grouping                term                     block Iteration
1      <NA>                   1                   NA NA 1         3
2      <NA>   game_time_num_c_2   NA NA game_time_num_c_2         3
3      <NA> attendance_school_z NA NA attendance_school_z         3
5      <NA>            s_game_c            NA NA s_game_c         3
6      <NA> area_classification NA NA area_classification         3
7      <NA>       tenure_year_c       NA NA tenure_year_c         3
9      <NA>          conference          NA NA conference         3
10   school                   1               NA school 1         3
            LRT
1            NA
2  5.684445e-01
3  8.127934e-01
5  7.695352e-01
6  6.594078e-01
7  5.671962e-73
9  4.903473e-01
10 0.000000e+00
Updating formula: s_diversion ~ 1 + game_time_num_c_2 + s_game_c +
    area_classification + tenure_year_c + conference + (1 | school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    s_game_c + area_classification + tenure_year_c + conference + (1 |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    s_game_c + area_classification + tenure_year_c + conference + (1 |
    school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + s_game_c +
    area_classification + tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    area_classification + tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    s_game_c + tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    s_game_c + area_classification + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    s_game_c + area_classification + tenure_year_c + (1 | school)
Fitting via gam, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    s_game_c + area_classification + tenure_year_c + conference
   grouping                term                     block Iteration
1      <NA>                   1                   NA NA 1         4
2      <NA>   game_time_num_c_2   NA NA game_time_num_c_2         4
5      <NA>            s_game_c            NA NA s_game_c         4
6      <NA> area_classification NA NA area_classification         4
7      <NA>       tenure_year_c       NA NA tenure_year_c         4
9      <NA>          conference          NA NA conference         4
10   school                   1               NA school 1         4
            LRT
1            NA
2  5.405208e-01
5  7.826067e-01
6  6.588291e-01
7  6.340657e-75
9  4.906797e-01
10 0.000000e+00
Updating formula: s_diversion ~ 1 + game_time_num_c_2 +
    area_classification + tenure_year_c + conference + (1 | school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    area_classification + tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    area_classification + tenure_year_c + conference + (1 | school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + area_classification +
    tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    area_classification + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    area_classification + tenure_year_c + (1 | school)
Fitting via gam, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    area_classification + tenure_year_c + conference
   grouping                term                     block Iteration
1      <NA>                   1                   NA NA 1         5
2      <NA>   game_time_num_c_2   NA NA game_time_num_c_2         5
6      <NA> area_classification NA NA area_classification         5
7      <NA>       tenure_year_c       NA NA tenure_year_c         5
9      <NA>          conference          NA NA conference         5
10   school                   1               NA school 1         5
            LRT
1            NA
2  5.139510e-01
6  6.588364e-01
7  6.404532e-75
9  4.908325e-01
10 0.000000e+00
Updating formula: s_diversion ~ 1 + game_time_num_c_2 + tenure_year_c +
    conference + (1 | school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    tenure_year_c + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    tenure_year_c + conference + (1 | school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + game_time_num_c_2 +
    tenure_year_c + (1 | school)
Fitting via gam, with REML: s_diversion ~ 1 + game_time_num_c_2 +
    tenure_year_c + conference
   grouping              term                   block Iteration          LRT
1      <NA>                 1                 NA NA 1         6           NA
2      <NA> game_time_num_c_2 NA NA game_time_num_c_2         6 5.152554e-01
7      <NA>     tenure_year_c     NA NA tenure_year_c         6 7.044989e-75
9      <NA>        conference        NA NA conference         6 4.619063e-01
10   school                 1             NA school 1         6 0.000000e+00
Updating formula: s_diversion ~ 1 + tenure_year_c + conference + (1 |
    school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c +
    conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + conference
    + (1 | school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + conference + (1 | school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + (1 |
    school)
Fitting via gam, with REML: s_diversion ~ 1 + tenure_year_c +
    conference
   grouping          term               block Iteration          LRT
1      <NA>             1             NA NA 1         7           NA
7      <NA> tenure_year_c NA NA tenure_year_c         7 7.867901e-75
9      <NA>    conference    NA NA conference         7 4.597580e-01
10   school             1         NA school 1         7 0.000000e+00
Updating formula: s_diversion ~ 1 + tenure_year_c + (1 | school)
Fitting ML and REML reference models
Fitting via lmer, with REML: s_diversion ~ 1 + tenure_year_c + (1 |
    school)
Fitting via lmer, with ML: s_diversion ~ 1 + tenure_year_c + (1 |
    school)
Testing terms
Fitting via lmer, with ML: s_diversion ~ 1 + (1 | school)
Fitting via gam, with REML: s_diversion ~ 1 + tenure_year_c
   grouping          term               block Iteration          LRT
1      <NA>             1             NA NA 1         8           NA
7      <NA> tenure_year_c NA NA tenure_year_c         8 5.430732e-75
10   school             1         NA school 1         8 0.000000e+00
All terms are significant
Finalizing by converting the model to lmerTest
final_model_5 <- m_5@model
summary(final_model_5)
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: s_diversion ~ 1 + tenure_year_c + (1 | school)
   Data: data_clean
Control: 
structure(list(optimizer = "bobyqa", restart_edge = TRUE, boundary.tol = 1e-05,  
    calc.derivs = TRUE, use.last.params = FALSE, checkControl = list( 
        check.nobs.vs.rankZ = "ignore", check.nobs.vs.nlev = "stop",  
        check.nlev.gtreq.5 = "ignore", check.nlev.gtr.1 = "stop",  
        check.nobs.vs.nRE = "stop", check.rankX = "message+drop.cols",  
        check.scaleX = "warning", check.formula.LHS = "stop"),  
    checkConv = list(check.conv.grad = list(action = "warning",  
        tol = 0.002, relTol = NULL), check.conv.singular = list( 
        action = "message", tol = 1e-04), check.conv.hess = list( 
        action = "warning", tol = 1e-06)), optCtrl = list()), class = c("lmerControl",  
"merControl"))

REML criterion at convergence: -1450.1

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-3.5869 -0.5502 -0.0223  0.5807  4.0197 

Random effects:
 Groups   Name        Variance Std.Dev.
 school   (Intercept) 0.06396  0.2529  
 Residual             0.01833  0.1354  
Number of obs: 1390, groups:  school, 31

Fixed effects:
               Estimate Std. Error        df t value Pr(>|t|)    
(Intercept)   2.966e-01  4.582e-02 3.047e+01   6.474 3.48e-07 ***
tenure_year_c 2.119e-02  1.086e-03 1.370e+03  19.517  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr)
tenure_yr_c -0.085