Dear all,
I'm doing a scatter plot (potassium levels in 2 distinct moments) with this code (which works fine):
twoway (lfitci Pre_Pot Post_Pot, ciplot(rarea)) (scatter Pre_Pot Post_Pot,c(. l) m(Oh) mc(black) msiz(small)) (line W W, lp(dash) lc(black)) if Sequence==0, ytitle(Potassium(mEq/L)) xtitle(Potassium(mEq/L)) legend(order(1 2)) legend(off) text(7.8 7 "Line 45°",size(vsmall) place(e)) text(5.1 6.8 "Lfit: y=2.10 +0.52x",size(vsmall) place(e)) text(4.9 7 "{&sigma}{superscript:2}=0.43",size(vsmall) place(e)) xlab(2(1)8) ylab(2(1)8) xmtick(##10) ymtick(##10) ysize(5.5) graphregion(fcolor(white))
and produce this graph:
Array
The dashed line (45°) was created just to add a reference to the reader using:
generate W=_n
replace W=. if W>8 | W<1.4
My problem is when I try do to the same graph for the group Sequence=1. Changing the conditional from 0 to 1 the dashed line disappears!
twoway (lfitci Pre_Pot Post_Pot, ciplot(rarea))(scatter Pre_Pot Post_Pot,c(. l) m(Oh) mc(black) msiz(small)) (line W W, lp(dash) lc(black)) if Sequence==1, ytitle(Potassium(mEq/L)) xtitle(Potassium(mEq/L)) legend(order(1 2)) legend(off) text(7.8 7 "Line 45°",size(vsmall) place(e)) text(5.1 6.8 "Lfit: y=2.35 +0.48x",size(vsmall) place(e)) text(4.9 7 "{&sigma}{superscript:2}=0.59",size(vsmall) place(e)) xlab(2(1)8) ylab(2(1)8) xmtick(##10) ymtick(##10) ysize(5.5) graphregion(fcolor(white))
Array
ps: Sequence is a binary variable where 0 the patient started in one dialysis modality (CAPD) whilst 1 the patient started in another dialysis modality (APD)
Regards
Thyago
Related Posts with Line disappears
Plotting an InteractionI am trying to plot the effect on Value of an interaction between Trend and Experience, at high vs. …
Testing for a known break date in a time series with yearly dataI have a data set that contains variables for economic growth (called "dgdp") and the change of unem…
Skewed continuous outcome in mediation (SEM)Hello, I am conducting a mediation analysis using SEM. My continuous outcome is skewed. I wondered …
Ordered Logit model: discontinuous region with missing values encountered when estimating MEDear Statalist, I am using Stata 15.1 and want to estimate the marginal effects of an ordered logit…
Panel Data- Working with the ID`sHello, Statalisters I am working with an Unbalanced Panel Data with information about sales, capita…
Subscribe to:
Post Comments (Atom)
0 Response to Line disappears
Post a Comment