Hi all, I'm posting without any data because I think this is a conceptual rather than technical question (Stata 17.0).
I'm happy using margins after xtset and looking at effect of lagged exposure variable and interaction with categorical variable on current outcome, e.g.:
This is great, giving me values of panel_zscore (y axis) as a function of the previous score (3 strata taking values -2SD, 0 and +2SD), depending on whether binary occurred or not (x axis).
I'd like to see the change in panel_zscore over time (which is not directly in the model <- it's embedded in xtset), such that the marginsplot would give:
panel_zscore (y axis) by(binary) as it changes from one lagged measure to the outcome such that time in the x axis.
(I put by(binary) in italics as it's obviously not a real command, it expresses what I'm hoping for).
This example would give 6 lines showing change from lagged measure to follow-up: one for each marginal level (-2SD, 0 and +2SD) * binary status.
Is this possible using marginsplot, or do I need to use something like predict instead?
Many thanks in advance.
I'm happy using margins after xtset and looking at effect of lagged exposure variable and interaction with categorical variable on current outcome, e.g.:
Code:
sort pid time xtset pid time regress panel_zscore c.L1.panel_zscore##i.binary, cluster(pid) margins, at(binary=(0 1) l.panel_zscore=(-2(2)2))
I'd like to see the change in panel_zscore over time (which is not directly in the model <- it's embedded in xtset), such that the marginsplot would give:
panel_zscore (y axis) by(binary) as it changes from one lagged measure to the outcome such that time in the x axis.
(I put by(binary) in italics as it's obviously not a real command, it expresses what I'm hoping for).
This example would give 6 lines showing change from lagged measure to follow-up: one for each marginal level (-2SD, 0 and +2SD) * binary status.
Is this possible using marginsplot, or do I need to use something like predict instead?
Many thanks in advance.

Comment