Dear Statalist,
First of all, Happy holidays to the people on this forum!
I have 2 questions concerning structural equation modelling (SEM) using Stata SE 14 on Mac OS 10.13.
The first question is basically "how do I calculate the degree of freedom (DoF) for an SEM model". I am aware that the definition of DoF is:
number of information ( k(k+1/2) where k is the number of variables ) minus number of parameters one wishes to estimate.
However, this formula does not seem to work for my case, where I aim to run a very simple mediation model to test if loneliness mediates the association between stigma and depression in my sample (n=350) using the command:
There are three variables here (k=3) so the number of information should be 6 (3(3+1)/2). I am only estimating 5 parameters (3 pathways shown in the sem code and 2 error variances). This should give a DoF of 1. I am confused why the results show that there is a 0 degree of freedom?
The second question concerns Bootstrap failures. Here I used another data (n=120, no missing value) to test the same mediation effect mentioned above, but as can be seen in my codes below, a measurement component is included so that there are 3 indicators for stigma, which is now represented by a latent variable. I have also adjusted for employment and education level.
The results showed a high number of bootstrap failures (4 out of 10). It also took unusually long to run compared to my other, more complex, sem models (approx. 30 minutes for just 10 reps)
There has been previous report of bootstrap failure on this forum where the -noisily option is suggested to diagnose the bootstrap execution. I have done so with the following codes:
The results suggested the failed bootstraps ran more than 15,000 iterations and yielded the error message:
These bootstraps are also the main reason it took so long.
As mentioned, this dataset has no missing value, I am therefore not sure how this came to be and would very much like to know what you think may have gone wrong.
I hope the above question has been presented clearly and following the correct formats.
Please kindly let me know if I can provide any additional information.
Any and all help is very deeply appreciated. Thank you in advance.
Kai-Yuan
First of all, Happy holidays to the people on this forum!
I have 2 questions concerning structural equation modelling (SEM) using Stata SE 14 on Mac OS 10.13.
The first question is basically "how do I calculate the degree of freedom (DoF) for an SEM model". I am aware that the definition of DoF is:
number of information ( k(k+1/2) where k is the number of variables ) minus number of parameters one wishes to estimate.
However, this formula does not seem to work for my case, where I aim to run a very simple mediation model to test if loneliness mediates the association between stigma and depression in my sample (n=350) using the command:
Code:
sem (lonely -> depress, ) (stigma -> depress, ) (stigma -> lonely, ), nocapslatent
The second question concerns Bootstrap failures. Here I used another data (n=120, no missing value) to test the same mediation effect mentioned above, but as can be seen in my codes below, a measurement component is included so that there are 3 indicators for stigma, which is now represented by a latent variable. I have also adjusted for employment and education level.
Code:
. sem (latentstigma -> gih_m, ) (latentstigma -> lih_r, ) (latentstigma -> lih_atol, ) (latentstigma loneliness employment education -> depression, ) (latentstigma employment education -> loneliness, ), latent(latentih ) nocapslatent vce(bootstrap, reps(10) seed(1234)) (running sem on estimation sample) Bootstrap replications (10) ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 .x.x..xx.. Structural equation model Number of obs = 120 Log likelihood = -1926.6482 Replications = 6
There has been previous report of bootstrap failure on this forum where the -noisily option is suggested to diagnose the bootstrap execution. I have done so with the following codes:
Code:
program bootsem1, rclass sem (latentstigma -> gih_m, ) (latentstigma -> lih_r, ) (latentstigma -> lih_atol, ) (latentstigma loneliness employment education -> depression, ) (latentstigma employment education-> loneliness, ), latent(latentstigma ) nocapslatent estat teffects, compact mat ind = r(indirect) mat dir = r(direct) mat tot = r(total) return scalar ind = ind[1,2] return scalar dirih = dir[1,2] return scalar dirlonely = dir[1,1] return scalar tot = tot[1,2] end set seed 1234 bootstrap r(ind) r(dirih) r(dirlonely) r(tot), noisily reps(10) : bootsem1
Code:
Convergence not achieved an error occurred when bootstrap executed bootsem1, posting missing values
As mentioned, this dataset has no missing value, I am therefore not sure how this came to be and would very much like to know what you think may have gone wrong.
I hope the above question has been presented clearly and following the correct formats.
Please kindly let me know if I can provide any additional information.
Any and all help is very deeply appreciated. Thank you in advance.
Kai-Yuan
Comment