```{r, echo=F, include=F}
# defaults
set.seed(170819)
options(digits=3, width=120, max.print=100000)
knitr::opts_chunk$set(echo=T, error=F, message=F, tidy=T, warning=F, cache=T)
```
```{r Packages, cache=F, results='hide'}
# relevant packages
devtools::install_github("tdienlin/td@v0.0.2.6")
required <- c("GGally", "ggplot2", "lavaan", "lme4", "magrittr",
"MissMech", # attention: pkg is obsolete, needs to be installed manually
"papaja", "psych", "pwr", "MVN", "semTools",
"sjstats", "tidyverse", "td")
# load required libraries
lapply(required, function(x) library(x, character.only = T))
load("data/workspace.RData")
```
In what follows, we report the results of additional analyses that were also calculated. For example, for each measure we also report exploratory factor analyses, first order model solutions, and unconstrained solutions to estimate longitudinal invariance.
# Measures
## Concerns about online privacy
### EFA
```{r}
# set-up
no <- 0
name <- "pri_con"
d_tmp <- select(d_wide, contains(paste0("t1_", name)), -contains("_m"), -contains("_fs"))
model <- fa.parallel(d_tmp, fa = "fa", fm = "ml")
factan <- fa(d_tmp, fm = "ml", nfactors = model$nfact, rotate = "promax")
print(factan, sort = TRUE, cut = .3)
```
### CFA
#### First-Order Model Unconstrained
```{r}
model <- '
# create factors
t1_pri_con_f =~ 1*t1_pri_con_01 + t1_pri_con_02 + t1_pri_con_03 + t1_pri_con_04 + t1_pri_con_05 + t1_pri_con_06 + t1_pri_con_07 + t1_pri_con_08 + t1_pri_con_09
t2_pri_con_f =~ 1*t2_pri_con_01 + t2_pri_con_02 + t2_pri_con_03 + t2_pri_con_04 + t2_pri_con_05 + t2_pri_con_06 + t2_pri_con_07 + t2_pri_con_08 + t2_pri_con_09
t3_pri_con_f =~ 1*t3_pri_con_01 + t3_pri_con_02 + t3_pri_con_03 + t3_pri_con_04 + t3_pri_con_05 + t3_pri_con_06 + t3_pri_con_07 + t3_pri_con_08 + t3_pri_con_09
# error covariances
t3_pri_con_01 ~~ t2_pri_con_01 + t1_pri_con_01
t3_pri_con_02 ~~ t2_pri_con_02 + t1_pri_con_02
t3_pri_con_03 ~~ t2_pri_con_03 + t1_pri_con_03
t3_pri_con_04 ~~ t2_pri_con_04 + t1_pri_con_04
t3_pri_con_05 ~~ t2_pri_con_05 + t1_pri_con_05
t3_pri_con_06 ~~ t2_pri_con_06 + t1_pri_con_06
t3_pri_con_07 ~~ t2_pri_con_07 + t1_pri_con_07
t3_pri_con_08 ~~ t2_pri_con_08 + t1_pri_con_08
t3_pri_con_09 ~~ t2_pri_con_09 + t1_pri_con_09
t2_pri_con_01 ~~ t1_pri_con_01
t2_pri_con_02 ~~ t1_pri_con_02
t2_pri_con_03 ~~ t1_pri_con_03
t2_pri_con_04 ~~ t1_pri_con_04
t2_pri_con_05 ~~ t1_pri_con_05
t2_pri_con_06 ~~ t1_pri_con_06
t2_pri_con_07 ~~ t1_pri_con_07
t2_pri_con_08 ~~ t1_pri_con_08
t2_pri_con_09 ~~ t1_pri_con_09
# factor covariances
t1_pri_con_f ~~ t2_pri_con_f + t3_pri_con_f
t2_pri_con_f ~~ t3_pri_con_f
'
no <- no + 1
assign(paste("fit", name, no, sep = "_"), cfa(model, d_wide, missing = "ML"))
summary(get(paste("fit", name, no, sep = "_")), standardized = TRUE, fit.measures = TRUE)
reliability(get(paste("fit", name, no, sep = "_")))
```
#### First-Order Model Constrained
```{r}
model <- '
# create factors
t1_pri_con_f =~ 1*t1_pri_con_01 + b2*t1_pri_con_02 + b3*t1_pri_con_03 + b4*t1_pri_con_04 + b5*t1_pri_con_05 + b6*t1_pri_con_06 + b7*t1_pri_con_07 + b8*t1_pri_con_08 + b9*t1_pri_con_09
t2_pri_con_f =~ 1*t2_pri_con_01 + b2*t2_pri_con_02 + b3*t2_pri_con_03 + b4*t2_pri_con_04 + b5*t2_pri_con_05 + b6*t2_pri_con_06 + b7*t2_pri_con_07 + b8*t2_pri_con_08 + b9*t2_pri_con_09
t3_pri_con_f =~ 1*t3_pri_con_01 + b2*t3_pri_con_02 + b3*t3_pri_con_03 + b4*t3_pri_con_04 + b5*t3_pri_con_05 + b6*t3_pri_con_06 + b7*t3_pri_con_07 + b8*t3_pri_con_08 + b9*t3_pri_con_09
# error covariances
t3_pri_con_01 ~~ t2_pri_con_01 + t1_pri_con_01
t3_pri_con_02 ~~ t2_pri_con_02 + t1_pri_con_02
t3_pri_con_03 ~~ t2_pri_con_03 + t1_pri_con_03
t3_pri_con_04 ~~ t2_pri_con_04 + t1_pri_con_04
t3_pri_con_05 ~~ t2_pri_con_05 + t1_pri_con_05
t3_pri_con_06 ~~ t2_pri_con_06 + t1_pri_con_06
t3_pri_con_07 ~~ t2_pri_con_07 + t1_pri_con_07
t3_pri_con_08 ~~ t2_pri_con_08 + t1_pri_con_08
t3_pri_con_09 ~~ t2_pri_con_09 + t1_pri_con_09
t2_pri_con_01 ~~ t1_pri_con_01
t2_pri_con_02 ~~ t1_pri_con_02
t2_pri_con_03 ~~ t1_pri_con_03
t2_pri_con_04 ~~ t1_pri_con_04
t2_pri_con_05 ~~ t1_pri_con_05
t2_pri_con_06 ~~ t1_pri_con_06
t2_pri_con_07 ~~ t1_pri_con_07
t2_pri_con_08 ~~ t1_pri_con_08
t2_pri_con_09 ~~ t1_pri_con_09
# factor covariances
t1_pri_con_f ~~ t2_pri_con_f + t3_pri_con_f
t2_pri_con_f ~~ t3_pri_con_f
'
no <- no + 1
assign(paste("fit", name, no, sep = "_"), cfa(model, d_wide, missing = "ML"))
summary(get(paste("fit", name, no, sep = "_")), standardized = TRUE, fit.measures = TRUE)
```
#### Second-Order Model Unconstrained
In what follows, we analyze a second-order solution of privacy concerns. Here, we distinguish between horizontal privacy concerns (items 4, 5, 6) and vertical privacy concerns (items 7, 8, 9). The resulting model fits the data better than the unidimensional one.
```{r}
model <- '
# create factors
t1_pri_con_f =~ 1*t1_pri_con_f1 + t1_pri_con_f2
t2_pri_con_f =~ 1*t2_pri_con_f1 + t2_pri_con_f2
t3_pri_con_f =~ 1*t3_pri_con_f1 + t3_pri_con_f2
t1_pri_con_f1 =~ 1*t1_pri_con_04 + t1_pri_con_05 + t1_pri_con_06
t1_pri_con_f2 =~ 1*t1_pri_con_07 + t1_pri_con_08 + t1_pri_con_09
t2_pri_con_f1 =~ 1*t2_pri_con_04 + t2_pri_con_05 + t2_pri_con_06
t2_pri_con_f2 =~ 1*t2_pri_con_07 + t2_pri_con_08 + t2_pri_con_09
t3_pri_con_f1 =~ 1*t3_pri_con_04 + t3_pri_con_05 + t3_pri_con_06
t3_pri_con_f2 =~ 1*t3_pri_con_07 + t3_pri_con_08 + t3_pri_con_09
# error covariances
t3_pri_con_04 ~~ t2_pri_con_04 + t1_pri_con_04
t3_pri_con_05 ~~ t2_pri_con_05 + t1_pri_con_05
t3_pri_con_06 ~~ t2_pri_con_06 + t1_pri_con_06
t3_pri_con_07 ~~ t2_pri_con_07 + t1_pri_con_07
t3_pri_con_08 ~~ t2_pri_con_08 + t1_pri_con_08
t3_pri_con_09 ~~ t2_pri_con_09 + t1_pri_con_09
t2_pri_con_04 ~~ t1_pri_con_04
t2_pri_con_05 ~~ t1_pri_con_05
t2_pri_con_06 ~~ t1_pri_con_06
t2_pri_con_07 ~~ t1_pri_con_07
t2_pri_con_08 ~~ t1_pri_con_08
t2_pri_con_09 ~~ t1_pri_con_09
# factor covariances
t1_pri_con_f ~~ t2_pri_con_f + t3_pri_con_f
t2_pri_con_f ~~ t3_pri_con_f
'
no <- no + 1
assign(paste("fit", name, no, sep = "_"), cfa(model, d_wide, missing = "ML"))
summary(get(paste("fit", name, no, sep = "_")), standardized = TRUE, fit.measures = TRUE)
```
#### Second-Order Model Constrained
```{r}
model <- '
# create factors
t1_pri_con_f =~ 1*t1_pri_con_f1 + a2*t1_pri_con_f2
t2_pri_con_f =~ 1*t2_pri_con_f1 + a2*t2_pri_con_f2
t3_pri_con_f =~ 1*t3_pri_con_f1 + a2*t3_pri_con_f2
t1_pri_con_f1 =~ 1*t1_pri_con_04 + b2*t1_pri_con_05 + b3*t1_pri_con_06
t1_pri_con_f2 =~ 1*t1_pri_con_07 + c2*t1_pri_con_08 + c3*t1_pri_con_09
t2_pri_con_f1 =~ 1*t2_pri_con_04 + b2*t2_pri_con_05 + b3*t2_pri_con_06
t2_pri_con_f2 =~ 1*t2_pri_con_07 + c2*t2_pri_con_08 + c3*t2_pri_con_09
t3_pri_con_f1 =~ 1*t3_pri_con_04 + b2*t3_pri_con_05 + b3*t3_pri_con_06
t3_pri_con_f2 =~ 1*t3_pri_con_07 + c2*t3_pri_con_08 + c3*t3_pri_con_09
# error covariances
t3_pri_con_04 ~~ t2_pri_con_04 + t1_pri_con_04
t3_pri_con_05 ~~ t2_pri_con_05 + t1_pri_con_05
t3_pri_con_06 ~~ t2_pri_con_06 + t1_pri_con_06
t3_pri_con_07 ~~ t2_pri_con_07 + t1_pri_con_07
t3_pri_con_08 ~~ t2_pri_con_08 + t1_pri_con_08
t3_pri_con_09 ~~ t2_pri_con_09 + t1_pri_con_09
t2_pri_con_04 ~~ t1_pri_con_04
t2_pri_con_05 ~~ t1_pri_con_05
t2_pri_con_06 ~~ t1_pri_con_06
t2_pri_con_07 ~~ t1_pri_con_07
t2_pri_con_08 ~~ t1_pri_con_08
t2_pri_con_09 ~~ t1_pri_con_09
# factor covariances
t1_pri_con_f ~~ t2_pri_con_f + t3_pri_con_f
t2_pri_con_f ~~ t3_pri_con_f
'
no <- no + 1
assign(paste("fit", name, no, sep = "_"), cfa(model, d_wide, missing = "ML"))
summary(get(paste("fit", name, no, sep = "_")), standardized = TRUE, fit.measures = TRUE)
```
### Reliability
```{r}
reliabilityL2(get(paste("fit", name, no, sep = "_")), paste("t1", name, "f", sep = "_"))
reliabilityL2(get(paste("fit", name, no, sep = "_")), paste("t2", name, "f", sep = "_"))
reliabilityL2(get(paste("fit", name, no, sep = "_")), paste("t3", name, "f", sep = "_"))
```
### Longitudinal Invariance
```{r}
(anova(get(paste("fit", name, no - 1, sep = "_")), get(paste("fit", name, no, sep = "_"))))
```
## Attitude Toward Online Sharing of Personal Information
### EFA
```{r}
no <- 0
name <- "inf_sha_att"
d_tmp <- select(d_wide, contains(paste0("t1_", name)), -contains("_m"))
model <- fa.parallel(d_tmp, fa = "fa", fm = "ml")
factan <- fa(d_tmp, fm = "ml", nfactors = model$nfact, rotate = "promax")
print(factan, sort = TRUE, cut = .3)
```
### CFA
#### First-Order Model Unconstrained
```{r}
model <- '
# create factors
t1_pri_con_f =~ 1*t1_pri_con_01 + t1_pri_con_02 + t1_pri_con_03 + t1_pri_con_04 + t1_pri_con_05 + t1_pri_con_06 + t1_pri_con_07 + t1_pri_con_08 + t1_pri_con_09
t2_pri_con_f =~ 1*t2_pri_con_01 + t2_pri_con_02 + t2_pri_con_03 + t2_pri_con_04 + t2_pri_con_05 + t2_pri_con_06 + t2_pri_con_07 + t2_pri_con_08 + t2_pri_con_09
t3_pri_con_f =~ 1*t3_pri_con_01 + t3_pri_con_02 + t3_pri_con_03 + t3_pri_con_04 + t3_pri_con_05 + t3_pri_con_06 + t3_pri_con_07 + t3_pri_con_08 + t3_pri_con_09
# error covariances
t3_pri_con_01 ~~ t2_pri_con_01 + t1_pri_con_01
t3_pri_con_02 ~~ t2_pri_con_02 + t1_pri_con_02
t3_pri_con_03 ~~ t2_pri_con_03 + t1_pri_con_03
t3_pri_con_04 ~~ t2_pri_con_04 + t1_pri_con_04
t3_pri_con_05 ~~ t2_pri_con_05 + t1_pri_con_05
t3_pri_con_06 ~~ t2_pri_con_06 + t1_pri_con_06
t3_pri_con_07 ~~ t2_pri_con_07 + t1_pri_con_07
t3_pri_con_08 ~~ t2_pri_con_08 + t1_pri_con_08
t3_pri_con_09 ~~ t2_pri_con_09 + t1_pri_con_09
t2_pri_con_01 ~~ t1_pri_con_01
t2_pri_con_02 ~~ t1_pri_con_02
t2_pri_con_03 ~~ t1_pri_con_03
t2_pri_con_04 ~~ t1_pri_con_04
t2_pri_con_05 ~~ t1_pri_con_05
t2_pri_con_06 ~~ t1_pri_con_06
t2_pri_con_07 ~~ t1_pri_con_07
t2_pri_con_08 ~~ t1_pri_con_08
t2_pri_con_09 ~~ t1_pri_con_09
# factor covariances
t1_pri_con_f ~~ t2_pri_con_f + t3_pri_con_f
t2_pri_con_f ~~ t3_pri_con_f
'
no <- no + 1
assign(paste("fit", name, no, sep = "_"), cfa(model, d_wide, missing = "ML"))
summary(get(paste("fit", name, no, sep = "_")), standardized = TRUE, fit.measures = TRUE)
```
#### First-Order Model Constrained
```{r}
model <- '
# create factors
t1_pri_con_f =~ 1*t1_pri_con_01 + a2*t1_pri_con_02 + a3*t1_pri_con_03 + a4*t1_pri_con_04 + a5*t1_pri_con_05 + a6*t1_pri_con_06 + a7*t1_pri_con_07 + a8*t1_pri_con_08 + a9*t1_pri_con_09
t2_pri_con_f =~ 1*t2_pri_con_01 + a2*t2_pri_con_02 + a3*t2_pri_con_03 + a4*t2_pri_con_04 + a5*t2_pri_con_05 + a6*t2_pri_con_06 + a7*t2_pri_con_07 + a8*t2_pri_con_08 + a9*t2_pri_con_09
t3_pri_con_f =~ 1*t3_pri_con_01 + a2*t3_pri_con_02 + a3*t3_pri_con_03 + a4*t3_pri_con_04 + a5*t3_pri_con_05 + a6*t3_pri_con_06 + a7*t3_pri_con_07 + a8*t3_pri_con_08 + a9*t3_pri_con_09
# error covariances
t3_pri_con_01 ~~ t2_pri_con_01 + t1_pri_con_01
t3_pri_con_02 ~~ t2_pri_con_02 + t1_pri_con_02
t3_pri_con_03 ~~ t2_pri_con_03 + t1_pri_con_03
t3_pri_con_04 ~~ t2_pri_con_04 + t1_pri_con_04
t3_pri_con_05 ~~ t2_pri_con_05 + t1_pri_con_05
t3_pri_con_06 ~~ t2_pri_con_06 + t1_pri_con_06
t3_pri_con_07 ~~ t2_pri_con_07 + t1_pri_con_07
t3_pri_con_08 ~~ t2_pri_con_08 + t1_pri_con_08
t3_pri_con_09 ~~ t2_pri_con_09 + t1_pri_con_09
t2_pri_con_01 ~~ t1_pri_con_01
t2_pri_con_02 ~~ t1_pri_con_02
t2_pri_con_03 ~~ t1_pri_con_03
t2_pri_con_04 ~~ t1_pri_con_04
t2_pri_con_05 ~~ t1_pri_con_05
t2_pri_con_06 ~~ t1_pri_con_06
t2_pri_con_07 ~~ t1_pri_con_07
t2_pri_con_08 ~~ t1_pri_con_08
t2_pri_con_09 ~~ t1_pri_con_09
# factor covariances
t1_pri_con_f ~~ t2_pri_con_f + t3_pri_con_f
t2_pri_con_f ~~ t3_pri_con_f
'
no <- no + 1
assign(paste("fit", name, no, sep = "_"), cfa(model, d_wide, missing = "ML"))
summary(get(paste("fit", name, no, sep = "_")), standardized = TRUE, fit.measures = TRUE)
```
#### Second-Order Model Unconstrained
We again run models in which we build sub-dimensions referring to the empirical EFA results and theoretical considerations. Resulting model fits the data better than unidimensional one.
```{r}
model <- '
# create factors
t1_inf_sha_att_f =~ 1*t1_inf_sha_att_f1 + t1_inf_sha_att_f2 + t1_inf_sha_att_f3 + t1_inf_sha_att_f4 + t1_inf_sha_att_f5
t2_inf_sha_att_f =~ 1*t2_inf_sha_att_f1 + t2_inf_sha_att_f2 + t2_inf_sha_att_f3 + t2_inf_sha_att_f4 + t2_inf_sha_att_f5
t3_inf_sha_att_f =~ 1*t3_inf_sha_att_f1 + t3_inf_sha_att_f2 + t3_inf_sha_att_f3 + t3_inf_sha_att_f4 + t3_inf_sha_att_f5
t1_inf_sha_att_f1 =~ 1*t1_inf_sha_att_01 + t1_inf_sha_att_02
t1_inf_sha_att_f2 =~ 1*t1_inf_sha_att_03 + t1_inf_sha_att_04
t1_inf_sha_att_f3 =~ 1*t1_inf_sha_att_05 + t1_inf_sha_att_06
t1_inf_sha_att_f4 =~ 1*t1_inf_sha_att_07 + t1_inf_sha_att_08
t1_inf_sha_att_f5 =~ 1*t1_inf_sha_att_10 + t1_inf_sha_att_11
t2_inf_sha_att_f1 =~ 1*t2_inf_sha_att_01 + t2_inf_sha_att_02
t2_inf_sha_att_f2 =~ 1*t2_inf_sha_att_03 + t2_inf_sha_att_04
t2_inf_sha_att_f3 =~ 1*t2_inf_sha_att_05 + t2_inf_sha_att_06
t2_inf_sha_att_f4 =~ 1*t2_inf_sha_att_07 + t2_inf_sha_att_08
t2_inf_sha_att_f5 =~ 1*t2_inf_sha_att_10 + t2_inf_sha_att_11
t3_inf_sha_att_f1 =~ 1*t3_inf_sha_att_01 + t3_inf_sha_att_02
t3_inf_sha_att_f2 =~ 1*t3_inf_sha_att_03 + t3_inf_sha_att_04
t3_inf_sha_att_f3 =~ 1*t3_inf_sha_att_05 + t3_inf_sha_att_06
t3_inf_sha_att_f4 =~ 1*t3_inf_sha_att_07 + t3_inf_sha_att_08
t3_inf_sha_att_f5 =~ 1*t3_inf_sha_att_10 + t3_inf_sha_att_11
# factor covariance
t1_inf_sha_att_f ~~ t2_inf_sha_att_f + t3_inf_sha_att_f
t2_inf_sha_att_f ~~ t3_inf_sha_att_f
# item error covariance
t1_inf_sha_att_01 ~~ t2_inf_sha_att_01 + t3_inf_sha_att_01
t2_inf_sha_att_01 ~~ t3_inf_sha_att_01
t1_inf_sha_att_02 ~~ t2_inf_sha_att_02 + t3_inf_sha_att_02
t2_inf_sha_att_02 ~~ t3_inf_sha_att_02
t1_inf_sha_att_03 ~~ t2_inf_sha_att_03 + t3_inf_sha_att_03
t2_inf_sha_att_03 ~~ t3_inf_sha_att_03
t1_inf_sha_att_04 ~~ t2_inf_sha_att_04 + t3_inf_sha_att_04
t2_inf_sha_att_04 ~~ t3_inf_sha_att_04
t1_inf_sha_att_05 ~~ t2_inf_sha_att_05 + t3_inf_sha_att_05
t2_inf_sha_att_05 ~~ t3_inf_sha_att_05
t1_inf_sha_att_06 ~~ t2_inf_sha_att_06 + t3_inf_sha_att_06
t2_inf_sha_att_06 ~~ t3_inf_sha_att_06
t1_inf_sha_att_07 ~~ t2_inf_sha_att_07 + t3_inf_sha_att_07
t2_inf_sha_att_07 ~~ t3_inf_sha_att_07
t1_inf_sha_att_08 ~~ t2_inf_sha_att_08 + t3_inf_sha_att_08
t2_inf_sha_att_08 ~~ t3_inf_sha_att_08
t1_inf_sha_att_10 ~~ t2_inf_sha_att_10 + t3_inf_sha_att_10
t2_inf_sha_att_10 ~~ t3_inf_sha_att_10
t1_inf_sha_att_11 ~~ t2_inf_sha_att_11 + t3_inf_sha_att_11
t2_inf_sha_att_11 ~~ t3_inf_sha_att_11
'
no <- no + 1
assign(paste("fit", name, no, sep = "_"), cfa(model, d_wide, missing = "ML"))
summary(get(paste("fit", name, no, sep = "_")), standardized = TRUE, fit.measures = TRUE)
```
#### Second-Order Model at All Waves Constrained
```{r}
model <- '
# create factors
t1_inf_sha_att_f =~ 1*t1_inf_sha_att_f1 + o2*t1_inf_sha_att_f2 + o3*t1_inf_sha_att_f3 + o4*t1_inf_sha_att_f4 + o5*t1_inf_sha_att_f5
t2_inf_sha_att_f =~ 1*t2_inf_sha_att_f1 + o2*t2_inf_sha_att_f2 + o3*t2_inf_sha_att_f3 + o4*t2_inf_sha_att_f4 + o5*t2_inf_sha_att_f5
t3_inf_sha_att_f =~ 1*t3_inf_sha_att_f1 + o2*t3_inf_sha_att_f2 + o3*t3_inf_sha_att_f3 + o4*t3_inf_sha_att_f4 + o5*t3_inf_sha_att_f5
t1_inf_sha_att_f1 =~ 1*t1_inf_sha_att_01 + j2*t1_inf_sha_att_02
t1_inf_sha_att_f2 =~ 1*t1_inf_sha_att_03 + k2*t1_inf_sha_att_04
t1_inf_sha_att_f3 =~ 1*t1_inf_sha_att_05 + l2*t1_inf_sha_att_06
t1_inf_sha_att_f4 =~ 1*t1_inf_sha_att_07 + m2*t1_inf_sha_att_08
t1_inf_sha_att_f5 =~ 1*t1_inf_sha_att_10 + n2*t1_inf_sha_att_11
t2_inf_sha_att_f1 =~ 1*t2_inf_sha_att_01 + j2*t2_inf_sha_att_02
t2_inf_sha_att_f2 =~ 1*t2_inf_sha_att_03 + k2*t2_inf_sha_att_04
t2_inf_sha_att_f3 =~ 1*t2_inf_sha_att_05 + l2*t2_inf_sha_att_06
t2_inf_sha_att_f4 =~ 1*t2_inf_sha_att_07 + m2*t2_inf_sha_att_08
t2_inf_sha_att_f5 =~ 1*t2_inf_sha_att_10 + n2*t2_inf_sha_att_11
t3_inf_sha_att_f1 =~ 1*t3_inf_sha_att_01 + j2*t3_inf_sha_att_02
t3_inf_sha_att_f2 =~ 1*t3_inf_sha_att_03 + k2*t3_inf_sha_att_04
t3_inf_sha_att_f3 =~ 1*t3_inf_sha_att_05 + l2*t3_inf_sha_att_06
t3_inf_sha_att_f4 =~ 1*t3_inf_sha_att_07 + m2*t3_inf_sha_att_08
t3_inf_sha_att_f5 =~ 1*t3_inf_sha_att_10 + n2*t3_inf_sha_att_11
# factor covariance
t1_inf_sha_att_f ~~ t2_inf_sha_att_f + t3_inf_sha_att_f
t2_inf_sha_att_f ~~ t3_inf_sha_att_f
# item error covariance
t1_inf_sha_att_01 ~~ t2_inf_sha_att_01 + t3_inf_sha_att_01
t2_inf_sha_att_01 ~~ t3_inf_sha_att_01
t1_inf_sha_att_02 ~~ t2_inf_sha_att_02 + t3_inf_sha_att_02
t2_inf_sha_att_02 ~~ t3_inf_sha_att_02
t1_inf_sha_att_03 ~~ t2_inf_sha_att_03 + t3_inf_sha_att_03
t2_inf_sha_att_03 ~~ t3_inf_sha_att_03
t1_inf_sha_att_04 ~~ t2_inf_sha_att_04 + t3_inf_sha_att_04
t2_inf_sha_att_04 ~~ t3_inf_sha_att_04
t1_inf_sha_att_05 ~~ t2_inf_sha_att_05 + t3_inf_sha_att_05
t2_inf_sha_att_05 ~~ t3_inf_sha_att_05
t1_inf_sha_att_06 ~~ t2_inf_sha_att_06 + t3_inf_sha_att_06
t2_inf_sha_att_06 ~~ t3_inf_sha_att_06
t1_inf_sha_att_07 ~~ t2_inf_sha_att_07 + t3_inf_sha_att_07
t2_inf_sha_att_07 ~~ t3_inf_sha_att_07
t1_inf_sha_att_08 ~~ t2_inf_sha_att_08 + t3_inf_sha_att_08
t2_inf_sha_att_08 ~~ t3_inf_sha_att_08
t1_inf_sha_att_10 ~~ t2_inf_sha_att_10 + t3_inf_sha_att_10
t2_inf_sha_att_10 ~~ t3_inf_sha_att_10
t1_inf_sha_att_11 ~~ t2_inf_sha_att_11 + t3_inf_sha_att_11
t2_inf_sha_att_11 ~~ t3_inf_sha_att_11
'
no <- no + 1
assign(paste("fit", name, no, sep = "_"), cfa(model, d_wide, missing = "ML"))
summary(get(paste("fit", name, no, sep = "_")), standardized = TRUE, fit.measures = TRUE)
```
### Reliability
```{r}
reliabilityL2(get(paste("fit", name, no, sep = "_")), paste("t1", name, "f", sep = "_"))
reliabilityL2(get(paste("fit", name, no, sep = "_")), paste("t2", name, "f", sep = "_"))
reliabilityL2(get(paste("fit", name, no, sep = "_")), paste("t3", name, "f", sep = "_"))
```
### Longitudinal Invariance
```{r}
(anova(get(paste("fit", name, no - 1, sep = "_")), get(paste("fit", name, no, sep = "_"))))
```
## Online Sharing of Personal Information
### EFA
```{r}
no <- 0
name <- "inf_sha_beh"
d_tmp <- select(d_wide, contains(paste0("t1_", name)), -contains("_m"))
model <- fa.parallel(d_tmp, fa = "fa", fm = "ml")
factan <- fa(d_tmp, fm = "ml", nfactors = model$nfact, rotate = "promax")
print(factan, sort = TRUE, cut = .3)
```
### CFA
#### First-Order Model Unconstrained
First-order model shows poor fit. Needs to be adapted (see second order model).
```{r}
model <- '
# create factors
t1_inf_sha_beh_f =~ 1*t1_inf_sha_beh_01 + t1_inf_sha_beh_02 + t1_inf_sha_beh_03 + t1_inf_sha_beh_04 + t1_inf_sha_beh_05 + t1_inf_sha_beh_06 + t1_inf_sha_beh_07 + t1_inf_sha_beh_08 + t1_inf_sha_beh_09 + t1_inf_sha_beh_10 + t1_inf_sha_beh_11
t2_inf_sha_beh_f =~ 1*t2_inf_sha_beh_01 + t2_inf_sha_beh_02 + t2_inf_sha_beh_03 + t2_inf_sha_beh_04 + t2_inf_sha_beh_05 + t2_inf_sha_beh_06 + t2_inf_sha_beh_07 + t2_inf_sha_beh_08 + t2_inf_sha_beh_09 + t2_inf_sha_beh_10 + t2_inf_sha_beh_11
t3_inf_sha_beh_f =~ 1*t3_inf_sha_beh_01 + t3_inf_sha_beh_02 + t3_inf_sha_beh_03 + t3_inf_sha_beh_04 + t3_inf_sha_beh_05 + t3_inf_sha_beh_06 + t3_inf_sha_beh_07 + t3_inf_sha_beh_08 + t3_inf_sha_beh_09 + t3_inf_sha_beh_10 + t3_inf_sha_beh_11
# factor covariance
t1_inf_sha_beh_f ~~ t2_inf_sha_beh_f + t3_inf_sha_beh_f
t2_inf_sha_beh_f ~~ t3_inf_sha_beh_f
# item error covariance
t1_inf_sha_beh_01 ~~ t2_inf_sha_beh_01 + t3_inf_sha_beh_01
t2_inf_sha_beh_01 ~~ t3_inf_sha_beh_01
t1_inf_sha_beh_02 ~~ t2_inf_sha_beh_02 + t3_inf_sha_beh_02
t2_inf_sha_beh_02 ~~ t3_inf_sha_beh_02
t1_inf_sha_beh_03 ~~ t2_inf_sha_beh_03 + t3_inf_sha_beh_03
t2_inf_sha_beh_03 ~~ t3_inf_sha_beh_03
t1_inf_sha_beh_04 ~~ t2_inf_sha_beh_04 + t3_inf_sha_beh_04
t2_inf_sha_beh_04 ~~ t3_inf_sha_beh_04
t1_inf_sha_beh_05 ~~ t2_inf_sha_beh_05 + t3_inf_sha_beh_05
t2_inf_sha_beh_05 ~~ t3_inf_sha_beh_05
t1_inf_sha_beh_06 ~~ t2_inf_sha_beh_06 + t3_inf_sha_beh_06
t2_inf_sha_beh_06 ~~ t3_inf_sha_beh_06
t1_inf_sha_beh_07 ~~ t2_inf_sha_beh_07 + t3_inf_sha_beh_07
t2_inf_sha_beh_07 ~~ t3_inf_sha_beh_07
t1_inf_sha_beh_08 ~~ t2_inf_sha_beh_08 + t3_inf_sha_beh_08
t2_inf_sha_beh_08 ~~ t3_inf_sha_beh_08
t1_inf_sha_beh_09 ~~ t2_inf_sha_beh_09 + t3_inf_sha_beh_09
t2_inf_sha_beh_09 ~~ t3_inf_sha_beh_09
t1_inf_sha_beh_10 ~~ t2_inf_sha_beh_10 + t3_inf_sha_beh_10
t2_inf_sha_beh_10 ~~ t3_inf_sha_beh_10
t1_inf_sha_beh_11 ~~ t2_inf_sha_beh_11 + t3_inf_sha_beh_11
t2_inf_sha_beh_11 ~~ t3_inf_sha_beh_11
'
no <- no + 1
assign(paste("fit", name, no, sep = "_"), cfa(model, d_wide, missing = "ML"))
summary(get(paste("fit", name, no, sep = "_")), standardized = TRUE, fit.measures = TRUE)
```
#### First-Order Model Constrained
```{r}
model <- '
# create factors
t1_inf_sha_beh_f =~ 1*t1_inf_sha_beh_01 + c2*t1_inf_sha_beh_02 + c3*t1_inf_sha_beh_03 + c4*t1_inf_sha_beh_04 + c5*t1_inf_sha_beh_05 + c6*t1_inf_sha_beh_06 + c7*t1_inf_sha_beh_07 + c8*t1_inf_sha_beh_08 + c9*t1_inf_sha_beh_09 + c10*t1_inf_sha_beh_10 + c11*t1_inf_sha_beh_11
t2_inf_sha_beh_f =~ 1*t2_inf_sha_beh_01 + c2*t2_inf_sha_beh_02 + c3*t2_inf_sha_beh_03 + c4*t2_inf_sha_beh_04 + c5*t2_inf_sha_beh_05 + c6*t2_inf_sha_beh_06 + c7*t2_inf_sha_beh_07 + c8*t2_inf_sha_beh_08 + c9*t2_inf_sha_beh_09 + c10*t2_inf_sha_beh_10 + c11*t2_inf_sha_beh_11
t3_inf_sha_beh_f =~ 1*t3_inf_sha_beh_01 + c2*t3_inf_sha_beh_02 + c3*t3_inf_sha_beh_03 + c4*t3_inf_sha_beh_04 + c5*t3_inf_sha_beh_05 + c6*t3_inf_sha_beh_06 + c7*t3_inf_sha_beh_07 + c8*t3_inf_sha_beh_08 + c9*t3_inf_sha_beh_09 + c10*t3_inf_sha_beh_10 + c11*t3_inf_sha_beh_11
# factor covariance
t1_inf_sha_beh_f ~~ t2_inf_sha_beh_f + t3_inf_sha_beh_f
t2_inf_sha_beh_f ~~ t3_inf_sha_beh_f
# item error covariance
t1_inf_sha_beh_01 ~~ t2_inf_sha_beh_01 + t3_inf_sha_beh_01
t2_inf_sha_beh_01 ~~ t3_inf_sha_beh_01
t1_inf_sha_beh_02 ~~ t2_inf_sha_beh_02 + t3_inf_sha_beh_02
t2_inf_sha_beh_02 ~~ t3_inf_sha_beh_02
t1_inf_sha_beh_03 ~~ t2_inf_sha_beh_03 + t3_inf_sha_beh_03
t2_inf_sha_beh_03 ~~ t3_inf_sha_beh_03
t1_inf_sha_beh_04 ~~ t2_inf_sha_beh_04 + t3_inf_sha_beh_04
t2_inf_sha_beh_04 ~~ t3_inf_sha_beh_04
t1_inf_sha_beh_05 ~~ t2_inf_sha_beh_05 + t3_inf_sha_beh_05
t2_inf_sha_beh_05 ~~ t3_inf_sha_beh_05
t1_inf_sha_beh_06 ~~ t2_inf_sha_beh_06 + t3_inf_sha_beh_06
t2_inf_sha_beh_06 ~~ t3_inf_sha_beh_06
t1_inf_sha_beh_07 ~~ t2_inf_sha_beh_07 + t3_inf_sha_beh_07
t2_inf_sha_beh_07 ~~ t3_inf_sha_beh_07
t1_inf_sha_beh_08 ~~ t2_inf_sha_beh_08 + t3_inf_sha_beh_08
t2_inf_sha_beh_08 ~~ t3_inf_sha_beh_08
t1_inf_sha_beh_09 ~~ t2_inf_sha_beh_09 + t3_inf_sha_beh_09
t2_inf_sha_beh_09 ~~ t3_inf_sha_beh_09
t1_inf_sha_beh_10 ~~ t2_inf_sha_beh_10 + t3_inf_sha_beh_10
t2_inf_sha_beh_10 ~~ t3_inf_sha_beh_10
t1_inf_sha_beh_11 ~~ t2_inf_sha_beh_11 + t3_inf_sha_beh_11
t2_inf_sha_beh_11 ~~ t3_inf_sha_beh_11
'
no <- no + 1
assign(paste("fit", name, no, sep = "_"), cfa(model, d_wide, missing = "ML"))
summary(get(paste("fit", name, no, sep = "_")), standardized = TRUE, fit.measures = TRUE)
```
#### Second-Order Model Unconstrained
Second-order model shows much improved fit.
```{r}
model <- '
# create factors
t1_inf_sha_beh_f =~ 1*t1_inf_sha_beh_f1 + t1_inf_sha_beh_f2 + t1_inf_sha_beh_f3 + t1_inf_sha_beh_f4 + t1_inf_sha_beh_f5
t2_inf_sha_beh_f =~ 1*t2_inf_sha_beh_f1 + t2_inf_sha_beh_f2 + t2_inf_sha_beh_f3 + t2_inf_sha_beh_f4 + t2_inf_sha_beh_f5
t3_inf_sha_beh_f =~ 1*t3_inf_sha_beh_f1 + t3_inf_sha_beh_f2 + t3_inf_sha_beh_f3 + t3_inf_sha_beh_f4 + t3_inf_sha_beh_f5
t1_inf_sha_beh_f1 =~ 1*t1_inf_sha_beh_01 + t1_inf_sha_beh_02
t1_inf_sha_beh_f2 =~ 1*t1_inf_sha_beh_03 + t1_inf_sha_beh_04
t1_inf_sha_beh_f3 =~ 1*t1_inf_sha_beh_05 + t1_inf_sha_beh_06
t1_inf_sha_beh_f4 =~ 1*t1_inf_sha_beh_07 + t1_inf_sha_beh_08
t1_inf_sha_beh_f5 =~ 1*t1_inf_sha_beh_10 + t1_inf_sha_beh_11
t2_inf_sha_beh_f1 =~ 1*t2_inf_sha_beh_01 + t2_inf_sha_beh_02
t2_inf_sha_beh_f2 =~ 1*t2_inf_sha_beh_03 + t2_inf_sha_beh_04
t2_inf_sha_beh_f3 =~ 1*t2_inf_sha_beh_05 + t2_inf_sha_beh_06
t2_inf_sha_beh_f4 =~ 1*t2_inf_sha_beh_07 + t2_inf_sha_beh_08
t2_inf_sha_beh_f5 =~ 1*t2_inf_sha_beh_10 + t2_inf_sha_beh_11
t3_inf_sha_beh_f1 =~ 1*t3_inf_sha_beh_01 + t3_inf_sha_beh_02
t3_inf_sha_beh_f2 =~ 1*t3_inf_sha_beh_03 + t3_inf_sha_beh_04
t3_inf_sha_beh_f3 =~ 1*t3_inf_sha_beh_05 + t3_inf_sha_beh_06
t3_inf_sha_beh_f4 =~ 1*t3_inf_sha_beh_07 + t3_inf_sha_beh_08
t3_inf_sha_beh_f5 =~ 1*t3_inf_sha_beh_10 + t3_inf_sha_beh_11
# factor covariance
t1_inf_sha_beh_f ~~ t2_inf_sha_beh_f + t3_inf_sha_beh_f
t2_inf_sha_beh_f ~~ t3_inf_sha_beh_f
# item error covariance
t1_inf_sha_beh_01 ~~ t2_inf_sha_beh_01 + t3_inf_sha_beh_01
t2_inf_sha_beh_01 ~~ t3_inf_sha_beh_01
t1_inf_sha_beh_02 ~~ t2_inf_sha_beh_02 + t3_inf_sha_beh_02
t2_inf_sha_beh_02 ~~ t3_inf_sha_beh_02
t1_inf_sha_beh_03 ~~ t2_inf_sha_beh_03 + t3_inf_sha_beh_03
t2_inf_sha_beh_03 ~~ t3_inf_sha_beh_03
t1_inf_sha_beh_04 ~~ t2_inf_sha_beh_04 + t3_inf_sha_beh_04
t2_inf_sha_beh_04 ~~ t3_inf_sha_beh_04
t1_inf_sha_beh_05 ~~ t2_inf_sha_beh_05 + t3_inf_sha_beh_05
t2_inf_sha_beh_05 ~~ t3_inf_sha_beh_05
t1_inf_sha_beh_06 ~~ t2_inf_sha_beh_06 + t3_inf_sha_beh_06
t2_inf_sha_beh_06 ~~ t3_inf_sha_beh_06
t1_inf_sha_beh_07 ~~ t2_inf_sha_beh_07 + t3_inf_sha_beh_07
t2_inf_sha_beh_07 ~~ t3_inf_sha_beh_07
t1_inf_sha_beh_08 ~~ t2_inf_sha_beh_08 + t3_inf_sha_beh_08
t2_inf_sha_beh_08 ~~ t3_inf_sha_beh_08
t1_inf_sha_beh_10 ~~ t2_inf_sha_beh_10 + t3_inf_sha_beh_10
t2_inf_sha_beh_10 ~~ t3_inf_sha_beh_10
t1_inf_sha_beh_11 ~~ t2_inf_sha_beh_11 + t3_inf_sha_beh_11
t2_inf_sha_beh_11 ~~ t3_inf_sha_beh_11
'
no <- no + 1
assign(paste("fit", name, no, sep = "_"), cfa(model, d_wide, missing = "ML"))
summary(get(paste("fit", name, no, sep = "_")), standardized = TRUE, fit.measures = TRUE)
```
#### Second-Order Model Constrained
```{r}
model <- '
# create factors
t1_inf_sha_beh_f =~ 1*t1_inf_sha_beh_f1 + o2*t1_inf_sha_beh_f2 + o3*t1_inf_sha_beh_f3 + o4*t1_inf_sha_beh_f4 + o5*t1_inf_sha_beh_f5
t2_inf_sha_beh_f =~ 1*t2_inf_sha_beh_f1 + o2*t2_inf_sha_beh_f2 + o3*t2_inf_sha_beh_f3 + o4*t2_inf_sha_beh_f4 + o5*t2_inf_sha_beh_f5
t3_inf_sha_beh_f =~ 1*t3_inf_sha_beh_f1 + o2*t3_inf_sha_beh_f2 + o3*t3_inf_sha_beh_f3 + o4*t3_inf_sha_beh_f4 + o5*t3_inf_sha_beh_f5
t1_inf_sha_beh_f1 =~ 1*t1_inf_sha_beh_01 + j2*t1_inf_sha_beh_02
t1_inf_sha_beh_f2 =~ 1*t1_inf_sha_beh_03 + k2*t1_inf_sha_beh_04
t1_inf_sha_beh_f3 =~ 1*t1_inf_sha_beh_05 + l2*t1_inf_sha_beh_06
t1_inf_sha_beh_f4 =~ 1*t1_inf_sha_beh_07 + m2*t1_inf_sha_beh_08
t1_inf_sha_beh_f5 =~ 1*t1_inf_sha_beh_10 + n2*t1_inf_sha_beh_11
t2_inf_sha_beh_f1 =~ 1*t2_inf_sha_beh_01 + j2*t2_inf_sha_beh_02
t2_inf_sha_beh_f2 =~ 1*t2_inf_sha_beh_03 + k2*t2_inf_sha_beh_04
t2_inf_sha_beh_f3 =~ 1*t2_inf_sha_beh_05 + l2*t2_inf_sha_beh_06
t2_inf_sha_beh_f4 =~ 1*t2_inf_sha_beh_07 + m2*t2_inf_sha_beh_08
t2_inf_sha_beh_f5 =~ 1*t2_inf_sha_beh_10 + n2*t2_inf_sha_beh_11
t3_inf_sha_beh_f1 =~ 1*t3_inf_sha_beh_01 + j2*t3_inf_sha_beh_02
t3_inf_sha_beh_f2 =~ 1*t3_inf_sha_beh_03 + k2*t3_inf_sha_beh_04
t3_inf_sha_beh_f3 =~ 1*t3_inf_sha_beh_05 + l2*t3_inf_sha_beh_06
t3_inf_sha_beh_f4 =~ 1*t3_inf_sha_beh_07 + m2*t3_inf_sha_beh_08
t3_inf_sha_beh_f5 =~ 1*t3_inf_sha_beh_10 + n2*t3_inf_sha_beh_11
# factor covariance
t1_inf_sha_beh_f ~~ t2_inf_sha_beh_f + t3_inf_sha_beh_f
t2_inf_sha_beh_f ~~ t3_inf_sha_beh_f
# item error covariance
t1_inf_sha_beh_01 ~~ t2_inf_sha_beh_01 + t3_inf_sha_beh_01
t2_inf_sha_beh_01 ~~ t3_inf_sha_beh_01
t1_inf_sha_beh_02 ~~ t2_inf_sha_beh_02 + t3_inf_sha_beh_02
t2_inf_sha_beh_02 ~~ t3_inf_sha_beh_02
t1_inf_sha_beh_03 ~~ t2_inf_sha_beh_03 + t3_inf_sha_beh_03
t2_inf_sha_beh_03 ~~ t3_inf_sha_beh_03
t1_inf_sha_beh_04 ~~ t2_inf_sha_beh_04 + t3_inf_sha_beh_04
t2_inf_sha_beh_04 ~~ t3_inf_sha_beh_04
t1_inf_sha_beh_05 ~~ t2_inf_sha_beh_05 + t3_inf_sha_beh_05
t2_inf_sha_beh_05 ~~ t3_inf_sha_beh_05
t1_inf_sha_beh_06 ~~ t2_inf_sha_beh_06 + t3_inf_sha_beh_06
t2_inf_sha_beh_06 ~~ t3_inf_sha_beh_06
t1_inf_sha_beh_07 ~~ t2_inf_sha_beh_07 + t3_inf_sha_beh_07
t2_inf_sha_beh_07 ~~ t3_inf_sha_beh_07
t1_inf_sha_beh_08 ~~ t2_inf_sha_beh_08 + t3_inf_sha_beh_08
t2_inf_sha_beh_08 ~~ t3_inf_sha_beh_08
t1_inf_sha_beh_10 ~~ t2_inf_sha_beh_10 + t3_inf_sha_beh_10
t2_inf_sha_beh_10 ~~ t3_inf_sha_beh_10
t1_inf_sha_beh_11 ~~ t2_inf_sha_beh_11 + t3_inf_sha_beh_11
t2_inf_sha_beh_11 ~~ t3_inf_sha_beh_11
'
no <- no + 1
assign(paste("fit", name, no, sep = "_"), cfa(model, d_wide, missing = "ML"))
summary(get(paste("fit", name, no, sep = "_")), standardized = TRUE, fit.measures = TRUE)
```
### Reliability
```{r}
reliabilityL2(get(paste("fit", name, no, sep = "_")), paste("t1", name, "f", sep = "_"))
reliabilityL2(get(paste("fit", name, no, sep = "_")), paste("t2", name, "f", sep = "_"))
reliabilityL2(get(paste("fit", name, no, sep = "_")), paste("t3", name, "f", sep = "_"))
```
### Longitudinal Invariance
```{r}
(anova(get(paste("fit", name, no - 1, sep = "_")), get(paste("fit", name, no, sep = "_"))))
```
## Baseline Model
### Second Order
```{r CFA_All_ALL}
name <- "all_vars"
no <- 0
model <- '
# Privacy Concerns
# create factors
t1_pri_con_f =~ 1*t1_pri_con_f1 + a2*t1_pri_con_f2
t2_pri_con_f =~ 1*t2_pri_con_f1 + a2*t2_pri_con_f2
t3_pri_con_f =~ 1*t3_pri_con_f1 + a2*t3_pri_con_f2
t1_pri_con_f1 =~ 1*t1_pri_con_04 + b2*t1_pri_con_05 + b3*t1_pri_con_06
t1_pri_con_f2 =~ 1*t1_pri_con_07 + c2*t1_pri_con_08 + c3*t1_pri_con_09
t2_pri_con_f1 =~ 1*t2_pri_con_04 + b2*t2_pri_con_05 + b3*t2_pri_con_06
t2_pri_con_f2 =~ 1*t2_pri_con_07 + c2*t2_pri_con_08 + c3*t2_pri_con_09
t3_pri_con_f1 =~ 1*t3_pri_con_04 + b2*t3_pri_con_05 + b3*t3_pri_con_06
t3_pri_con_f2 =~ 1*t3_pri_con_07 + c2*t3_pri_con_08 + c3*t3_pri_con_09
# error covariances
t3_pri_con_04 ~~ t2_pri_con_04 + t1_pri_con_04
t3_pri_con_05 ~~ t2_pri_con_05 + t1_pri_con_05
t3_pri_con_06 ~~ t2_pri_con_06 + t1_pri_con_06
t3_pri_con_07 ~~ t2_pri_con_07 + t1_pri_con_07
t3_pri_con_08 ~~ t2_pri_con_08 + t1_pri_con_08
t3_pri_con_09 ~~ t2_pri_con_09 + t1_pri_con_09
t2_pri_con_04 ~~ t1_pri_con_04
t2_pri_con_05 ~~ t1_pri_con_05
t2_pri_con_06 ~~ t1_pri_con_06
t2_pri_con_07 ~~ t1_pri_con_07
t2_pri_con_08 ~~ t1_pri_con_08
t2_pri_con_09 ~~ t1_pri_con_09
# factor covariances
t1_pri_con_f ~~ t2_pri_con_f + t3_pri_con_f
t2_pri_con_f ~~ t3_pri_con_f
# Information Sharing Attitude
# create factors
t1_inf_sha_att_f =~ 1*t1_inf_sha_att_f1 + d2*t1_inf_sha_att_f2 + d3*t1_inf_sha_att_f3 + d4*t1_inf_sha_att_f4 + d5*t1_inf_sha_att_f5
t2_inf_sha_att_f =~ 1*t2_inf_sha_att_f1 + d2*t2_inf_sha_att_f2 + d3*t2_inf_sha_att_f3 + d4*t2_inf_sha_att_f4 + d5*t2_inf_sha_att_f5
t3_inf_sha_att_f =~ 1*t3_inf_sha_att_f1 + d2*t3_inf_sha_att_f2 + d3*t3_inf_sha_att_f3 + d4*t3_inf_sha_att_f4 + d5*t3_inf_sha_att_f5
t1_inf_sha_att_f1 =~ 1*t1_inf_sha_att_01 + e*t1_inf_sha_att_02
t1_inf_sha_att_f2 =~ 1*t1_inf_sha_att_03 + f*t1_inf_sha_att_04
t1_inf_sha_att_f3 =~ 1*t1_inf_sha_att_05 + g*t1_inf_sha_att_06
t1_inf_sha_att_f4 =~ 1*t1_inf_sha_att_07 + h*t1_inf_sha_att_08
t1_inf_sha_att_f5 =~ 1*t1_inf_sha_att_10 + i*t1_inf_sha_att_11
t2_inf_sha_att_f1 =~ 1*t2_inf_sha_att_01 + e*t2_inf_sha_att_02
t2_inf_sha_att_f2 =~ 1*t2_inf_sha_att_03 + f*t2_inf_sha_att_04
t2_inf_sha_att_f3 =~ 1*t2_inf_sha_att_05 + g*t2_inf_sha_att_06
t2_inf_sha_att_f4 =~ 1*t2_inf_sha_att_07 + h*t2_inf_sha_att_08
t2_inf_sha_att_f5 =~ 1*t2_inf_sha_att_10 + i*t2_inf_sha_att_11
t3_inf_sha_att_f1 =~ 1*t3_inf_sha_att_01 + e*t3_inf_sha_att_02
t3_inf_sha_att_f2 =~ 1*t3_inf_sha_att_03 + f*t3_inf_sha_att_04
t3_inf_sha_att_f3 =~ 1*t3_inf_sha_att_05 + g*t3_inf_sha_att_06
t3_inf_sha_att_f4 =~ 1*t3_inf_sha_att_07 + h*t3_inf_sha_att_08
t3_inf_sha_att_f5 =~ 1*t3_inf_sha_att_10 + i*t3_inf_sha_att_11
# factor covariance
t1_inf_sha_att_f ~~ t2_inf_sha_att_f + t3_inf_sha_att_f
t2_inf_sha_att_f ~~ t3_inf_sha_att_f
# item error covariance
t1_inf_sha_att_01 ~~ t2_inf_sha_att_01 + t3_inf_sha_att_01
t2_inf_sha_att_01 ~~ t3_inf_sha_att_01
t1_inf_sha_att_02 ~~ t2_inf_sha_att_02 + t3_inf_sha_att_02
t2_inf_sha_att_02 ~~ t3_inf_sha_att_02
t1_inf_sha_att_03 ~~ t2_inf_sha_att_03 + t3_inf_sha_att_03
t2_inf_sha_att_03 ~~ t3_inf_sha_att_03
t1_inf_sha_att_04 ~~ t2_inf_sha_att_04 + t3_inf_sha_att_04
t2_inf_sha_att_04 ~~ t3_inf_sha_att_04
t1_inf_sha_att_05 ~~ t2_inf_sha_att_05 + t3_inf_sha_att_05
t2_inf_sha_att_05 ~~ t3_inf_sha_att_05
t1_inf_sha_att_06 ~~ t2_inf_sha_att_06 + t3_inf_sha_att_06
t2_inf_sha_att_06 ~~ t3_inf_sha_att_06
t1_inf_sha_att_07 ~~ t2_inf_sha_att_07 + t3_inf_sha_att_07
t2_inf_sha_att_07 ~~ t3_inf_sha_att_07
t1_inf_sha_att_08 ~~ t2_inf_sha_att_08 + t3_inf_sha_att_08
t2_inf_sha_att_08 ~~ t3_inf_sha_att_08
t1_inf_sha_att_10 ~~ t2_inf_sha_att_10 + t3_inf_sha_att_10
t2_inf_sha_att_10 ~~ t3_inf_sha_att_10
t1_inf_sha_att_11 ~~ t2_inf_sha_att_11 + t3_inf_sha_att_11
t2_inf_sha_att_11 ~~ t3_inf_sha_att_11
# information sharing behavior
# create factors
t1_inf_sha_beh_f =~ 1*t1_inf_sha_beh_f1 + o2*t1_inf_sha_beh_f2 + o3*t1_inf_sha_beh_f3 + o4*t1_inf_sha_beh_f4 + o5*t1_inf_sha_beh_f5
t2_inf_sha_beh_f =~ 1*t2_inf_sha_beh_f1 + o2*t2_inf_sha_beh_f2 + o3*t2_inf_sha_beh_f3 + o4*t2_inf_sha_beh_f4 + o5*t2_inf_sha_beh_f5
t3_inf_sha_beh_f =~ 1*t3_inf_sha_beh_f1 + o2*t3_inf_sha_beh_f2 + o3*t3_inf_sha_beh_f3 + o4*t3_inf_sha_beh_f4 + o5*t3_inf_sha_beh_f5
t1_inf_sha_beh_f1 =~ 1*t1_inf_sha_beh_01 + j2*t1_inf_sha_beh_02
t1_inf_sha_beh_f2 =~ 1*t1_inf_sha_beh_03 + k2*t1_inf_sha_beh_04
t1_inf_sha_beh_f3 =~ 1*t1_inf_sha_beh_05 + l2*t1_inf_sha_beh_06
t1_inf_sha_beh_f4 =~ 1*t1_inf_sha_beh_07 + m2*t1_inf_sha_beh_08
t1_inf_sha_beh_f5 =~ 1*t1_inf_sha_beh_10 + n2*t1_inf_sha_beh_11
t2_inf_sha_beh_f1 =~ 1*t2_inf_sha_beh_01 + j2*t2_inf_sha_beh_02
t2_inf_sha_beh_f2 =~ 1*t2_inf_sha_beh_03 + k2*t2_inf_sha_beh_04
t2_inf_sha_beh_f3 =~ 1*t2_inf_sha_beh_05 + l2*t2_inf_sha_beh_06
t2_inf_sha_beh_f4 =~ 1*t2_inf_sha_beh_07 + m2*t2_inf_sha_beh_08
t2_inf_sha_beh_f5 =~ 1*t2_inf_sha_beh_10 + n2*t2_inf_sha_beh_11
t3_inf_sha_beh_f1 =~ 1*t3_inf_sha_beh_01 + j2*t3_inf_sha_beh_02
t3_inf_sha_beh_f2 =~ 1*t3_inf_sha_beh_03 + k2*t3_inf_sha_beh_04
t3_inf_sha_beh_f3 =~ 1*t3_inf_sha_beh_05 + l2*t3_inf_sha_beh_06
t3_inf_sha_beh_f4 =~ 1*t3_inf_sha_beh_07 + m2*t3_inf_sha_beh_08
t3_inf_sha_beh_f5 =~ 1*t3_inf_sha_beh_10 + n2*t3_inf_sha_beh_11
# factor covariance
t1_inf_sha_beh_f ~~ t2_inf_sha_beh_f + t3_inf_sha_beh_f
t2_inf_sha_beh_f ~~ t3_inf_sha_beh_f
# item error covariance
t1_inf_sha_beh_01 ~~ t2_inf_sha_beh_01 + t3_inf_sha_beh_01
t2_inf_sha_beh_01 ~~ t3_inf_sha_beh_01
t1_inf_sha_beh_02 ~~ t2_inf_sha_beh_02 + t3_inf_sha_beh_02
t2_inf_sha_beh_02 ~~ t3_inf_sha_beh_02
t1_inf_sha_beh_03 ~~ t2_inf_sha_beh_03 + t3_inf_sha_beh_03
t2_inf_sha_beh_03 ~~ t3_inf_sha_beh_03
t1_inf_sha_beh_04 ~~ t2_inf_sha_beh_04 + t3_inf_sha_beh_04
t2_inf_sha_beh_04 ~~ t3_inf_sha_beh_04
t1_inf_sha_beh_05 ~~ t2_inf_sha_beh_05 + t3_inf_sha_beh_05
t2_inf_sha_beh_05 ~~ t3_inf_sha_beh_05
t1_inf_sha_beh_06 ~~ t2_inf_sha_beh_06 + t3_inf_sha_beh_06
t2_inf_sha_beh_06 ~~ t3_inf_sha_beh_06
t1_inf_sha_beh_07 ~~ t2_inf_sha_beh_07 + t3_inf_sha_beh_07
t2_inf_sha_beh_07 ~~ t3_inf_sha_beh_07
t1_inf_sha_beh_08 ~~ t2_inf_sha_beh_08 + t3_inf_sha_beh_08
t2_inf_sha_beh_08 ~~ t3_inf_sha_beh_08
t1_inf_sha_beh_10 ~~ t2_inf_sha_beh_10 + t3_inf_sha_beh_10
t2_inf_sha_beh_10 ~~ t3_inf_sha_beh_10
t1_inf_sha_beh_11 ~~ t2_inf_sha_beh_11 + t3_inf_sha_beh_11
t2_inf_sha_beh_11 ~~ t3_inf_sha_beh_11
## Correlations Attitude and Behavior-Items
t1_inf_sha_beh_01 ~~ t1_inf_sha_att_01
t1_inf_sha_beh_02 ~~ t1_inf_sha_att_02
t1_inf_sha_beh_03 ~~ t1_inf_sha_att_03
t1_inf_sha_beh_04 ~~ t1_inf_sha_att_04
t1_inf_sha_beh_05 ~~ t1_inf_sha_att_05
t1_inf_sha_beh_06 ~~ t1_inf_sha_att_06
t1_inf_sha_beh_07 ~~ t1_inf_sha_att_07
t1_inf_sha_beh_08 ~~ t1_inf_sha_att_08
t1_inf_sha_beh_10 ~~ t1_inf_sha_att_10
t1_inf_sha_beh_11 ~~ t1_inf_sha_att_11
t2_inf_sha_beh_01 ~~ t2_inf_sha_att_01
t2_inf_sha_beh_02 ~~ t2_inf_sha_att_02
t2_inf_sha_beh_03 ~~ t2_inf_sha_att_03
t2_inf_sha_beh_04 ~~ t2_inf_sha_att_04
t2_inf_sha_beh_05 ~~ t2_inf_sha_att_05
t2_inf_sha_beh_06 ~~ t2_inf_sha_att_06
t2_inf_sha_beh_07 ~~ t2_inf_sha_att_07
t2_inf_sha_beh_08 ~~ t2_inf_sha_att_08
t2_inf_sha_beh_10 ~~ t2_inf_sha_att_10
t2_inf_sha_beh_11 ~~ t2_inf_sha_att_11
t3_inf_sha_beh_01 ~~ t3_inf_sha_att_01
t3_inf_sha_beh_02 ~~ t3_inf_sha_att_02
t3_inf_sha_beh_03 ~~ t3_inf_sha_att_03
t3_inf_sha_beh_04 ~~ t3_inf_sha_att_04
t3_inf_sha_beh_05 ~~ t3_inf_sha_att_05
t3_inf_sha_beh_06 ~~ t3_inf_sha_att_06
t3_inf_sha_beh_07 ~~ t3_inf_sha_att_07
t3_inf_sha_beh_08 ~~ t3_inf_sha_att_08
t3_inf_sha_beh_10 ~~ t3_inf_sha_att_10
t3_inf_sha_beh_11 ~~ t3_inf_sha_att_11
'
no <- no + 1
assign(paste("fit", name, no, sep = "_"), cfa(model, d_wide, missing = "ML"))
summary(get(paste("fit", name, no, sep = "_")), standardized = TRUE, fit.measures = TRUE)
```
# Results
In what follows, we report additional models, which are also related to our research question.
## RI-CLPM
### Two Variables
Here, we look at the bivariate relations of privacy concerns and information sharing. This is interesting, because in the paper we also address privacy attitudes, thereby potentially attenuating the effect of privacy concerns. However, when analyzing only these two variables we do not find larger effects sizes.
#### Model 1
Here, we use regular observed means.
```{r }
model <- '
# between relations
pri_con_b =~ 1*t1_pri_con_m + 1*t2_pri_con_m + 1*t3_pri_con_m
inf_sha_beh_b =~ 1*t1_inf_sha_beh_m + 1*t2_inf_sha_beh_m + 1*t3_inf_sha_beh_m
# intercepts
t1_pri_con_m ~ mu1*1
t2_pri_con_m ~ mu2*1
t3_pri_con_m ~ mu3*1
t1_inf_sha_beh_m ~ pi1*1
t2_inf_sha_beh_m ~ pi2*1
t3_inf_sha_beh_m ~ pi3*1
# within person changes
t1_pri_con_w =~ 1*t1_pri_con_m
t2_pri_con_w =~ 1*t2_pri_con_m
t3_pri_con_w =~ 1*t3_pri_con_m
t1_inf_sha_beh_w =~ 1*t1_inf_sha_beh_m
t2_inf_sha_beh_w =~ 1*t2_inf_sha_beh_m
t3_inf_sha_beh_w =~ 1*t3_inf_sha_beh_m
# estimate variances
pri_con_b ~~ pri_con_b
inf_sha_beh_b ~~ inf_sha_beh_b
t1_pri_con_w ~~ t1_pri_con_w
t2_pri_con_w ~~ t2_pri_con_w
t3_pri_con_w ~~ t3_pri_con_w
t1_inf_sha_beh_w ~~ t1_inf_sha_beh_w
t2_inf_sha_beh_w ~~ t2_inf_sha_beh_w
t3_inf_sha_beh_w ~~ t3_inf_sha_beh_w
# within person effects
t2_pri_con_w ~ a1*t1_pri_con_w + a2*t1_inf_sha_beh_w
t2_inf_sha_beh_w ~ b1*t1_pri_con_w + b2*t1_inf_sha_beh_w
t3_pri_con_w ~ a1*t2_pri_con_w + a2*t2_inf_sha_beh_w
t3_inf_sha_beh_w ~ b1*t2_pri_con_w + b2*t2_inf_sha_beh_w
# covariances
pri_con_b ~~ inf_sha_beh_b
t1_pri_con_w ~~ t1_inf_sha_beh_w
t2_pri_con_w ~~ a*t2_inf_sha_beh_w
t3_pri_con_w ~~ a*t3_inf_sha_beh_w
'
fit <- lavaan(model, data = d_wide, missing = "ML")
summary(fit, standardized = TRUE, fit.measures = TRUE)
```
#### Model 2
Model with a (broad) single item measure of privacy concerns ("In general, how concerned are you about your privacy while using the Internet?").
```{r }
model <- '
# between relations
pri_con_b =~ 1*t1_pri_con_01 + 1*t2_pri_con_01 + 1*t3_pri_con_01
inf_sha_beh_b =~ 1*t1_inf_sha_beh_m + 1*t2_inf_sha_beh_m + 1*t3_inf_sha_beh_m
# intercepts
t1_pri_con_01 ~ mu1*1
t2_pri_con_01 ~ mu2*1
t3_pri_con_01 ~ mu3*1
t1_inf_sha_beh_m ~ pi1*1
t2_inf_sha_beh_m ~ pi2*1
t3_inf_sha_beh_m ~ pi3*1
# within person changes
t1_pri_con_w =~ 1*t1_pri_con_01
t2_pri_con_w =~ 1*t2_pri_con_01
t3_pri_con_w =~ 1*t3_pri_con_01
t1_inf_sha_beh_w =~ 1*t1_inf_sha_beh_m
t2_inf_sha_beh_w =~ 1*t2_inf_sha_beh_m
t3_inf_sha_beh_w =~ 1*t3_inf_sha_beh_m
# estimate variances
pri_con_b ~~ pri_con_b
inf_sha_beh_b ~~ inf_sha_beh_b
t1_pri_con_w ~~ t1_pri_con_w
t2_pri_con_w ~~ t2_pri_con_w
t3_pri_con_w ~~ t3_pri_con_w
t1_inf_sha_beh_w ~~ t1_inf_sha_beh_w
t2_inf_sha_beh_w ~~ t2_inf_sha_beh_w
t3_inf_sha_beh_w ~~ t3_inf_sha_beh_w
# within person effects
t2_pri_con_w ~ a1*t1_pri_con_w + a2*t1_inf_sha_beh_w
t2_inf_sha_beh_w ~ b1*t1_pri_con_w + b2*t1_inf_sha_beh_w
t3_pri_con_w ~ a1*t2_pri_con_w + a2*t2_inf_sha_beh_w
t3_inf_sha_beh_w ~ b1*t2_pri_con_w + b2*t2_inf_sha_beh_w
# covariances
pri_con_b ~~ inf_sha_beh_b
t1_pri_con_w ~~ t1_inf_sha_beh_w
t2_pri_con_w ~~ a*t2_inf_sha_beh_w
t3_pri_con_w ~~ a*t3_inf_sha_beh_w
'
fit <- lavaan(model, data = d_wide, missing = "ML")
summary(fit, standardized = TRUE, fit.measures = TRUE)
```
#### Model 3
With Factor Scores.
```{r}
model <- '
# between relations
pri_con_b =~ 1*t1_pri_con_fs + 1*t2_pri_con_fs + 1*t3_pri_con_fs
inf_sha_beh_b =~ 1*t1_inf_sha_beh_fs + 1*t2_inf_sha_beh_fs + 1*t3_inf_sha_beh_fs
# intercepts
t1_pri_con_fs ~ 1
t2_pri_con_fs ~ 1
t3_pri_con_fs ~ 1
t1_inf_sha_beh_fs ~ 1
t2_inf_sha_beh_fs ~ 1
t3_inf_sha_beh_fs ~ 1
# within person changes
t1_pri_con_w =~ 1*t1_pri_con_fs
t2_pri_con_w =~ 1*t2_pri_con_fs
t3_pri_con_w =~ 1*t3_pri_con_fs
t1_inf_sha_beh_w =~ 1*t1_inf_sha_beh_fs
t2_inf_sha_beh_w =~ 1*t2_inf_sha_beh_fs
t3_inf_sha_beh_w =~ 1*t3_inf_sha_beh_fs
# estimate variances
pri_con_b ~~ pri_con_b
inf_sha_beh_b ~~ inf_sha_beh_b
t1_pri_con_w ~~ t1_pri_con_w
t2_pri_con_w ~~ t2_pri_con_w
t3_pri_con_w ~~ t3_pri_con_w
t1_inf_sha_beh_w ~~ t1_inf_sha_beh_w
t2_inf_sha_beh_w ~~ t2_inf_sha_beh_w
t3_inf_sha_beh_w ~~ t3_inf_sha_beh_w
# within person effects
t2_pri_con_w ~ a1*t1_pri_con_w + a2*t1_inf_sha_beh_w
t2_inf_sha_beh_w ~ b1*t1_pri_con_w + b2*t1_inf_sha_beh_w
t3_pri_con_w ~ a1*t2_pri_con_w + a2*t2_inf_sha_beh_w
t3_inf_sha_beh_w ~ b1*t2_pri_con_w + b2*t2_inf_sha_beh_w
# covariances
pri_con_b ~~ inf_sha_beh_b
t1_pri_con_w ~~ t1_inf_sha_beh_w
t2_pri_con_w ~~ a*t2_inf_sha_beh_w
t3_pri_con_w ~~ a*t3_inf_sha_beh_w
'
fit <- lavaan(model, data = d_wide)
summary(fit, standardized = TRUE, fit.measures = TRUE)
```
#### Model 4
With Factor Scores and Control Variables.
```{r}
model <- '
# between relations
pri_con_b =~ 1*t1_pri_con_fs + 1*t2_pri_con_fs + 1*t3_pri_con_fs
inf_sha_beh_b =~ 1*t1_inf_sha_beh_fs + 1*t2_inf_sha_beh_fs + 1*t3_inf_sha_beh_fs
# intercepts
t1_pri_con_fs ~ 1
t2_pri_con_fs ~ 1
t3_pri_con_fs ~ 1
t1_inf_sha_beh_fs ~ 1
t2_inf_sha_beh_fs ~ 1
t3_inf_sha_beh_fs ~ 1
# within person changes
t1_pri_con_w =~ 1*t1_pri_con_fs
t2_pri_con_w =~ 1*t2_pri_con_fs
t3_pri_con_w =~ 1*t3_pri_con_fs
t1_inf_sha_beh_w =~ 1*t1_inf_sha_beh_fs
t2_inf_sha_beh_w =~ 1*t2_inf_sha_beh_fs
t3_inf_sha_beh_w =~ 1*t3_inf_sha_beh_fs
# estimate variances
pri_con_b ~~ pri_con_b
inf_sha_beh_b ~~ inf_sha_beh_b
t1_pri_con_w ~~ t1_pri_con_w
t2_pri_con_w ~~ t2_pri_con_w
t3_pri_con_w ~~ t3_pri_con_w
t1_inf_sha_beh_w ~~ t1_inf_sha_beh_w
t2_inf_sha_beh_w ~~ t2_inf_sha_beh_w
t3_inf_sha_beh_w ~~ t3_inf_sha_beh_w
# within person effects
t2_pri_con_w ~ a1*t1_pri_con_w + a2*t1_inf_sha_beh_w
t2_inf_sha_beh_w ~ b1*t1_pri_con_w + b2*t1_inf_sha_beh_w
t3_pri_con_w ~ a1*t2_pri_con_w + a2*t2_inf_sha_beh_w
t3_inf_sha_beh_w ~ b1*t2_pri_con_w + b2*t2_inf_sha_beh_w
# covariances
pri_con_b ~~ inf_sha_beh_b
t1_pri_con_w ~~ t1_inf_sha_beh_w
t2_pri_con_w ~~ a*t2_inf_sha_beh_w
t3_pri_con_w ~~ a*t3_inf_sha_beh_w
# control variables
t1_pri_con_fs ~ age + edu_num + male
t2_pri_con_fs ~ age + edu_num + male
t3_pri_con_fs ~ age + edu_num + male
t1_inf_sha_beh_fs ~ age + edu_num + male
t2_inf_sha_beh_fs ~ age + edu_num + male
t3_inf_sha_beh_fs ~ age + edu_num + male
'
fit <- lavaan(model, data = d_wide, missing = "ml")
summary(fit, standardized = TRUE, fit.measures = TRUE)
```
#### Model 5
In this model, we omit all longitudinal paths in order to better estimate the concurrent relations of the variables for _all_ waves (in the regular RI-CLPM, only the relations at wave 1 can be interpreted meaningfully).
```{r }
model <- '
# between relations
pri_con_b =~ 1*t1_pri_con_m + 1*t2_pri_con_m + 1*t3_pri_con_m
inf_sha_beh_b =~ 1*t1_inf_sha_beh_m + 1*t2_inf_sha_beh_m + 1*t3_inf_sha_beh_m
# intercepts
t1_pri_con_m ~ mu1*1
t2_pri_con_m ~ mu2*1
t3_pri_con_m ~ mu3*1
t1_inf_sha_beh_m ~ pi1*1
t2_inf_sha_beh_m ~ pi2*1
t3_inf_sha_beh_m ~ pi3*1
# within person changes
t1_pri_con_w =~ 1*t1_pri_con_m
t2_pri_con_w =~ 1*t2_pri_con_m
t3_pri_con_w =~ 1*t3_pri_con_m
t1_inf_sha_beh_w =~ 1*t1_inf_sha_beh_m
t2_inf_sha_beh_w =~ 1*t2_inf_sha_beh_m
t3_inf_sha_beh_w =~ 1*t3_inf_sha_beh_m
# estimate variances
pri_con_b ~~ pri_con_b
inf_sha_beh_b ~~ inf_sha_beh_b
t1_pri_con_w ~~ t1_pri_con_w
t2_pri_con_w ~~ t2_pri_con_w
t3_pri_con_w ~~ t3_pri_con_w
t1_inf_sha_beh_w ~~ t1_inf_sha_beh_w
t2_inf_sha_beh_w ~~ t2_inf_sha_beh_w
t3_inf_sha_beh_w ~~ t3_inf_sha_beh_w
# covariances
pri_con_b ~~ inf_sha_beh_b
t1_pri_con_w ~~ a*t1_inf_sha_beh_w
t2_pri_con_w ~~ a*t2_inf_sha_beh_w
t3_pri_con_w ~~ a*t3_inf_sha_beh_w
'
fit <- lavaan(model, data = d_wide, missing = "ml")
summary(fit, standardized = TRUE, fit.measures = TRUE)
```
#### Model 6
The same like above, using Factor Scores and control variables.
```{r}
model <- '
# between relations
pri_con_b =~ 1*t1_pri_con_fs + 1*t2_pri_con_fs + 1*t3_pri_con_fs
inf_sha_beh_b =~ 1*t1_inf_sha_beh_fs + 1*t2_inf_sha_beh_fs + 1*t3_inf_sha_beh_fs
# intercepts
t1_pri_con_fs ~ 1
t2_pri_con_fs ~ 1
t3_pri_con_fs ~ 1
t1_inf_sha_beh_fs ~ 1
t2_inf_sha_beh_fs ~ 1
t3_inf_sha_beh_fs ~ 1
# within person changes
t1_pri_con_w =~ 1*t1_pri_con_fs
t2_pri_con_w =~ 1*t2_pri_con_fs
t3_pri_con_w =~ 1*t3_pri_con_fs
t1_inf_sha_beh_w =~ 1*t1_inf_sha_beh_fs
t2_inf_sha_beh_w =~ 1*t2_inf_sha_beh_fs
t3_inf_sha_beh_w =~ 1*t3_inf_sha_beh_fs
# estimate variances
pri_con_b ~~ pri_con_b
inf_sha_beh_b ~~ inf_sha_beh_b
t1_pri_con_w ~~ t1_pri_con_w
t2_pri_con_w ~~ t2_pri_con_w
t3_pri_con_w ~~ t3_pri_con_w
t1_inf_sha_beh_w ~~ t1_inf_sha_beh_w
t2_inf_sha_beh_w ~~ t2_inf_sha_beh_w
t3_inf_sha_beh_w ~~ t3_inf_sha_beh_w
# covariances
pri_con_b ~~ inf_sha_beh_b
t1_pri_con_w ~~ a*t1_inf_sha_beh_w
t2_pri_con_w ~~ a*t2_inf_sha_beh_w
t3_pri_con_w ~~ a*t3_inf_sha_beh_w
# control variables
t1_pri_con_fs ~ age + edu_num + male
t2_pri_con_fs ~ age + edu_num + male
t3_pri_con_fs ~ age + edu_num + male
t1_inf_sha_beh_fs ~ age + edu_num + male
t2_inf_sha_beh_fs ~ age + edu_num + male
t3_inf_sha_beh_fs ~ age + edu_num + male
'
fit <- lavaan(model, data = d_wide, missing = "ml")
summary(fit, standardized = TRUE, fit.measures = TRUE)
```
### Three Variables
#### Model 1
With observed means.
```{r }
model <- '
# random intercepts (between person)
pri_con_b =~ 1*t1_pri_con_m + 1*t2_pri_con_m + 1*t3_pri_con_m
inf_sha_att_b =~ 1*t1_inf_sha_att_m + 1*t2_inf_sha_att_m + 1*t3_inf_sha_att_m
inf_sha_beh_b =~ 1*t1_inf_sha_beh_m + 1*t2_inf_sha_beh_m + 1*t3_inf_sha_beh_m
# within person changes
t1_pri_con_w =~ 1*t1_pri_con_m
t2_pri_con_w =~ 1*t2_pri_con_m
t3_pri_con_w =~ 1*t3_pri_con_m
t1_inf_sha_att_w =~ 1*t1_inf_sha_att_m
t2_inf_sha_att_w =~ 1*t2_inf_sha_att_m
t3_inf_sha_att_w =~ 1*t3_inf_sha_att_m
t1_inf_sha_beh_w =~ 1*t1_inf_sha_beh_m
t2_inf_sha_beh_w =~ 1*t2_inf_sha_beh_m
t3_inf_sha_beh_w =~ 1*t3_inf_sha_beh_m
# within person effects
t2_pri_con_w ~ a1*t1_pri_con_w + a2*t1_inf_sha_att_w + a3*t1_inf_sha_beh_w
t2_inf_sha_att_w ~ b1*t1_pri_con_w + b2*t1_inf_sha_att_w + b3*t1_inf_sha_beh_w
t2_inf_sha_beh_w ~ c1*t1_pri_con_w + c2*t1_inf_sha_att_w + c3*t1_inf_sha_beh_w
t3_pri_con_w ~ a1*t2_pri_con_w + a2*t2_inf_sha_att_w + a3*t2_inf_sha_beh_w
t3_inf_sha_att_w ~ b1*t2_pri_con_w + b2*t2_inf_sha_att_w + b3*t2_inf_sha_beh_w
t3_inf_sha_beh_w ~ c1*t2_pri_con_w + c2*t2_inf_sha_att_w + c3*t2_inf_sha_beh_w
# setting variances of observed variables to zero
t1_pri_con_m ~~ 0*t1_pri_con_m
t2_pri_con_m ~~ 0*t2_pri_con_m
t3_pri_con_m ~~ 0*t3_pri_con_m
t1_inf_sha_att_m ~~ 0*t1_inf_sha_att_m
t2_inf_sha_att_m ~~ 0*t2_inf_sha_att_m
t3_inf_sha_att_m ~~ 0*t3_inf_sha_att_m
t1_inf_sha_beh_m ~~ 0*t1_inf_sha_beh_m
t2_inf_sha_beh_m ~~ 0*t2_inf_sha_beh_m
t3_inf_sha_beh_m ~~ 0*t3_inf_sha_beh_m
# allow covariances RIs & variables measured at the same time
pri_con_b ~~ inf_sha_att_b + inf_sha_beh_b
inf_sha_att_b ~~ inf_sha_beh_b
t1_pri_con_w ~~ t1_inf_sha_att_w + t1_inf_sha_beh_w
t1_inf_sha_att_w ~~ t1_inf_sha_beh_w
t2_pri_con_w ~~ a*t2_inf_sha_att_w + b*t2_inf_sha_beh_w
t2_inf_sha_att_w ~~ c*t2_inf_sha_beh_w
t3_pri_con_w ~~ a*t3_inf_sha_att_w + b*t3_inf_sha_beh_w
t3_inf_sha_att_w ~~ c*t3_inf_sha_beh_w
'
fit <- sem(model, estimator = "ML", data = d_wide, orthogonal = TRUE, missing = "ML")
summary(fit, standardized = TRUE, fit.measures = TRUE, ci = TRUE)
```
#### Model 2
With observed means and control variables.
```{r }
model <- '
# random intercepts (between person)
pri_con_b =~ 1*t1_pri_con_m + 1*t2_pri_con_m + 1*t3_pri_con_m
inf_sha_att_b =~ 1*t1_inf_sha_att_m + 1*t2_inf_sha_att_m + 1*t3_inf_sha_att_m
inf_sha_beh_b =~ 1*t1_inf_sha_beh_m + 1*t2_inf_sha_beh_m + 1*t3_inf_sha_beh_m
# within person changes
t1_pri_con_w =~ 1*t1_pri_con_m
t2_pri_con_w =~ 1*t2_pri_con_m
t3_pri_con_w =~ 1*t3_pri_con_m
t1_inf_sha_att_w =~ 1*t1_inf_sha_att_m
t2_inf_sha_att_w =~ 1*t2_inf_sha_att_m
t3_inf_sha_att_w =~ 1*t3_inf_sha_att_m
t1_inf_sha_beh_w =~ 1*t1_inf_sha_beh_m
t2_inf_sha_beh_w =~ 1*t2_inf_sha_beh_m
t3_inf_sha_beh_w =~ 1*t3_inf_sha_beh_m
# within person effects
t2_pri_con_w ~ a1*t1_pri_con_w + a2*t1_inf_sha_att_w + a3*t1_inf_sha_beh_w
t2_inf_sha_att_w ~ b1*t1_pri_con_w + b2*t1_inf_sha_att_w + b3*t1_inf_sha_beh_w
t2_inf_sha_beh_w ~ c1*t1_pri_con_w + c2*t1_inf_sha_att_w + c3*t1_inf_sha_beh_w
t3_pri_con_w ~ a1*t2_pri_con_w + a2*t2_inf_sha_att_w + a3*t2_inf_sha_beh_w
t3_inf_sha_att_w ~ b1*t2_pri_con_w + b2*t2_inf_sha_att_w + b3*t2_inf_sha_beh_w
t3_inf_sha_beh_w ~ c1*t2_pri_con_w + c2*t2_inf_sha_att_w + c3*t2_inf_sha_beh_w
# setting variances of observed variables to zero
t1_pri_con_m ~~ 0*t1_pri_con_m
t2_pri_con_m ~~ 0*t2_pri_con_m
t3_pri_con_m ~~ 0*t3_pri_con_m
t1_inf_sha_att_m ~~ 0*t1_inf_sha_att_m
t2_inf_sha_att_m ~~ 0*t2_inf_sha_att_m
t3_inf_sha_att_m ~~ 0*t3_inf_sha_att_m
t1_inf_sha_beh_m ~~ 0*t1_inf_sha_beh_m
t2_inf_sha_beh_m ~~ 0*t2_inf_sha_beh_m
t3_inf_sha_beh_m ~~ 0*t3_inf_sha_beh_m
# allow covariances RIs & variables measured at the same time
pri_con_b ~~ inf_sha_att_b + inf_sha_beh_b
inf_sha_att_b ~~ inf_sha_beh_b
t1_pri_con_w ~~ t1_inf_sha_att_w + t1_inf_sha_beh_w
t1_inf_sha_att_w ~~ t1_inf_sha_beh_w
t2_pri_con_w ~~ a*t2_inf_sha_att_w + b*t2_inf_sha_beh_w
t2_inf_sha_att_w ~~ c*t2_inf_sha_beh_w
t3_pri_con_w ~~ a*t3_inf_sha_att_w + b*t3_inf_sha_beh_w
t3_inf_sha_att_w ~~ c*t3_inf_sha_beh_w
# control variables
t1_pri_con_m ~ age + edu_num + male
t2_pri_con_m ~ age + edu_num + male
t3_pri_con_m ~ age + edu_num + male
t1_inf_sha_beh_m ~ age + edu_num + male
t2_inf_sha_beh_m ~ age + edu_num + male
t3_inf_sha_beh_m ~ age + edu_num + male
t1_inf_sha_att_m ~ age + edu_num + male
t2_inf_sha_att_m ~ age + edu_num + male
t3_inf_sha_att_m ~ age + edu_num + male
'
fit <- sem(model, estimator = "ML", data = d_wide, orthogonal = TRUE, missing = "ML")
summary(fit, standardized = TRUE, fit.measures = TRUE, ci = TRUE)
```
#### Model 3
With Factor Scores.
```{r}
model <- '
# between relations
pri_con_b =~ 1*t1_pri_con_fs + 1*t2_pri_con_fs + 1*t3_pri_con_fs
inf_sha_beh_b =~ 1*t1_inf_sha_beh_fs + 1*t2_inf_sha_beh_fs + 1*t3_inf_sha_beh_fs
inf_sha_att_b =~ 1*t1_inf_sha_att_fs + 1*t2_inf_sha_att_fs + 1*t3_inf_sha_att_fs
# within person changes
t1_pri_con_w =~ 1*t1_pri_con_fs
t2_pri_con_w =~ 1*t2_pri_con_fs
t3_pri_con_w =~ 1*t3_pri_con_fs
t1_inf_sha_beh_w =~ 1*t1_inf_sha_beh_fs
t2_inf_sha_beh_w =~ 1*t2_inf_sha_beh_fs
t3_inf_sha_beh_w =~ 1*t3_inf_sha_beh_fs
t1_inf_sha_att_w =~ 1*t1_inf_sha_att_fs
t2_inf_sha_att_w =~ 1*t2_inf_sha_att_fs
t3_inf_sha_att_w =~ 1*t3_inf_sha_att_fs
# within person effects
t2_pri_con_w ~ a1*t1_pri_con_w + a2*t1_inf_sha_att_w + a3*t1_inf_sha_beh_w
t2_inf_sha_att_w ~ b1*t1_pri_con_w + b2*t1_inf_sha_att_w + b3*t1_inf_sha_beh_w
t2_inf_sha_beh_w ~ c1*t1_pri_con_w + c2*t1_inf_sha_att_w + c3*t1_inf_sha_beh_w
t3_pri_con_w ~ a1*t2_pri_con_w + a2*t2_inf_sha_att_w + a3*t2_inf_sha_beh_w
t3_inf_sha_att_w ~ b1*t2_pri_con_w + b2*t2_inf_sha_att_w + b3*t2_inf_sha_beh_w
t3_inf_sha_beh_w ~ c1*t2_pri_con_w + c2*t2_inf_sha_att_w + c3*t2_inf_sha_beh_w
# covariances
pri_con_b ~~ inf_sha_att_b + inf_sha_beh_b
inf_sha_att_b ~~ inf_sha_beh_b
t1_pri_con_w ~~ t1_inf_sha_att_w + t1_inf_sha_beh_w
t1_inf_sha_att_w ~~ t1_inf_sha_beh_w
t2_pri_con_w ~~ a*t2_inf_sha_att_w + b*t2_inf_sha_beh_w
t2_inf_sha_att_w ~~ c*t2_inf_sha_beh_w
t3_pri_con_w ~~ a*t3_inf_sha_att_w + b*t3_inf_sha_beh_w
t3_inf_sha_att_w ~~ c*t3_inf_sha_beh_w
# setting variances of observed variables to zero
t1_pri_con_fs ~~ 0*t1_pri_con_fs
t2_pri_con_fs ~~ 0*t2_pri_con_fs
t3_pri_con_fs ~~ 0*t3_pri_con_fs
t1_inf_sha_att_fs ~~ 0*t1_inf_sha_att_fs
t2_inf_sha_att_fs ~~ 0*t2_inf_sha_att_fs
t3_inf_sha_att_fs ~~ 0*t3_inf_sha_att_fs
t1_inf_sha_beh_fs ~~ 0*t1_inf_sha_beh_fs
t2_inf_sha_beh_fs ~~ 0*t2_inf_sha_beh_fs
t3_inf_sha_beh_fs ~~ 0*t3_inf_sha_beh_fs
'
fit <- sem(model, data = d_wide, orthogonal = TRUE, missing = "ML")
summary(fit, standardized = TRUE, fit.measures = TRUE, ci = TRUE)
```
#### Model 4 (final)
With Factor Scores and control variables. This is the final model we report in the paper.
```{r}
model <- '
# between relations
pri_con_b =~ 1*t1_pri_con_fs + 1*t2_pri_con_fs + 1*t3_pri_con_fs
inf_sha_beh_b =~ 1*t1_inf_sha_beh_fs + 1*t2_inf_sha_beh_fs + 1*t3_inf_sha_beh_fs
inf_sha_att_b =~ 1*t1_inf_sha_att_fs + 1*t2_inf_sha_att_fs + 1*t3_inf_sha_att_fs
# within person changes
t1_pri_con_w =~ 1*t1_pri_con_fs
t2_pri_con_w =~ 1*t2_pri_con_fs
t3_pri_con_w =~ 1*t3_pri_con_fs
t1_inf_sha_beh_w =~ 1*t1_inf_sha_beh_fs
t2_inf_sha_beh_w =~ 1*t2_inf_sha_beh_fs
t3_inf_sha_beh_w =~ 1*t3_inf_sha_beh_fs
t1_inf_sha_att_w =~ 1*t1_inf_sha_att_fs
t2_inf_sha_att_w =~ 1*t2_inf_sha_att_fs
t3_inf_sha_att_w =~ 1*t3_inf_sha_att_fs
# within person effects
t2_pri_con_w ~ a1*t1_pri_con_w + a2*t1_inf_sha_att_w + a3*t1_inf_sha_beh_w
t2_inf_sha_att_w ~ b1*t1_pri_con_w + b2*t1_inf_sha_att_w + b3*t1_inf_sha_beh_w
t2_inf_sha_beh_w ~ c1*t1_pri_con_w + c2*t1_inf_sha_att_w + c3*t1_inf_sha_beh_w
t3_pri_con_w ~ a1*t2_pri_con_w + a2*t2_inf_sha_att_w + a3*t2_inf_sha_beh_w
t3_inf_sha_att_w ~ b1*t2_pri_con_w + b2*t2_inf_sha_att_w + b3*t2_inf_sha_beh_w
t3_inf_sha_beh_w ~ c1*t2_pri_con_w + c2*t2_inf_sha_att_w + c3*t2_inf_sha_beh_w
# covariances
pri_con_b ~~ cor_b_1*inf_sha_att_b + cor_b_2*inf_sha_beh_b
inf_sha_att_b ~~ cor_b_3*inf_sha_beh_b
t1_pri_con_w ~~ cor_w_1*t1_inf_sha_att_w + cor_w_2*t1_inf_sha_beh_w
t1_inf_sha_att_w ~~ cor_w_3*t1_inf_sha_beh_w
t2_pri_con_w ~~ a*t2_inf_sha_att_w + b*t2_inf_sha_beh_w
t2_inf_sha_att_w ~~ c*t2_inf_sha_beh_w
t3_pri_con_w ~~ a*t3_inf_sha_att_w + b*t3_inf_sha_beh_w
t3_inf_sha_att_w ~~ c*t3_inf_sha_beh_w
# setting variances of observed variables to zero
t1_pri_con_fs ~~ 0*t1_pri_con_fs
t2_pri_con_fs ~~ 0*t2_pri_con_fs
t3_pri_con_fs ~~ 0*t3_pri_con_fs
t1_inf_sha_att_fs ~~ 0*t1_inf_sha_att_fs
t2_inf_sha_att_fs ~~ 0*t2_inf_sha_att_fs
t3_inf_sha_att_fs ~~ 0*t3_inf_sha_att_fs
t1_inf_sha_beh_fs ~~ 0*t1_inf_sha_beh_fs
t2_inf_sha_beh_fs ~~ 0*t2_inf_sha_beh_fs
t3_inf_sha_beh_fs ~~ 0*t3_inf_sha_beh_fs
# control variables
t1_pri_con_fs ~ age + edu_num + male
t2_pri_con_fs ~ age + edu_num + male
t3_pri_con_fs ~ age + edu_num + male
t1_inf_sha_beh_fs ~ age + edu_num + male
t2_inf_sha_beh_fs ~ age + edu_num + male
t3_inf_sha_beh_fs ~ age + edu_num + male
t1_inf_sha_att_fs ~ age + edu_num + male
t2_inf_sha_att_fs ~ age + edu_num + male
t3_inf_sha_att_fs ~ age + edu_num + male
'
fit <- sem(model, data = d_wide, orthogonal = TRUE, missing = "ML")
summary(fit, standardized = TRUE, fit.measures = TRUE, ci = TRUE)
fit_riclpm <- fit
effect_std_ci <- standardizedsolution(fit) %>%
filter(lhs == "pri_con_b", rhs == "inf_sha_beh_b")
```
#### Model 5
Same model, but with unconstrained effects. That way, we can empirically test the assumption whether effects have changed over time.
With Factor Scores, control variables, and 4 waves / 1 year intervals
```{r}
model_free <- '
# between relations
pri_con_b =~ 1*t1_pri_con_fs + 1*t2_pri_con_fs + 1*t3_pri_con_fs
inf_sha_beh_b =~ 1*t1_inf_sha_beh_fs + 1*t2_inf_sha_beh_fs + 1*t3_inf_sha_beh_fs
inf_sha_att_b =~ 1*t1_inf_sha_att_fs + 1*t2_inf_sha_att_fs + 1*t3_inf_sha_att_fs
# within person changes
t1_pri_con_w =~ 1*t1_pri_con_fs
t2_pri_con_w =~ 1*t2_pri_con_fs
t3_pri_con_w =~ 1*t3_pri_con_fs
t1_inf_sha_beh_w =~ 1*t1_inf_sha_beh_fs
t2_inf_sha_beh_w =~ 1*t2_inf_sha_beh_fs
t3_inf_sha_beh_w =~ 1*t3_inf_sha_beh_fs
t1_inf_sha_att_w =~ 1*t1_inf_sha_att_fs
t2_inf_sha_att_w =~ 1*t2_inf_sha_att_fs
t3_inf_sha_att_w =~ 1*t3_inf_sha_att_fs
# within person effects
t2_pri_con_w ~ a1*t1_pri_con_w + t1_inf_sha_att_w + t1_inf_sha_beh_w
t2_inf_sha_att_w ~ t1_pri_con_w + b2*t1_inf_sha_att_w + t1_inf_sha_beh_w
t2_inf_sha_beh_w ~ t1_pri_con_w + t1_inf_sha_att_w + c3*t1_inf_sha_beh_w
t3_pri_con_w ~ a1*t2_pri_con_w + t2_inf_sha_att_w + t2_inf_sha_beh_w
t3_inf_sha_att_w ~ t2_pri_con_w + b2*t2_inf_sha_att_w + t2_inf_sha_beh_w
t3_inf_sha_beh_w ~ t2_pri_con_w + t2_inf_sha_att_w + c3*t2_inf_sha_beh_w
# covariances
pri_con_b ~~ cor_b_1*inf_sha_att_b + cor_b_2*inf_sha_beh_b
inf_sha_att_b ~~ cor_b_3*inf_sha_beh_b
t1_pri_con_w ~~ cor_w_1*t1_inf_sha_att_w + cor_w_2*t1_inf_sha_beh_w
t1_inf_sha_att_w ~~ cor_w_3*t1_inf_sha_beh_w
t2_pri_con_w ~~ t2_inf_sha_att_w + t2_inf_sha_beh_w
t2_inf_sha_att_w ~~ t2_inf_sha_beh_w
t3_pri_con_w ~~ t3_inf_sha_att_w + t3_inf_sha_beh_w
t3_inf_sha_att_w ~~ t3_inf_sha_beh_w
# setting variances of observed variables to zero
t1_pri_con_fs ~~ 0*t1_pri_con_fs
t2_pri_con_fs ~~ 0*t2_pri_con_fs
t3_pri_con_fs ~~ 0*t3_pri_con_fs
t1_inf_sha_att_fs ~~ 0*t1_inf_sha_att_fs
t2_inf_sha_att_fs ~~ 0*t2_inf_sha_att_fs
t3_inf_sha_att_fs ~~ 0*t3_inf_sha_att_fs
t1_inf_sha_beh_fs ~~ 0*t1_inf_sha_beh_fs
t2_inf_sha_beh_fs ~~ 0*t2_inf_sha_beh_fs
t3_inf_sha_beh_fs ~~ 0*t3_inf_sha_beh_fs
# control variables
t1_pri_con_fs ~ age + edu_num + male
t2_pri_con_fs ~ age + edu_num + male
t3_pri_con_fs ~ age + edu_num + male
t1_inf_sha_beh_fs ~ age + edu_num + male
t2_inf_sha_beh_fs ~ age + edu_num + male
t3_inf_sha_beh_fs ~ age + edu_num + male
t1_inf_sha_att_fs ~ age + edu_num + male
t2_inf_sha_att_fs ~ age + edu_num + male
t3_inf_sha_att_fs ~ age + edu_num + male
'
fit_free <- sem(model_free, data = d_wide, orthogonal = TRUE, missing = "ML")
summary(fit_free, standardized = TRUE, fit.measures = TRUE, ci = TRUE)
effect_std_ci_free <- standardizedsolution(fit) %>%
filter(lhs == "pri_con_b", rhs == "inf_sha_beh_b")
# model comparison
(model_comp <- anova(fit_riclpm, fit_free))
```
Shows that model with freely estimated parameters does not show significantly improved fit.
#### Model 6
```{r}
model <- '
# between relations
pri_con_b =~ 1*t1_pri_con_m + 1*t3_pri_con_m + 1*t4_pri_con_m + 1*t5_pri_con_m
inf_sha_beh_b =~ 1*t1_inf_sha_beh_m + 1*t3_inf_sha_beh_m + 1*t4_inf_sha_beh_m + 1*t5_inf_sha_beh_m
inf_sha_att_b =~ 1*t1_inf_sha_att_m + 1*t3_inf_sha_att_m + 1*t4_inf_sha_att_m + 1*t5_inf_sha_att_m
# within person changes
t1_pri_con_w =~ 1*t1_pri_con_m
t3_pri_con_w =~ 1*t3_pri_con_m
t4_pri_con_w =~ 1*t4_pri_con_m
t5_pri_con_w =~ 1*t5_pri_con_m
t1_inf_sha_beh_w =~ 1*t1_inf_sha_beh_m
t3_inf_sha_beh_w =~ 1*t3_inf_sha_beh_m
t4_inf_sha_beh_w =~ 1*t4_inf_sha_beh_m
t5_inf_sha_beh_w =~ 1*t5_inf_sha_beh_m
t1_inf_sha_att_w =~ 1*t1_inf_sha_att_m
t3_inf_sha_att_w =~ 1*t3_inf_sha_att_m
t4_inf_sha_att_w =~ 1*t4_inf_sha_att_m
t5_inf_sha_att_w =~ 1*t5_inf_sha_att_m
# within person effects
t3_pri_con_w ~ a1*t1_pri_con_w + a2*t1_inf_sha_att_w + a3*t1_inf_sha_beh_w
t3_inf_sha_att_w ~ b1*t1_pri_con_w + b2*t1_inf_sha_att_w + b3*t1_inf_sha_beh_w
t3_inf_sha_beh_w ~ c1*t1_pri_con_w + c2*t1_inf_sha_att_w + c3*t1_inf_sha_beh_w
t4_pri_con_w ~ a1*t3_pri_con_w + a2*t3_inf_sha_att_w + a3*t3_inf_sha_beh_w
t4_inf_sha_att_w ~ b1*t3_pri_con_w + b2*t3_inf_sha_att_w + b3*t3_inf_sha_beh_w
t4_inf_sha_beh_w ~ c1*t3_pri_con_w + c2*t3_inf_sha_att_w + c3*t3_inf_sha_beh_w
t5_pri_con_w ~ a1*t4_pri_con_w + a2*t4_inf_sha_att_w + a3*t4_inf_sha_beh_w
t5_inf_sha_att_w ~ b1*t4_pri_con_w + b2*t4_inf_sha_att_w + b3*t4_inf_sha_beh_w
t5_inf_sha_beh_w ~ c1*t4_pri_con_w + c2*t4_inf_sha_att_w + c3*t4_inf_sha_beh_w
# covariances
pri_con_b ~~ inf_sha_att_b + inf_sha_beh_b
inf_sha_att_b ~~ inf_sha_beh_b
t1_pri_con_w ~~ t1_inf_sha_att_w + t1_inf_sha_beh_w
t1_inf_sha_att_w ~~ t1_inf_sha_beh_w
t3_pri_con_w ~~ a*t3_inf_sha_att_w + b*t3_inf_sha_beh_w
t3_inf_sha_att_w ~~ c*t3_inf_sha_beh_w
t4_pri_con_w ~~ a*t4_inf_sha_att_w + b*t4_inf_sha_beh_w
t4_inf_sha_att_w ~~ c*t4_inf_sha_beh_w
t5_pri_con_w ~~ a*t5_inf_sha_att_w + b*t5_inf_sha_beh_w
t5_inf_sha_att_w ~~ c*t5_inf_sha_beh_w
# setting variances of observed variables to zero
t1_pri_con_m ~~ 0*t1_pri_con_m
t3_pri_con_m ~~ 0*t3_pri_con_m
t4_pri_con_m ~~ 0*t4_pri_con_m
t5_pri_con_m ~~ 0*t5_pri_con_m
t1_inf_sha_att_m ~~ 0*t1_inf_sha_att_m
t3_inf_sha_att_m ~~ 0*t3_inf_sha_att_m
t4_inf_sha_att_m ~~ 0*t4_inf_sha_att_m
t5_inf_sha_att_m ~~ 0*t5_inf_sha_att_m
t1_inf_sha_beh_m ~~ 0*t1_inf_sha_beh_m
t3_inf_sha_beh_m ~~ 0*t3_inf_sha_beh_m
t4_inf_sha_beh_m ~~ 0*t4_inf_sha_beh_m
t5_inf_sha_beh_m ~~ 0*t5_inf_sha_beh_m
# control variables
t1_pri_con_m ~ age + edu_num + male
t3_pri_con_m ~ age + edu_num + male
t4_pri_con_m ~ age + edu_num + male
t5_pri_con_m ~ age + edu_num + male
t1_inf_sha_beh_m ~ age + edu_num + male
t3_inf_sha_beh_m ~ age + edu_num + male
t4_inf_sha_beh_m ~ age + edu_num + male
t5_inf_sha_beh_m ~ age + edu_num + male
t1_inf_sha_att_m ~ age + edu_num + male
t3_inf_sha_att_m ~ age + edu_num + male
t4_inf_sha_att_m ~ age + edu_num + male
t5_inf_sha_att_m ~ age + edu_num + male
'
fit <- sem(model, data = d_wide_all, orthogonal = TRUE, missing = "ML")
summary(fit, standardized = TRUE, fit.measures = TRUE, ci = TRUE)
```
#### Model 7 (longer intervals)
This is like the final model reported in the paper, but with other, that is longer, intervals. Now, waves are separated by 1 year and span until 2018.
We first need to redo the factor scores, because we now have a different sample.
Specifically, we first estimate a model containing all measures, which is then used to extract factor scores.
```{r CFA_All}
name <- "all_vars"
model <- '
# Privacy Concerns
# create factors
t1_pri_con_f =~ 1*t1_pri_con_f1 + a2*t1_pri_con_f2
t3_pri_con_f =~ 1*t3_pri_con_f1 + a2*t3_pri_con_f2
t4_pri_con_f =~ 1*t4_pri_con_f1 + a2*t4_pri_con_f2
t5_pri_con_f =~ 1*t5_pri_con_f1 + a2*t5_pri_con_f2
t1_pri_con_f1 =~ 1*t1_pri_con_04 + b2*t1_pri_con_05 + b3*t1_pri_con_06
t1_pri_con_f2 =~ 1*t1_pri_con_07 + c2*t1_pri_con_08 + c3*t1_pri_con_09
t3_pri_con_f1 =~ 1*t3_pri_con_04 + b2*t3_pri_con_05 + b3*t3_pri_con_06
t3_pri_con_f2 =~ 1*t3_pri_con_07 + c2*t3_pri_con_08 + c3*t3_pri_con_09
t4_pri_con_f1 =~ 1*t4_pri_con_04 + b2*t4_pri_con_05 + b3*t4_pri_con_06
t4_pri_con_f2 =~ 1*t4_pri_con_07 + c2*t4_pri_con_08 + c3*t4_pri_con_09
t5_pri_con_f1 =~ 1*t5_pri_con_04 + b2*t5_pri_con_05 + b3*t5_pri_con_06
t5_pri_con_f2 =~ 1*t5_pri_con_07 + c2*t5_pri_con_08 + c3*t5_pri_con_09
# error covariances
t5_pri_con_04 ~~ t4_pri_con_04 + t3_pri_con_04 + t1_pri_con_04
t5_pri_con_05 ~~ t4_pri_con_05 + t3_pri_con_05 + t1_pri_con_05
t5_pri_con_06 ~~ t4_pri_con_06 + t3_pri_con_06 + t1_pri_con_06
t5_pri_con_07 ~~ t4_pri_con_07 + t3_pri_con_07 + t1_pri_con_07
t5_pri_con_08 ~~ t4_pri_con_08 + t3_pri_con_08 + t1_pri_con_08
t5_pri_con_09 ~~ t4_pri_con_09 + t3_pri_con_09 + t1_pri_con_09
t4_pri_con_04 ~~ t3_pri_con_04 + t1_pri_con_04
t4_pri_con_05 ~~ t3_pri_con_05 + t1_pri_con_05
t4_pri_con_06 ~~ t3_pri_con_06 + t1_pri_con_06
t4_pri_con_07 ~~ t3_pri_con_07 + t1_pri_con_07
t4_pri_con_08 ~~ t3_pri_con_08 + t1_pri_con_08
t4_pri_con_09 ~~ t3_pri_con_09 + t1_pri_con_09
t3_pri_con_04 ~~ t1_pri_con_04
t3_pri_con_05 ~~ t1_pri_con_05
t3_pri_con_06 ~~ t1_pri_con_06
t3_pri_con_07 ~~ t1_pri_con_07
t3_pri_con_08 ~~ t1_pri_con_08
t3_pri_con_09 ~~ t1_pri_con_09
# factor covariances
t5_pri_con_f ~~ t1_pri_con_f + t3_pri_con_f + t4_pri_con_f
t1_pri_con_f ~~ t3_pri_con_f + t4_pri_con_f
t3_pri_con_f ~~ t4_pri_con_f
# Information Sharing Attitude
# create factors
t1_inf_sha_att_f =~ 1*t1_inf_sha_att_f1 + d2*t1_inf_sha_att_f2 + d3*t1_inf_sha_att_f3 + d4*t1_inf_sha_att_f4 + d5*t1_inf_sha_att_f5
t3_inf_sha_att_f =~ 1*t3_inf_sha_att_f1 + d2*t3_inf_sha_att_f2 + d3*t3_inf_sha_att_f3 + d4*t3_inf_sha_att_f4 + d5*t3_inf_sha_att_f5
t4_inf_sha_att_f =~ 1*t4_inf_sha_att_f1 + d2*t4_inf_sha_att_f2 + d3*t4_inf_sha_att_f3 + d4*t4_inf_sha_att_f4 + d5*t4_inf_sha_att_f5
t5_inf_sha_att_f =~ 1*t5_inf_sha_att_f1 + d2*t5_inf_sha_att_f2 + d3*t5_inf_sha_att_f3 + d4*t5_inf_sha_att_f4 + d5*t5_inf_sha_att_f5
t1_inf_sha_att_f1 =~ 1*t1_inf_sha_att_01 + e*t1_inf_sha_att_02
t1_inf_sha_att_f2 =~ 1*t1_inf_sha_att_03 + f*t1_inf_sha_att_04
t1_inf_sha_att_f3 =~ 1*t1_inf_sha_att_05 + g*t1_inf_sha_att_06
t1_inf_sha_att_f4 =~ 1*t1_inf_sha_att_07 + h*t1_inf_sha_att_08
t1_inf_sha_att_f5 =~ 1*t1_inf_sha_att_10 + i*t1_inf_sha_att_11
t3_inf_sha_att_f1 =~ 1*t3_inf_sha_att_01 + e*t3_inf_sha_att_02
t3_inf_sha_att_f2 =~ 1*t3_inf_sha_att_03 + f*t3_inf_sha_att_04
t3_inf_sha_att_f3 =~ 1*t3_inf_sha_att_05 + g*t3_inf_sha_att_06
t3_inf_sha_att_f4 =~ 1*t3_inf_sha_att_07 + h*t3_inf_sha_att_08
t3_inf_sha_att_f5 =~ 1*t3_inf_sha_att_10 + i*t3_inf_sha_att_11
t4_inf_sha_att_f1 =~ 1*t4_inf_sha_att_01 + e*t4_inf_sha_att_02
t4_inf_sha_att_f2 =~ 1*t4_inf_sha_att_03 + f*t4_inf_sha_att_04
t4_inf_sha_att_f3 =~ 1*t4_inf_sha_att_05 + g*t4_inf_sha_att_06
t4_inf_sha_att_f4 =~ 1*t4_inf_sha_att_07 + h*t4_inf_sha_att_08
t4_inf_sha_att_f5 =~ 1*t4_inf_sha_att_10 + i*t4_inf_sha_att_11
t5_inf_sha_att_f1 =~ 1*t5_inf_sha_att_01 + e*t5_inf_sha_att_02
t5_inf_sha_att_f2 =~ 1*t5_inf_sha_att_03 + f*t5_inf_sha_att_04
t5_inf_sha_att_f3 =~ 1*t5_inf_sha_att_05 + g*t5_inf_sha_att_06
t5_inf_sha_att_f4 =~ 1*t5_inf_sha_att_07 + h*t5_inf_sha_att_08
t5_inf_sha_att_f5 =~ 1*t5_inf_sha_att_10 + i*t5_inf_sha_att_11
# factor covariance
t5_inf_sha_att_f ~~ t1_inf_sha_att_f + t3_inf_sha_att_f + t4_inf_sha_att_f
t1_inf_sha_att_f ~~ t3_inf_sha_att_f + t4_inf_sha_att_f
t3_inf_sha_att_f ~~ t4_inf_sha_att_f
# item error covariance
t5_inf_sha_att_01 ~~ t1_inf_sha_att_01 + t3_inf_sha_att_01 + t4_inf_sha_att_01
t1_inf_sha_att_01 ~~ t3_inf_sha_att_01 + t4_inf_sha_att_01
t3_inf_sha_att_01 ~~ t4_inf_sha_att_01
t5_inf_sha_att_02 ~~ t1_inf_sha_att_02 + t3_inf_sha_att_02 + t4_inf_sha_att_02
t1_inf_sha_att_02 ~~ t3_inf_sha_att_02 + t4_inf_sha_att_02
t3_inf_sha_att_02 ~~ t4_inf_sha_att_02
t5_inf_sha_att_03 ~~ t1_inf_sha_att_03 + t3_inf_sha_att_03 + t4_inf_sha_att_03
t1_inf_sha_att_03 ~~ t3_inf_sha_att_03 + t4_inf_sha_att_03
t3_inf_sha_att_03 ~~ t4_inf_sha_att_03
t5_inf_sha_att_04 ~~ t1_inf_sha_att_04 + t3_inf_sha_att_04 + t4_inf_sha_att_04
t1_inf_sha_att_04 ~~ t3_inf_sha_att_04 + t4_inf_sha_att_04
t3_inf_sha_att_04 ~~ t4_inf_sha_att_04
t5_inf_sha_att_05 ~~ t1_inf_sha_att_05 + t3_inf_sha_att_05 + t4_inf_sha_att_05
t1_inf_sha_att_05 ~~ t3_inf_sha_att_05 + t4_inf_sha_att_05
t3_inf_sha_att_05 ~~ t4_inf_sha_att_05
t5_inf_sha_att_06 ~~ t1_inf_sha_att_06 + t3_inf_sha_att_06 + t4_inf_sha_att_06
t1_inf_sha_att_06 ~~ t3_inf_sha_att_06 + t4_inf_sha_att_06
t3_inf_sha_att_06 ~~ t4_inf_sha_att_06
t5_inf_sha_att_07 ~~ t1_inf_sha_att_07 + t3_inf_sha_att_07 + t4_inf_sha_att_07
t1_inf_sha_att_07 ~~ t3_inf_sha_att_07 + t4_inf_sha_att_07
t3_inf_sha_att_07 ~~ t4_inf_sha_att_07
t5_inf_sha_att_08 ~~ t1_inf_sha_att_08 + t3_inf_sha_att_08 + t4_inf_sha_att_08
t1_inf_sha_att_08 ~~ t3_inf_sha_att_08 + t4_inf_sha_att_08
t3_inf_sha_att_08 ~~ t4_inf_sha_att_08
t5_inf_sha_att_10 ~~ t1_inf_sha_att_10 + t3_inf_sha_att_10 + t4_inf_sha_att_10
t1_inf_sha_att_10 ~~ t3_inf_sha_att_10 + t4_inf_sha_att_10
t3_inf_sha_att_10 ~~ t4_inf_sha_att_10
t5_inf_sha_att_11 ~~ t1_inf_sha_att_11 + t3_inf_sha_att_11 + t4_inf_sha_att_11
t1_inf_sha_att_11 ~~ t3_inf_sha_att_11 + t4_inf_sha_att_11
t3_inf_sha_att_11 ~~ t4_inf_sha_att_11
# information sharing behavior
# create factors
t1_inf_sha_beh_f =~ 1*t1_inf_sha_beh_f1 + o2*t1_inf_sha_beh_f2 + o3*t1_inf_sha_beh_f3 + o4*t1_inf_sha_beh_f4 + o5*t1_inf_sha_beh_f5
t3_inf_sha_beh_f =~ 1*t3_inf_sha_beh_f1 + o2*t3_inf_sha_beh_f2 + o3*t3_inf_sha_beh_f3 + o4*t3_inf_sha_beh_f4 + o5*t3_inf_sha_beh_f5
t4_inf_sha_beh_f =~ 1*t4_inf_sha_beh_f1 + o2*t4_inf_sha_beh_f2 + o3*t4_inf_sha_beh_f3 + o4*t4_inf_sha_beh_f4 + o5*t4_inf_sha_beh_f5
t5_inf_sha_beh_f =~ 1*t5_inf_sha_beh_f1 + o2*t5_inf_sha_beh_f2 + o3*t5_inf_sha_beh_f3 + o4*t5_inf_sha_beh_f4 + o5*t5_inf_sha_beh_f5
t1_inf_sha_beh_f1 =~ 1*t1_inf_sha_beh_01 + j2*t1_inf_sha_beh_02
t1_inf_sha_beh_f2 =~ 1*t1_inf_sha_beh_03 + k2*t1_inf_sha_beh_04
t1_inf_sha_beh_f3 =~ 1*t1_inf_sha_beh_05 + l2*t1_inf_sha_beh_06
t1_inf_sha_beh_f4 =~ 1*t1_inf_sha_beh_07 + m2*t1_inf_sha_beh_08
t1_inf_sha_beh_f5 =~ 1*t1_inf_sha_beh_10 + n2*t1_inf_sha_beh_11
t3_inf_sha_beh_f1 =~ 1*t3_inf_sha_beh_01 + j2*t3_inf_sha_beh_02
t3_inf_sha_beh_f2 =~ 1*t3_inf_sha_beh_03 + k2*t3_inf_sha_beh_04
t3_inf_sha_beh_f3 =~ 1*t3_inf_sha_beh_05 + l2*t3_inf_sha_beh_06
t3_inf_sha_beh_f4 =~ 1*t3_inf_sha_beh_07 + m2*t3_inf_sha_beh_08
t3_inf_sha_beh_f5 =~ 1*t3_inf_sha_beh_10 + n2*t3_inf_sha_beh_11
t4_inf_sha_beh_f1 =~ 1*t4_inf_sha_beh_01 + j2*t4_inf_sha_beh_02
t4_inf_sha_beh_f2 =~ 1*t4_inf_sha_beh_03 + k2*t4_inf_sha_beh_04
t4_inf_sha_beh_f3 =~ 1*t4_inf_sha_beh_05 + l2*t4_inf_sha_beh_06
t4_inf_sha_beh_f4 =~ 1*t4_inf_sha_beh_07 + m2*t4_inf_sha_beh_08
t4_inf_sha_beh_f5 =~ 1*t4_inf_sha_beh_10 + n2*t4_inf_sha_beh_11
t5_inf_sha_beh_f1 =~ 1*t5_inf_sha_beh_01 + j2*t5_inf_sha_beh_02
t5_inf_sha_beh_f2 =~ 1*t5_inf_sha_beh_03 + k2*t5_inf_sha_beh_04
t5_inf_sha_beh_f3 =~ 1*t5_inf_sha_beh_05 + l2*t5_inf_sha_beh_06
t5_inf_sha_beh_f4 =~ 1*t5_inf_sha_beh_07 + m2*t5_inf_sha_beh_08
t5_inf_sha_beh_f5 =~ 1*t5_inf_sha_beh_10 + n2*t5_inf_sha_beh_11
# factor covariance
t5_inf_sha_beh_f ~~ t1_inf_sha_beh_f + t3_inf_sha_beh_f + t4_inf_sha_beh_f
t1_inf_sha_beh_f ~~ t3_inf_sha_beh_f + t4_inf_sha_beh_f
t3_inf_sha_beh_f ~~ t4_inf_sha_beh_f
# item error covariance
t5_inf_sha_beh_01 ~~ t1_inf_sha_beh_01 + t3_inf_sha_beh_01 + t4_inf_sha_beh_01
t1_inf_sha_beh_01 ~~ t3_inf_sha_beh_01 + t4_inf_sha_beh_01
t3_inf_sha_beh_01 ~~ t4_inf_sha_beh_01
t5_inf_sha_beh_02 ~~ t1_inf_sha_beh_02 + t3_inf_sha_beh_02 + t4_inf_sha_beh_02
t1_inf_sha_beh_02 ~~ t3_inf_sha_beh_02 + t4_inf_sha_beh_02
t3_inf_sha_beh_02 ~~ t4_inf_sha_beh_02
t5_inf_sha_beh_03 ~~ t1_inf_sha_beh_03 + t3_inf_sha_beh_03 + t4_inf_sha_beh_03
t1_inf_sha_beh_03 ~~ t3_inf_sha_beh_03 + t4_inf_sha_beh_03
t3_inf_sha_beh_03 ~~ t4_inf_sha_beh_03
t5_inf_sha_beh_04 ~~ t1_inf_sha_beh_04 + t3_inf_sha_beh_04 + t4_inf_sha_beh_04
t1_inf_sha_beh_04 ~~ t3_inf_sha_beh_04 + t4_inf_sha_beh_04
t3_inf_sha_beh_04 ~~ t4_inf_sha_beh_04
t5_inf_sha_beh_05 ~~ t1_inf_sha_beh_05 + t3_inf_sha_beh_05 + t4_inf_sha_beh_05
t1_inf_sha_beh_05 ~~ t3_inf_sha_beh_05 + t4_inf_sha_beh_05
t3_inf_sha_beh_05 ~~ t4_inf_sha_beh_05
t5_inf_sha_beh_06 ~~ t1_inf_sha_beh_06 + t3_inf_sha_beh_06 + t4_inf_sha_beh_06
t1_inf_sha_beh_06 ~~ t3_inf_sha_beh_06 + t4_inf_sha_beh_06
t3_inf_sha_beh_06 ~~ t4_inf_sha_beh_06
t5_inf_sha_beh_07 ~~ t1_inf_sha_beh_07 + t3_inf_sha_beh_07 + t4_inf_sha_beh_07
t1_inf_sha_beh_07 ~~ t3_inf_sha_beh_07 + t4_inf_sha_beh_07
t3_inf_sha_beh_07 ~~ t4_inf_sha_beh_07
t5_inf_sha_beh_08 ~~ t1_inf_sha_beh_08 + t3_inf_sha_beh_08 + t4_inf_sha_beh_08
t1_inf_sha_beh_08 ~~ t3_inf_sha_beh_08 + t4_inf_sha_beh_08
t3_inf_sha_beh_08 ~~ t4_inf_sha_beh_08
t5_inf_sha_beh_10 ~~ t1_inf_sha_beh_10 + t3_inf_sha_beh_10 + t4_inf_sha_beh_10
t1_inf_sha_beh_10 ~~ t3_inf_sha_beh_10 + t4_inf_sha_beh_10
t3_inf_sha_beh_10 ~~ t4_inf_sha_beh_10
t5_inf_sha_beh_11 ~~ t1_inf_sha_beh_11 + t3_inf_sha_beh_11 + t4_inf_sha_beh_11
t1_inf_sha_beh_11 ~~ t3_inf_sha_beh_11 + t4_inf_sha_beh_11
t3_inf_sha_beh_11 ~~ t4_inf_sha_beh_11
## Correlations Attitude and Behavior-Items
t1_inf_sha_beh_01 ~~ t1_inf_sha_att_01
t1_inf_sha_beh_02 ~~ t1_inf_sha_att_02
t1_inf_sha_beh_03 ~~ t1_inf_sha_att_03
t1_inf_sha_beh_04 ~~ t1_inf_sha_att_04
t1_inf_sha_beh_05 ~~ t1_inf_sha_att_05
t1_inf_sha_beh_06 ~~ t1_inf_sha_att_06
t1_inf_sha_beh_07 ~~ t1_inf_sha_att_07
t1_inf_sha_beh_08 ~~ t1_inf_sha_att_08
t1_inf_sha_beh_10 ~~ t1_inf_sha_att_10
t1_inf_sha_beh_11 ~~ t1_inf_sha_att_11
t3_inf_sha_beh_01 ~~ t3_inf_sha_att_01
t3_inf_sha_beh_02 ~~ t3_inf_sha_att_02
t3_inf_sha_beh_03 ~~ t3_inf_sha_att_03
t3_inf_sha_beh_04 ~~ t3_inf_sha_att_04
t3_inf_sha_beh_05 ~~ t3_inf_sha_att_05
t3_inf_sha_beh_06 ~~ t3_inf_sha_att_06
t3_inf_sha_beh_07 ~~ t3_inf_sha_att_07
t3_inf_sha_beh_08 ~~ t3_inf_sha_att_08
t3_inf_sha_beh_10 ~~ t3_inf_sha_att_10
t3_inf_sha_beh_11 ~~ t3_inf_sha_att_11
t4_inf_sha_beh_01 ~~ t4_inf_sha_att_01
t4_inf_sha_beh_02 ~~ t4_inf_sha_att_02
t4_inf_sha_beh_03 ~~ t4_inf_sha_att_03
t4_inf_sha_beh_04 ~~ t4_inf_sha_att_04
t4_inf_sha_beh_05 ~~ t4_inf_sha_att_05
t4_inf_sha_beh_06 ~~ t4_inf_sha_att_06
t4_inf_sha_beh_07 ~~ t4_inf_sha_att_07
t4_inf_sha_beh_08 ~~ t4_inf_sha_att_08
t4_inf_sha_beh_10 ~~ t4_inf_sha_att_10
t4_inf_sha_beh_11 ~~ t4_inf_sha_att_11
t5_inf_sha_beh_01 ~~ t5_inf_sha_att_01
t5_inf_sha_beh_02 ~~ t5_inf_sha_att_02
t5_inf_sha_beh_03 ~~ t5_inf_sha_att_03
t5_inf_sha_beh_04 ~~ t5_inf_sha_att_04
t5_inf_sha_beh_05 ~~ t5_inf_sha_att_05
t5_inf_sha_beh_06 ~~ t5_inf_sha_att_06
t5_inf_sha_beh_07 ~~ t5_inf_sha_att_07
t5_inf_sha_beh_08 ~~ t5_inf_sha_att_08
t5_inf_sha_beh_10 ~~ t5_inf_sha_att_10
t5_inf_sha_beh_11 ~~ t5_inf_sha_att_11
'
assign(paste("fit", name, sep = "_"), cfa(model, d_wide_all, missing = "ML"))
summary(get(paste("fit", name, sep = "_")), standardized = TRUE, fit.measures = TRUE)
```
Extract factor scores.
```{r}
d_fs_all <- lavPredict(get(paste("fit", name, sep = "_")), type = "ov") %>%
as.data.frame() %>%
mutate(t1_pri_con_fs = rowMeans(select(., starts_with("t1_pri"))),
t3_pri_con_fs = rowMeans(select(., starts_with("t3_pri"))),
t4_pri_con_fs = rowMeans(select(., starts_with("t4_pri"))),
t5_pri_con_fs = rowMeans(select(., starts_with("t5_pri"))),
t1_inf_sha_att_fs = rowMeans(select(., starts_with("t1_inf_sha_att"))),
t3_inf_sha_att_fs = rowMeans(select(., starts_with("t3_inf_sha_att"))),
t4_inf_sha_att_fs = rowMeans(select(., starts_with("t4_inf_sha_att"))),
t5_inf_sha_att_fs = rowMeans(select(., starts_with("t5_inf_sha_att"))),
t1_inf_sha_beh_fs = rowMeans(select(., starts_with("t1_inf_sha_beh"))),
t3_inf_sha_beh_fs = rowMeans(select(., starts_with("t3_inf_sha_beh"))),
t4_inf_sha_beh_fs = rowMeans(select(., starts_with("t4_inf_sha_beh"))),
t5_inf_sha_beh_fs = rowMeans(select(., starts_with("t5_inf_sha_beh")))
) %>%
select(contains("_fs"))
d_wide_all <- cbind(d_fs_all, d_wide_all)
```
Run new model.
```{r}
model <- '
# between relations
pri_con_b =~ 1*t1_pri_con_fs + 1*t3_pri_con_fs + 1*t4_pri_con_fs + 1*t5_pri_con_fs
inf_sha_beh_b =~ 1*t1_inf_sha_beh_fs + 1*t3_inf_sha_beh_fs + 1*t4_inf_sha_beh_fs + 1*t5_inf_sha_beh_fs
inf_sha_att_b =~ 1*t1_inf_sha_att_fs + 1*t3_inf_sha_att_fs + 1*t4_inf_sha_att_fs + 1*t5_inf_sha_att_fs
# within person changes
t1_pri_con_w =~ 1*t1_pri_con_fs
t3_pri_con_w =~ 1*t3_pri_con_fs
t4_pri_con_w =~ 1*t4_pri_con_fs
t5_pri_con_w =~ 1*t5_pri_con_fs
t1_inf_sha_beh_w =~ 1*t1_inf_sha_beh_fs
t3_inf_sha_beh_w =~ 1*t3_inf_sha_beh_fs
t4_inf_sha_beh_w =~ 1*t4_inf_sha_beh_fs
t5_inf_sha_beh_w =~ 1*t5_inf_sha_beh_fs
t1_inf_sha_att_w =~ 1*t1_inf_sha_att_fs
t3_inf_sha_att_w =~ 1*t3_inf_sha_att_fs
t4_inf_sha_att_w =~ 1*t4_inf_sha_att_fs
t5_inf_sha_att_w =~ 1*t5_inf_sha_att_fs
# within person effects
t3_pri_con_w ~ a1*t1_pri_con_w + a2*t1_inf_sha_att_w + a3*t1_inf_sha_beh_w
t3_inf_sha_att_w ~ b1*t1_pri_con_w + b2*t1_inf_sha_att_w + b3*t1_inf_sha_beh_w
t3_inf_sha_beh_w ~ c1*t1_pri_con_w + c2*t1_inf_sha_att_w + c3*t1_inf_sha_beh_w
t4_pri_con_w ~ a1*t3_pri_con_w + a2*t3_inf_sha_att_w + a3*t3_inf_sha_beh_w
t4_inf_sha_att_w ~ b1*t3_pri_con_w + b2*t3_inf_sha_att_w + b3*t3_inf_sha_beh_w
t4_inf_sha_beh_w ~ c1*t3_pri_con_w + c2*t3_inf_sha_att_w + c3*t3_inf_sha_beh_w
t5_pri_con_w ~ a1*t4_pri_con_w + a2*t4_inf_sha_att_w + a3*t4_inf_sha_beh_w
t5_inf_sha_att_w ~ b1*t4_pri_con_w + b2*t4_inf_sha_att_w + b3*t4_inf_sha_beh_w
t5_inf_sha_beh_w ~ c1*t4_pri_con_w + c2*t4_inf_sha_att_w + c3*t4_inf_sha_beh_w
# covariances
pri_con_b ~~ cor_b_1*inf_sha_att_b + cor_b_2*inf_sha_beh_b
inf_sha_att_b ~~ cor_b_3*inf_sha_beh_b
t1_pri_con_w ~~ cor_w_1*t1_inf_sha_att_w + cor_w_2*t1_inf_sha_beh_w
t1_inf_sha_att_w ~~ cor_w_3*t1_inf_sha_beh_w
t3_pri_con_w ~~ a*t3_inf_sha_att_w + b*t3_inf_sha_beh_w
t3_inf_sha_att_w ~~ c*t3_inf_sha_beh_w
t4_pri_con_w ~~ a*t4_inf_sha_att_w + b*t4_inf_sha_beh_w
t4_inf_sha_att_w ~~ c*t4_inf_sha_beh_w
t5_pri_con_w ~~ a*t5_inf_sha_att_w + b*t5_inf_sha_beh_w
t5_inf_sha_att_w ~~ c*t5_inf_sha_beh_w
# setting variances of observed variables to zero
t1_pri_con_fs ~~ 0*t1_pri_con_fs
t3_pri_con_fs ~~ 0*t3_pri_con_fs
t4_pri_con_fs ~~ 0*t4_pri_con_fs
t5_pri_con_fs ~~ 0*t5_pri_con_fs
t1_inf_sha_att_fs ~~ 0*t1_inf_sha_att_fs
t3_inf_sha_att_fs ~~ 0*t3_inf_sha_att_fs
t4_inf_sha_att_fs ~~ 0*t4_inf_sha_att_fs
t5_inf_sha_att_fs ~~ 0*t5_inf_sha_att_fs
t1_inf_sha_beh_fs ~~ 0*t1_inf_sha_beh_fs
t3_inf_sha_beh_fs ~~ 0*t3_inf_sha_beh_fs
t4_inf_sha_beh_fs ~~ 0*t4_inf_sha_beh_fs
t5_inf_sha_beh_fs ~~ 0*t5_inf_sha_beh_fs
# control variables
t1_pri_con_fs ~ age + edu_num + male
t3_pri_con_fs ~ age + edu_num + male
t4_pri_con_fs ~ age + edu_num + male
t5_pri_con_fs ~ age + edu_num + male
t1_inf_sha_beh_fs ~ age + edu_num + male
t3_inf_sha_beh_fs ~ age + edu_num + male
t4_inf_sha_beh_fs ~ age + edu_num + male
t5_inf_sha_beh_fs ~ age + edu_num + male
t1_inf_sha_att_fs ~ age + edu_num + male
t3_inf_sha_att_fs ~ age + edu_num + male
t4_inf_sha_att_fs ~ age + edu_num + male
t5_inf_sha_att_fs ~ age + edu_num + male
'
fit <- sem(model, data = d_wide_all, orthogonal = TRUE, missing = "ML")
summary(fit, standardized = TRUE, fit.measures = TRUE, ci = TRUE)
fit_riclpm_5w <- fit
```
The results show the same between person effects. Within-person effects disappear, which is understandable given the longer interval. Effects hence remain stable also across longer time intervals and until 2018.
## Mixed Models
In what follows, we also present the results of several mixed models. Using mixed models, we can include more data. However, one downside is that not all research questions can be answered in one single model.
### Two Variables
#### Model 1
Measures overall correlation between privacy concerns and information sharing.
```{r}
fit <- lmer(pri_con_m ~ 1 + inf_sha_beh_m + (1 | id) + (1 | wave), d_long)
summary(fit)
std_beta(fit)
```
#### Model 2
Measures how current levels of information sharing are affected by generel levels of privacy concern und current levels of privacy concern.
```{r}
fit <- lmer(inf_sha_beh_m ~ pri_con_m_b + pri_con_m_w + (1 | id) + (1 | wave), d_long)
summary(fit)
std_beta(fit)
```
Measures how current levels of privacy concern are affected by generel levels of information sharing und current levels of information sharing.
```{r}
fit <- lmer(pri_con_m ~ inf_sha_beh_m_b + inf_sha_beh_m_w + (1 | id) + (1 | wave), d_long)
summary(fit)
std_beta(fit)
```
#### Model 3
Includes control variables.
```{r}
fit <- lmer(inf_sha_beh_m ~ 1 + pri_con_m_b + pri_con_m_w + male + age + edu_num + (1 | id) + (1 | wave), d_long)
summary(fit)
std_beta(fit)
```
```{r}
fit <- lmer(pri_con_m ~ 1 + inf_sha_beh_m_b + inf_sha_beh_m_w + male + age + edu_num + (1 | id) + (1 | wave), d_long)
summary(fit)
std_beta(fit)
```
### Three Variables
#### Model 1
Measures how current levels of information sharing are affected by generel levels of privacy concern and current levels of privacy concern, as well as general levels of positive attitude toward information sharing and current levels of positive attitude toward information sharing.
```{r}
fit <- lmer(inf_sha_beh_m ~ 1 + pri_con_m_b + pri_con_m_w + inf_sha_att_m_b + inf_sha_att_m_w + (1 | id) + (1 | wave), d_long)
summary(fit)
std_beta(fit)
```
Measures how current levels of positive attitude toward information sharing are affected by generel levels of privacy concern and current levels of privacy concern, as well as general levels of information sharing and current levels of information sharing.
```{r}
fit <- lmer(inf_sha_att_m ~ 1 + pri_con_m_b + pri_con_m_w + inf_sha_beh_m_b + inf_sha_beh_m_w + (1 | id) + (1 | wave), d_long)
summary(fit)
std_beta(fit)
```
Measures how current levels of privacy concern are affected by generel levels of positive attitude toward information sharing and current levels of positive attitude toward information sharing, as well as general levels of information sharing and current levels of information sharing.
```{r}
fit <- lmer(pri_con_m ~ 1 + inf_sha_beh_m_b + inf_sha_beh_m_w + inf_sha_att_m_b + inf_sha_att_m_w + (1 | id) + (1 | wave), d_long)
summary(fit)
std_beta(fit)
```
#### Model 2
Includes control variables
```{r}
fit <- lmer(pri_con_m ~ 1 + inf_sha_att_m_b + inf_sha_att_m_w + inf_sha_beh_m_b + inf_sha_beh_m_w + male + age + edu_num + (1 | id) + (1 | wave), d_long)
summary(fit)
std_beta(fit)
```
```{r}
fit <- lmer(inf_sha_att_m ~ 1 + pri_con_m_b + pri_con_m_w + inf_sha_beh_m_b + inf_sha_beh_m_w + male + age + edu_num + (1 | id) + (1 | wave), d_long)
summary(fit)
std_beta(fit)
```
```{r}
fit <- lmer(inf_sha_beh_m ~ 1 + pri_con_m_b + pri_con_m_w + inf_sha_att_m_b + inf_sha_att_m_w + male + age + edu_num + (1 | id) + (1 | wave), d_long)
summary(fit)
std_beta(fit)
```
```{r include=F, cache=F}
save.image("data/workspace.RData")
```