Appendix 1: Code
Data
dat <- read.csv("C:/Users/Emma Stacy/Desktop/Graduate School/Classes/FA26/SEM/Homework 3/hw3_missing.csv",
head = TRUE)
Model
mod.1 <- 'effort ~ selfeff + motiv
gpa ~ selfeff + motiv + effort'
1. Report missingness
library(naniar); library(mice)
dat <- dat %>%
select(female, selfeff, motiv, effort, gpa, appHours)
id = NULL
miss_var_summary(dat) # % missing per variable
## # A tibble: 6 × 3
## variable n_miss pct_miss
## <chr> <int> <num>
## 1 effort 105 35
## 2 gpa 97 32.3
## 3 female 0 0
## 4 selfeff 0 0
## 5 motiv 0 0
## 6 appHours 0 0
md.pattern (dat) # missing-data patterns

## female selfeff motiv appHours gpa effort
## 137 1 1 1 1 1 1 0
## 66 1 1 1 1 1 0 1
## 58 1 1 1 1 0 1 1
## 39 1 1 1 1 0 0 2
## 0 0 0 0 97 105 202
2. Missing Mechanism
mcar_test(dat) # Little's test (MCAR vs. not MCAR)
## # A tibble: 1 × 4
## statistic df p.value missing.patterns
## <dbl> <dbl> <dbl> <int>
## 1 113. 14 0 4
Logistic regression - effort
dat_glm <- dat %>%
mutate(
effort_na <- is.na(effort),
gpa_na <- is.na(gpa)
)
model1 <- glm(effort_na <- is.na(effort) ~ selfeff + motiv + appHours, data = dat_glm, family = "binomial")
summary(model1)
##
## Call:
## glm(formula = effort_na <- is.na(effort) ~ selfeff + motiv +
## appHours, family = "binomial", data = dat_glm)
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 5.54400 1.02035 5.433 5.53e-08 ***
## selfeff -0.14842 0.02081 -7.132 9.87e-13 ***
## motiv 0.01245 0.01657 0.751 0.452
## appHours 0.03710 0.05197 0.714 0.475
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 388.47 on 299 degrees of freedom
## Residual deviance: 303.67 on 296 degrees of freedom
## AIC: 311.67
##
## Number of Fisher Scoring iterations: 5
Logistic regression - gpa
model2 <- glm(gpa_na <- is.na(gpa) ~ selfeff + motiv + appHours, data = dat_glm, family = "binomial")
summary(model2)
##
## Call:
## glm(formula = gpa_na <- is.na(gpa) ~ selfeff + motiv + appHours,
## family = "binomial", data = dat_glm)
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 4.050873 0.905520 4.474 7.69e-06 ***
## selfeff -0.009498 0.014256 -0.666 0.505
## motiv -0.087160 0.017020 -5.121 3.04e-07 ***
## appHours -0.011875 0.048408 -0.245 0.806
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 377.61 on 299 degrees of freedom
## Residual deviance: 335.56 on 296 degrees of freedom
## AIC: 343.56
##
## Number of Fisher Scoring iterations: 4
Complete-case analysis
dat_omit <- dat %>%
filter(!is.na(effort),
!is.na(gpa))
fit.1 <- sem(model = mod.1, data = dat_omit)
summary(fit.1, fit.measures = TRUE, estimates = TRUE, standardized = TRUE)
## lavaan 0.7-2 ended normally after 1 iteration
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 7
##
## Number of observations 137
##
## Model Test User Model:
##
## Test statistic 0.000
## Degrees of freedom 0
##
## Model Test Baseline Model:
##
## Test statistic 152.058
## Degrees of freedom 5
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.000
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -513.645
## Loglikelihood unrestricted model (H1) -513.645
##
## Akaike (AIC) 1041.290
## Bayesian (BIC) 1061.730
## Sample-size adjusted Bayesian (SABIC) 1039.585
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value H_0: RMSEA <= 0.050 NA
## P-value H_0: RMSEA >= 0.080 NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.000
##
## Goodness of Fit Index:
##
## Goodness of Fit Index (GFI) 1.000
## 90 Percent confidence interval - lower 1.000
## 90 Percent confidence interval - upper 1.000
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## effort ~
## selfeff 0.393 0.082 4.759 0.000 0.393 0.350
## motiv 0.446 0.085 5.230 0.000 0.446 0.385
## gpa ~
## selfeff 0.004 0.003 1.163 0.245 0.004 0.086
## motiv 0.013 0.003 3.986 0.000 0.013 0.298
## effort 0.016 0.003 5.348 0.000 0.016 0.424
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .effort 71.422 8.630 8.276 0.000 71.422 0.619
## .gpa 0.087 0.010 8.276 0.000 0.087 0.533
4. FIML
fit.1 <- sem(model = mod.1, data = dat,
missing = "fiml",
fixed.x = FALSE)
summary(fit.1, fit.measures = TRUE,
estimates = TRUE,
standardized = TRUE)
## lavaan 0.7-2 ended normally after 37 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 14
##
## Number of observations 300
## Number of missing patterns 4
##
## Model Test User Model:
##
## Test statistic 0.000
## Degrees of freedom 0
##
## Model Test Baseline Model:
##
## Test statistic 203.013
## Degrees of freedom 5
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.000
##
## Robust Comparative Fit Index (CFI) 1.000
## Robust Tucker-Lewis Index (TLI) 1.000
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -2941.010
## Loglikelihood unrestricted model (H1) -2941.010
##
## Akaike (AIC) 5910.021
## Bayesian (BIC) 5961.874
## Sample-size adjusted Bayesian (SABIC) 5917.474
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value H_0: RMSEA <= 0.050 NA
## P-value H_0: RMSEA >= 0.080 NA
##
## Robust RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value H_0: Robust RMSEA <= 0.050 NA
## P-value H_0: Robust RMSEA >= 0.080 NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.000
##
## Goodness of Fit Index:
##
## Goodness of Fit Index (GFI) 1.000
## 90 Percent confidence interval - lower 1.000
## 90 Percent confidence interval - upper 1.000
##
## Robust GFI NA
## 90 Percent confidence interval - lower 1.000
## 90 Percent confidence interval - upper 1.000
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Observed
## Observed information based on Hessian
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## effort ~
## selfeff 0.349 0.066 5.293 0.000 0.349 0.342
## motiv 0.440 0.062 7.129 0.000 0.440 0.414
## gpa ~
## selfeff 0.005 0.003 1.740 0.082 0.005 0.114
## motiv 0.011 0.003 3.956 0.000 0.011 0.266
## effort 0.017 0.003 5.625 0.000 0.017 0.422
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## selfeff ~~
## motiv 36.670 6.067 6.044 0.000 36.670 0.372
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .effort 10.406 3.770 2.760 0.006 10.406 1.008
## .gpa 1.279 0.148 8.646 0.000 1.279 3.116
## selfeff 49.795 0.584 85.209 0.000 49.795 4.920
## motiv 49.671 0.562 88.429 0.000 49.671 5.105
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .effort 64.574 6.567 9.832 0.000 64.574 0.605
## .gpa 0.092 0.010 9.313 0.000 0.092 0.547
## selfeff 102.452 8.365 12.247 0.000 102.452 1.000
## motiv 94.655 7.729 12.247 0.000 94.655 1.000
5. Imputation and diagnostics
library(mice)
imp <- mice(dat,
m = 50,
maxit = 20,
method = "norm",
seed = 1234,
printFlag = FALSE)
Plots
plot(imp)

