I have contributed this module to SSC (thanks to Kit Baum):
cdfquantreg: Stata module for estimating generalized linear models for doubly-bounded random variables with cdf-quantile distributions.
cdfquantreg estimates generalized linear models with cdf-quantile distributions for doubly-bounded random variables (Smithson & Shou, 2017). It assumes that the dependent variable's values are in the (0,1) interval. These two-parameter distributions are especially useful for modeling quantiles, and have very flexible shapes. They enable a wide variety of quantile regression models with predictors for the location and dispersion parameters, and simple interpretations of those parameters. Users may specify separate submodels for the location and for the dispersion parameters, with different or overlapping sets of predictors in each. This module has similar capabilities to its counterpart package in R (Shou & Smithson, 2019).
Code:
ssc install cdfquantreg
Code:
. cdfquantreg trbdi i.parentrel, cdf(logit) quantile(logistic) zvarlist(i.parentrel) nolog Number of obs = 4,582 Wald chi2(2) = 71.46 Log likelihood = 4675.7358 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ trbdi | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- eq1 | parentrel | 2 | -.0167766 .1381178 -0.12 0.903 -.2874826 .2539294 3 | -.5778559 .1268643 -4.55 0.000 -.8265054 -.3292063 | _cons | -2.027631 .1220459 -16.61 0.000 -2.266836 -1.788425 -------------+---------------------------------------------------------------- eq2 | parentrel | 2 | -.0225056 .069397 -0.32 0.746 -.1585212 .11351 3 | .1646371 .0625629 2.63 0.008 .0420161 .2872581 | _cons | .0670706 .0607738 1.10 0.270 -.0520438 .186185 ------------------------------------------------------------------------------
Code:
. cdfquantreg_m parentrel, pctle(0.75) Adjusted predictions Number of obs = 4,582 Model VCE : OIM Expression : Linear prediction, predict(equation(#1)) ------------------------------------------------------------------------------ | Delta-method | Margin Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- parentrel | 1 | -2.027631 .1220459 -16.61 0.000 -2.266836 -1.788425 2 | -2.044407 .0646633 -31.62 0.000 -2.171145 -1.917669 3 | -2.605487 .0346319 -75.23 0.000 -2.673364 -2.537609 ------------------------------------------------------------------------------ (results modresults are active now) Adjusted predictions Number of obs = 4,582 Model VCE : OIM Expression : Linear prediction, predict(equation(#2)) ------------------------------------------------------------------------------ | Delta-method | Margin Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- parentrel | 1 | .0670706 .0607738 1.10 0.270 -.0520438 .186185 2 | .044565 .0335035 1.33 0.183 -.0211007 .1102307 3 | .2317077 .0148547 15.60 0.000 .202593 .2608224 ------------------------------------------------------------------------------ (results modresults are active now) parentrel .75 quantile factor level -------------------------- .29884445 1bn.parentrel .28992918 2.parentrel .22786434 3.parentrel . cdfquantreg_m parentrel, pctle(0.25) * [SNIP] * parentrel .25 quantile factor level -------------------------- .03907345 1bn.parentrel .03942672 2.parentrel .01815365 3.parentrel * (.29884445/(1-.29884445))/(.03907345/(1-.03907345)) = 10.48188 * (.22786434/(1-.22786434))/(.01815365/(1-.01815365)) = 15.96108
cdfquantreg.sthlp, cdfquantreg_postestimation.sthlp, cdfquantreg_margins.sthlp
I am grateful to Bill Rising for his considerable advice and help on this project, but I hasten to add that any faults or errors in the module are mine alone. I welcome comments and suggestions, and an appropriate citation would be greatly appreciated if you end up using this module in your own research.
References:
Smithson, M. & Shou, Y. (2017). CDF-quantile distributions for modeling random variables on the unit interval. British Journal of Mathematical and Statistical Psychology, 70(3), 412-438 .
Shou, Y. & Smithson, M. (2019). cdfquantreg: An R package for CDF-Quantile Regression. Journal of Statistical Software, 88, 1-30.
Smithson, M. & Shou, Y. (2019). Generalized Linear Models for Bounded and Limited Quantitative Variables. Quantitative Applications in the Social Sciences Series. Belmont, CA: Sage.
Yu, Y., Yang, X., Yang, Y., Chen, L., Qiu, X., Qiao, Z., ... & He, J. (2015). The role of family environment in depressive symptoms among university students: a large sample survey in China. PloS One, 10(12), e0143612.
0 Response to cdfquantreg: Module for quantile regression models for doubly-bounded random variables with cdf-quantile distributions
Post a Comment