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 columndata_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 columndata_clean$`Game Time`=format(data_clean$`Game Time`, format ="%H:%M") # avoid game time impacted by computer system datedata_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
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, # Morningifelse(GameTime_numeric >=12& GameTime_numeric <15.5, 2, # noonifelse(GameTime_numeric >=15.5& GameTime_numeric <19, 3, # afternoonifelse(GameTime_numeric >=19, 4, # eveningNA))) )) # 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 <- 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.
Might violate the heteroscedasticity. The spread of residuals is not constant across the range of fitted values.(fitted values < 0.2, variance is small)
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).
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
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).
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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@modelsummary(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
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).
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
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
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
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
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
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
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
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
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@modelsummary(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
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
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
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
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
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
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
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