setwd("/Users/lawrencehouston/Library/CloudStorage/OneDrive-UniversityOfHouston/Research Methods Course (UH)/Exercises/Exercise #2")

Part I: Exploratory Factor Analysis

The purpose of this part of the exercise is to examine the factor structure of 11 job attitude items. The items below were developed and hypothesized to capture three inter-related, yet distinct job attitudes: Job Satisfaction, Job Involvement, and Job Morale. The following items were administered to a large sample of employees (next to each item is its label used in the dataset). The dataset (Exercise_2a) is available on Canvas.

Job Satisfaction: 1. I am very satisfied with my job in this organization (jobsat1) 2. I like my job in this organization (jobsat2) 3. I am satisfied with the kind of work I do on my job (jobsat3)

Job Involvement: 1. I feel responsible for my job performance (jobinv1) 2. I am committed to my job (jobinv2) 3. How well I do in my job matters a great deal to me (jobinv3) 4. How I do in my job influences how I feel (jobinv4)

Job Morale: 1. Your personal morale (morale1) 2. Your level of motivation (morale2) 3. Your level of energy (morale3) 4. Your level of drive (morale4)

1. Examine the inter-correlations among all items, and answer the following questions: a. Based on these correlation analyses, do you expect the 11 items to factor into 3 different factors or composites, why or why not? b. Based on these correlation analyses, do you expect that any of the 11 items would NOT load well on its intended factor/composite, why or why not? c. Report a summary of your descriptives (correlations, means, and standard deviations) in a table. Below is R syntax that you may use.

library(apaTables)
apa.cor.table(Exercise_2a)
## 
## 
## Means, standard deviations, and correlations with confidence intervals
##  
## 
##   Variable    M    SD   1          2          3          4          5         
##   1. jobsat1  3.00 1.21                                                       
##                                                                               
##   2. jobsat2  3.16 1.22 .83**                                                 
##                         [.81, .85]                                            
##                                                                               
##   3. jobsat3  3.23 1.16 .67**      .67**                                      
##                         [.63, .70] [.63, .71]                                 
##                                                                               
##   4. jobinv1  4.20 1.68 .08*       .10**      .12**                           
##                         [.01, .15] [.03, .17] [.05, .19]                      
##                                                                               
##   5. jobinv2  3.91 0.89 .50**      .51**      .43**      .28**                
##                         [.44, .55] [.46, .56] [.37, .49] [.22, .35]           
##                                                                               
##   6. jobinv3  4.10 0.86 .40**      .43**      .35**      .26**      .74**     
##                         [.34, .46] [.37, .48] [.29, .41] [.20, .33] [.70, .77]
##                                                                               
##   7. jobinv4  3.89 0.95 .33**      .31**      .28**      .20**      .58**     
##                         [.27, .40] [.24, .37] [.21, .34] [.13, .27] [.53, .62]
##                                                                               
##   8. morale1  3.30 1.09 .38**      .37**      .35**      .12**      .35**     
##                         [.32, .44] [.31, .43] [.28, .41] [.05, .19] [.28, .41]
##                                                                               
##   9. morale2  3.24 1.10 .38**      .36**      .33**      .13**      .45**     
##                         [.31, .43] [.30, .42] [.27, .39] [.06, .20] [.39, .50]
##                                                                               
##   10. morale3 3.28 1.05 .33**      .31**      .29**      .10**      .35**     
##                         [.27, .39] [.25, .38] [.22, .35] [.03, .17] [.29, .41]
##                                                                               
##   11. morale4 3.41 1.07 .35**      .32**      .31**      .16**      .44**     
##                         [.28, .41] [.26, .38] [.24, .37] [.09, .23] [.39, .50]
##                                                                               
##   6          7          8          9          10        
##                                                         
##                                                         
##                                                         
##                                                         
##                                                         
##                                                         
##                                                         
##                                                         
##                                                         
##                                                         
##                                                         
##                                                         
##                                                         
##                                                         
##                                                         
##                                                         
##                                                         
##   .71**                                                 
##   [.67, .74]                                            
##                                                         
##   .31**      .24**                                      
##   [.25, .38] [.18, .31]                                 
##                                                         
##   .39**      .31**      .68**                           
##   [.33, .45] [.24, .37] [.64, .72]                      
##                                                         
##   .35**      .28**      .59**      .73**                
##   [.29, .41] [.21, .34] [.54, .64] [.70, .76]           
##                                                         
##   .40**      .31**      .62**      .79**      .80**     
##   [.34, .46] [.25, .38] [.57, .66] [.76, .81] [.77, .82]
##                                                         
## 
## Note. M and SD are used to represent mean and standard deviation, respectively.
## Values in square brackets indicate the 95% confidence interval.
## The confidence interval is a plausible range of population correlations 
## that could have caused the sample correlation (Cumming, 2014).
##  * indicates p < .05. ** indicates p < .01.
## 
library(psych)
KMO(Exercise_2a) # Higher KMO values (≥ .70) indicate that factor analysis is appropriate.
## Kaiser-Meyer-Olkin factor adequacy
## Call: KMO(r = Exercise_2a)
## Overall MSA =  0.86
## MSA for each item = 
## jobsat1 jobsat2 jobsat3 jobinv1 jobinv2 jobinv3 jobinv4 morale1 morale2 morale3 
##    0.81    0.80    0.93    0.89    0.88    0.81    0.84    0.93    0.88    0.87 
## morale4 
##    0.85
cortest.bartlett(Exercise_2a) # Lower p-values (<.05) indicate that factor analysis is appropriate. 
## R was not square, finding R from data
## $chisq
## [1] 5223.037
## 
## $p.value
## [1] 0
## 
## $df
## [1] 55

Q1a: Based on the correlation analyses, I expect the 11 items to factor into three different factors because the correlations among the items within each subscale are higher than the correlations between subscales.

Q1b: I suspect that the “jobinv1” item will not load well on its intended factor/composite (i.e., < .3) because it is only moderately correlated with the other items within the subscale (i.e., .284, .264, .203). However, on average the “jobinv1” item is more strongly correlated with items within the subscales than non-job involvement items (i.e., .08 to 16), suggesting that the “jobinv1” item would load more strongly on the job involvement subscale opposed to the job satisfaction and morale subscales.

2. Perform a complete principal axis factoring, using a direct oblimin rotation, and answer the following: a. How many factors did you end-up extracting in the final analysis, and what did you base this decision on? b. Did you end-up dropping any items from the analysis, why or why not? c. What range of item factor loadings did you obtain in the principal axis factoring analyses, and what do these estimated factor loadings indicate? d. Were the item factor loadings adequate? What item yielded the lowest factor loadings, and what does this indicate about the item? e. Overall, did the tests support the hypothesized, 3-factor structure?

# Q2a (Option 1)
library(nFactors)
## Loading required package: lattice
## 
## Attaching package: 'nFactors'
## The following object is masked from 'package:lattice':
## 
##     parallel
corMatrix1 <- cor(Exercise_2a, use = "pairwise.complete.obs")
nScree(x=corMatrix1,model="factors")
##   noc naf nparallel nkaiser
## 1   3   1         3       3
# Q2a (Option 2)
library(GPArotation)
## 
## Attaching package: 'GPArotation'
## The following objects are masked from 'package:psych':
## 
##     equamax, varimin
fa_results <- psych::fa(Exercise_2a, nfactors = ncol(Exercise_2a), rotate="oblimin", fm = "pa", SMC=FALSE) 
print(fa_results$values) # Extract eigenvalues (3 eigenvalues greater than 1)
##  [1] 5.1230098 1.6570344 1.3380731 0.8592521 0.4446346 0.4001335 0.3664395
##  [8] 0.2534604 0.2174700 0.1806843 0.1598082
# Plot eigenvalues
plot(fa_results$values, type = "b", pch = 19, col = "blue",
     main = "Scree Plot (PAF Eigenvalues)", xlab = "Factors", ylab = "Eigenvalues") +
  abline(h = 1, lty = 2, col = "red")  # Kaiser criterion

