Dear all,
I'm trying to replicate the results retrieved by -twoway lowess- with the command -lowess-. The reason for is is that I need the smoothed data points to send them to another department.
Unfortunately, the results I get from -lowess- are not the same as from -twoway lowess- although I've specified the same options (bwidth etc.). Another soultion for my problem would be an option to save the results coming from -twoway lowess- to a variabel.
I would post a snapshot of my data but the precise reason why I'm trying to use -lowess- are confidality reasons.
My code looks as follows:
I attach the comparision of results. Notably the -twoway lowess- graph remains at zero for a longer in the beginning - this is the expected result. Also it is more smooth than the pure -lowess- command.
I'm trying to replicate the results retrieved by -twoway lowess- with the command -lowess-. The reason for is is that I need the smoothed data points to send them to another department.
Unfortunately, the results I get from -lowess- are not the same as from -twoway lowess- although I've specified the same options (bwidth etc.). Another soultion for my problem would be an option to save the results coming from -twoway lowess- to a variabel.
I would post a snapshot of my data but the precise reason why I'm trying to use -lowess- are confidality reasons.
My code looks as follows:
Code:
lowess krit2_surplus_max_bs_share_all krit2_surplus_max if krit2_surplus_max>=0 & krit2_surplus_max<=10000, bwidth(0.1) gen(skrit2_surplus_max_bs_share_all )
lowess krit3_surplus_max_bs_share_all krit3_surplus_max if krit3_surplus_max>=0 & krit3_surplus_max<=10000, bwidth(0.1) gen(skrit3_surplus_max_bs_share_all )
lowess krit4_surplus_max_bs_share_all krit4_surplus_max if krit4_surplus_max>=0 & krit4_surplus_max<=10000, bwidth(0.1) gen(skrit4_surplus_max_bs_share_all )
lowess krit7_surplus_max_bs_share_all krit7_surplus_max if krit7_surplus_max>=0 & krit7_surplus_max<=10000, bwidth(0.1) gen(skrit7_surplus_max_bs_share_all )
twoway (line skrit2_surplus_max_bs_share_all krit2_surplus_max if krit2_surplus_max<=10000, connect(stairstep) sort(Datum krit2_surplus_max) ) ///
(line skrit3_surplus_max_bs_share_all krit3_surplus_max if krit3_surplus_max<=10000, sort(Datum krit3_surplus_max) ) ///
(line skrit4_surplus_max_bs_share_all krit4_surplus_max if krit4_surplus_max<=10000, sort(Datum krit4_surplus_max) ) ///
(line skrit7_surplus_max_bs_share_all krit7_surplus_max if krit7_surplus_max<=10000, sort(Datum krit7_surplus_max) ) ///
if Datum==td(${selectdate}), subtitle("lowess")
twoway (lowess krit2_surplus_max_bs_share_all krit2_surplus_max if krit2_surplus_max>=0 & krit2_surplus_max<=10000, bwidth(0.1) sort(Datum krit2_surplus_max) ) ///
(lowess krit3_surplus_max_bs_share_all krit3_surplus_max if krit3_surplus_max>=0 & krit3_surplus_max<=10000, bwidth(0.1) sort(Datum krit3_surplus_max) ) ///
(lowess krit4_surplus_max_bs_share_all krit4_surplus_max if krit4_surplus_max>=0 & krit4_surplus_max<=10000, bwidth(0.1) sort(Datum krit4_surplus_max) ) ///
(lowess krit7_surplus_max_bs_share_all krit7_surplus_max if krit7_surplus_max>=0 & krit7_surplus_max<=10000, bwidth(0.1) sort(Datum krit7_surplus_max) ) ///
if Datum==td(${selectdate}), subtitle("twoway lowess")
