Dear all,
I have plotted a scatterplot and run two non-parametric smoothing functions over the respective data. The graphs work just fine for me, the question is the following: How can I calculate the intersection of the smoothed functions with the 45-degree-line? Basically, this reduces to the question, where the x- and y-value of the function are exactly the same. You can find my code and the resulting graph below.
Thank you very much in advance
* Generate first graph
twoway scatter income_abi_ppp income_abi_ppp_t_2 , msize(tiny) mcolor(blue) ///
||scatteri 25 25 -5 -5, connect(l) msymbol(i) lpattern(dash) lcolor(black) ///
||lpoly income_abi_ppp income_abi_ppp_t_2, lpattern(solid) lwidth(medthick) lcolor(black) ///
legend(off) ///
xscale(range(-5 25)) xlabel(-5[5]25) yscale(range(-5 25)) ylabel(-5[5]25) ///
ytitle("Daily p.c. ABI in 2005PPP US$, 2016") ///
title("Kernel, Entire Sample") ///
saving(Figure_4_poly_all)
* Generate secondgraph
twoway scatter income_abi_ppp income_abi_ppp_t_2 , msize(tiny) mcolor(blue) ///
|| scatteri 25 25 -5 -5, connect(l) msymbol(i) lpattern(dash) lcolor(black) ///
|| lowess income_abi_ppp income_abi_ppp_t_2, lpattern(solid) lwidth(medthick) lcolor(black) ///
legend(off) ///
xscale(range(-5 25)) xlabel(-5[5]25) yscale(range(-5 25)) ylabel(-5[5]25) ///
ytitle("Daily p.c. ABI in 2005PPP US$, 2016") ///
xtitle("Daily p.c. ABI in 2005PPP US$, 2010") ///
title("Lowess, Entire Sample") ///
saving(Figure_4_lowess_all)
* Combine the two graphs
graph combine "Figure_4_poly_all" ///
"Figure_4_lowess_all", ///
rows(2) cols(3) ///
title("Mean Asset Paths") ///
ycommon xcommon iscale(0.5) ///
saving(Statalist_Kernel_Lowess_All)
I have plotted a scatterplot and run two non-parametric smoothing functions over the respective data. The graphs work just fine for me, the question is the following: How can I calculate the intersection of the smoothed functions with the 45-degree-line? Basically, this reduces to the question, where the x- and y-value of the function are exactly the same. You can find my code and the resulting graph below.
Thank you very much in advance
* Generate first graph
twoway scatter income_abi_ppp income_abi_ppp_t_2 , msize(tiny) mcolor(blue) ///
||scatteri 25 25 -5 -5, connect(l) msymbol(i) lpattern(dash) lcolor(black) ///
||lpoly income_abi_ppp income_abi_ppp_t_2, lpattern(solid) lwidth(medthick) lcolor(black) ///
legend(off) ///
xscale(range(-5 25)) xlabel(-5[5]25) yscale(range(-5 25)) ylabel(-5[5]25) ///
ytitle("Daily p.c. ABI in 2005PPP US$, 2016") ///
title("Kernel, Entire Sample") ///
saving(Figure_4_poly_all)
* Generate secondgraph
twoway scatter income_abi_ppp income_abi_ppp_t_2 , msize(tiny) mcolor(blue) ///
|| scatteri 25 25 -5 -5, connect(l) msymbol(i) lpattern(dash) lcolor(black) ///
|| lowess income_abi_ppp income_abi_ppp_t_2, lpattern(solid) lwidth(medthick) lcolor(black) ///
legend(off) ///
xscale(range(-5 25)) xlabel(-5[5]25) yscale(range(-5 25)) ylabel(-5[5]25) ///
ytitle("Daily p.c. ABI in 2005PPP US$, 2016") ///
xtitle("Daily p.c. ABI in 2005PPP US$, 2010") ///
title("Lowess, Entire Sample") ///
saving(Figure_4_lowess_all)
* Combine the two graphs
graph combine "Figure_4_poly_all" ///
"Figure_4_lowess_all", ///
rows(2) cols(3) ///
title("Mean Asset Paths") ///
ycommon xcommon iscale(0.5) ///
saving(Statalist_Kernel_Lowess_All)
Comment