## integer(0)
# Conduct Final Factor Analysis with 3 Extracted Factors
fa_results <- fa(Exercise_2a, nfactors = 3, rotate="oblimin", fm = "pa") 
print(fa_results$loadings, cutoff=.3) # Q2b - Q2e
## 
## Loadings:
##         PA2    PA1    PA3   
## jobsat1         0.902       
## jobsat2         0.921       
## jobsat3         0.705       
## jobinv1                0.320
## jobinv2                0.686
## jobinv3                0.947
## jobinv4                0.762
## morale1  0.679              
## morale2  0.876              
## morale3  0.868              
## morale4  0.905              
## 
##                  PA2   PA1   PA3
## SS loadings    2.809 2.219 2.057
## Proportion Var 0.255 0.202 0.187
## Cumulative Var 0.255 0.457 0.644

Q2a: The PAF yielded 3 factors, which was based on an eigenvalue greater than one. Additionally, I looked at the scree plot to determine when the drop in eigenvalues begins to level out (i.e., the slope of the curve begins to create an elbow). Also, 66% of the total variance was explained by the 3 factors.

Q2b: Because no item exhibited high cross-loadings (greater than .35) or had a factor loading of less than .30. All items were retained (c.f., Hinkin, 1995).

Q2c: The factor loadings obtained from the principal axis factoring analysis ranged from 0.320 to 0.947. These factor loadings support the construct validity of items, as the all items’ loadings on respective factor exceeded the conventional threshold of 0.30, with no cross-loadings.

Q2d: Jobinv1 demonstrated the lowest factor loading, whereas Jobinv3 demonstrated the highest loading on their respective factor.

Q2e: Overall, the tests supported a 3-factor structure because the items loaded much higher on their intended factors than the other factors.

3. Report your principal axis factoring results using an APA-style table (use any of the articles you’ve read thus far in the course as a guide).

library(sjPlot)
## Warning: package 'sjPlot' was built under R version 4.3.3
## Install package "strengejacke" from GitHub (`devtools::install_github("strengejacke/strengejacke")`) to load all sj-packages at once!
tab_fa(fa_results)
## Cronbach's Alpha can only be calculated when having a data frame with each component / variable as column.
Factor Analysis
  Factor 1 Factor 2 Factor 3
jobsat1 0.01 0.90 -0.01
jobsat2 -0.03 0.92 0.01
jobsat3 0.04 0.71 0.03
jobinv1 0.03 -0.06 0.32
jobinv2 0.06 0.17 0.69
jobinv3 -0.01 -0.03 0.95
jobinv4 -0.01 -0.03 0.76
morale1 0.68 0.14 -0.05
morale2 0.88 0.02 0.01
morale3 0.87 -0.02 -0.03
morale4 0.90 -0.05 0.05

4. Use the R code below to calculate the internal consistency reliability (alpha) for each of the final scale, and then report the means, SDs, alphas, and correlations for the scales using an APA-style, or AOM-style, table.

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
# Alphas
JobSat <- alpha(Exercise_2a[,c("jobsat1", "jobsat2", "jobsat3")])
cat("Cronbach's Alpha for Job Satisfaction:", JobSat$total$raw_alpha, "\n")
## Cronbach's Alpha for Job Satisfaction: 0.8878538
JobInv <- alpha(Exercise_2a[,c("jobinv1", "jobinv2", "jobinv3", "jobinv4")])
cat("Cronbach's Alpha for Job Involvement:", JobInv$total$raw_alpha, "\n")
## Cronbach's Alpha for Job Involvement: 0.6822294
Morale <- alpha(Exercise_2a[,c("morale1", "morale2", "morale3","morale4")])
cat("Cronbach's Alpha for Job Morale:", Morale$total$raw_alpha, "\n")
## Cronbach's Alpha for Job Morale: 0.9036196
# Create Variables
Exercise_2a <- Exercise_2a %>%
  mutate(
    jobsat = rowMeans(cbind(jobsat1, jobsat2, jobsat3), na.rm = TRUE),
    
    jobinv = rowMeans(cbind(jobinv1, jobinv2, jobinv3, jobinv4), na.rm = TRUE),
    
    morale = rowMeans(cbind(morale1, morale2, morale3, morale4), na.rm = TRUE)
    )

# Descriptives
apa.cor.table(Exercise_2a[ , c("jobsat", "jobinv", "morale")])
## 
## 
## Means, standard deviations, and correlations with confidence intervals
##  
## 
##   Variable  M    SD   1          2         
##   1. jobsat 3.13 1.08                      
##                                            
##   2. jobinv 4.03 0.82 .41**                
##                       [.35, .47]           
##                                            
##   3. morale 3.31 0.95 .43**      .40**     
##                       [.37, .48] [.34, .46]
##                                            
## 
## Note. M and SD are used to represent mean and standard deviation, respectively.
## Values in square brackets indicate the 95% confidence interval.
## The confidence interval is a plausible range of population correlations 
## that could have caused the sample correlation (Cumming, 2014).
##  * indicates p < .05. ** indicates p < .01.
## 

Q5: I submitted the 11 items to an exploratory factor analysis (EFA), using principal axis factoring with an oblique rotation (Oblimin). Three factors were extracted with eigenvalues greater than 1.00. The moral factor accounted for the largest amount of variance (26%), followed by job satisfaction (21%) and job involvement (19%) factors. Factor loadings of items to their corresponding scale were greater than .68, and there was no cross-loading greater than .30.

The means, standard deviations, bivariate correlations, and reliability statistics of subscales are presented in Table X.

Part II: Confirmatory Factor Analysis and Structural Equation Modeling A study was conducted to test the relationships among two personality traits (conscientiousness and trait negative affect), two self-regulation mechanisms (state negative affect and effort allocation), and learning performance. Data were collected from 247 trainees, who participated in a training program directed at enhancing Microsoft Office skills. The design of the study was as follows:

In a pre-training session, trainees completed two self-report measures: (1) a 10-item measure of trait negative affect (extent to which individuals experience negative affect – e.g., feel anxious, nervous, etc. – in general; labeled as tna1-tna10); and (2) an 8-item measure of conscientiousness (extent to which individuals characterized themselves as hard working, efficient, detailed oriented, etc. in general; labeled as con1-con8). A 5-point Likert response scale was used for both measures (1 = strongly disagree; 5 = strongly agree), such that higher scores indicate higher levels of the respective construct.

1. For each of the multi-item variables (excluding performance), create 3 parcels of items. Parcels should include random combinations of sub-set of items, averaged into a single score (e.g., ‘tna1’, ‘tna4’, ‘tna7’, and ‘tna10’ can be averaged and combined into ‘tnap1’; ‘tna2’, ‘tna5’, and ‘tna8’ can be averaged and combined into ‘tnap2’, and so forth). Report how you create the parcels. In total, you should have 12 parcels total (3 for trait negative affect, 3 for conscientiousness, 3 for state negative affect, and 3 for effort). Performance should include a single-item indicator (i.e., ‘perform’). Make sure to describe and include and clearly label your syntax from this parceling procedure in your answer.

2. Using the 13 observed indicators (12 parcels and ‘perform’), conduct a series of confirmatory factor analyses to test the discriminant validity of the 5 constructs (assume reliability of .90 for performance). Specifically, compare the fit of the hypothesized (5-factor) model to 2 other alternative models. The choice of alternative models is up to you, but make sure to justify your choice for the 2 alternative models.

3. Report your results (i.e., fit statistics – including chi-squared with respective df, CFI, TLI, RMSEA, and SRMR) in a clearly labeled, APA-style table. What are your conclusions regarding the discriminant validity of measures?

Exercise_2b <- Exercise_2b %>%
  mutate(
    tna_parcel1 = rowMeans(cbind(tna8, tna1, tna4), na.rm = TRUE),
    tna_parcel2 = rowMeans(cbind(tna2, tna9, tna5), na.rm = TRUE),
    tna_parcel3 = rowMeans(cbind(tna10, tna6, tna7, tna3), na.rm = TRUE),
    con_parcel1 = rowMeans(cbind(con1, con4, con8), na.rm = TRUE),
    con_parcel2 = rowMeans(cbind(con2, con5, con7), na.rm = TRUE),
    con_parcel3 = rowMeans(cbind(con3, con6), na.rm = TRUE),
    sna_parcel1 = rowMeans(cbind(sna8, sna1, sna4), na.rm = TRUE),
    sna_parcel2 = rowMeans(cbind(tna2, sna9, sna5), na.rm = TRUE),
    sna_parcel3 = rowMeans(cbind(sna10, sna6, sna7, sna3), na.rm = TRUE),
    effrt_parcel1 = rowMeans(cbind(effrt1, effrt4), na.rm = TRUE),
    effrt_parcel2 = effrt2,
    effrt_parcel3 = effrt3
    )

