Node based analysis with latent space model
We fit the same model on the friendship and WeChat networks using the LSM approach. Under this approach, the latent positions take the roles of the network statistics. To denote latent positions, we modify the model section as shown below. An additional step indicating the estimation of latent positions is needed: friends ˜lp.friends
for the friendship network and wechat ˜lp.wechat
for the WeChat network. The latent positions are then used in the regression part of the model.
model <-'
# measurement model
Extroversion =~ personality1 + personality6
+ personality11 + personality16
Conscientiousness =~ personality2 + personality7
+ personality12 + personality17
Neuroticism =~ personality3 + personality8
+ personality13 + personality18
Openness =~ personality4 + personality9
+ personality14 + personality19
Agreeableness =~ personality5 + personality10 +
personality15 + personality20
Happiness =~ happy1 + happy2 + happy3 + happy4
# LSM
friends ~ lp.friends
wechat ~ lp.wechat
# structural model
lp.friends ~ a1*Extroversion + a2*Conscientiousness + a3*Neuroticism +
a4*Openness + a5*Agreeableness
Happiness ~ b1*lp.friends + b2*lp.wechat
'
To fit the model, the sem.net.lsm()
function is used. The argument latent.dim
should be used to denote the number of latent
dimensions to be used in estimating the LSM. A random seed can be set to ensure reproduction of the results.
data = list(network=network, nonnetwork=non_network)
set.seed(100)
res <- sem.net.lsm(model=model,data=data, latent.dim = 2, data.rescale = T)
For SEM with latent positions, the estimation is again a two-stage process. First, a latent space model with no covariates is used to estimate latent positions through the latentnet
R package. The resulting latent positions are then be extracted and compiled into the same dataset as the non-network variables such as the Big Five personality items and the happiness score items, which are then inputted into lavaan
to be estimated in the SEM framework. We could again use res$data to access the restructured data with latent positions, and res$model to access the modified model string. The output of sem.net.lsm() has two components in res$estimates - res$estimates$sem.es for lavaan SEM results and res$estimates$lsm.es for latentnet LSM results.
The output of the analysis is given below:
lavaan 0.6.15 ended normally after 195 iterations
Estimator ML
Optimization method NLMINB
Number of model parameters 74
Number of observations 165
Model Test User Model:
Test statistic 947.953
Degrees of freedom 329
P-value (Chi-square) 0.000
Model Test Baseline Model:
Test statistic 1448.277
Degrees of freedom 377
P-value 0.000
User Model versus Baseline Model:
Comparative Fit Index (CFI) 0.422
Tucker-Lewis Index (TLI) 0.338
Loglikelihood and Information Criteria:
Loglikelihood user model (H0) -6642.329
Loglikelihood unrestricted model (H1) -6168.353
Akaike (AIC) 13432.658
Bayesian (BIC) 13662.498
Sample-size adjusted Bayesian (SABIC) 13428.214
Root Mean Square Error of Approximation:
RMSEA 0.107
90 Percent confidence interval - lower 0.099
90 Percent confidence interval - upper 0.115
P-value H_0: RMSEA <= 0.050 0.000
P-value H_0: RMSEA >= 0.080 1.000
Standardized Root Mean Square Residual:
SRMR 0.119
Parameter Estimates:
Standard errors Standard
Information Expected
Information saturated (h1) model Structured
Latent Variables:
Estimate Std.Err z-value P(>|z|)
Happiness =~
happy4 1.000
happy3 -4.299 3.529 -1.218 0.223
happy2 -6.668 5.428 -1.229 0.219
happy1 -6.874 5.596 -1.229 0.219
Agreeableness =~
personality20 1.000
personality15 -0.955 0.754 -1.267 0.205
personality10 -4.410 2.423 -1.820 0.069
personality5 -4.034 2.211 -1.824 0.068
Openness =~
personality19 1.000
personality14 0.722 0.158 4.571 0.000
personality9 -0.200 0.100 -2.005 0.045
personality4 -0.088 0.101 -0.873 0.383
Neuroticism =~
personality18 1.000
personality13 -0.508 0.144 -3.530 0.000
personality8 -0.798 0.172 -4.651 0.000
personality3 -0.354 0.133 -2.664 0.008
Conscientiousness =~
personality17 1.000
personality12 -0.523 0.180 -2.911 0.004
personality7 -0.455 0.189 -2.412 0.016
personality2 1.055 0.241 4.378 0.000
Extroversion =~
personality16 1.000
personality11 0.632 0.151 4.181 0.000
personality6 -0.559 0.138 -4.038 0.000
personality1 -0.558 0.134 -4.170 0.000
Regressions:
Estimate Std.Err z-value P(>|z|)
friends.Z1 ~
Extroversion -0.383 0.457 -0.838 0.402
friends.Z2 ~
Extroversion -0.586 0.491 -1.192 0.233
friends.Z1 ~
Conscientisnss -0.148 1.023 -0.144 0.885
friends.Z2 ~
Conscientisnss 0.503 1.048 0.480 0.631
friends.Z1 ~
Neuroticism -0.004 0.718 -0.006 0.995
friends.Z2 ~
Neuroticism 1.780 0.898 1.982 0.048
friends.Z1 ~
Openness 0.352 0.466 0.756 0.450
friends.Z2 ~
Openness -1.003 0.559 -1.794 0.073
friends.Z1 ~
Agreeableness 0.961 2.930 0.328 0.743
friends.Z2 ~
Agreeableness -2.654 3.260 -0.814 0.416
Happiness ~
friends.Z1 -0.016 0.013 -1.165 0.244
friends.Z2 -0.002 0.005 -0.394 0.693
wechat.Z1 0.019 0.017 1.146 0.252
wechat.Z2 -0.001 0.006 -0.192 0.848
Covariances:
Estimate Std.Err z-value P(>|z|)
Agreeableness ~~
Openness 0.018 0.019 0.965 0.334
Neuroticism 0.044 0.029 1.538 0.124
Conscientisnss -0.075 0.043 -1.727 0.084
Extroversion -0.011 0.020 -0.553 0.580
Openness ~~
Neuroticism 0.346 0.075 4.596 0.000
Conscientisnss -0.141 0.063 -2.233 0.026
Extroversion 0.085 0.080 1.063 0.288
Neuroticism ~~
Conscientisnss -0.150 0.063 -2.391 0.017
Extroversion 0.212 0.081 2.605 0.009
Conscientiousness ~~
Extroversion 0.154 0.074 2.073 0.038
Variances:
Estimate Std.Err z-value P(>|z|)
.happy4 2.702 0.298 9.065 0.000
.happy3 1.218 0.146 8.332 0.000
.happy2 0.569 0.137 4.141 0.000
.happy1 0.522 0.142 3.678 0.000
.personality20 1.103 0.123 8.968 0.000
.personality15 1.208 0.134 8.987 0.000
.personality10 0.511 0.135 3.773 0.000
.personality5 0.786 0.135 5.806 0.000
.personality19 0.184 0.139 1.326 0.185
.personality14 0.710 0.107 6.662 0.000
.personality9 0.858 0.095 9.013 0.000
.personality4 0.964 0.106 9.072 0.000
.personality18 0.484 0.104 4.635 0.000
.personality13 0.929 0.109 8.529 0.000
.personality8 0.963 0.125 7.720 0.000
.personality3 0.899 0.102 8.809 0.000
.personality17 0.568 0.102 5.555 0.000
.personality12 1.055 0.123 8.600 0.000
.personality7 1.270 0.145 8.781 0.000
.personality2 1.065 0.151 7.046 0.000
.personality16 0.641 0.167 3.831 0.000
.personality11 1.120 0.144 7.796 0.000
.personality6 1.011 0.127 7.983 0.000
.personality1 0.883 0.113 7.813 0.000
.friends.Z1 9.034 1.006 8.984 0.000
.friends.Z2 7.746 1.033 7.497 0.000
.Happiness 0.025 0.041 0.615 0.538
Agreeableness 0.034 0.036 0.934 0.350
Openness 0.712 0.168 4.234 0.000
Neuroticism 0.508 0.131 3.880 0.000
Conscientisnss 0.387 0.117 3.310 0.001
Extroversion 0.798 0.208 3.842 0.000
The path diagram is given below: