SD line (reduced major axis)
sdline yvar xvar [if exp] [in range] [ , generate(ysdlvar) nograph graph_options ]
Description
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)
Options
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.
Examples
. 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
Author
Nicholas J. Cox, Durham University, U.K. n.j.cox@durham.ac.uk
Acknowledgements
Allan Reese found typos in this help.
Also see
On-line: twoway scatter