Compute Error Variance for Performance Variable

var(Exercise_2b$perform) * (1-.90)
## [1] 18.74894

Conduct CFA

library(lavaan)
## Warning: package 'lavaan' was built under R version 4.3.3
## This is lavaan 0.6-19
## lavaan is FREE software! Please report any bugs.
## 
## Attaching package: 'lavaan'
## The following object is masked from 'package:psych':
## 
##     cor2cov
library(semPlot)

Hypothesized_5f <- '
  # Latent variable: TNA
  TNA_f1 =~ tna_parcel1 + tna_parcel2 + tna_parcel3

  # Latent variable: CON
  CON_f2 =~ con_parcel1 + con_parcel2 + con_parcel3

  # Latent variable: SNA
  SNA_f3 =~ sna_parcel1 + sna_parcel2 + sna_parcel3

  # Latent variable: EFFRT
  EFFRT_f4 =~ effrt_parcel1 + effrt_parcel2 + effrt_parcel3
  
  # Latent variable: PERFORM 
  PERFORM_f5 =~ perform

  # Fix the error variance of perform
  perform ~~ 18.7489*perform
'


# RESULTS
Hypothesized_5f_results <- cfa(Hypothesized_5f, data=Exercise_2b) 
summary(Hypothesized_5f_results, fit.measures=TRUE, standardized=TRUE)
## lavaan 0.6-19 ended normally after 66 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        35
## 
##   Number of observations                           247
## 
## Model Test User Model:
##                                                       
##   Test statistic                               184.030
##   Degrees of freedom                                56
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              1511.622
##   Degrees of freedom                                78
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.911
##   Tucker-Lewis Index (TLI)                       0.876
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -3818.404
##   Loglikelihood unrestricted model (H1)      -3726.388
##                                                       
##   Akaike (AIC)                                7706.807
##   Bayesian (BIC)                              7829.636
##   Sample-size adjusted Bayesian (SABIC)       7718.686
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.096
##   90 Percent confidence interval - lower         0.081
##   90 Percent confidence interval - upper         0.112
##   P-value H_0: RMSEA <= 0.050                    0.000
##   P-value H_0: RMSEA >= 0.080                    0.960
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.059
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   TNA_f1 =~                                                             
##     tna_parcel1       1.000                               0.734    0.854
##     tna_parcel2       0.849    0.058   14.675    0.000    0.623    0.805
##     tna_parcel3       0.854    0.053   16.149    0.000    0.627    0.880
##   CON_f2 =~                                                             
##     con_parcel1       1.000                               0.610    0.837
##     con_parcel2       0.696    0.067   10.415    0.000    0.425    0.703
##     con_parcel3       0.927    0.084   11.088    0.000    0.565    0.779
##   SNA_f3 =~                                                             
##     sna_parcel1       1.000                               0.806    0.811
##     sna_parcel2       0.695    0.049   14.281    0.000    0.560    0.849
##     sna_parcel3       0.723    0.051   14.170    0.000    0.583    0.841
##   EFFRT_f4 =~                                                           
##     effrt_parcel1     1.000                               0.744    0.981
##     effrt_parcel2     0.683    0.109    6.277    0.000    0.508    0.538
##     effrt_parcel3     0.670    0.118    5.669    0.000    0.499    0.453
##   PERFORM_f5 =~                                                         
##     perform           1.000                              12.961    0.948
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   TNA_f1 ~~                                                             
##     CON_f2           -0.110    0.034   -3.188    0.001   -0.245   -0.245
##     SNA_f3            0.334    0.052    6.492    0.000    0.565    0.565
##     EFFRT_f4         -0.095    0.038   -2.484    0.013   -0.174   -0.174
##     PERFORM_f5        0.049    0.677    0.073    0.942    0.005    0.005
##   CON_f2 ~~                                                             
##     SNA_f3           -0.064    0.037   -1.728    0.084   -0.131   -0.131
##     EFFRT_f4          0.150    0.034    4.382    0.000    0.331    0.331
##     PERFORM_f5        0.652    0.585    1.115    0.265    0.082    0.082
##   SNA_f3 ~~                                                             
##     EFFRT_f4         -0.171    0.044   -3.926    0.000   -0.286   -0.286
##     PERFORM_f5       -2.563    0.776   -3.305    0.001   -0.245   -0.245
##   EFFRT_f4 ~~                                                           
##     PERFORM_f5        3.068    0.688    4.462    0.000    0.318    0.318
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .perform          18.749                              18.749    0.100
##    .tna_parcel1       0.201    0.028    7.160    0.000    0.201    0.271
##    .tna_parcel2       0.211    0.025    8.507    0.000    0.211    0.352
##    .tna_parcel3       0.114    0.019    6.155    0.000    0.114    0.225
##    .con_parcel1       0.159    0.030    5.396    0.000    0.159    0.300
##    .con_parcel2       0.184    0.021    8.744    0.000    0.184    0.505
##    .con_parcel3       0.207    0.029    7.092    0.000    0.207    0.392
##    .sna_parcel1       0.339    0.042    8.065    0.000    0.339    0.343
##    .sna_parcel2       0.121    0.017    6.960    0.000    0.121    0.279
##    .sna_parcel3       0.140    0.019    7.213    0.000    0.140    0.292
##    .effrt_parcel1     0.022    0.069    0.315    0.752    0.022    0.038
##    .effrt_parcel2     0.635    0.066    9.661    0.000    0.635    0.711
##    .effrt_parcel3     0.961    0.092   10.429    0.000    0.961    0.794
##     TNA_f1            0.539    0.068    7.980    0.000    1.000    1.000
##     CON_f2            0.372    0.052    7.098    0.000    1.000    1.000
##     SNA_f3            0.649    0.088    7.348    0.000    1.000    1.000
##     EFFRT_f4          0.554    0.086    6.428    0.000    1.000    1.000
##     PERFORM_f5      167.981   16.803    9.997    0.000    1.000    1.000
# PLOT
semPaths(Hypothesized_5f_results, "std", weighted = FALSE, nCharNodes = 7, shapeMan = "rectangle",
         sizeMan = 8, sizeMan2 = 5) 

Alternative Model #1: Combined trait negative affect and conscientiousness to create a single factor because both were measured at the same point in time (pre-training) and both represent stable personality traits. Allowed state negative affect, effort, and overall learning performance to create 3 separate factors (i.e., loaded on their respective subscales) because the training program presumably influenced these exogenous variables.

Hypothesized_4f <- '
  # Latent variable: TNA & CON 
  TNA_CON_f1 =~ tna_parcel1 + tna_parcel2 + tna_parcel3 +
         con_parcel1 + con_parcel2 + con_parcel3

  # Latent variable: SNA
  SNA_f2 =~ sna_parcel1 + sna_parcel2 + sna_parcel3 

  # Latent variable: EFFRT
  EFFRT_f3 =~ effrt_parcel1 + effrt_parcel2 + effrt_parcel3
  
  # Latent variable: PERFORM 
  PERFORM_f4 =~ perform

  # Fix the error variance of perform
  perform ~~ 18.74894*perform
'

