Skip to contents

Replace (some of) the first‑order latent variables in a lavaan measurement model by single composite indicators whose error variances are fixed from Cronbach's \(\alpha\). The function returns a modified lavaan model syntax together with an augmented data set that contains the newly created composite variables, so that you can fit the full SEM in a single step.

Usage

relcorr_single_item(
  syntax,
  data,
  choose = NULL,
  scale.corrected = TRUE,
  warn.lav = TRUE
)

Arguments

syntax

A character string containing lavaan model syntax. Must at least include the measurement relations (=~).

data

A data.frame, tibble or object coercible to a data frame that holds the raw observed indicators.

choose

Optional. Character vector with the names of the latent variables you wish to replace by single indicators. Defaults to all first‑order latent variables in syntax.

scale.corrected

Should reliability-corrected items be scale-corrected? If TRUE reliability-corrected single items are corrected for differences in factor loadings between the items. Default is TRUE.

warn.lav

Should warnings from lavaan::cfa be displayed? If FALSE, they are suppressed.

Value

An object of S3 class modsem_relcorr (a named list) with elements:

syntax

Modified lavaan syntax string.

data

Data frame with additional composite indicator columns.

parTable

Parameter table corresponding to `syntax`.

reliability

Named numeric vector of reliabilities (one per latent variable).

AVE

Named numeric vector with Average Variance Extracted values.

lVs

Character vector of latent variables that were corrected.

single.items

Character vector with names for the generated reliability corrected items

Details

The resulting object can be fed directly into modsem or lavaan::sem by supplying syntax = $syntax and data = $data.

Examples

# \dontrun{
tpb_uk <- "
# Outer Model (Based on Hagger et al., 2007)
 ATT =~ att3 + att2 + att1 + att4
 SN =~ sn4 + sn2 + sn3 + sn1
 PBC =~ pbc2 + pbc1 + pbc3 + pbc4
 INT =~ int2 + int1 + int3 + int4
 BEH =~ beh3 + beh2 + beh1 + beh4

# Inner Model (Based on Steinmetz et al., 2011)
 INT ~ ATT + SN + PBC
 BEH ~ INT + PBC
 BEH ~ INT:PBC
"

corrected <- relcorr_single_item(syntax = tpb_uk, data = TPB_UK)
print(corrected)
#> Average Variance Extracted:
#>   ATT:    0.773
#>   SN:     0.759
#>   PBC:    0.765
#>   INT:    0.790
#>   BEH:    0.769
#> 
#> Chronbach's Alpha:
#>   ATT:    0.941
#>   SN:     0.917
#>   PBC:    0.931
#>   INT:    0.984
#>   BEH:    0.942
#> 
#> Generated Syntax:
#>   INT ~ ATT
#>   INT ~ SN
#>   INT ~ PBC
#>   BEH ~ INT
#>   BEH ~ PBC
#>   BEH ~ INT:PBC
#>   ATT =~ 1*composite_ATT_
#>   SN =~ 1*composite_SN_
#>   PBC =~ 1*composite_PBC_
#>   INT =~ 1*composite_INT_
#>   BEH =~ 1*composite_BEH_
#>   composite_ATT_ ~~ 0.261238305705924*composite_ATT_
#>   composite_SN_ ~~ 0.168932578899161*composite_SN_
#>   composite_PBC_ ~~ 0.339024670490075*composite_PBC_
#>   composite_INT_ ~~ 0.0800211390420975*composite_INT_
#>   composite_BEH_ ~~ 0.36503257276914*composite_BEH_
#>   
#> Generated Items:
#>   'data.frame':	1169 obs. of  5 variables:
#>     $ composite_ATT_: num  6.03 5.49 2.19 6.03 4.94 ...
#>     $ composite_SN_ : num  5.57 4.07 3 5.57 4.5 ...
#>     $ composite_PBC_: num  4.44 5 1.94 6.39 6.11 ...
#>     $ composite_INT_: num  4.06 4.56 1.01 5.32 5.32 ...
#>     $ composite_BEH_: num  1.11 4.17 1.39 3.06 5.84 ...

syntax <- corrected$syntax
data   <- corrected$data

