*! version 1.1.1 16mar2021

*! Sebastian Kripfganz, www.kripfganz.de

*! Jan F. Kiviet, sites.google.com/site/homepagejfk/

Title

kinkyreg -- Kinky least squares estimation and inference

Syntax

kinkyreg depvar [varlist1] (varlist2 [= varlist_iv]) [if] [in] [, options]

varlist1 is a list of exogenous variables.

varlist2 is a list of endogenous variables.

varlist_iv is a list of excluded instrumental variables.

options

Model
* endogeneity(numlist) specify values for the endogeneity correlations

range(#_1 #_2) admissible range for endogeneity

stepsize(#) step size for considered endogeneities

ekurtosis(#) specify kurtosis of error term

xkurtosis(#) specify kurtosis of right-hand side variables

noconstant suppress constant term

Reporting
correlation(#) postulated endogeneity for regression output

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

small make degrees-of-freedom adjustment and report small-sample statistics

inference(varlist) specify variables for KLS inference

lincom(#: exp) specify linear combinations for KLS inference; can be specified more than once

twoway(twoway_spec) specify options for twoway graphs; can be specified more than once

coefplot(coefplot_spec) specify options for coefficient plots; can be specified more than once

ciplot(ciplot_spec) specify options for confidence interval plots; can be specified more than once

namestub(namestub) set prefix for twoway graph names

ivperfect do not check for collinearity between endogenous regressors and excluded instruments

nograph suppress creation of graphs

noheader suppress output header

notable suppress coefficient table

novstore do not store variance-covariance matrices for each grid point; seldom used

display_options control

* This option is required if varlist2 contains multiple endogenous variables.

twoway_spec is

[varname|#] [, twoway_options order(orderinfo) yrange(#_1 #_2) addplot(plotinfo)]

coefplot_spec is

kls|iv [varname|#] [, line_options recast(newplottype)]

ciplot_spec is

kls|iv [varname|#] [, fitarea_options recast(newplottype)]

See kinkyreg postestimation for features available after estimation and kinkyreg2dta for a convenience tool to generate a data set of estimation and postestimation results.

kinkyreg is a community-contributed program. The current version requires Stata version 13 or higher; see version history and updates.

Description

kinkyreg implements the kinky least squares (KLS) estimator proposed by Kiviet (2020) for linear regression models with endogenous regressors.
The coefficient estimates and confidence intervals are graphically compared to the instrumental variables (IV) / two-stage least squares (2SLS) estimator; see [R] ivregress.
The instrumental variables are not needed for KLS inference.

Options

Model

endogeneity(numlist) specifies values for the correlations of the endogenous variables with the error term. The order of the values corresponds to the order of the variables in varlist2.
A missing value (.) must be specified for the variable for which the endogeneity correlation should be varied over the range specified with option range(). All other endogeneity correlations are held fixed.
This option is required if varlist2 contains multiple variables, and it is redundant otherwise. For a way to jointly vary the endogeneity correlations of multiple endogenous variables, see kinkyreg2dta.

range(#_1 #_2) requests to compute the KLS estimator for all feasible endogeneity correlations in the interval [#_1, #_2]. The default is range(-1 1).

stepsize(#) sets the step size for the interval over which the KLS estimator is computed. The default is stepsize(0.01).

ekurtosis(#) specifies a value for the kurtosis of the error term to be used in the variance calculation. By default, the kurtosis is estimated based on the KLS estimates.

xkurtosis(#) specifies a value for the kurtosis of the right-hand side variables to be used in the variance calculation. By default, the maximum of the estimated kurtosis for all variables in varlist1 and varlist2 is used.

noconstant; see [R] estimation options.

Reporting

correlation(#) requests to display estimation results for the specified endogeneity correlation and to return the results in e(b) and e(V).
If # does not match a value on the grid specified with options range() and stepsize(), the estimation results for the closest grid point to # are displayed.
By default, a regression table is not displayed and estimation results are not returned in e(b) and e(V).

level(#); see [R] estimation options.

small requests that a degrees-of-freedom adjustment be made to the variance-covariance matrix and that small-sample t and F statistics be reported.
The adjustment factor is N/(N-K), where N is the number of observations and K the number of coefficients. By default, no degrees-of-freedom adjustment is made and z and Wald statistics are reported.

inference(varlist) specifies variables for which KLS inference graphs are generated. By default, KLS inference is only carried out for the endogenous regressors, inference(varlist2), unless option lincom() is specified.
In the latter case, the default is to produce KLS inference only for the specified linear combinations.

lincom(#: exp) specifies linear combinations exp of the regression coefficients for which KLS inference graphs are generated; see [R] lincom.
You may specify as many sets of linear combinations, with different reference number # (an integer number between 1 and 1,999), as you need.

twoway([varname|#] [, twoway_options order(orderinfo) yrange(#_1 #_2) addplot(plotinfo)} specifies options for twoway graphs; see [G-2] graph twoway.
varname must be a variable name in varlist1 or varlist2. # must be the reference number for a linear combination specified with option lincom().
If neither varname nor # are specified, then all twoway graphs are addressed.

The twoway options name(name) and saving(filename) require varname or # to be specified.
If name() is not specified, name(namestub_varname|#, replace) is assumed. The prefix is set with option namestub(namestub).
If varname is specified and the addressed variable contains factor variable or time series operators, the symbols "." and "#" are replaced by "_".

order(orderinfo) allows to change the order in which the plots are drawn. orderinfo is a list containing one or more of the following graph elements in the order in which they shall be drawn:
kls for the KLS coefficient estimate, kls_ci for the KLS confidence interval, iv for the IV coefficient estimate, and iv_ci for the IV confidence interval. The default is order(iv_ci iv kls_ci kls).
This option also affects the order of the graph elements in the graph legend; see legend_options.

yrange(#_1 #_2) specifies that the coefficient and confidence interval plots be restricted to the interval [#_1, #_2] on the y axis.
A missing value for #_1 or #_2 refers to minus or plus infinity, respectively.

addplot(plot [, before(orderinfo)]) allows to overlay the twoway graphs with additional plots; see addplot_option.
before(orderinfo) allows to change the order of the graph elements by drawing the additional plots immediately before the specified element.
orderinfo is one of the graph elements kls, kls_ci, iv, iv_ci as specified with suboption order(). By default, the additional plots are ordered last.

coefplot(kls|iv [varname|#] [, line_options recast(newplottype)]) determines the look of the KLS and IV coefficient plots.
By default, these are options for twoway line plots; see [G-2] graph twoway line. varname must be a variable name in varlist1 or varlist2.
# must be the reference number for a linear combination specified with option lincom(). If neither varname nor # are specified, then all coefficient plots are addressed.

recast(newplottype) allows to treat the plot as newplottype instead of a line plot; see advanced_options.

ciplot(kls|iv [varname|#] [, fitarea_options recast(newplottype)]) determines the look of the KLS and IV confidence interval plots.
By default, these are options for twoway range plots with area shading; see [G-2] graph twoway rarea. varname must be a variable name in varlist1 or varlist2.
# must be the reference number for a linear combination specified with option lincom(). If neither varname nor # are specified, then all confidence interval plots are addressed.

recast(newplottype) allows to treat the plot as newplottype instead of a range plot with area shading; see advanced_options.

namestub(namestub) sets the prefix for the names of all graphs being created unless a name is explicitly specified with option twoway(varname|#, name(name)).
The default is namestub(kinkyreg). This option also affects the graphs created by the postestimation commands.

ivperfect; see option perfect of [R] ivregress.

coeflegend; see [R] estimation options.

nograph suppresses the creation of graphs for KLS inference.

noheader suppresses display of the header above the coefficient table that displays the number of observations.

notable suppresses display of the coefficient table.

novstore requests not to store the variance-covariance matrices for each grid point in order to consume less memory. By default, these matrices are stored as hidden estimation results.
They are required by some postestimation commands. This option is seldom used.

display_options: noci, nopvalues, noomitted, vsquish, noemptycells, baselevels, allbaselevels, nofvlabel, fvwrap(#), fvwrapon(style), cformat(%fmt),
pformat(%fmt), sformat(%fmt), and nolstretch; see [R] estimation options.

Remarks

See Kripfganz and Kiviet (2021) for background information and examples.

Example

Setup

. use http://www.stata-press.com/data/imeus/griliches

Graphical inference for KLS estimation with 2SLS comparison

. kinkyreg lw s expr tenure rns smsa _I* (iq = age mrt), range(-0.7 0.7) inference(iq s)

Regression output for selected endogeneity correlation

. kinkyreg, correlation(-0.4)

Graphical inference for KLS estimation with two endogenous variables and fixed endogeneity correlation for the second endogenous variable

. kinkyreg lw s expr tenure rns smsa _I* (iq kww), endogeneity(. -0.2) range(-0.7 0.7) inference(iq s)

Saved results

kinkyreg saves the following in e():

Scalars

e(N) number of observations

e(df_r) residual degrees of freedom; not always saved

e(rank) rank of e(V)

e(xkurtosis) maximum kurtosis of right-hand side variables

e(grid_min) lower bound for admissible endogeneity

e(grid_max) upper bound for admissible endogeneity

e(grid_step) step size for considered endogeneities

e(corr) postulated endogeneity for e(b); not always saved

Macros

e(cmd) kinkyreg

e(cmdline) command as typed

e(estat_cmd) kinkyreg_estat

e(predict) kinkyreg_p

e(klsvar) endogenous variable with varied endogeneity

e(endovars) endogenous variables

e(exovars) exogenous variables

e(ivvars) instrumental variables

e(namestub) prefix for graph names

e(properties) b V; not always saved

e(depvar) name of dependent variable

Matrices

e(b) coefficient vector; not always saved

e(V) variance-covariance matrix of the estimators; not always saved

e(b_kls) KLS coefficient vectors

e(se_kls) KLS standard errors

e(ciub_kls) KLS confidence interval upper bounds

e(cilb_kls) KLS confidence interval lower bounds

e(b_kls_lincom) KLS lincom coefficient vectors; not always saved

e(se_kls_lincom) KLS lincom standard errors; not always saved

e(ciub_kls_lincom) KLS lincom CI upper bounds; not always saved

e(cilb_kls_lincom) KLS lincom CI lower bounds; not always saved

e(endogeneity) fixed endogeneity correlations; not always saved

e(sigma2e) KLS estimates of sigma_e^2

e(ekurtosis) kurtosis of KLS residuals

Functions

e(sample) marks estimation sample

Version history and updates

kinkyreg is a community-contributed program. To determine the currently installed version, type

. which kinkyreg, all

To update the kinkyreg package to the latest version, type

. //www.kripfganz.de/stata/") replace"'

Authors

Sebastian Kripfganz, University of Exeter, http://www.kripfganz.de

Jan F. Kiviet, University of Amsterdam, https://sites.google.com/site/homepagejfk/

References

Kiviet, J. F. 2020.
Testing the impossible: identifying exclusion restrictions.
Journal of Econometrics 218: 294-316.

Kiviet, J. F. 2020.
Instrument-free inference under confined regressor endogeneity and mild regularity.
Stellenbosch Economic Working Papers: WP09/2020.

Kripfganz, S., and J. F. Kiviet. 2021.
kinkyreg: Instrument-free inference for linear regression models with endogenous regressors.
Accepted for publication in the Stata Journal.