# RESULTS
Hypothesized_4f_results <- cfa(Hypothesized_4f, data=Exercise_2b) 
summary(Hypothesized_4f_results, fit.measures=TRUE, standardized=TRUE)
## lavaan 0.6-19 ended normally after 55 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        31
## 
##   Number of observations                           247
## 
## Model Test User Model:
##                                                       
##   Test statistic                               445.724
##   Degrees of freedom                                60
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              1511.622
##   Degrees of freedom                                78
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.731
##   Tucker-Lewis Index (TLI)                       0.650
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -3949.251
##   Loglikelihood unrestricted model (H1)      -3726.388
##                                                       
##   Akaike (AIC)                                7960.501
##   Bayesian (BIC)                              8069.292
##   Sample-size adjusted Bayesian (SABIC)       7971.022
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.161
##   90 Percent confidence interval - lower         0.147
##   90 Percent confidence interval - upper         0.176
##   P-value H_0: RMSEA <= 0.050                    0.000
##   P-value H_0: RMSEA >= 0.080                    1.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.127
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   TNA_CON_f1 =~                                                         
##     tna_parcel1       1.000                               0.733    0.853
##     tna_parcel2       0.854    0.058   14.701    0.000    0.626    0.809
##     tna_parcel3       0.847    0.053   15.961    0.000    0.621    0.872
##     con_parcel1      -0.227    0.066   -3.436    0.001   -0.166   -0.228
##     con_parcel2      -0.166    0.055   -3.023    0.003   -0.122   -0.201
##     con_parcel3      -0.246    0.065   -3.760    0.000   -0.181   -0.249
##   SNA_f2 =~                                                             
##     sna_parcel1       1.000                               0.806    0.811
##     sna_parcel2       0.693    0.049   14.245    0.000    0.558    0.847
##     sna_parcel3       0.726    0.051   14.222    0.000    0.585    0.845
##   EFFRT_f3 =~                                                           
##     effrt_parcel1     1.000                               0.756    0.997
##     effrt_parcel2     0.662    0.116    5.692    0.000    0.501    0.530
##     effrt_parcel3     0.649    0.124    5.214    0.000    0.491    0.446
##   PERFORM_f4 =~                                                         
##     perform           1.000                              12.961    0.948
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   TNA_CON_f1 ~~                                                         
##     SNA_f2            0.333    0.051    6.481    0.000    0.564    0.564
##     EFFRT_f3         -0.106    0.038   -2.751    0.006   -0.190   -0.190
##     PERFORM_f4       -0.009    0.677   -0.013    0.989   -0.001   -0.001
##   SNA_f2 ~~                                                             
##     EFFRT_f3         -0.172    0.044   -3.939    0.000   -0.283   -0.283
##     PERFORM_f4       -2.570    0.776   -3.314    0.001   -0.246   -0.246
##   EFFRT_f3 ~~                                                           
##     PERFORM_f4        3.076    0.688    4.471    0.000    0.314    0.314
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .perform          18.749                              18.749    0.100
##    .tna_parcel1       0.202    0.028    7.194    0.000    0.202    0.273
##    .tna_parcel2       0.207    0.025    8.403    0.000    0.207    0.346
##    .tna_parcel3       0.122    0.019    6.513    0.000    0.122    0.240
##    .con_parcel1       0.504    0.046   11.040    0.000    0.504    0.948
##    .con_parcel2       0.350    0.032   11.056    0.000    0.350    0.959
##    .con_parcel3       0.494    0.045   11.024    0.000    0.494    0.938
##    .sna_parcel1       0.339    0.042    8.063    0.000    0.339    0.343
##    .sna_parcel2       0.123    0.017    7.044    0.000    0.123    0.283
##    .sna_parcel3       0.137    0.019    7.097    0.000    0.137    0.286
##    .effrt_parcel1     0.004    0.082    0.048    0.962    0.004    0.007
##    .effrt_parcel2     0.643    0.068    9.440    0.000    0.643    0.719
##    .effrt_parcel3     0.969    0.094   10.331    0.000    0.969    0.801
##     TNA_CON_f1        0.538    0.068    7.967    0.000    1.000    1.000
##     SNA_f2            0.649    0.088    7.348    0.000    1.000    1.000
##     EFFRT_f3          0.571    0.097    5.903    0.000    1.000    1.000
##     PERFORM_f4      167.981   16.803    9.997    0.000    1.000    1.000
# PLOT
semPaths(Hypothesized_4f_results, "std", weighted = FALSE, nCharNodes = 7, shapeMan = "rectangle",
         sizeMan = 8, sizeMan2 = 5) 

Alternative Model #2: Combined trait negative affect and conscientiousness to create a single factor because both were measured at the same point in time (pre-training) and both represent stable personality traits. Combined state negative affect and effort to create a single factor because both were measured at the same point in time (end of 3rd module) and reflect self-regulatory behaviors. The overall score for the learning performance measure was allowed to load on a single factor because it was measured post-training and reflects training effectiveness.

Hypothesized_3f <- '
  # Latent variable: TNA & CON 
  TNA_CON_f1 =~ tna_parcel1 + tna_parcel2 + tna_parcel3 +
         con_parcel1 + con_parcel2 + con_parcel3

  # Latent variable: SNA
  SNA_f2 =~ sna_parcel1 + sna_parcel2 + sna_parcel3 +
         effrt_parcel1 + effrt_parcel2 + effrt_parcel3
  
  # Latent variable: PERFORM 
  PERFORM_f3 =~ perform

  # Fix the error variance of perform
  perform ~~ 18.74894*perform
'

# RESULTS
Hypothesized_3f_results <- cfa(Hypothesized_3f, data=Exercise_2b) 
summary(Hypothesized_3f_results, fit.measures=TRUE, standardized=TRUE)
## lavaan 0.6-19 ended normally after 42 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        28
## 
##   Number of observations                           247
## 
## Model Test User Model:
##                                                       
##   Test statistic                               583.142
##   Degrees of freedom                                63
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              1511.622
##   Degrees of freedom                                78
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.637
##   Tucker-Lewis Index (TLI)                       0.551
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -4017.960
##   Loglikelihood unrestricted model (H1)      -3726.388
##                                                       
##   Akaike (AIC)                                8091.919
##   Bayesian (BIC)                              8190.182
##   Sample-size adjusted Bayesian (SABIC)       8101.422
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.183
##   90 Percent confidence interval - lower         0.169
##   90 Percent confidence interval - upper         0.197
##   P-value H_0: RMSEA <= 0.050                    0.000
##   P-value H_0: RMSEA >= 0.080                    1.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.147
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   TNA_CON_f1 =~                                                         
##     tna_parcel1       1.000                               0.733    0.852
##     tna_parcel2       0.855    0.058   14.701    0.000    0.627    0.809
##     tna_parcel3       0.848    0.053   15.975    0.000    0.622    0.873
##     con_parcel1      -0.225    0.066   -3.400    0.001   -0.165   -0.226
##     con_parcel2      -0.164    0.055   -2.985    0.003   -0.120   -0.199
##     con_parcel3      -0.245    0.066   -3.735    0.000   -0.179   -0.247
##   SNA_f2 =~                                                             
##     sna_parcel1       1.000                               0.801    0.806
##     sna_parcel2       0.692    0.049   14.079    0.000    0.554    0.841
##     sna_parcel3       0.732    0.052   14.169    0.000    0.587    0.847
##     effrt_parcel1    -0.301    0.063   -4.785    0.000   -0.241   -0.318
##     effrt_parcel2    -0.140    0.080   -1.759    0.079   -0.112   -0.119
##     effrt_parcel3    -0.313    0.092   -3.402    0.001   -0.251   -0.228
##   PERFORM_f3 =~                                                         
##     perform           1.000                              12.961    0.948
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   TNA_CON_f1 ~~                                                         
##     SNA_f2            0.332    0.051    6.481    0.000    0.565    0.565
##     PERFORM_f3       -0.009    0.676   -0.013    0.990   -0.001   -0.001
##   SNA_f2 ~~                                                             
##     PERFORM_f3       -2.734    0.775   -3.528    0.000   -0.263   -0.263
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .perform          18.749                              18.749    0.100
##    .tna_parcel1       0.202    0.028    7.208    0.000    0.202    0.274
##    .tna_parcel2       0.207    0.025    8.404    0.000    0.207    0.346
##    .tna_parcel3       0.121    0.019    6.472    0.000    0.121    0.238
##    .con_parcel1       0.504    0.046   11.041    0.000    0.504    0.949
##    .con_parcel2       0.350    0.032   11.058    0.000    0.350    0.960
##    .con_parcel3       0.494    0.045   11.026    0.000    0.494    0.939
##    .sna_parcel1       0.346    0.042    8.197    0.000    0.346    0.351
##    .sna_parcel2       0.127    0.018    7.265    0.000    0.127    0.293
##    .sna_parcel3       0.135    0.019    7.072    0.000    0.135    0.282
##    .effrt_parcel1     0.517    0.047   10.946    0.000    0.517    0.899
##    .effrt_parcel2     0.881    0.079   11.092    0.000    0.881    0.986
##    .effrt_parcel3     1.147    0.104   11.032    0.000    1.147    0.948
##     TNA_CON_f1        0.537    0.067    7.962    0.000    1.000    1.000
##     SNA_f2            0.642    0.088    7.290    0.000    1.000    1.000
##     PERFORM_f3      167.981   16.803    9.997    0.000    1.000    1.000
# PLOT
semPaths(Hypothesized_4f_results, "std", weighted = FALSE, nCharNodes = 7, shapeMan = "rectangle",
         sizeMan = 8, sizeMan2 = 5) 

