I have some code that uses the user-defined function kernmean, which computes kernel means for bivariate regression. The code is:
Where the function estimates a local kernel mean at each value of variable z using the epanechnikov kernel and a bandwidth of 5 for all observations satisfying the various conditions.
My issue is that I need to include controls in the regression and cannot do this using the user-defined function kernmean. Instead I want to use the STATA command npregress. The code I have so far is:
However, this does not estimate the mean at each value of variable z.
Is there a way to include such an option in the npregress command, or is there another command that could accomplish this?
Cross-posted from: https://stackoverflow.com/questions/...as-is-possible
Code:
kernmean y x if cond_a==1 & cond_b=1 & cond_c>cond_d, order(1) at(z) generate(newvar) epan bw(5)
My issue is that I need to include controls in the regression and cannot do this using the user-defined function kernmean. Instead I want to use the STATA command npregress. The code I have so far is:
Code:
npregress kernel y x control if if cond_a==1 & cond_b=1 & cond_c>cond_d, kernel(ep) predict(newvar1 newvar2 newvar3) bwidth(5 5 5 5, copy)
Is there a way to include such an option in the npregress command, or is there another command that could accomplish this?
Cross-posted from: https://stackoverflow.com/questions/...as-is-possible
Comment