help for sdline

SD line (reduced major axis)

sdline yvar xvar [if exp] [in range] [ , generate(ysdlvar) nograph graph_options ]


sdline produces a scatter plot of yvar versus xvar with the SD line or reduced major axis superimposed.

This line goes through the intersection of the means (mean of xvar, mean of yvar) and has slope

sign of corr(xvar, yvar) * (SD of yvar) / (SD of xvar)


generate() saves the values of yvar predicted from the SD line as a new variable.

graph_options are options allowed with twoway scatter. The default options include ms(oh none) connect(none l) sort. Know that the data points are plotted first and the SD line second by twoway scatter. These options include plot_option (Stata 8 only) and addplot_option (Stata 9).

nograph suppresses the graph and is for situations in which only the numerical results for the SD line are desired.


. sdline length width . sdline length width, gen(length_sd) . sdline length width, addplot(lfit length width)

Saved results

r(N) number of observations r(ymean) mean of yvar r(ysd) SD of yvar r(xmean) mean of xvar r(xsd) SD of xvar r(slope) slope of SD line


Nicholas J. Cox, Durham University, U.K. n.j.cox@durham.ac.uk


Allan Reese found typos in this help.

Also see

On-line: twoway scatter