# Compare Models 
Model_5vs4 <- anova(Hypothesized_5f_results, 
                    Hypothesized_4f_results)

Model_5vs3 <- anova(Hypothesized_5f_results, 
                    Hypothesized_3f_results)

# extract values based on column indices
Hypothesized_5f_fit <- Model_5vs4[1, ]  
Hypothesized_4f_fit <- Model_5vs4[2, ] 
Hypothesized_3f_fit <- Model_5vs3[2, ] 

Model_Comparisons_Table <- rbind(Hypothesized_5f_fit,
                           Hypothesized_4f_fit,
                           Hypothesized_3f_fit
                           )

print(Model_Comparisons_Table)
## 
## Chi-Squared Difference Test
## 
##                         Df    AIC    BIC  Chisq Chisq diff   RMSEA Df diff
## Hypothesized_5f_results 56 7706.8 7829.6 184.03                           
## Hypothesized_4f_results 60 7960.5 8069.3 445.72     261.69 0.51071       4
## Hypothesized_3f_results 63 8091.9 8190.2 583.14     399.11 0.47622       7
##                         Pr(>Chisq)    
## Hypothesized_5f_results               
## Hypothesized_4f_results  < 2.2e-16 ***
## Hypothesized_3f_results  < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Q3: The more complex 5-factor model fits the data significantly better than the more parsimonious 4-factor (χ2 = 261.69, df = 4, p < .01) and 3-factor (χ2 = 399.11, df = 7, p < .01) models. Thus, the hypothesized 5-factor model will be used as the measurement model for further testing of structural relationships.

4. Report descriptive statistics (means and standard deviations), correlations among, and internal consistency reliability for the 5 scales. The results for this table should be based on all items from each scale (not the parcels you created).

# Create variables
Exercise_2b <- Exercise_2b %>%
  mutate(
    TNA = rowMeans(cbind(tna1, tna2, tna3, tna4, tna5, 
                         tna6, tna7, tna8, tna9, tna10), na.rm = TRUE),
    
    CON = rowMeans(cbind(con1, con2, con3, con4, 
                         con5, con6, con7, con8), na.rm = TRUE),
    
    SNA = rowMeans(cbind(sna1, sna2, sna3, sna4, sna5, 
                         sna6, sna7, sna8, sna9, sna10), na.rm = TRUE),
    
    EFFRT = rowMeans(cbind(effrt1, effrt2, effrt3, effrt4), na.rm = TRUE)
  )

# Descriptive Statistics
names(Exercise_2b)
##  [1] "tna1"          "tna2"          "tna3"          "tna4"         
##  [5] "tna5"          "tna6"          "tna7"          "tna8"         
##  [9] "tna9"          "tna10"         "con1"          "con2"         
## [13] "con3"          "con4"          "con5"          "con6"         
## [17] "con7"          "con8"          "sna1"          "sna2"         
## [21] "sna3"          "sna4"          "sna5"          "sna6"         
## [25] "sna7"          "sna8"          "sna9"          "sna10"        
## [29] "effrt1"        "effrt2"        "effrt3"        "effrt4"       
## [33] "perform"       "tna_parcel1"   "tna_parcel2"   "tna_parcel3"  
## [37] "con_parcel1"   "con_parcel2"   "con_parcel3"   "sna_parcel1"  
## [41] "sna_parcel2"   "sna_parcel3"   "effrt_parcel1" "effrt_parcel2"
## [45] "effrt_parcel3" "TNA"           "CON"           "SNA"          
## [49] "EFFRT"
apa.cor.table(Exercise_2b[ ,c("TNA","CON","SNA","EFFRT","perform")])
## 
## 
## Means, standard deviations, and correlations with confidence intervals
##  
## 
##   Variable   M     SD    1            2           3            4         
##   1. TNA     2.13  0.70                                                  
##                                                                          
##   2. CON     3.82  0.59  -.21**                                          
##                          [-.33, -.09]                                    
##                                                                          
##   3. SNA     2.03  0.71  .38**        -.09                               
##                          [.26, .48]   [-.21, .03]                        
##                                                                          
##   4. EFFRT   3.82  0.70  -.18**       .31**       -.24**                 
##                          [-.30, -.06] [.19, .42]  [-.36, -.12]           
##                                                                          
##   5. perform 74.92 13.69 .00          .07         -.23**       .25**     
##                          [-.12, .13]  [-.05, .19] [-.35, -.11] [.13, .37]
##                                                                          
## 
## Note. M and SD are used to represent mean and standard deviation, respectively.
## Values in square brackets indicate the 95% confidence interval.
## The confidence interval is a plausible range of population correlations 
## that could have caused the sample correlation (Cumming, 2014).
##  * indicates p < .05. ** indicates p < .01.
## 
# Compute Reliability

# TNA alpha
alpha_tna <- alpha(Exercise_2b[, c("tna1", "tna2", "tna3", "tna4", "tna5",
                                   "tna6", "tna7", "tna8", "tna9", "tna10")])

# CON alpha
alpha_con <- alpha(Exercise_2b[, c("con1", "con2", "con3", "con4", 
                                   "con5", "con6", "con7", "con8")])

# SNA alpha
alpha_sna <- alpha(Exercise_2b[, c("sna1", "sna2", "sna3", "sna4", "sna5",
                                   "sna6", "sna7", "sna8", "sna9", "sna10")])

# EFFRT alpha
alpha_effrt <- alpha(Exercise_2b[, c("effrt1", "effrt2", "effrt3", "effrt4")])

cat("Cronbach's Alpha for trait negative affect:", alpha_tna$total$raw_alpha, "\n")
## Cronbach's Alpha for trait negative affect: 0.8762884
cat("Cronbach's Alpha for state negative affect:", alpha_sna$total$raw_alpha, "\n")
## Cronbach's Alpha for state negative affect: 0.8929394
cat("Cronbach's Alpha for conscientiousness:", alpha_con$total$raw_alpha, "\n")
## Cronbach's Alpha for conscientiousness: 0.8163869
cat("Cronbach's Alpha for effort:", alpha_effrt$total$raw_alpha, "\n")
## Cronbach's Alpha for effort: 0.6892437

5. In one or two paragraphs (one half or one page), propose and provide explanation for a theoretical model of relationships among the 5 constructs (trait negative affect, conscientiousness, state negative affect, effort, and learning performance). Also, provide a figure illustrating your proposed, hypothesized model.

6. In a short paragraph (no more than half a page), propose and provide explanation for (1) one alternative, more parsimonious model of relationships among these constructs, and (2) a second alternative, less parsimonious model of relationships among these constructs. No need to provide a figure for these models, but they could be incorporated into the figure of the hypothesized model from question #5.

Hypothesized Model: Conscientiousness and trait negative affect are stable attributes that have been empirically shown to influence employees’ effort and state negative affect in the workplace, respectively. In turn, employee effort and state negative affect has been empirically shown to influence employees’ performance ratings. Thus, I propose a model that reflects these prior findings (see Figure 1).

