Hello,
I have written before about this and I have not yet found a solution to my problem. I have pre and post treatment data that I would like to use linear mixed model for. I used the "mixed command for the model is below. How do I adjust for additional variables in thee "mixed" command? I am also trying to get a visual of the model into a linear graph but this is super hard. I have tried the margins command below but it doesn't give me the same thing I want from this publication (https://europepmc.org/backend/ptpmcr...1&blobtype=pdf). Figures 3 and 4 are what I am trying to replicate.
My dependent variable is continuous. My time variable is also continuous and have pre-treatment data from -100 months and post treatment data from 1-100 months. Below are the codes I have tried so far. Please help. How do I get a similar graph?
nl hockey dep time /*Find break point*/
predict yhat
twoway (line yhat time, sort)
mixed dep c.time || id: time, covariance(unstructured) nolrtest no-log
quietly margins , at(time = (-100(1)100))
marginsplot , title("") plotopts(msymbol(none) lcolor(black)) ytitle(dep (%)) ylabel( , angle(horizontal) nogrid) xtitle(months) level(50) recastci(rline) ciopts(lcolor(black) lpattern(dash)) xline(0)
Related Posts with Piecewise Linear mixed model with trajectories and change points
Create and export spatial matrix: spmatrix does not find the matrix created in MataI have a code that partially works to create a spatial matrix: egen id = group(IOCode),label lname(…
Merging two datasets based on a date rangeHi, I am a STATA newbie and got somehow stuck merging two datasets. One dataset (A) contains, amo…
Creation of a bar grap/ histogram with 4 variables.I am having a problem with creating a bar graph/ histogram with 4 different variables. The variables…
import all excel sheets from a specified folder, and save as STATA filesHello - I am attempting to import all excel sheets from a specified folder, and save as STATA files.…
How can I use Stata to generate 50 consecutive strings like star1 star2 star3 star4 star5........star50?As the title suggested, I know how to use R to generate them. However, I don't know how to do that i…
Subscribe to:
Post Comments (Atom)
0 Response to Piecewise Linear mixed model with trajectories and change points
Post a Comment