Hi,
I am using the -gformula- command in Stata 18. My data is in wide format. I am trying to run the most basic version of my model before I begin to build it but I cannot get the gformula command to run without issue. I have been successful running this same model using -mediate- and -sem-. I can't find much online on troubleshooting -gformula- but assume from the error codes given that it's a syntax problem. Please note that I am aware 15 bootstrap samples are not recommended... I just wanted to get the basic code running before I go further with my model. My code is:
I have also tried a simpler piece of code:
Both returned the following Stata output:
Any advice would be much appreciated!
Thanks,
Robyn
I am using the -gformula- command in Stata 18. My data is in wide format. I am trying to run the most basic version of my model before I begin to build it but I cannot get the gformula command to run without issue. I have been successful running this same model using -mediate- and -sem-. I can't find much online on troubleshooting -gformula- but assume from the error codes given that it's a syntax problem. Please note that I am aware 15 bootstrap samples are not recommended... I just wanted to get the basic code running before I go further with my model. My code is:
Code:
#delimit; gformula multi9 lone hscrp4, mediation outcome(multi9) equations(multi9: lone hscrp4, hscrp4: lone) commands(multi9:poisson, hscrp4:regress) exposure(lone) linexp mediator(hscrp4) logOR samples(15) seed(179) moreMC sim(50000); #delimit cr
Code:
#delimit; gformula multi9 lone hscrp4, mediation outcome(multi9) equations(multi9: lone hscrp4, hscrp4: lone) commands(multi9:poisson, hscrp4:regress) exposure(lone) linexp mediator(hscrp4); #delimit cr
Code:
G-computation procedure using Monte Carlo simulation: mediation
[Please note that neither the abbreviation of variable names nor the use of
variable lists (such as x1-x3 to denote x1 x2 x3) is supported by this command.
If you have used abbreviations or lists, the command may fail to run or the
results below may not be correct.]
Outcome variable: multi9
Exposure variable(s): lone
Mediator variable(s): hscrp4
Size of MC sample: 50000
No. of bootstrap samples: 15
A summary of the specified parametric models:
(for simulation under different interventions)
Variable | Command | Prediction equation
------------+---------+-------------------------------------------------------
hscrp4 | regress | lone
multi9 | poisson | lone hscrp4
------------------------------------------------------------------------------
No. of subjects = 4947
|-PROGRESS-|
Preparing dataset for MC simulations: |----------|
|-PROGRESS-|
Fitting parametric models and simulating: |---- invalid name
r(198);
end of do-file
r(198);
Thanks,
Robyn

Comment