Hypothesized_Model <- '
  # Latent variable: TNA
  TNA_f1 =~ tna_parcel1 + tna_parcel2 + tna_parcel3

  # Latent variable: CON
  CON_f2 =~ con_parcel1 + con_parcel2 + con_parcel3

  # Latent variable: SNA
  SNA_f3 =~ sna_parcel1 + sna_parcel2 + sna_parcel3

  # Latent variable: EFFRT
  EFFRT_f4 =~ effrt_parcel1 + effrt_parcel2 + effrt_parcel3
  
  # Latent variable: PERFORM 
  PERFORM_f5 =~ perform

  # Fix the error variance of perform
  perform ~~ 18.74894*perform
  
  # Conscientiousness predicting Effort
  EFFRT_f4 ~ a1*CON_f2
  
  # Trait Negative Affect predicting State Negative Affect
  SNA_f3 ~ a2*TNA_f1
  
  # Effort, State Negative Affect, Conscientiousness, and Trait Negative Affect predicting Learning Performance  
  PERFORM_f5 ~ b1*EFFRT_f4 + b2*SNA_f3 + CON_f2 + TNA_f1
  
  # Constrain Covariance to Zero
  TNA_f1 ~~ 0*CON_f2
  
  # Indirect Effects
  ab1 := a1 * b1  
  ab2 := a2 * b2
'

# RESULTS
Hypothesized_Model_results <- cfa(Hypothesized_Model, data=Exercise_2b) 
summary(Hypothesized_Model_results, fit.measures=TRUE, standardized=TRUE)
## lavaan 0.6-19 ended normally after 139 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        31
## 
##   Number of observations                           247
## 
## Model Test User Model:
##                                                       
##   Test statistic                               210.018
##   Degrees of freedom                                60
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              1511.622
##   Degrees of freedom                                78
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.895
##   Tucker-Lewis Index (TLI)                       0.864
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -3831.397
##   Loglikelihood unrestricted model (H1)      -3726.388
##                                                       
##   Akaike (AIC)                                7724.794
##   Bayesian (BIC)                              7833.585
##   Sample-size adjusted Bayesian (SABIC)       7735.316
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.101
##   90 Percent confidence interval - lower         0.086
##   90 Percent confidence interval - upper         0.116
##   P-value H_0: RMSEA <= 0.050                    0.000
##   P-value H_0: RMSEA >= 0.080                    0.989
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.106
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   TNA_f1 =~                                                             
##     tna_parcel1       1.000                               0.734    0.853
##     tna_parcel2       0.847    0.058   14.599    0.000    0.621    0.802
##     tna_parcel3       0.858    0.053   16.142    0.000    0.629    0.883
##   CON_f2 =~                                                             
##     con_parcel1       1.000                               0.610    0.837
##     con_parcel2       0.698    0.067   10.370    0.000    0.426    0.705
##     con_parcel3       0.925    0.084   10.973    0.000    0.564    0.778
##   SNA_f3 =~                                                             
##     sna_parcel1       1.000                               0.802    0.807
##     sna_parcel2       0.702    0.049   14.203    0.000    0.563    0.854
##     sna_parcel3       0.724    0.052   14.008    0.000    0.581    0.839
##   EFFRT_f4 =~                                                           
##     effrt_parcel1     1.000                               0.729    0.961
##     effrt_parcel2     0.712    0.117    6.096    0.000    0.519    0.549
##     effrt_parcel3     0.695    0.125    5.538    0.000    0.507    0.461
##   PERFORM_f5 =~                                                         
##     perform           1.000                              12.835    0.948
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   EFFRT_f4 ~                                                            
##     CON_f2    (a1)    0.406    0.086    4.735    0.000    0.339    0.339
##   SNA_f3 ~                                                              
##     TNA_f1    (a2)    0.622    0.078    7.993    0.000    0.569    0.569
##   PERFORM_f5 ~                                                          
##     EFFRT_f4  (b1)    5.125    1.445    3.547    0.000    0.291    0.291
##     SNA_f3    (b2)   -4.716    1.412   -3.339    0.001   -0.295   -0.295
##     CON_f2           -0.116    1.603   -0.073    0.942   -0.006   -0.006
##     TNA_f1            3.875    1.520    2.549    0.011    0.222    0.222
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   TNA_f1 ~~                                                             
##     CON_f2            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .perform          18.749                              18.749    0.102
##    .tna_parcel1       0.201    0.028    7.149    0.000    0.201    0.272
##    .tna_parcel2       0.214    0.025    8.551    0.000    0.214    0.356
##    .tna_parcel3       0.112    0.019    5.999    0.000    0.112    0.220
##    .con_parcel1       0.160    0.030    5.324    0.000    0.160    0.300
##    .con_parcel2       0.183    0.021    8.686    0.000    0.183    0.503
##    .con_parcel3       0.208    0.029    7.062    0.000    0.208    0.394
##    .sna_parcel1       0.345    0.043    8.105    0.000    0.345    0.349
##    .sna_parcel2       0.118    0.018    6.737    0.000    0.118    0.271
##    .sna_parcel3       0.142    0.020    7.227    0.000    0.142    0.296
##    .effrt_parcel1     0.044    0.071    0.615    0.539    0.044    0.076
##    .effrt_parcel2     0.624    0.067    9.321    0.000    0.624    0.698
##    .effrt_parcel3     0.953    0.093   10.265    0.000    0.953    0.788
##     TNA_f1            0.538    0.068    7.966    0.000    1.000    1.000
##     CON_f2            0.372    0.053    7.065    0.000    1.000    1.000
##    .SNA_f3            0.435    0.064    6.837    0.000    0.676    0.676
##    .EFFRT_f4          0.471    0.084    5.581    0.000    0.885    0.885
##    .PERFORM_f5      140.787   14.824    9.497    0.000    0.855    0.855
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     ab1               2.079    0.727    2.859    0.004    0.099    0.099
##     ab2              -2.933    0.943   -3.110    0.002   -0.168   -0.168
# PLOT
semPaths(Hypothesized_Model_results, "std", weighted = FALSE, nCharNodes = 7, shapeMan = "rectangle",
         sizeMan = 8, sizeMan2 = 5) 

More Parsimonious Model: This model tests the extent to which effort and state negative effect fully explain the linkages between conscientiousness and trait negative effect on learning performance. Therefore, the direct effects of conscientiousness and trait negative effect on learning performance were not estimated. As such, two less parameters were estimated compared to the hypothesized model.

MoreParsimonious_Model <- '
  # Latent variable: TNA
  TNA_f1 =~ tna_parcel1 + tna_parcel2 + tna_parcel3

  # Latent variable: CON
  CON_f2 =~ con_parcel1 + con_parcel2 + con_parcel3

  # Latent variable: SNA
  SNA_f3 =~ sna_parcel1 + sna_parcel2 + sna_parcel3

  # Latent variable: EFFRT
  EFFRT_f4 =~ effrt_parcel1 + effrt_parcel2 + effrt_parcel3
  
  # Latent variable: PERFORM 
  PERFORM_f5 =~ perform

  # Fix the error variance of perform
  perform ~~ 18.74894*perform
  
  # Conscientiousness predicting Effort
  EFFRT_f4 ~ a1*CON_f2
  
  # Trait Negative Affect predicting State Negative Affect
  SNA_f3 ~ a2*TNA_f1
  
  # Effort and State Negative Affect predicting Learning Performance (no direct effect)  
  PERFORM_f5 ~ b1*EFFRT_f4 + b2*SNA_f3
  
  TNA_f1 ~~ 0*CON_f2
  
  # Indirect Effects
  ab1 := a1 * b1  
  ab2 := a2 * b2
'

