help for locpr

Semi-parametrically estimate probability/proportion as a function of one regressor

Syntax

locpr [varlist]
[, stub(string)
logit combine
other options ]

stub(string) save graphed predictions to new variables with names beginning with string

plot(string) add string to each graph command (useful for adding plots)

logit estimate a logit model and graph results

combine combine logit and semi-parametric estimates in one graph

rarea(string) pass options string to rarea command graphing CI

loptions(string) pass options string to logit prediction graph

coptions(string) pass options string to combined graph

nquantiles(integer) specifies how many points at which to estimate the local regression (default is 99)}

levels estimate the local regression at each distinct value of the regressor}

Description

locpr semi-parametrically estimates a probability or proportion as
a function of one other variable and graphs the result. Specifically, it
estimates a local linear regression using lpoly and approximates the endpoints
of the confidence interval via a logit transformation. The estimates are computed at
a number of quantiles (99 percentiles by default) of the regressor
(or at each value of the regressor within the range of those quantiles, if
there are fewer distinct values than the number of quantiles, unless
the levels option requests estimation at every distinct value of the regressor)
and graphed. The logit option
offers a direct comparison to parametric logistic regression.
Other twoway options may be specified that apply to the
graph of local regression estimates.

Examples

sysuse nlsw88, clear

locpr never_married hours, l c

webuse nhanes2, clear

g bmi=weight/height^2*10000

lpoly highbp bmi [aw=finalwgt], nosc ci name(lpoly)

locpr highbp bmi [pw=finalwgt], l c name(hibp)

locpr diabetes bmi [pw=finalwgt], l c name(diab)

webuse psidextract, clear

locpr ms lwage, l c name(lwage)

locpr ms wks, l c name(wks)

locpr ms ed, l c name(ed)

*why graphs exclude bottom and top 1% of X by default:

*(also add a rug plot and vertical lines at 1%ile and 99%ile)

g l="|"

g o=-.1

_pctile wks, nq(100)

loc p1=r(r1)

loc p99=r(r99)

locpr union wks, yla(0(.5)1) xli(`p1') xli(`p99') plot(|| scatter o wks, ms(none) mlabel(l) mlabp(0))

locpr union wks, levels yla(0(.5)1) xli(`p1') xli(`p99') plot(|| scatter o wks, ms(none) mlabel(l) mlabp(0))

Author

Austin Nichols
Urban Institute
Washington, DC, USA
austinnichols@gmail.com

Also see

On-line: logit, probit, glm, lpoly, lowess, mlowess (on SSC), transint (on SSC)