universityterew.blogg.se

Stata local
Stata local









stata local

We'll look at just one predictor to keep things simple: systolic blood pressure ( sbp). It comes from a study of risk factors for heart disease (CORIS study, Rousseauw et al South Aftrican Medical Journal (1983) 64: 430-36.), comprising nine risk factors and a binary dependent variable indicating whether the person had previously had a heart attack at the time of entering the study.

STATA LOCAL DOWNLOAD

To work through the basic functionality, let's read in the data used in Hastie and colleagues' book, which you can download here. Npregress works just as well with binary, count or continuous data because it is not parametric, it doesn't assume any particular likelihood function for the dependent variable conditional on the prediction. That means that, once you run npregress, you can call on the wonderful margins and marginsplot to help you understand the shape of the function and communicate it to others. It is, but with one important difference: local-linear kernel regression also provides inferential statistics, so you not only get a predictive function but also standard errors and confidence intervals around that. You might be thinking that this sounds a lot like LOWESS, which has long been available in Stata as part of twoway graphics. This makes the resulting function smooth when all these little linear components are added together. The further away from the observation in question, the less weight the data contribute to that regression. Linear regressions are fittied to each observation in the data and their neighbouring observations, weighted by some smooth kernel distribution. A good reference to this for the mathematically-minded is Hastie, Tibshirani and Friedman's book Elements of Statistical Learning (section 6.1.1), which you can download for free. Stata achieves this by an algorithm called local-linear kernel regression. You can get predicted values, and residuals from it like any other regression model. The function doesn't follow any given parametric form, like being polynomial: Stata version 15 now includes a command npregress, which fits a smooth function to predict your dependent variable (endogenous variable, or outcome) using your independent variables (exogenous variables or predictors).

stata local

Stata Tips #14 - Non-parametric (local-linear kernel) regression in Stata 15 What is non-parametric regression?











Stata local