Hi there,
I have created two piecewise graphs from linear mixed effects models. I now want to overlay them onto one graph.
Outcome is A1C.
Unit of measurement is months (pre = -12 to 0 months; post = 0 to 12 months).
Exposure is group (group==0 is the control group; group==1 is the intervention group). Study subjects only received the intervention at "post" (i.e. 0-12 months).
I get the following marginsplot graphs from the following code:
mixed a1c c.pre c.post i.group c.post#i.group if group==0 || id: , cov(unstr) reml
margins, at(pre=-12 post=0) at(pre=0 post=0) at(pre=12 post=12) vsquish
marginsplot, recast(line) ciopt(color(%20)) recastci(rarea)
Array
mixed a1c c.pre c.post i.group c.post#i.group if group==1 || id: , cov(unstr) reml
margins, at(pre=-12 post=0) at(pre=0 post=0) at(pre=12 post=12) vsquish
marginsplot, recast(line) ciopt(color(%20)) recastci(rarea)
Array
I want to combine the two graphs, so I used the following code:
mixed a1c c.pre c.post i.group c.post#i.group if group==0 || id: , cov(unstr) reml
margins, at(pre=-12 post=0) at(pre=0 post=0) at(pre=12 post=12) saving(file1, replace) vsquish
mixed a1c c.pre c.post i.group c.post#i.group if group==1 || id: , cov(unstr) reml
margins, at(pre=-12 post=0) at(pre=0 post=0) at(pre=12 post=12) saving(file2, replace) vsquish
combomarginsplot file1 file2, labels("Control" "Intervention")
Unfortunately, I get a graph that looks like this:
Array
How do I tell combomarginsplot that I want to plot the outcome against the original x-variable, rather than (File 1 vs. File 2)?
Thanks in advance!
Joseph Leung
Clinician Investigator Program PGY-7
University of British Columbia
Related Posts with Problem with combomarginsplot
Reproducing an output including all indicators of a categorial variable and a constantDear Stata-Listers, I am currently trying to reproduce the output in the picture. The model used in…
How to generate monthly time series data based on yearly time series data?Hello, I am wondering how to generate monthly time series data. For example, my current data set is…
What does the keyword `control' at the end a regression command do?Hi everyone, I am trying to replicate a paper to get my self familiar with STATA. I the paper comes…
fixed effects relative to the mean, help needed with felsdvregdmHello everyone, I've been working on this for two days and am failed to produce the results. I reall…
How to convert the unprojected point data in lat/lon format into projected point dat, usable in spmapHi everyone, I have a list of selected airports in lat/lon format and want to scatter these points …
Subscribe to:
Post Comments (Atom)
0 Response to Problem with combomarginsplot
Post a Comment