1 Preparing Data

1.1 Load Libraries

## Necessary Libraries loaded.

1.2 Load Data

2 Overview of Raw Data

2.1 Histograms of all IWB for all Organisations

library(ggplot2)
ggplot(DFvar, aes(x = Org, y = IWB, fill = Sector)) + ylim(1, 7) +
    geom_violin(trim = FALSE) + ggtitle("Individual Innovative Work Behaviour (IWB) by Organisation") + 
    scale_fill_manual(values = c("lightblue", "pink")) +
    xlab("") + ylab("") + 
    geom_boxplot(width = 0.2, fill = "lightgrey") +
    geom_jitter(shape = 16, position = position_jitter(0.2)) +
    stat_summary(fun.y = mean, geom = "point", shape = 15, size = 5, color = "red") +
    theme(
    plot.title   = element_text(color = "black", size = 35, face = "bold", hjust = 0.5, margin = margin(30,0,30,0)),
    axis.title.x = element_blank(),
    axis.title.y = element_blank(),
    axis.text.x  = element_text(color = "darkblue", size = 30, margin = margin(30,0,0,0)),
    axis.text.y  = element_text(color = "darkblue", size = 30, margin = margin(0,30,0,0)),
    panel.background = element_rect(fill = "white", colour = "grey", size = 0.5, linetype = "solid"),
    panel.grid.major = element_line(size = 0.5, linetype = 'solid', colour = "lightblue"),
    plot.margin = margin(2, 2, 2, 2, "cm"),
    legend.position = "top",
    legend.title =element_blank(), 
    legend.text = element_text(size = 25))

2.2 Descriptive Statistics of Individual Innovative Work Behaviour

library(RcmdrMisc)
## Loading required package: sandwich
## 
## Attaching package: 'RcmdrMisc'
## The following object is masked from 'package:psych':
## 
##     reliability
numSummary(DFvar$IWB, 
           groups = DFvar$Org, 
           statistics = c("mean", "sd", "skewness", "kurtosis", "quantiles"), 
                          quantiles = c(0.0, 0.25, 0.5, 0.75, 1.00))
##           mean     sd skewness kurtosis    0%   25%   50%   75%  100% data:n
## Private1 5.091 1.1254  -0.5235  -0.2731 2.111 4.472 5.111 6.000 7.000     90
## Private2 5.006 0.9753  -0.5676  -0.2870 1.778 4.222 5.167 5.889 6.444    128
## Private3 4.771 1.0767  -0.1944   0.5547 2.333 4.167 4.667 5.500 7.000     29
## Public1  4.731 1.1847  -0.6806  -0.4105 1.889 4.028 5.000 5.750 6.222     26
## Public2  4.453 1.0426  -0.2478   0.1286 1.778 3.889 4.556 5.111 7.000    155
## Public3  4.632 1.1316  -0.7535   1.0568 1.000 3.889 4.833 5.333 6.889     54

3 Studying Data

3.1 Running EFA for Pax Data (DFs)

# Conduct a single-factor EFA
# install.packages("lavaan")
EFA_Pax <- fa(DFs, )

# View the results
# print(EFA_Pax)

# View the factor loadings
# EFA_Pax$loadings

# Plot factor scores
plot(density(EFA_Pax$scores, na.rm = TRUE), main = "Factor Scores", size = 2, col = "blue")
grid(nx = NULL, ny = NULL, col = "lightgray", lty = "dotted")

The plot of factor scores indicates the distribution of all survey ratings assuming they all belong to a common factor.

3.2 Evaluating data with factor analysis

Evaluating Model Structure with Indices: RMSR < 0.08, SRMR < 0.08, TLI > 0.90, CFI > 0.90, i.e. model fit is acceptable with seven factors. Scree Plot hints to eight factors instead of seven proposed by our variables. Therefore, we may need to split one less consistently structured factor into two.

# Calculate the correlation matrix first
DFS_EFA_corr <- cor(DFs, use = "pairwise.complete.obs")

# Then use that correlation matrix to calculate eigenvalues
eigenvals <- eigen(DFS_EFA_corr)

# Look at the eigenvalues returned
eigenvals$values
##  [1] 28.4010  7.9071  3.9078  2.7397  1.4387  1.3085  1.1872  1.0916  1.0194
## [10]  1.0049  0.9391  0.9017  0.8229  0.7906  0.7537  0.7240  0.7033  0.6908
## [19]  0.6654  0.6556  0.6103  0.5983  0.5674  0.5527  0.5388  0.5356  0.5236
## [28]  0.5214  0.5022  0.4846  0.4771  0.4585  0.4528  0.4485  0.4445  0.4196
## [37]  0.4082  0.4014  0.3893  0.3809  0.3692  0.3630  0.3566  0.3505  0.3305
## [46]  0.3293  0.3212  0.3121  0.3103  0.2980  0.2890  0.2825  0.2779  0.2687
## [55]  0.2636  0.2573  0.2459  0.2381  0.2308  0.2226  0.2171  0.2110  0.2066
## [64]  0.1938  0.1889  0.1836  0.1830  0.1738  0.1686  0.1618  0.1549  0.1511
## [73]  0.1445  0.1378  0.1217  0.1158
# Prepare PDF
# pdf("ScreePlot.pdf", width = 25, height = 16)
# par(mai=c(2, 2, 2, 2))
# par(oma=c(2, 2, 2, 2))

# Plot Scree Plot
plot(eigenvals$values, log = "y", 
     main = "Scree Plot for Eigenvalues",
     xlab = "Factor", xlim = c(0, 20), 
     ylab = "Eigenvalue of Factor", ylim = c(0.5, 25),
     type  = "o" # connect dots with line.
      )
abline(h = 1, col = "red", lty = 5)
text(x = 12,
     y = 1,
     labels = "Eigenvalue of 1", cex = 1.0,
     pos = 3,
     col  = "red")
grid(nx = NULL, ny = NULL, col = "lightgray", lty = "dotted")

# dev.off()

# Use the correlation matrix to create the scree plot
# scree(DFS_EFA_corr, factors = TRUE)

# Run the EFA with 7 factors (as indicated by scree plot)
library(psych)
EFA_model <- fa(DFs, nfactors = 7)
## Loading required namespace: GPArotation
print(EFA_model)
## Factor Analysis using method =  minres
## Call: fa(r = DFs, nfactors = 7)
## Standardized loadings (pattern matrix) based upon correlation matrix
##       MR1   MR2   MR3   MR4   MR5   MR6   MR7   h2   u2 com
## Q001 0.64  0.24  0.10  0.08 -0.19 -0.17  0.07 0.55 0.45 1.7
## Q002 0.66  0.25  0.07  0.00 -0.15 -0.12  0.00 0.54 0.46 1.5
## Q003 0.56  0.31  0.13  0.13 -0.17 -0.11  0.12 0.50 0.50 2.3
## Q004 0.62  0.19  0.14  0.04  0.01 -0.08 -0.08 0.46 0.54 1.4
## Q005 0.59  0.28  0.11  0.03  0.12 -0.19 -0.08 0.49 0.51 1.9
## Q006 0.67  0.29  0.07  0.05  0.02 -0.08 -0.15 0.57 0.43 1.6
## Q007 0.55  0.34  0.19  0.08  0.28 -0.14  0.05 0.56 0.44 2.8
## Q008 0.44  0.23  0.17  0.19 -0.04  0.02  0.20 0.35 0.65 2.8
## Q009 0.51  0.21  0.15  0.09 -0.02 -0.14 -0.01 0.36 0.64 1.8
## Q010 0.46  0.34  0.25  0.26  0.03 -0.13  0.00 0.47 0.53 3.4
## Q011 0.66  0.17  0.24  0.06 -0.03 -0.06 -0.14 0.55 0.45 1.5
## Q012 0.61  0.12  0.22  0.06 -0.06 -0.09  0.00 0.45 0.55 1.4
## Q013 0.64 -0.47 -0.07  0.10  0.08 -0.12  0.01 0.66 0.34 2.1
## Q014 0.58 -0.47  0.03  0.18 -0.08  0.05 -0.01 0.60 0.40 2.2
## Q015 0.62 -0.53  0.02  0.17  0.07 -0.07 -0.07 0.70 0.30 2.2
## Q016 0.61 -0.45  0.02  0.15  0.09  0.06 -0.03 0.61 0.39 2.1
## Q017 0.65 -0.45 -0.11 -0.01  0.03 -0.17 -0.03 0.67 0.33 2.0
## Q018 0.67 -0.50 -0.04  0.08 -0.03  0.04  0.01 0.71 0.29 1.9
## Q019 0.63 -0.43  0.02  0.22 -0.09  0.03 -0.06 0.64 0.36 2.1
## Q020 0.68 -0.42  0.00  0.19 -0.06 -0.02 -0.03 0.68 0.32 1.9
## Q021 0.66 -0.48 -0.03  0.09 -0.03 -0.06 -0.10 0.69 0.31 1.9
## Q022 0.65 -0.49  0.01  0.12 -0.06  0.01 -0.06 0.68 0.32 2.0
## Q023 0.66 -0.52 -0.02  0.06  0.03 -0.08 -0.07 0.71 0.29 2.0
## Q024 0.70 -0.48 -0.02  0.13 -0.04 -0.04  0.01 0.75 0.25 1.9
## Q025 0.56 -0.51 -0.05  0.09 -0.02  0.04  0.03 0.59 0.41 2.1
## Q026 0.59 -0.55 -0.02  0.07 -0.01  0.12 -0.04 0.68 0.32 2.1
## Q027 0.64 -0.49 -0.03  0.08 -0.02  0.00 -0.06 0.66 0.34 1.9
## Q028 0.64 -0.52 -0.10  0.05  0.06  0.00 -0.01 0.69 0.31 2.0
## Q029 0.51 -0.58 -0.10 -0.03  0.07 -0.10  0.03 0.62 0.38 2.2
## Q030 0.38 -0.18 -0.08  0.14 -0.02  0.06  0.11 0.22 0.78 2.1
## Q031 0.63 -0.21 -0.20  0.10 -0.01 -0.03  0.05 0.50 0.50 1.5
## Q032 0.66 -0.54 -0.03  0.01  0.11 -0.11 -0.03 0.76 0.24 2.1
## Q033 0.65 -0.06  0.33 -0.21 -0.03  0.25  0.04 0.64 0.36 2.1
## Q034 0.62 -0.11  0.35 -0.24 -0.07  0.18  0.05 0.62 0.38 2.3
## Q035 0.61 -0.20  0.34 -0.26 -0.03  0.23  0.04 0.65 0.35 2.6
## Q037 0.39 -0.17  0.23 -0.39  0.04 -0.10  0.02 0.40 0.60 3.2
## Q038 0.57 -0.14  0.33 -0.31 -0.01  0.01  0.07 0.56 0.44 2.4
## Q044 0.55 -0.15  0.32 -0.29 -0.08  0.07  0.15 0.55 0.45 2.7
## Q045 0.57 -0.07  0.37 -0.17  0.04  0.20 -0.09 0.55 0.45 2.3
## Q049 0.59 -0.12  0.23 -0.41  0.04  0.03  0.04 0.59 0.41 2.3
## Q050 0.43 -0.09  0.18 -0.48  0.15  0.00  0.02 0.48 0.52 2.6
## Q051 0.54 -0.04  0.18 -0.43  0.10 -0.12 -0.11 0.55 0.45 2.5
## Q054 0.53 -0.03  0.22 -0.31  0.02 -0.18 -0.03 0.46 0.54 2.3
## Q055 0.62  0.30 -0.03  0.00 -0.20  0.07 -0.12 0.54 0.46 1.8
## Q057 0.60  0.30  0.00 -0.04 -0.22  0.03 -0.15 0.52 0.48 2.0
## Q058 0.60  0.26 -0.03 -0.08 -0.06  0.02 -0.21 0.48 0.52 1.7
## Q059 0.65  0.39  0.05  0.07 -0.15  0.09 -0.15 0.63 0.37 2.0
## Q060 0.62  0.39 -0.09 -0.22 -0.04 -0.04 -0.14 0.61 0.39 2.1
## Q061 0.59  0.42 -0.09 -0.09 -0.06 -0.12 -0.07 0.56 0.44 2.1
## Q062 0.69  0.28 -0.18  0.08  0.08  0.18 -0.14 0.66 0.34 1.8
## Q063 0.51  0.17 -0.37 -0.12  0.12  0.07 -0.14 0.48 0.52 2.6
## Q064 0.65  0.25 -0.35  0.06  0.19  0.15 -0.12 0.69 0.31 2.4
## Q066 0.61  0.28 -0.26  0.03  0.15  0.19 -0.10 0.58 0.42 2.3
## Q067 0.68  0.27 -0.32 -0.08  0.11  0.16 -0.03 0.69 0.31 2.0
## Q068 0.67  0.29 -0.43 -0.02  0.08  0.06 -0.08 0.73 0.27 2.2
## Q069 0.45  0.11 -0.27 -0.02  0.05  0.13 -0.09 0.31 0.69 2.2
## Q070 0.58  0.17  0.18  0.11 -0.13  0.11  0.08 0.45 0.55 1.7
## Q071 0.67  0.08  0.18  0.04 -0.16  0.09 -0.02 0.52 0.48 1.4
## Q072 0.50  0.29  0.20  0.25 -0.18  0.07  0.09 0.48 0.52 3.1
## Q075 0.65  0.37  0.07  0.00 -0.12 -0.17 -0.07 0.61 0.39 1.9
## Q076 0.66  0.37 -0.02 -0.06  0.03 -0.09 -0.10 0.60 0.40 1.7
## Q077 0.55  0.22  0.15  0.23 -0.06 -0.07  0.03 0.44 0.56 2.0
## Q081 0.44  0.21  0.16  0.24 -0.18  0.17  0.07 0.39 0.61 3.2
## Q083 0.50  0.28  0.31  0.26  0.35  0.05  0.06 0.62 0.38 3.9
## Q084 0.53  0.34  0.23  0.22  0.32  0.01  0.12 0.62 0.38 3.5
## Q085 0.57  0.30  0.32  0.20  0.31  0.01  0.08 0.66 0.34 3.2
## Q086 0.47  0.23  0.31  0.29  0.14  0.10  0.09 0.50 0.50 3.6
## Q087 0.74  0.18 -0.34 -0.05 -0.05  0.02  0.11 0.70 0.30 1.6
## Q088 0.71  0.11 -0.33 -0.10 -0.04 -0.01  0.15 0.67 0.33 1.6
## Q089 0.72  0.17 -0.30  0.02 -0.09  0.05  0.07 0.65 0.35 1.5
## Q090 0.59  0.03 -0.21 -0.07  0.08  0.11  0.17 0.44 0.56 1.6
## Q091 0.72  0.15 -0.37 -0.16  0.00 -0.05  0.15 0.74 0.26 1.8
## Q092 0.72  0.13 -0.27 -0.05 -0.01 -0.05  0.09 0.62 0.38 1.4
## Q093 0.71  0.17 -0.37 -0.15  0.01 -0.09  0.22 0.74 0.26 2.0
## Q094 0.71  0.11 -0.33 -0.21 -0.03 -0.10  0.15 0.70 0.30 1.8
## Q095 0.67  0.08 -0.30 -0.05 -0.05  0.03  0.27 0.62 0.38 1.8
## 
##                         MR1  MR2  MR3  MR4  MR5  MR6  MR7
## SS loadings           28.00 7.53 3.50 2.28 1.01 0.86 0.74
## Proportion Var         0.37 0.10 0.05 0.03 0.01 0.01 0.01
## Cumulative Var         0.37 0.47 0.51 0.54 0.56 0.57 0.58
## Proportion Explained   0.64 0.17 0.08 0.05 0.02 0.02 0.02
## Cumulative Proportion  0.64 0.81 0.89 0.94 0.96 0.98 1.00
## 
## Mean item complexity =  2.1
## Test of the hypothesis that 7 factors are sufficient.
## 
## The degrees of freedom for the null model are  2850  and the objective function was  61.91 with Chi Square of  28161
## The degrees of freedom for the model are 2339  and the objective function was  8.77 
## 
## The root mean square of the residuals (RMSR) is  0.02 
## The df corrected root mean square of the residuals is  0.03 
## 
## The harmonic number of observations is  482 with the empirical chi square  1538  with prob <  1 
## The total number of observations was  482  with Likelihood Chi Square =  3947  with prob <  6.2e-86 
## 
## Tucker Lewis Index of factoring reliability =  0.922
## RMSEA index =  0.038  and the 90 % confidence intervals are  0.036 0.04
## BIC =  -10503
## Fit based upon off diagonal values = 1
## Measures of factor score adequacy             
##                                                    MR1  MR2  MR3  MR4  MR5  MR6
## Correlation of (regression) scores with factors   0.99 0.98 0.95 0.92 0.84 0.82
## Multiple R square of scores with factors          0.99 0.95 0.90 0.84 0.71 0.68
## Minimum correlation of possible factor scores     0.97 0.91 0.80 0.68 0.43 0.36
##                                                    MR7
## Correlation of (regression) scores with factors   0.81
## Multiple R square of scores with factors          0.65
## Minimum correlation of possible factor scores     0.30

3.3 Error Plot of Data for all Items (Questions)

Error plots give an idea of potential misfitting items (questions/statements) per factor (variable.)

# Create mean scores and confidence intervals
library(psych)
error.dots(Creativ, eyes = TRUE, sort = FALSE, main = "Creative Role Identity - CI Around Mean", xlim = c(1, 7), lcolor = "azure2")

error.dots(InnoReady, eyes = TRUE, sort = FALSE, main = "Individual Innovation Readyness - CI Around Mean", xlim = c(1, 7), lcolor = "pink")

error.dots(IRJP, eyes = TRUE, sort = FALSE, main = "In-Role Job Performance - CI Around Mean", xlim = c(1, 7), lcolor = "darkgoldenrod1")

error.dots(PsyCap, eyes = TRUE, sort = FALSE, main = "PsyCap - CI Around Mean", xlim = c(1, 7), lcolor = "lightblue")

error.dots(Support, eyes = TRUE, sort = FALSE, main = "Support for Innovation - CI Around Mean", xlim = c(1, 7), lcolor = "orange")

error.dots(Lead, eyes = TRUE, sort = FALSE, main = "Transformational Leadership - CI Around Mean", xlim = c(1, 7), lcolor = "lightgreen")

error.dots(IWB, eyes = TRUE, sort = FALSE, main = "Individual Innovative Work Behaviour - CI Around Mean", xlim = c(1, 7), lcolor = "cyan")

Support for innovation seems to have a less consistent item structure.

3.4 Cronbach’s Alpha for all Latent Variables

Cronbach’s Alpha is an indicator for scale reliability. Raw alpha is sensitive to differences in the item variances. Standardized alpha is based upon the correlations rather than the covariances. A level of 0.7 and above is acceptable, whereas 0.8 should be achieved in research. When making important data driven decisions, 0.9 marks a minimum. If Guttman’s Lambda 6 (G6) is higher than Alpha, factor shows unequal item loadings.

# Cronbach Alpha
library(psych)
library(data.table)
## 
## Attaching package: 'data.table'
## The following objects are masked from 'package:dplyr':
## 
##     between, first, last
# omega(Creativ, digits = 3)
cAlpha <- psych::alpha(x = Creativ)
## Number of categories should be increased  in order to count frequencies.
alphaDF <- data.table(variable = "Individual Creative Role Identity", id = "ICR", cAlpha$total)

cAlpha <- psych::alpha(x = InnoReady)
## Number of categories should be increased  in order to count frequencies.
alphaDF2 <- data.table(variable = "Individual Innovation Readiness", id = "IIR", cAlpha$total)
alphaDF  <- rbind(alphaDF, alphaDF2)

cAlpha <- psych::alpha(x = IRJP)
alphaDF2 <- data.table(variable = "In-Role Job Performance", id = "IRJP", cAlpha$total)
alphaDF  <- rbind(alphaDF, alphaDF2)

cAlpha <- psych::alpha(x = PsyCap)
## Number of categories should be increased  in order to count frequencies.
alphaDF2 <- data.table(variable = "Psychological Capital", id = "PSY", cAlpha$total)
alphaDF  <- rbind(alphaDF, alphaDF2)

cAlpha <- psych::alpha(x = Support)
## Number of categories should be increased  in order to count frequencies.
alphaDF2 <- data.table(variable = "Support for Innovation", id = "SFI", cAlpha$total)
alphaDF  <- rbind(alphaDF, alphaDF2)

cAlpha <- psych::alpha(x = Lead)
## Number of categories should be increased  in order to count frequencies.
alphaDF2 <- data.table(variable = "Transformational Leadership", id = "TFL", cAlpha$total)
alphaDF  <- rbind(alphaDF, alphaDF2)

cAlpha <- psych::alpha(x = IWB)
## Number of categories should be increased  in order to count frequencies.
alphaDF2 <- data.table(variable = "Individual Innovative Work Behaviour", id = "IWB", cAlpha$total)
alphaDF  <- rbind(alphaDF, alphaDF2)
alphaDF
##                                variable   id raw_alpha std.alpha G6(smc)
## 1:    Individual Creative Role Identity  ICR    0.9286    0.9297  0.9361
## 2:      Individual Innovation Readiness  IIR    0.8526    0.8532  0.8433
## 3:              In-Role Job Performance IRJP    0.8491    0.8526  0.8167
## 4:                Psychological Capital  PSY    0.9054    0.9061  0.9072
## 5:               Support for Innovation  SFI    0.9128    0.9145  0.9179
## 6:          Transformational Leadership  TFL    0.9678    0.9685  0.9714
## 7: Individual Innovative Work Behaviour  IWB    0.9402    0.9403  0.9365
##    average_r    S/N      ase  mean     sd median_r
## 1:    0.5041 13.215 0.004776 4.914 0.8973   0.5020
## 2:    0.4537  5.813 0.010227 5.506 0.7324   0.4487
## 3:    0.5911  5.783 0.011328 5.762 0.7654   0.5911
## 4:    0.4458  9.652 0.006361 5.360 0.7716   0.4469
## 5:    0.4930 10.698 0.005939 4.923 0.9511   0.4698
## 6:    0.6057 30.717 0.002109 5.047 1.0886   0.6360
## 7:    0.6365 15.757 0.004046 4.773 1.0880   0.6556

Individual Creative Role Identity, Support for Innovation and Transformational Leadership show indication of unequal factor loading by items.

4 Overview of Variable Data

4.1 Histograms of all Variables

par(mfrow=c(3, 3))
hist(DFvar$ICR, prob = T, xlim = c(1, 7), col = "azure", xlab= "", ylab="", , cex.lab = 2.5, cex.axis = 2.5, cex.main = 3.0)
hist(DFvar$IIR, prob = T, xlim = c(1, 7), col = "pink", xlab= "", ylab="", , cex.lab = 2.5, cex.axis = 2.5, cex.main = 3.0)
hist(DFvar$IRJ, prob = T, xlim = c(1, 7), col = "yellow", xlab= "", ylab="", , cex.lab = 2.5, cex.axis = 2.5, cex.main = 3.0)
hist(DFvar$PSY, prob = T, xlim = c(1, 7), col = "lightblue", xlab= "", ylab="", , cex.lab = 2.5, cex.axis = 2.5, cex.main = 3.0)
hist(DFvar$SFI, prob = T, xlim = c(1, 7), col = "orange", xlab= "", ylab="", , cex.lab = 2.5, cex.axis = 2.5, cex.main = 3.0)
hist(DFvar$TFL, prob = T, xlim = c(1, 7), col = "lightgreen", xlab= "", ylab="", , cex.lab = 2.5, cex.axis = 2.5, cex.main = 3.0)
hist(DFvar$IWB, prob = T, xlim = c(1, 7), col = "cyan", xlab= "", ylab="", , cex.lab = 2.5, cex.axis = 2.5, cex.main = 3.0)

4.2 Descriptive Statistics of all Variables

library(RcmdrMisc)
numSummary(DFvar[,c("PSY", "TFL", "SFI", "ICR", "IIR", "IRJ", "IWB")], 
           groups = DFvar$Org, 
           statistics = c("mean", "sd", "skewness", "kurtosis", "quantiles"), 
                          quantiles = c(0.0, 0.25, 0.5, 0.75, 1.00))
## 
## Variable: PSY 
##           mean     sd skewness kurtosis    0%   25%   50%   75%  100%   n
## Private1 5.395 0.7982 -0.80944   0.7569 3.250 5.083 5.542 5.896 7.000  90
## Private2 5.693 0.6389 -0.87454   1.1036 3.333 5.333 5.750 6.104 6.750 128
## Private3 5.545 0.6299  0.27186   0.2756 4.167 5.333 5.500 5.750 6.833  29
## Public1  5.516 0.5916 -0.17174   1.3777 3.917 5.250 5.458 5.875 6.833  26
## Public2  4.990 0.6846 -0.08597   0.2481 3.083 4.500 5.000 5.500 7.000 155
## Public3  5.404 0.9571 -1.93557   4.9623 2.000 5.021 5.583 6.000 6.833  54
## 
## Variable: TFL 
##           mean     sd skewness kurtosis   0%   25%   50%  75% 100%   n
## Private1 5.364 1.0871  -1.7026   4.1699 1.00 4.850 5.650 6.00 7.00  90
## Private2 5.002 1.1130  -0.6791   0.2834 1.65 4.375 5.100 5.90 6.90 128
## Private3 5.029 1.0490  -0.3276  -0.7175 2.85 4.050 5.200 5.80 6.90  29
## Public1  5.317 0.9582  -1.9878   5.0109 1.95 5.025 5.600 5.90 6.35  26
## Public2  4.859 1.0458  -0.6597   0.6068 1.95 4.350 5.000 5.55 7.00 155
## Public3  5.044 1.1381  -1.0379   2.3655 1.00 4.513 5.175 5.75 6.90  54
## 
## Variable: SFI 
##           mean     sd skewness kurtosis    0%   25%   50%   75%  100%   n
## Private1 5.107 0.9159  -1.1674   2.2492 1.545 4.750 5.273 5.795 6.545  90
## Private2 5.096 0.9435  -1.4131   2.9715 1.364 4.727 5.273 5.727 6.727 128
## Private3 4.851 0.9306  -0.9161   0.8079 2.500 4.364 5.182 5.455 6.455  29
## Public1  5.287 0.5579  -0.6276   1.3488 3.727 5.091 5.273 5.523 6.182  26
## Public2  4.681 0.8980  -0.6190   0.8620 1.273 4.091 4.727 5.364 7.000 155
## Public3  4.763 1.1513  -0.9790   1.3020 1.000 4.205 5.000 5.545 6.636  54
## 
## Variable: ICR 
##           mean     sd skewness kurtosis    0%   25%   50%   75%  100%   n
## Private1 5.199 0.8605 -0.47540  -0.2484 2.846 4.500 5.346 5.769 7.000  90
## Private2 5.276 0.7548 -0.35706  -0.3440 3.308 4.769 5.346 5.846 6.846 128
## Private3 4.729 0.9577  0.51991   0.3866 2.769 4.154 4.538 5.269 7.000  29
## Public1  4.947 0.8885 -0.61054  -0.4811 3.154 4.481 5.038 5.596 6.308  26
## Public2  4.513 0.8315  0.01644   0.4962 2.077 4.000 4.462 5.077 7.000 155
## Public3  4.812 0.9367 -0.70387   1.1393 2.000 4.231 4.885 5.462 6.538  54
## 
## Variable: IIR 
##           mean     sd  skewness kurtosis    0%   25%   50%   75%  100%   n
## Private1 5.613 0.6857 -0.692813   1.3332 3.143 5.286 5.714 6.000 7.000  90
## Private2 5.765 0.6821 -0.981684   1.8367 3.286 5.429 5.857 6.143 7.000 128
## Private3 5.396 0.5212  0.237384  -0.3181 4.286 5.071 5.400 5.714 6.429  29
## Public1  5.714 0.5525  0.359473  -0.4587 4.857 5.286 5.714 6.107 7.000  26
## Public2  5.183 0.7060 -0.004028  -0.3551 3.571 4.643 5.171 5.643 7.000 155
## Public3  5.601 0.8401 -1.811214   5.7027 2.000 5.179 5.714 6.143 6.857  54
## 
## Variable: IRJ 
##           mean     sd skewness kurtosis   0%   25% 50%   75% 100%   n
## Private1 5.747 0.7749  -0.5938   0.3166 3.50 5.250 6.0 6.188    7  90
## Private2 5.963 0.7044  -0.6636   0.2451 3.75 5.500 6.0 6.500    7 128
## Private3 6.048 0.5968   0.0304  -0.6618 4.75 5.500 6.0 6.500    7  29
## Public1  5.942 0.7947  -0.5974  -0.1182 4.25 5.562 6.0 6.438    7  26
## Public2  5.468 0.7121  -0.2693  -0.3093 3.50 5.000 5.5 6.000    7 155
## Public3  5.917 0.8509  -2.0373   7.7973 2.00 5.500 6.0 6.500    7  54
## 
## Variable: IWB 
##           mean     sd skewness kurtosis    0%   25%   50%   75%  100%   n
## Private1 5.091 1.1254  -0.5235  -0.2731 2.111 4.472 5.111 6.000 7.000  90
## Private2 5.006 0.9753  -0.5676  -0.2870 1.778 4.222 5.167 5.889 6.444 128
## Private3 4.771 1.0767  -0.1944   0.5547 2.333 4.167 4.667 5.500 7.000  29
## Public1  4.731 1.1847  -0.6806  -0.4105 1.889 4.028 5.000 5.750 6.222  26
## Public2  4.453 1.0426  -0.2478   0.1286 1.778 3.889 4.556 5.111 7.000 155
## Public3  4.632 1.1316  -0.7535   1.0568 1.000 3.889 4.833 5.333 6.889  54

5 Plotting Correlation Matrices for all Latent Variables (Pearson)

All items (questions/statements) should be correlated with a p-value < 0.01. ## Correlation Matrix - Individual Creative Role Identity

# Plot Correlation Matrix
library(corrplot)

Mat <- cor(Creativ)
Res <- cor.mtest(Creativ, conf.level = .95)
corrplot.mixed(Mat, lower.col = "black", number.cex = 2.0, upper = "pie", tl.col = "blue", tl.cex = 2.0, p.mat = Res$p, insig = "p-value", cl.ratio = 0.2, cl.align = "r", cl.lim = c(0, 1), cl.cex = 2.0)

## Correlation Matrix - Individual Innovation Readyness

Mat <- cor(InnoReady)
Res <- cor.mtest(InnoReady, conf.level = .95)
corrplot.mixed(Mat, lower.col = "black", number.cex = 2.0, upper = "pie", tl.col = "blue", tl.cex = 2.0, p.mat = Res$p, insig = "p-value", cl.ratio = 0.2, cl.align = "r", cl.lim = c(0, 1), cl.cex = 2.0)

## Correlation Matrix - In-Role Job Performance

Mat <- cor(IRJP)
Res <- cor.mtest(IRJP, conf.level = .95)
corrplot.mixed(Mat, lower.col = "black", number.cex = 2.0, upper = "pie", tl.col = "blue", tl.cex = 2.0, p.mat = Res$p, insig = "p-value", cl.ratio = 0.2, cl.align = "r", cl.lim = c(0, 1), cl.cex = 2.0)

## Correlation Matrix - PsyCap

Mat <- cor(PsyCap)
Res <- cor.mtest(PsyCap, conf.level = .95)
corrplot.mixed(Mat, lower.col = "black", number.cex = 2.0, upper = "pie", tl.col = "blue", tl.cex = 2.0, p.mat = Res$p, insig = "p-value", cl.ratio = 0.2, cl.align = "r", cl.lim = c(0, 1), cl.cex = 2.0)

## Correlation Matrix - Support for Innovation

Mat <- cor(Support)
Res <- cor.mtest(Support, conf.level = .95)
corrplot.mixed(Mat, lower.col = "black", number.cex = 2.0, upper = "pie", tl.col = "blue", tl.cex = 2.0, p.mat = Res$p, insig = "p-value", cl.ratio = 0.2, cl.align = "r", cl.lim = c(0, 1), cl.cex = 2.0)

## Correlation Matrix - Transformational Leadership

Mat <- cor(Lead)
Res <- cor.mtest(Lead, conf.level = .95)
corrplot.mixed(Mat, lower.col = "black", number.cex = 2.0, upper = "pie", tl.col = "blue", tl.cex = 2.0, p.mat = Res$p, insig = "p-value", cl.ratio = 0.2, cl.align = "r", cl.lim = c(0, 1), cl.cex = 2.0)

## Correlation Matrix - Individdual Innovative Work Behaviour

Mat <- cor(IWB)
Res <- cor.mtest(IWB, conf.level = .95)
corrplot.mixed(Mat, lower.col = "black", number.cex = 2.0, upper = "pie", tl.col = "blue", tl.cex = 2.0, p.mat = Res$p, insig = "p-value", cl.ratio = 0.2, cl.align = "r", cl.lim = c(0, 1), cl.cex = 2.0)


5.1 Analysis of Measurement Reproducability using Intraclass Correlation (ICC)

Transformational Leadership

library(irr)
## Loading required package: lpSolve
ICC(Lead)
## Call: ICC(x = Lead)
## 
## Intraclass correlation coefficients 
##                          type  ICC  F df1  df2 p lower bound upper bound
## Single_raters_absolute   ICC1 0.59 30 481 9158 0        0.56        0.62
## Single_random_raters     ICC2 0.59 31 481 9139 0        0.56        0.62
## Single_fixed_raters      ICC3 0.60 31 481 9139 0        0.57        0.63
## Average_raters_absolute ICC1k 0.97 30 481 9158 0        0.96        0.97
## Average_random_raters   ICC2k 0.97 31 481 9139 0        0.96        0.97
## Average_fixed_raters    ICC3k 0.97 31 481 9139 0        0.96        0.97
## 
##  Number of subjects = 482     Number of Judges =  20
## See the help file for a discussion of the other 4 McGraw and Wong estimates,

Support for Innovation

ICC(Support)
## Call: ICC(x = Support)
## 
## Intraclass correlation coefficients 
##                          type  ICC    F df1  df2 p lower bound upper bound
## Single_raters_absolute   ICC1 0.44  9.7 481 4820 0        0.41        0.48
## Single_random_raters     ICC2 0.45 11.5 481 4810 0        0.40        0.49
## Single_fixed_raters      ICC3 0.49 11.5 481 4810 0        0.45        0.52
## Average_raters_absolute ICC1k 0.90  9.7 481 4820 0        0.88        0.91
## Average_random_raters   ICC2k 0.90 11.5 481 4810 0        0.88        0.91
## Average_fixed_raters    ICC3k 0.91 11.5 481 4810 0        0.90        0.92
## 
##  Number of subjects = 482     Number of Judges =  11
## See the help file for a discussion of the other 4 McGraw and Wong estimates,

Individual Innovation Readiness

ICC(InnoReady)
## Call: ICC(x = InnoReady)
## 
## Intraclass correlation coefficients 
##                          type  ICC   F df1  df2        p lower bound
## Single_raters_absolute   ICC1 0.42 6.1 481 2892 2.3e-212        0.38
## Single_random_raters     ICC2 0.42 6.8 481 2886 2.9e-243        0.38
## Single_fixed_raters      ICC3 0.45 6.8 481 2886 2.9e-243        0.41
## Average_raters_absolute ICC1k 0.83 6.1 481 2892 2.3e-212        0.81
## Average_random_raters   ICC2k 0.84 6.8 481 2886 2.9e-243        0.81
## Average_fixed_raters    ICC3k 0.85 6.8 481 2886 2.9e-243        0.83
##                         upper bound
## Single_raters_absolute         0.46
## Single_random_raters           0.47
## Single_fixed_raters            0.49
## Average_raters_absolute        0.86
## Average_random_raters          0.86
## Average_fixed_raters           0.87
## 
##  Number of subjects = 482     Number of Judges =  7
## See the help file for a discussion of the other 4 McGraw and Wong estimates,

Individual Innovative Work Behaviour

ICC(IWB)
## Call: ICC(x = IWB)
## 
## Intraclass correlation coefficients 
##                          type  ICC  F df1  df2 p lower bound upper bound
## Single_raters_absolute   ICC1 0.63 16 481 3856 0        0.59        0.66
## Single_random_raters     ICC2 0.63 17 481 3848 0        0.59        0.66
## Single_fixed_raters      ICC3 0.64 17 481 3848 0        0.60        0.67
## Average_raters_absolute ICC1k 0.94 16 481 3856 0        0.93        0.95
## Average_random_raters   ICC2k 0.94 17 481 3848 0        0.93        0.95
## Average_fixed_raters    ICC3k 0.94 17 481 3848 0        0.93        0.95
## 
##  Number of subjects = 482     Number of Judges =  9
## See the help file for a discussion of the other 4 McGraw and Wong estimates,

Intraclass correlation is evaluated against the following thresholds (Koo and Li, 2016): * below 0.50: poor * between 0.50 and 0.75: moderate * between 0.75 and 0.90: good * above 0.90: excellent

6 Building Linear Regression Model with all Factors

Variance Inflation Factors (VIF) have been studied.

lmModel <- lm(IWB ~ ICR + IIR + IRJ + PSY + SFI + TFL, data = DFvar)
# Check variance inflation factors
library(car)
vif <- (vif(lmModel))
vif
##   ICR   IIR   IRJ   PSY   SFI   TFL 
## 2.513 3.724 2.190 4.447 1.929 1.609

All VIF are found to be lower than 5, i.e. this model is not inflated. It is ok.

IIR and SFI are removed step by step.

# TFI on IWB
summary(lmModel)
## 
## Call:
## lm(formula = IWB ~ ICR + IIR + IRJ + PSY + SFI + TFL, data = DFvar)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.9692 -0.2752  0.0537  0.3222  1.7225 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -0.65526    0.20942   -3.13   0.0019 ** 
## ICR          0.83829    0.04384   19.12   <2e-16 ***
## IIR          0.00961    0.06539    0.15   0.8832    
## IRJ         -0.14944    0.04798   -3.11   0.0020 ** 
## PSY          0.14326    0.06782    2.11   0.0352 *  
## SFI          0.01273    0.03624    0.35   0.7255    
## TFL          0.25501    0.02891    8.82   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.544 on 475 degrees of freedom
## Multiple R-squared:  0.753,  Adjusted R-squared:  0.75 
## F-statistic:  241 on 6 and 475 DF,  p-value: <2e-16
# Remove IIR due to insignificance
lmModel <- lm(IWB ~ ICR + IRJ + PSY + SFI + TFL, data = DFvar)
summary(lmModel)
## 
## Call:
## lm(formula = IWB ~ ICR + IRJ + PSY + SFI + TFL, data = DFvar)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.9677 -0.2744  0.0511  0.3201  1.7275 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -0.6470     0.2016   -3.21   0.0014 ** 
## ICR           0.8403     0.0416   20.22   <2e-16 ***
## IRJ          -0.1479     0.0468   -3.16   0.0017 ** 
## PSY           0.1475     0.0612    2.41   0.0163 *  
## SFI           0.0131     0.0361    0.36   0.7174    
## TFL           0.2552     0.0288    8.85   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.544 on 476 degrees of freedom
## Multiple R-squared:  0.753,  Adjusted R-squared:  0.75 
## F-statistic:  290 on 5 and 476 DF,  p-value: <2e-16
# Remove SFI due to insignificance
lmModel <- lm(IWB ~ ICR + IRJ + PSY + TFL, data = DFvar)
summary(lmModel)
## 
## Call:
## lm(formula = IWB ~ ICR + IRJ + PSY + TFL, data = DFvar)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.9727 -0.2768  0.0481  0.3214  1.6920 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -0.6426     0.2011   -3.20   0.0015 ** 
## ICR           0.8407     0.0415   20.25   <2e-16 ***
## IRJ          -0.1472     0.0467   -3.15   0.0017 ** 
## PSY           0.1532     0.0591    2.59   0.0098 ** 
## TFL           0.2599     0.0258   10.07   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.543 on 477 degrees of freedom
## Multiple R-squared:  0.753,  Adjusted R-squared:  0.751 
## F-statistic:  363 on 4 and 477 DF,  p-value: <2e-16
# Remove SFI due to insignificance
lmModel <- lm(IWB ~ IIR + SFI + TFL, data = DFvar)
summary(lmModel)
## 
## Call:
## lm(formula = IWB ~ IIR + SFI + TFL, data = DFvar)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -2.533 -0.423  0.103  0.509  2.653 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -1.0673     0.2664   -4.01  7.1e-05 ***
## IIR           0.6854     0.0567   12.10  < 2e-16 ***
## SFI           0.0770     0.0486    1.58     0.11    
## TFL           0.3345     0.0396    8.44  3.7e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.753 on 478 degrees of freedom
## Multiple R-squared:  0.524,  Adjusted R-squared:  0.521 
## F-statistic:  176 on 3 and 478 DF,  p-value: <2e-16
# Prepare PDF
# pdf("Model01.pdf", width = 25, height = 16)
par(mar=c(7, 1, 7, 1))
par(oma=c(1, 1, 1, 1))

# Plot model
library(semPlot)
semPaths(lmModel, intAtSide = FALSE, what = "stand", whatLabels = "stand", intercepts = FALSE, residuals = FALSE, edge.label.cex = 0.9, edge.color = "blue", layout = "tree", rotation = 2, curve = 1, curvePivot = TRUE, mar = c(3,2,7,2), sizeLat = 10, sizeMan = 10, color = colorlist)
title(main = "Model of ICR, IRJ, PSY, TFL Influencing IWB - Model 01\nIIR and SFI are not significant", cex.main = 2.5, col.main = "darkblue", font.main = 3, cex.sub = 1.4)

# # dev.off()

Strongest driver seems to be Individual Creative Role Identity. In the following, the impact of TFI on IWB under different models with SFI and IIR are studied.

6.1 Group Variables “Sector” and “Org” are Tested as Moderators

# Add Sector as Moderator
lmModel <- lm(IWB ~ ICR + IRJ + PSY + TFL + Sector, data = DFvar)
summary(lmModel)
## 
## Call:
## lm(formula = IWB ~ ICR + IRJ + PSY + TFL + Sector, data = DFvar)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.9403 -0.2805  0.0503  0.3278  1.6949 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           -0.7251     0.2133   -3.40  0.00073 ***
## ICR                    0.8492     0.0421   20.15  < 2e-16 ***
## IRJ                   -0.1491     0.0467   -3.19  0.00150 ** 
## PSY                    0.1595     0.0593    2.69  0.00739 ** 
## TFL                    0.2577     0.0259    9.96  < 2e-16 ***
## SectorPublic Service   0.0605     0.0523    1.16  0.24825    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.543 on 476 degrees of freedom
## Multiple R-squared:  0.754,  Adjusted R-squared:  0.751 
## F-statistic:  291 on 5 and 476 DF,  p-value: <2e-16
# Add Org as Moderator
lmModel <- lm(IWB ~ ICR + IRJ + PSY + TFL + Org, data = DFvar)
summary(lmModel)
## 
## Call:
## lm(formula = IWB ~ ICR + IRJ + PSY + TFL + Org, data = DFvar)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1.8687 -0.2697  0.0522  0.3348  1.6292 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -0.8199     0.2185   -3.75   0.0002 ***
## ICR           0.8629     0.0427   20.19   <2e-16 ***
## IRJ          -0.1505     0.0467   -3.22   0.0014 ** 
## PSY           0.1730     0.0600    2.88   0.0041 ** 
## TFL           0.2529     0.0261    9.68   <2e-16 ***
## OrgPrivate2  -0.0789     0.0764   -1.03   0.3024    
## OrgPrivate3   0.1895     0.1185    1.60   0.1106    
## OrgPublic1   -0.1225     0.1211   -1.01   0.3124    
## OrgPublic2    0.1095     0.0743    1.47   0.1414    
## OrgPublic3   -0.0206     0.0948   -0.22   0.8283    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.539 on 472 degrees of freedom
## Multiple R-squared:  0.759,  Adjusted R-squared:  0.755 
## F-statistic:  165 on 9 and 472 DF,  p-value: <2e-16

Both, Sector and Org do not have significant moderating effect on the multiple linear model.


7 Confirmatory Factor Analysis (CFA) with Different Models

7.1 How to Evaluate CFA Output?

Chisq: The model Chi-squared assesses overall fit and the discrepancy between the sample and fitted covariance matrices. Its p-value should be > .05 (i.e., the hypothesis of a perfect fit cannot be rejected). However, it is quite sensitive to sample size. Commonly, Chisq/DF < 3 is used as criteria.

GFI/AGFI: The (Adjusted) Goodness of Fit is the proportion of variance accounted for by the estimated population covariance. Analogous to R2. The GFI and the AGFI should be > .95 and > .90, respectively.

NFI/NNFI/TLI: The (Non) Normed Fit Index. An NFI of 0.95, indicates the model of interest improves the fit by 95% relative to the null model. The NNFI (also called the Tucker Lewis index; TLI) is preferable for smaller samples. They should be > .90 (Byrne, 1994) or > .95 (Schumacker & Lomax, 2004). TLI > .90. TLI: < .85(poor); .85-.90 (mediocre); .90-.95 (acceptable); .95-.99 (close); 1.00 (perfect)

CFI: The Comparative Fit Index is a revised form of NFI. Not very sensitive to sample size (Fan, Thompson, & Wang, 1999). Compares the fit of a target model to the fit of an independent, or null, model. CFI: < .85(poor); .85-.90 (mediocre); .90-.95 (acceptable); .95-.99 (close); 1.00 (perfect)

RMSEA: The Root Mean Square Error of Approximation is a parsimony-adjusted index. Values closer to 0 represent a good fit. It should be < .08 or < .05. The p-value printed with it tests the hypothesis that RMSEA is less than or equal to .05 (a cutoff sometimes used for good fit), and thus should be not significant. RMSEA: > .10 (poor); .08-.10 (mediocre); .05-.08 (acceptable); .01-.05 (close); .00 (perfect)

RMR/SRMR: the (Standardized) Root Mean Square Residual represents the square-root of the difference between the residuals of the sample covariance matrix and the hypothesized model. As the RMR can be sometimes hard to interpret, better to use SRMR. SRMR: > .10 (poor); .08-.10 (mediocre); .05-.08 (acceptable); .01-.05 (close); .00 (perfect)

RFI: the Relative Fit Index, also known as RHO1, is not guaranteed to vary from 0 to 1. However, RFI close to 1 indicates a good fit.

IFI: the Incremental Fit Index (IFI) adjusts the Normed Fit Index (NFI) for sample size and degrees of freedom (Bollen’s, 1989). Over 0.90 is a good fit, but the index can exceed 1.

PNFI: the Parsimony-Adjusted Measures Index. There is no commonly agreed-upon cutoff value for an acceptable model for this index. Should be > 0.50.

To Report: chi-square, RMSEA, CFI, RMSEA and SRMR.


7.2 Model 11: Direct effect only

# Building model for linear regression
library(lavaan)
## This is lavaan 0.6-12
## lavaan is FREE software! Please report any bugs.
## 
## Attaching package: 'lavaan'
## The following object is masked from 'package:psych':
## 
##     cor2cov
model11 <- '

# latent variables
 TFL =~ Q013 + Q014 + Q015 + Q016 + Q017 + Q018 + Q019 + Q020 + Q021 + Q022 + Q023 + Q024 + Q025 + Q026 +           Q027 + Q028 + Q029 + Q030 + Q031 + Q032
 IWB =~ Q087 + Q088 + Q089 + Q090 + Q091 + Q092 + Q093 + Q094 + Q095
 
# direct effect
 IWB ~ a * TFL
 DirEff := a
 TotEff := a

'

# Calculate fit
fit11 <- sem(model11, data = DFs)

# Print results (fit indices, parameters, hypothesis tests)
summary(fit11, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6-12 ended normally after 33 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        59
## 
##   Number of observations                           482
## 
## Model Test User Model:
##                                                       
##   Test statistic                              1040.564
##   Degrees of freedom                               376
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                             12232.254
##   Degrees of freedom                               406
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.944
##   Tucker-Lewis Index (TLI)                       0.939
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -18516.795
##   Loglikelihood unrestricted model (H1)     -17996.513
##                                                       
##   Akaike (AIC)                               37151.589
##   Bayesian (BIC)                             37398.088
##   Sample-size adjusted Bayesian (BIC)        37210.827
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.061
##   90 Percent confidence interval - lower         0.056
##   90 Percent confidence interval - upper         0.065
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.044
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   TFL =~                                              
##     Q013              1.000                           
##     Q014              0.903    0.048   18.823    0.000
##     Q015              0.939    0.044   21.270    0.000
##     Q016              0.858    0.045   19.226    0.000
##     Q017              0.989    0.049   20.076    0.000
##     Q018              0.976    0.045   21.763    0.000
##     Q019              0.842    0.043   19.539    0.000
##     Q020              0.957    0.046   20.971    0.000
##     Q021              0.952    0.044   21.412    0.000
##     Q022              0.918    0.043   21.115    0.000
##     Q023              1.006    0.046   21.952    0.000
##     Q024              0.931    0.041   22.774    0.000
##     Q025              0.843    0.045   18.897    0.000
##     Q026              0.914    0.045   20.468    0.000
##     Q027              0.937    0.045   20.702    0.000
##     Q028              0.941    0.044   21.380    0.000
##     Q029              1.002    0.053   18.814    0.000
##     Q030              0.542    0.057    9.497    0.000
##     Q031              0.744    0.048   15.399    0.000
##     Q032              1.040    0.047   22.254    0.000
##   IWB =~                                              
##     Q087              1.000                           
##     Q088              1.043    0.047   22.228    0.000
##     Q089              0.933    0.044   21.123    0.000
##     Q090              0.776    0.049   15.669    0.000
##     Q091              1.089    0.045   24.408    0.000
##     Q092              0.919    0.043   21.153    0.000
##     Q093              1.086    0.045   24.095    0.000
##     Q094              1.104    0.050   22.224    0.000
##     Q095              0.939    0.046   20.516    0.000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB ~                                               
##     TFL        (a)    0.530    0.043   12.413    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .Q013              0.770    0.052   14.753    0.000
##    .Q014              0.856    0.057   14.959    0.000
##    .Q015              0.577    0.039   14.617    0.000
##    .Q016              0.717    0.048   14.916    0.000
##    .Q017              0.811    0.055   14.809    0.000
##    .Q018              0.562    0.039   14.519    0.000
##    .Q019              0.651    0.044   14.879    0.000
##    .Q020              0.637    0.043   14.671    0.000
##    .Q021              0.576    0.040   14.590    0.000
##    .Q022              0.569    0.039   14.646    0.000
##    .Q023              0.574    0.040   14.477    0.000
##    .Q024              0.408    0.029   14.266    0.000
##    .Q025              0.736    0.049   14.952    0.000
##    .Q026              0.642    0.044   14.752    0.000
##    .Q027              0.645    0.044   14.716    0.000
##    .Q028              0.566    0.039   14.597    0.000
##    .Q029              1.055    0.071   14.960    0.000
##    .Q030              1.875    0.122   15.431    0.000
##    .Q031              1.079    0.071   15.220    0.000
##    .Q032              0.573    0.040   14.406    0.000
##    .Q087              0.462    0.035   13.382    0.000
##    .Q088              0.626    0.045   13.808    0.000
##    .Q089              0.600    0.043   14.092    0.000
##    .Q090              0.990    0.066   14.927    0.000
##    .Q091              0.468    0.036   13.012    0.000
##    .Q092              0.580    0.041   14.086    0.000
##    .Q093              0.492    0.037   13.152    0.000
##    .Q094              0.702    0.051   13.809    0.000
##    .Q095              0.670    0.047   14.226    0.000
##     TFL               1.378    0.130   10.586    0.000
##    .IWB               0.755    0.068   11.087    0.000
## 
## R-Square:
##                    Estimate
##     Q013              0.642
##     Q014              0.568
##     Q015              0.678
##     Q016              0.586
##     Q017              0.624
##     Q018              0.700
##     Q019              0.600
##     Q020              0.665
##     Q021              0.684
##     Q022              0.671
##     Q023              0.708
##     Q024              0.745
##     Q025              0.571
##     Q026              0.642
##     Q027              0.653
##     Q028              0.683
##     Q029              0.567
##     Q030              0.177
##     Q031              0.414
##     Q032              0.722
##     Q087              0.712
##     Q088              0.665
##     Q089              0.624
##     Q090              0.410
##     Q091              0.743
##     Q092              0.625
##     Q093              0.732
##     Q094              0.665
##     Q095              0.600
##     IWB               0.339
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)
##     DirEff            0.530    0.043   12.413    0.000
##     TotEff            0.530    0.043   12.413    0.000
modInd <- modificationIndices(fit11, minimum.value = 10)
# head(modInd[order(modInd$mi, decreasing=TRUE), ], 10)
subset(modInd[order(modInd$mi, decreasing=TRUE), ], mi > 5)
##      lhs op  rhs    mi    epc sepc.lv sepc.all sepc.nox
## 91   IWB =~ Q031 53.41  0.422   0.451    0.332    0.332
## 423 Q029 ~~ Q032 45.83  0.255   0.255    0.328    0.328
## 105 Q013 ~~ Q026 23.26 -0.163  -0.163   -0.232   -0.232
## 224 Q018 ~~ Q020 22.90  0.140   0.140    0.233    0.233
## 290 Q021 ~~ Q023 21.90  0.132   0.132    0.229    0.229
## 276 Q020 ~~ Q029 20.34 -0.177  -0.177   -0.216   -0.216
## 111 Q013 ~~ Q032 19.01  0.141   0.141    0.213    0.213
## 106 Q013 ~~ Q027 18.80 -0.147  -0.147   -0.209   -0.209
## 261 Q019 ~~ Q089 17.61  0.128   0.128    0.204    0.204
## 221 Q017 ~~ Q094 17.47  0.155   0.155    0.206    0.206
## 141 Q014 ~~ Q089 15.47  0.137   0.137    0.191    0.191
## 94  Q013 ~~ Q015 15.03  0.125   0.125    0.188    0.188
## 255 Q019 ~~ Q029 14.41 -0.149  -0.149   -0.180   -0.180
## 433 Q030 ~~ Q031 13.91  0.245   0.245    0.172    0.172
## 258 Q019 ~~ Q032 13.86 -0.110  -0.110   -0.181   -0.181
## 125 Q014 ~~ Q019 13.71  0.131   0.131    0.176    0.176
## 456 Q032 ~~ Q089 13.58 -0.107  -0.107   -0.182   -0.182
## 254 Q019 ~~ Q028 13.56 -0.108  -0.108   -0.177   -0.177
## 259 Q019 ~~ Q087 13.55  0.101   0.101    0.183    0.183
## 379 Q026 ~~ Q027 12.74  0.111   0.111    0.172    0.172
## 391 Q026 ~~ Q093 12.29 -0.099  -0.099   -0.177   -0.177
## 471 Q088 ~~ Q089 12.09 -0.110  -0.110   -0.180   -0.180
## 121 Q014 ~~ Q015 11.60  0.115   0.115    0.163    0.163
## 108 Q013 ~~ Q029 11.45  0.146   0.146    0.162    0.162
## 164 Q015 ~~ Q032 11.24  0.095   0.095    0.165    0.165
## 429 Q029 ~~ Q092 11.01 -0.126  -0.126   -0.161   -0.161
## 212 Q017 ~~ Q031 10.71  0.144   0.144    0.154    0.154
## 75   IWB =~ Q015 10.13 -0.137  -0.147   -0.110   -0.110

Composite Reliability must be > 0.7

# Composite reliability
sl <- standardizedSolution(fit11)
sl <- sl$est.std[sl$op == "=~"]
re <- 1 - sl^2

cat(paste("Composite Reliability of Model is: ", round(sum(sl)^2 / (sum(sl)^2 + sum(re)), 5), "\n", sep = " ", collapse = NULL))
## Composite Reliability of Model is:  0.97934

7.3 Model 12: Direct effect with Covariances

# Amending model 
model12 <- '

# latent variables
 TFL =~ Q013 + Q014 + Q016 + Q017 + Q018 + Q019 + Q020 + Q021 + Q022 + Q023 + Q024 + Q025 + Q026 + Q027 + Q028 + Q029 + Q030 + Q032
 IWB =~ Q087 + Q088 + Q089 + Q090 + Q091 + Q092 + Q093 + Q094 + Q095
 
# direct effect
 IWB ~ b * TFL
 DirEff := b
 TotEff := b

 
# covariances
 Q013 ~~ Q026
 Q013 ~~ Q027
 Q013 ~~ Q028
 Q013 ~~ Q032
 Q018 ~~ Q020
 Q018 ~~ Q029
 Q020 ~~ Q029
 Q021 ~~ Q023
 Q029 ~~ Q032
'

# Calculate fit
fit12 <- sem(model12, data = DFs)

# Print results (fit indices, parameters, hypothesis tests)
summary(fit12, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6-12 ended normally after 37 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        64
## 
##   Number of observations                           482
## 
## Model Test User Model:
##                                                       
##   Test statistic                               699.086
##   Degrees of freedom                               314
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                             11289.321
##   Degrees of freedom                               351
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.965
##   Tucker-Lewis Index (TLI)                       0.961
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -17161.883
##   Loglikelihood unrestricted model (H1)     -16812.339
##                                                       
##   Akaike (AIC)                               34451.765
##   Bayesian (BIC)                             34719.154
##   Sample-size adjusted Bayesian (BIC)        34516.023
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.050
##   90 Percent confidence interval - lower         0.045
##   90 Percent confidence interval - upper         0.055
##   P-value RMSEA <= 0.05                          0.435
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.035
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   TFL =~                                              
##     Q013              1.000                           
##     Q014              0.899    0.048   18.757    0.000
##     Q016              0.855    0.045   19.201    0.000
##     Q017              0.984    0.049   20.008    0.000
##     Q018              0.971    0.045   21.658    0.000
##     Q019              0.839    0.043   19.495    0.000
##     Q020              0.953    0.046   20.892    0.000
##     Q021              0.947    0.044   21.284    0.000
##     Q022              0.920    0.043   21.237    0.000
##     Q023              1.003    0.046   21.919    0.000
##     Q024              0.928    0.041   22.774    0.000
##     Q025              0.843    0.045   18.928    0.000
##     Q026              0.926    0.049   19.090    0.000
##     Q027              0.943    0.049   19.251    0.000
##     Q028              0.944    0.046   20.632    0.000
##     Q029              0.993    0.053   18.599    0.000
##     Q030              0.540    0.057    9.478    0.000
##     Q032              1.022    0.043   23.916    0.000
##   IWB =~                                              
##     Q087              1.000                           
##     Q088              1.043    0.047   22.229    0.000
##     Q089              0.933    0.044   21.118    0.000
##     Q090              0.776    0.050   15.671    0.000
##     Q091              1.089    0.045   24.404    0.000
##     Q092              0.919    0.043   21.151    0.000
##     Q093              1.086    0.045   24.092    0.000
##     Q094              1.104    0.050   22.222    0.000
##     Q095              0.939    0.046   20.522    0.000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB ~                                               
##     TFL        (b)    0.527    0.043   12.362    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .Q013 ~~                                             
##    .Q026             -0.137    0.033   -4.190    0.000
##    .Q027             -0.127    0.033   -3.834    0.000
##    .Q028             -0.061    0.031   -1.966    0.049
##    .Q032              0.113    0.033    3.461    0.001
##  .Q018 ~~                                             
##    .Q020              0.129    0.031    4.214    0.000
##    .Q029              0.079    0.036    2.180    0.029
##  .Q020 ~~                                             
##    .Q029             -0.138    0.038   -3.611    0.000
##  .Q021 ~~                                             
##    .Q023              0.121    0.030    4.100    0.000
##  .Q029 ~~                                             
##    .Q032              0.236    0.039    5.979    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .Q013              0.753    0.053   14.312    0.000
##    .Q014              0.863    0.058   14.911    0.000
##    .Q016              0.719    0.048   14.859    0.000
##    .Q017              0.819    0.056   14.749    0.000
##    .Q018              0.571    0.040   14.369    0.000
##    .Q019              0.655    0.044   14.821    0.000
##    .Q020              0.643    0.044   14.526    0.000
##    .Q021              0.587    0.041   14.470    0.000
##    .Q022              0.561    0.039   14.535    0.000
##    .Q023              0.577    0.040   14.331    0.000
##    .Q024              0.410    0.029   14.142    0.000
##    .Q025              0.734    0.049   14.891    0.000
##    .Q026              0.608    0.042   14.484    0.000
##    .Q027              0.628    0.043   14.480    0.000
##    .Q028              0.554    0.039   14.337    0.000
##    .Q029              1.077    0.072   14.905    0.000
##    .Q030              1.876    0.122   15.423    0.000
##    .Q032              0.610    0.043   14.349    0.000
##    .Q087              0.462    0.035   13.381    0.000
##    .Q088              0.626    0.045   13.806    0.000
##    .Q089              0.601    0.043   14.093    0.000
##    .Q090              0.990    0.066   14.926    0.000
##    .Q091              0.468    0.036   13.012    0.000
##    .Q092              0.580    0.041   14.085    0.000
##    .Q093              0.492    0.037   13.151    0.000
##    .Q094              0.702    0.051   13.808    0.000
##    .Q095              0.669    0.047   14.224    0.000
##     TFL               1.382    0.130   10.610    0.000
##    .IWB               0.758    0.068   11.080    0.000
## 
## R-Square:
##                    Estimate
##     Q013              0.648
##     Q014              0.564
##     Q016              0.584
##     Q017              0.621
##     Q018              0.695
##     Q019              0.598
##     Q020              0.661
##     Q021              0.679
##     Q022              0.676
##     Q023              0.707
##     Q024              0.744
##     Q025              0.572
##     Q026              0.661
##     Q027              0.662
##     Q028              0.690
##     Q029              0.559
##     Q030              0.177
##     Q032              0.703
##     Q087              0.712
##     Q088              0.665
##     Q089              0.623
##     Q090              0.410
##     Q091              0.743
##     Q092              0.625
##     Q093              0.732
##     Q094              0.665
##     Q095              0.601
##     IWB               0.337
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)
##     DirEff            0.527    0.043   12.362    0.000
##     TotEff            0.527    0.043   12.362    0.000
modInd <- modificationIndices(fit12, minimum.value = 10)
# head(modInd[order(modInd$mi, decreasing=TRUE), ], 10)
subset(modInd[order(modInd$mi, decreasing=TRUE), ], mi > 5)
##      lhs op  rhs    mi    epc sepc.lv sepc.all sepc.nox
## 224 Q019 ~~ Q089 18.29  0.131   0.131    0.208    0.208
## 188 Q017 ~~ Q094 17.63  0.157   0.157    0.207    0.207
## 218 Q019 ~~ Q028 17.23 -0.122  -0.122   -0.203   -0.203
## 136 Q014 ~~ Q089 16.05  0.140   0.140    0.195    0.195
## 121 Q014 ~~ Q019 14.81  0.138   0.138    0.184    0.184
## 222 Q019 ~~ Q087 13.79  0.102   0.102    0.185    0.185
## 107 Q013 ~~ Q029 13.35  0.159   0.159    0.177    0.177
## 410 Q088 ~~ Q089 12.07 -0.110  -0.110   -0.180   -0.180
## 379 Q029 ~~ Q092 11.26 -0.119  -0.119   -0.151   -0.151
## 312 Q024 ~~ Q089 10.29  0.079   0.079    0.160    0.160
## 81   IWB =~ Q017 10.25  0.163   0.175    0.119    0.119
## 345 Q026 ~~ Q093 10.16 -0.088  -0.088   -0.161   -0.161
# Show model performance
# library(performance)
# model_performance(fit12, metrics = "all", verbose = TRUE)

7.4 Model 13: Direct effect with Covariances and Estimation Method DWLS

Commonly used estimation method Maximum Likelihood (ML) has been developed for continuous data following the normal-theory. This method is used to estimate all fit indices like RMSEA, CFI, and TLI. Since our data is generated using a 7-point Likert Scale, i.e. resulting in ordered discrete/categorical data, this method may not be the best to determine model fit (Yan Xia & Yanyun Yang, 2018).Therefore, methods based on Unweighted Least Squares (ULS) and Diagonally Weighted Least Squares (DWLS) based on polychoric correlation matrices have been considered in previous studies.

# Amending model 
model13 <- '

# latent variables
 TFL =~ Q013 + Q014 + Q016 + Q017 + Q018 + Q019 + Q020 + Q021 + Q022 + Q023 + Q024 + Q025 + Q026 + Q027 + Q028 + Q029 + Q030 + Q032
 IWB =~ Q087 + Q088 + Q089 + Q090 + Q091 + Q092 + Q093 + Q094 + Q095
 
# direct effect
 IWB ~ b * TFL
 DirEff := b
 TotEff := b

 
# covariances
 Q013 ~~ Q026
 Q013 ~~ Q027
 Q013 ~~ Q028
 Q013 ~~ Q032
 Q018 ~~ Q020
 Q018 ~~ Q029
 Q020 ~~ Q029
 Q021 ~~ Q023
 Q029 ~~ Q032
'

# Calculate fit
fit13 <- sem(model13, data = DFs, estimator = "WLSMV")

# Print results (fit indices, parameters, hypothesis tests)
summary(fit13, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6-12 ended normally after 55 iterations
## 
##   Estimator                                       DWLS
##   Optimization method                           NLMINB
##   Number of model parameters                        64
## 
##   Number of observations                           482
## 
## Model Test User Model:
##                                               Standard      Robust
##   Test Statistic                               119.906     408.982
##   Degrees of freedom                               314         314
##   P-value (Chi-square)                           1.000       0.000
##   Scaling correction factor                                  0.544
##   Shift parameter                                          188.558
##     simple second-order correction                                
## 
## Model Test Baseline Model:
## 
##   Test statistic                             27290.560    3428.274
##   Degrees of freedom                               351         351
##   P-value                                        0.000       0.000
##   Scaling correction factor                                  8.754
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    1.000       0.969
##   Tucker-Lewis Index (TLI)                       1.008       0.965
##                                                                   
##   Robust Comparative Fit Index (CFI)                            NA
##   Robust Tucker-Lewis Index (TLI)                               NA
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.000       0.025
##   90 Percent confidence interval - lower         0.000       0.018
##   90 Percent confidence interval - upper         0.000       0.032
##   P-value RMSEA <= 0.05                          1.000       1.000
##                                                                   
##   Robust RMSEA                                                  NA
##   90 Percent confidence interval - lower                        NA
##   90 Percent confidence interval - upper                        NA
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.032       0.032
## 
## Parameter Estimates:
## 
##   Standard errors                           Robust.sem
##   Information                                 Expected
##   Information saturated (h1) model        Unstructured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   TFL =~                                              
##     Q013              1.000                           
##     Q014              0.867    0.047   18.269    0.000
##     Q016              0.831    0.044   18.763    0.000
##     Q017              0.994    0.039   25.206    0.000
##     Q018              0.962    0.039   24.720    0.000
##     Q019              0.812    0.046   17.509    0.000
##     Q020              0.946    0.042   22.719    0.000
##     Q021              0.927    0.042   22.066    0.000
##     Q022              0.894    0.050   18.006    0.000
##     Q023              0.978    0.036   27.301    0.000
##     Q024              0.918    0.038   23.904    0.000
##     Q025              0.818    0.045   18.185    0.000
##     Q026              0.886    0.045   19.868    0.000
##     Q027              0.921    0.045   20.384    0.000
##     Q028              0.936    0.041   22.579    0.000
##     Q029              0.955    0.042   22.989    0.000
##     Q030              0.561    0.060    9.395    0.000
##     Q032              0.999    0.037   27.136    0.000
##   IWB =~                                              
##     Q087              1.000                           
##     Q088              1.088    0.081   13.445    0.000
##     Q089              0.963    0.056   17.273    0.000
##     Q090              0.855    0.074   11.583    0.000
##     Q091              1.084    0.066   16.380    0.000
##     Q092              0.966    0.053   18.121    0.000
##     Q093              1.060    0.050   21.025    0.000
##     Q094              1.137    0.057   19.897    0.000
##     Q095              0.990    0.065   15.251    0.000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB ~                                               
##     TFL        (b)    0.513    0.052    9.902    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .Q013 ~~                                             
##    .Q026             -0.158    0.046   -3.430    0.001
##    .Q027             -0.162    0.040   -4.045    0.000
##    .Q028             -0.116    0.044   -2.657    0.008
##    .Q032              0.122    0.056    2.186    0.029
##  .Q018 ~~                                             
##    .Q020              0.103    0.047    2.181    0.029
##    .Q029              0.079    0.051    1.554    0.120
##  .Q020 ~~                                             
##    .Q029             -0.136    0.050   -2.701    0.007
##  .Q021 ~~                                             
##    .Q023              0.133    0.046    2.886    0.004
##  .Q029 ~~                                             
##    .Q032              0.292    0.060    4.844    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .Q013              0.714    0.088    8.102    0.000
##    .Q014              0.904    0.134    6.726    0.000
##    .Q016              0.741    0.077    9.628    0.000
##    .Q017              0.742    0.073   10.112    0.000
##    .Q018              0.547    0.057    9.555    0.000
##    .Q019              0.681    0.059   11.511    0.000
##    .Q020              0.617    0.059   10.502    0.000
##    .Q021              0.595    0.060    9.876    0.000
##    .Q022              0.584    0.081    7.243    0.000
##    .Q023              0.597    0.055   10.901    0.000
##    .Q024              0.393    0.041    9.620    0.000
##    .Q025              0.758    0.100    7.620    0.000
##    .Q026              0.669    0.083    8.036    0.000
##    .Q027              0.639    0.095    6.721    0.000
##    .Q028              0.530    0.046   11.546    0.000
##    .Q029              1.130    0.097   11.707    0.000
##    .Q030              1.832    0.163   11.270    0.000
##    .Q032              0.632    0.065    9.679    0.000
##    .Q087              0.525    0.062    8.457    0.000
##    .Q088              0.591    0.112    5.267    0.000
##    .Q089              0.593    0.073    8.178    0.000
##    .Q090              0.889    0.109    8.156    0.000
##    .Q091              0.554    0.084    6.581    0.000
##    .Q092              0.538    0.074    7.284    0.000
##    .Q093              0.624    0.066    9.456    0.000
##    .Q094              0.700    0.089    7.867    0.000
##    .Q095              0.619    0.082    7.577    0.000
##     TFL               1.438    0.130   11.073    0.000
##    .IWB               0.704    0.089    7.894    0.000
## 
## R-Square:
##                    Estimate
##     Q013              0.668
##     Q014              0.544
##     Q016              0.573
##     Q017              0.657
##     Q018              0.709
##     Q019              0.582
##     Q020              0.676
##     Q021              0.675
##     Q022              0.663
##     Q023              0.697
##     Q024              0.755
##     Q025              0.559
##     Q026              0.628
##     Q027              0.656
##     Q028              0.704
##     Q029              0.537
##     Q030              0.198
##     Q032              0.694
##     Q087              0.673
##     Q088              0.684
##     Q089              0.629
##     Q090              0.471
##     Q091              0.696
##     Q092              0.652
##     Q093              0.661
##     Q094              0.666
##     Q095              0.631
##     IWB               0.350
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)
##     DirEff            0.513    0.052    9.902    0.000
##     TotEff            0.513    0.052    9.902    0.000
modInd <- modificationIndices(fit12, minimum.value = 10)
# head(modInd[order(modInd$mi, decreasing=TRUE), ], 10)
subset(modInd[order(modInd$mi, decreasing=TRUE), ], mi > 5)
##      lhs op  rhs    mi    epc sepc.lv sepc.all sepc.nox
## 224 Q019 ~~ Q089 18.29  0.131   0.131    0.208    0.208
## 188 Q017 ~~ Q094 17.63  0.157   0.157    0.207    0.207
## 218 Q019 ~~ Q028 17.23 -0.122  -0.122   -0.203   -0.203
## 136 Q014 ~~ Q089 16.05  0.140   0.140    0.195    0.195
## 121 Q014 ~~ Q019 14.81  0.138   0.138    0.184    0.184
## 222 Q019 ~~ Q087 13.79  0.102   0.102    0.185    0.185
## 107 Q013 ~~ Q029 13.35  0.159   0.159    0.177    0.177
## 410 Q088 ~~ Q089 12.07 -0.110  -0.110   -0.180   -0.180
## 379 Q029 ~~ Q092 11.26 -0.119  -0.119   -0.151   -0.151
## 312 Q024 ~~ Q089 10.29  0.079   0.079    0.160    0.160
## 81   IWB =~ Q017 10.25  0.163   0.175    0.119    0.119
## 345 Q026 ~~ Q093 10.16 -0.088  -0.088   -0.161   -0.161
# Show model performance
# library(performance)
# model_performance(fit12, metrics = "all", verbose = TRUE)

7.5 Model 14: Direct effect with Covariances and Estimation Method ULS

An alternative for models based on ordered discrete/categorical data for fit estimation is the Unweighted Least Squares (ULS) method.

# Amending model 
model14 <- '

# latent variables
 TFL =~ Q013 + Q014 + Q016 + Q017 + Q018 + Q019 + Q020 + Q021 + Q022 + Q023 + Q024 + Q025 + Q026 + Q027 + Q028 + Q029 + Q030 + Q032
 IWB =~ Q087 + Q088 + Q089 + Q090 + Q091 + Q092 + Q093 + Q094 + Q095
 
# direct effect
 IWB ~ b * TFL
 DirEff := b
 TotEff := b

 
# covariances
 Q013 ~~ Q026
 Q013 ~~ Q027
 Q013 ~~ Q028
 Q013 ~~ Q032
 Q018 ~~ Q020
 Q018 ~~ Q029
 Q020 ~~ Q029
 Q021 ~~ Q023
 Q029 ~~ Q032
'

# Calculate fit
fit14 <- sem(model14, data = DFs, estimator = "ULSMV")

# Print results (fit indices, parameters, hypothesis tests)
summary(fit14, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6-12 ended normally after 85 iterations
## 
##   Estimator                                        ULS
##   Optimization method                           NLMINB
##   Number of model parameters                        64
## 
##   Number of observations                           482
## 
## Model Test User Model:
##                                               Standard      Robust
##   Test Statistic                               663.522     413.518
##   Degrees of freedom                               314         314
##   P-value (Unknown)                                 NA       0.000
##   Scaling correction factor                                  2.918
##   Shift parameter                                          186.098
##     simple second-order correction                                
## 
## Model Test Baseline Model:
## 
##   Test statistic                            161341.604    3452.942
##   Degrees of freedom                               351         351
##   P-value                                           NA       0.000
##   Scaling correction factor                                 51.366
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.998       0.968
##   Tucker-Lewis Index (TLI)                       0.998       0.964
##                                                                   
##   Robust Comparative Fit Index (CFI)                            NA
##   Robust Tucker-Lewis Index (TLI)                               NA
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.048       0.026
##   90 Percent confidence interval - lower         0.043       0.018
##   90 Percent confidence interval - upper         0.053       0.032
##   P-value RMSEA <= 0.05                          0.724       1.000
##                                                                   
##   Robust RMSEA                                                  NA
##   90 Percent confidence interval - lower                        NA
##   90 Percent confidence interval - upper                        NA
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.032       0.032
## 
## Parameter Estimates:
## 
##   Standard errors                           Robust.sem
##   Information                                 Expected
##   Information saturated (h1) model        Unstructured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   TFL =~                                              
##     Q013              1.000                           
##     Q014              0.869    0.047   18.500    0.000
##     Q016              0.832    0.044   18.794    0.000
##     Q017              0.990    0.039   25.533    0.000
##     Q018              0.959    0.038   24.998    0.000
##     Q019              0.814    0.046   17.690    0.000
##     Q020              0.942    0.040   23.312    0.000
##     Q021              0.926    0.041   22.413    0.000
##     Q022              0.895    0.049   18.191    0.000
##     Q023              0.978    0.035   27.827    0.000
##     Q024              0.915    0.038   24.044    0.000
##     Q025              0.820    0.044   18.502    0.000
##     Q026              0.889    0.044   20.119    0.000
##     Q027              0.921    0.044   20.726    0.000
##     Q028              0.933    0.041   22.738    0.000
##     Q029              0.957    0.041   23.101    0.000
##     Q030              0.553    0.060    9.209    0.000
##     Q032              0.998    0.037   27.315    0.000
##   IWB =~                                              
##     Q087              1.000                           
##     Q088              1.092    0.082   13.358    0.000
##     Q089              0.964    0.057   17.026    0.000
##     Q090              0.858    0.074   11.602    0.000
##     Q091              1.085    0.067   16.314    0.000
##     Q092              0.968    0.054   17.983    0.000
##     Q093              1.061    0.051   20.764    0.000
##     Q094              1.142    0.058   19.717    0.000
##     Q095              0.992    0.065   15.190    0.000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB ~                                               
##     TFL        (b)    0.511    0.051    9.965    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .Q013 ~~                                             
##    .Q026             -0.165    0.045   -3.676    0.000
##    .Q027             -0.165    0.039   -4.229    0.000
##    .Q028             -0.114    0.042   -2.701    0.007
##    .Q032              0.120    0.053    2.266    0.023
##  .Q018 ~~                                             
##    .Q020              0.110    0.046    2.363    0.018
##    .Q029              0.078    0.049    1.580    0.114
##  .Q020 ~~                                             
##    .Q029             -0.136    0.049   -2.768    0.006
##  .Q021 ~~                                             
##    .Q023              0.132    0.044    2.994    0.003
##  .Q029 ~~                                             
##    .Q032              0.288    0.057    5.013    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .Q013              0.711    0.084    8.416    0.000
##    .Q014              0.895    0.133    6.712    0.000
##    .Q016              0.738    0.077    9.585    0.000
##    .Q017              0.750    0.072   10.420    0.000
##    .Q018              0.553    0.056    9.821    0.000
##    .Q019              0.675    0.058   11.571    0.000
##    .Q020              0.624    0.057   10.975    0.000
##    .Q021              0.596    0.059   10.141    0.000
##    .Q022              0.580    0.080    7.218    0.000
##    .Q023              0.594    0.053   11.305    0.000
##    .Q024              0.399    0.040    9.999    0.000
##    .Q025              0.752    0.098    7.668    0.000
##    .Q026              0.658    0.081    8.150    0.000
##    .Q027              0.636    0.092    6.898    0.000
##    .Q028              0.535    0.045   11.897    0.000
##    .Q029              1.123    0.094   11.987    0.000
##    .Q030              1.843    0.163   11.296    0.000
##    .Q032              0.631    0.063   10.074    0.000
##    .Q087              0.529    0.063    8.381    0.000
##    .Q088              0.585    0.113    5.182    0.000
##    .Q089              0.595    0.075    7.959    0.000
##    .Q090              0.888    0.109    8.154    0.000
##    .Q091              0.555    0.085    6.567    0.000
##    .Q092              0.537    0.075    7.151    0.000
##    .Q093              0.628    0.067    9.319    0.000
##    .Q094              0.694    0.090    7.670    0.000
##    .Q095              0.617    0.082    7.559    0.000
##     TFL               1.441    0.128   11.221    0.000
##    .IWB               0.701    0.089    7.874    0.000
## 
## R-Square:
##                    Estimate
##     Q013              0.670
##     Q014              0.549
##     Q016              0.575
##     Q017              0.653
##     Q018              0.706
##     Q019              0.586
##     Q020              0.672
##     Q021              0.675
##     Q022              0.665
##     Q023              0.699
##     Q024              0.751
##     Q025              0.563
##     Q026              0.634
##     Q027              0.658
##     Q028              0.701
##     Q029              0.540
##     Q030              0.193
##     Q032              0.695
##     Q087              0.671
##     Q088              0.687
##     Q089              0.628
##     Q090              0.472
##     Q091              0.696
##     Q092              0.653
##     Q093              0.659
##     Q094              0.669
##     Q095              0.632
##     IWB               0.350
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)
##     DirEff            0.511    0.051    9.965    0.000
##     TotEff            0.511    0.051    9.965    0.000
modInd <- modificationIndices(fit14, minimum.value = 10)
# head(modInd[order(modInd$mi, decreasing=TRUE), ], 10)
subset(modInd[order(modInd$mi, decreasing=TRUE), ], mi > 5)
##      lhs op  rhs    mi    epc sepc.lv sepc.all sepc.nox
## 94   IWB =~ Q030 81.55  0.210   0.218    0.144    0.144
## 81   IWB =~ Q017 46.34  0.163   0.170    0.115    0.115
## 72   TFL =~ Q090 40.41  0.115   0.138    0.106    0.106
## 75   TFL =~ Q093 35.24 -0.112  -0.135   -0.099   -0.099
## 188 Q017 ~~ Q094 26.72  0.243   0.243    0.336    0.336
## 90   IWB =~ Q026 24.46 -0.118  -0.123   -0.092   -0.092
## 345 Q026 ~~ Q093 18.35 -0.200  -0.200   -0.311   -0.311
## 373 Q029 ~~ Q030 17.24 -0.197  -0.197   -0.137   -0.137
## 79   IWB =~ Q014 16.77 -0.097  -0.101   -0.072   -0.072
## 388 Q030 ~~ Q091 15.22  0.180   0.180    0.178    0.178
## 389 Q030 ~~ Q092 15.14  0.180   0.180    0.180    0.180
## 73   TFL =~ Q091 14.67 -0.073  -0.087   -0.065   -0.065
## 386 Q030 ~~ Q089 14.28  0.174   0.174    0.166    0.166
## 140 Q014 ~~ Q093 14.20 -0.176  -0.176   -0.234   -0.234
## 426 Q090 ~~ Q094 12.68 -0.175  -0.175   -0.223   -0.223
## 384 Q030 ~~ Q087 12.62  0.164   0.164    0.166    0.166
## 93   IWB =~ Q029 12.31 -0.085  -0.089   -0.057   -0.057
## 121 Q014 ~~ Q019 11.86  0.164   0.164    0.211    0.211
## 107 Q013 ~~ Q029 10.52  0.160   0.160    0.179    0.179
## 182 Q017 ~~ Q088 10.46  0.152   0.152    0.229    0.229
# Show model performance
# library(performance)
# model_performance(fit12, metrics = "all", verbose = TRUE)
# Comparing model fits
# anova(fit11, fit12, fit13) # Lavaan ERROR: some models (but not all) have scaled test statistics


# Prepare PDF for Model 11
# pdf("Model11.pdf", width = 25, height = 16)
par(mar=c(7, 1, 7, 1))
par(oma=c(1, 1, 1, 1))

# Prepare fitmeasures
ParDF <- as.data.frame(do.call(cbind, fit11@ParTable))
DirEff <- round(as.numeric(ParDF[ParDF$label == "DirEff", 14]), 4)
TotEff <- round(as.numeric(ParDF[ParDF$label == "TotEff", 14]), 4)
n      <- fit11@SampleStats@ntotal

fitMeas <- toString(c("ChiSq: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit11, "chisq"))), 4),
            " - ChiSq-p: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit11, "pvalue"))), 4),
            " - DF: ", gsub("[^0-9.]", "", fitMeasures(fit11, "df")),
            " - ChiSq/DF: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit11, "chisq")))/ as.numeric(gsub("[^0-9.]", "", fitMeasures(fit11, "df"))), 4),
            " - CFI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit11, "cfi"))), 4),
            " - TLI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit11, "tli"))), 4),
            " - RMSEA: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit11, "rmsea"))), 4),
            " - SRMR: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit11, "srmr"))), 4),
            " - n: ", n,
            " - DirEff: ", DirEff,
            " - TotalEff: ", TotEff
            ), 
            width = 255)
fitMeas <- gsub(",", "", fitMeas)

# Plot model
library(semPlot)
semPaths(fit11, what = "stand", whatLabels = "stand", intercepts = FALSE, residuals = FALSE, edge.label.cex = 0.5, edge.color = "blue", layout = "tree", rotation = 3, curve = 1, curvePivot = TRUE, mar = c(3,1,5,1), sizeLat = 7, sizeMan = 3, color = colorlist)
title(main = "Model Showing Only Direct Effect of TFL on IWB - Model 11", cex.main = 2.5, col.main = "darkblue", font.main = 3, sub = fitMeas, cex.sub = 1.4)

# dev.off()


# Prepare PDF for Model 12
# pdf("Model12.pdf", width = 25, height = 16)
par(mar=c(7, 1, 7, 1))
par(oma=c(1, 1, 1, 1))

# Prepare fitmeasures
ParDF  <- as.data.frame(do.call(cbind, fit12@ParTable))
DirEff <- round(as.numeric(ParDF[ParDF$label == "DirEff", 14]), 4)
TotEff <- round(as.numeric(ParDF[ParDF$label == "TotEff", 14]), 4)
n      <- fit12@SampleStats@ntotal

fitMeas <- toString(c("ChiSq: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit12, "chisq"))), 4),
            " - ChiSq-p: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit12, "pvalue"))), 4),
            " - DF: ", gsub("[^0-9.]", "", fitMeasures(fit12, "df")),
            " - ChiSq/DF: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit12, "chisq")))/ as.numeric(gsub("[^0-9.]", "", fitMeasures(fit12, "df"))), 4),
            " - CFI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit12, "cfi"))), 4),
            " - TLI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit12, "tli"))), 4),
            " - RMSEA: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit12, "rmsea"))), 4),
            " - SRMR: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit12, "srmr"))), 4),
            " - n: ", n,
            " - DirEff: ", DirEff,
            " - TotalEff: ", TotEff
            ), 
            width = 255)
fitMeas <- gsub(",", "", fitMeas)

# Plot model
library(semPlot)
semPaths(fit12, what = "est", whatLabels = "est", intercepts = FALSE, residuals = FALSE, edge.label.cex = 0.5, edge.color = "blue", layout = "tree", rotation = 3, curve = 1, curvePivot = TRUE, mar = c(3,1,5,1), sizeLat = 7, sizeMan = 3, color = colorlist)
title(main = "Model Showing Only Direct Effect of TFL on IWB - Model 12\nSome Modification Indices Applied", cex.main = 2.5, col.main = "darkblue", font.main = 3, sub = fitMeas, cex.sub = 1.4)

# dev.off()


# Prepare PDF for Model 13
# pdf("Model13.pdf", width = 25, height = 16)
par(mar=c(7, 1, 7, 1))
par(oma=c(1, 1, 1, 1))

# Prepare fitmeasures
ParDF <- as.data.frame(do.call(cbind, fit13@ParTable))
DirEff <- round(as.numeric(ParDF[ParDF$label == "DirEff", 14]), 4)
TotEff <- round(as.numeric(ParDF[ParDF$label == "TotEff", 14]), 4)
n      <- fit13@SampleStats@ntotal

fitMeas <- toString(c("ChiSq: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit13, "chisq"))), 4),
            " - ChiSq-p: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit13, "pvalue"))), 4),
            " - DF: ", gsub("[^0-9.]", "", fitMeasures(fit13, "df")),
            " - ChiSq/DF: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit13, "chisq")))/ as.numeric(gsub("[^0-9.]", "", fitMeasures(fit13, "df"))), 4),
            " - CFI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit13, "cfi"))), 4),
            " - TLI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit13, "tli"))), 4),
            " - RMSEA: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit13, "rmsea"))), 4),
            " - SRMR: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit13, "srmr"))), 4),
            " - n: ", n,
            " - DirEff: ", DirEff,
            " - TotalEff: ", TotEff
            ), 
            width = 255)
fitMeas <- gsub(",", "", fitMeas)

# Plot model
library(semPlot)
semPaths(fit13, what = "stand", whatLabels = "stand", intercepts = FALSE, residuals = FALSE, edge.label.cex = 0.5, edge.color = "blue", layout = "tree", rotation = 3, curve = 1, curvePivot = TRUE, mar = c(3,1,5,1), sizeLat = 7, sizeMan = 3, color = colorlist)
title(main = "Model Showing Only Direct Effect of TFL on IWB - Model 13\nEstimation Method DWLS", cex.main = 2.5, col.main = "darkblue", font.main = 3, sub = fitMeas, cex.sub = 1.4)

# dev.off()


# Prepare PDF for Model 14
# pdf("Model14.pdf", width = 25, height = 16)
par(mar=c(7, 1, 7, 1))
par(oma=c(1, 1, 1, 1))

# Prepare fitmeasures
ParDF <- as.data.frame(do.call(cbind, fit14@ParTable))
DirEff <- round(as.numeric(ParDF[ParDF$label == "DirEff", 14]), 4)
TotEff <- round(as.numeric(ParDF[ParDF$label == "TotEff", 14]), 4)
n      <- fit14@SampleStats@ntotal

fitMeas <- toString(c("ChiSq: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit14, "chisq"))), 4),
            " - ChiSq-p: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit14, "pvalue"))), 4),
            " - DF: ", gsub("[^0-9.]", "", fitMeasures(fit14, "df")),
            " - ChiSq/DF: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit14, "chisq")))/ as.numeric(gsub("[^0-9.]", "", fitMeasures(fit14, "df"))), 4),
            " - CFI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit14, "cfi"))), 4),
            " - TLI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit14, "tli"))), 4),
            " - RMSEA: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit14, "rmsea"))), 4),
            " - SRMR: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit14, "srmr"))), 4),
            " - n: ", n,
            " - DirEff: ", DirEff,
            " - TotalEff: ", TotEff
            ), 
            width = 255)
fitMeas <- gsub(",", "", fitMeas)

# Plot model
library(semPlot)
semPaths(fit14, what = "stand", whatLabels = "stand", intercepts = FALSE, residuals = FALSE, edge.label.cex = 0.5, edge.color = "blue", layout = "tree", rotation = 3, curve = 1, curvePivot = TRUE, mar = c(3,1,5,1), sizeLat = 7, sizeMan = 3, color = colorlist)
title(main = "Model Showing Only Direct Effect of TFL on IWB - Model 14\nEstimation Method ULS", cex.main = 2.5, col.main = "darkblue", font.main = 3, sub = fitMeas, cex.sub = 1.4)

# dev.off()

After modification from Model 11 to Model 12, all indicators have improved. A significant difference between models was found.

7.6 Comparing Fit Measures for Simple Models using Different Estimation Methods

# Compare fit measures
cbind("Model 11"               = round(inspect(fit11, 'fit.measures'), 4), 
      "Model 12 (Cov)"         = round(inspect(fit12, 'fit.measures'), 4),
      "Model 13 (Cov + DWLS)"  = round(inspect(fit13, 'fit.measures'), 4),
      "Model 14 (Cov + ULS)"   = round(inspect(fit14, 'fit.measures'), 4)
      )
##                                 Model 11 Model 12 (Cov) Model 13 (Cov + DWLS)
## npar                           5.900e+01      6.400e+01             6.400e+01
## fmin                           1.079e+00      7.252e-01             1.244e-01
## chisq                          1.041e+03      6.991e+02             1.199e+02
## df                             3.760e+02      3.140e+02             3.140e+02
## pvalue                         0.000e+00      0.000e+00             1.000e+00
## chisq.scaled                   1.223e+04      1.129e+04             4.090e+02
## df.scaled                      4.060e+02      3.510e+02             3.140e+02
## pvalue.scaled                  0.000e+00      0.000e+00             2.000e-04
## chisq.scaling.factor           9.438e-01      9.648e-01             5.440e-01
## baseline.chisq                 9.393e-01      9.606e-01             2.729e+04
## baseline.df                    9.393e-01      9.606e-01             3.510e+02
## baseline.pvalue                9.081e-01      9.308e-01             0.000e+00
## baseline.chisq.scaled          9.149e-01      9.381e-01             3.428e+03
## baseline.df.scaled             8.473e-01      8.392e-01             3.510e+02
## baseline.pvalue.scaled         9.439e-01      9.649e-01             0.000e+00
## baseline.chisq.scaling.factor  9.438e-01      9.648e-01             8.754e+00
## cfi                           -1.852e+04     -1.716e+04             1.000e+00
## tli                           -1.800e+04     -1.681e+04             1.008e+00
## nnfi                           3.715e+04      3.445e+04             1.008e+00
## rfi                            3.740e+04      3.472e+04             9.951e-01
## nfi                            4.820e+02      4.820e+02             9.956e-01
## pnfi                           3.721e+04      3.452e+04             8.907e-01
## ifi                            6.060e-02      5.040e-02             1.007e+00
## rni                            5.620e-02      4.540e-02             1.007e+00
## cfi.scaled                     6.490e-02      5.550e-02             9.691e-01
## tli.scaled                     0.000e+00      4.348e-01             9.655e-01
## cfi.robust                     8.190e-02      6.610e-02                    NA
## tli.robust                     8.190e-02      6.610e-02                    NA
## nnfi.scaled                    4.390e-02      3.510e-02             9.655e-01
## nnfi.robust                    4.390e-02      3.510e-02                    NA
## rfi.scaled                     4.390e-02      3.510e-02             8.666e-01
## nfi.scaled                     4.550e-02      3.640e-02             8.807e-01
## ifi.scaled                     4.550e-02      3.640e-02             9.695e-01
## rni.scaled                     4.390e-02      3.510e-02             9.691e-01
## rni.robust                     4.390e-02      3.510e-02                    NA
## rmsea                          1.966e+02      2.467e+02             0.000e+00
## rmsea.ci.lower                 2.061e+02      2.597e+02             0.000e+00
## rmsea.ci.upper                 8.629e-01      9.012e-01             0.000e+00
## rmsea.pvalue                   8.413e-01      8.810e-01             1.000e+00
## rmsea.scaled                   7.458e-01      7.486e-01             2.510e-02
## rmsea.ci.lower.scaled          5.019e-01      6.707e-01             1.760e-02
## rmsea.ci.upper.scaled          2.404e+00      1.716e+00             3.170e-02
## rmsea.pvalue.scaled            5.900e+01      6.400e+01             1.000e+00
## rmsea.robust                   1.079e+00      7.252e-01                    NA
## rmsea.ci.lower.robust          1.041e+03      6.991e+02                    NA
## rmsea.ci.upper.robust          3.760e+02      3.140e+02                    NA
## rmsea.pvalue.robust            0.000e+00      0.000e+00                    NA
## rmr                            1.223e+04      1.129e+04             6.050e-02
## rmr_nomean                     4.060e+02      3.510e+02             6.050e-02
## srmr                           0.000e+00      0.000e+00             3.210e-02
## srmr_bentler                   9.438e-01      9.648e-01             3.210e-02
## srmr_bentler_nomean            9.393e-01      9.606e-01             3.210e-02
## crmr                           9.393e-01      9.606e-01             3.340e-02
## crmr_nomean                    9.081e-01      9.308e-01             3.340e-02
## srmr_mplus                     9.149e-01      9.381e-01             3.210e-02
## srmr_mplus_nomean              8.473e-01      8.392e-01             3.210e-02
## cn_05                          9.439e-01      9.649e-01             1.430e+03
## cn_01                          9.438e-01      9.648e-01             1.506e+03
## gfi                           -1.852e+04     -1.716e+04             9.964e-01
## agfi                          -1.800e+04     -1.681e+04             9.957e-01
## pgfi                           3.715e+04      3.445e+04             8.277e-01
## mfi                            3.740e+04      3.472e+04             1.224e+00
## ecvi                           4.820e+02      4.820e+02             5.154e-01
##                               Model 14 (Cov + ULS)
## npar                                     6.400e+01
## fmin                                     6.883e-01
## chisq                                    6.635e+02
## df                                       3.140e+02
## pvalue                                          NA
## chisq.scaled                             4.135e+02
## df.scaled                                3.140e+02
## pvalue.scaled                            1.000e-04
## chisq.scaling.factor                     2.918e+00
## baseline.chisq                           1.613e+05
## baseline.df                              3.510e+02
## baseline.pvalue                                 NA
## baseline.chisq.scaled                    3.453e+03
## baseline.df.scaled                       3.510e+02
## baseline.pvalue.scaled                   0.000e+00
## baseline.chisq.scaling.factor            5.137e+01
## cfi                                      9.978e-01
## tli                                      9.976e-01
## nnfi                                     9.976e-01
## rfi                                      9.954e-01
## nfi                                      9.959e-01
## pnfi                                     8.909e-01
## ifi                                      9.978e-01
## rni                                      9.978e-01
## cfi.scaled                               9.679e-01
## tli.scaled                               9.641e-01
## cfi.robust                                      NA
## tli.robust                                      NA
## nnfi.scaled                              9.641e-01
## nnfi.robust                                     NA
## rfi.scaled                               8.661e-01
## nfi.scaled                               8.802e-01
## ifi.scaled                               9.683e-01
## rni.scaled                               9.679e-01
## rni.robust                                      NA
## rmsea                                    4.810e-02
## rmsea.ci.lower                           4.300e-02
## rmsea.ci.upper                           5.320e-02
## rmsea.pvalue                             7.239e-01
## rmsea.scaled                             2.570e-02
## rmsea.ci.lower.scaled                    1.830e-02
## rmsea.ci.upper.scaled                    3.220e-02
## rmsea.pvalue.scaled                      1.000e+00
## rmsea.robust                                    NA
## rmsea.ci.lower.robust                           NA
## rmsea.ci.upper.robust                           NA
## rmsea.pvalue.robust                             NA
## rmr                                      6.040e-02
## rmr_nomean                               6.040e-02
## srmr                                     3.210e-02
## srmr_bentler                             3.210e-02
## srmr_bentler_nomean                      3.210e-02
## crmr                                     3.330e-02
## crmr_nomean                              3.330e-02
## srmr_mplus                               3.210e-02
## srmr_mplus_nomean                        3.210e-02
## cn_05                                    2.593e+02
## cn_01                                    2.730e+02
## gfi                                      9.968e-01
## agfi                                     9.961e-01
## pgfi                                     8.280e-01
## mfi                                      6.954e-01
## ecvi                                     1.646e+00

TLI and CFI show higher (better fit) values when using estimation methods DWLS and ULS whereas RMSEA shows lower (better fit) values when using those methods. Since there are no commony used thresholds available for both methods, we continue using the ML estimation method for model fit knowing that it might not be fair to our 7-point Likert Scale data, i.e. ordered discrete/categorical data.


8 Adding Mediators:

8.1 Model 22: IIR Mediates the Relationship Between TFL and Employee IWB

# Amending model for Mediation by IRR 
model22 <- '

# latent variables
 IWB =~ Q088 + Q089 + Q090 + Q091 + Q092 + Q093 + Q094 + Q095
 TFL =~ Q013 + Q014 + Q015 + Q016 + Q017 + Q018 + Q019 + Q020 + Q021 + Q022 + Q023 + Q024 + Q025 + Q026 +         Q027 + Q028 + Q029 + Q031 + Q032
 IIR =~ Q071 + Q072 + Q075 + Q076 + Q077 + Q081
 
# direct effect
 IWB ~ c * TFL
 DirEff := c

# mediator
 IIR ~ a1 * TFL
 IWB ~ b1 * IIR

# indirect effect
 ab1 := a1 * b1

# total effect
 TotEff := c + (a1 * b1)

# covariances
 Q013 ~~ Q026
 Q013 ~~ Q032
 Q013 ~~ Q027
 Q013 ~~ Q015
 Q018 ~~ Q020
 Q020 ~~ Q029
 Q021 ~~ Q023
 Q029 ~~ Q032
 Q075 ~~ Q076
 
'

# Calculate fit22
fit22 <- sem(model22, data = DF)

# Print results (fit22 indices, parameters, hypothesis tests)
summary(fit22, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6-12 ended normally after 40 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        78
## 
##   Number of observations                           482
## 
## Model Test User Model:
##                                                       
##   Test statistic                              1095.749
##   Degrees of freedom                               483
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                             12996.947
##   Degrees of freedom                               528
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.951
##   Tucker-Lewis Index (TLI)                       0.946
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -20614.225
##   Loglikelihood unrestricted model (H1)     -20066.351
##                                                       
##   Akaike (AIC)                               41384.450
##   Bayesian (BIC)                             41710.330
##   Sample-size adjusted Bayesian (BIC)        41462.765
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.051
##   90 Percent confidence interval - lower         0.047
##   90 Percent confidence interval - upper         0.055
##   P-value RMSEA <= 0.05                          0.292
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.052
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB =~                                              
##     Q088              1.000                           
##     Q089              0.890    0.044   20.036    0.000
##     Q090              0.742    0.049   15.225    0.000
##     Q091              1.043    0.045   22.942    0.000
##     Q092              0.878    0.044   20.096    0.000
##     Q093              1.033    0.046   22.463    0.000
##     Q094              1.059    0.050   21.133    0.000
##     Q095              0.904    0.046   19.761    0.000
##   TFL =~                                              
##     Q013              1.000                           
##     Q014              0.904    0.048   18.847    0.000
##     Q015              0.936    0.041   22.912    0.000
##     Q016              0.859    0.045   19.242    0.000
##     Q017              0.989    0.049   20.066    0.000
##     Q018              0.971    0.045   21.600    0.000
##     Q019              0.843    0.043   19.563    0.000
##     Q020              0.954    0.046   20.810    0.000
##     Q021              0.948    0.045   21.237    0.000
##     Q022              0.920    0.043   21.173    0.000
##     Q023              1.003    0.046   21.839    0.000
##     Q024              0.932    0.041   22.814    0.000
##     Q025              0.845    0.045   18.931    0.000
##     Q026              0.924    0.048   19.073    0.000
##     Q027              0.947    0.049   19.247    0.000
##     Q028              0.941    0.044   21.390    0.000
##     Q029              1.000    0.053   18.766    0.000
##     Q031              0.743    0.048   15.364    0.000
##     Q032              1.032    0.044   23.645    0.000
##   IIR =~                                              
##     Q071              1.000                           
##     Q072              0.836    0.067   12.391    0.000
##     Q075              1.069    0.078   13.681    0.000
##     Q076              0.965    0.076   12.777    0.000
##     Q077              0.808    0.065   12.450    0.000
##     Q081              0.715    0.066   10.793    0.000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB ~                                               
##     TFL        (c)    0.297    0.040    7.333    0.000
##   IIR ~                                               
##     TFL       (a1)    0.301    0.035    8.714    0.000
##   IWB ~                                               
##     IIR       (b1)    0.865    0.083   10.454    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .Q013 ~~                                             
##    .Q026             -0.128    0.032   -3.973    0.000
##    .Q032              0.087    0.031    2.843    0.004
##    .Q027             -0.131    0.032   -4.050    0.000
##    .Q015              0.098    0.032    3.021    0.003
##  .Q018 ~~                                             
##    .Q020              0.146    0.031    4.735    0.000
##  .Q020 ~~                                             
##    .Q029             -0.158    0.037   -4.298    0.000
##  .Q021 ~~                                             
##    .Q023              0.126    0.030    4.252    0.000
##  .Q029 ~~                                             
##    .Q032              0.218    0.039    5.578    0.000
##  .Q075 ~~                                             
##    .Q076              0.127    0.035    3.650    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .Q088              0.622    0.046   13.591    0.000
##    .Q089              0.606    0.043   13.956    0.000
##    .Q090              0.990    0.067   14.860    0.000
##    .Q091              0.465    0.037   12.708    0.000
##    .Q092              0.583    0.042   13.938    0.000
##    .Q093              0.507    0.039   12.988    0.000
##    .Q094              0.697    0.051   13.591    0.000
##    .Q095              0.657    0.047   14.033    0.000
##    .Q013              0.756    0.052   14.503    0.000
##    .Q014              0.855    0.057   14.930    0.000
##    .Q015              0.588    0.040   14.527    0.000
##    .Q016              0.716    0.048   14.885    0.000
##    .Q017              0.813    0.055   14.777    0.000
##    .Q018              0.576    0.040   14.457    0.000
##    .Q019              0.649    0.044   14.845    0.000
##    .Q020              0.652    0.045   14.616    0.000
##    .Q021              0.591    0.041   14.533    0.000
##    .Q022              0.566    0.039   14.593    0.000
##    .Q023              0.584    0.041   14.410    0.000
##    .Q024              0.407    0.029   14.194    0.000
##    .Q025              0.734    0.049   14.921    0.000
##    .Q026              0.619    0.042   14.601    0.000
##    .Q027              0.622    0.043   14.559    0.000
##    .Q028              0.566    0.039   14.551    0.000
##    .Q029              1.057    0.071   14.919    0.000
##    .Q031              1.082    0.071   15.208    0.000
##    .Q032              0.591    0.041   14.350    0.000
##    .Q071              0.634    0.049   12.988    0.000
##    .Q072              0.536    0.040   13.438    0.000
##    .Q075              0.524    0.045   11.667    0.000
##    .Q076              0.583    0.047   12.514    0.000
##    .Q077              0.492    0.037   13.398    0.000
##    .Q081              0.637    0.045   14.250    0.000
##    .IWB               0.494    0.053    9.264    0.000
##     TFL               1.376    0.130   10.600    0.000
##    .IIR               0.435    0.056    7.762    0.000
## 
## R-Square:
##                    Estimate
##     Q088              0.667
##     Q089              0.620
##     Q090              0.409
##     Q091              0.744
##     Q092              0.622
##     Q093              0.724
##     Q094              0.667
##     Q095              0.608
##     Q013              0.645
##     Q014              0.568
##     Q015              0.672
##     Q016              0.586
##     Q017              0.623
##     Q018              0.693
##     Q019              0.601
##     Q020              0.658
##     Q021              0.677
##     Q022              0.673
##     Q023              0.703
##     Q024              0.746
##     Q025              0.572
##     Q026              0.655
##     Q027              0.665
##     Q028              0.683
##     Q029              0.565
##     Q031              0.412
##     Q032              0.713
##     Q071              0.469
##     Q072              0.422
##     Q075              0.550
##     Q076              0.472
##     Q077              0.426
##     Q081              0.310
##     IWB               0.604
##     IIR               0.223
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)
##     DirEff            0.297    0.040    7.333    0.000
##     ab1               0.260    0.034    7.580    0.000
##     TotEff            0.557    0.046   12.245    0.000
modInd <- modificationIndices(fit22, minimum.value = 10)
# head(modInd[order(modInd$mi, decreasing=TRUE), ], 10)
subset(modInd[order(modInd$mi, decreasing=TRUE), ], mi > 5)
##      lhs op  rhs    mi    epc sepc.lv sepc.all sepc.nox
## 102  IWB =~ Q031 50.84  0.398   0.444    0.327    0.327
## 107  IWB =~ Q076 33.30  0.340   0.380    0.361    0.361
## 118  TFL =~ Q071 30.81  0.231   0.270    0.248    0.248
## 149  IIR =~ Q031 27.86  0.430   0.321    0.237    0.237
## 105  IWB =~ Q072 24.10 -0.289  -0.322   -0.335   -0.335
## 664 Q072 ~~ Q081 23.23  0.147   0.147    0.252    0.252
## 195 Q089 ~~ Q019 19.30  0.135   0.135    0.215    0.215
## 333 Q094 ~~ Q017 16.76  0.153   0.153    0.203    0.203
## 190 Q089 ~~ Q014 14.81  0.135   0.135    0.188    0.188
## 511 Q019 ~~ Q028 13.87 -0.109  -0.109   -0.180   -0.180
## 437 Q015 ~~ Q032 13.75  0.102   0.102    0.173    0.173
## 403 Q014 ~~ Q019 13.49  0.130   0.130    0.175    0.175
## 663 Q072 ~~ Q077 12.33  0.099   0.099    0.193    0.193
## 151 Q088 ~~ Q089 12.09 -0.112  -0.112   -0.183   -0.183
## 148  IIR =~ Q029 11.66 -0.260  -0.194   -0.125   -0.125
## 268 Q091 ~~ Q072 11.53 -0.090  -0.090   -0.180   -0.180
## 399 Q014 ~~ Q015 11.27  0.112   0.112    0.158    0.158
## 292 Q092 ~~ Q029 11.12 -0.120  -0.120   -0.153   -0.153
## 477 Q017 ~~ Q031 11.10  0.148   0.148    0.157    0.157
## 145  IIR =~ Q026 10.95 -0.207  -0.155   -0.115   -0.115
## 87   IWB =~ Q015 10.91 -0.136  -0.152   -0.113   -0.113
## 125  IIR =~ Q089 10.70  0.299   0.224    0.177    0.177
## 391 Q013 ~~ Q029 10.59  0.136   0.136    0.152    0.152
## 285 Q092 ~~ Q022 10.59  0.092   0.092    0.161    0.161
## 89   IWB =~ Q017 10.54  0.159   0.178    0.121    0.121
## 109  IWB =~ Q081 10.40 -0.195  -0.218   -0.227   -0.227
## 647 Q031 ~~ Q076 10.27  0.119   0.119    0.149    0.149
# Show model performance
# library(performance)
# model_performance(fit22, metrics = "all", verbose = TRUE)

# Prepare PDF
# pdf("Model22.pdf", width = 25, height = 16)
par(mar=c(7, 1, 7, 1))
par(oma=c(1, 1, 1, 1))

# Prepare fitmeasures
ParDF  <- as.data.frame(do.call(cbind, fit22@ParTable))
DirEff <- round(as.numeric(ParDF[ParDF$label == "DirEff", 14]), 4)
TotEff <- round(as.numeric(ParDF[ParDF$label == "TotEff", 14]), 4)
n      <- fit22@SampleStats@ntotal

fitMeas <- toString(c("ChiSq: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit22, "chisq"))), 4),
                      " - DF: ", gsub("[^0-9.]", "", fitMeasures(fit22, "df")),
                      " - ChiSq/DF: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit22, "chisq")))/ as.numeric(gsub("[^0-9.]", "", fitMeasures(fit22, "df"))), 4),
                      " - CFI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit22, "cfi"))), 4),
                      " - TLI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit22, "tli"))), 4),
                      " - RMSEA: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit22, "rmsea"))), 4),
                      " - SRMR: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit22, "srmr"))), 4),
                      " - n: ", n,
                      " - DirEff: ", DirEff,
                      " - TotalEff: ", TotEff
                      ), 
                    width = 255)
fitMeas <- gsub(",", "", fitMeas)

# Plot model
library(semPlot)
semPaths(fit22, what = "stand", whatLabels = "stand", intercepts = FALSE, residuals = FALSE, edge.label.cex = 0.5, edge.color = "blue", layout = "tree", rotation = 3, curve = 1, curvePivot = TRUE, mar = c(3,1,5,1), sizeLat = 7, sizeMan = 3, color = colorlist)
title(main = "IIR Mediates Relationship of TFL on IWB - Model 22", cex.main = 2.5, col.main = "darkblue", font.main = 3, sub = fitMeas, cex.sub = 1.4)

# dev.off()

Calculate Average Variance Extracted (AVE). If AVE of factor is less than 0.5, more error variance than explained variance is experienced. Model is not good.

# Calculate AVE (R-Square)
inspect(fit22, "rsquare" )
##  Q088  Q089  Q090  Q091  Q092  Q093  Q094  Q095  Q013  Q014  Q015  Q016  Q017 
## 0.667 0.620 0.409 0.744 0.622 0.724 0.667 0.608 0.645 0.568 0.672 0.586 0.623 
##  Q018  Q019  Q020  Q021  Q022  Q023  Q024  Q025  Q026  Q027  Q028  Q029  Q031 
## 0.693 0.601 0.658 0.677 0.673 0.703 0.746 0.572 0.655 0.665 0.683 0.565 0.412 
##  Q032  Q071  Q072  Q075  Q076  Q077  Q081   IWB   IIR 
## 0.713 0.469 0.422 0.550 0.472 0.426 0.310 0.604 0.223

AVE of IIR is calculated with 0.223. This means, only a small portion of the variation in IIR is explained. In later models, IIR could cause model performance to drop.

8.2 Model 43: Model Including IIR + SFI as Mediators

# Amending model for Mediation by IRR and SFI
library(lavaan)
model43 <- '

# latent variables
 IWB =~ Q087 + Q088 + Q089 + Q090 + Q091 + Q092 + Q093 + Q094 + Q095
 IIR =~ Q070 + Q071 + Q075 + Q076 + Q077 
 SFI =~ Q033 + Q034 + Q035 + Q037 + Q038 + Q044 + Q045 + Q049 + Q050 + Q051 + Q054
 TFL =~ Q014 + Q015 + Q016 + Q017 + Q018 + Q019 + Q020 + Q021 + Q022 + Q023 + Q024 + Q025 + Q026 + Q027 + Q028 + Q029 + Q032

# direct effect
 IWB ~ d1 * TFL
 DirEff := d1

# mediator
 SFI ~ a1 * TFL
 IIR ~ a2 * TFL
 IIR ~ b1 * SFI
 IWB ~ c1 * IIR

# indirect effect
 a1b1c1 := a1 * b1 * c1
 a2c1   := a2 * c1
 IndEff := a1b1c1 + a2c1

# total effect
 TotEff := d1 + (a1 * b1 * c1) + (a2 * c1)

# covariances
# Q029 ~~ Q032
# Q034 ~~ Q035
 Q018 ~~ Q020
 Q021 ~~ Q023
 Q029 ~~ Q032
 Q034 ~~ Q035
 Q075 ~~ Q076
 Q050 ~~ Q051
 Q051 ~~ Q054
 
'

# Calculate fit43
fit43 <- sem(model43, data = DFs)

# Print results (fit43 indices, parameters, hypothesis tests)
summary(fit43, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6-12 ended normally after 44 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        96
## 
##   Number of observations                           482
## 
## Model Test User Model:
##                                                       
##   Test statistic                              1685.169
##   Degrees of freedom                               807
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                             16232.183
##   Degrees of freedom                               861
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.943
##   Tucker-Lewis Index (TLI)                       0.939
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -26609.982
##   Loglikelihood unrestricted model (H1)     -25767.397
##                                                       
##   Akaike (AIC)                               53411.963
##   Bayesian (BIC)                             53813.046
##   Sample-size adjusted Bayesian (BIC)        53508.350
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.048
##   90 Percent confidence interval - lower         0.044
##   90 Percent confidence interval - upper         0.051
##   P-value RMSEA <= 0.05                          0.899
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.043
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB =~                                              
##     Q087              1.000                           
##     Q088              1.040    0.047   22.301    0.000
##     Q089              0.934    0.044   21.321    0.000
##     Q090              0.774    0.049   15.715    0.000
##     Q091              1.085    0.044   24.501    0.000
##     Q092              0.919    0.043   21.335    0.000
##     Q093              1.081    0.045   24.126    0.000
##     Q094              1.102    0.049   22.326    0.000
##     Q095              0.934    0.046   20.525    0.000
##   IIR =~                                              
##     Q070              1.000                           
##     Q071              1.253    0.095   13.227    0.000
##     Q075              1.251    0.095   13.205    0.000
##     Q076              1.168    0.092   12.738    0.000
##     Q077              0.894    0.078   11.455    0.000
##   SFI =~                                              
##     Q033              1.000                           
##     Q034              1.032    0.058   17.717    0.000
##     Q035              0.993    0.055   18.147    0.000
##     Q037              0.840    0.067   12.498    0.000
##     Q038              0.996    0.058   17.090    0.000
##     Q044              0.974    0.058   16.805    0.000
##     Q045              0.907    0.056   16.313    0.000
##     Q049              1.022    0.059   17.351    0.000
##     Q050              0.832    0.063   13.175    0.000
##     Q051              0.892    0.063   14.095    0.000
##     Q054              0.928    0.069   13.422    0.000
##   TFL =~                                              
##     Q014              1.000                           
##     Q015              1.035    0.054   19.341    0.000
##     Q016              0.950    0.053   17.853    0.000
##     Q017              1.082    0.059   18.269    0.000
##     Q018              1.070    0.055   19.574    0.000
##     Q019              0.937    0.051   18.206    0.000
##     Q020              1.055    0.055   19.110    0.000
##     Q021              1.050    0.054   19.449    0.000
##     Q022              1.022    0.053   19.449    0.000
##     Q023              1.107    0.056   19.807    0.000
##     Q024              1.033    0.050   20.635    0.000
##     Q025              0.937    0.053   17.654    0.000
##     Q026              1.026    0.054   19.120    0.000
##     Q027              1.046    0.055   19.178    0.000
##     Q028              1.042    0.053   19.553    0.000
##     Q029              1.088    0.064   17.123    0.000
##     Q032              1.137    0.057   19.904    0.000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB ~                                               
##     TFL       (d1)    0.247    0.044    5.661    0.000
##   SFI ~                                               
##     TFL       (a1)    0.577    0.046   12.489    0.000
##   IIR ~                                               
##     TFL       (a2)    0.077    0.034    2.277    0.023
##     SFI       (b1)    0.392    0.046    8.624    0.000
##   IWB ~                                               
##     IIR       (c1)    1.085    0.100   10.799    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .Q018 ~~                                             
##    .Q020              0.138    0.031    4.417    0.000
##  .Q021 ~~                                             
##    .Q023              0.125    0.030    4.181    0.000
##  .Q029 ~~                                             
##    .Q032              0.267    0.042    6.330    0.000
##  .Q034 ~~                                             
##    .Q035              0.197    0.036    5.539    0.000
##  .Q075 ~~                                             
##    .Q076              0.132    0.034    3.814    0.000
##  .Q050 ~~                                             
##    .Q051              0.312    0.052    6.017    0.000
##  .Q051 ~~                                             
##    .Q054              0.458    0.060    7.574    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .Q087              0.457    0.034   13.436    0.000
##    .Q088              0.628    0.045   13.884    0.000
##    .Q089              0.594    0.042   14.125    0.000
##    .Q090              0.990    0.066   14.950    0.000
##    .Q091              0.470    0.036   13.131    0.000
##    .Q092              0.574    0.041   14.122    0.000
##    .Q093              0.499    0.038   13.286    0.000
##    .Q094              0.703    0.051   13.877    0.000
##    .Q095              0.674    0.047   14.292    0.000
##    .Q070              0.497    0.037   13.370    0.000
##    .Q071              0.577    0.046   12.585    0.000
##    .Q075              0.550    0.045   12.132    0.000
##    .Q076              0.569    0.045   12.573    0.000
##    .Q077              0.544    0.039   13.961    0.000
##    .Q033              0.587    0.044   13.415    0.000
##    .Q034              0.674    0.050   13.412    0.000
##    .Q035              0.567    0.043   13.228    0.000
##    .Q037              1.353    0.091   14.883    0.000
##    .Q038              0.730    0.053   13.845    0.000
##    .Q044              0.744    0.053   13.946    0.000
##    .Q045              0.715    0.051   14.104    0.000
##    .Q049              0.726    0.053   13.746    0.000
##    .Q050              1.151    0.078   14.775    0.000
##    .Q051              1.091    0.074   14.834    0.000
##    .Q054              1.361    0.092   14.736    0.000
##    .Q014              0.854    0.057   14.866    0.000
##    .Q015              0.586    0.040   14.496    0.000
##    .Q016              0.714    0.048   14.814    0.000
##    .Q017              0.839    0.057   14.740    0.000
##    .Q018              0.586    0.041   14.383    0.000
##    .Q019              0.639    0.043   14.752    0.000
##    .Q020              0.646    0.044   14.507    0.000
##    .Q021              0.585    0.041   14.407    0.000
##    .Q022              0.555    0.038   14.465    0.000
##    .Q023              0.589    0.041   14.300    0.000
##    .Q024              0.401    0.029   14.026    0.000
##    .Q025              0.727    0.049   14.846    0.000
##    .Q026              0.610    0.042   14.554    0.000
##    .Q027              0.624    0.043   14.539    0.000
##    .Q028              0.561    0.039   14.435    0.000
##    .Q029              1.104    0.074   14.890    0.000
##    .Q032              0.605    0.042   14.307    0.000
##    .IWB               0.433    0.046    9.465    0.000
##    .IIR               0.209    0.029    7.087    0.000
##    .SFI               0.521    0.055    9.487    0.000
##     TFL               1.126    0.116    9.686    0.000
## 
## R-Square:
##                    Estimate
##     Q087              0.715
##     Q088              0.664
##     Q089              0.627
##     Q090              0.410
##     Q091              0.742
##     Q092              0.628
##     Q093              0.729
##     Q094              0.664
##     Q095              0.597
##     Q070              0.441
##     Q071              0.517
##     Q075              0.528
##     Q076              0.485
##     Q077              0.366
##     Q033              0.604
##     Q034              0.586
##     Q035              0.609
##     Q037              0.318
##     Q038              0.549
##     Q044              0.533
##     Q045              0.507
##     Q049              0.563
##     Q050              0.350
##     Q051              0.395
##     Q054              0.362
##     Q014              0.569
##     Q015              0.673
##     Q016              0.587
##     Q017              0.611
##     Q018              0.687
##     Q019              0.607
##     Q020              0.660
##     Q021              0.680
##     Q022              0.679
##     Q023              0.701
##     Q024              0.750
##     Q025              0.576
##     Q026              0.660
##     Q027              0.664
##     Q028              0.686
##     Q029              0.547
##     Q032              0.706
##     IWB               0.623
##     IIR               0.468
##     SFI               0.418
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)
##     DirEff            0.247    0.044    5.661    0.000
##     a1b1c1            0.245    0.034    7.312    0.000
##     a2c1              0.084    0.037    2.228    0.026
##     IndEff            0.329    0.041    8.025    0.000
##     TotEff            0.576    0.049   11.789    0.000
modInd <- modificationIndices(fit43, minimum.value = 10)
# head(modInd[order(modInd$mi, decreasing=TRUE), ], 10)
subset(modInd[order(modInd$mi, decreasing=TRUE), ], mi > 5)
##       lhs op  rhs    mi    epc sepc.lv sepc.all sepc.nox
## 109   IWB =~ Q076 26.22  0.340   0.364    0.346    0.346
## 186   SFI =~ Q071 23.59  0.334   0.316    0.289    0.289
## 518  Q094 ~~ Q017 18.37  0.162   0.162    0.211    0.211
## 716  Q033 ~~ Q037 18.34 -0.193  -0.193   -0.217   -0.217
## 217   TFL =~ Q071 18.14  0.203   0.216    0.198    0.198
## 1030 Q019 ~~ Q028 17.04 -0.120  -0.120   -0.201   -0.201
## 340  Q089 ~~ Q019 16.16  0.121   0.121    0.196    0.196
## 1041 Q020 ~~ Q029 16.14 -0.146  -0.146   -0.173   -0.173
## 795  Q037 ~~ Q050 14.45  0.215   0.215    0.172    0.172
## 335  Q089 ~~ Q014 14.38  0.131   0.131    0.184    0.184
## 791  Q037 ~~ Q038 14.34  0.187   0.187    0.188    0.188
## 1020 Q018 ~~ Q029 14.24  0.132   0.132    0.164    0.164
## 565  Q070 ~~ Q071 13.70  0.116   0.116    0.216    0.216
## 174   IIR =~ Q029 13.65 -0.353  -0.221   -0.142   -0.142
## 939  Q054 ~~ Q017 13.00  0.168   0.168    0.157    0.157
## 569  Q070 ~~ Q033 12.98  0.101   0.101    0.187    0.187
## 273  Q088 ~~ Q089 12.73 -0.112  -0.112   -0.184   -0.184
## 983  Q015 ~~ Q032 12.72  0.098   0.098    0.164    0.164
## 957  Q014 ~~ Q019 12.51  0.125   0.125    0.170    0.170
## 261  Q087 ~~ Q019 12.45  0.095   0.095    0.176    0.176
## 125   IWB =~ Q017 12.40  0.180   0.193    0.131    0.131
## 953  Q014 ~~ Q015 12.35  0.120   0.120    0.170    0.170
## 719  Q033 ~~ Q045 12.07  0.119   0.119    0.183    0.183
## 628  Q075 ~~ Q077 11.85  0.098   0.098    0.179    0.179
## 793  Q037 ~~ Q045 11.39 -0.163  -0.163   -0.166   -0.166
## 484  Q093 ~~ Q017 10.87  0.107   0.107    0.166    0.166
## 908  Q050 ~~ Q020 10.81 -0.124  -0.124   -0.144   -0.144
## 532  Q095 ~~ Q070 10.76  0.096   0.096    0.165    0.165
## 436  Q092 ~~ Q034 10.75  0.095   0.095    0.152    0.152
## 966  Q014 ~~ Q028 10.60 -0.109  -0.109   -0.158   -0.158
## 523  Q094 ~~ Q022 10.07 -0.098  -0.098   -0.158   -0.158
## 171   IIR =~ Q026 10.07 -0.245  -0.153   -0.114   -0.114
## 461  Q092 ~~ Q029 10.05 -0.114  -0.114   -0.144   -0.144
# Prepare PDF
# pdf("Model43.pdf", width = 25, height = 16)
par(mar=c(7, 1, 7, 1))
par(oma=c(1, 1, 1, 1))

# Prepare fitmeasures
ParDF  <- as.data.frame(do.call(cbind, fit43@ParTable))
DirEff <- round(as.numeric(ParDF[ParDF$label == "DirEff", 14]), 4)
TotEff <- round(as.numeric(ParDF[ParDF$label == "TotEff", 14]), 4)
n      <- fit43@SampleStats@ntotal

fitMeas <- toString(c("ChiSq: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit43, "chisq"))), 4),
                      " - DF: ", gsub("[^0-9.]", "", fitMeasures(fit43, "df")),
                      " - ChiSq/DF: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit43, "chisq")))/ as.numeric(gsub("[^0-9.]", "", fitMeasures(fit43, "df"))), 4),
                      " - CFI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit43, "cfi"))), 4),
                      " - TLI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit43, "tli"))), 4),
                      " - RMSEA: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit43, "rmsea"))), 4),
                      " - SRMR: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit43, "srmr"))), 4),
                      " - n: ", n,
                      " - DirEff: ", DirEff,
                      " - TotalEff: ", TotEff
                      ), 
                    width = 255)
fitMeas <- gsub(",", "", fitMeas)

# Plot model
library(semPlot)
semPaths(fit43, what = "stand", whatLabels = "stand", intercepts = FALSE, residuals = FALSE, edge.label.cex = 0.5, edge.color = "blue", layout = "tree", rotation = 3, curve = 1, curvePivot = TRUE, mar = c(3,1,5,1), sizeLat = 7, sizeMan = 4, color = colorlist)
title(main = "IIR Mediates Relationship TFL -> IWB, SFI Mediates TFL -> IIR - Model 43", cex.main = 2.5, col.main = "darkblue", font.main = 3, sub = fitMeas, cex.sub = 1.4)

# dev.off()

Direct effect of SFI to IWB is non-significant with p-value = 0.211.Therefore, it has been eliminated from the model. Instead, SFI is used as mediator for TFL on IIR. After this change, the model performs well. Direct effect of TFL on IWB is 0.24. Together with the indirect effects via SFI and IIR, the total effect of TFL on IWB is 0.576.

To check the model, Average Variance Extracted (AVE) is calculated. If AVE of factor is less than 0.5, more error variance than explained variance is experienced. Model is not good.

# Calculate AVE (R-Square)
inspect(fit43, "rsquare" )
##  Q087  Q088  Q089  Q090  Q091  Q092  Q093  Q094  Q095  Q070  Q071  Q075  Q076 
## 0.715 0.664 0.627 0.410 0.742 0.628 0.729 0.664 0.597 0.441 0.517 0.528 0.485 
##  Q077  Q033  Q034  Q035  Q037  Q038  Q044  Q045  Q049  Q050  Q051  Q054  Q014 
## 0.366 0.604 0.586 0.609 0.318 0.549 0.533 0.507 0.563 0.350 0.395 0.362 0.569 
##  Q015  Q016  Q017  Q018  Q019  Q020  Q021  Q022  Q023  Q024  Q025  Q026  Q027 
## 0.673 0.587 0.611 0.687 0.607 0.660 0.680 0.679 0.701 0.750 0.576 0.660 0.664 
##  Q028  Q029  Q032   IWB   IIR   SFI 
## 0.686 0.547 0.706 0.623 0.468 0.418

8.3 Model 43: Model Including IIR + SFI as Mediators - Using Estimator = “DWLS”

# Amending model for Mediation by IRR and SFI
library(lavaan)
model43 <- '

# latent variables
 IWB =~ Q087 + Q088 + Q089 + Q090 + Q091 + Q092 + Q093 + Q094 + Q095
 IIR =~ Q070 + Q071 + Q075 + Q076 + Q077 
 SFI =~ Q033 + Q034 + Q035 + Q037 + Q038 + Q044 + Q045 + Q049 + Q050 + Q051 + Q054
 TFL =~ Q014 + Q015 + Q016 + Q017 + Q018 + Q019 + Q020 + Q021 + Q022 + Q023 + Q024 + Q025 + Q026 + Q027 + Q028 + Q029 + Q032

# direct effect
 IWB ~ d1 * TFL
 DirEff := d1

# mediator
 SFI ~ a1 * TFL
 IIR ~ a2 * TFL
 IIR ~ b1 * SFI
 IWB ~ c1 * IIR

# indirect effect
 a1b1c1 := a1 * b1 * c1
 a2c1   := a2 * c1
 IndEff := a1b1c1 + a2c1

# total effect
 TotEff := d1 + (a1 * b1 * c1) + (a2 * c1)

# covariances
# Q029 ~~ Q032
# Q034 ~~ Q035
 Q018 ~~ Q020
 Q021 ~~ Q023
 Q029 ~~ Q032
 Q034 ~~ Q035
 Q075 ~~ Q076
 Q050 ~~ Q051
 Q051 ~~ Q054
 
'

# Calculate fit43a
fit43a <- sem(model43, data = DFs, estimator = "WLSMV")

# Print results (fit43a indices, parameters, hypothesis tests)
summary(fit43a, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6-12 ended normally after 62 iterations
## 
##   Estimator                                       DWLS
##   Optimization method                           NLMINB
##   Number of model parameters                        96
## 
##   Number of observations                           482
## 
## Model Test User Model:
##                                               Standard      Robust
##   Test Statistic                               440.878    1056.376
##   Degrees of freedom                               807         807
##   P-value (Chi-square)                           1.000       0.000
##   Scaling correction factor                                  0.891
##   Shift parameter                                          561.786
##     simple second-order correction                                
## 
## Model Test Baseline Model:
## 
##   Test statistic                             47751.538    5328.344
##   Degrees of freedom                               861         861
##   P-value                                        0.000       0.000
##   Scaling correction factor                                 10.496
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    1.000       0.944
##   Tucker-Lewis Index (TLI)                       1.008       0.940
##                                                                   
##   Robust Comparative Fit Index (CFI)                            NA
##   Robust Tucker-Lewis Index (TLI)                               NA
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.000       0.025
##   90 Percent confidence interval - lower         0.000       0.021
##   90 Percent confidence interval - upper         0.000       0.029
##   P-value RMSEA <= 0.05                          1.000       1.000
##                                                                   
##   Robust RMSEA                                                  NA
##   90 Percent confidence interval - lower                        NA
##   90 Percent confidence interval - upper                        NA
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.040       0.040
## 
## Parameter Estimates:
## 
##   Standard errors                           Robust.sem
##   Information                                 Expected
##   Information saturated (h1) model        Unstructured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB =~                                              
##     Q087              1.000                           
##     Q088              1.075    0.073   14.803    0.000
##     Q089              0.958    0.054   17.797    0.000
##     Q090              0.851    0.070   12.235    0.000
##     Q091              1.080    0.060   17.914    0.000
##     Q092              0.968    0.053   18.332    0.000
##     Q093              1.055    0.051   20.806    0.000
##     Q094              1.149    0.057   20.198    0.000
##     Q095              0.969    0.062   15.747    0.000
##   IIR =~                                              
##     Q070              1.000                           
##     Q071              1.381    0.142    9.691    0.000
##     Q075              1.201    0.124    9.697    0.000
##     Q076              1.196    0.116   10.340    0.000
##     Q077              0.875    0.144    6.087    0.000
##   SFI =~                                              
##     Q033              1.000                           
##     Q034              1.032    0.071   14.441    0.000
##     Q035              0.994    0.061   16.179    0.000
##     Q037              0.796    0.082    9.703    0.000
##     Q038              0.984    0.062   15.759    0.000
##     Q044              0.950    0.070   13.599    0.000
##     Q045              0.871    0.059   14.689    0.000
##     Q049              1.034    0.072   14.452    0.000
##     Q050              0.784    0.065   12.099    0.000
##     Q051              0.918    0.082   11.171    0.000
##     Q054              0.968    0.084   11.507    0.000
##   TFL =~                                              
##     Q014              1.000                           
##     Q015              1.019    0.054   18.959    0.000
##     Q016              0.963    0.062   15.562    0.000
##     Q017              1.151    0.065   17.591    0.000
##     Q018              1.113    0.064   17.487    0.000
##     Q019              0.942    0.050   18.769    0.000
##     Q020              1.091    0.060   18.250    0.000
##     Q021              1.079    0.059   18.294    0.000
##     Q022              1.040    0.066   15.799    0.000
##     Q023              1.135    0.063   17.955    0.000
##     Q024              1.066    0.052   20.521    0.000
##     Q025              0.934    0.059   15.951    0.000
##     Q026              1.016    0.058   17.656    0.000
##     Q027              1.068    0.059   18.157    0.000
##     Q028              1.066    0.058   18.306    0.000
##     Q029              1.074    0.068   15.777    0.000
##     Q032              1.170    0.063   18.691    0.000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB ~                                               
##     TFL       (d1)    0.275    0.055    4.961    0.000
##   SFI ~                                               
##     TFL       (a1)    0.585    0.062    9.504    0.000
##   IIR ~                                               
##     TFL       (a2)    0.081    0.041    1.980    0.048
##     SFI       (b1)    0.374    0.066    5.662    0.000
##   IWB ~                                               
##     IIR       (c1)    1.015    0.146    6.958    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .Q018 ~~                                             
##    .Q020              0.090    0.052    1.719    0.086
##  .Q021 ~~                                             
##    .Q023              0.103    0.052    1.993    0.046
##  .Q029 ~~                                             
##    .Q032              0.295    0.061    4.850    0.000
##  .Q034 ~~                                             
##    .Q035              0.186    0.052    3.552    0.000
##  .Q075 ~~                                             
##    .Q076              0.136    0.049    2.766    0.006
##  .Q050 ~~                                             
##    .Q051              0.359    0.087    4.133    0.000
##  .Q051 ~~                                             
##    .Q054              0.422    0.085    4.980    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .Q087              0.516    0.060    8.575    0.000
##    .Q088              0.611    0.094    6.510    0.000
##    .Q089              0.596    0.066    9.088    0.000
##    .Q090              0.890    0.103    8.638    0.000
##    .Q091              0.552    0.082    6.758    0.000
##    .Q092              0.525    0.072    7.265    0.000
##    .Q093              0.626    0.064    9.730    0.000
##    .Q094              0.659    0.078    8.479    0.000
##    .Q095              0.654    0.082    7.941    0.000
##    .Q070              0.494    0.058    8.578    0.000
##    .Q071              0.439    0.069    6.332    0.000
##    .Q075              0.593    0.067    8.862    0.000
##    .Q076              0.539    0.071    7.613    0.000
##    .Q077              0.555    0.069    8.025    0.000
##    .Q033              0.578    0.074    7.840    0.000
##    .Q034              0.665    0.067    9.962    0.000
##    .Q035              0.556    0.075    7.403    0.000
##    .Q037              1.413    0.116   12.167    0.000
##    .Q038              0.743    0.091    8.191    0.000
##    .Q044              0.778    0.073   10.718    0.000
##    .Q045              0.765    0.075   10.150    0.000
##    .Q049              0.695    0.074    9.441    0.000
##    .Q050              1.217    0.109   11.215    0.000
##    .Q051              1.060    0.100   10.642    0.000
##    .Q054              1.286    0.125   10.305    0.000
##    .Q014              0.895    0.145    6.158    0.000
##    .Q015              0.665    0.064   10.380    0.000
##    .Q016              0.725    0.080    9.081    0.000
##    .Q017              0.721    0.079    9.147    0.000
##    .Q018              0.529    0.060    8.825    0.000
##    .Q019              0.665    0.062   10.792    0.000
##    .Q020              0.607    0.063    9.574    0.000
##    .Q021              0.562    0.070    8.045    0.000
##    .Q022              0.556    0.087    6.396    0.000
##    .Q023              0.569    0.057    9.993    0.000
##    .Q024              0.367    0.046    8.028    0.000
##    .Q025              0.769    0.105    7.357    0.000
##    .Q026              0.674    0.083    8.145    0.000
##    .Q027              0.618    0.097    6.364    0.000
##    .Q028              0.552    0.052   10.670    0.000
##    .Q029              1.186    0.101   11.761    0.000
##    .Q032              0.576    0.063    9.095    0.000
##    .IWB               0.418    0.060    6.951    0.000
##    .IIR               0.225    0.059    3.839    0.000
##    .SFI               0.535    0.075    7.096    0.000
##     TFL               1.089    0.141    7.746    0.000
## 
## R-Square:
##                    Estimate
##     Q087              0.679
##     Q088              0.673
##     Q089              0.627
##     Q090              0.470
##     Q091              0.697
##     Q092              0.660
##     Q093              0.660
##     Q094              0.686
##     Q095              0.610
##     Q070              0.445
##     Q071              0.633
##     Q075              0.491
##     Q076              0.513
##     Q077              0.354
##     Q033              0.611
##     Q034              0.592
##     Q035              0.617
##     Q037              0.289
##     Q038              0.542
##     Q044              0.513
##     Q045              0.474
##     Q049              0.583
##     Q050              0.314
##     Q051              0.419
##     Q054              0.398
##     Q014              0.549
##     Q015              0.630
##     Q016              0.582
##     Q017              0.667
##     Q018              0.718
##     Q019              0.592
##     Q020              0.681
##     Q021              0.693
##     Q022              0.679
##     Q023              0.712
##     Q024              0.771
##     Q025              0.553
##     Q026              0.625
##     Q027              0.668
##     Q028              0.692
##     Q029              0.515
##     Q032              0.722
##     IWB               0.617
##     IIR               0.433
##     SFI               0.410
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)
##     DirEff            0.275    0.055    4.961    0.000
##     a1b1c1            0.222    0.044    5.037    0.000
##     a2c1              0.082    0.040    2.027    0.043
##     IndEff            0.304    0.050    6.018    0.000
##     TotEff            0.578    0.067    8.627    0.000
modInd <- modificationIndices(fit43a, minimum.value = 10)
# head(modInd[order(modInd$mi, decreasing=TRUE), ], 10)
subset(modInd[order(modInd$mi, decreasing=TRUE), ], mi > 5)
##     lhs op  rhs    mi    epc sepc.lv sepc.all sepc.nox
## 217 TFL =~ Q071 33.89  0.242   0.253    0.231    0.231
## 186 SFI =~ Q071 32.99  0.415   0.395    0.362    0.362
## 218 TFL =~ Q075 20.67 -0.169  -0.176   -0.163   -0.163
## 219 TFL =~ Q076 18.32 -0.156  -0.163   -0.155   -0.155
## 151 IIR =~ Q037 12.06 -0.418  -0.263   -0.187   -0.187
## 125 IWB =~ Q017 11.22  0.173   0.181    0.123    0.123
## 109 IWB =~ Q076 10.20  0.307   0.321    0.305    0.305
## 114 IWB =~ Q037 10.14 -0.170  -0.177   -0.126   -0.126
## 174 IIR =~ Q029 10.00 -0.294  -0.186   -0.119   -0.119
# Prepare PDF
# pdf("Model43.pdf", width = 25, height = 16)
par(mar=c(7, 1, 7, 1))
par(oma=c(1, 1, 1, 1))

# Prepare fitmeasures
ParDF  <- as.data.frame(do.call(cbind, fit43a@ParTable))
DirEff <- round(as.numeric(ParDF[ParDF$label == "DirEff", 14]), 4)
TotEff <- round(as.numeric(ParDF[ParDF$label == "TotEff", 14]), 4)
n      <- fit43a@SampleStats@ntotal

fitMeas <- toString(c("ChiSq: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit43a, "chisq"))), 4),
                      " - DF: ", gsub("[^0-9.]", "", fitMeasures(fit43a, "df")),
                      " - ChiSq/DF: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit43a, "chisq")))/ as.numeric(gsub("[^0-9.]", "", fitMeasures(fit43a, "df"))), 4),
                      " - CFI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit43a, "cfi"))), 4),
                      " - TLI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit43a, "tli"))), 4),
                      " - RMSEA: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit43a, "rmsea"))), 4),
                      " - SRMR: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit43a, "srmr"))), 4),
                      " - n: ", n,
                      " - DirEff: ", DirEff,
                      " - TotalEff: ", TotEff
                      ), 
                    width = 255)
fitMeas <- gsub(",", "", fitMeas)

# Plot model
library(semPlot)
semPaths(fit43a, what = "stand", whatLabels = "stand", intercepts = FALSE, residuals = FALSE, edge.label.cex = 0.5, edge.color = "blue", layout = "tree", rotation = 3, curve = 1, curvePivot = TRUE, mar = c(3,1,5,1), sizeLat = 7, sizeMan = 4, color = colorlist)
title(main = "IIR Mediates Relationship TFL -> IWB, SFI Mediates TFL -> IIR - Model 43 (DWLS)", cex.main = 2.5, col.main = "darkblue", font.main = 3, sub = fitMeas, cex.sub = 1.4)

# dev.off()

9 Adding Moderators:

9.1 Model 46: Model Including IIR as Mediator for TFL on IWB and SFI as Moderator for IIR on IWB

# Making Moderators
DFvar$SmT    <- DFvar$SFI * DFvar$TFL
DFvar$ImT    <- DFvar$IIR * DFvar$TFL
DFs$SmT      <- DFvar$SFI * DFvar$TFL
DFs$ImT      <- DFvar$IIR * DFvar$TFL

# Amending model for Moderation
library(lavaan)
model46 <- '

# latent variables
 IWB =~ Q087 + Q088 + Q089 + Q090 + Q091 + Q092 + Q093 + Q094 + Q095
 IIR =~ Q070 + Q071 + Q075 + Q076 + Q077 + Q081
 SFI =~ Q033 + Q034 + Q035 + Q037 + Q038 + Q044 + Q045 + Q049 + Q050 + Q051 + Q054
 TFL =~ Q014 + Q015 + Q016 + Q017 + Q018 + Q019 + Q020 + Q021 + Q022 + Q023 + Q024 + Q025 + Q026 + Q027 + Q028 + Q029 + Q032

# get moderator
 SxT =~ SmT

# direct effect
 IWB ~ d1 * TFL
 DirEff := d1

# mediator
 IIR ~ a1 * TFL
 IWB ~ a2 * IIR

# moderator effect TFL x SFI on IIR
 IIR ~ m2 * SxT
 IIR ~ m1 * SFI

# indirect effect
# a1b1c1 := a1 * b1 * c1
# a2c1   := a2 * c1
# IndEff := a1b1c1 + a2c1

# total effect
# TotEff := d1 + (a1 * b1 * c1) + (a2 * c1)

# covariances
 Q021 ~~ Q023
 Q029 ~~ Q032
 Q034 ~~ Q035
 Q018 ~~ Q020
 Q050 ~~ Q051
 Q051 ~~ Q054
'

# Calculate fit46
fit46 <- sem(model46, data = DFs)

# Print results (fit indices, parameters, hypothesis tests)
summary(fit46, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6-12 ended normally after 114 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                       101
## 
##   Number of observations                           482
## 
## Model Test User Model:
##                                                       
##   Test statistic                              1964.885
##   Degrees of freedom                               889
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                             18219.164
##   Degrees of freedom                               946
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.938
##   Tucker-Lewis Index (TLI)                       0.934
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -28138.687
##   Loglikelihood unrestricted model (H1)     -27156.244
##                                                       
##   Akaike (AIC)                               56479.373
##   Bayesian (BIC)                             56901.346
##   Sample-size adjusted Bayesian (BIC)        56580.781
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.050
##   90 Percent confidence interval - lower         0.047
##   90 Percent confidence interval - upper         0.053
##   P-value RMSEA <= 0.05                          0.472
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.047
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB =~                                              
##     Q087              1.000                           
##     Q088              1.040    0.047   22.290    0.000
##     Q089              0.935    0.044   21.332    0.000
##     Q090              0.775    0.049   15.716    0.000
##     Q091              1.085    0.044   24.464    0.000
##     Q092              0.920    0.043   21.324    0.000
##     Q093              1.081    0.045   24.119    0.000
##     Q094              1.103    0.049   22.343    0.000
##     Q095              0.935    0.046   20.532    0.000
##   IIR =~                                              
##     Q070              1.000                           
##     Q071              1.234    0.095   12.961    0.000
##     Q075              1.329    0.096   13.878    0.000
##     Q076              1.257    0.093   13.560    0.000
##     Q077              0.925    0.079   11.694    0.000
##     Q081              0.810    0.080   10.080    0.000
##   SFI =~                                              
##     Q033              1.000                           
##     Q034              1.035    0.062   16.658    0.000
##     Q035              0.990    0.059   16.901    0.000
##     Q037              0.959    0.070   13.768    0.000
##     Q038              1.033    0.062   16.670    0.000
##     Q044              1.011    0.062   16.423    0.000
##     Q045              0.908    0.059   15.379    0.000
##     Q049              1.063    0.063   16.954    0.000
##     Q050              0.953    0.066   14.540    0.000
##     Q051              1.052    0.066   15.920    0.000
##     Q054              1.085    0.072   15.139    0.000
##   TFL =~                                              
##     Q014              1.000                           
##     Q015              1.031    0.054   19.249    0.000
##     Q016              0.945    0.053   17.741    0.000
##     Q017              1.107    0.059   18.766    0.000
##     Q018              1.077    0.055   19.727    0.000
##     Q019              0.932    0.051   18.103    0.000
##     Q020              1.048    0.055   18.958    0.000
##     Q021              1.051    0.054   19.458    0.000
##     Q022              1.022    0.053   19.449    0.000
##     Q023              1.118    0.056   20.035    0.000
##     Q024              1.025    0.050   20.440    0.000
##     Q025              0.945    0.053   17.834    0.000
##     Q026              1.021    0.054   19.010    0.000
##     Q027              1.044    0.055   19.135    0.000
##     Q028              1.044    0.053   19.575    0.000
##     Q029              1.111    0.063   17.547    0.000
##     Q032              1.154    0.057   20.248    0.000
##   SxT =~                                              
##     SmT               1.000                           
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB ~                                               
##     TFL       (d1)    0.287    0.041    6.961    0.000
##   IIR ~                                               
##     TFL       (a1)    0.169    1.545    0.109    0.913
##   IWB ~                                               
##     IIR       (a2)    1.081    0.097   11.152    0.000
##   IIR ~                                               
##     SxT       (m2)   -0.024    0.336   -0.070    0.944
##     SFI       (m1)    0.518    1.693    0.306    0.760
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .Q021 ~~                                             
##    .Q023              0.119    0.029    4.156    0.000
##  .Q029 ~~                                             
##    .Q032              0.224    0.039    5.794    0.000
##  .Q034 ~~                                             
##    .Q035              0.283    0.036    7.866    0.000
##  .Q018 ~~                                             
##    .Q020              0.145    0.031    4.734    0.000
##  .Q050 ~~                                             
##    .Q051              0.209    0.045    4.691    0.000
##  .Q051 ~~                                             
##    .Q054              0.309    0.050    6.214    0.000
##   SFI ~~                                              
##     TFL               0.614    0.064    9.589    0.000
##     SxT               6.931    0.556   12.473    0.000
##   TFL ~~                                              
##     SxT               8.253    0.650   12.698    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .Q087              0.458    0.034   13.460    0.000
##    .Q088              0.629    0.045   13.898    0.000
##    .Q089              0.593    0.042   14.132    0.000
##    .Q090              0.990    0.066   14.954    0.000
##    .Q091              0.472    0.036   13.161    0.000
##    .Q092              0.575    0.041   14.134    0.000
##    .Q093              0.498    0.037   13.303    0.000
##    .Q094              0.701    0.050   13.884    0.000
##    .Q095              0.674    0.047   14.299    0.000
##    .Q070              0.510    0.037   13.820    0.000
##    .Q071              0.615    0.046   13.367    0.000
##    .Q075              0.493    0.040   12.386    0.000
##    .Q076              0.505    0.039   12.791    0.000
##    .Q077              0.533    0.038   14.133    0.000
##    .Q081              0.675    0.046   14.684    0.000
##    .Q033              0.671    0.045   15.047    0.000
##    .Q034              0.758    0.050   15.067    0.000
##    .Q035              0.655    0.044   15.036    0.000
##    .Q037              1.239    0.081   15.308    0.000
##    .Q038              0.752    0.050   15.074    0.000
##    .Q044              0.764    0.051   15.103    0.000
##    .Q045              0.781    0.051   15.203    0.000
##    .Q049              0.745    0.050   15.037    0.000
##    .Q050              1.034    0.068   15.261    0.000
##    .Q051              0.928    0.061   15.232    0.000
##    .Q054              1.176    0.077   15.219    0.000
##    .Q014              0.860    0.057   15.100    0.000
##    .Q015              0.601    0.040   14.878    0.000
##    .Q016              0.731    0.048   15.079    0.000
##    .Q017              0.785    0.052   14.953    0.000
##    .Q018              0.576    0.039   14.770    0.000
##    .Q019              0.653    0.043   15.039    0.000
##    .Q020              0.669    0.045   14.905    0.000
##    .Q021              0.590    0.040   14.814    0.000
##    .Q022              0.560    0.038   14.842    0.000
##    .Q023              0.569    0.039   14.696    0.000
##    .Q024              0.424    0.029   14.616    0.000
##    .Q025              0.716    0.047   15.069    0.000
##    .Q026              0.627    0.042   14.917    0.000
##    .Q027              0.635    0.043   14.897    0.000
##    .Q028              0.565    0.038   14.818    0.000
##    .Q029              1.055    0.070   15.081    0.000
##    .Q032              0.570    0.039   14.659    0.000
##    .SmT               0.000                           
##    .IWB               0.415    0.043    9.705    0.000
##    .IIR               0.217    0.031    7.097    0.000
##     SFI               0.811    0.086    9.450    0.000
##     TFL               1.120    0.116    9.686    0.000
##     SxT              72.893    4.695   15.524    0.000
## 
## R-Square:
##                    Estimate
##     Q087              0.714
##     Q088              0.663
##     Q089              0.628
##     Q090              0.410
##     Q091              0.741
##     Q092              0.628
##     Q093              0.729
##     Q094              0.665
##     Q095              0.598
##     Q070              0.427
##     Q071              0.485
##     Q075              0.577
##     Q076              0.543
##     Q077              0.379
##     Q081              0.270
##     Q033              0.547
##     Q034              0.534
##     Q035              0.548
##     Q037              0.376
##     Q038              0.535
##     Q044              0.520
##     Q045              0.461
##     Q049              0.551
##     Q050              0.416
##     Q051              0.492
##     Q054              0.448
##     Q014              0.566
##     Q015              0.665
##     Q016              0.578
##     Q017              0.636
##     Q018              0.693
##     Q019              0.598
##     Q020              0.648
##     Q021              0.677
##     Q022              0.676
##     Q023              0.711
##     Q024              0.735
##     Q025              0.583
##     Q026              0.651
##     Q027              0.658
##     Q028              0.684
##     Q029              0.567
##     Q032              0.724
##     SmT               1.000
##     IWB               0.637
##     IIR               0.429
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)
##     DirEff            0.287    0.041    6.961    0.000
modInd <- modificationIndices(fit46, minimum.value = 10)
# head(modInd[order(modInd$mi, decreasing=TRUE), ], 10)
subset(modInd[order(modInd$mi, decreasing=TRUE), ], mi > 10)
##       lhs op  rhs    mi    epc sepc.lv sepc.all sepc.nox
## 252   SxT =~ Q071 26.45  0.032   0.277    0.253    0.253
## 830  Q033 ~~ Q045 26.09  0.174   0.174    0.240    0.240
## 225   TFL =~ Q071 22.05  0.210   0.222    0.203    0.203
## 1136 Q017 ~~  SmT 21.48  0.312   0.312       NA       NA
## 827  Q033 ~~ Q037 20.39 -0.192  -0.192   -0.211   -0.211
## 1056 Q051 ~~  SmT 19.61  0.327   0.327       NA       NA
## 636  Q070 ~~ Q071 18.86  0.131   0.131    0.233    0.233
## 1074 Q054 ~~  SmT 18.11  0.358   0.358       NA       NA
## 703  Q075 ~~ Q076 17.58  0.128   0.128    0.257    0.257
## 1169 Q020 ~~ Q029 17.44 -0.151  -0.151   -0.180   -0.180
## 398  Q089 ~~ Q019 17.32  0.125   0.125    0.201    0.201
## 641  Q070 ~~ Q033 17.24  0.118   0.118    0.202    0.202
## 156   IIR =~ Q037 16.53 -0.518  -0.319   -0.227   -0.227
## 192   SFI =~ Q071 16.41  0.254   0.229    0.209    0.209
## 112   IWB =~ Q076 15.78  0.258   0.276    0.263    0.263
## 393  Q089 ~~ Q014 15.62  0.136   0.136    0.191    0.191
## 1226  IWB ~~  SFI 15.43 -0.045  -0.077   -0.077   -0.077
## 1243  SFI  ~  IWB 15.43 -0.107  -0.127   -0.127   -0.127
## 640  Q070 ~~ Q081 15.39  0.115   0.115    0.197    0.197
## 586  Q094 ~~ Q017 15.12  0.141   0.141    0.190    0.190
## 179   IIR =~ Q029 14.81 -0.355  -0.218   -0.140   -0.140
## 929  Q037 ~~  SmT 14.68  0.343   0.343       NA       NA
## 907  Q037 ~~ Q045 14.14 -0.172  -0.172   -0.175   -0.175
## 1079 Q014 ~~ Q019 13.99  0.132   0.132    0.176    0.176
## 1075 Q014 ~~ Q015 13.75  0.126   0.126    0.175    0.175
## 572  Q094 ~~ Q033 13.63 -0.123  -0.123   -0.179   -0.179
## 993  Q045 ~~ Q026 13.40  0.120   0.120    0.172    0.172
## 671  Q071 ~~ Q076 13.38 -0.117  -0.117   -0.209   -0.209
## 143   IWB =~  SmT 13.25  0.480   0.513    0.060    0.060
## 153   IIR =~ Q033 13.22  0.353   0.218    0.179    0.179
## 591  Q094 ~~ Q022 13.19 -0.112  -0.112   -0.178   -0.178
## 826  Q033 ~~ Q035 13.08  0.103   0.103    0.155    0.155
## 1157 Q019 ~~ Q028 12.90 -0.104  -0.104   -0.171   -0.171
## 328  Q088 ~~ Q089 12.87 -0.113  -0.113   -0.184   -0.184
## 1228  IWB ~~  SxT 12.86  0.194   0.035    0.035    0.035
## 1239  SxT  ~  IWB 12.86  0.467   0.059    0.059    0.059
## 638  Q070 ~~ Q076 12.79 -0.101  -0.101   -0.199   -0.199
## 118   IWB =~ Q037 12.27 -0.219  -0.235   -0.167   -0.167
## 315  Q087 ~~ Q019 12.15  0.094   0.094    0.172    0.172
## 500  Q092 ~~ Q034 12.05  0.100   0.100    0.152    0.152
## 226   TFL =~ Q075 11.64 -0.144  -0.153   -0.142   -0.142
## 1106 Q015 ~~ Q032 11.57  0.091   0.091    0.155    0.155
## 742  Q076 ~~ Q044 11.55 -0.106  -0.106   -0.170   -0.170
## 559  Q093 ~~ Q026 11.51 -0.095  -0.095   -0.169   -0.169
## 1027 Q050 ~~ Q020 11.16 -0.122  -0.122   -0.147   -0.147
## 852  Q033 ~~  SmT 11.06 -0.239  -0.239       NA       NA
## 1161 Q020 ~~ Q021 11.03  0.093   0.093    0.148    0.148
## 890  Q035 ~~ Q017 10.86 -0.101  -0.101   -0.141   -0.141
## 518  Q092 ~~ Q022 10.84  0.091   0.091    0.160    0.160
## 176   IIR =~ Q026 10.48 -0.246  -0.151   -0.113   -0.113
## 856  Q034 ~~ Q045 10.43  0.106   0.106    0.137    0.137
## 1227  IWB ~~  TFL 10.43 -0.035  -0.051   -0.051   -0.051
## 1235  TFL  ~  IWB 10.43 -0.084  -0.085   -0.085   -0.085
## 1146 Q018 ~~ Q029 10.40  0.109   0.109    0.140    0.140
## 873  Q034 ~~ Q026 10.37  0.095   0.095    0.138    0.138
## 403  Q089 ~~ Q024 10.18  0.078   0.078    0.156    0.156
## 253   SxT =~ Q075 10.17 -0.019  -0.163   -0.151   -0.151
## 601  Q095 ~~ Q070 10.14  0.093   0.093    0.159    0.159
## 676  Q071 ~~ Q035 10.11  0.090   0.090    0.142    0.142
# Prepare PDF
# pdf("Model46.pdf", width = 25, height = 16)
par(mar=c(7, 1, 7, 1))
par(oma=c(1, 1, 1, 1))

# Prepare fitmeasures
ParDF  <- as.data.frame(do.call(cbind, fit46@ParTable))
DirEff <- round(as.numeric(ParDF[ParDF$label == "DirEff", 14]), 4)
TotEff <- round(as.numeric(ParDF[ParDF$label == "TotEff", 14]), 4)
n      <- fit46@SampleStats@ntotal

fitMeas <- toString(c("ChiSq: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit46, "chisq"))), 4),
                      " - DF: ", gsub("[^0-9.]", "", fitMeasures(fit46, "df")),
                      " - ChiSq/DF: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit46, "chisq")))/ as.numeric(gsub("[^0-9.]", "", fitMeasures(fit46, "df"))), 4),
                      " - CFI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit46, "cfi"))), 4),
                      " - TLI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit46, "tli"))), 4),
                      " - RMSEA: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit46, "rmsea"))), 4),
                      " - SRMR: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit46, "srmr"))), 4),
                      " - n: ", n,
                      " - DirEff: ", DirEff,
                      " - TotalEff: ", TotEff
                      ), 
                    width = 255)
fitMeas <- gsub(",", "", fitMeas)

# Plot model
library(semPlot)
semPaths(fit46, what = "stand", whatLabels = "stand", intercepts = FALSE, residuals = FALSE, edge.label.cex = 0.5, edge.color = "blue", layout = "tree", rotation = 3, curve = 1, curvePivot = TRUE, mar = c(3,1,5,1), sizeLat = 7, sizeMan = 3, color = colorlist)
title(main = "IIR Mediates Relationship TFL -> IWB, SFI Moderates TFL -> IIR - Model 46", cex.main = 2.5, col.main = "darkblue", font.main = 3, sub = fitMeas, cex.sub = 1.4)

# dev.off()

Model 46 shows Mediation of IIR on TFL to IWB and Moderation of the connection between TFL and IIR. However, this model does not seem to be useful since the effect of TFL on IIR, SxT on IIR and SFI on IIR TFL are insignificant with p-values above 0.7. This model is not helpful.

9.2 Model 47: Model Including SFI as Mediator for TFL on IWB and IIR as Moderator for SFI on IWB

# Amending model for Moderation
library(lavaan)
model47 <- '

# latent variables
 IWB =~ Q087 + Q088 + Q089 + Q090 + Q091 + Q092 + Q093 + Q094 + Q095
 SFI =~ Q033 + Q034 + Q035 + Q037 + Q038 + Q044 + Q045 + Q049 + Q050 + Q051 + Q054
 TFL =~ Q014 + Q015 + Q016 + Q017 + Q018 + Q019 + Q020 + Q021 + Q022 + Q023 + Q024 + Q025 + Q026 + Q027 + Q028 + Q029 + Q032
 IIR =~ Q070 + Q071 + Q075 + Q076 + Q077 + Q081

# get moderator
 IxT =~ ImT

# direct effect
 IWB ~ d1 * TFL
 DirEff := d1

# mediator
 SFI ~ a1 * TFL
 IWB ~ a2 * SFI

# moderator effect TFL x IIR on SFI
 SFI ~ m2 * IxT
 SFI ~ m1 * IIR

# indirect effect
# a1b1c1 := a1 * b1 * c1
# a2c1   := a2 * c1
# IndEff := a1b1c1 + a2c1

# total effect
# TotEff := d1 + (a1 * b1 * c1) + (a2 * c1)

# covariances
 Q021 ~~ Q023
 Q029 ~~ Q032
 Q034 ~~ Q035
 Q018 ~~ Q020
 Q050 ~~ Q051
 Q051 ~~ Q054
 Q075 ~~ Q076
 
'
 
# Calculate fit47
fit47 <- sem(model47, data = DFs, estimator = "WLSMV")  # , se = "bootstrap", bootstrap = 10000

# Print results (fit indices, parameters, hypothesis tests)
summary(fit47, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6-12 ended normally after 156 iterations
## 
##   Estimator                                       DWLS
##   Optimization method                           NLMINB
##   Number of model parameters                       102
## 
##   Number of observations                           482
## 
## Model Test User Model:
##                                               Standard      Robust
##   Test Statistic                               863.910    1435.030
##   Degrees of freedom                               888         888
##   P-value (Chi-square)                           0.713       0.000
##   Scaling correction factor                                  1.121
##   Shift parameter                                          664.564
##     simple second-order correction                                
## 
## Model Test Baseline Model:
## 
##   Test statistic                             53841.212    5808.068
##   Degrees of freedom                               946         946
##   P-value                                        0.000       0.000
##   Scaling correction factor                                 10.879
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    1.000       0.887
##   Tucker-Lewis Index (TLI)                       1.000       0.880
##                                                                   
##   Robust Comparative Fit Index (CFI)                            NA
##   Robust Tucker-Lewis Index (TLI)                               NA
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.000       0.036
##   90 Percent confidence interval - lower         0.000       0.032
##   90 Percent confidence interval - upper         0.011       0.039
##   P-value RMSEA <= 0.05                          1.000       1.000
##                                                                   
##   Robust RMSEA                                                  NA
##   90 Percent confidence interval - lower                        NA
##   90 Percent confidence interval - upper                        NA
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.053       0.053
## 
## Parameter Estimates:
## 
##   Standard errors                           Robust.sem
##   Information                                 Expected
##   Information saturated (h1) model        Unstructured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB =~                                              
##     Q087              1.000                           
##     Q088              1.076    0.073   14.725    0.000
##     Q089              0.961    0.054   17.816    0.000
##     Q090              0.855    0.070   12.148    0.000
##     Q091              1.078    0.061   17.705    0.000
##     Q092              0.968    0.053   18.105    0.000
##     Q093              1.056    0.051   20.579    0.000
##     Q094              1.149    0.057   20.068    0.000
##     Q095              0.974    0.062   15.764    0.000
##   SFI =~                                              
##     Q033              1.000                           
##     Q034              1.018    0.071   14.336    0.000
##     Q035              0.974    0.060   16.205    0.000
##     Q037              0.776    0.083    9.372    0.000
##     Q038              0.966    0.062   15.658    0.000
##     Q044              0.936    0.070   13.417    0.000
##     Q045              0.864    0.059   14.663    0.000
##     Q049              1.016    0.071   14.290    0.000
##     Q050              0.760    0.065   11.732    0.000
##     Q051              0.908    0.082   11.144    0.000
##     Q054              0.963    0.084   11.463    0.000
##   TFL =~                                              
##     Q014              1.000                           
##     Q015              1.015    0.053   19.290    0.000
##     Q016              0.960    0.061   15.811    0.000
##     Q017              1.144    0.064   17.874    0.000
##     Q018              1.111    0.063   17.751    0.000
##     Q019              0.943    0.049   19.104    0.000
##     Q020              1.091    0.059   18.628    0.000
##     Q021              1.075    0.058   18.632    0.000
##     Q022              1.036    0.065   16.055    0.000
##     Q023              1.130    0.062   18.323    0.000
##     Q024              1.063    0.051   20.939    0.000
##     Q025              0.932    0.057   16.320    0.000
##     Q026              1.009    0.056   17.924    0.000
##     Q027              1.063    0.058   18.428    0.000
##     Q028              1.059    0.057   18.648    0.000
##     Q029              1.067    0.067   15.965    0.000
##     Q032              1.162    0.061   19.028    0.000
##   IIR =~                                              
##     Q070              1.000                           
##     Q071              1.380    0.139    9.915    0.000
##     Q075              1.166    0.118    9.843    0.000
##     Q076              1.148    0.110   10.430    0.000
##     Q077              0.869    0.138    6.287    0.000
##     Q081              0.713    0.115    6.221    0.000
##   IxT =~                                              
##     ImT               1.000                           
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB ~                                               
##     TFL       (d1)    0.120    0.100    1.197    0.231
##   SFI ~                                               
##     TFL       (a1)   -0.910    0.262   -3.474    0.001
##   IWB ~                                               
##     SFI       (a2)    0.767    0.105    7.288    0.000
##   SFI ~                                               
##     IxT       (m2)    0.226    0.047    4.813    0.000
##     IIR       (m1)   -0.427    0.208   -2.053    0.040
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .Q021 ~~                                             
##    .Q023              0.105    0.051    2.065    0.039
##  .Q029 ~~                                             
##    .Q032              0.304    0.061    4.962    0.000
##  .Q034 ~~                                             
##    .Q035              0.376    0.066    5.737    0.000
##  .Q018 ~~                                             
##    .Q020              0.082    0.051    1.589    0.112
##  .Q050 ~~                                             
##    .Q051              0.496    0.086    5.784    0.000
##  .Q051 ~~                                             
##    .Q054              0.575    0.081    7.106    0.000
##  .Q075 ~~                                             
##    .Q076              0.161    0.051    3.158    0.002
##   TFL ~~                                              
##     IIR               0.337    0.060    5.593    0.000
##     IxT               7.935    0.718   11.051    0.000
##   IIR ~~                                              
##     IxT               4.288    0.536    8.007    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .Q087              0.519    0.061    8.494    0.000
##    .Q088              0.613    0.094    6.486    0.000
##    .Q089              0.593    0.065    9.064    0.000
##    .Q090              0.885    0.104    8.513    0.000
##    .Q091              0.560    0.083    6.745    0.000
##    .Q092              0.527    0.074    7.124    0.000
##    .Q093              0.627    0.066    9.567    0.000
##    .Q094              0.662    0.079    8.377    0.000
##    .Q095              0.646    0.083    7.804    0.000
##    .Q033              0.739    0.074    9.996    0.000
##    .Q034              0.856    0.076   11.263    0.000
##    .Q035              0.744    0.081    9.199    0.000
##    .Q037              1.539    0.112   13.704    0.000
##    .Q038              0.924    0.097    9.517    0.000
##    .Q044              0.943    0.079   11.880    0.000
##    .Q045              0.896    0.083   10.799    0.000
##    .Q049              0.894    0.082   10.946    0.000
##    .Q050              1.343    0.105   12.785    0.000
##    .Q051              1.208    0.097   12.433    0.000
##    .Q054              1.445    0.117   12.369    0.000
##    .Q014              0.887    0.144    6.151    0.000
##    .Q015              0.665    0.064   10.434    0.000
##    .Q016              0.722    0.079    9.124    0.000
##    .Q017              0.727    0.078    9.265    0.000
##    .Q018              0.524    0.060    8.796    0.000
##    .Q019              0.655    0.060   10.838    0.000
##    .Q020              0.597    0.062    9.599    0.000
##    .Q021              0.563    0.069    8.107    0.000
##    .Q022              0.556    0.086    6.466    0.000
##    .Q023              0.573    0.057   10.071    0.000
##    .Q024              0.365    0.045    8.028    0.000
##    .Q025              0.768    0.103    7.424    0.000
##    .Q026              0.681    0.084    8.130    0.000
##    .Q027              0.620    0.097    6.412    0.000
##    .Q028              0.558    0.052   10.806    0.000
##    .Q029              1.195    0.101   11.858    0.000
##    .Q032              0.585    0.064    9.190    0.000
##    .Q070              0.483    0.055    8.740    0.000
##    .Q071              0.419    0.060    6.969    0.000
##    .Q075              0.611    0.067    9.121    0.000
##    .Q076              0.569    0.070    8.122    0.000
##    .Q077              0.551    0.068    8.062    0.000
##    .Q081              0.718    0.066   10.871    0.000
##    .ImT               0.000                           
##    .IWB               0.514    0.071    7.257    0.000
##    .SFI               0.207    0.053    3.879    0.000
##     TFL               1.097    0.140    7.853    0.000
##     IIR               0.408    0.081    5.032    0.000
##     IxT              66.402    4.211   15.770    0.000
## 
## R-Square:
##                    Estimate
##     Q087              0.677
##     Q088              0.673
##     Q089              0.629
##     Q090              0.473
##     Q091              0.693
##     Q092              0.660
##     Q093              0.659
##     Q094              0.684
##     Q095              0.615
##     Q033              0.503
##     Q034              0.475
##     Q035              0.488
##     Q037              0.226
##     Q038              0.430
##     Q044              0.409
##     Q045              0.383
##     Q049              0.463
##     Q050              0.243
##     Q051              0.338
##     Q054              0.324
##     Q014              0.553
##     Q015              0.630
##     Q016              0.584
##     Q017              0.664
##     Q018              0.721
##     Q019              0.598
##     Q020              0.686
##     Q021              0.692
##     Q022              0.680
##     Q023              0.709
##     Q024              0.773
##     Q025              0.554
##     Q026              0.621
##     Q027              0.666
##     Q028              0.688
##     Q029              0.511
##     Q032              0.717
##     Q070              0.458
##     Q071              0.650
##     Q075              0.476
##     Q076              0.486
##     Q077              0.358
##     Q081              0.224
##     ImT               1.000
##     IWB               0.528
##     SFI               0.722
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)
##     DirEff            0.120    0.100    1.197    0.231
modInd <- modificationIndices(fit47, minimum.value = 10)
# head(modInd[order(modInd$mi, decreasing=TRUE), ], 10)
subset(modInd[order(modInd$mi, decreasing=TRUE), ], mi > 10)
##       lhs op  rhs     mi    epc sepc.lv sepc.all sepc.nox
## 1234  SFI  ~  IWB 373.55 -0.812  -0.980   -0.980   -0.980
## 1225  IWB ~~  SFI 373.54 -0.417  -1.278   -1.278   -1.278
## 1232  IWB  ~  IxT 373.29  0.371   2.900    2.900    2.900
## 1243  IIR  ~  IWB 350.08  0.468   0.764    0.764    0.764
## 1227  IWB ~~  IIR 350.08  0.240   0.525    0.525    0.525
## 1233  IWB  ~  IIR 324.11  3.371   2.065    2.065    2.065
## 1239  IxT  ~  IWB 312.83 -3.244  -0.415   -0.415   -0.415
## 1228  IWB ~~  IxT 312.82 -1.666  -0.285   -0.285   -0.285
## 1235  TFL  ~  IWB 291.73  0.624   0.621    0.621    0.621
## 1226  IWB ~~  TFL 291.72  0.320   0.427    0.427    0.427
## 141   IWB =~ Q076  72.81  0.468   0.488    0.464    0.464
## 140   IWB =~ Q075  43.97  0.369   0.385    0.356    0.356
## 116   IWB =~ Q045  30.11 -0.386  -0.402   -0.334   -0.334
## 112   IWB =~ Q035  25.76 -0.346  -0.361   -0.299   -0.299
## 199   TFL =~ Q071  20.51  0.188   0.197    0.181    0.181
## 172   SFI =~ Q071  20.01  0.710   0.614    0.561    0.561
## 115   IWB =~ Q044  19.94 -0.315  -0.329   -0.260   -0.260
## 281   IxT =~ Q071  19.92  0.033   0.265    0.243    0.243
## 113   IWB =~ Q037  19.29 -0.321  -0.334   -0.237   -0.237
## 216   IIR =~ Q035  19.19 -0.936  -0.598   -0.496   -0.496
## 114   IWB =~ Q038  18.48 -0.310  -0.323   -0.254   -0.254
## 739  Q037 ~~ Q050  15.32  0.419   0.419    0.291    0.291
## 142   IWB =~ Q077  15.25  0.177   0.185    0.199    0.199
## 282   IxT =~ Q075  15.11 -0.025  -0.205   -0.190   -0.190
## 200   TFL =~ Q075  14.20 -0.139  -0.146   -0.135   -0.135
## 278   IxT =~ Q029  14.06 -0.064  -0.518   -0.331   -0.331
## 111   IWB =~ Q034  13.90 -0.275  -0.287   -0.224   -0.224
## 260   IxT =~ Q050  13.83 -0.043  -0.353   -0.265   -0.265
## 189   TFL =~ Q035  13.14  0.204   0.213    0.177    0.177
## 144   IWB =~  ImT  12.88  1.747   1.822    0.224    0.224
## 562  Q093 ~~ Q076  12.44  0.284   0.284    0.475    0.475
## 325  Q087 ~~ Q076  12.25  0.270   0.270    0.497    0.497
## 735  Q037 ~~ Q038  12.23  0.364   0.364    0.305    0.305
## 139   IWB =~ Q071  12.19  0.210   0.219    0.201    0.201
## 124   IWB =~ Q017  12.11  0.183   0.191    0.130    0.130
## 598  Q094 ~~ Q076  12.05  0.276   0.276    0.449    0.449
## 240   IIR =~ Q029  11.89 -0.315  -0.201   -0.129   -0.129
## 110   IWB =~ Q033  11.64 -0.232  -0.242   -0.199   -0.199
## 246   IxT =~ Q090  11.32  0.021   0.175    0.135    0.135
## 283   IxT =~ Q076  11.29 -0.021  -0.172   -0.164   -0.164
## 217   IIR =~ Q037  11.17 -0.748  -0.478   -0.339   -0.339
## 486  Q091 ~~ Q075  10.07  0.248   0.248    0.424    0.424
# Prepare PDF
# pdf("Model47.pdf", width = 25, height = 16)
par(mar=c(7, 1, 7, 1))
par(oma=c(1, 1, 1, 1))

# Prepare fitmeasures
ParDF <- as.data.frame(do.call(cbind, fit47@ParTable))
DirEff <- round(as.numeric(ParDF[ParDF$label == "DirEff", 14]), 4)
TotEff <- round(as.numeric(ParDF[ParDF$label == "TotEff", 14]), 4)
n      <- fit47@SampleStats@ntotal

fitMeas <- toString(c("ChiSq: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit47, "chisq"))), 4),
                      " - DF: ", gsub("[^0-9.]", "", fitMeasures(fit47, "df")),
                      " - ChiSq/DF: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit47, "chisq")))/ as.numeric(gsub("[^0-9.]", "", fitMeasures(fit47, "df"))), 4),
                      " - CFI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit47, "cfi"))), 4),
                      " - TLI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit47, "tli"))), 4),
                      " - RMSEA: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit47, "rmsea"))), 4),
                      " - SRMR: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit47, "srmr"))), 4),
                      " - n: ", n,
                      " - DirEff: ", DirEff,
                      " - TotalEff: ", TotEff
                      ), 
                    width = 255)
fitMeas <- gsub(",", "", fitMeas)

# Plot model
library(semPlot)
semPaths(fit47, what = "stand", whatLabels = "stand", intercepts = FALSE, residuals = FALSE, edge.label.cex = 0.5, edge.color = "blue", layout = "tree", rotation = 3, curve = 1, curvePivot = TRUE, mar = c(3,1,5,1), sizeLat = 7, sizeMan = 3, color = colorlist)
title(main = "SFI Mediates Relationship TFL -> IWB, IIR Moderates TFL -> SFI - Model 47", cex.main = 2.5, col.main = "darkblue", font.main = 3, sub = fitMeas, cex.sub = 1.4)

# dev.off()

Model 47 shows Mediation of SFI on TFL to IWB and Moderation of the connection between TFL and SFI by IIR. However, this model does not seem to be useful since the effects of TFL on SFI and IIR on SFI are strong negative. This does not seem to be practical since the total effect of TFL on IWB would drop significantly. This model is not helpful.

9.3 Determine Fit Measures for Moderated Models

# Compare fit measures
cbind("Good Fit"          = round(inspect(fit43, 'fit.measures'), 4), 
      "Good fit (DWLS)"   = round(inspect(fit43a, 'fit.measures'), 4),
      "SFI as Moderator"  = round(inspect(fit46, 'fit.measures'), 4),
      "IIR as Moderator"  = round(inspect(fit47, 'fit.measures'), 4)
      )
##                                 Good Fit Good fit (DWLS) SFI as Moderator
## npar                           9.600e+01       9.600e+01        1.010e+02
## fmin                           1.748e+00       4.573e-01        2.038e+00
## chisq                          1.685e+03       4.409e+02        1.965e+03
## df                             8.070e+02       8.070e+02        8.890e+02
## pvalue                         0.000e+00       1.000e+00        0.000e+00
## chisq.scaled                   1.623e+04       1.056e+03        1.822e+04
## df.scaled                      8.610e+02       8.070e+02        9.460e+02
## pvalue.scaled                  0.000e+00       0.000e+00        0.000e+00
## chisq.scaling.factor           9.429e-01       8.914e-01        9.377e-01
## baseline.chisq                 9.390e-01       4.775e+04        9.337e-01
## baseline.df                    9.390e-01       8.610e+02        9.337e-01
## baseline.pvalue                8.892e-01       0.000e+00        8.852e-01
## baseline.chisq.scaled          8.962e-01       5.328e+03        8.922e-01
## baseline.df.scaled             8.400e-01       8.610e+02        8.384e-01
## baseline.pvalue.scaled         9.431e-01       0.000e+00        9.379e-01
## baseline.chisq.scaling.factor  9.429e-01       1.050e+01        9.377e-01
## cfi                           -2.661e+04       1.000e+00       -2.814e+04
## tli                           -2.577e+04       1.008e+00       -2.716e+04
## nnfi                           5.341e+04       1.008e+00        5.648e+04
## rfi                            5.381e+04       9.901e-01        5.690e+04
## nfi                            4.820e+02       9.908e-01        4.820e+02
## pnfi                           5.351e+04       9.286e-01        5.658e+04
## ifi                            4.750e-02       1.008e+00        5.010e-02
## rni                            4.430e-02       1.008e+00        4.710e-02
## cfi.scaled                     5.070e-02       9.442e-01        5.310e-02
## tli.scaled                     8.995e-01       9.404e-01        4.716e-01
## cfi.robust                     7.060e-02              NA        9.560e-02
## tli.robust                     7.060e-02              NA        9.560e-02
## nnfi.scaled                    4.280e-02       9.404e-01        4.680e-02
## nnfi.robust                    4.280e-02              NA        4.680e-02
## rfi.scaled                     4.280e-02       7.885e-01        4.680e-02
## nfi.scaled                     4.380e-02       8.017e-01        4.790e-02
## ifi.scaled                     4.380e-02       9.448e-01        4.790e-02
## rni.scaled                     4.270e-02       9.442e-01        4.680e-02
## rni.robust                     4.270e-02              NA        4.680e-02
## rmsea                          2.510e+02       0.000e+00        2.364e+02
## rmsea.ci.lower                 2.594e+02       0.000e+00        2.439e+02
## rmsea.ci.upper                 8.456e-01       0.000e+00        8.239e-01
## rmsea.pvalue                   8.272e-01       1.000e+00        8.039e-01
## rmsea.scaled                   7.557e-01       2.530e-02        7.399e-01
## rmsea.ci.lower.scaled          4.021e-01       2.090e-02        3.276e-01
## rmsea.ci.upper.scaled          3.894e+00       2.950e-02        4.496e+00
## rmsea.pvalue.scaled            9.600e+01       1.000e+00        1.010e+02
## rmsea.robust                   1.748e+00              NA        2.038e+00
## rmsea.ci.lower.robust          1.685e+03              NA        1.965e+03
## rmsea.ci.upper.robust          8.070e+02              NA        8.890e+02
## rmsea.pvalue.robust            0.000e+00              NA        0.000e+00
## rmr                            1.623e+04       6.540e-02        1.822e+04
## rmr_nomean                     8.610e+02       6.540e-02        9.460e+02
## srmr                           0.000e+00       3.960e-02        0.000e+00
## srmr_bentler                   9.429e-01       3.960e-02        9.377e-01
## srmr_bentler_nomean            9.390e-01       3.960e-02        9.337e-01
## crmr                           9.390e-01       4.060e-02        9.337e-01
## crmr_nomean                    8.892e-01       4.060e-02        8.852e-01
## srmr_mplus                     8.962e-01       3.960e-02        8.922e-01
## srmr_mplus_nomean              8.400e-01       3.960e-02        8.384e-01
## cn_05                          9.431e-01       9.548e+02        9.379e-01
## cn_01                          9.429e-01       9.866e+02        9.377e-01
## gfi                           -2.661e+04       9.922e-01       -2.814e+04
## agfi                          -2.577e+04       9.913e-01       -2.716e+04
## pgfi                           5.341e+04       8.868e-01        5.648e+04
## mfi                            5.381e+04       1.463e+00        5.690e+04
## ecvi                           4.820e+02       1.316e+00        4.820e+02
##                               IIR as Moderator
## npar                                 1.020e+02
## fmin                                 8.962e-01
## chisq                                8.639e+02
## df                                   8.880e+02
## pvalue                               7.126e-01
## chisq.scaled                         1.435e+03
## df.scaled                            8.880e+02
## pvalue.scaled                        0.000e+00
## chisq.scaling.factor                 1.121e+00
## baseline.chisq                       5.384e+04
## baseline.df                          9.460e+02
## baseline.pvalue                      0.000e+00
## baseline.chisq.scaled                5.808e+03
## baseline.df.scaled                   9.460e+02
## baseline.pvalue.scaled               0.000e+00
## baseline.chisq.scaling.factor        1.088e+01
## cfi                                  1.000e+00
## tli                                  1.000e+00
## nnfi                                 1.000e+00
## rfi                                  9.829e-01
## nfi                                  9.840e-01
## pnfi                                 9.236e-01
## ifi                                  1.000e+00
## rni                                  1.000e+00
## cfi.scaled                           8.875e-01
## tli.scaled                           8.801e-01
## cfi.robust                                  NA
## tli.robust                                  NA
## nnfi.scaled                          8.801e-01
## nnfi.robust                                 NA
## rfi.scaled                           7.368e-01
## nfi.scaled                           7.529e-01
## ifi.scaled                           8.888e-01
## rni.scaled                           8.875e-01
## rni.robust                                  NA
## rmsea                                0.000e+00
## rmsea.ci.lower                       0.000e+00
## rmsea.ci.upper                       1.060e-02
## rmsea.pvalue                         1.000e+00
## rmsea.scaled                         3.580e-02
## rmsea.ci.lower.scaled                3.240e-02
## rmsea.ci.upper.scaled                3.910e-02
## rmsea.pvalue.scaled                  1.000e+00
## rmsea.robust                                NA
## rmsea.ci.lower.robust                       NA
## rmsea.ci.upper.robust                       NA
## rmsea.pvalue.robust                         NA
## rmr                                  1.142e-01
## rmr_nomean                           1.142e-01
## srmr                                 5.290e-02
## srmr_bentler                         5.290e-02
## srmr_bentler_nomean                  5.290e-02
## crmr                                 5.420e-02
## crmr_nomean                          5.420e-02
## srmr_mplus                           5.290e-02
## srmr_mplus_nomean                    5.290e-02
## cn_05                                5.346e+02
## cn_01                                5.516e+02
## gfi                                  9.864e-01
## agfi                                 9.848e-01
## pgfi                                 8.847e-01
## mfi                                  1.025e+00
## ecvi                                 2.220e+00

10 Studying the Influence of TFL on IWB Depending on Group “Sector” as Moderator.

10.1 Descriptive Statistics and Plot of IWB data by Sector and Organisation

# Prepare PDF
# # pdf("Distribution-PriPub.pdf", width = 9, height = 6)
par(mar=c(7, 1, 7, 1))
par(oma=c(1, 1, 1, 1))

library(ggplot2)
# Building histogram
ggplot(data = DFvar, aes(IWB)) +
  geom_histogram(aes(y =..density..), col="grey", bins = 20, fill = "lightblue") +
  geom_density(color = "red", size = 2) + facet_wrap(~ Sector , ncol = 2) +
  ggtitle("Distribution of Private and Public Service Data") + 
  xlab("IWB - Innovative Work Behaviour") + ylab("Density") +
  theme(
    panel.grid.major = element_line(linetype = "blank"), 
    panel.grid.minor = element_line(linetype = "blank"),
    plot.margin = unit(c(0.5, 0.5, 0.5, 0.5), "cm"),
    axis.title.x = element_text(family = "sans", size = 25, margin = margin(30,0,0,0)), 
    axis.title.y = element_text(family = "sans", size = 25, margin = margin(0,30,0,0)), 
    axis.text = element_text(family = "mono", size = 30),
    plot.title = element_text(family = "sans", size = 40, hjust = 0.5, colour = "darkblue", margin = margin(0,0,30,0)),
    strip.text.x = element_text(size = 30, colour = "darkblue"),
    panel.background = element_rect(fill = NA),
    strip.text = element_text(size = 5)
  )

# # dev.off()

# Descriptive Statistics
library(plyr)
ddply(DFvar, c("Sector", "Org"), summarise,
               n    = length(IWB),
               mean = mean(IWB),
               sd   = sd(IWB),
               se   = sd / sqrt(n))
##            Sector      Org   n  mean     sd      se
## 1 Private Service Private1  90 5.091 1.1254 0.11863
## 2 Private Service Private2 128 5.006 0.9753 0.08620
## 3 Private Service Private3  29 4.771 1.0767 0.19994
## 4  Public Service  Public1  26 4.731 1.1847 0.23235
## 5  Public Service  Public2 155 4.453 1.0426 0.08374
## 6  Public Service  Public3  54 4.632 1.1316 0.15400

10.2 Model 50: SFI Mediates Relationship TFL -> IWB, IIR Mediates TFL -> SFI

library(lavaan)
model50 <- '

# latent variables
 IWB =~ Q087 + Q088 + Q089 + Q090 + Q091 + Q092 + Q093 + Q094 + Q095
 IIR =~ Q070 + Q075 + Q076 + Q077 + Q081
 SFI =~ Q033 + Q034 + Q035 + Q037 + Q038 + Q044 + Q045 + Q049 + Q050 + Q051 + Q054
 TFL =~ Q014 + Q015 + Q016 + Q017 + Q018 + Q019 + Q020 + Q021 + Q022 + Q023 + Q024 + Q025 + Q026 + Q027 + Q028 + Q029 + Q032

# direct effect
  IWB ~ d1 * TFL

# mediator
  IIR ~ TFL
  SFI ~ TFL
  IIR ~ SFI
  IWB ~ IIR
 
# total effect
#  TotEff := d1 + (a1 * b1 * c1) + (a2 * c1)

# covariances
  Q014 ~~ Q015
  Q018 ~~ Q020
  Q020 ~~ Q029
  Q029 ~~ Q032
  Q034 ~~ Q035
  Q050 ~~ Q051
  Q051 ~~ Q054
  Q075 ~~ Q076
'

# Calculate fit50
fit50 <- sem(model50, data = DF, group = "Sector")

# Show Measurement Invariances
library(semTools)
## 
## ###############################################################################
## This is semTools 0.5-6
## All users of R (or SEM) are invited to submit functions or ideas for functions.
## ###############################################################################
## 
## Attaching package: 'semTools'
## The following object is masked from 'package:RcmdrMisc':
## 
##     reliability
## The following objects are masked from 'package:psych':
## 
##     reliability, skew
measurementInvariance(model = fit50, data = DF, group = "Sector")
## 
## Measurement invariance models:
## 
## Model 1 : fit.configural
## Model 2 : fit.loadings
## Model 3 : fit.intercepts
## Model 4 : fit.means
## 
## Chi-Squared Difference Test
## 
##                  Df   AIC   BIC Chisq Chisq diff Df diff Pr(>Chisq)
## fit.configural 1613 53394 54551  2841                              
## fit.loadings   1613 53394 54551  2841          0       0           
## fit.intercepts 1613 53394 54551  2841          0       0           
## fit.means      1613 53394 54551  2841          0       0           
## 
## 
## Fit measures:
## 
##                  cfi rmsea cfi.delta rmsea.delta
## fit.configural 0.921 0.056        NA          NA
## fit.loadings   0.921 0.056         0           0
## fit.intercepts 0.921 0.056         0           0
## fit.means      0.921 0.056         0           0
# Print results (fit indices, parameters, hypothesis tests)
summary(fit50, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6-12 ended normally after 69 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                       278
##   Number of equality constraints                     1
## 
##   Number of observations per group:                   
##     Private Service                                247
##     Public Service                                 235
## 
## Model Test User Model:
##                                                       
##   Test statistic                              2840.731
##   Degrees of freedom                              1613
##   P-value (Chi-square)                           0.000
##   Test statistic for each group:
##     Private Service                           1435.018
##     Public Service                            1405.713
## 
## Model Test Baseline Model:
## 
##   Test statistic                             17174.613
##   Degrees of freedom                              1722
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.921
##   Tucker-Lewis Index (TLI)                       0.915
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -26419.917
##   Loglikelihood unrestricted model (H1)     -24999.552
##                                                       
##   Akaike (AIC)                               53393.834
##   Bayesian (BIC)                             54551.125
##   Sample-size adjusted Bayesian (BIC)        53671.951
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.056
##   90 Percent confidence interval - lower         0.053
##   90 Percent confidence interval - upper         0.060
##   P-value RMSEA <= 0.05                          0.002
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.050
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## 
## Group 1 [Private Service]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB =~                                              
##     Q087              1.000                           
##     Q088              0.954    0.069   13.822    0.000
##     Q089              0.972    0.068   14.347    0.000
##     Q090              0.661    0.071    9.342    0.000
##     Q091              1.038    0.065   15.983    0.000
##     Q092              0.840    0.066   12.721    0.000
##     Q093              1.159    0.069   16.690    0.000
##     Q094              1.079    0.074   14.565    0.000
##     Q095              1.045    0.070   14.946    0.000
##   IIR =~                                              
##     Q070              1.000                           
##     Q075              1.231    0.143    8.604    0.000
##     Q076              1.253    0.141    8.863    0.000
##     Q077              1.003    0.125    7.996    0.000
##     Q081              0.718    0.118    6.070    0.000
##   SFI =~                                              
##     Q033              1.000                           
##     Q034              1.085    0.092   11.736    0.000
##     Q035              1.088    0.090   12.054    0.000
##     Q037              0.878    0.111    7.874    0.000
##     Q038              1.077    0.097   11.087    0.000
##     Q044              1.131    0.095   11.933    0.000
##     Q045              0.900    0.085   10.547    0.000
##     Q049              1.083    0.093   11.641    0.000
##     Q050              0.843    0.098    8.600    0.000
##     Q051              0.903    0.097    9.268    0.000
##     Q054              0.925    0.109    8.483    0.000
##   TFL =~                                              
##     Q014              1.000                           
##     Q015              1.090    0.083   13.135    0.000
##     Q016              1.050    0.088   11.955    0.000
##     Q017              1.169    0.096   12.211    0.000
##     Q018              1.095    0.087   12.642    0.000
##     Q019              0.974    0.083   11.678    0.000
##     Q020              1.086    0.088   12.387    0.000
##     Q021              1.106    0.088   12.588    0.000
##     Q022              1.108    0.084   13.268    0.000
##     Q023              1.158    0.091   12.725    0.000
##     Q024              1.047    0.080   13.066    0.000
##     Q025              1.055    0.089   11.814    0.000
##     Q026              1.137    0.091   12.481    0.000
##     Q027              1.163    0.094   12.374    0.000
##     Q028              1.151    0.089   12.942    0.000
##     Q029              1.183    0.102   11.572    0.000
##     Q032              1.209    0.093   13.010    0.000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB ~                                               
##     TFL       (d1)    0.316    0.043    7.265    0.000
##   IIR ~                                               
##     TFL              -0.029    0.046   -0.630    0.528
##   SFI ~                                               
##     TFL               0.517    0.066    7.873    0.000
##   IIR ~                                               
##     SFI               0.368    0.066    5.550    0.000
##   IWB ~                                               
##     IIR               1.214    0.150    8.101    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .Q014 ~~                                             
##    .Q015              0.090    0.057    1.570    0.116
##  .Q018 ~~                                             
##    .Q020              0.128    0.044    2.915    0.004
##  .Q020 ~~                                             
##    .Q029             -0.115    0.053   -2.158    0.031
##  .Q029 ~~                                             
##    .Q032              0.222    0.058    3.814    0.000
##  .Q034 ~~                                             
##    .Q035              0.209    0.053    3.963    0.000
##  .Q050 ~~                                             
##    .Q051              0.336    0.075    4.491    0.000
##  .Q051 ~~                                             
##    .Q054              0.456    0.087    5.222    0.000
##  .Q075 ~~                                             
##    .Q076              0.045    0.041    1.101    0.271
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .Q087              5.031    0.081   62.415    0.000
##    .Q088              5.162    0.083   62.274    0.000
##    .Q089              5.217    0.082   63.406    0.000
##    .Q090              5.019    0.078   64.463    0.000
##    .Q091              5.011    0.082   61.292    0.000
##    .Q092              5.009    0.078   64.624    0.000
##    .Q093              4.839    0.089   54.521    0.000
##    .Q094              4.767    0.090   52.741    0.000
##    .Q095              5.032    0.086   58.515    0.000
##    .Q070              5.795    0.057  101.116    0.000
##    .Q075              5.393    0.062   87.019    0.000
##    .Q076              5.488    0.061   90.499    0.000
##    .Q077              5.840    0.058  100.397    0.000
##    .Q081              5.826    0.058  100.546    0.000
##    .Q033              5.567    0.075   73.958    0.000
##    .Q034              5.503    0.080   68.564    0.000
##    .Q035              5.441    0.079   69.275    0.000
##    .Q037              4.437    0.095   46.641    0.000
##    .Q038              5.300    0.084   62.810    0.000
##    .Q044              4.995    0.083   60.423    0.000
##    .Q045              5.548    0.074   75.116    0.000
##    .Q049              5.081    0.081   62.720    0.000
##    .Q050              4.522    0.084   53.921    0.000
##    .Q051              4.648    0.084   55.579    0.000
##    .Q054              4.741    0.093   50.823    0.000
##    .Q014              5.199    0.094   55.488    0.000
##    .Q015              5.296    0.087   60.694    0.000
##    .Q016              5.504    0.088   62.720    0.000
##    .Q017              4.898    0.096   51.239    0.000
##    .Q018              5.200    0.086   60.169    0.000
##    .Q019              5.316    0.083   63.784    0.000
##    .Q020              5.328    0.087   60.905    0.000
##    .Q021              5.304    0.088   60.451    0.000
##    .Q022              5.310    0.083   63.734    0.000
##    .Q023              5.040    0.091   55.512    0.000
##    .Q024              5.347    0.080   66.863    0.000
##    .Q025              5.053    0.089   56.655    0.000
##    .Q026              5.204    0.091   57.241    0.000
##    .Q027              5.103    0.094   54.368    0.000
##    .Q028              5.208    0.089   58.694    0.000
##    .Q029              4.756    0.102   46.589    0.000
##    .Q032              5.022    0.093   54.190    0.000
##    .IWB               0.000                           
##    .IIR               0.000                           
##    .SFI               0.000                           
##     TFL               0.000                           
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .Q087              0.526    0.054    9.729    0.000
##    .Q088              0.715    0.070   10.187    0.000
##    .Q089              0.653    0.065   10.059    0.000
##    .Q090              1.026    0.095   10.805    0.000
##    .Q091              0.488    0.051    9.499    0.000
##    .Q092              0.722    0.069   10.403    0.000
##    .Q093              0.497    0.054    9.137    0.000
##    .Q094              0.762    0.076   10.000    0.000
##    .Q095              0.649    0.066    9.888    0.000
##    .Q070              0.487    0.051    9.608    0.000
##    .Q075              0.457    0.057    8.062    0.000
##    .Q076              0.399    0.052    7.660    0.000
##    .Q077              0.509    0.053    9.670    0.000
##    .Q081              0.662    0.063   10.556    0.000
##    .Q033              0.629    0.064    9.765    0.000
##    .Q034              0.685    0.072    9.532    0.000
##    .Q035              0.613    0.065    9.365    0.000
##    .Q037              1.642    0.153   10.718    0.000
##    .Q038              0.865    0.087    9.976    0.000
##    .Q044              0.704    0.074    9.570    0.000
##    .Q045              0.724    0.071   10.166    0.000
##    .Q049              0.718    0.074    9.729    0.000
##    .Q050              1.191    0.112   10.604    0.000
##    .Q051              1.100    0.103   10.636    0.000
##    .Q054              1.491    0.140   10.623    0.000
##    .Q014              1.125    0.104   10.774    0.000
##    .Q015              0.641    0.062   10.427    0.000
##    .Q016              0.752    0.071   10.581    0.000
##    .Q017              0.832    0.079   10.518    0.000
##    .Q018              0.594    0.057   10.347    0.000
##    .Q019              0.726    0.068   10.640    0.000
##    .Q020              0.660    0.063   10.423    0.000
##    .Q021              0.625    0.060   10.402    0.000
##    .Q022              0.433    0.043   10.083    0.000
##    .Q023              0.638    0.062   10.352    0.000
##    .Q024              0.435    0.043   10.199    0.000
##    .Q025              0.805    0.076   10.612    0.000
##    .Q026              0.694    0.067   10.438    0.000
##    .Q027              0.765    0.073   10.471    0.000
##    .Q028              0.563    0.055   10.259    0.000
##    .Q029              1.114    0.105   10.615    0.000
##    .Q032              0.598    0.059   10.203    0.000
##    .IWB               0.368    0.060    6.122    0.000
##    .IIR               0.231    0.047    4.919    0.000
##    .SFI               0.492    0.077    6.400    0.000
##     TFL               1.043    0.165    6.309    0.000
## 
## R-Square:
##                    Estimate
##     Q087              0.672
##     Q088              0.579
##     Q089              0.610
##     Q090              0.315
##     Q091              0.705
##     Q092              0.513
##     Q093              0.745
##     Q094              0.623
##     Q095              0.645
##     Q070              0.400
##     Q075              0.519
##     Q076              0.561
##     Q077              0.390
##     Q081              0.202
##     Q033              0.550
##     Q034              0.569
##     Q035              0.598
##     Q037              0.265
##     Q038              0.508
##     Q044              0.583
##     Q045              0.463
##     Q049              0.557
##     Q050              0.315
##     Q051              0.363
##     Q054              0.307
##     Q014              0.481
##     Q015              0.659
##     Q016              0.605
##     Q017              0.631
##     Q018              0.678
##     Q019              0.577
##     Q020              0.651
##     Q021              0.672
##     Q022              0.747
##     Q023              0.686
##     Q024              0.724
##     Q025              0.590
##     Q026              0.660
##     Q027              0.649
##     Q028              0.710
##     Q029              0.567
##     Q032              0.718
##     IWB               0.659
##     IIR               0.289
##     SFI               0.361
## 
## 
## Group 2 [Public Service]:
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB =~                                              
##     Q087              1.000                           
##     Q088              1.088    0.063   17.392    0.000
##     Q089              0.890    0.058   15.386    0.000
##     Q090              0.891    0.070   12.708    0.000
##     Q091              1.087    0.059   18.367    0.000
##     Q092              0.978    0.056   17.574    0.000
##     Q093              1.004    0.059   17.003    0.000
##     Q094              1.092    0.066   16.476    0.000
##     Q095              0.858    0.061   14.041    0.000
##   IIR =~                                              
##     Q070              1.000                           
##     Q075              1.260    0.136    9.294    0.000
##     Q076              1.072    0.126    8.529    0.000
##     Q077              0.831    0.105    7.921    0.000
##     Q081              0.853    0.114    7.518    0.000
##   SFI =~                                              
##     Q033              1.000                           
##     Q034              0.993    0.079   12.593    0.000
##     Q035              0.923    0.071   13.035    0.000
##     Q037              0.873    0.085   10.282    0.000
##     Q038              0.971    0.075   13.012    0.000
##     Q044              0.932    0.077   12.121    0.000
##     Q045              0.907    0.077   11.857    0.000
##     Q049              0.989    0.080   12.336    0.000
##     Q050              0.878    0.087   10.057    0.000
##     Q051              0.872    0.086   10.082    0.000
##     Q054              0.918    0.091   10.059    0.000
##   TFL =~                                              
##     Q014              1.000                           
##     Q015              0.973    0.055   17.806    0.000
##     Q016              0.837    0.063   13.277    0.000
##     Q017              0.982    0.071   13.836    0.000
##     Q018              1.045    0.067   15.687    0.000
##     Q019              0.913    0.061   14.910    0.000
##     Q020              1.030    0.068   15.221    0.000
##     Q021              1.003    0.063   16.024    0.000
##     Q022              0.934    0.066   14.154    0.000
##     Q023              1.069    0.065   16.413    0.000
##     Q024              1.021    0.059   17.184    0.000
##     Q025              0.841    0.061   13.739    0.000
##     Q026              0.924    0.061   15.242    0.000
##     Q027              0.936    0.060   15.650    0.000
##     Q028              0.929    0.062   15.013    0.000
##     Q029              1.009    0.078   12.974    0.000
##     Q032              1.068    0.069   15.575    0.000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB ~                                               
##     TFL       (d1)    0.316    0.043    7.265    0.000
##   IIR ~                                               
##     TFL               0.165    0.054    3.046    0.002
##   SFI ~                                               
##     TFL               0.608    0.061    9.919    0.000
##   IIR ~                                               
##     SFI               0.329    0.067    4.917    0.000
##   IWB ~                                               
##     IIR               0.828    0.123    6.716    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .Q014 ~~                                             
##    .Q015              0.154    0.042    3.671    0.000
##  .Q018 ~~                                             
##    .Q020              0.173    0.044    3.950    0.000
##  .Q020 ~~                                             
##    .Q029             -0.188    0.050   -3.762    0.000
##  .Q029 ~~                                             
##    .Q032              0.289    0.059    4.888    0.000
##  .Q034 ~~                                             
##    .Q035              0.189    0.048    3.982    0.000
##  .Q050 ~~                                             
##    .Q051              0.292    0.071    4.119    0.000
##  .Q051 ~~                                             
##    .Q054              0.433    0.080    5.394    0.000
##  .Q075 ~~                                             
##    .Q076              0.111    0.054    2.053    0.040
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .Q087              4.589    0.080   57.368    0.000
##    .Q088              4.545    0.089   51.254    0.000
##    .Q089              4.789    0.078   61.637    0.000
##    .Q090              4.713    0.088   53.629    0.000
##    .Q091              4.306    0.086   49.988    0.000
##    .Q092              4.511    0.079   56.901    0.000
##    .Q093              4.374    0.083   52.786    0.000
##    .Q094              4.147    0.092   45.236    0.000
##    .Q095              4.749    0.079   59.920    0.000
##    .Q070              5.662    0.064   88.445    0.000
##    .Q075              4.879    0.073   66.788    0.000
##    .Q076              4.859    0.069   70.764    0.000
##    .Q077              5.565    0.060   92.943    0.000
##    .Q081              5.620    0.065   86.119    0.000
##    .Q033              5.126    0.079   64.797    0.000
##    .Q034              5.115    0.082   62.235    0.000
##    .Q035              5.071    0.074   68.149    0.000
##    .Q037              4.349    0.085   50.885    0.000
##    .Q038              5.104    0.079   64.986    0.000
##    .Q044              5.006    0.080   62.775    0.000
##    .Q045              5.125    0.079   64.871    0.000
##    .Q049              4.717    0.083   56.536    0.000
##    .Q050              4.421    0.088   50.500    0.000
##    .Q051              4.187    0.087   48.270    0.000
##    .Q054              4.211    0.092   45.995    0.000
##    .Q014              5.153    0.087   59.327    0.000
##    .Q015              5.155    0.085   60.793    0.000
##    .Q016              5.228    0.080   65.195    0.000
##    .Q017              4.474    0.091   48.955    0.000
##    .Q018              4.953    0.089   55.461    0.000
##    .Q019              5.247    0.081   65.013    0.000
##    .Q020              5.068    0.090   56.468    0.000
##    .Q021              4.951    0.085   58.491    0.000
##    .Q022              5.074    0.086   59.333    0.000
##    .Q023              4.755    0.089   53.507    0.000
##    .Q024              5.121    0.082   62.083    0.000
##    .Q025              5.102    0.079   64.877    0.000
##    .Q026              5.064    0.081   62.890    0.000
##    .Q027              4.970    0.080   62.009    0.000
##    .Q028              4.913    0.082   60.063    0.000
##    .Q029              4.564    0.098   46.497    0.000
##    .Q032              4.817    0.092   52.488    0.000
##    .IWB               0.000                           
##    .IIR               0.000                           
##    .SFI               0.000                           
##     TFL               0.000                           
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .Q087              0.383    0.041    9.295    0.000
##    .Q088              0.522    0.055    9.498    0.000
##    .Q089              0.532    0.053    9.962    0.000
##    .Q090              0.926    0.090   10.335    0.000
##    .Q091              0.419    0.046    9.169    0.000
##    .Q092              0.405    0.043    9.443    0.000
##    .Q093              0.484    0.050    9.607    0.000
##    .Q094              0.639    0.066    9.738    0.000
##    .Q095              0.652    0.064   10.174    0.000
##    .Q070              0.522    0.058    8.976    0.000
##    .Q075              0.554    0.072    7.745    0.000
##    .Q076              0.601    0.070    8.574    0.000
##    .Q077              0.538    0.056    9.606    0.000
##    .Q081              0.679    0.069    9.813    0.000
##    .Q033              0.544    0.058    9.311    0.000
##    .Q034              0.675    0.071    9.537    0.000
##    .Q035              0.513    0.055    9.380    0.000
##    .Q037              1.012    0.099   10.216    0.000
##    .Q038              0.577    0.061    9.480    0.000
##    .Q044              0.690    0.070    9.794    0.000
##    .Q045              0.704    0.071    9.870    0.000
##    .Q049              0.730    0.075    9.727    0.000
##    .Q050              1.088    0.106   10.249    0.000
##    .Q051              1.064    0.102   10.392    0.000
##    .Q054              1.190    0.116   10.249    0.000
##    .Q014              0.583    0.058   10.139    0.000
##    .Q015              0.563    0.055   10.150    0.000
##    .Q016              0.677    0.065   10.432    0.000
##    .Q017              0.815    0.079   10.372    0.000
##    .Q018              0.576    0.057   10.057    0.000
##    .Q019              0.539    0.053   10.230    0.000
##    .Q020              0.632    0.062   10.183    0.000
##    .Q021              0.487    0.049   10.023    0.000
##    .Q022              0.681    0.066   10.335    0.000
##    .Q023              0.496    0.050    9.929    0.000
##    .Q024              0.360    0.037    9.695    0.000
##    .Q025              0.612    0.059   10.383    0.000
##    .Q026              0.508    0.050   10.176    0.000
##    .Q027              0.468    0.046   10.101    0.000
##    .Q028              0.545    0.053   10.214    0.000
##    .Q029              1.054    0.101   10.483    0.000
##    .Q032              0.622    0.062   10.097    0.000
##    .IWB               0.473    0.065    7.255    0.000
##    .IIR               0.230    0.046    4.954    0.000
##    .SFI               0.487    0.072    6.780    0.000
##     TFL               1.190    0.155    7.690    0.000
## 
## R-Square:
##                    Estimate
##     Q087              0.745
##     Q088              0.717
##     Q089              0.625
##     Q090              0.490
##     Q091              0.760
##     Q092              0.725
##     Q093              0.700
##     Q094              0.676
##     Q095              0.558
##     Q070              0.458
##     Q075              0.558
##     Q076              0.458
##     Q077              0.361
##     Q081              0.321
##     Q033              0.630
##     Q034              0.575
##     Q035              0.606
##     Q037              0.411
##     Q038              0.602
##     Q044              0.538
##     Q045              0.520
##     Q049              0.554
##     Q050              0.396
##     Q051              0.398
##     Q054              0.396
##     Q014              0.671
##     Q015              0.667
##     Q016              0.552
##     Q017              0.585
##     Q018              0.692
##     Q019              0.648
##     Q020              0.666
##     Q021              0.711
##     Q022              0.604
##     Q023              0.733
##     Q024              0.775
##     Q025              0.579
##     Q026              0.667
##     Q027              0.690
##     Q028              0.654
##     Q029              0.535
##     Q032              0.686
##     IWB               0.578
##     IIR               0.478
##     SFI               0.474
modInd <- modificationIndices(fit50, minimum.value = 10)
# head(modInd[order(modInd$mi, decreasing=TRUE), ], 10)
subset(modInd[order(modInd$mi, decreasing=TRUE), ], mi > 5)
##       lhs op  rhs block group level    mi    epc sepc.lv sepc.all sepc.nox
## 485  Q088 ~~ Q054     1     1     1 17.45 -0.268  -0.268   -0.260   -0.260
## 530  Q089 ~~ Q019     1     1     1 17.43  0.196   0.196    0.284    0.284
## 1700 Q094 ~~ Q017     2     2     1 16.52  0.206   0.206    0.285    0.285
## 674  Q093 ~~ Q017     1     1     1 15.30  0.180   0.180    0.280    0.280
## 298   IWB =~ Q076     1     1     1 14.42  0.366   0.380    0.399    0.399
## 2257 Q025 ~~ Q032     2     2     1 14.40  0.148   0.148    0.240    0.240
## 1750 Q070 ~~ Q081     2     2     1 14.05  0.175   0.175    0.294    0.294
## 985  Q037 ~~ Q050     1     1     1 13.93  0.326   0.326    0.233    0.233
## 1705 Q094 ~~ Q022     2     2     1 13.66 -0.171  -0.171   -0.260   -0.260
## 361   IIR =~ Q026     1     1     1 13.51 -0.408  -0.233   -0.163   -0.163
## 1636 Q092 ~~ Q022     2     2     1 13.07  0.135   0.135    0.258    0.258
## 1898 Q033 ~~ Q037     2     2     1 12.87 -0.196  -0.196   -0.264   -0.264
## 2094 Q050 ~~ Q024     2     2     1 12.79 -0.150  -0.150   -0.239   -0.239
## 757  Q070 ~~ Q077     1     1     1 12.64  0.136   0.136    0.273    0.273
## 2121 Q054 ~~ Q017     2     2     1 12.15  0.213   0.213    0.216    0.216
## 1232 Q021 ~~ Q023     1     1     1 11.99  0.150   0.150    0.238    0.238
## 1923 Q034 ~~ Q037     2     2     1 11.78 -0.187  -0.187   -0.227   -0.227
## 1751 Q070 ~~ Q033     2     2     1 11.66  0.137   0.137    0.258    0.258
## 983  Q037 ~~ Q045     1     1     1 11.23 -0.249  -0.249   -0.228   -0.228
## 1715 Q095 ~~ Q075     2     2     1 10.98 -0.143  -0.143   -0.238   -0.238
## 724  Q095 ~~ Q076     1     1     1 10.93 -0.124  -0.124   -0.244   -0.244
## 2211 Q019 ~~ Q028     2     2     1 10.79 -0.124  -0.124   -0.229   -0.229
## 2099 Q050 ~~ Q029     2     2     1 10.79  0.204   0.204    0.190    0.190
## 657  Q093 ~~ Q076     1     1     1 10.21  0.109   0.109    0.245    0.245
# Prepare PDF
# pdf("Model53.pdf", width = 25, height = 16)
par(mar=c(7, 1, 7, 1))
par(oma=c(1, 1, 1, 1))

# Plot model
library(semPlot)
semPaths(fit50, ask=FALSE, what = "stand", whatLabels = "stand", intercepts = FALSE, residuals = FALSE, edge.label.cex = 0.5, edge.color = "blue", layout = "tree", rotation = 3, curve = 1, curvePivot = TRUE, mar = c(3,1,5,1), sizeLat = 7, sizeMan = 3, color = colorlist)

title(main = "SFI Mediates Relationship TFL -> IWB, IIR Mediates TFL -> SFI - Model 50\n- Private & Public Sector -", cex.main = 2.5, col.main = "darkblue", font.main = 3, sub = "", cex.sub = 1.4)

# dev.off()

After adding grouping variable Sector to the model, CFI and TLI drop. Furthermore, the effects change drastically from model to model.The effect from TFL to IIR turns insignificant for Private Sector. It seems better for model fit and more practical for model application, to design different models for Private and Public Sector.

10.3 Model 51-Pri/Pub: Model Including IIR + SFI as Mediator - Private

library(lavaan)
model51Pri <- '

# latent variables
 IWB =~ Q087 + Q088 + Q089 + Q090 + Q091 + Q092 + Q093 + Q094 + Q095
 IIR =~ Q070 + Q071 + Q075 + Q076 + Q077 
 SFI =~ Q033 + Q034 + Q035 + Q037 + Q038 + Q044 + Q045 + Q049 + Q050 + Q051 + Q054
 TFL =~ Q014 + Q015 + Q016 + Q017 + Q018 + Q019 + Q020 + Q021 + Q022 + Q023 + Q024 + Q025 + Q026 + Q027 + Q028 + Q029 + Q032

# direct effect
 IWB ~ d1 * TFL
 DirEff := d1

# mediator
 SFI ~ a1 * TFL
 IIR ~ b1 * SFI
 IWB ~ c1 * IIR

# indirect effect
 a1b1c1 := a1 * b1 * c1
 IndEff := a1b1c1

# total effect
 TotEff := d1 + (a1 * b1 * c1)

# covariances
 Q021 ~~ Q023
 Q025 ~~ Q029
 Q029 ~~ Q032
 Q034 ~~ Q035
 Q029 ~~ Q032
 Q037 ~~ Q050
 Q050 ~~ Q051
 Q051 ~~ Q054
 Q070 ~~ Q071
 Q070 ~~ Q076
'

# Calculate fit for Private
fit51Pri <- sem(model51Pri, data = DFpri)

# Print results (fit indices, parameters, hypothesis tests)
summary(fit51Pri, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6-12 ended normally after 42 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        97
## 
##   Number of observations                           247
## 
## Model Test User Model:
##                                                       
##   Test statistic                              1391.545
##   Degrees of freedom                               806
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              8460.120
##   Degrees of freedom                               861
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.923
##   Tucker-Lewis Index (TLI)                       0.918
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -13834.185
##   Loglikelihood unrestricted model (H1)     -13138.412
##                                                       
##   Akaike (AIC)                               27862.369
##   Bayesian (BIC)                             28202.780
##   Sample-size adjusted Bayesian (BIC)        27895.291
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.054
##   90 Percent confidence interval - lower         0.049
##   90 Percent confidence interval - upper         0.059
##   P-value RMSEA <= 0.05                          0.074
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.054
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB =~                                              
##     Q087              1.000                           
##     Q088              0.957    0.069   13.778    0.000
##     Q089              0.975    0.068   14.299    0.000
##     Q090              0.661    0.071    9.322    0.000
##     Q091              1.042    0.065   15.915    0.000
##     Q092              0.842    0.066   12.686    0.000
##     Q093              1.163    0.070   16.598    0.000
##     Q094              1.083    0.075   14.522    0.000
##     Q095              1.046    0.070   14.839    0.000
##   IIR =~                                              
##     Q070              1.000                           
##     Q071              0.973    0.107    9.084    0.000
##     Q075              1.185    0.132    8.996    0.000
##     Q076              1.279    0.144    8.896    0.000
##     Q077              0.940    0.118    7.953    0.000
##   SFI =~                                              
##     Q033              1.000                           
##     Q034              1.079    0.092   11.791    0.000
##     Q035              1.085    0.089   12.146    0.000
##     Q037              0.852    0.111    7.682    0.000
##     Q038              1.069    0.096   11.099    0.000
##     Q044              1.123    0.094   11.970    0.000
##     Q045              0.902    0.085   10.666    0.000
##     Q049              1.077    0.092   11.697    0.000
##     Q050              0.822    0.097    8.463    0.000
##     Q051              0.897    0.097    9.289    0.000
##     Q054              0.919    0.108    8.486    0.000
##   TFL =~                                              
##     Q014              1.000                           
##     Q015              1.078    0.087   12.384    0.000
##     Q016              1.040    0.087   11.894    0.000
##     Q017              1.155    0.095   12.123    0.000
##     Q018              1.088    0.086   12.622    0.000
##     Q019              0.966    0.083   11.647    0.000
##     Q020              1.078    0.087   12.366    0.000
##     Q021              1.084    0.088   12.385    0.000
##     Q022              1.095    0.083   13.156    0.000
##     Q023              1.133    0.091   12.502    0.000
##     Q024              1.035    0.080   12.956    0.000
##     Q025              1.036    0.089   11.670    0.000
##     Q026              1.122    0.091   12.376    0.000
##     Q027              1.147    0.094   12.256    0.000
##     Q028              1.137    0.089   12.830    0.000
##     Q029              1.151    0.102   11.266    0.000
##     Q032              1.194    0.093   12.900    0.000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB ~                                               
##     TFL       (d1)    0.292    0.054    5.450    0.000
##   SFI ~                                               
##     TFL       (a1)    0.514    0.065    7.889    0.000
##   IIR ~                                               
##     SFI       (b1)    0.365    0.055    6.579    0.000
##   IWB ~                                               
##     IIR       (c1)    1.176    0.144    8.145    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .Q021 ~~                                             
##    .Q023              0.152    0.046    3.272    0.001
##  .Q025 ~~                                             
##    .Q029              0.213    0.063    3.396    0.001
##  .Q029 ~~                                             
##    .Q032              0.275    0.059    4.684    0.000
##  .Q034 ~~                                             
##    .Q035              0.207    0.053    3.920    0.000
##  .Q037 ~~                                             
##    .Q050              0.327    0.092    3.564    0.000
##  .Q050 ~~                                             
##    .Q051              0.328    0.072    4.530    0.000
##  .Q051 ~~                                             
##    .Q054              0.458    0.088    5.220    0.000
##  .Q070 ~~                                             
##    .Q071              0.126    0.043    2.944    0.003
##    .Q076             -0.106    0.033   -3.228    0.001
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .Q087              0.524    0.054    9.740    0.000
##    .Q088              0.715    0.070   10.193    0.000
##    .Q089              0.652    0.065   10.065    0.000
##    .Q090              1.028    0.095   10.809    0.000
##    .Q091              0.486    0.051    9.504    0.000
##    .Q092              0.723    0.069   10.409    0.000
##    .Q093              0.496    0.054    9.147    0.000
##    .Q094              0.760    0.076   10.004    0.000
##    .Q095              0.654    0.066    9.910    0.000
##    .Q070              0.459    0.052    8.876    0.000
##    .Q071              0.596    0.060    9.946    0.000
##    .Q075              0.458    0.050    9.181    0.000
##    .Q076              0.336    0.045    7.475    0.000
##    .Q077              0.526    0.052   10.092    0.000
##    .Q033              0.621    0.064    9.718    0.000
##    .Q034              0.685    0.072    9.509    0.000
##    .Q035              0.609    0.065    9.323    0.000
##    .Q037              1.671    0.156   10.734    0.000
##    .Q038              0.870    0.087    9.976    0.000
##    .Q044              0.707    0.074    9.566    0.000
##    .Q045              0.715    0.071   10.130    0.000
##    .Q049              0.718    0.074    9.712    0.000
##    .Q050              1.201    0.112   10.692    0.000
##    .Q051              1.101    0.104   10.631    0.000
##    .Q054              1.493    0.141   10.618    0.000
##    .Q014              1.115    0.104   10.775    0.000
##    .Q015              0.639    0.061   10.426    0.000
##    .Q016              0.746    0.071   10.566    0.000
##    .Q017              0.830    0.079   10.506    0.000
##    .Q018              0.577    0.056   10.338    0.000
##    .Q019              0.717    0.068   10.621    0.000
##    .Q020              0.645    0.062   10.432    0.000
##    .Q021              0.645    0.062   10.394    0.000
##    .Q022              0.431    0.043   10.061    0.000
##    .Q023              0.664    0.064   10.354    0.000
##    .Q024              0.434    0.043   10.181    0.000
##    .Q025              0.817    0.077   10.615    0.000
##    .Q026              0.695    0.067   10.429    0.000
##    .Q027              0.769    0.073   10.467    0.000
##    .Q028              0.563    0.055   10.245    0.000
##    .Q029              1.185    0.110   10.741    0.000
##    .Q032              0.597    0.058   10.207    0.000
##    .IWB               0.364    0.057    6.337    0.000
##    .IIR               0.246    0.049    5.000    0.000
##    .SFI               0.495    0.077    6.441    0.000
##     TFL               1.070    0.171    6.257    0.000
## 
## R-Square:
##                    Estimate
##     Q087              0.673
##     Q088              0.580
##     Q089              0.611
##     Q090              0.314
##     Q091              0.706
##     Q092              0.514
##     Q093              0.746
##     Q094              0.624
##     Q095              0.643
##     Q070              0.432
##     Q071              0.357
##     Q075              0.517
##     Q076              0.630
##     Q077              0.370
##     Q033              0.556
##     Q034              0.570
##     Q035              0.601
##     Q037              0.252
##     Q038              0.505
##     Q044              0.581
##     Q045              0.469
##     Q049              0.557
##     Q050              0.304
##     Q051              0.363
##     Q054              0.305
##     Q014              0.490
##     Q015              0.660
##     Q016              0.608
##     Q017              0.632
##     Q018              0.687
##     Q019              0.582
##     Q020              0.658
##     Q021              0.661
##     Q022              0.748
##     Q023              0.674
##     Q024              0.725
##     Q025              0.584
##     Q026              0.660
##     Q027              0.646
##     Q028              0.711
##     Q029              0.544
##     Q032              0.719
##     IWB               0.662
##     IIR               0.296
##     SFI               0.364
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)
##     DirEff            0.292    0.054    5.450    0.000
##     a1b1c1            0.221    0.040    5.524    0.000
##     IndEff            0.221    0.040    5.524    0.000
##     TotEff            0.513    0.066    7.742    0.000
modInd <- modificationIndices(fit51Pri, minimum.value = 10)
# head(modInd[order(modInd$mi, decreasing=TRUE), ], 10)
subset(modInd[order(modInd$mi, decreasing=TRUE), ], mi > 5)
##      lhs op  rhs    mi    epc sepc.lv sepc.all sepc.nox
## 295 Q088 ~~ Q054 17.60 -0.269  -0.269   -0.260   -0.260
## 340 Q089 ~~ Q019 17.11  0.193   0.193    0.282    0.282
## 484 Q093 ~~ Q017 15.61  0.181   0.181    0.283    0.283
## 171  IIR =~ Q026 15.54 -0.420  -0.248   -0.174   -0.174
## 918 Q051 ~~ Q015 10.95 -0.163  -0.163   -0.194   -0.194
## 535 Q095 ~~ Q076 10.93 -0.122  -0.122   -0.260   -0.260
# Prepare PDF
# pdf("Model51pri.pdf", width = 25, height = 16)
par(mar=c(7, 1, 7, 1))
par(oma=c(1, 1, 1, 1))

# Prepare fitmeasures
ParDF  <- as.data.frame(do.call(cbind, fit51Pri@ParTable))
DirEff <- round(as.numeric(ParDF[ParDF$label == "DirEff", 14]), 4)
TotEff <- round(as.numeric(ParDF[ParDF$label == "TotEff", 14]), 4)
n      <- fit51Pri@SampleStats@ntotal

fitMeas <- toString(c("ChiSq: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pri, "chisq"))), 4),
        " - DF: ", gsub("[^0-9.]", "", fitMeasures(fit51Pri, "df")),
        " - ChiSq/DF: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pri, "chisq")))/ as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pri, "df"))), 4),
        " - CFI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pri, "cfi"))), 4),
        " - TLI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pri, "tli"))), 4),
        " - RMSEA: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pri, "rmsea"))), 4),
        " - SRMR: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pri, "srmr"))), 4),
        " - n: ", n,
        " - DirEff: ", DirEff,
        " - TotalEff: ", TotEff
        ), 
        width = 255)
fitMeas <- gsub(",", "", fitMeas)

# Plot model
library(semPlot)
semPaths(fit51Pri, what = "stand", whatLabels = "stand", intercepts = FALSE, residuals = FALSE, edge.label.cex = 0.5, edge.color = "blue", layout = "tree", rotation = 3, curve = 1, curvePivot = TRUE, mar = c(3,1,5,1), sizeLat = 7, sizeMan = 3, color = colorlist)
title(main = "A series of SFI and IIR Mediates Relationship TFL -> IWB - Model 51\n- Private -", cex.main = 2.5, col.main = "darkblue", font.main = 3, sub = fitMeas, cex.sub = 1.4)

# dev.off()

This model of a mediation by a series of SFI and IIR reaches CFI = 0.923 and TLI = 0.918, RMSEA = 0.054 and SRMR = 0.054 with all effects significant with p-value < 0.01. The total effect for TFL on IWB is 0.513. This model might be a good representation of the data given by Private Sector organisations.

10.4 Model 51-Pri/Pub: Model Including IIR + SFI as Mediator - Private Org 1

# Calculate fit for Private
fit51Pri1 <- sem(model51Pri, data = DFpri1)

# Print results (fit indices, parameters, hypothesis tests)
summary(fit51Pri1, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6-12 ended normally after 50 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        97
## 
##   Number of observations                            90
## 
## Model Test User Model:
##                                                       
##   Test statistic                              1392.358
##   Degrees of freedom                               806
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              4157.694
##   Degrees of freedom                               861
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.822
##   Tucker-Lewis Index (TLI)                       0.810
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -4939.853
##   Loglikelihood unrestricted model (H1)      -4243.674
##                                                       
##   Akaike (AIC)                               10073.706
##   Bayesian (BIC)                             10316.187
##   Sample-size adjusted Bayesian (BIC)        10010.048
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.090
##   90 Percent confidence interval - lower         0.082
##   90 Percent confidence interval - upper         0.098
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.084
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB =~                                              
##     Q087              1.000                           
##     Q088              0.691    0.079    8.758    0.000
##     Q089              0.962    0.078   12.254    0.000
##     Q090              0.464    0.091    5.098    0.000
##     Q091              0.889    0.075   11.829    0.000
##     Q092              0.676    0.085    7.935    0.000
##     Q093              1.097    0.079   13.918    0.000
##     Q094              0.913    0.087   10.505    0.000
##     Q095              0.840    0.079   10.689    0.000
##   IIR =~                                              
##     Q070              1.000                           
##     Q071              0.890    0.159    5.578    0.000
##     Q075              0.992    0.151    6.584    0.000
##     Q076              1.062    0.186    5.718    0.000
##     Q077              0.873    0.161    5.420    0.000
##   SFI =~                                              
##     Q033              1.000                           
##     Q034              1.540    0.265    5.815    0.000
##     Q035              1.149    0.222    5.169    0.000
##     Q037              1.005    0.268    3.746    0.000
##     Q038              1.248    0.254    4.919    0.000
##     Q044              1.550    0.267    5.806    0.000
##     Q045              1.196    0.228    5.239    0.000
##     Q049              1.508    0.246    6.138    0.000
##     Q050              0.801    0.210    3.809    0.000
##     Q051              1.164    0.244    4.766    0.000
##     Q054              1.527    0.310    4.918    0.000
##   TFL =~                                              
##     Q014              1.000                           
##     Q015              1.084    0.156    6.970    0.000
##     Q016              1.037    0.144    7.186    0.000
##     Q017              1.174    0.179    6.567    0.000
##     Q018              1.008    0.148    6.833    0.000
##     Q019              0.967    0.146    6.643    0.000
##     Q020              1.244    0.170    7.335    0.000
##     Q021              1.123    0.159    7.052    0.000
##     Q022              1.098    0.151    7.264    0.000
##     Q023              1.162    0.160    7.253    0.000
##     Q024              1.105    0.154    7.182    0.000
##     Q025              0.987    0.157    6.303    0.000
##     Q026              1.076    0.153    7.039    0.000
##     Q027              1.092    0.174    6.262    0.000
##     Q028              1.065    0.152    6.991    0.000
##     Q029              1.046    0.170    6.136    0.000
##     Q032              1.185    0.173    6.837    0.000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB ~                                               
##     TFL       (d1)    0.413    0.118    3.493    0.000
##   SFI ~                                               
##     TFL       (a1)    0.465    0.104    4.455    0.000
##   IIR ~                                               
##     SFI       (b1)    0.636    0.148    4.289    0.000
##   IWB ~                                               
##     IIR       (c1)    1.202    0.218    5.520    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .Q021 ~~                                             
##    .Q023              0.033    0.052    0.641    0.521
##  .Q025 ~~                                             
##    .Q029              0.362    0.103    3.514    0.000
##  .Q029 ~~                                             
##    .Q032              0.290    0.093    3.109    0.002
##  .Q034 ~~                                             
##    .Q035              0.171    0.092    1.850    0.064
##  .Q037 ~~                                             
##    .Q050              0.279    0.156    1.781    0.075
##  .Q050 ~~                                             
##    .Q051              0.253    0.118    2.143    0.032
##  .Q051 ~~                                             
##    .Q054              0.431    0.161    2.684    0.007
##  .Q070 ~~                                             
##    .Q071             -0.035    0.063   -0.558    0.577
##    .Q076             -0.178    0.056   -3.155    0.002
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .Q087              0.430    0.078    5.508    0.000
##    .Q088              0.731    0.115    6.374    0.000
##    .Q089              0.519    0.090    5.791    0.000
##    .Q090              1.160    0.175    6.614    0.000
##    .Q091              0.502    0.085    5.899    0.000
##    .Q092              0.896    0.139    6.448    0.000
##    .Q093              0.399    0.077    5.150    0.000
##    .Q094              0.772    0.125    6.155    0.000
##    .Q095              0.621    0.101    6.126    0.000
##    .Q070              0.380    0.078    4.850    0.000
##    .Q071              0.536    0.092    5.853    0.000
##    .Q075              0.353    0.063    5.592    0.000
##    .Q076              0.376    0.076    4.944    0.000
##    .Q077              0.610    0.098    6.258    0.000
##    .Q033              0.795    0.125    6.344    0.000
##    .Q034              0.701    0.123    5.683    0.000
##    .Q035              0.772    0.126    6.152    0.000
##    .Q037              1.882    0.287    6.552    0.000
##    .Q038              1.156    0.183    6.317    0.000
##    .Q044              0.723    0.126    5.738    0.000
##    .Q045              0.797    0.129    6.187    0.000
##    .Q049              0.411    0.081    5.089    0.000
##    .Q050              1.139    0.174    6.558    0.000
##    .Q051              1.137    0.178    6.397    0.000
##    .Q054              1.726    0.274    6.310    0.000
##    .Q014              1.411    0.214    6.581    0.000
##    .Q015              0.512    0.081    6.294    0.000
##    .Q016              0.350    0.057    6.154    0.000
##    .Q017              0.921    0.143    6.439    0.000
##    .Q018              0.518    0.082    6.355    0.000
##    .Q019              0.581    0.090    6.418    0.000
##    .Q020              0.396    0.066    6.002    0.000
##    .Q021              0.492    0.079    6.207    0.000
##    .Q022              0.348    0.057    6.082    0.000
##    .Q023              0.395    0.065    6.055    0.000
##    .Q024              0.400    0.065    6.157    0.000
##    .Q025              0.825    0.127    6.496    0.000
##    .Q026              0.462    0.074    6.256    0.000
##    .Q027              1.045    0.161    6.503    0.000
##    .Q028              0.480    0.076    6.283    0.000
##    .Q029              1.061    0.159    6.655    0.000
##    .Q032              0.713    0.112    6.353    0.000
##    .IWB               0.589    0.129    4.580    0.000
##    .IIR               0.295    0.084    3.524    0.000
##    .SFI               0.235    0.079    2.964    0.003
##     TFL               1.024    0.299    3.428    0.001
## 
## R-Square:
##                    Estimate
##     Q087              0.803
##     Q088              0.535
##     Q089              0.758
##     Q090              0.246
##     Q091              0.734
##     Q092              0.473
##     Q093              0.841
##     Q094              0.655
##     Q095              0.666
##     Q070              0.558
##     Q071              0.414
##     Q075              0.572
##     Q076              0.590
##     Q077              0.374
##     Q033              0.365
##     Q034              0.607
##     Q035              0.438
##     Q037              0.197
##     Q038              0.381
##     Q044              0.603
##     Q045              0.450
##     Q049              0.716
##     Q050              0.205
##     Q051              0.352
##     Q054              0.381
##     Q014              0.421
##     Q015              0.702
##     Q016              0.759
##     Q017              0.605
##     Q018              0.668
##     Q019              0.622
##     Q020              0.800
##     Q021              0.724
##     Q022              0.780
##     Q023              0.778
##     Q024              0.758
##     Q025              0.547
##     Q026              0.720
##     Q027              0.539
##     Q028              0.707
##     Q029              0.513
##     Q032              0.669
##     IWB               0.665
##     IIR               0.385
##     SFI               0.485
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)
##     DirEff            0.413    0.118    3.493    0.000
##     a1b1c1            0.356    0.095    3.731    0.000
##     IndEff            0.356    0.095    3.731    0.000
##     TotEff            0.768    0.150    5.110    0.000
modInd <- modificationIndices(fit51Pri1, minimum.value = 10)
# head(modInd[order(modInd$mi, decreasing=TRUE), ], 10)
subset(modInd[order(modInd$mi, decreasing=TRUE), ], mi > 5)
##      lhs op  rhs    mi    epc sepc.lv sepc.all sepc.nox
## 656 Q076 ~~ Q077 14.23 -0.252  -0.252   -0.527   -0.527
## 434 Q092 ~~ Q077 13.94  0.305   0.305    0.413    0.413
## 124  IWB =~ Q016 13.84 -0.235  -0.311   -0.259   -0.259
## 657 Q076 ~~ Q033 13.16  0.239   0.239    0.438    0.438
## 836 Q044 ~~ Q045 12.41 -0.325  -0.325   -0.428   -0.428
## 161  IIR =~ Q016 11.06 -0.370  -0.256   -0.213   -0.213
## 501 Q094 ~~ Q075 10.69  0.201   0.201    0.385    0.385
## 504 Q094 ~~ Q033 10.59 -0.287  -0.287   -0.366   -0.366
## 327 Q089 ~~ Q037 10.25 -0.353  -0.353   -0.357   -0.357
## 226  TFL =~ Q044 10.05  0.466   0.471    0.349    0.349
# Prepare PDF
# pdf("Model51pri2.pdf", width = 25, height = 16)
par(mar=c(7, 1, 7, 1))
par(oma=c(1, 1, 1, 1))

# Prepare fitmeasures
ParDF  <- as.data.frame(do.call(cbind, fit51Pri1@ParTable))
DirEff <- round(as.numeric(ParDF[ParDF$label == "DirEff", 14]), 4)
TotEff <- round(as.numeric(ParDF[ParDF$label == "TotEff", 14]), 4)
n      <- fit51Pri1@SampleStats@ntotal

fitMeas <- toString(c("ChiSq: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pri1, "chisq"))), 4),
        " - DF: ", gsub("[^0-9.]", "", fitMeasures(fit51Pri1, "df")),
        " - ChiSq/DF: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pri1, "chisq")))/ as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pri1, "df"))), 4),
        " - CFI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pri1, "cfi"))), 4),
        " - TLI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pri1, "tli"))), 4),
        " - RMSEA: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pri1, "rmsea"))), 4),
        " - SRMR: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pri1, "srmr"))), 4),
        " - n: ", n,
        " - DirEff: ", DirEff,
        " - TotalEff: ", TotEff
        ), 
        width = 255)
fitMeas <- gsub(",", "", fitMeas)

# Plot model
library(semPlot)
semPaths(fit51Pri1, what = "stand", whatLabels = "stand", intercepts = FALSE, residuals = FALSE, edge.label.cex = 0.5, edge.color = "blue", layout = "tree", rotation = 3, curve = 1, curvePivot = TRUE, mar = c(3,1,5,1), sizeLat = 7, sizeMan = 3, color = colorlist)
title(main = "A series of SFI and IIR Mediates Relationship TFL -> IWB - Model 51\n- Private Org 1 -", cex.main = 2.5, col.main = "darkblue", font.main = 3, sub = fitMeas, cex.sub = 1.4)

# dev.off()

10.5 Model 51-Pri/Pub: Model Including IIR + SFI as Mediator - Private Org 2

# Calculate fit for Private
fit51Pri2 <- sem(model51Pri, data = DFpri2)

# Print results (fit indices, parameters, hypothesis tests)
summary(fit51Pri2, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6-12 ended normally after 50 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        97
## 
##   Number of observations                           128
## 
## Model Test User Model:
##                                                       
##   Test statistic                              1408.292
##   Degrees of freedom                               806
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              5074.404
##   Degrees of freedom                               861
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.857
##   Tucker-Lewis Index (TLI)                       0.847
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -7112.045
##   Loglikelihood unrestricted model (H1)      -6407.899
##                                                       
##   Akaike (AIC)                               14418.091
##   Bayesian (BIC)                             14694.738
##   Sample-size adjusted Bayesian (BIC)        14387.971
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.076
##   90 Percent confidence interval - lower         0.070
##   90 Percent confidence interval - upper         0.083
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.077
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB =~                                              
##     Q087              1.000                           
##     Q088              1.132    0.125    9.084    0.000
##     Q089              0.938    0.114    8.258    0.000
##     Q090              0.796    0.120    6.608    0.000
##     Q091              1.154    0.118    9.814    0.000
##     Q092              0.925    0.111    8.317    0.000
##     Q093              1.212    0.122    9.899    0.000
##     Q094              1.148    0.129    8.912    0.000
##     Q095              1.199    0.128    9.405    0.000
##   IIR =~                                              
##     Q070              1.000                           
##     Q071              1.017    0.132    7.703    0.000
##     Q075              1.268    0.211    6.008    0.000
##     Q076              1.389    0.222    6.251    0.000
##     Q077              1.094    0.190    5.748    0.000
##   SFI =~                                              
##     Q033              1.000                           
##     Q034              0.856    0.097    8.801    0.000
##     Q035              1.064    0.099   10.797    0.000
##     Q037              0.834    0.133    6.285    0.000
##     Q038              1.010    0.110    9.218    0.000
##     Q044              1.033    0.103   10.016    0.000
##     Q045              0.776    0.095    8.193    0.000
##     Q049              0.912    0.108    8.440    0.000
##     Q050              0.874    0.119    7.320    0.000
##     Q051              0.780    0.113    6.890    0.000
##     Q054              0.684    0.118    5.787    0.000
##   TFL =~                                              
##     Q014              1.000                           
##     Q015              1.058    0.116    9.086    0.000
##     Q016              1.033    0.121    8.554    0.000
##     Q017              1.145    0.124    9.272    0.000
##     Q018              1.138    0.118    9.650    0.000
##     Q019              0.956    0.114    8.403    0.000
##     Q020              1.081    0.118    9.155    0.000
##     Q021              1.076    0.120    9.005    0.000
##     Q022              1.112    0.114    9.757    0.000
##     Q023              1.120    0.125    8.929    0.000
##     Q024              1.037    0.104    9.921    0.000
##     Q025              1.044    0.122    8.524    0.000
##     Q026              1.178    0.127    9.256    0.000
##     Q027              1.157    0.120    9.653    0.000
##     Q028              1.183    0.121    9.769    0.000
##     Q029              1.198    0.138    8.656    0.000
##     Q032              1.177    0.120    9.774    0.000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB ~                                               
##     TFL       (d1)    0.248    0.065    3.814    0.000
##   SFI ~                                               
##     TFL       (a1)    0.592    0.095    6.243    0.000
##   IIR ~                                               
##     SFI       (b1)    0.253    0.062    4.084    0.000
##   IWB ~                                               
##     IIR       (c1)    1.090    0.202    5.387    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .Q021 ~~                                             
##    .Q023              0.254    0.079    3.237    0.001
##  .Q025 ~~                                             
##    .Q029              0.165    0.085    1.949    0.051
##  .Q029 ~~                                             
##    .Q032              0.325    0.080    4.072    0.000
##  .Q034 ~~                                             
##    .Q035              0.238    0.066    3.584    0.000
##  .Q037 ~~                                             
##    .Q050              0.456    0.131    3.471    0.001
##  .Q050 ~~                                             
##    .Q051              0.271    0.095    2.843    0.004
##  .Q051 ~~                                             
##    .Q054              0.476    0.117    4.082    0.000
##  .Q070 ~~                                             
##    .Q071              0.278    0.062    4.458    0.000
##    .Q076             -0.046    0.039   -1.199    0.230
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .Q087              0.543    0.076    7.148    0.000
##    .Q088              0.714    0.100    7.169    0.000
##    .Q089              0.697    0.094    7.417    0.000
##    .Q090              0.985    0.128    7.704    0.000
##    .Q091              0.526    0.077    6.827    0.000
##    .Q092              0.661    0.089    7.403    0.000
##    .Q093              0.555    0.082    6.775    0.000
##    .Q094              0.792    0.110    7.230    0.000
##    .Q095              0.692    0.098    7.038    0.000
##    .Q070              0.484    0.072    6.713    0.000
##    .Q071              0.565    0.079    7.181    0.000
##    .Q075              0.465    0.071    6.526    0.000
##    .Q076              0.324    0.061    5.287    0.000
##    .Q077              0.449    0.065    6.876    0.000
##    .Q033              0.491    0.075    6.574    0.000
##    .Q034              0.659    0.093    7.115    0.000
##    .Q035              0.480    0.076    6.319    0.000
##    .Q037              1.607    0.209    7.694    0.000
##    .Q038              0.806    0.113    7.118    0.000
##    .Q044              0.625    0.092    6.807    0.000
##    .Q045              0.688    0.093    7.392    0.000
##    .Q049              0.869    0.118    7.335    0.000
##    .Q050              1.195    0.157    7.624    0.000
##    .Q051              1.114    0.144    7.715    0.000
##    .Q054              1.321    0.170    7.751    0.000
##    .Q014              0.984    0.127    7.724    0.000
##    .Q015              0.690    0.091    7.559    0.000
##    .Q016              0.878    0.114    7.669    0.000
##    .Q017              0.724    0.096    7.507    0.000
##    .Q018              0.562    0.076    7.373    0.000
##    .Q019              0.811    0.105    7.694    0.000
##    .Q020              0.692    0.092    7.541    0.000
##    .Q021              0.747    0.099    7.567    0.000
##    .Q022              0.498    0.068    7.324    0.000
##    .Q023              0.843    0.111    7.584    0.000
##    .Q024              0.384    0.053    7.237    0.000
##    .Q025              0.909    0.118    7.673    0.000
##    .Q026              0.774    0.103    7.512    0.000
##    .Q027              0.579    0.079    7.372    0.000
##    .Q028              0.559    0.076    7.318    0.000
##    .Q029              1.115    0.145    7.682    0.000
##    .Q032              0.551    0.075    7.313    0.000
##    .IWB               0.276    0.066    4.169    0.000
##    .IIR               0.230    0.068    3.373    0.001
##    .SFI               0.582    0.111    5.224    0.000
##     TFL               1.068    0.227    4.694    0.000
## 
## R-Square:
##                    Estimate
##     Q087              0.588
##     Q088              0.582
##     Q089              0.495
##     Q090              0.333
##     Q091              0.662
##     Q092              0.501
##     Q093              0.672
##     Q094              0.564
##     Q095              0.617
##     Q070              0.376
##     Q071              0.348
##     Q075              0.502
##     Q076              0.634
##     Q077              0.437
##     Q033              0.661
##     Q034              0.515
##     Q035              0.693
##     Q037              0.293
##     Q038              0.548
##     Q044              0.620
##     Q045              0.455
##     Q049              0.478
##     Q050              0.380
##     Q051              0.343
##     Q054              0.253
##     Q014              0.520
##     Q015              0.634
##     Q016              0.565
##     Q017              0.659
##     Q018              0.711
##     Q019              0.546
##     Q020              0.643
##     Q021              0.624
##     Q022              0.726
##     Q023              0.614
##     Q024              0.749
##     Q025              0.561
##     Q026              0.657
##     Q027              0.711
##     Q028              0.728
##     Q029              0.579
##     Q032              0.729
##     IWB               0.644
##     IIR               0.210
##     SFI               0.392
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)
##     DirEff            0.248    0.065    3.814    0.000
##     a1b1c1            0.163    0.046    3.591    0.000
##     IndEff            0.163    0.046    3.591    0.000
##     TotEff            0.412    0.079    5.237    0.000
modInd <- modificationIndices(fit51Pri2, minimum.value = 10)
# head(modInd[order(modInd$mi, decreasing=TRUE), ], 10)
subset(modInd[order(modInd$mi, decreasing=TRUE), ], mi > 5)
##      lhs op  rhs    mi    epc sepc.lv sepc.all sepc.nox
## 874 Q045 ~~ Q026 12.97  0.248   0.248    0.340    0.340
## 195  SFI =~ Q019 12.50 -0.409  -0.400   -0.299   -0.299
## 593 Q070 ~~ Q029 10.28 -0.162  -0.162   -0.220   -0.220
## 461 Q092 ~~ Q029 10.23 -0.226  -0.226   -0.263   -0.263
# Prepare PDF
# pdf("Model51pri2.pdf", width = 25, height = 16)
par(mar=c(7, 1, 7, 1))
par(oma=c(1, 1, 1, 1))

# Prepare fitmeasures
ParDF  <- as.data.frame(do.call(cbind, fit51Pri2@ParTable))
DirEff <- round(as.numeric(ParDF[ParDF$label == "DirEff", 14]), 4)
TotEff <- round(as.numeric(ParDF[ParDF$label == "TotEff", 14]), 4)
n      <- fit51Pri2@SampleStats@ntotal

fitMeas <- toString(c("ChiSq: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pri2, "chisq"))), 4),
        " - DF: ", gsub("[^0-9.]", "", fitMeasures(fit51Pri2, "df")),
        " - ChiSq/DF: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pri2, "chisq")))/ as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pri2, "df"))), 4),
        " - CFI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pri2, "cfi"))), 4),
        " - TLI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pri2, "tli"))), 4),
        " - RMSEA: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pri2, "rmsea"))), 4),
        " - SRMR: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pri2, "srmr"))), 4),
        " - n: ", n,
        " - DirEff: ", DirEff,
        " - TotalEff: ", TotEff
        ), 
        width = 255)
fitMeas <- gsub(",", "", fitMeas)

# Plot model
library(semPlot)
semPaths(fit51Pri2, what = "stand", whatLabels = "stand", intercepts = FALSE, residuals = FALSE, edge.label.cex = 0.5, edge.color = "blue", layout = "tree", rotation = 3, curve = 1, curvePivot = TRUE, mar = c(3,1,5,1), sizeLat = 7, sizeMan = 3, color = colorlist)
title(main = "A series of SFI and IIR Mediates Relationship TFL -> IWB - Model 51\n- Private Org 2 -", cex.main = 2.5, col.main = "darkblue", font.main = 3, sub = fitMeas, cex.sub = 1.4)

# dev.off()

10.6 Model 51-Pri/Pub: Model Including IIR + SFI as Mediator - Public

model51Pub <- '

# latent variables
 IWB =~ Q087 + Q088 + Q089 + Q090 + Q091 + Q092 + Q093 + Q094 + Q095
 IIR =~ Q070 + Q071 + Q075 + Q076 + Q077 
 SFI =~ Q033 + Q034 + Q035 + Q037 + Q038 + Q044 + Q045 + Q049 + Q050 + Q051 + Q054
 TFL =~ Q014 + Q015 + Q016 + Q017 + Q018 + Q019 + Q020 + Q021 + Q022 + Q023 + Q024 + Q025 + Q026 + Q027 + Q028 + Q029 + Q032

# direct effect
 IWB ~ d1 * TFL
 DirEff := d1

# mediator
 SFI ~ a1 * TFL
 IIR ~ a2 * TFL
 IIR ~ b1 * SFI
 IWB ~ c1 * IIR

# indirect effect
 a1b1c1 := a1 * b1 * c1 + a2 * c1
 IndEff := a1b1c1

# total effect
 TotEff := d1 + (a1 * b1 * c1) + (a2 * c1)

# covariances
 Q014 ~~ Q015
 Q017 ~~ Q029
 Q018 ~~ Q020
 Q025 ~~ Q032
 Q033 ~~ Q037
 Q029 ~~ Q032
 Q034 ~~ Q035
 Q034 ~~ Q037
 Q050 ~~ Q051
 Q051 ~~ Q054
 Q071 ~~ Q076

'

# Calculate fit for Public
fit51Pub <- sem(model51Pub, data = DFpub)

# Print results (fit indices, parameters, hypothesis tests)
summary(fit51Pub, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6-12 ended normally after 44 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                       100
## 
##   Number of observations                           235
## 
## Model Test User Model:
##                                                       
##   Test statistic                              1389.663
##   Degrees of freedom                               803
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              8892.660
##   Degrees of freedom                               861
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.927
##   Tucker-Lewis Index (TLI)                       0.922
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -12520.680
##   Loglikelihood unrestricted model (H1)     -11825.849
##                                                       
##   Akaike (AIC)                               25241.361
##   Bayesian (BIC)                             25587.319
##   Sample-size adjusted Bayesian (BIC)        25270.361
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.056
##   90 Percent confidence interval - lower         0.051
##   90 Percent confidence interval - upper         0.061
##   P-value RMSEA <= 0.05                          0.028
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.049
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB =~                                              
##     Q087              1.000                           
##     Q088              1.082    0.062   17.414    0.000
##     Q089              0.886    0.057   15.417    0.000
##     Q090              0.888    0.070   12.771    0.000
##     Q091              1.083    0.059   18.427    0.000
##     Q092              0.973    0.055   17.608    0.000
##     Q093              1.001    0.059   17.066    0.000
##     Q094              1.087    0.066   16.517    0.000
##     Q095              0.852    0.061   14.023    0.000
##   IIR =~                                              
##     Q070              1.000                           
##     Q071              1.483    0.149    9.942    0.000
##     Q075              1.293    0.134    9.646    0.000
##     Q076              1.192    0.130    9.155    0.000
##     Q077              0.767    0.105    7.318    0.000
##   SFI =~                                              
##     Q033              1.000                           
##     Q034              0.997    0.075   13.276    0.000
##     Q035              0.901    0.068   13.263    0.000
##     Q037              0.904    0.091    9.909    0.000
##     Q038              0.952    0.071   13.328    0.000
##     Q044              0.915    0.074   12.406    0.000
##     Q045              0.889    0.073   12.107    0.000
##     Q049              0.967    0.077   12.573    0.000
##     Q050              0.858    0.084   10.195    0.000
##     Q051              0.853    0.083   10.238    0.000
##     Q054              0.891    0.088   10.115    0.000
##   TFL =~                                              
##     Q014              1.000                           
##     Q015              0.974    0.055   17.682    0.000
##     Q016              0.841    0.063   13.263    0.000
##     Q017              0.978    0.072   13.637    0.000
##     Q018              1.046    0.067   15.583    0.000
##     Q019              0.916    0.062   14.867    0.000
##     Q020              1.032    0.068   15.257    0.000
##     Q021              1.006    0.063   15.949    0.000
##     Q022              0.937    0.066   14.106    0.000
##     Q023              1.071    0.066   16.299    0.000
##     Q024              1.024    0.060   17.116    0.000
##     Q025              0.836    0.062   13.518    0.000
##     Q026              0.928    0.061   15.200    0.000
##     Q027              0.937    0.060   15.536    0.000
##     Q028              0.928    0.062   14.865    0.000
##     Q029              0.993    0.078   12.691    0.000
##     Q032              1.062    0.069   15.291    0.000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB ~                                               
##     TFL       (d1)    0.296    0.070    4.203    0.000
##   SFI ~                                               
##     TFL       (a1)    0.611    0.062    9.923    0.000
##   IIR ~                                               
##     TFL       (a2)    0.182    0.045    4.062    0.000
##     SFI       (b1)    0.341    0.056    6.050    0.000
##   IWB ~                                               
##     IIR       (c1)    0.861    0.142    6.085    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .Q014 ~~                                             
##    .Q015              0.151    0.042    3.616    0.000
##  .Q017 ~~                                             
##    .Q029              0.223    0.061    3.652    0.000
##  .Q018 ~~                                             
##    .Q020              0.144    0.044    3.309    0.001
##  .Q025 ~~                                             
##    .Q032              0.149    0.042    3.552    0.000
##  .Q033 ~~                                             
##    .Q037             -0.202    0.051   -3.957    0.000
##  .Q029 ~~                                             
##    .Q032              0.302    0.057    5.277    0.000
##  .Q034 ~~                                             
##    .Q035              0.158    0.046    3.425    0.001
##    .Q037             -0.206    0.053   -3.900    0.000
##  .Q050 ~~                                             
##    .Q051              0.294    0.070    4.168    0.000
##  .Q051 ~~                                             
##    .Q054              0.441    0.080    5.502    0.000
##  .Q071 ~~                                             
##    .Q076             -0.216    0.047   -4.632    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .Q087              0.380    0.041    9.273    0.000
##    .Q088              0.524    0.055    9.508    0.000
##    .Q089              0.533    0.053    9.966    0.000
##    .Q090              0.924    0.089   10.334    0.000
##    .Q091              0.418    0.046    9.168    0.000
##    .Q092              0.406    0.043    9.451    0.000
##    .Q093              0.483    0.050    9.605    0.000
##    .Q094              0.640    0.066    9.741    0.000
##    .Q095              0.656    0.064   10.184    0.000
##    .Q070              0.557    0.056    9.909    0.000
##    .Q071              0.514    0.068    7.526    0.000
##    .Q075              0.574    0.062    9.271    0.000
##    .Q076              0.531    0.062    8.532    0.000
##    .Q077              0.604    0.058   10.348    0.000
##    .Q033              0.510    0.056    9.109    0.000
##    .Q034              0.624    0.067    9.338    0.000
##    .Q035              0.521    0.054    9.572    0.000
##    .Q037              0.922    0.093    9.920    0.000
##    .Q038              0.580    0.060    9.729    0.000
##    .Q044              0.691    0.069    9.982    0.000
##    .Q045              0.707    0.070   10.049    0.000
##    .Q049              0.738    0.074    9.942    0.000
##    .Q050              1.094    0.106   10.364    0.000
##    .Q051              1.067    0.102   10.508    0.000
##    .Q054              1.207    0.116   10.374    0.000
##    .Q014              0.578    0.057   10.108    0.000
##    .Q015              0.563    0.056   10.126    0.000
##    .Q016              0.673    0.065   10.412    0.000
##    .Q017              0.830    0.080   10.369    0.000
##    .Q018              0.577    0.057   10.035    0.000
##    .Q019              0.536    0.052   10.201    0.000
##    .Q020              0.613    0.061   10.098    0.000
##    .Q021              0.484    0.048    9.986    0.000
##    .Q022              0.679    0.066   10.313    0.000
##    .Q023              0.496    0.050    9.897    0.000
##    .Q024              0.354    0.037    9.630    0.000
##    .Q025              0.624    0.060   10.370    0.000
##    .Q026              0.503    0.050   10.143    0.000
##    .Q027              0.469    0.047   10.078    0.000
##    .Q028              0.550    0.054   10.201    0.000
##    .Q029              1.076    0.102   10.564    0.000
##    .Q032              0.644    0.063   10.229    0.000
##    .IWB               0.496    0.066    7.547    0.000
##    .IIR               0.165    0.033    4.964    0.000
##    .SFI               0.517    0.074    7.003    0.000
##     TFL               1.186    0.155    7.645    0.000
## 
## R-Square:
##                    Estimate
##     Q087              0.749
##     Q088              0.718
##     Q089              0.626
##     Q090              0.493
##     Q091              0.761
##     Q092              0.726
##     Q093              0.702
##     Q094              0.678
##     Q095              0.557
##     Q070              0.422
##     Q071              0.635
##     Q075              0.542
##     Q076              0.521
##     Q077              0.283
##     Q033              0.653
##     Q034              0.605
##     Q035              0.600
##     Q037              0.460
##     Q038              0.600
##     Q044              0.538
##     Q045              0.518
##     Q049              0.549
##     Q050              0.392
##     Q051              0.396
##     Q054              0.387
##     Q014              0.672
##     Q015              0.666
##     Q016              0.555
##     Q017              0.577
##     Q018              0.692
##     Q019              0.650
##     Q020              0.673
##     Q021              0.713
##     Q022              0.605
##     Q023              0.733
##     Q024              0.778
##     Q025              0.570
##     Q026              0.670
##     Q027              0.689
##     Q028              0.650
##     Q029              0.521
##     Q032              0.675
##     IWB               0.564
##     IIR               0.593
##     SFI               0.461
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)
##     DirEff            0.296    0.070    4.203    0.000
##     a1b1c1            0.336    0.059    5.713    0.000
##     IndEff            0.336    0.059    5.713    0.000
##     TotEff            0.632    0.064    9.934    0.000
modInd <- modificationIndices(fit51Pub, minimum.value = 10)
# head(modInd[order(modInd$mi, decreasing=TRUE), ], 10)
subset(modInd[order(modInd$mi, decreasing=TRUE), ], mi > 5)
##       lhs op  rhs    mi    epc sepc.lv sepc.all sepc.nox
## 189   SFI =~ Q071 22.69  0.563   0.552    0.465    0.465
## 521  Q094 ~~ Q017 14.99  0.190   0.190    0.261    0.261
## 457  Q092 ~~ Q022 13.52  0.138   0.138    0.262    0.262
## 220   TFL =~ Q071 12.96  0.323   0.351    0.296    0.296
## 526  Q094 ~~ Q022 12.83 -0.166  -0.166   -0.252   -0.252
## 913  Q050 ~~ Q024 12.16 -0.145  -0.145   -0.233   -0.233
## 687  Q076 ~~ Q029 11.93 -0.167  -0.167   -0.221   -0.221
## 918  Q050 ~~ Q029 11.31  0.207   0.207    0.191    0.191
## 1019 Q018 ~~ Q029 11.18  0.154   0.154    0.195    0.195
## 940  Q054 ~~ Q017 11.15  0.198   0.198    0.198    0.198
## 1029 Q019 ~~ Q028 10.66 -0.124  -0.124   -0.228   -0.228
## 535  Q095 ~~ Q070 10.46  0.136   0.136    0.226    0.226
## 882  Q049 ~~ Q050 10.22  0.191   0.191    0.213    0.213
## 1083 Q028 ~~ Q029 10.20  0.149   0.149    0.194    0.194
# Prepare PDF
# pdf("Model51pub.pdf", width = 25, height = 16)
par(mar=c(7, 1, 7, 1))
par(oma=c(1, 1, 1, 1))

# Prepare fitmeasures
ParDF  <- as.data.frame(do.call(cbind, fit51Pub@ParTable))
DirEff <- round(as.numeric(ParDF[ParDF$label == "DirEff", 14]), 4)
TotEff <- round(as.numeric(ParDF[ParDF$label == "TotEff", 14]), 4)
n      <- fit51Pub@SampleStats@ntotal

fitMeas <- toString(c("ChiSq: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pub, "chisq"))), 4),
        " - DF: ", gsub("[^0-9.]", "", fitMeasures(fit51Pub, "df")),
        " - ChiSq/DF: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pub, "chisq")))/ as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pub, "df"))), 4),
        " - CFI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pub, "cfi"))), 4),
        " - TLI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pub, "tli"))), 4),
        " - RMSEA: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pub, "rmsea"))), 4),
        " - SRMR: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pub, "srmr"))), 4),
        " - n: ", n,
        " - DirEff: ", DirEff,
        " - TotalEff: ", TotEff
        ), 
        width = 255)
fitMeas <- gsub(",", "", fitMeas)

# Plot model
library(semPlot)
semPaths(fit51Pub, what = "stand", whatLabels = "stand", intercepts = FALSE, residuals = FALSE, edge.label.cex = 0.5, edge.color = "blue", layout = "tree", rotation = 3, curve = 1, curvePivot = TRUE, mar = c(3,1,5,1), sizeLat = 7, sizeMan = 3, color = colorlist)
title(main = "SFI Mediates Relationship TFL -> IWB, IIR Mediates TFL -> SFI - Model 51\n- Public -", cex.main = 2.5, col.main = "darkblue", font.main = 3, sub = fitMeas, cex.sub = 1.4)

# dev.off()

This model shows how IIR mediates the relationship between TFL and IWB, whereas SFI mediates the relationship between TFL and IIR. This model reaches CFI = 0.927 and TLI = 0.922, RMSEA = 0.056 and SRMR = 0.049 with all effects significant with p-value < 0.01. This model might be a good representation of the data given by Public Sector organisations. The overall effect of TFL on IWB is highest with this model with 0.632.

10.7 Model 51-Pri/Pub: Model Including IIR + SFI as Mediator - Public Org 2

# Calculate fit for Public
fit51Pub2 <- sem(model51Pub, data = DFpub2)

# Print results (fit indices, parameters, hypothesis tests)
summary(fit51Pub2, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6-12 ended normally after 46 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                       100
## 
##   Number of observations                           155
## 
## Model Test User Model:
##                                                       
##   Test statistic                              1255.738
##   Degrees of freedom                               803
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              6425.105
##   Degrees of freedom                               861
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.919
##   Tucker-Lewis Index (TLI)                       0.913
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -7854.268
##   Loglikelihood unrestricted model (H1)      -7226.399
##                                                       
##   Akaike (AIC)                               15908.536
##   Bayesian (BIC)                             16212.878
##   Sample-size adjusted Bayesian (BIC)        15896.355
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.060
##   90 Percent confidence interval - lower         0.054
##   90 Percent confidence interval - upper         0.067
##   P-value RMSEA <= 0.05                          0.005
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.055
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB =~                                              
##     Q087              1.000                           
##     Q088              1.080    0.075   14.321    0.000
##     Q089              0.924    0.065   14.220    0.000
##     Q090              0.981    0.080   12.216    0.000
##     Q091              1.099    0.070   15.657    0.000
##     Q092              0.994    0.067   14.837    0.000
##     Q093              0.996    0.067   14.979    0.000
##     Q094              1.081    0.075   14.371    0.000
##     Q095              0.823    0.070   11.776    0.000
##   IIR =~                                              
##     Q070              1.000                           
##     Q071              1.578    0.210    7.523    0.000
##     Q075              1.284    0.181    7.109    0.000
##     Q076              1.150    0.177    6.504    0.000
##     Q077              0.824    0.140    5.881    0.000
##   SFI =~                                              
##     Q033              1.000                           
##     Q034              1.103    0.108   10.223    0.000
##     Q035              0.867    0.092    9.430    0.000
##     Q037              0.928    0.125    7.406    0.000
##     Q038              0.990    0.094   10.497    0.000
##     Q044              0.956    0.104    9.212    0.000
##     Q045              0.960    0.102    9.435    0.000
##     Q049              0.989    0.095   10.371    0.000
##     Q050              1.022    0.109    9.351    0.000
##     Q051              0.873    0.108    8.094    0.000
##     Q054              0.886    0.117    7.567    0.000
##   TFL =~                                              
##     Q014              1.000                           
##     Q015              0.974    0.067   14.452    0.000
##     Q016              0.879    0.078   11.227    0.000
##     Q017              1.013    0.087   11.621    0.000
##     Q018              1.097    0.079   13.933    0.000
##     Q019              0.878    0.075   11.745    0.000
##     Q020              1.046    0.078   13.415    0.000
##     Q021              0.993    0.074   13.427    0.000
##     Q022              0.978    0.078   12.563    0.000
##     Q023              1.108    0.078   14.209    0.000
##     Q024              1.033    0.071   14.551    0.000
##     Q025              0.853    0.070   12.208    0.000
##     Q026              0.958    0.074   13.030    0.000
##     Q027              0.953    0.073   13.050    0.000
##     Q028              1.001    0.073   13.677    0.000
##     Q029              1.121    0.090   12.438    0.000
##     Q032              1.048    0.078   13.477    0.000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB ~                                               
##     TFL       (d1)    0.264    0.084    3.128    0.002
##   SFI ~                                               
##     TFL       (a1)    0.574    0.073    7.917    0.000
##   IIR ~                                               
##     TFL       (a2)    0.134    0.051    2.644    0.008
##     SFI       (b1)    0.371    0.075    4.972    0.000
##   IWB ~                                               
##     IIR       (c1)    0.913    0.190    4.815    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .Q014 ~~                                             
##    .Q015              0.140    0.047    2.982    0.003
##  .Q017 ~~                                             
##    .Q029              0.227    0.064    3.566    0.000
##  .Q018 ~~                                             
##    .Q020             -0.032    0.042   -0.758    0.449
##  .Q025 ~~                                             
##    .Q032              0.081    0.039    2.086    0.037
##  .Q033 ~~                                             
##    .Q037             -0.226    0.062   -3.642    0.000
##  .Q029 ~~                                             
##    .Q032              0.204    0.052    3.948    0.000
##  .Q034 ~~                                             
##    .Q035              0.156    0.056    2.801    0.005
##    .Q037             -0.184    0.062   -2.959    0.003
##  .Q050 ~~                                             
##    .Q051              0.103    0.066    1.563    0.118
##  .Q051 ~~                                             
##    .Q054              0.388    0.090    4.306    0.000
##  .Q071 ~~                                             
##    .Q076             -0.231    0.055   -4.235    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .Q087              0.298    0.040    7.449    0.000
##    .Q088              0.514    0.065    7.892    0.000
##    .Q089              0.386    0.049    7.914    0.000
##    .Q090              0.694    0.084    8.248    0.000
##    .Q091              0.385    0.051    7.538    0.000
##    .Q092              0.385    0.050    7.771    0.000
##    .Q093              0.374    0.048    7.735    0.000
##    .Q094              0.510    0.065    7.881    0.000
##    .Q095              0.542    0.065    8.303    0.000
##    .Q070              0.552    0.068    8.164    0.000
##    .Q071              0.443    0.076    5.821    0.000
##    .Q075              0.539    0.070    7.675    0.000
##    .Q076              0.552    0.076    7.267    0.000
##    .Q077              0.504    0.060    8.335    0.000
##    .Q033              0.544    0.070    7.742    0.000
##    .Q034              0.625    0.082    7.632    0.000
##    .Q035              0.535    0.067    8.046    0.000
##    .Q037              0.875    0.107    8.156    0.000
##    .Q038              0.462    0.059    7.801    0.000
##    .Q044              0.717    0.087    8.206    0.000
##    .Q045              0.665    0.082    8.153    0.000
##    .Q049              0.486    0.062    7.854    0.000
##    .Q050              0.776    0.095    8.164    0.000
##    .Q051              0.899    0.107    8.420    0.000
##    .Q054              1.129    0.133    8.475    0.000
##    .Q014              0.475    0.058    8.221    0.000
##    .Q015              0.583    0.070    8.347    0.000
##    .Q016              0.660    0.078    8.488    0.000
##    .Q017              0.783    0.093    8.448    0.000
##    .Q018              0.463    0.058    8.042    0.000
##    .Q019              0.569    0.067    8.439    0.000
##    .Q020              0.495    0.061    8.148    0.000
##    .Q021              0.446    0.054    8.207    0.000
##    .Q022              0.560    0.067    8.343    0.000
##    .Q023              0.433    0.054    8.038    0.000
##    .Q024              0.335    0.042    7.943    0.000
##    .Q025              0.470    0.056    8.373    0.000
##    .Q026              0.468    0.057    8.275    0.000
##    .Q027              0.460    0.056    8.272    0.000
##    .Q028              0.419    0.051    8.159    0.000
##    .Q029              0.761    0.090    8.463    0.000
##    .Q032              0.488    0.059    8.229    0.000
##    .IWB               0.499    0.078    6.385    0.000
##    .IIR               0.135    0.036    3.745    0.000
##    .SFI               0.426    0.080    5.345    0.000
##     TFL               1.113    0.173    6.420    0.000
## 
## R-Square:
##                    Estimate
##     Q087              0.777
##     Q088              0.701
##     Q089              0.696
##     Q090              0.589
##     Q091              0.765
##     Q092              0.726
##     Q093              0.733
##     Q094              0.704
##     Q095              0.564
##     Q070              0.372
##     Q071              0.648
##     Q075              0.500
##     Q076              0.439
##     Q077              0.306
##     Q033              0.593
##     Q034              0.607
##     Q035              0.527
##     Q037              0.438
##     Q038              0.627
##     Q044              0.503
##     Q045              0.524
##     Q049              0.615
##     Q050              0.516
##     Q051              0.402
##     Q054              0.355
##     Q014              0.701
##     Q015              0.644
##     Q016              0.566
##     Q017              0.593
##     Q018              0.743
##     Q019              0.601
##     Q020              0.711
##     Q021              0.711
##     Q022              0.656
##     Q023              0.760
##     Q024              0.780
##     Q025              0.633
##     Q026              0.686
##     Q027              0.687
##     Q028              0.727
##     Q029              0.648
##     Q032              0.715
##     IWB               0.518
##     IIR               0.588
##     SFI               0.463
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)
##     DirEff            0.264    0.084    3.128    0.002
##     a1b1c1            0.316    0.069    4.576    0.000
##     IndEff            0.316    0.069    4.576    0.000
##     TotEff            0.580    0.076    7.663    0.000
modInd <- modificationIndices(fit51Pub2, minimum.value = 10)
# head(modInd[order(modInd$mi, decreasing=TRUE), ], 10)
subset(modInd[order(modInd$mi, decreasing=TRUE), ], mi > 5)
##      lhs op  rhs    mi   epc sepc.lv sepc.all sepc.nox
## 983 Q015 ~~ Q032 14.16 0.148   0.148    0.278    0.278
## 277 Q088 ~~ Q090 11.69 0.181   0.181    0.303    0.303
# Prepare PDF
# pdf("Model51pub2.pdf", width = 25, height = 16)
par(mar=c(7, 1, 7, 1))
par(oma=c(1, 1, 1, 1))

# Prepare fitmeasures
ParDF  <- as.data.frame(do.call(cbind, fit51Pub2@ParTable))
DirEff <- round(as.numeric(ParDF[ParDF$label == "DirEff", 14]), 4)
TotEff <- round(as.numeric(ParDF[ParDF$label == "TotEff", 14]), 4)
n      <- fit51Pub2@SampleStats@ntotal

fitMeas <- toString(c("ChiSq: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pub2, "chisq"))), 4),
        " - DF: ", gsub("[^0-9.]", "", fitMeasures(fit51Pub2, "df")),
        " - ChiSq/DF: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pub2, "chisq")))/ as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pub2, "df"))), 4),
        " - CFI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pub2, "cfi"))), 4),
        " - TLI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pub2, "tli"))), 4),
        " - RMSEA: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pub2, "rmsea"))), 4),
        " - SRMR: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pub2, "srmr"))), 4),
        " - n: ", n,
        " - DirEff: ", DirEff,
        " - TotalEff: ", TotEff
        ), 
        width = 255)
fitMeas <- gsub(",", "", fitMeas)

# Plot model
library(semPlot)
semPaths(fit51Pub2, what = "stand", whatLabels = "stand", intercepts = FALSE, residuals = FALSE, edge.label.cex = 0.5, edge.color = "blue", layout = "tree", rotation = 3, curve = 1, curvePivot = TRUE, mar = c(3,1,5,1), sizeLat = 7, sizeMan = 3, color = colorlist)
title(main = "SFI Mediates Relationship TFL -> IWB, IIR Mediates TFL -> SFI - Model 51\n- Public Org 2 -", cex.main = 2.5, col.main = "darkblue", font.main = 3, sub = fitMeas, cex.sub = 1.4)

# dev.off()

10.8 Model 51-Pri/Pub: Model Including IIR + SFI as Mediator - Public Org 3

# Calculate fit for Public
fit51Pub3 <- sem(model51Pub, data = DFpub3)

# Print results (fit indices, parameters, hypothesis tests)
summary(fit51Pub3, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6-12 ended normally after 46 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                       100
## 
##   Number of observations                            54
## 
## Model Test User Model:
##                                                       
##   Test statistic                              1696.462
##   Degrees of freedom                               803
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              3574.994
##   Degrees of freedom                               861
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.671
##   Tucker-Lewis Index (TLI)                       0.647
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -2981.740
##   Loglikelihood unrestricted model (H1)      -2133.508
##                                                       
##   Akaike (AIC)                                6163.479
##   Bayesian (BIC)                              6362.378
##   Sample-size adjusted Bayesian (BIC)         6048.209
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.144
##   90 Percent confidence interval - lower         0.134
##   90 Percent confidence interval - upper         0.153
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.084
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB =~                                              
##     Q087              1.000                           
##     Q088              1.003    0.121    8.304    0.000
##     Q089              0.849    0.118    7.199    0.000
##     Q090              0.747    0.131    5.722    0.000
##     Q091              1.050    0.110    9.517    0.000
##     Q092              0.918    0.103    8.909    0.000
##     Q093              0.860    0.111    7.772    0.000
##     Q094              0.941    0.135    6.997    0.000
##     Q095              0.850    0.125    6.784    0.000
##   IIR =~                                              
##     Q070              1.000                           
##     Q071              1.184    0.163    7.251    0.000
##     Q075              1.091    0.153    7.154    0.000
##     Q076              1.072    0.147    7.279    0.000
##     Q077              0.478    0.155    3.088    0.002
##   SFI =~                                              
##     Q033              1.000                           
##     Q034              0.824    0.098    8.399    0.000
##     Q035              0.891    0.093    9.598    0.000
##     Q037              0.879    0.133    6.595    0.000
##     Q038              0.887    0.123    7.203    0.000
##     Q044              0.768    0.104    7.390    0.000
##     Q045              0.801    0.107    7.479    0.000
##     Q049              0.936    0.132    7.081    0.000
##     Q050              0.819    0.131    6.256    0.000
##     Q051              0.915    0.135    6.767    0.000
##     Q054              0.863    0.145    5.955    0.000
##   TFL =~                                              
##     Q014              1.000                           
##     Q015              1.005    0.123    8.151    0.000
##     Q016              0.920    0.138    6.654    0.000
##     Q017              0.933    0.153    6.102    0.000
##     Q018              0.950    0.156    6.089    0.000
##     Q019              1.055    0.145    7.279    0.000
##     Q020              0.986    0.164    5.993    0.000
##     Q021              1.086    0.153    7.091    0.000
##     Q022              0.911    0.157    5.800    0.000
##     Q023              1.108    0.158    7.025    0.000
##     Q024              1.055    0.144    7.340    0.000
##     Q025              0.850    0.156    5.437    0.000
##     Q026              0.974    0.142    6.852    0.000
##     Q027              0.992    0.129    7.664    0.000
##     Q028              0.852    0.137    6.235    0.000
##     Q029              1.005    0.175    5.729    0.000
##     Q032              1.192    0.183    6.501    0.000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB ~                                               
##     TFL       (d1)    0.320    0.138    2.317    0.021
##   SFI ~                                               
##     TFL       (a1)    0.771    0.155    4.961    0.000
##   IIR ~                                               
##     TFL       (a2)    0.301    0.119    2.526    0.012
##     SFI       (b1)    0.351    0.107    3.284    0.001
##   IWB ~                                               
##     IIR       (c1)    0.822    0.190    4.316    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .Q014 ~~                                             
##    .Q015              0.196    0.105    1.870    0.061
##  .Q017 ~~                                             
##    .Q029              0.112    0.137    0.817    0.414
##  .Q018 ~~                                             
##    .Q020              0.618    0.163    3.780    0.000
##  .Q025 ~~                                             
##    .Q032              0.326    0.150    2.171    0.030
##  .Q033 ~~                                             
##    .Q037             -0.064    0.107   -0.604    0.546
##  .Q029 ~~                                             
##    .Q032              0.406    0.168    2.422    0.015
##  .Q034 ~~                                             
##    .Q035              0.040    0.063    0.636    0.525
##    .Q037             -0.147    0.097   -1.515    0.130
##  .Q050 ~~                                             
##    .Q051              0.402    0.154    2.610    0.009
##  .Q051 ~~                                             
##    .Q054              0.415    0.168    2.464    0.014
##  .Q071 ~~                                             
##    .Q076             -0.074    0.083   -0.887    0.375
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .Q087              0.446    0.101    4.429    0.000
##    .Q088              0.610    0.132    4.634    0.000
##    .Q089              0.692    0.143    4.842    0.000
##    .Q090              0.998    0.199    5.006    0.000
##    .Q091              0.386    0.091    4.218    0.000
##    .Q092              0.392    0.088    4.462    0.000
##    .Q093              0.561    0.118    4.747    0.000
##    .Q094              0.924    0.190    4.870    0.000
##    .Q095              0.823    0.168    4.898    0.000
##    .Q070              0.364    0.086    4.223    0.000
##    .Q071              0.502    0.129    3.901    0.000
##    .Q075              0.494    0.114    4.348    0.000
##    .Q076              0.405    0.104    3.885    0.000
##    .Q077              0.900    0.176    5.111    0.000
##    .Q033              0.488    0.114    4.290    0.000
##    .Q034              0.424    0.098    4.330    0.000
##    .Q035              0.289    0.073    3.976    0.000
##    .Q037              0.937    0.197    4.748    0.000
##    .Q038              0.840    0.174    4.839    0.000
##    .Q044              0.584    0.121    4.810    0.000
##    .Q045              0.611    0.127    4.795    0.000
##    .Q049              0.984    0.203    4.857    0.000
##    .Q050              1.061    0.214    4.954    0.000
##    .Q051              1.069    0.213    5.010    0.000
##    .Q054              1.341    0.269    4.983    0.000
##    .Q014              0.752    0.154    4.886    0.000
##    .Q015              0.622    0.129    4.822    0.000
##    .Q016              0.603    0.124    4.882    0.000
##    .Q017              0.863    0.174    4.968    0.000
##    .Q018              0.901    0.181    4.970    0.000
##    .Q019              0.523    0.111    4.720    0.000
##    .Q020              1.025    0.206    4.982    0.000
##    .Q021              0.633    0.132    4.778    0.000
##    .Q022              0.978    0.195    5.006    0.000
##    .Q023              0.689    0.144    4.797    0.000
##    .Q024              0.501    0.107    4.698    0.000
##    .Q025              1.043    0.207    5.038    0.000
##    .Q026              0.596    0.123    4.840    0.000
##    .Q027              0.343    0.075    4.554    0.000
##    .Q028              0.665    0.134    4.952    0.000
##    .Q029              1.237    0.246    5.019    0.000
##    .Q032              1.111    0.223    4.981    0.000
##    .IWB               0.365    0.109    3.341    0.001
##    .IIR               0.312    0.094    3.301    0.001
##    .SFI               0.845    0.220    3.847    0.000
##     TFL               1.248    0.361    3.463    0.001
## 
## R-Square:
##                    Estimate
##     Q087              0.762
##     Q088              0.702
##     Q089              0.598
##     Q090              0.444
##     Q091              0.803
##     Q092              0.754
##     Q093              0.653
##     Q094              0.577
##     Q095              0.556
##     Q070              0.693
##     Q071              0.697
##     Q075              0.665
##     Q076              0.701
##     Q077              0.173
##     Q033              0.765
##     Q034              0.718
##     Q035              0.813
##     Q037              0.567
##     Q038              0.598
##     Q044              0.616
##     Q045              0.625
##     Q049              0.586
##     Q050              0.501
##     Q051              0.554
##     Q054              0.469
##     Q014              0.624
##     Q015              0.669
##     Q016              0.637
##     Q017              0.558
##     Q018              0.556
##     Q019              0.726
##     Q020              0.542
##     Q021              0.700
##     Q022              0.515
##     Q023              0.690
##     Q024              0.735
##     Q025              0.464
##     Q026              0.665
##     Q027              0.781
##     Q028              0.577
##     Q029              0.505
##     Q032              0.615
##     IWB               0.744
##     IIR               0.622
##     SFI               0.468
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)
##     DirEff            0.320    0.138    2.317    0.021
##     a1b1c1            0.470    0.134    3.503    0.000
##     IndEff            0.470    0.134    3.503    0.000
##     TotEff            0.790    0.147    5.385    0.000
modInd <- modificationIndices(fit51Pub3, minimum.value = 10)
# head(modInd[order(modInd$mi, decreasing=TRUE), ], 10)
subset(modInd[order(modInd$mi, decreasing=TRUE), ], mi > 5)
##      lhs op  rhs    mi    epc sepc.lv sepc.all sepc.nox
## 946 Q054 ~~ Q023 13.55  0.469   0.469    0.488    0.488
## 342 Q089 ~~ Q018 11.37  0.288   0.288    0.365    0.365
## 937 Q054 ~~ Q014 10.66 -0.406  -0.406   -0.404   -0.404
## 599 Q070 ~~ Q032 10.26 -0.271  -0.271   -0.427   -0.427
## 979 Q015 ~~ Q026 10.21  0.270   0.270    0.444    0.444
## 434 Q092 ~~ Q071 10.06 -0.233  -0.233   -0.524   -0.524
## 457 Q092 ~~ Q022 10.01  0.292   0.292    0.471    0.471
# Prepare PDF
# pdf("Model51pub2.pdf", width = 25, height = 16)
par(mar=c(7, 1, 7, 1))
par(oma=c(1, 1, 1, 1))

# Prepare fitmeasures
ParDF  <- as.data.frame(do.call(cbind, fit51Pub3@ParTable))
DirEff <- round(as.numeric(ParDF[ParDF$label == "DirEff", 14]), 4)
TotEff <- round(as.numeric(ParDF[ParDF$label == "TotEff", 14]), 4)
n      <- fit51Pub3@SampleStats@ntotal

fitMeas <- toString(c("ChiSq: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pub3, "chisq"))), 4),
        " - DF: ", gsub("[^0-9.]", "", fitMeasures(fit51Pub3, "df")),
        " - ChiSq/DF: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pub3, "chisq")))/ as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pub3, "df"))), 4),
        " - CFI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pub3, "cfi"))), 4),
        " - TLI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pub3, "tli"))), 4),
        " - RMSEA: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pub3, "rmsea"))), 4),
        " - SRMR: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit51Pub3, "srmr"))), 4),
        " - n: ", n,
        " - DirEff: ", DirEff,
        " - TotalEff: ", TotEff
        ), 
        width = 255)
fitMeas <- gsub(",", "", fitMeas)

# Plot model
library(semPlot)
semPaths(fit51Pub3, what = "stand", whatLabels = "stand", intercepts = FALSE, residuals = FALSE, edge.label.cex = 0.5, edge.color = "blue", layout = "tree", rotation = 3, curve = 1, curvePivot = TRUE, mar = c(3,1,5,1), sizeLat = 7, sizeMan = 3, color = colorlist)
title(main = "SFI Mediates Relationship TFL -> IWB, IIR Mediates TFL -> SFI - Model 51\n- Public Org 3 -", cex.main = 2.5, col.main = "darkblue", font.main = 3, sub = fitMeas, cex.sub = 1.4)

# dev.off()

10.9 Comparing Private-Public Model Fit Measures

# Compare fit measures
cbind(Private  = round(inspect(fit51Pri, 'fit.measures'), 4), 
      Public   = round(inspect(fit51Pub, 'fit.measures'), 4),
      Private1 = round(inspect(fit51Pri1, 'fit.measures'), 4),
      Private2 = round(inspect(fit51Pri2, 'fit.measures'), 4),
      Public2  = round(inspect(fit51Pub2, 'fit.measures'), 4),
      Public3  = round(inspect(fit51Pub3, 'fit.measures'), 4)
      )
##                        Private     Public   Private1   Private2    Public2
## npar                 9.700e+01  1.000e+02    97.0000    97.0000   100.0000
## fmin                 2.817e+00  2.957e+00     7.7353     5.5011     4.0508
## chisq                1.392e+03  1.390e+03  1392.3581  1408.2921  1255.7378
## df                   8.060e+02  8.030e+02   806.0000   806.0000   803.0000
## pvalue               0.000e+00  0.000e+00     0.0000     0.0000     0.0000
## baseline.chisq       8.460e+03  8.893e+03  4157.6938  5074.4041  6425.1047
## baseline.df          8.610e+02  8.610e+02   861.0000   861.0000   861.0000
## baseline.pvalue      0.000e+00  0.000e+00     0.0000     0.0000     0.0000
## cfi                  9.229e-01  9.270e-01     0.8221     0.8571     0.9186
## tli                  9.177e-01  9.217e-01     0.8100     0.8473     0.9128
## nnfi                 9.177e-01  9.217e-01     0.8100     0.8473     0.9128
## rfi                  8.243e-01  8.324e-01     0.6423     0.7035     0.7904
## nfi                  8.355e-01  8.437e-01     0.6651     0.7225     0.8046
## pnfi                 7.821e-01  7.869e-01     0.6226     0.6763     0.7504
## ifi                  9.235e-01  9.275e-01     0.8251     0.8589     0.9195
## rni                  9.229e-01  9.270e-01     0.8221     0.8571     0.9186
## logl                -1.383e+04 -1.252e+04 -4939.8530 -7112.0455 -7854.2679
## unrestricted.logl   -1.314e+04 -1.183e+04 -4243.6739 -6407.8994 -7226.3990
## aic                  2.786e+04  2.524e+04 10073.7060 14418.0909 15908.5358
## bic                  2.820e+04  2.559e+04 10316.1875 14694.7379 16212.8783
## ntotal               2.470e+02  2.350e+02    90.0000   128.0000   155.0000
## bic2                 2.790e+04  2.527e+04 10010.0482 14387.9706 15896.3550
## rmsea                5.420e-02  5.580e-02     0.0899     0.0764     0.0603
## rmsea.ci.lower       4.940e-02  5.080e-02     0.0819     0.0697     0.0538
## rmsea.ci.upper       5.900e-02  6.060e-02     0.0978     0.0830     0.0666
## rmsea.pvalue         7.380e-02  2.830e-02     0.0000     0.0000     0.0051
## rmr                  8.940e-02  7.840e-02     0.1423     0.1249     0.0800
## rmr_nomean           8.940e-02  7.840e-02     0.1423     0.1249     0.0800
## srmr                 5.400e-02  4.930e-02     0.0845     0.0766     0.0554
## srmr_bentler         5.400e-02  4.930e-02     0.0845     0.0766     0.0554
## srmr_bentler_nomean  5.400e-02  4.930e-02     0.0845     0.0766     0.0554
## crmr                 5.530e-02  5.040e-02     0.0855     0.0784     0.0567
## crmr_nomean          5.530e-02  5.040e-02     0.0855     0.0784     0.0567
## srmr_mplus           5.400e-02  4.920e-02     0.0836     0.0766     0.0554
## srmr_mplus_nomean    5.400e-02  4.920e-02     0.0836     0.0766     0.0554
## cn_05                1.560e+02  1.481e+02    57.4396    80.3615   108.3913
## cn_01                1.612e+02  1.531e+02    59.3255    83.0132   111.9862
## gfi                  7.920e-01  7.751e-01     0.6111     0.6684     0.7340
## agfi                 7.669e-01  7.471e-01     0.5643     0.6284     0.7009
## pgfi                 7.069e-01  6.893e-01     0.5455     0.5966     0.6527
## mfi                  3.057e-01  2.870e-01     0.0385     0.0951     0.2321
## ecvi                 6.419e+00  6.764e+00    17.6262    12.5179     9.3919
##                        Public3
## npar                  100.0000
## fmin                   15.7080
## chisq                1696.4624
## df                    803.0000
## pvalue                  0.0000
## baseline.chisq       3574.9944
## baseline.df           861.0000
## baseline.pvalue         0.0000
## cfi                     0.6708
## tli                     0.6470
## nnfi                    0.6470
## rfi                     0.4912
## nfi                     0.5255
## pnfi                    0.4901
## ifi                     0.6777
## rni                     0.6708
## logl                -2981.7396
## unrestricted.logl   -2133.5084
## aic                  6163.4792
## bic                  6362.3776
## ntotal                 54.0000
## bic2                 6048.2090
## rmsea                   0.1435
## rmsea.ci.lower          0.1340
## rmsea.ci.upper          0.1531
## rmsea.pvalue            0.0000
## rmr                     0.1590
## rmr_nomean              0.1590
## srmr                    0.0840
## srmr_bentler            0.0840
## srmr_bentler_nomean     0.0840
## crmr                    0.0861
## crmr_nomean             0.0861
## srmr_mplus              0.0841
## srmr_mplus_nomean       0.0841
## cn_05                  28.6940
## cn_01                  29.6211
## gfi                     0.4877
## agfi                    0.4239
## pgfi                    0.4337
## mfi                     0.0003
## ecvi                   35.1197

Comparing Private-Public Model Fit Measures using ANOVA: If p-value < 0.05, models are different.

# Compare models using ANOVA - IF p-value < 0.05, models are significantly different
anova(fit51Pri, fit51Pub)
## Chi-Squared Difference Test
## 
##           Df   AIC   BIC Chisq Chisq diff Df diff Pr(>Chisq)
## fit51Pub 803 25241 25587  1390                              
## fit51Pri 806 27862 28203  1392       1.88       3        0.6

This Chi-Squared Test shows an insignificant difference in the model fit measures in AIC and BIC.

10.10 Model 61: IIR Mediates Relationship TFL -> IWB1, SFI Mediates TFL -> IIR

# Model for IWB Steps
model61 <- '

# latent variables
 IWB1 =~ Q087 + Q089 + Q092
 IIR  =~ Q070 + Q071 + Q075 + Q076 + Q077 
 SFI  =~ Q033 + Q034 + Q035 + Q037 + Q038 + Q044 + Q045 + Q049 + Q050 + Q051 + Q054
 TFL  =~ Q014 + Q015 + Q016 + Q017 + Q018 + Q019 + Q020 + Q021 + Q022 + Q023 + Q024 + Q025 + Q026 + Q027 + Q028 + Q029 + Q032

# direct effect
 IWB1 ~ d1 * TFL
 DirEff := d1

# mediator
 SFI  ~ a1 * TFL
 IIR  ~ a2 * TFL
 IIR  ~ b1 * SFI
 IWB1 ~ c1 * IIR

# indirect effect
 a1b1c1 := a1 * b1 * c1
 a2c1   := a2 * c1
 IndEff := a1b1c1 + a2c1

# total effect
 TotEff := d1 + (a1 * b1 * c1) + (a2 * c1)

# covariances
# Q019 ~~ Q028
# Q033 ~~ Q037
 Q018 ~~ Q020
 Q020 ~~ Q029
 Q021 ~~ Q023
 Q029 ~~ Q032
 Q034 ~~ Q035
 Q075 ~~ Q076
 Q050 ~~ Q051
 Q051 ~~ Q054
 Q070 ~~ Q071
 
'

# Calculate fit61
fit61 <- sem(model61, data = DFs)

# Print results (fit61 indices, parameters, hypothesis tests)
summary(fit61, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6-12 ended normally after 45 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        86
## 
##   Number of observations                           482
## 
## Model Test User Model:
##                                                       
##   Test statistic                              1219.467
##   Degrees of freedom                               580
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                             13266.679
##   Degrees of freedom                               630
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.949
##   Tucker-Lewis Index (TLI)                       0.945
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -22887.498
##   Loglikelihood unrestricted model (H1)     -22277.764
##                                                       
##   Akaike (AIC)                               45946.995
##   Bayesian (BIC)                             46306.298
##   Sample-size adjusted Bayesian (BIC)        46033.342
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.048
##   90 Percent confidence interval - lower         0.044
##   90 Percent confidence interval - upper         0.052
##   P-value RMSEA <= 0.05                          0.827
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.044
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB1 =~                                             
##     Q087              1.000                           
##     Q089              0.939    0.047   20.132    0.000
##     Q092              0.920    0.046   20.042    0.000
##   IIR =~                                              
##     Q070              1.000                           
##     Q071              1.276    0.095   13.468    0.000
##     Q075              1.366    0.112   12.238    0.000
##     Q076              1.282    0.108   11.909    0.000
##     Q077              0.973    0.089   10.921    0.000
##   SFI =~                                              
##     Q033              1.000                           
##     Q034              1.034    0.058   17.704    0.000
##     Q035              0.995    0.055   18.113    0.000
##     Q037              0.841    0.067   12.497    0.000
##     Q038              0.997    0.058   17.052    0.000
##     Q044              0.976    0.058   16.773    0.000
##     Q045              0.908    0.056   16.295    0.000
##     Q049              1.023    0.059   17.323    0.000
##     Q050              0.833    0.063   13.153    0.000
##     Q051              0.893    0.063   14.074    0.000
##     Q054              0.930    0.069   13.424    0.000
##   TFL =~                                              
##     Q014              1.000                           
##     Q015              1.035    0.053   19.371    0.000
##     Q016              0.950    0.053   17.858    0.000
##     Q017              1.081    0.059   18.268    0.000
##     Q018              1.069    0.055   19.581    0.000
##     Q019              0.937    0.051   18.223    0.000
##     Q020              1.057    0.055   19.127    0.000
##     Q021              1.050    0.054   19.457    0.000
##     Q022              1.021    0.052   19.460    0.000
##     Q023              1.106    0.056   19.820    0.000
##     Q024              1.032    0.050   20.644    0.000
##     Q025              0.937    0.053   17.669    0.000
##     Q026              1.025    0.054   19.134    0.000
##     Q027              1.045    0.054   19.189    0.000
##     Q028              1.042    0.053   19.564    0.000
##     Q029              1.094    0.063   17.263    0.000
##     Q032              1.137    0.057   19.906    0.000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB1 ~                                              
##     TFL       (d1)    0.236    0.046    5.116    0.000
##   SFI ~                                               
##     TFL       (a1)    0.575    0.046   12.462    0.000
##   IIR ~                                               
##     TFL       (a2)    0.070    0.032    2.147    0.032
##     SFI       (b1)    0.358    0.044    8.066    0.000
##   IWB1 ~                                              
##     IIR       (c1)    1.255    0.121   10.380    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .Q018 ~~                                             
##    .Q020              0.149    0.031    4.781    0.000
##  .Q020 ~~                                             
##    .Q029             -0.148    0.037   -4.045    0.000
##  .Q021 ~~                                             
##    .Q023              0.126    0.030    4.195    0.000
##  .Q029 ~~                                             
##    .Q032              0.251    0.042    6.053    0.000
##  .Q034 ~~                                             
##    .Q035              0.196    0.036    5.510    0.000
##  .Q075 ~~                                             
##    .Q076              0.100    0.035    2.863    0.004
##  .Q050 ~~                                             
##    .Q051              0.312    0.052    6.024    0.000
##  .Q051 ~~                                             
##    .Q054              0.457    0.060    7.566    0.000
##  .Q070 ~~                                             
##    .Q071              0.122    0.034    3.635    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .Q087              0.431    0.044    9.801    0.000
##    .Q089              0.561    0.048   11.651    0.000
##    .Q092              0.550    0.047   11.731    0.000
##    .Q070              0.545    0.041   13.419    0.000
##    .Q071              0.632    0.050   12.693    0.000
##    .Q075              0.519    0.046   11.303    0.000
##    .Q076              0.537    0.046   11.798    0.000
##    .Q077              0.531    0.039   13.738    0.000
##    .Q033              0.590    0.044   13.419    0.000
##    .Q034              0.672    0.050   13.390    0.000
##    .Q035              0.566    0.043   13.213    0.000
##    .Q037              1.352    0.091   14.878    0.000
##    .Q038              0.731    0.053   13.840    0.000
##    .Q044              0.744    0.053   13.939    0.000
##    .Q045              0.714    0.051   14.094    0.000
##    .Q049              0.726    0.053   13.736    0.000
##    .Q050              1.152    0.078   14.773    0.000
##    .Q051              1.091    0.074   14.830    0.000
##    .Q054              1.359    0.092   14.729    0.000
##    .Q014              0.853    0.057   14.871    0.000
##    .Q015              0.584    0.040   14.501    0.000
##    .Q016              0.715    0.048   14.821    0.000
##    .Q017              0.841    0.057   14.750    0.000
##    .Q018              0.587    0.041   14.385    0.000
##    .Q019              0.638    0.043   14.758    0.000
##    .Q020              0.647    0.045   14.516    0.000
##    .Q021              0.585    0.041   14.420    0.000
##    .Q022              0.555    0.038   14.476    0.000
##    .Q023              0.589    0.041   14.313    0.000
##    .Q024              0.401    0.029   14.043    0.000
##    .Q025              0.727    0.049   14.852    0.000
##    .Q026              0.609    0.042   14.563    0.000
##    .Q027              0.624    0.043   14.549    0.000
##    .Q028              0.562    0.039   14.446    0.000
##    .Q029              1.082    0.073   14.873    0.000
##    .Q032              0.607    0.042   14.306    0.000
##    .IWB1              0.382    0.050    7.601    0.000
##    .IIR               0.193    0.030    6.512    0.000
##    .SFI               0.521    0.055    9.472    0.000
##     TFL               1.127    0.116    9.692    0.000
## 
## R-Square:
##                    Estimate
##     Q087              0.731
##     Q089              0.648
##     Q092              0.644
##     Q070              0.388
##     Q071              0.471
##     Q075              0.554
##     Q076              0.514
##     Q077              0.381
##     Q033              0.602
##     Q034              0.587
##     Q035              0.609
##     Q037              0.319
##     Q038              0.548
##     Q044              0.533
##     Q045              0.508
##     Q049              0.563
##     Q050              0.350
##     Q051              0.395
##     Q054              0.363
##     Q014              0.569
##     Q015              0.674
##     Q016              0.587
##     Q017              0.610
##     Q018              0.687
##     Q019              0.608
##     Q020              0.661
##     Q021              0.680
##     Q022              0.679
##     Q023              0.701
##     Q024              0.749
##     Q025              0.576
##     Q026              0.660
##     Q027              0.663
##     Q028              0.685
##     Q029              0.555
##     Q032              0.706
##     IWB1              0.674
##     IIR               0.441
##     SFI               0.417
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)
##     DirEff            0.236    0.046    5.116    0.000
##     a1b1c1            0.258    0.036    7.174    0.000
##     a2c1              0.087    0.042    2.107    0.035
##     IndEff            0.345    0.044    7.846    0.000
##     TotEff            0.582    0.051   11.406    0.000
modInd <- modificationIndices(fit61, minimum.value = 10)
# head(modInd[order(modInd$mi, decreasing=TRUE), ], 10)
subset(modInd[order(modInd$mi, decreasing=TRUE), ], mi > 5)
##      lhs op  rhs    mi    epc sepc.lv sepc.all sepc.nox
## 164  SFI =~ Q071 30.23  0.355   0.336    0.307    0.307
## 189  TFL =~ Q071 21.45  0.210   0.223    0.204    0.204
## 294 Q092 ~~ Q019 18.41 -0.133  -0.133   -0.225   -0.225
## 456 Q033 ~~ Q037 18.21 -0.193  -0.193   -0.216   -0.216
## 770 Q019 ~~ Q028 17.06 -0.120  -0.120   -0.201   -0.201
## 99  IWB1 =~ Q076 15.92  0.335   0.363    0.346    0.346
## 535 Q037 ~~ Q050 14.43  0.214   0.214    0.172    0.172
## 531 Q037 ~~ Q038 14.29  0.187   0.187    0.188    0.188
## 158  IIR =~ Q029 14.16 -0.374  -0.220   -0.141   -0.141
## 723 Q015 ~~ Q032 13.45  0.101   0.101    0.169    0.169
## 679 Q054 ~~ Q017 12.99  0.168   0.168    0.157    0.157
## 697 Q014 ~~ Q019 12.38  0.124   0.124    0.169    0.169
## 459 Q033 ~~ Q045 12.23  0.120   0.120    0.184    0.184
## 693 Q014 ~~ Q015 12.10  0.119   0.119    0.168    0.168
## 533 Q037 ~~ Q045 11.57 -0.164  -0.164   -0.167   -0.167
## 309 Q070 ~~ Q033 11.57  0.095   0.095    0.167    0.167
## 834  IIR  ~ IWB1 11.35  0.350   0.646    0.646    0.646
## 825 IWB1 ~~  IIR 11.35  0.134   0.493    0.493    0.493
## 831 IWB1  ~  SFI 11.35 -0.248  -0.217   -0.217   -0.217
## 826 IWB1 ~~  SFI 11.35 -0.129  -0.290   -0.290   -0.290
## 832  SFI  ~ IWB1 11.35 -0.338  -0.387   -0.387   -0.387
## 706 Q014 ~~ Q028 10.65 -0.110  -0.110   -0.158   -0.158
## 190  TFL =~ Q075 10.16 -0.138  -0.146   -0.135   -0.135
# Prepare PDF
# pdf("Model61.pdf", width = 25, height = 16)
par(mar=c(7, 1, 7, 1))
par(oma=c(1, 1, 1, 1))

# Prepare fitmeasures
ParDF  <- as.data.frame(do.call(cbind, fit61@ParTable))
DirEff <- round(as.numeric(ParDF[ParDF$label == "DirEff", 14]), 4)
TotEff <- round(as.numeric(ParDF[ParDF$label == "TotEff", 14]), 4)
n      <- fit61@SampleStats@ntotal

fitMeas <- toString(c("ChiSq: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit61, "chisq"))), 4),
                      " - DF: ", gsub("[^0-9.]", "", fitMeasures(fit61, "df")),
                      " - ChiSq/DF: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit61, "chisq")))/ as.numeric(gsub("[^0-9.]", "", fitMeasures(fit61, "df"))), 4),
                      " - CFI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit61, "cfi"))), 4),
                      " - TLI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit61, "tli"))), 4),
                      " - RMSEA: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit61, "rmsea"))), 4),
                      " - SRMR: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit61, "srmr"))), 4),
                      " - n: ", n,
                      " - DirEff: ", DirEff,
                      " - TotalEff: ", TotEff
                      ), 
                    width = 255)
fitMeas <- gsub(",", "", fitMeas)

# Plot model
library(semPlot)
semPaths(fit61, what = "stand", whatLabels = "stand", intercepts = FALSE, residuals = FALSE, edge.label.cex = 0.5, edge.color = "blue", layout = "tree", rotation = 3, curve = 1, curvePivot = TRUE, mar = c(3,1,5,1), sizeLat = 7, sizeMan = 4, nCharNodes = 4, color = colorlist)
title(main = "IIR Mediates Relationship TFL -> IWB, SFI Mediates TFL -> IIR - Model 61\n IWB - Step 1: Idea Generation", cex.main = 2.5, col.main = "darkblue", font.main = 3, sub = fitMeas, cex.sub = 1.4)

# dev.off()

10.11 Model 62: IIR Mediates Relationship TFL -> IWB2, SFI Mediates TFL -> IIR

# Model for IWB Steps
model62 <- '

# latent variables
 IWB2 =~ Q088 + Q090 + Q094
 IIR  =~ Q070 + Q071 + Q075 + Q076 + Q077 
 SFI  =~ Q033 + Q034 + Q035 + Q037 + Q038 + Q044 + Q045 + Q049 + Q050 + Q051 + Q054
 TFL  =~ Q014 + Q015 + Q016 + Q017 + Q018 + Q019 + Q020 + Q021 + Q022 + Q023 + Q024 + Q025 + Q026 + Q027 + Q028 + Q029 + Q032

# direct effect
 IWB2  ~ d1 * TFL
 DirEff := d1

# mediator
 SFI  ~ a1 * TFL
 IIR  ~ a2 * TFL
 IIR  ~ b1 * SFI
 IWB2 ~ c1 * IIR

# indirect effect
 a1b1c1 := a1 * b1 * c1
 a2c1   := a2 * c1
 IndEff := a1b1c1 + a2c1

# total effect
 TotEff := d1 + (a1 * b1 * c1) + (a2 * c1)

# covariances
# Q029 ~~ Q032
# Q034 ~~ Q035
 Q018 ~~ Q020
 Q021 ~~ Q023
 Q029 ~~ Q032
 Q034 ~~ Q035
 Q075 ~~ Q076
 Q050 ~~ Q051
 Q051 ~~ Q054
 
'

# Calculate fit62
fit62 <- sem(model62, data = DFs)

# Print results (fit62 indices, parameters, hypothesis tests)
summary(fit62, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6-12 ended normally after 44 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        84
## 
##   Number of observations                           482
## 
## Model Test User Model:
##                                                       
##   Test statistic                              1225.631
##   Degrees of freedom                               582
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                             13042.713
##   Degrees of freedom                               630
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.948
##   Tucker-Lewis Index (TLI)                       0.944
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -23124.928
##   Loglikelihood unrestricted model (H1)     -22512.112
##                                                       
##   Akaike (AIC)                               46417.855
##   Bayesian (BIC)                             46768.803
##   Sample-size adjusted Bayesian (BIC)        46502.194
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.048
##   90 Percent confidence interval - lower         0.044
##   90 Percent confidence interval - upper         0.052
##   P-value RMSEA <= 0.05                          0.819
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.041
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB2 =~                                             
##     Q088              1.000                           
##     Q090              0.730    0.050   14.578    0.000
##     Q094              0.998    0.055   18.217    0.000
##   IIR =~                                              
##     Q070              1.000                           
##     Q071              1.259    0.093   13.550    0.000
##     Q075              1.200    0.092   13.064    0.000
##     Q076              1.104    0.089   12.422    0.000
##     Q077              0.871    0.076   11.424    0.000
##   SFI =~                                              
##     Q033              1.000                           
##     Q034              1.032    0.058   17.730    0.000
##     Q035              0.994    0.055   18.174    0.000
##     Q037              0.840    0.067   12.503    0.000
##     Q038              0.996    0.058   17.104    0.000
##     Q044              0.974    0.058   16.811    0.000
##     Q045              0.907    0.056   16.332    0.000
##     Q049              1.021    0.059   17.345    0.000
##     Q050              0.831    0.063   13.160    0.000
##     Q051              0.891    0.063   14.087    0.000
##     Q054              0.926    0.069   13.394    0.000
##   TFL =~                                              
##     Q014              1.000                           
##     Q015              1.035    0.054   19.325    0.000
##     Q016              0.951    0.053   17.855    0.000
##     Q017              1.083    0.059   18.273    0.000
##     Q018              1.070    0.055   19.572    0.000
##     Q019              0.937    0.051   18.192    0.000
##     Q020              1.055    0.055   19.101    0.000
##     Q021              1.051    0.054   19.448    0.000
##     Q022              1.022    0.053   19.437    0.000
##     Q023              1.107    0.056   19.806    0.000
##     Q024              1.032    0.050   20.617    0.000
##     Q025              0.937    0.053   17.646    0.000
##     Q026              1.026    0.054   19.119    0.000
##     Q027              1.046    0.055   19.180    0.000
##     Q028              1.043    0.053   19.547    0.000
##     Q029              1.089    0.064   17.134    0.000
##     Q032              1.138    0.057   19.909    0.000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB2 ~                                              
##     TFL       (d1)    0.306    0.053    5.737    0.000
##   SFI ~                                               
##     TFL       (a1)    0.577    0.046   12.497    0.000
##   IIR ~                                               
##     TFL       (a2)    0.077    0.034    2.247    0.025
##     SFI       (b1)    0.410    0.046    8.850    0.000
##   IWB2 ~                                              
##     IIR       (c1)    1.087    0.111    9.763    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .Q018 ~~                                             
##    .Q020              0.138    0.031    4.418    0.000
##  .Q021 ~~                                             
##    .Q023              0.125    0.030    4.167    0.000
##  .Q029 ~~                                             
##    .Q032              0.265    0.042    6.304    0.000
##  .Q034 ~~                                             
##    .Q035              0.196    0.035    5.520    0.000
##  .Q075 ~~                                             
##    .Q076              0.166    0.036    4.596    0.000
##  .Q050 ~~                                             
##    .Q051              0.312    0.052    6.026    0.000
##  .Q051 ~~                                             
##    .Q054              0.459    0.061    7.590    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .Q088              0.528    0.060    8.763    0.000
##    .Q090              0.964    0.071   13.619    0.000
##    .Q094              0.760    0.071   10.734    0.000
##    .Q070              0.483    0.037   13.075    0.000
##    .Q071              0.549    0.045   12.085    0.000
##    .Q075              0.578    0.047   12.324    0.000
##    .Q076              0.609    0.047   12.853    0.000
##    .Q077              0.549    0.040   13.905    0.000
##    .Q033              0.587    0.044   13.420    0.000
##    .Q034              0.673    0.050   13.414    0.000
##    .Q035              0.565    0.043   13.225    0.000
##    .Q037              1.353    0.091   14.885    0.000
##    .Q038              0.729    0.053   13.848    0.000
##    .Q044              0.744    0.053   13.951    0.000
##    .Q045              0.714    0.051   14.104    0.000
##    .Q049              0.728    0.053   13.756    0.000
##    .Q050              1.153    0.078   14.781    0.000
##    .Q051              1.092    0.074   14.840    0.000
##    .Q054              1.364    0.093   14.743    0.000
##    .Q014              0.855    0.057   14.867    0.000
##    .Q015              0.587    0.040   14.499    0.000
##    .Q016              0.713    0.048   14.813    0.000
##    .Q017              0.838    0.057   14.738    0.000
##    .Q018              0.586    0.041   14.382    0.000
##    .Q019              0.639    0.043   14.754    0.000
##    .Q020              0.646    0.045   14.508    0.000
##    .Q021              0.584    0.041   14.405    0.000
##    .Q022              0.555    0.038   14.467    0.000
##    .Q023              0.588    0.041   14.299    0.000
##    .Q024              0.402    0.029   14.032    0.000
##    .Q025              0.728    0.049   14.847    0.000
##    .Q026              0.609    0.042   14.553    0.000
##    .Q027              0.623    0.043   14.537    0.000
##    .Q028              0.561    0.039   14.435    0.000
##    .Q029              1.102    0.074   14.887    0.000
##    .Q032              0.604    0.042   14.303    0.000
##    .IWB2              0.519    0.066    7.803    0.000
##    .IIR               0.208    0.029    7.103    0.000
##    .SFI               0.520    0.055    9.489    0.000
##     TFL               1.126    0.116    9.683    0.000
## 
## R-Square:
##                    Estimate
##     Q088              0.717
##     Q090              0.425
##     Q094              0.637
##     Q070              0.457
##     Q071              0.540
##     Q075              0.503
##     Q076              0.449
##     Q077              0.359
##     Q033              0.604
##     Q034              0.586
##     Q035              0.610
##     Q037              0.318
##     Q038              0.549
##     Q044              0.533
##     Q045              0.508
##     Q049              0.562
##     Q050              0.349
##     Q051              0.394
##     Q054              0.360
##     Q014              0.568
##     Q015              0.673
##     Q016              0.588
##     Q017              0.612
##     Q018              0.687
##     Q019              0.607
##     Q020              0.660
##     Q021              0.680
##     Q022              0.679
##     Q023              0.701
##     Q024              0.749
##     Q025              0.576
##     Q026              0.660
##     Q027              0.664
##     Q028              0.686
##     Q029              0.548
##     Q032              0.707
##     IWB2              0.613
##     IIR               0.488
##     SFI               0.419
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)
##     DirEff            0.306    0.053    5.737    0.000
##     a1b1c1            0.257    0.037    7.033    0.000
##     a2c1              0.084    0.038    2.187    0.029
##     IndEff            0.341    0.045    7.605    0.000
##     TotEff            0.647    0.056   11.626    0.000
modInd <- modificationIndices(fit62, minimum.value = 10)
# head(modInd[order(modInd$mi, decreasing=TRUE), ], 10)
subset(modInd[order(modInd$mi, decreasing=TRUE), ], mi > 5)
##      lhs op  rhs    mi    epc sepc.lv sepc.all sepc.nox
## 290 Q094 ~~ Q017 19.34  0.188   0.188    0.236    0.236
## 455 Q033 ~~ Q037 18.39 -0.193  -0.193   -0.217   -0.217
## 162  SFI =~ Q071 17.16  0.300   0.284    0.260    0.260
## 769 Q019 ~~ Q028 16.83 -0.120  -0.120   -0.200   -0.200
## 113 IWB2 =~ Q017 16.27  0.211   0.244    0.166    0.166
## 780 Q020 ~~ Q029 16.27 -0.147  -0.147   -0.174   -0.174
## 187  TFL =~ Q071 14.81  0.186   0.198    0.181    0.181
## 534 Q037 ~~ Q050 14.53  0.215   0.215    0.172    0.172
## 97  IWB2 =~ Q076 14.30  0.242   0.280    0.267    0.267
## 530 Q037 ~~ Q038 14.29  0.186   0.186    0.188    0.188
## 367 Q075 ~~ Q077 14.25  0.109   0.109    0.193    0.193
## 759 Q018 ~~ Q029 14.10  0.131   0.131    0.163    0.163
## 274 Q094 ~~ Q076 13.26  0.130   0.130    0.191    0.191
## 308 Q070 ~~ Q033 13.18  0.101   0.101    0.190    0.190
## 678 Q054 ~~ Q017 13.15  0.169   0.169    0.158    0.158
## 156  IIR =~ Q029 12.94 -0.342  -0.218   -0.140   -0.140
## 722 Q015 ~~ Q032 12.78  0.098   0.098    0.165    0.165
## 696 Q014 ~~ Q019 12.63  0.126   0.126    0.170    0.170
## 692 Q014 ~~ Q015 12.49  0.121   0.121    0.171    0.171
## 111 IWB2 =~ Q015 12.11 -0.153  -0.178   -0.133   -0.133
## 458 Q033 ~~ Q045 11.90  0.118   0.118    0.182    0.182
## 532 Q037 ~~ Q045 11.50 -0.164  -0.164   -0.167   -0.167
## 647 Q050 ~~ Q020 10.77 -0.124  -0.124   -0.144   -0.144
## 705 Q014 ~~ Q028 10.53 -0.109  -0.109   -0.157   -0.157
# Prepare PDF
# pdf("Model43.pdf", width = 25, height = 16)
par(mar=c(7, 1, 7, 1))
par(oma=c(1, 1, 1, 1))

# Prepare fitmeasures
ParDF  <- as.data.frame(do.call(cbind, fit62@ParTable))
DirEff <- round(as.numeric(ParDF[ParDF$label == "DirEff", 14]), 4)
TotEff <- round(as.numeric(ParDF[ParDF$label == "TotEff", 14]), 4)
n      <- fit62@SampleStats@ntotal

fitMeas <- toString(c("ChiSq: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit62, "chisq"))), 4),
                      " - DF: ", gsub("[^0-9.]", "", fitMeasures(fit62, "df")),
                      " - ChiSq/DF: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit62, "chisq")))/ as.numeric(gsub("[^0-9.]", "", fitMeasures(fit62, "df"))), 4),
                      " - CFI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit62, "cfi"))), 4),
                      " - TLI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit62, "tli"))), 4),
                      " - RMSEA: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit62, "rmsea"))), 4),
                      " - SRMR: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit62, "srmr"))), 4),
                      " - n: ", n,
                      " - DirEff: ", DirEff,
                      " - TotalEff: ", TotEff
                      ), 
                    width = 255)
fitMeas <- gsub(",", "", fitMeas)

# Plot model
library(semPlot)
semPaths(fit62, what = "stand", whatLabels = "stand", intercepts = FALSE, residuals = FALSE, edge.label.cex = 0.5, edge.color = "blue", layout = "tree2", rotation = 3, curve = 1, curvePivot = TRUE, mar = c(3,1,5,1), sizeLat = 7, sizeMan = 4, nCharNodes = 4, color = colorlist)
title(main = "IIR Mediates Relationship TFL -> IWB, SFI Mediates TFL -> IIR - Model 62\n IWB - Step 2: Idea Championing", cex.main = 2.5, col.main = "darkblue", font.main = 3, sub = fitMeas, cex.sub = 1.4)

# dev.off()

10.12 Model 63: IIR Mediates Relationship TFL -> IWB3, SFI Mediates TFL -> IIR

# Model for IWB Steps
model63 <- '

# latent variables
 IWB3 =~ Q091 + Q093 + Q095
 IIR  =~ Q070 + Q071 + Q075 + Q076 + Q077 
 SFI  =~ Q033 + Q034 + Q035 + Q037 + Q038 + Q044 + Q045 + Q049 + Q050 + Q051 + Q054
 TFL  =~ Q014 + Q015 + Q016 + Q017 + Q018 + Q019 + Q020 + Q021 + Q022 + Q023 + Q024 + Q025 + Q026 + Q027 + Q028 + Q029 + Q032

# direct effect
 IWB3  ~ d1 * TFL
 DirEff := d1

# mediator
 SFI  ~ a1 * TFL
 IIR  ~ a2 * TFL
 IIR  ~ b1 * SFI
 IWB3 ~ c1 * IIR

# indirect effect
 a1b1c1 := a1 * b1 * c1
 a2c1   := a2 * c1
 IndEff := a1b1c1 + a2c1

# total effect
 TotEff := d1 + (a1 * b1 * c1) + (a2 * c1)

# covariances
 Q018 ~~ Q029
 Q019 ~~ Q028
 Q020 ~~ Q029
 Q021 ~~ Q023
 Q029 ~~ Q032
 Q033 ~~ Q037
 Q034 ~~ Q035
 Q050 ~~ Q051
 Q051 ~~ Q054
 Q075 ~~ Q076
 
'

# Calculate fit63
fit63 <- sem(model63, data = DFs)

# Print results (fit63 indices, parameters, hypothesis tests)
summary(fit63, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6-12 ended normally after 45 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        87
## 
##   Number of observations                           482
## 
## Model Test User Model:
##                                                       
##   Test statistic                              1198.132
##   Degrees of freedom                               579
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                             13264.293
##   Degrees of freedom                               630
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.951
##   Tucker-Lewis Index (TLI)                       0.947
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)             -22962.629
##   Loglikelihood unrestricted model (H1)     -22363.563
##                                                       
##   Akaike (AIC)                               46099.258
##   Bayesian (BIC)                             46462.739
##   Sample-size adjusted Bayesian (BIC)        46186.609
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.047
##   90 Percent confidence interval - lower         0.043
##   90 Percent confidence interval - upper         0.051
##   P-value RMSEA <= 0.05                          0.896
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.042
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB3 =~                                             
##     Q091              1.000                           
##     Q093              1.000    0.046   21.873    0.000
##     Q095              0.874    0.045   19.636    0.000
##   IIR =~                                              
##     Q070              1.000                           
##     Q071              1.244    0.093   13.416    0.000
##     Q075              1.212    0.092   13.145    0.000
##     Q076              1.124    0.089   12.593    0.000
##     Q077              0.876    0.076   11.478    0.000
##   SFI =~                                              
##     Q033              1.000                           
##     Q034              1.012    0.057   17.847    0.000
##     Q035              0.977    0.053   18.356    0.000
##     Q037              0.859    0.072   11.980    0.000
##     Q038              0.985    0.057   17.370    0.000
##     Q044              0.962    0.056   17.045    0.000
##     Q045              0.890    0.054   16.426    0.000
##     Q049              1.007    0.057   17.557    0.000
##     Q050              0.825    0.062   13.370    0.000
##     Q051              0.878    0.062   14.202    0.000
##     Q054              0.915    0.068   13.525    0.000
##   TFL =~                                              
##     Q014              1.000                           
##     Q015              1.034    0.054   19.294    0.000
##     Q016              0.950    0.053   17.825    0.000
##     Q017              1.081    0.059   18.222    0.000
##     Q018              1.076    0.055   19.699    0.000
##     Q019              0.946    0.051   18.368    0.000
##     Q020              1.067    0.055   19.349    0.000
##     Q021              1.052    0.054   19.468    0.000
##     Q022              1.021    0.053   19.409    0.000
##     Q023              1.108    0.056   19.803    0.000
##     Q024              1.033    0.050   20.615    0.000
##     Q025              0.937    0.053   17.634    0.000
##     Q026              1.025    0.054   19.087    0.000
##     Q027              1.045    0.055   19.142    0.000
##     Q028              1.049    0.053   19.647    0.000
##     Q029              1.087    0.064   17.033    0.000
##     Q032              1.135    0.057   19.819    0.000
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   IWB3 ~                                              
##     TFL       (d1)    0.247    0.052    4.734    0.000
##   SFI ~                                               
##     TFL       (a1)    0.581    0.046   12.524    0.000
##   IIR ~                                               
##     TFL       (a2)    0.084    0.034    2.468    0.014
##     SFI       (b1)    0.393    0.045    8.739    0.000
##   IWB3 ~                                              
##     IIR       (c1)    1.115    0.112    9.991    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .Q018 ~~                                             
##    .Q029              0.123    0.036    3.379    0.001
##  .Q019 ~~                                             
##    .Q028             -0.120    0.029   -4.181    0.000
##  .Q020 ~~                                             
##    .Q029             -0.147    0.037   -3.950    0.000
##  .Q021 ~~                                             
##    .Q023              0.124    0.030    4.167    0.000
##  .Q029 ~~                                             
##    .Q032              0.269    0.042    6.453    0.000
##  .Q033 ~~                                             
##    .Q037             -0.195    0.044   -4.436    0.000
##  .Q034 ~~                                             
##    .Q035              0.206    0.036    5.781    0.000
##  .Q050 ~~                                             
##    .Q051              0.311    0.052    6.021    0.000
##  .Q051 ~~                                             
##    .Q054              0.461    0.060    7.630    0.000
##  .Q075 ~~                                             
##    .Q076              0.152    0.036    4.266    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .Q091              0.479    0.049    9.731    0.000
##    .Q093              0.497    0.050    9.927    0.000
##    .Q095              0.649    0.053   12.337    0.000
##    .Q070              0.484    0.037   13.106    0.000
##    .Q071              0.566    0.046   12.304    0.000
##    .Q075              0.568    0.047   12.203    0.000
##    .Q076              0.592    0.047   12.684    0.000
##    .Q077              0.546    0.039   13.893    0.000
##    .Q033              0.564    0.043   13.168    0.000
##    .Q034              0.686    0.050   13.587    0.000
##    .Q035              0.573    0.043   13.393    0.000
##    .Q037              1.305    0.089   14.693    0.000
##    .Q038              0.727    0.052   13.915    0.000
##    .Q044              0.743    0.053   14.021    0.000
##    .Q045              0.722    0.051   14.202    0.000
##    .Q049              0.730    0.053   13.850    0.000
##    .Q050              1.145    0.077   14.803    0.000
##    .Q051              1.094    0.074   14.887    0.000
##    .Q054              1.363    0.092   14.780    0.000
##    .Q014              0.856    0.057   14.908    0.000
##    .Q015              0.590    0.041   14.566    0.000
##    .Q016              0.717    0.048   14.859    0.000
##    .Q017              0.845    0.057   14.794    0.000
##    .Q018              0.572    0.040   14.439    0.000
##    .Q019              0.622    0.042   14.682    0.000
##    .Q020              0.619    0.043   14.538    0.000
##    .Q021              0.582    0.040   14.468    0.000
##    .Q022              0.558    0.038   14.536    0.000
##    .Q023              0.588    0.041   14.373    0.000
##    .Q024              0.402    0.028   14.118    0.000
##    .Q025              0.729    0.049   14.888    0.000
##    .Q026              0.612    0.042   14.617    0.000
##    .Q027              0.627    0.043   14.604    0.000
##    .Q028              0.549    0.038   14.376    0.000
##    .Q029              1.117    0.075   14.967    0.000
##    .Q032              0.615    0.043   14.402    0.000
##    .IWB3              0.576    0.064    8.936    0.000
##    .IIR               0.213    0.030    7.151    0.000
##    .SFI               0.540    0.056    9.668    0.000
##     TFL               1.124    0.116    9.678    0.000
## 
## R-Square:
##                    Estimate
##     Q091              0.737
##     Q093              0.730
##     Q095              0.612
##     Q070              0.456
##     Q071              0.526
##     Q075              0.512
##     Q076              0.464
##     Q077              0.363
##     Q033              0.620
##     Q034              0.579
##     Q035              0.605
##     Q037              0.342
##     Q038              0.551
##     Q044              0.534
##     Q045              0.502
##     Q049              0.560
##     Q050              0.353
##     Q051              0.393
##     Q054              0.361
##     Q014              0.568
##     Q015              0.671
##     Q016              0.586
##     Q017              0.609
##     Q018              0.695
##     Q019              0.618
##     Q020              0.674
##     Q021              0.681
##     Q022              0.677
##     Q023              0.701
##     Q024              0.749
##     Q025              0.575
##     Q026              0.659
##     Q027              0.662
##     Q028              0.692
##     Q029              0.543
##     Q032              0.702
##     IWB3              0.571
##     IIR               0.476
##     SFI               0.413
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)
##     DirEff            0.247    0.052    4.734    0.000
##     a1b1c1            0.254    0.036    7.042    0.000
##     a2c1              0.094    0.039    2.397    0.017
##     IndEff            0.348    0.045    7.693    0.000
##     TotEff            0.595    0.054   10.956    0.000
modInd <- modificationIndices(fit63, minimum.value = 10)
# head(modInd[order(modInd$mi, decreasing=TRUE), ], 10)
subset(modInd[order(modInd$mi, decreasing=TRUE), ], mi > 5)
##      lhs op  rhs    mi    epc sepc.lv sepc.all sepc.nox
## 100 IWB3 =~ Q076 23.50  0.289   0.334    0.318    0.318
## 753 Q018 ~~ Q020 22.00  0.137   0.137    0.231    0.231
## 165  SFI =~ Q071 20.42  0.314   0.301    0.275    0.275
## 190  TFL =~ Q071 16.64  0.197   0.209    0.191    0.191
## 260 Q093 ~~ Q017 16.40  0.146   0.146    0.225    0.225
## 724 Q015 ~~ Q032 13.79  0.102   0.102    0.170    0.170
## 370 Q075 ~~ Q077 13.41  0.105   0.105    0.189    0.189
## 680 Q054 ~~ Q017 13.13  0.169   0.169    0.157    0.157
## 694 Q014 ~~ Q015 12.87  0.123   0.123    0.173    0.173
## 159  IIR =~ Q029 12.43 -0.327  -0.208   -0.133   -0.133
## 534 Q037 ~~ Q045 12.13 -0.168  -0.168   -0.173   -0.173
## 536 Q037 ~~ Q050 11.91  0.192   0.192    0.157    0.157
## 241 Q093 ~~ Q070 11.52 -0.098  -0.098   -0.200   -0.200
## 116 IWB3 =~ Q017 11.30  0.163   0.189    0.128    0.128
## 244 Q093 ~~ Q076 10.92  0.098   0.098    0.182    0.182
## 284 Q095 ~~ Q044 10.85  0.120   0.120    0.173    0.173
## 156  IIR =~ Q026 10.53 -0.249  -0.158   -0.118   -0.118
## 307 Q070 ~~ Q071 10.45  0.103   0.103    0.196    0.196
# Prepare PDF
# pdf("Model63.pdf", width = 25, height = 16)
par(mar=c(7, 1, 7, 1))
par(oma=c(1, 1, 1, 1))

# Prepare fitmeasures
ParDF  <- as.data.frame(do.call(cbind, fit63@ParTable))
DirEff <- round(as.numeric(ParDF[ParDF$label == "DirEff", 14]), 4)
TotEff <- round(as.numeric(ParDF[ParDF$label == "TotEff", 14]), 4)
n      <- fit63@SampleStats@ntotal

fitMeas <- toString(c("ChiSq: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit63, "chisq"))), 4),
                      " - DF: ", gsub("[^0-9.]", "", fitMeasures(fit63, "df")),
                      " - ChiSq/DF: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit63, "chisq")))/ as.numeric(gsub("[^0-9.]", "", fitMeasures(fit63, "df"))), 4),
                      " - CFI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit63, "cfi"))), 4),
                      " - TLI: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit63, "tli"))), 4),
                      " - RMSEA: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit63, "rmsea"))), 4),
                      " - SRMR: ", round(as.numeric(gsub("[^0-9.]", "", fitMeasures(fit63, "srmr"))), 4),
                      " - n: ", n,
                      " - DirEff: ", DirEff,
                      " - TotalEff: ", TotEff
                      ), 
                    width = 255)
fitMeas <- gsub(",", "", fitMeas)

# Plot model
library(semPlot)
semPaths(fit63, what = "stand", whatLabels = "stand", intercepts = FALSE, residuals = FALSE, edge.label.cex = 0.5, edge.color = "blue", layout = "tree2", rotation = 3, curve = 1, curvePivot = TRUE, mar = c(3,1,5,1), sizeLat = 7, sizeMan = 4, nCharNodes = 4, color = colorlist)
title(main = "IIR Mediates Relationship TFL -> IWB, SFI Mediates TFL -> IIR - Model 63\n IWB - Step 3: Idea Implementation", cex.main = 2.5, col.main = "darkblue", font.main = 3, sub = fitMeas, cex.sub = 1.4)

# dev.off()