*! version 1.0 20July2020

*! version 2.0 12December2023
help skewreg

Title

skewreg -- Skewness Regression

Syntax

skewreg depvar [indepvars] [if] [in]
[, options]

Model
quantile(#) specify quantile of interest; default is quantile(.25)

reps(#) specify number of bootstrap replications; default is reps(50)

seed(#) set random seed; default is seed(1)

Reporting
detail show detailed results

graph graph coefficients and confidence intervals

level(#) set confidence level; default is level(95)

predict(string) predict conditional skewness

by and bysort are allowed; see prefix.

Description

skewreg performs skewness regression for cross-sectional or time-series data as defined in Chen and Xiao (2023), which quantifies the effects of covariates on quantile-based measure of skewness of the conditional distribution.
skewreg calls qrprocess for fast implementation of quantile regressions (Chernozhukov et al., 2020, 2022), which also avoids the potential problem of quantile crossing (Chernozhukov et al., 2010).
The command qrprocess can be installed from SSC by typing "ssc install qrprocess,replace".
skewreg then use margins to computes average marginal effects (AME), which are parameters of interest.
For a continuous variable x, AME is defined as marginal effects (dy/dx) averaged over all observations. For discrete variables, marginal effects are defined as discrete changes from the base level.
For example, for a dummy variable x, AME is defined as (y|x=1)-(y|x=0), averaged over all observations. Standard errors for AMEs are obtained by the delta method from bootstrap standard errors.

Options

Model

quantile specify quantile of interest. The default is quantile(.25),
which corresponds to conditional skewness as measured by
{[Q(.75|x)-Q(.5|x)]-[Q(.5|x)-Q(.25|x)]}/[Q(.75|x)-Q(.25|x)].

reps specify the number of bootstrap replications used for obtaining bootstrap standard errors. The default is reps(50) for fast computation, but reps(500) is recommended for accurate results.

seed set random seed for reproducible results. The default is seed(1).

Reporting

detail show detailed results, including underlying quantile regression, the numerator and denominator parts of skewness regression.

graph graph coefficients of skewness regression to visualize average marginal effects and their confidence intervals.

level(#) set confidence level for confidence intervals in both regression results and graph. The default is level(95) for the 95% confidence level.

predict(string) predict conditional skewness for possible later usage.

Examples: fast but trivial

Setup

. sysuse auto,clear

Fit a default skewness regression

. skewreg price mpg weight foreign

Fit a skewness regression with detailed output, 90% confidience intervals, coefficient graph, and record predicted conditional skewness as a new variable skewness

. skewreg price mpg weight foreign, detail level(90) graph predict(skewness)

Fit a skewness regression at the 0.1 quantile with random seed 123 and 500 bootstrap replications

. skewreg price mpg weight foreign, quantile(0.1) seed(123) reps(500)

Fit a skewness regression in a subsample

. skewreg price mpg weight foreign if rep78==3

Examples: slow but interesting

Setup (1% US census data in 1980 obtained from Angrist et al.(2006). After loading data, use command notes for a detailed description)

. sysuse census80.dta, clear

Fit a default skewness regression (for correct computation of AME, use factor variable (see fvvarlist) c.exper#c.exper so that Stata recognizes it as the square of exper)

. skewreg logwk educ black exper c.exper#c.exper

Test joint significance of coefficients following the above skewness regression

. test educ black exper

Fit a skewness regression with detailed output, 90% confidience intervals, coefficient graph, and record predicted conditional skewness as a new variable skewness

. skewreg logwk educ black exper c.exper#c.exper, detail level(90) graph predict(skewness)

Fit a skewness regression at the 0.1 quantile with random seed 123 and 500 bootstrap replications (very slow)

. skewreg logwk educ black exper c.exper#c.exper, quantile(0.1) seed(123) reps(500)

Fit a default skewness regression for the black and non-black subsamples respectively via bysort

. bysort black: skewreg logwk educ exper c.exper#c.exper

Example: time series

Setup

. sysuse sp500.dta, clear

Since qrprocess doesn't accept time-series operators (see tsvarlist), skewreg doesn't either. So define one-period lagged variable manually

. gen trade_date = _n

. tsset trade_date

. gen l1_close = l.close

Fit a default skewness regression

. skewreg close l1_close

Fit a skewness regression with detailed output, 90% confidience intervals, coefficient graph, and record predicted conditional skewness as a new variable skewness

. skewreg close l1_close, detail level(90) graph predict(skewness)

Fit a skewness regression at the 0.1 quantile with random seed 123 and 500 bootstrap replications

. skewreg close l1_close, quantile(0.1) seed(123) reps(500)

Stored results

skewreg stores the following in e():

Scalars

e(N) number of observations

e(df_r) residual degrees of freedom

e(reps) number of bootstrap replications

e(seed) random seed number

e(q1) quantile index of the first quantile regression

e(q2) quantile index of the second quantile regression

e(q3) quantile index of the third quantile regression

e(pr_q1) pseudo R2 of the first quantile regression

e(pr_q2) pseudo R2 of the second quantile regression

e(pr_q3) pseudo R2 of the third quantile regression

Macros

e(vcetype) Delta-method

e(cmdline) command as typed

e(cmd) skewreg

e(properties) b V

e(depvar) Skewness

Matrices

e(b) coefficient vector, i.e. average marginal effects

e(V) variance-covariance matrix of the estimators

Functions

e(sample) marks estimation sample

Author

Qiang Chen, School of Economics, Shandong University, P. R. China

qiang2chen2@126.com
www.econometrics-stata.com

References

Angrist, Joshua, Victor Chernozhukov and Iván Fernández-Val, 2006. Quantile Regression under Misspecification, with an Application to the U.S. Wage Structure.
Econometrica, 74(2), 539-563.

Chernozhukov, Victor, Iván Fernández-Val and Alfred Galichon, 2010. Quantile and Probability Curves without Crossing.
Econometrica, 78, 1093-1125.

Chernozhukov, Victor, Iván Fernández-Val and Blaise Melly, 2020. Quantile and Distribution Regression in Stata: Algorithms, Pointwise and Functional Inference. Working paper.

Chernozhukov, Victor, Iván Fernández-Val and Blaise Melly, 2022. Fast Algorithms for the Quantile Regression Process.
Empirical Economics, 62,7-33.

Chen, Qiang, and Zhijie Xiao, 2023, "Spread Regression, Skewness Regression and Kurtosis Regression with an Application to the U.S. Wage Structure," Journal of Applied Econometrics, revise and resubmit.