Hello everyone,
I am working a regression discontinuity study. I have an outcome (y), running variable (x), and a cutoff at x = 0. I would like to create a scatterplot, with two separate functions (before and after the cutoff point) where each function is a 4th degree polynomial of x. I am able to create the plot itself, but the functions does not overlap properly onto the graph. My code thus far as below:
graph twoway (scatter y x if t >= -15 & t <= 15, title("Earnings in -15≤t≤15") ///
xtitle("x") ytitle("Mean Earnings") yscale(range(3000 7000)) ///
name(scatter_plot, replace)) ///
(function y = 5420 + 19*t + 87*t*t + 914*t*t*t + 13.52*t*t*t*t)
Any help is greatly appreciated.
I am working a regression discontinuity study. I have an outcome (y), running variable (x), and a cutoff at x = 0. I would like to create a scatterplot, with two separate functions (before and after the cutoff point) where each function is a 4th degree polynomial of x. I am able to create the plot itself, but the functions does not overlap properly onto the graph. My code thus far as below:
graph twoway (scatter y x if t >= -15 & t <= 15, title("Earnings in -15≤t≤15") ///
xtitle("x") ytitle("Mean Earnings") yscale(range(3000 7000)) ///
name(scatter_plot, replace)) ///
(function y = 5420 + 19*t + 87*t*t + 914*t*t*t + 13.52*t*t*t*t)
Any help is greatly appreciated.
Comment