# RESULTS
MoreParsimonious_Model_results <- cfa(MoreParsimonious_Model, data=Exercise_2b) 
summary(MoreParsimonious_Model_results, fit.measures=TRUE, standardized=TRUE)
## lavaan 0.6-19 ended normally after 186 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        29
## 
##   Number of observations                           247
## 
## Model Test User Model:
##                                                       
##   Test statistic                               216.511
##   Degrees of freedom                                62
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              1511.622
##   Degrees of freedom                                78
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.892
##   Tucker-Lewis Index (TLI)                       0.864
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -3834.644
##   Loglikelihood unrestricted model (H1)      -3726.388
##                                                       
##   Akaike (AIC)                                7727.288
##   Bayesian (BIC)                              7829.060
##   Sample-size adjusted Bayesian (SABIC)       7737.130
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.100
##   90 Percent confidence interval - lower         0.086
##   90 Percent confidence interval - upper         0.115
##   P-value H_0: RMSEA <= 0.050                    0.000
##   P-value H_0: RMSEA >= 0.080                    0.990
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.107
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   TNA_f1 =~                                                             
##     tna_parcel1       1.000                               0.732    0.851
##     tna_parcel2       0.849    0.058   14.548    0.000    0.621    0.802
##     tna_parcel3       0.862    0.054   16.073    0.000    0.631    0.886
##   CON_f2 =~                                                             
##     con_parcel1       1.000                               0.610    0.837
##     con_parcel2       0.698    0.067   10.365    0.000    0.426    0.705
##     con_parcel3       0.926    0.084   10.971    0.000    0.565    0.778
##   SNA_f3 =~                                                             
##     sna_parcel1       1.000                               0.805    0.810
##     sna_parcel2       0.696    0.049   14.194    0.000    0.560    0.850
##     sna_parcel3       0.725    0.051   14.098    0.000    0.583    0.843
##   EFFRT_f4 =~                                                           
##     effrt_parcel1     1.000                               0.741    0.976
##     effrt_parcel2     0.690    0.115    5.998    0.000    0.511    0.541
##     effrt_parcel3     0.675    0.124    5.459    0.000    0.500    0.455
##   PERFORM_f5 =~                                                         
##     perform           1.000                              12.824    0.947
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   EFFRT_f4 ~                                                            
##     CON_f2    (a1)    0.404    0.086    4.711    0.000    0.333    0.333
##   SNA_f3 ~                                                              
##     TNA_f1    (a2)    0.617    0.078    7.883    0.000    0.561    0.561
##   PERFORM_f5 ~                                                          
##     EFFRT_f4  (b1)    4.894    1.302    3.761    0.000    0.283    0.283
##     SNA_f3    (b2)   -2.489    1.096   -2.272    0.023   -0.156   -0.156
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   TNA_f1 ~~                                                             
##     CON_f2            0.000                               0.000    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .perform          18.749                              18.749    0.102
##    .tna_parcel1       0.204    0.028    7.197    0.000    0.204    0.276
##    .tna_parcel2       0.214    0.025    8.533    0.000    0.214    0.356
##    .tna_parcel3       0.109    0.019    5.851    0.000    0.109    0.216
##    .con_parcel1       0.159    0.030    5.319    0.000    0.159    0.300
##    .con_parcel2       0.184    0.021    8.692    0.000    0.184    0.503
##    .con_parcel3       0.207    0.029    7.053    0.000    0.207    0.394
##    .sna_parcel1       0.340    0.042    8.020    0.000    0.340    0.344
##    .sna_parcel2       0.121    0.018    6.836    0.000    0.121    0.278
##    .sna_parcel3       0.139    0.020    7.083    0.000    0.139    0.290
##    .effrt_parcel1     0.027    0.074    0.363    0.717    0.027    0.046
##    .effrt_parcel2     0.632    0.067    9.426    0.000    0.632    0.708
##    .effrt_parcel3     0.960    0.093   10.318    0.000    0.960    0.793
##     TNA_f1            0.535    0.068    7.926    0.000    1.000    1.000
##     CON_f2            0.372    0.053    7.065    0.000    1.000    1.000
##    .SNA_f3            0.444    0.065    6.885    0.000    0.686    0.686
##    .EFFRT_f4          0.488    0.087    5.598    0.000    0.889    0.889
##    .PERFORM_f5      147.300   15.136    9.732    0.000    0.896    0.896
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     ab1               1.976    0.668    2.960    0.003    0.094    0.094
##     ab2              -1.536    0.695   -2.211    0.027   -0.088   -0.088
# PLOT
semPaths(MoreParsimonious_Model_results, "std", weighted = FALSE, nCharNodes = 7, shapeMan = "rectangle",
         sizeMan = 8, sizeMan2 = 5) 

Less Parsimonious Model: Based on the past research demonstrating the relationship among the personality variables and self-regulatory behaviors, the predictors and mediators were allowed to covary. Moreover, it was expected that effort would partially explain the linkage between conscientiousness and learning performance and state negative affect would partially explain the linkage between trait negative affect and learning performance. Therefore, the direct effects of conscientiousness and trait negative effect on learning performance were estimated. As such, one additional parameter was estimated compared to the hypothesized model.

LessParsimonious_Model <- '
  # Latent variable: TNA
  TNA_f1 =~ tna_parcel1 + tna_parcel2 + tna_parcel3

  # Latent variable: CON
  CON_f2 =~ con_parcel1 + con_parcel2 + con_parcel3

  # Latent variable: SNA
  SNA_f3 =~ sna_parcel1 + sna_parcel2 + sna_parcel3

  # Latent variable: EFFRT
  EFFRT_f4 =~ effrt_parcel1 + effrt_parcel2 + effrt_parcel3
  
  # Latent variable: PERFORM 
  PERFORM_f5 =~ perform

  # Fix the error variance of perform
  perform ~~ 18.74894*perform
  
  # Conscientiousness predicting Effort
  EFFRT_f4 ~ a1*CON_f2
  
  # Trait Negative Affect predicting State Negative Affect
  SNA_f3 ~ a2*TNA_f1
  
  # Effort and State Negative Affect predicting Learning Performance (no direct effect)  
  PERFORM_f5 ~ b1*EFFRT_f4 + b2*SNA_f3 + TNA_f1 + CON_f2 
  
  # Indirect Effects
  ab1 := a1 * b1  
  ab2 := a2 * b2
'

