I'm trying to graph a scatterplot with a regressionline. Instead of a standard OLS estimation, I would like to fit a line using
I use the aaplot module to get the graph autamtically annotated with the estimated regression coefficients and R^2.
Trying to get a weighted regression line, I include the option [w=weights] in my lfit command:
Code:
aaplot y x, addplot(lfit y x [w=weights])
However, the output does not look as desired, with only one regression line (from the weighted estimation) and the correct coefficients for this regression.
Instead, the plot includes 2 lines (one in green and one in a light grey) and the estimated regression coefficients and R^2 appear to be from a standard unweighted regression (see png. below).
Is there a possibility to get a scatterplot with only a regression line from a weighted regression using the aaplot command?
Array
0 Response to Scatterplot with weighted regression line using aaplot and lfit
Post a Comment