library(haven)
library(tidyverse)
library(psych)
library(lavaan)
library(semTools)
options(scipen=999)
options(digits=3)
Mydata <- read_sav("/Users/niurongting/Desktop/JPPR/Crisis Emotion - Main Study-Final.sav")
Mydata_r <- select(Mydata, c(NWOM_1:NWOM_3, Boycott_intention_1:Boycott_intention_4))
describe(Mydata_r)
## vars n mean sd median trimmed mad min max range skew
## NWOM_1 1 482 4.07 1.87 4 4.10 1.48 1 7 6 -0.21
## NWOM_2 2 482 4.21 1.91 4 4.27 2.97 1 7 6 -0.33
## NWOM_3 3 482 4.08 1.86 4 4.11 1.48 1 7 6 -0.25
## Boycott_intention_1 4 482 5.20 1.67 6 5.43 1.48 1 7 6 -0.90
## Boycott_intention_2 5 482 4.54 2.00 5 4.67 1.48 1 7 6 -0.46
## Boycott_intention_3 6 482 4.76 1.89 5 4.94 1.48 1 7 6 -0.62
## Boycott_intention_4 7 482 4.99 1.82 5 5.21 1.48 1 7 6 -0.80
## kurtosis se
## NWOM_1 -1.07 0.09
## NWOM_2 -0.99 0.09
## NWOM_3 -1.02 0.08
## Boycott_intention_1 0.13 0.08
## Boycott_intention_2 -1.01 0.09
## Boycott_intention_3 -0.67 0.09
## Boycott_intention_4 -0.34 0.08
Mydata_NWOM <- select(Mydata, c(NWOM_1:NWOM_3))
multi.hist(Mydata_NWOM)
Mydata_Boycott <- select(Mydata, c(Boycott_intention_1:Boycott_intention_4))
multi.hist(Mydata_Boycott)
pairs.panels(Mydata_r,
method = "pearson",
density = TRUE,
gap = 0)
### CFA 2 Factor
CFA <- 'NWOM =~ NWOM_1 + NWOM_2 + NWOM_3
Boycott =~ Boycott_intention_1 + Boycott_intention_2 + Boycott_intention_3 + Boycott_intention_4'
cfa_fit <- cfa(data = Mydata, model = CFA, std.lv = TRUE, estimator = "MLR")
summary(cfa_fit, std = TRUE, fit.measures = TRUE, rsquare = TRUE)
## lavaan 0.6-19 ended normally after 27 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 15
##
## Number of observations 482
##
## Model Test User Model:
## Standard Scaled
## Test Statistic 45.959 28.125
## Degrees of freedom 13 13
## P-value (Chi-square) 0.000 0.009
## Scaling correction factor 1.634
## Yuan-Bentler correction (Mplus variant)
##
## Model Test Baseline Model:
##
## Test statistic 3584.154 1697.864
## Degrees of freedom 21 21
## P-value 0.000 0.000
## Scaling correction factor 2.111
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.991 0.991
## Tucker-Lewis Index (TLI) 0.985 0.985
##
## Robust Comparative Fit Index (CFI) 0.993
## Robust Tucker-Lewis Index (TLI) 0.989
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -5102.776 -5102.776
## Scaling correction factor 1.842
## for the MLR correction
## Loglikelihood unrestricted model (H1) NA NA
## Scaling correction factor 1.746
## for the MLR correction
##
## Akaike (AIC) 10235.552 10235.552
## Bayesian (BIC) 10298.221 10298.221
## Sample-size adjusted Bayesian (SABIC) 10250.612 10250.612
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.073 0.049
## 90 Percent confidence interval - lower 0.050 0.030
## 90 Percent confidence interval - upper 0.096 0.069
## P-value H_0: RMSEA <= 0.050 0.047 0.499
## P-value H_0: RMSEA >= 0.080 0.319 0.004
##
## Robust RMSEA 0.063
## 90 Percent confidence interval - lower 0.030
## 90 Percent confidence interval - upper 0.095
## P-value H_0: Robust RMSEA <= 0.050 0.227
## P-value H_0: Robust RMSEA >= 0.080 0.205
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.022 0.022
##
## Parameter Estimates:
##
## Standard errors Sandwich
## Information bread Observed
## Observed information based on Hessian
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## NWOM =~
## NWOM_1 1.707 0.048 35.205 0.000 1.707 0.915
## NWOM_2 1.706 0.054 31.549 0.000 1.706 0.894
## NWOM_3 1.754 0.048 36.170 0.000 1.754 0.945
## Boycott =~
## Boyctt_ntntn_1 1.418 0.068 20.771 0.000 1.418 0.851
## Boyctt_ntntn_2 1.698 0.060 28.226 0.000 1.698 0.850
## Boyctt_ntntn_3 1.722 0.058 29.775 0.000 1.722 0.914
## Boyctt_ntntn_4 1.732 0.058 29.679 0.000 1.732 0.952
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## NWOM ~~
## Boycott 0.814 0.022 36.917 0.000 0.814 0.814
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .NWOM_1 0.569 0.077 7.420 0.000 0.569 0.163
## .NWOM_2 0.733 0.089 8.197 0.000 0.733 0.201
## .NWOM_3 0.365 0.068 5.390 0.000 0.365 0.106
## .Boyctt_ntntn_1 0.768 0.085 9.018 0.000 0.768 0.276
## .Boyctt_ntntn_2 1.109 0.135 8.234 0.000 1.109 0.278
## .Boyctt_ntntn_3 0.587 0.130 4.506 0.000 0.587 0.165
## .Boyctt_ntntn_4 0.312 0.052 6.000 0.000 0.312 0.094
## NWOM 1.000 1.000 1.000
## Boycott 1.000 1.000 1.000
##
## R-Square:
## Estimate
## NWOM_1 0.837
## NWOM_2 0.799
## NWOM_3 0.894
## Boyctt_ntntn_1 0.724
## Boyctt_ntntn_2 0.722
## Boyctt_ntntn_3 0.835
## Boyctt_ntntn_4 0.906
# lavInspect(cfa_fit)
We can use CICFA to examine discriminant validity of the two constructs. We specify the standardized solution.
standardizedsolution(cfa_fit)
## lhs op rhs est.std se z pvalue
## 1 NWOM =~ NWOM_1 0.915 0.012 74.28 0
## 2 NWOM =~ NWOM_2 0.894 0.014 62.25 0
## 3 NWOM =~ NWOM_3 0.945 0.011 88.15 0
## 4 Boycott =~ Boycott_intention_1 0.851 0.020 43.03 0
## 5 Boycott =~ Boycott_intention_2 0.850 0.020 42.88 0
## 6 Boycott =~ Boycott_intention_3 0.914 0.019 47.06 0
## 7 Boycott =~ Boycott_intention_4 0.952 0.009 108.81 0
## 8 NWOM_1 ~~ NWOM_1 0.163 0.023 7.25 0
## 9 NWOM_2 ~~ NWOM_2 0.201 0.026 7.83 0
## 10 NWOM_3 ~~ NWOM_3 0.106 0.020 5.23 0
## 11 Boycott_intention_1 ~~ Boycott_intention_1 0.276 0.034 8.21 0
## 12 Boycott_intention_2 ~~ Boycott_intention_2 0.278 0.034 8.25 0
## 13 Boycott_intention_3 ~~ Boycott_intention_3 0.165 0.035 4.66 0
## 14 Boycott_intention_4 ~~ Boycott_intention_4 0.094 0.017 5.65 0
## 15 NWOM ~~ NWOM 1.000 0.000 NA NA
## 16 Boycott ~~ Boycott 1.000 0.000 NA NA
## 17 NWOM ~~ Boycott 0.814 0.022 36.92 0
## ci.lower ci.upper
## 1 0.891 0.939
## 2 0.866 0.922
## 3 0.924 0.966
## 4 0.812 0.889
## 5 0.811 0.889
## 6 0.876 0.952
## 7 0.935 0.969
## 8 0.119 0.208
## 9 0.151 0.251
## 10 0.066 0.146
## 11 0.210 0.342
## 12 0.212 0.344
## 13 0.096 0.235
## 14 0.061 0.127
## 15 1.000 1.000
## 16 1.000 1.000
## 17 0.771 0.857
semTools::discriminantValidity(cfa_fit, cutoff = 0.9, merge = FALSE, level = 0.95)
## lhs op rhs est ci.lower ci.upper Df AIC BIC Chisq Chisq diff
## 1 NWOM ~~ Boycott 0.814 0.771 0.857 14 10270 10328 82.1 11.9
## Df diff Pr(>Chisq)
## 1 1 0.000557
CFA_ULVT <- '
NWOM =~ NWOM_1 + NWOM_2 + NWOM_3
Boycott =~ Boycott_intention_1 + Boycott_intention_2 + Boycott_intention_3 + Boycott_intention_4
method =~ NWOM_1 + NWOM_2 + NWOM_3 +
Boycott_intention_1 + Boycott_intention_2 + Boycott_intention_3 + Boycott_intention_4
method ~~ 0*NWOM
method ~~ 0*Boycott'
CFA_ULVT_fit <- cfa(data = Mydata,CFA_ULVT,std.lv=T,estimator="MLR")
summary(CFA_ULVT_fit,std=T,fit.measures=T,rsquare=T)
## lavaan 0.6-19 ended normally after 74 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 22
##
## Number of observations 482
##
## Model Test User Model:
## Standard Scaled
## Test Statistic 3.980 2.997
## Degrees of freedom 6 6
## P-value (Chi-square) 0.679 0.809
## Scaling correction factor 1.328
## Yuan-Bentler correction (Mplus variant)
##
## Model Test Baseline Model:
##
## Test statistic 3584.154 1697.864
## Degrees of freedom 21 21
## P-value 0.000 0.000
## Scaling correction factor 2.111
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 1.000 1.000
## Tucker-Lewis Index (TLI) 1.002 1.006
##
## Robust Comparative Fit Index (CFI) 1.000
## Robust Tucker-Lewis Index (TLI) 1.004
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -5081.786 -5081.786
## Scaling correction factor 1.860
## for the MLR correction
## Loglikelihood unrestricted model (H1) NA NA
## Scaling correction factor 1.746
## for the MLR correction
##
## Akaike (AIC) 10207.572 10207.572
## Bayesian (BIC) 10299.487 10299.487
## Sample-size adjusted Bayesian (SABIC) 10229.661 10229.661
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000 0.000
## 90 Percent confidence interval - lower 0.000 0.000
## 90 Percent confidence interval - upper 0.046 0.029
## P-value H_0: RMSEA <= 0.050 0.964 0.994
## P-value H_0: RMSEA >= 0.080 0.001 0.000
##
## Robust RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.043
## P-value H_0: Robust RMSEA <= 0.050 0.970
## P-value H_0: Robust RMSEA >= 0.080 0.001
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.004 0.004
##
## Parameter Estimates:
##
## Standard errors Sandwich
## Information bread Observed
## Observed information based on Hessian
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## NWOM =~
## NWOM_1 1.111 0.185 6.013 0.000 1.111 0.595
## NWOM_2 0.974 0.179 5.449 0.000 0.974 0.510
## NWOM_3 1.176 0.151 7.782 0.000 1.176 0.634
## Boycott =~
## Boyctt_ntntn_1 -0.358 0.378 -0.947 0.344 -0.358 -0.215
## Boyctt_ntntn_2 -1.233 0.649 -1.901 0.057 -1.233 -0.617
## Boyctt_ntntn_3 -0.229 0.438 -0.524 0.601 -0.229 -0.122
## Boyctt_ntntn_4 -0.224 0.431 -0.519 0.604 -0.224 -0.123
## method =~
## NWOM_1 1.294 0.153 8.465 0.000 1.294 0.693
## NWOM_2 1.391 0.130 10.721 0.000 1.391 0.729
## NWOM_3 1.322 0.150 8.805 0.000 1.322 0.713
## Boyctt_ntntn_1 1.365 0.114 11.971 0.000 1.365 0.819
## Boyctt_ntntn_2 1.511 0.308 4.906 0.000 1.511 0.756
## Boyctt_ntntn_3 1.708 0.089 19.276 0.000 1.708 0.906
## Boyctt_ntntn_4 1.738 0.084 20.713 0.000 1.738 0.955
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## NWOM ~~
## method 0.000 0.000 0.000
## Boycott ~~
## method 0.000 0.000 0.000
## NWOM ~~
## Boycott -0.416 0.324 -1.285 0.199 -0.416 -0.416
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .NWOM_1 0.575 0.092 6.221 0.000 0.575 0.165
## .NWOM_2 0.761 0.085 8.959 0.000 0.761 0.209
## .NWOM_3 0.312 0.095 3.296 0.001 0.312 0.091
## .Boyctt_ntntn_1 0.788 0.086 9.142 0.000 0.788 0.284
## .Boyctt_ntntn_2 0.189 1.256 0.150 0.881 0.189 0.047
## .Boyctt_ntntn_3 0.584 0.138 4.227 0.000 0.584 0.164
## .Boyctt_ntntn_4 0.243 0.105 2.314 0.021 0.243 0.073
## NWOM 1.000 1.000 1.000
## Boycott 1.000 1.000 1.000
## method 1.000 1.000 1.000
##
## R-Square:
## Estimate
## NWOM_1 0.835
## NWOM_2 0.791
## NWOM_3 0.909
## Boyctt_ntntn_1 0.716
## Boyctt_ntntn_2 0.953
## Boyctt_ntntn_3 0.836
## Boyctt_ntntn_4 0.927
compfit_MV <- semTools::compareFit(CFA_ULVT_fit,cfa_fit,nested=T)
summary(compfit_MV)
## ################### Nested Model Comparison #########################
##
## Scaled Chi-Squared Difference Test (method = "satorra.bentler.2001")
##
## lavaan->unknown():
## lavaan NOTE: The "Chisq" column contains standard test statistics, not the
## robust test that should be reported per model. A robust difference test is
## a function of two standard (not robust) statistics.
## Df AIC BIC Chisq Chisq diff Df diff Pr(>Chisq)
## CFA_ULVT_fit 6 10208 10299 3.98
## cfa_fit 13 10236 10298 45.96 22.1 7 0.0024 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## ####################### Model Fit Indices ###########################
## chisq.scaled df.scaled pvalue.scaled rmsea.robust cfi.robust
## CFA_ULVT_fit 2.997† 6 .809 .000† 1.000†
## cfa_fit 28.125 13 .009 .063 .993
## tli.robust srmr aic bic
## CFA_ULVT_fit 1.004† .004† 10207.572† 10299.487
## cfa_fit .989 .022 10235.552 10298.221†
##
## ################## Differences in Fit Indices #######################
## df.scaled rmsea.robust cfi.robust tli.robust srmr aic
## cfa_fit - CFA_ULVT_fit 7 0.063 -0.007 -0.015 0.018 28
## bic
## cfa_fit - CFA_ULVT_fit -1.27