Hello,
Im trying to produce a twoway scatter using Stata SEv13 and the following code:
regress ssscore ageatdeath if sex==1
predict male
regress ssscore ageatdeath if sex==2
predict female
twoway (scatter male ageatdeath, connect(l) msymbol(i) lpattern(dash)) (scatter female ageatdeath, connect(l) msymbol(i)), title("social support by age and sex") ///
ytitle(predicted social support score) xtitle(age at last wave) ///
legend(order(1 "male" 2 "female"))
Here's the graph i produce:

The problem is that the lpattern(dash) option only seems to change the line in the legend and not the look of the line in the graph.
Please can someone advise me where im going wrong? Ive tried changing the colour and thickness and both of these options work well.
p.s. I specifically want to plot the predicted values of ssscore (rather than using lfit) because later i want to mi impute the missing ssscore data and use mi predict to get the predicted values (i dont think i can use lfit with imputed datasets - but please correct me if im wrong).
Many thanks,
Joanna
Im trying to produce a twoway scatter using Stata SEv13 and the following code:
regress ssscore ageatdeath if sex==1
predict male
regress ssscore ageatdeath if sex==2
predict female
twoway (scatter male ageatdeath, connect(l) msymbol(i) lpattern(dash)) (scatter female ageatdeath, connect(l) msymbol(i)), title("social support by age and sex") ///
ytitle(predicted social support score) xtitle(age at last wave) ///
legend(order(1 "male" 2 "female"))
Here's the graph i produce:
The problem is that the lpattern(dash) option only seems to change the line in the legend and not the look of the line in the graph.
Please can someone advise me where im going wrong? Ive tried changing the colour and thickness and both of these options work well.
p.s. I specifically want to plot the predicted values of ssscore (rather than using lfit) because later i want to mi impute the missing ssscore data and use mi predict to get the predicted values (i dont think i can use lfit with imputed datasets - but please correct me if im wrong).
Many thanks,
Joanna
Comment