I am using Stata 14 on Windows 10. I am using data from a longitudinal cohort study where subjects were measured three times: at ages 15, 18 and 25 years. I need to adjust my model for smoking status (smokers = 1 and nonsmokers = 0). But I am concerned that smoking status can change in time (some quit smoking, some start smoking etc). Is it OK if i only add smoking in the fixed part of the model like this:
HTML Code:
mixed ZvMAO c.time ib2.lifetime_drug_use i.smoking if sex ==1|| ID: time, reml cov(unstructured) Performing EM optimization: Performing gradient-based optimization: Iteration 0: log restricted-likelihood = -1389.7426 Iteration 1: log restricted-likelihood = -1389.5391 Iteration 2: log restricted-likelihood = -1389.5365 Iteration 3: log restricted-likelihood = -1389.5365 Computing standard errors: Mixed-effects REML regression Number of obs = 1,099 Group variable: ID Number of groups = 457 Obs per group: min = 1 avg = 2.4 max = 3 Wald chi2(3) = 44.67 Log restricted-likelihood = -1389.5365 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------------- ZvMAO | Coef. Std. Err. z P>|z| [95% Conf. Interval] --------------------+---------------------------------------------------------------- time | .0054066 .0049086 1.10 0.271 -.0042141 .0150273 1.lifetime_drug_use | -.363068 .0939173 -3.87 0.000 -.5471425 -.1789935 1.smoking | -.2684042 .056397 -4.76 0.000 -.3789402 -.1578682 _cons | .279152 .1242205 2.25 0.025 .0356843 .5226196 ------------------------------------------------------------------------------------- ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ ID: Unstructured | var(time) | .0009494 .0009033 .0001471 .0061272 var(_cons) | .9532168 .3814805 .4350489 2.088552 cov(time,_cons) | -.0200538 .0179578 -.0552505 .0151429 -----------------------------+------------------------------------------------ var(Residual) | .3805867 .0320362 .3227031 .448853 ------------------------------------------------------------------------------ LR test vs. linear model: chi2(3) = 290.78 Prob > chi2 = 0.0000 Note: LR test is conservative and provided only for reference.
Kind regards,
Urmeli
0 Response to How to adjust linear mixed models for a factor variable
Post a Comment