title: Monte-carlo simulation MONTECARLO: NAMES = y1-y3 x1; !variable names NOBS = 500; !sample size NREP = 100; !number of runs SEED = 45832; !starting seed; random number SAVE = multi_shi_i; !file name for saved data ANALYSIS: TYPE = ; !GLM as default ESTIMATOR = MLR; !MLR as default MODEL POPULATION: [x1@0]; !predictor variable mean x1*1; !predictor variable variance iy sy | y1@0 y2@1 y3@2; !growth model and time coding [iy*4]; !intercept estimate [sy*2]; !linear slope estimate iy*1; !intercept variance sy*1; !linear slope variance iy with sy*.2; !intercept-slope covariance y1-y3*.5; !repeated measures residuals iy with x1*.4; !intercept regressed on predictor sy with x1*.4; !linear slope regressed on predictor MODEL: [x1]; x1; iy sy | y1@0 y2@1 y3@2; [iy]; [sy]; iy; sy; iy with sy; iy with x1; sy with x1; !PLOT: Type = Plot3; !Series = y1-y4(*); !Series = b1-b4(*); OUTPUT: SAMPSTAT STANDARDIZED TECH1 CINTERVAL TECH9; title: Monte-carlo simulation two-part ZI LGM montecarlo: names = y1-y3 x1; !variable names generate = y1-y3(cbi 0); !generate zero-inflated y data, lower bounded censored = y1-y3(bi); !same, basically nobs = 500; !sample size nreps = 1; !number of repetitions; more = longer process time save = zi_multi_shi_i; !file name for saved data model population: [x1*0]; !predictor variable mean x1*1; !predictor variable variance iy sy | y1@0 y2@1 y3@2; !continuous growth model and time coding [iy*4]; !intercept estimate [sy*2]; !linear slope estimate iy*1; !intercept variance sy*1; !linear slope variance iy with sy*.2; !intercept-slope covariance y1-y3*.5; !repeated measures residuals iz sz | y1#1@0 y2#1@1 y3#1@2; !zi logit growth model and time coding [y1#1-y3#1*0] (1); !equal intercepts [iz@0]; !intercept estimate; zero inflation estimate for intercept [sz*-.5]; !linear slope estimate; zero inflation rate over time iz*1; !intercept variance; zero inflation variance for intercept sz@0; !linear slope variance; constrained to zero for simplicity / estimation iz with iy-sy@0; !zi intercept covariance with continuous growth model latent variables iy with x1*.4; !intercept regressed on predictor sy with x1*.4; !linear slope regressed on predictor iz with x1*.2; !zi intercept regressed on predictor analysis: type = ; !GLM as default estimator = mlr; !MLR as default !integration = 7; !number of integration points processors = 2 2; !number of processors and threads to use for analysis model: [x1]; !predictor variable mean x1; !predictor variable variance iy sy | y1@0 y2@1 y3@2; !continuous growth model and time coding [iy]; !intercept estimate [sy]; !linear slope estimate iy; !intercept variance sy; !linear slope variance iy with sy; !intercept-slope covariance y1-y3; !repeated measures residuals iz sz | y1#1@0 y2#1@1 y3#1@2; !zi logit growth model and time coding [y1#1-y3#1] (1); !equal intercepts [iz]; !intercept estimate; zero inflation estimate for intercept [sz]; !linear slope estimate; zero inflation rate over time iz; !intercept variance; zero inflation variance for intercept sz@0; !linear slope variance; constrained to zero for simplicity / estimation iz with iy-sy@0; !zi intercept covariance with continuous growth model latent variables iy with x1; !intercept regressed on predictor sy with x1; !linear slope regressed on predictor iz with x1; !zi intercept regressed on predictor output: tech8 tech9; TITLE: growth model; DATA: File is multi_shi_i; VARIABLE: Names are y1 y2 y3 x1; Usevariables are y1 y2 y3 x1; !Missing are all (999); DEFINE: ANALYSIS: Type = ; !Algorithm = integration; Estimator = MLR; !MITERATIONS = 5000; MODEL: iy sy | y1@0 y2@1 y3@2; !y1 y2 y3(v); [iy]; [sy]; iy ON x1;!effects on intercept sy ON x1;!effects on slope Savedata: !file is f_score_multi_lo_i.csv; !save = fscores; PLOT: Type = Plot3; Series = y1-y3(*); OUTPUT: TECH1 SAMPSTAT STANDARDIZED TECH4 CINTERVAL; TITLE: two-part zero-inflated growth model DATA: FILE = zi_multi_shi_i; DATA TWOPART: NAMES = y1-y3; BINARY = z1-z3; CONTINUOUS = c1-c3; TRANSFORM = none; VARIABLE: NAMES = y1-y3 x1; USEVARIABLES = x1 z1-z3 c1-c3; CATEGORICAL = z1-z3; !MISSING = ALL(999); ANALYSIS: ESTIMATOR = MLR; MODEL: iz sz | z1@0 z2@1 z3@2; sz@0; c1-c3(c); iy sy | c1@0 c2@1 c3@2; [iy]; [sy]; iz WITH iy-sy@0; iy on x1; sy on x1; iz on x1; !iy ON x1;!effects on intercept !sy ON x1;!effects on slope !iz ON x1;!effect on zi intercept Savedata: !file is f_score_multi_lo_i.csv; !save = fscores; PLOT: Type = Plot3; Series = c1-c3(*); OUTPUT: TECH1 SAMPSTAT STANDARDIZED TECH4 CINTERVAL;