# RESULTS
LessParsimonious_Model_results <- cfa(LessParsimonious_Model, data=Exercise_2b) 
summary(LessParsimonious_Model_results, fit.measures=TRUE, standardized=TRUE)
## lavaan 0.6-19 ended normally after 141 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        32
## 
##   Number of observations                           247
## 
## Model Test User Model:
##                                                       
##   Test statistic                               198.010
##   Degrees of freedom                                59
##   P-value (Chi-square)                           0.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                              1511.622
##   Degrees of freedom                                78
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.903
##   Tucker-Lewis Index (TLI)                       0.872
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -3825.394
##   Loglikelihood unrestricted model (H1)      -3726.388
##                                                       
##   Akaike (AIC)                                7714.787
##   Bayesian (BIC)                              7827.088
##   Sample-size adjusted Bayesian (SABIC)       7725.648
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.098
##   90 Percent confidence interval - lower         0.083
##   90 Percent confidence interval - upper         0.113
##   P-value H_0: RMSEA <= 0.050                    0.000
##   P-value H_0: RMSEA >= 0.080                    0.974
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.076
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## Latent Variables:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   TNA_f1 =~                                                             
##     tna_parcel1       1.000                               0.734    0.854
##     tna_parcel2       0.849    0.058   14.691    0.000    0.624    0.805
##     tna_parcel3       0.853    0.053   16.151    0.000    0.627    0.880
##   CON_f2 =~                                                             
##     con_parcel1       1.000                               0.607    0.832
##     con_parcel2       0.702    0.067   10.439    0.000    0.426    0.705
##     con_parcel3       0.934    0.084   11.113    0.000    0.567    0.781
##   SNA_f3 =~                                                             
##     sna_parcel1       1.000                               0.802    0.807
##     sna_parcel2       0.702    0.049   14.199    0.000    0.563    0.854
##     sna_parcel3       0.725    0.052   14.005    0.000    0.581    0.839
##   EFFRT_f4 =~                                                           
##     effrt_parcel1     1.000                               0.727    0.959
##     effrt_parcel2     0.715    0.117    6.137    0.000    0.520    0.551
##     effrt_parcel3     0.698    0.125    5.570    0.000    0.508    0.462
##   PERFORM_f5 =~                                                         
##     perform           1.000                              12.825    0.947
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   EFFRT_f4 ~                                                            
##     CON_f2    (a1)    0.415    0.086    4.822    0.000    0.346    0.346
##   SNA_f3 ~                                                              
##     TNA_f1    (a2)    0.623    0.078    8.014    0.000    0.570    0.570
##   PERFORM_f5 ~                                                          
##     EFFRT_f4  (b1)    5.154    1.453    3.547    0.000    0.292    0.292
##     SNA_f3    (b2)   -4.733    1.415   -3.344    0.001   -0.296   -0.296
##     TNA_f1            3.920    1.566    2.503    0.012    0.224    0.224
##     CON_f2           -0.011    1.679   -0.007    0.995   -0.001   -0.001
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   TNA_f1 ~~                                                             
##     CON_f2           -0.113    0.034   -3.296    0.001   -0.254   -0.254
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .perform          18.749                              18.749    0.102
##    .tna_parcel1       0.200    0.028    7.159    0.000    0.200    0.271
##    .tna_parcel2       0.211    0.025    8.501    0.000    0.211    0.351
##    .tna_parcel3       0.115    0.019    6.193    0.000    0.115    0.226
##    .con_parcel1       0.163    0.029    5.562    0.000    0.163    0.307
##    .con_parcel2       0.183    0.021    8.718    0.000    0.183    0.503
##    .con_parcel3       0.205    0.029    7.066    0.000    0.205    0.390
##    .sna_parcel1       0.345    0.043    8.115    0.000    0.345    0.349
##    .sna_parcel2       0.118    0.018    6.734    0.000    0.118    0.271
##    .sna_parcel3       0.142    0.020    7.225    0.000    0.142    0.296
##    .effrt_parcel1     0.046    0.070    0.660    0.509    0.046    0.080
##    .effrt_parcel2     0.622    0.067    9.321    0.000    0.622    0.697
##    .effrt_parcel3     0.952    0.093   10.264    0.000    0.952    0.787
##     TNA_f1            0.539    0.068    7.985    0.000    1.000    1.000
##     CON_f2            0.368    0.052    7.063    0.000    1.000    1.000
##    .SNA_f3            0.434    0.063    6.830    0.000    0.675    0.675
##    .EFFRT_f4          0.466    0.083    5.588    0.000    0.880    0.880
##    .PERFORM_f5      140.685   14.824    9.491    0.000    0.855    0.855
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##     ab1               2.137    0.742    2.879    0.004    0.101    0.101
##     ab2              -2.947    0.946   -3.115    0.002   -0.169   -0.169
# PLOT
semPaths(LessParsimonious_Model_results, "std", weighted = FALSE, nCharNodes = 7, shapeMan = "rectangle",
         sizeMan = 8, sizeMan2 = 5) 

7. Test the fit of the hypothesized model relative to the measurement model, the more parsimonious model, and the less parsimonious model. Report your fit statistics results in a clearly labeled, APA-style table.

8. Discuss your findings, including your decision as to which model to retain as the best supported model, and the support to your proposed hypotheses. Justify your answer. Also, report the standardized path coefficient from the accepted model in a figure.

# Compare Models 
Model_HYPvsMorePars <- anova(Hypothesized_Model_results, 
                       MoreParsimonious_Model_results)

Model_HYPvsLessPars <- anova(Hypothesized_Model_results, 
                       LessParsimonious_Model_results)

print(Model_HYPvsMorePars)
## 
## Chi-Squared Difference Test
## 
##                                Df    AIC    BIC  Chisq Chisq diff    RMSEA
## Hypothesized_Model_results     60 7724.8 7833.6 210.02                    
## MoreParsimonious_Model_results 62 7727.3 7829.1 216.51     6.4934 0.095373
##                                Df diff Pr(>Chisq)  
## Hypothesized_Model_results                         
## MoreParsimonious_Model_results       2     0.0389 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
print(Model_HYPvsLessPars)
## 
## Chi-Squared Difference Test
## 
##                                Df    AIC    BIC  Chisq Chisq diff  RMSEA
## LessParsimonious_Model_results 59 7714.8 7827.1 198.01                  
## Hypothesized_Model_results     60 7724.8 7833.6 210.02     12.007 0.2111
##                                Df diff Pr(>Chisq)    
## LessParsimonious_Model_results                       
## Hypothesized_Model_results           1  0.0005299 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Q8: Based on Anderson and Gerbing’s (1988) recommendations, I decided to retain the less parsimonious (i.e., more complex) model as the best-supported model. My decision was based on findings indicating that there was a significant difference between the hypothesized model and the less parsimonious model (∆χ2 = 12, ∆df = 1, p < .01), indicating that the less parsimonious fit the data best

Conduct a confirmatory factor analysis to ensure measurement invariance across two gender groups. You wish to see if the items correspond to their respective latent constructs (i.e., job satisfaction and job motivation). Provide a write-up of results as demonstrated in the course slides.

gender = male and female jobsat1 – jobsat5 = five items on a job satisfaction scale. Scores can range from 1 to 7. (Higher scores mean more job sat) jobmot1 – jobmot5 = five items on a job motivation scale. Scores can range from 1 to 7. (Higher scores mean more job mot)

# Specify Model: Two-Factor
twofactors <- 'f1  =~ jobsat1 + jobsat2 + jobsat3 + jobsat4 + jobsat5
               f2  =~ jobmot1 + jobmot2 + jobmot3 + jobmot4 + jobmot5

'

# Run CFA: Configural Invariance
fit.Configural <- cfa(twofactors, data = Exercise_2c, group = "gender", meanstructure = TRUE)

# Run CFA: Metric (Weak) Invariance
fit.Metric <- cfa(twofactors, data = Exercise_2c, group = "gender", 
  group.equal = c("loadings"), 
  meanstructure = TRUE) 

anova(fit.Configural,fit.Metric)
## 
## Chi-Squared Difference Test
## 
##                Df    AIC    BIC  Chisq Chisq diff    RMSEA Df diff Pr(>Chisq)
## fit.Configural 68 100489 100877 1942.2                                       
## fit.Metric     76 100484 100821 1952.7     10.526 0.012873       8       0.23
# Run CFA: Scalar (Strong) Invariance
fit.Scalar <- cfa(twofactors, data = Exercise_2c, group = "gender", 
  group.equal = c("loadings","intercepts"), 
  meanstructure = TRUE) 

anova(fit.Configural,fit.Scalar)
## 
## Chi-Squared Difference Test
## 
##                Df    AIC    BIC  Chisq Chisq diff    RMSEA Df diff Pr(>Chisq)
## fit.Configural 68 100489 100877 1942.2                                       
## fit.Scalar     84 100536 100823 2020.8     78.642 0.045328      16  2.921e-10
##                   
## fit.Configural    
## fit.Scalar     ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Run CFA: Residual (Strict) Invariance
fit.Residual <- cfa(twofactors, data = Exercise_2c, group = "gender", 
  group.equal = c("loadings","intercepts","residuals"), 
  meanstructure = TRUE) 

# Model Comparisons
lavTestLRT(fit.Configural, fit.Metric, fit.Scalar, fit.Residual)
## 
## Chi-Squared Difference Test
## 
##                Df    AIC    BIC  Chisq Chisq diff    RMSEA Df diff Pr(>Chisq)
## fit.Configural 68 100489 100877 1942.2                                       
## fit.Metric     76 100484 100821 1952.7     10.526 0.012873       8    0.23003
## fit.Scalar     84 100536 100823 2020.8     68.116 0.062798       8  1.165e-11
## fit.Residual   94 100538 100763 2042.4     21.627 0.024702      10    0.01712
##                   
## fit.Configural    
## fit.Metric        
## fit.Scalar     ***
## fit.Residual   *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Measurement Invariance: To examine whether measures of job satisfaction and job motivation were equivalent across gender, we conducted multi-group confirmatory factor analyses in R, on the five items measuring Job Satisfaction and the five items measuring Job Motivation. Results indicated that a measurement model in which factor loadings were freely estimated in each sample did not fit the data better than the model in which factor loadings were set to be equal for females and males, Δχ²(8) = 10.53, p = .23. These results support the measurement equivalence (metric invariance) of the job satisfaction and job motivation measures across both gender groups.