densityplot(imp, ~ effort + gpa)

stripplot(imp, effort ~ .imp, pch = 20)

stripplot(imp, gpa ~ .imp, pch = 20)

6. Pooling and FMI
Pool the path model:
implist <- mice::complete(imp, "all")
fit.mi <- sem.mi(
model = mod.1,
data = implist
)
summary(
fit.mi,
standardized = TRUE,
fit.measures = TRUE,
fmi = TRUE
)
## lavaan.mi object fit to 50 imputed data sets using:
## - lavaan (0.7-2)
## - lavaan.mi (0.1-1)
## See class?lavaan.mi help page for available methods.
##
## Convergence information:
## The model converged on 50 imputed data sets.
## Standard errors were available for all imputations.
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 7
##
## Number of observations 300
##
## Test statistic(s) pooled using the D4 pooling method.
## Pooled statistic: "standard"
##
## Model Test User Model:
##
## Test statistic 0.000
## Degrees of freedom 0
## P-value 1.000
## Pooling method D4
##
## Model Test Baseline Model:
##
## Test statistic 200.678
## Degrees of freedom 5
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.000
## Bentler-Bonett Non-normed Fit Index (NNFI) 1.000
## Bentler-Bonett Normed Fit Index (NFI) 1.000
## Parsimony Normed Fit Index (PNFI) 0.000
## Bollen's Relative Fit Index (RFI) 1.000
## Bollen's Incremental Fit Index (IFI) 1.000
## Relative Noncentrality Index (RNI) 1.000
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -1125.865
## Loglikelihood unrestricted model (H1) -1125.863
##
## Akaike (AIC) 2265.730
## Bayesian (BIC) 2291.657
## Sample-size adjusted Bayesian (SABIC) 2269.457
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value H_0: RMSEA <= 0.050 NA
## P-value H_0: RMSEA >= 0.080 NA
##
## Standardized Root Mean Square Residual:
##
## RMR 2.663
## RMR (No Mean) 2.663
## SRMR 0.040
##
## Goodness of Fit Index:
##
## Goodness of Fit Index (GFI) 1.000
## 90 Percent confidence interval - lower 1.000
## 90 Percent confidence interval - upper 1.000
##
## Other Fit Indices:
##
## Hoelter Critical N (CN) alpha = 0.05 NA
## Hoelter Critical N (CN) alpha = 0.01 NA
##
## Goodness of Fit Index LISREL (GFI) 1.000
## Adjusted Goodness of Fit Index LISREL (AGFI) 1.000
## Parsimony Goodness of Fit Index (PGFI) 0.000
##
## McDonald Fit Index (MFI) 1.000
##
## Expected Cross-Validation Index (ECVI) 0.047
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Pooled across imputations Rubin's (1987) rules
## Augment within-imputation variance Scale by average RIV
## Wald test for pooled parameters t(df) distribution
##
## Pooled t statistics with df >= 1000 are displayed with
## df = Inf(inity) to save space. Although the t distribution
## with large df closely approximates a standard normal
## distribution, exact df for reporting these t tests can be
## obtained from parameterEstimates.mi()
##
##
## Regressions:
## Estimate Std.Err t-value df P(>|t|) Std.lv
## effort ~
## selfeff 0.362 0.061 5.904 351.911 0.000 0.362
## motiv 0.415 0.064 6.494 Inf 0.000 0.415
## gpa ~
## selfeff 0.005 0.003 2.063 469.026 0.040 0.005
## motiv 0.012 0.003 4.400 552.425 0.000 0.012
## effort 0.016 0.003 6.017 369.135 0.000 0.016
## Std.all FMI RIV
##
## 0.355 0.373 0.595
## 0.390 0.216 0.276
##
## 0.127 0.323 0.478
## 0.275 0.298 0.424
## 0.404 0.364 0.573
##
## Variances:
## Estimate Std.Err t-value df P(>|t|) Std.lv
## .effort 66.107 6.642 9.954 359.674 0.000 66.107
## .gpa 0.094 0.009 9.950 289.674 0.000 0.094
## Std.all FMI RIV
## 0.619 0.369 0.585
## 0.552 0.411 0.699
Rerun with different seeds and five imputations
imp_5 <- mice(dat,
m = 5,
maxit = 20,
method = "norm",
seed = 12345,
printFlag = FALSE)
implist_5 <- mice::complete(imp_5, "all")
fit.mi2 <- sem.mi(
model = mod.1,
data = implist_5
)
summary(
fit.mi2,
standardized = TRUE,
fit.measures = TRUE,
fmi = TRUE
)
## lavaan.mi object fit to 5 imputed data sets using:
## - lavaan (0.7-2)
## - lavaan.mi (0.1-1)
## See class?lavaan.mi help page for available methods.
##
## Convergence information:
## The model converged on 5 imputed data sets.
## Standard errors were available for all imputations.
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 7
##
## Number of observations 300
##
## Test statistic(s) pooled using the D4 pooling method.
## Pooled statistic: "standard"
##
## Model Test User Model:
##
## Test statistic 0.000
## Degrees of freedom 0
## P-value 1.000
## Pooling method D4
##
## Model Test Baseline Model:
##
## Test statistic 159.082
## Degrees of freedom 5
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.000
## Bentler-Bonett Non-normed Fit Index (NNFI) 1.000
## Bentler-Bonett Normed Fit Index (NFI) 1.000
## Parsimony Normed Fit Index (PNFI) 0.000
## Bollen's Relative Fit Index (RFI) 1.000
## Bollen's Incremental Fit Index (IFI) 1.000
## Relative Noncentrality Index (RNI) 1.000
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -1127.862
## Loglikelihood unrestricted model (H1) -1127.860
##
## Akaike (AIC) 2269.724
## Bayesian (BIC) 2295.650
## Sample-size adjusted Bayesian (SABIC) 2273.450
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value H_0: RMSEA <= 0.050 NA
## P-value H_0: RMSEA >= 0.080 NA
##
## Standardized Root Mean Square Residual:
##
## RMR 2.466
## RMR (No Mean) 2.466
## SRMR 0.031
##
## Goodness of Fit Index:
##
## Goodness of Fit Index (GFI) 1.000
## 90 Percent confidence interval - lower 1.000
## 90 Percent confidence interval - upper 1.000
##
## Other Fit Indices:
##
## Hoelter Critical N (CN) alpha = 0.05 NA
## Hoelter Critical N (CN) alpha = 0.01 NA
##
## Goodness of Fit Index LISREL (GFI) 1.000
## Adjusted Goodness of Fit Index LISREL (AGFI) 1.000
## Parsimony Goodness of Fit Index (PGFI) 0.000
##
## McDonald Fit Index (MFI) 1.000
##
## Expected Cross-Validation Index (ECVI) 0.047
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Pooled across imputations Rubin's (1987) rules
## Augment within-imputation variance Scale by average RIV
## Wald test for pooled parameters t(df) distribution
##
## Regressions:
## Estimate Std.Err t-value df P(>|t|) Std.lv
## effort ~
## selfeff 0.351 0.066 5.301 12.704 0.000 0.351
## motiv 0.409 0.069 5.938 93.845 0.000 0.409
## gpa ~
## selfeff 0.005 0.003 2.035 32.010 0.050 0.005
## motiv 0.011 0.003 4.011 51.315 0.000 0.011
## effort 0.016 0.003 5.677 22.421 0.000 0.016
## Std.all FMI RIV
##
## 0.344 0.561 1.279
## 0.386 0.206 0.260
##
## 0.134 0.354 0.547
## 0.268 0.279 0.387
## 0.405 0.422 0.731
##
## Variances:
## Estimate Std.Err t-value df P(>|t|) Std.lv
## .effort 67.383 7.237 9.311 11.843 0.000 67.383
## .gpa 0.093 0.010 9.323 19.840 0.000 0.093
## Std.all FMI RIV
## 0.634 0.581 1.388
## 0.556 0.449 0.815
imp_52 <- mice(dat,
m = 5,
maxit = 20,
method = "norm",
seed = 54321,
printFlag = FALSE)
implist_52 <- mice::complete(imp_52, "all")
fit.mi22 <- sem.mi(
model = mod.1,
data = implist_52
)
summary(
fit.mi22,
standardized = TRUE,
fit.measures = TRUE,
fmi = TRUE
)
## lavaan.mi object fit to 5 imputed data sets using:
## - lavaan (0.7-2)
## - lavaan.mi (0.1-1)
## See class?lavaan.mi help page for available methods.
##
## Convergence information:
## The model converged on 5 imputed data sets.
## Standard errors were available for all imputations.
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 7
##
## Number of observations 300
##
## Test statistic(s) pooled using the D4 pooling method.
## Pooled statistic: "standard"
##
## Model Test User Model:
##
## Test statistic 0.000
## Degrees of freedom 0
## P-value 1.000
## Pooling method D4
##
## Model Test Baseline Model:
##
## Test statistic 168.073
## Degrees of freedom 5
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.000
## Bentler-Bonett Non-normed Fit Index (NNFI) 1.000
## Bentler-Bonett Normed Fit Index (NFI) 1.000
## Parsimony Normed Fit Index (PNFI) 0.000
## Bollen's Relative Fit Index (RFI) 1.000
## Bollen's Incremental Fit Index (IFI) 1.000
## Relative Noncentrality Index (RNI) 1.000
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -1124.111
## Loglikelihood unrestricted model (H1) -1124.109
##
## Akaike (AIC) 2262.223
## Bayesian (BIC) 2288.149
## Sample-size adjusted Bayesian (SABIC) 2265.949
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value H_0: RMSEA <= 0.050 NA
## P-value H_0: RMSEA >= 0.080 NA
##
## Standardized Root Mean Square Residual:
##
## RMR 1.365
## RMR (No Mean) 1.365
## SRMR 0.035
##
## Goodness of Fit Index:
##
## Goodness of Fit Index (GFI) 1.000
## 90 Percent confidence interval - lower 1.000
## 90 Percent confidence interval - upper 1.000
##
## Other Fit Indices:
##
## Hoelter Critical N (CN) alpha = 0.05 NA
## Hoelter Critical N (CN) alpha = 0.01 NA
##
## Goodness of Fit Index LISREL (GFI) 1.000
## Adjusted Goodness of Fit Index LISREL (AGFI) 1.000
## Parsimony Goodness of Fit Index (PGFI) 0.000
##
## McDonald Fit Index (MFI) 1.000
##
## Expected Cross-Validation Index (ECVI) 0.047
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Pooled across imputations Rubin's (1987) rules
## Augment within-imputation variance Scale by average RIV
## Wald test for pooled parameters t(df) distribution
##
## Regressions:
## Estimate Std.Err t-value df P(>|t|) Std.lv
## effort ~
## selfeff 0.391 0.065 6.012 101.175 0.000 0.391
## motiv 0.413 0.068 6.105 32.681 0.000 0.413
## gpa ~
## selfeff 0.005 0.003 1.949 36.003 0.059 0.005
## motiv 0.011 0.003 3.955 20.188 0.001 0.011
## effort 0.016 0.003 5.573 53.314 0.000 0.016
## Std.all FMI RIV
##
## 0.379 0.199 0.248
## 0.385 0.350 0.538
##
## 0.130 0.333 0.500
## 0.264 0.445 0.802
## 0.406 0.274 0.377
##
## Variances:
## Estimate Std.Err t-value df P(>|t|) Std.lv
## .effort 65.354 6.984 9.358 42.950 0.000 65.354
## .gpa 0.094 0.010 9.335 10.965 0.000 0.094
## Std.all FMI RIV
## 0.600 0.305 0.439
## 0.555 0.604 1.525
7. Compare methods
library(knitr)
library(kableExtra)
gpa_table <- tibble(
Predictor = c("Self-efficacy (selfeff)", "Motivation (motiv)", "Effort (effort)"),
MI_Beta = c("0.127", "0.275", "0.404"),
MI_SE = c("0.003", "0.003", "0.003"),
FIML_Beta = c("0.114", "0.266", "0.422"),
FIML_SE = c("0.003", "0.003", "0.003"),
Del_Beta = c("0.086", "0.298", "0.424"),
Del_SE = c("0.003", "0.003", "0.003")
)
gpa_table %>%
kable(
format = "html",
booktabs = TRUE,
col.names = c("Predictor", "beta", "SE", "beta", "SE", "beta", "SE"),
align = c("l", "c", "c", "c", "c", "c", "c"),
caption = "Comparison of GPA Path Estimates and Standard Errors Across Missing Data Methods"
) %>%
add_header_above(c(" " = 1, "Multiple Imputation" = 2, "FIML" = 2, "Complete Case" = 2)) %>%
kable_classic(full_width = FALSE, html_font = "Times New Roman")
Comparison of GPA Path Estimates and Standard Errors Across Missing Data
Methods
|
|
Multiple Imputation
|
FIML
|
Complete Case
|
|
Predictor
|
beta
|
SE
|
beta
|
SE
|
beta
|
SE
|
|
Self-efficacy (selfeff)
|
0.127
|
0.003
|
0.114
|
0.003
|
0.086
|
0.003
|
|
Motivation (motiv)
|
0.275
|
0.003
|
0.266
|
0.003
|
0.298
|
0.003
|
|
Effort (effort)
|
0.404
|
0.003
|
0.422
|
0.003
|
0.424
|
0.003
|
8. Auxillary variable - appHours
Refit FIML with appHours
mod.1_aux <- 'effort ~ selfeff + motiv
gpa ~ selfeff + motiv + effort
appHours ~~ selfeff + motiv + effort + gpa
appHours ~~ appHours
appHours ~ 1'
fit.1.aux <- sem(model = mod.1_aux, data = dat,
missing = "fiml",
fixed.x = FALSE)
summary(fit.1.aux, fit.measures = TRUE,
estimates = TRUE,
standardized = TRUE)
## lavaan 0.7-2 ended normally after 72 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 19
##
## Number of observations 300
## Number of missing patterns 4
##
## Model Test User Model:
##
## Test statistic 44.780
## Degrees of freedom 1
## P-value (Chi-square) 0.000
##
## Model Test Baseline Model:
##
## Test statistic 341.098
## Degrees of freedom 10
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.868
## Tucker-Lewis Index (TLI) -0.322
##
## Robust Comparative Fit Index (CFI) 0.912
## Robust Tucker-Lewis Index (TLI) 0.120
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -3659.253
## Loglikelihood unrestricted model (H1) -3636.863
##
## Akaike (AIC) 7356.505
## Bayesian (BIC) 7426.877
## Sample-size adjusted Bayesian (SABIC) 7366.620
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.382
## 90 Percent confidence interval - lower 0.291
## 90 Percent confidence interval - upper 0.481
## P-value H_0: RMSEA <= 0.050 0.000
## P-value H_0: RMSEA >= 0.080 1.000
##
## Robust RMSEA 0.382
## 90 Percent confidence interval - lower 0.291
## 90 Percent confidence interval - upper 0.481
## P-value H_0: Robust RMSEA <= 0.050 0.000
## P-value H_0: Robust RMSEA >= 0.080 1.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.114
##
## Goodness of Fit Index:
##
## Goodness of Fit Index (GFI) 0.945
## 90 Percent confidence interval - lower 0.915
## 90 Percent confidence interval - upper 0.967
##
## Robust GFI 0.945
## 90 Percent confidence interval - lower 0.915
## 90 Percent confidence interval - upper 0.967
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Observed
## Observed information based on Hessian
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## effort ~
## selfeff 0.361 0.062 5.793 0.000 0.361 0.376
## motiv 0.415 0.059 6.996 0.000 0.415 0.416
## gpa ~
## selfeff 0.005 0.003 1.779 0.075 0.005 0.120
## motiv 0.012 0.003 4.189 0.000 0.012 0.288
## effort 0.017 0.003 5.846 0.000 0.017 0.414
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## selfeff ~~
## appHours 3.259 1.731 1.882 0.060 3.259 0.113
## motiv ~~
## appHours 7.517 1.755 4.283 0.000 7.517 0.272
## .effort ~~
## appHours 10.809 1.585 6.818 0.000 10.809 0.473
## .gpa ~~
## appHours -0.095 0.054 -1.755 0.079 -0.095 -0.111
##
## Intercepts:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## appHours 9.861 0.164 60.085 0.000 9.861 3.469
## .effort 11.175 3.562 3.137 0.002 11.175 1.152
## .gpa 1.258 0.146 8.593 0.000 1.258 3.203
## selfeff 49.795 0.584 85.209 0.000 49.795 4.920
## motiv 49.671 0.562 88.429 0.000 49.671 5.105
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## appHours 8.081 0.651 12.404 0.000 8.081 1.000
## .effort 64.517 6.441 10.016 0.000 64.517 0.685
## .gpa 0.092 0.010 9.471 0.000 0.092 0.594
## selfeff 102.452 8.365 12.247 0.000 102.452 1.000
## motiv 94.655 7.729 12.247 0.000 94.655 1.000
Refit MI without appHours
dat_aux <- dat %>%
select(-appHours)
imp_aux <- mice(dat_aux,
m = 50,
maxit = 20,
method = "norm",
seed = 1234,
printFlag = FALSE)
implist_aux <- mice::complete(imp_aux, "all")
fit.miaux <- sem.mi(
model = mod.1,
data = implist_aux
)
summary(
fit.miaux,
standardized = TRUE,
fit.measures = TRUE,
fmi = TRUE
)
## lavaan.mi object fit to 50 imputed data sets using:
## - lavaan (0.7-2)
## - lavaan.mi (0.1-1)
## See class?lavaan.mi help page for available methods.
##
## Convergence information:
## The model converged on 50 imputed data sets.
## Standard errors were available for all imputations.
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 7
##
## Number of observations 300
##
## Test statistic(s) pooled using the D4 pooling method.
## Pooled statistic: "standard"
##
## Model Test User Model:
##
## Test statistic 0.000
## Degrees of freedom 0
## P-value 1.000
## Pooling method D4
##
## Model Test Baseline Model:
##
## Test statistic 165.826
## Degrees of freedom 5
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.000
## Bentler-Bonett Non-normed Fit Index (NNFI) 1.000
## Bentler-Bonett Normed Fit Index (NFI) 1.000
## Parsimony Normed Fit Index (PNFI) 0.000
## Bollen's Relative Fit Index (RFI) 1.000
## Bollen's Incremental Fit Index (IFI) 1.000
## Relative Noncentrality Index (RNI) 1.000
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -1125.565
## Loglikelihood unrestricted model (H1) -1125.559
##
## Akaike (AIC) 2265.130
## Bayesian (BIC) 2291.057
## Sample-size adjusted Bayesian (SABIC) 2268.857
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value H_0: RMSEA <= 0.050 NA
## P-value H_0: RMSEA >= 0.080 NA
##
## Standardized Root Mean Square Residual:
##
## RMR 2.223
## RMR (No Mean) 2.223
## SRMR 0.033
##
## Goodness of Fit Index:
##
## Goodness of Fit Index (GFI) 1.000
## 90 Percent confidence interval - lower 1.000
## 90 Percent confidence interval - upper 1.000
##
## Other Fit Indices:
##
## Hoelter Critical N (CN) alpha = 0.05 NA
## Hoelter Critical N (CN) alpha = 0.01 NA
##
## Goodness of Fit Index LISREL (GFI) 1.000
## Adjusted Goodness of Fit Index LISREL (AGFI) 1.000
## Parsimony Goodness of Fit Index (PGFI) 0.000
##
## McDonald Fit Index (MFI) 1.000
##
## Expected Cross-Validation Index (ECVI) 0.047
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Pooled across imputations Rubin's (1987) rules
## Augment within-imputation variance Scale by average RIV
## Wald test for pooled parameters t(df) distribution
##
## Regressions:
## Estimate Std.Err t-value df P(>|t|) Std.lv
## effort ~
## selfeff 0.352 0.064 5.471 209.893 0.000 0.352
## motiv 0.437 0.067 6.530 481.754 0.000 0.437
## gpa ~
## selfeff 0.005 0.003 1.851 237.581 0.065 0.005
## motiv 0.011 0.003 3.908 290.269 0.000 0.011
## effort 0.016 0.003 5.731 200.292 0.000 0.016
## Std.all FMI RIV
##
## 0.344 0.483 0.935
## 0.410 0.319 0.468
##
## 0.121 0.454 0.832
## 0.262 0.411 0.697
## 0.411 0.495 0.979
##
## Variances:
## Estimate Std.Err t-value df P(>|t|) Std.lv
## .effort 65.399 6.924 9.445 517.166 0.000 65.399
## .gpa 0.094 0.010 9.437 272.501 0.000 0.094
## Std.all FMI RIV
## 0.608 0.308 0.445
## 0.559 0.424 0.736