STAT 360: Computational Statistics and Data Analysis

Load R Libraries, Import and Attach Relevant Data, and Specify Seed

library(rmarkdown); library(knitr); library(readxl)
set.seed(37)

EXERCISE 01

Part (a)

The full mediation model is nested within partial mediation. This is because the degrees of freedom and chi-squared are higher for full mediation than for partial.

Part (b)

fullX2 <- 1338.404
partialX2 <- 1209.977
deltaX2 <- fullX2 - partialX2
deltaX2
## [1] 128.427

Part (c)

fullDF <- 576
partialDF <- 574
deltaDF <- fullDF - partialDF
deltaDF
## [1] 2

Part (d)

Any test statistics above this critical value of 5.99 would mean the nested model is significantly worse and shouldn't be used over the more complex model.
alpha <- .05
cv <- qchisq(1-alpha, deltaDF)
cv
## [1] 5.991465

Part (e)

Our test statistic is 128, which is way above the critical value. This means that the full mediation model is significantly worse than the partial mediation model. We should not use this simpler model over the more complex model. 

Part (f)

The partial mediation model is a better fit. Thus, it appears that cognitive appraisal would partially mediate the effect of work-family conflicts on teacher burnout.

Part (g)

The CFI for partial mediation is .954, which is above the threshold of .95, indicating that this is an acceptable model.
The CFI for full mediation is .945, which is below the threshold of .95, indicating this isn't an acceptable model. It's not too much lower, but the other model is definitely better. 

Part (h)

My answer to part g is in agreement with part f, so the partial mediation model is better.

Part (i)

The RMSEA of the partial mediation model is .051, which is below the threshold of .10, indicating this is an acceptable model.
The RMSEA of the full mediation model is .056, which is also below the threshold of .10, again indicating this is an acceptable model. 
They are both acceptable, but the RMSEA is lower for the partial mediation model, so this model is better than the full mediation model.

Part (j)

Again, my answer to part i is in agreement with my answer in part f. The partial model (not to be confused with the nested model because of the names), is better.

Part (k)

library(cats)
here_kitty()

## meow