I am trying to split the independent variable into different ranges and then regress the dependent variable on those separate ranges in one regression. The regression output will have different slopes for each range.
To explain simply, I am trying to replicate
Code:
twoway (lfit Y Range1) || (lfit Y Range2) || (lfit Y Range3)
For this I created,
Code:
egen range = cut(X), at(X1, X2, X3) icodes
And then ran the regression
Code:
reg Y i.range
Any help is much appreciated. Thank you.
0 Response to Linear regression on a string of ranges of indep var
Post a Comment