Dear Statalist users,
I have a multilevel data set and am testing a moderated inverted U-shaped relationship using the xtmixed command. I am using Stata 14.
I am having trouble creating a nice plot of curvilinear relationships. Specifically, I want to plot the relationship at 4 different values of the moderator (min, - 1 s.d., +1 s.d., max) to show that at some point, the curve flips to a U-shape.
This is my code:
and I am also attaching a screenshot of my current plot.
I have read many user guidelines for the options of the margins plot command and this is the best I could make it until now. However, I do not think that the graphs look good as it might be difficult for some readers to see the difference between the dashed and the dash-dotted line if the plot was displayed smaller. I would really like to have markers at the ends of the graphs but I do not manage to do so. Whenever I select markers, I get them all over each graph, which looks really messy. I only want them at the minimum and maximum of my independent variable.
Does anyone know how I could add different markers at the ends of the single graphs? I am thankful for any advice!
Best regards
Sophie
I have a multilevel data set and am testing a moderated inverted U-shaped relationship using the xtmixed command. I am using Stata 14.
I am having trouble creating a nice plot of curvilinear relationships. Specifically, I want to plot the relationship at 4 different values of the moderator (min, - 1 s.d., +1 s.d., max) to show that at some point, the curve flips to a U-shape.
This is my code:
Code:
mixed leadTSat gcTSat c.cGini##c.cGini##c.gcStress Maj_owner Gender cEntExp cAgeDis cTAge2 cTeamSize Sales_yes || TeamID: || ID: , mle cov(unstr) vsquish quietly margins, at (cGini=(-0.0936(0.025)0.646) gcStress=(-1.115385 -0.3408441 0.3408441 1.115385)) level (90) marginsplot, xsize(13) ysize(8) scale(1) noci noseparator recast(line) plotopts(lwidth(medthick) lcolor(black) cmissing(n) connect(direct)) plot1opts( lpattern(dot)) plot2opts(lpattern(dash_dot_dot)) plot3opts(lpattern(dash) ) plot4opts(lpattern(solid)) plotregion(fcolor(white)) graphregion(fcolor(white)) xtitle("Equity inequality", size(medsmall) margin(medium)) ytitle("Predicted value of satisfaction with the team", size(medsmall) margin(medium)) legend(order(1 "Minimum" 2 "- 1 standard deviation" 3 "+ 1 standard deviation" 4 "Maximum") size(medsmall) rows(4) position(3) title(Perceived stress levels, size(medsmall) color(black))) clegend(region(fcolor(white) lcolor(white)))
I have read many user guidelines for the options of the margins plot command and this is the best I could make it until now. However, I do not think that the graphs look good as it might be difficult for some readers to see the difference between the dashed and the dash-dotted line if the plot was displayed smaller. I would really like to have markers at the ends of the graphs but I do not manage to do so. Whenever I select markers, I get them all over each graph, which looks really messy. I only want them at the minimum and maximum of my independent variable.
Does anyone know how I could add different markers at the ends of the single graphs? I am thankful for any advice!
Best regards
Sophie
Comment