Warning: package 'lme4' was built under R version 4.2.3
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.2.3
Attaching package: 'lmerTest'
The following object is masked from 'package:lme4':
lmer
The following object is masked from 'package:stats':
step
library(negligible)model1 <-lmer(avg_MU ~ avg_studyTime + avg_pupil + (1| participant), model_data)# Below using the function from the package neglibile# I think I did it right. Not 100% yetneg.reg(data = model_data, formula = avg_MU ~ avg_studyTime + avg_pupil, predictor = avg_pupil,eil =-0.4, eiu =0.4)
*** Evaluating Negligible Effects Between Predictor and Outcome in Multiple Regression ***
Unstandardized regression coefficient for avg_pupil and confidence interval using 1000 bootstrap iterations (random seed = 10124):
b = 2.737, 95% CI [0.061, 5.237]
std. error = 1.353
**********************
Anderson-Hauck (AH) procedure:
Equivalence interval: lower= -0.4, upper= 0.4
Anderson-Hauck T statistic = 2.022
p = 0.944
NHST decision: The null hypothesis that the regression coefficient is non-negligible cannot be rejected. There is insufficient evidence to conclude a negligible effect. Be sure to interpret the magnitude (and precision) of the effect size.
*Note that in rare cases, where p is close to α, NHST decisions using the AH procedure may not match TOST NHST results or the Symmetric CI Approach at 100*(1-2α)% illustrated in the plots.
**********************
Proportional Distance
Proportional distance: 6.842
95% confidence interval for the proportional distance: (0.152, 13.092)
*Note that the confidence interval for the proportional distance may not be precise with small sample sizes
*******************
lower <-contest1D(model1, c(0, 0, 1), confint=TRUE, rhs=-0.4) # get t value for test against lower boundupper <-contest1D(model1, c(0, 0, 1), confint=TRUE, rhs=0.4) # get t value for test against upper boundprint("Below is the lower bound:")
[1] "Below is the lower bound:"
lower$`Pr(>|t|)`/2# test against lower bound
[1] 0.08943313
print("Below is the upper bound:")
[1] "Below is the upper bound:"
upper$`Pr(>|t|)`/2# test against upper bound
[1] 0.2243814
Both of the above methods (if I did them right) show that the equivalence tests for the pupil are not significant, meaning that we can’t say our effect is negligible, based on the pilot data at least.
Dominance analysis on multiple regression
Does not work with lmer, only works with standard lm.
The VIF values are identical, but this Stack Exchange answer explains why. The VIF and the correlation coefficient between study time and pupil actually demonstrate that there isn’t a problem. VIF values of 1 suggest no problem at all, VIF values from 1 - 5 suggest a moderate correlation (which many people ignore anyway even when VIF is at 5), so our VIF of 1.01 is fine. Also the correlation is only -0.2. But keep in mind I am just getting the average of the entire maintenance phase! We haven’t decided yet on the time period of interest.
library(car)library(performance)vif_model <-vif(model1)print("Below shows the VIF values of pupil and study time.")
[1] "Below shows the VIF values of pupil and study time."
vif_model
avg_studyTime avg_pupil
1.00946 1.00946
print("Below shows the correlation between pupil and study time.")
[1] "Below shows the correlation between pupil and study time."
cor(model_data$avg_pupil, model_data$avg_studyTime, use ="complete.obs")