est_dca <- modsem(syntax, data = data, method = "dblcent")
est_lms <- modsem(syntax, data = data, method="lms", nodes=32)
summary(est_lms)
#> 
#> modsem (version 1.0.12):
#> 
#>   Estimator                                         LMS
#>   Optimization method                        EMA-NLMINB
#>   Number of observations                           1169
#>   Number of iterations                              103
#>   Loglikelihood                                -9397.25
#>   Akaike (AIC)                                  18832.5
#>   Bayesian (BIC)                               18928.72
#>  
#> Numerical Integration:
#>   Points of integration (per dim)                    32
#>   Dimensions                                          1
#>   Total points of integration                        32
#>  
#> Fit Measures for Baseline Model (H0):
#>   Loglikelihood                                -9543.07
#>   Akaike (AIC)                                 19122.14
#>   Bayesian (BIC)                               19213.29
#>   Chi-square                                      34.39
#>   Degrees of Freedom (Chi-square)                     2
#>   P-value (Chi-square)                            0.000
#>   RMSEA                                           0.118
#>  
#> Comparative Fit to H0 (LRT test):
#>   Loglikelihood change                           145.82
#>   Difference test (D)                            291.63
#>   Degrees of freedom (D)                              1
#>   P-value (D)                                     0.000
#>  
#> R-Squared Interaction Model (H1):
#>   INT                                             0.857
#>   BEH                                             0.937
#> R-Squared Baseline Model (H0):
#>   INT                                             0.858
#>   BEH                                             0.873
#> R-Squared Change (H1 - H0):
#>   INT                                            -0.001
#>   BEH                                             0.064
#> 
#> Parameter Estimates:
#>   Coefficients                           unstandardized
#>   Information                                  observed
#>   Standard errors                              standard
#>  
#> Latent Variables:
#>                  Estimate  Std.Error  z.value  P(>|z|)
#>   ATT =~        
#>     cmpst_ATT_      1.000                             
#>   SN =~         
#>     compst_SN_      1.000                             
#>   PBC =~        
#>     cmpst_PBC_      1.000                             
#>   INT =~        
#>     cmpst_INT_      1.000                             
#>   BEH =~        
#>     cmpst_BEH_      1.000                             
#> 
#> Regressions:
#>                  Estimate  Std.Error  z.value  P(>|z|)
#>   INT ~         
#>     ATT            -0.022      0.042   -0.528    0.597
#>     SN              0.015      0.037    0.390    0.697
#>     PBC             0.991      0.046   21.712    0.000
#>   BEH ~         
#>     PBC             0.726      0.045   16.005    0.000
#>     INT             0.307      0.042    7.262    0.000
#>     INT:PBC         0.148      0.008   18.024    0.000
#> 
#> Intercepts:
#>                  Estimate  Std.Error  z.value  P(>|z|)
#>    .cmpst_PBC_      4.323      0.064   67.722    0.000
#>    .cmpst_ATT_      4.246      0.063   66.982    0.000
#>    .compst_SN_      3.797      0.041   93.173    0.000
#>    .cmpst_INT_      3.835      0.066   58.497    0.000
#>    .cmpst_BEH_      2.891      0.077   37.603    0.000
#> 
#> Covariances:
#>                  Estimate  Std.Error  z.value  P(>|z|)
#>   ATT ~~        
#>     SN              1.907      0.104   18.262    0.000
#>   PBC ~~        
#>     ATT             3.964      0.180   21.998    0.000
#>     SN              2.028      0.107   19.004    0.000
#> 
#> Variances:
#>                  Estimate  Std.Error  z.value  P(>|z|)
#>    .cmpst_PBC_      0.339                             
#>    .cmpst_ATT_      0.261                             
#>    .compst_SN_      0.169                             
#>    .cmpst_INT_      0.080                             
#>    .cmpst_BEH_      0.365                             
#>     ATT             4.438      0.194   22.837    0.000
#>     SN              1.773      0.080   22.071    0.000
#>     PBC             4.427      0.197   22.473    0.000
#>    .INT             0.709      0.046   15.353    0.000
#>    .BEH             0.376      0.039    9.694    0.000
#> 
# }