*! version 1.1.1 16mar2021

*! Sebastian Kripfganz, www.kripfganz.de

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

Title

kinkyreg2dta -- kinkyreg results to Stata data set

Syntax

kinkyreg2dta 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
range(numlist) admissible range for endogeneity

stepsize(numlist) admissible range for endogeneity

kinkyreg_options other options for kinkyreg estimation

Results
coef(coef_spec) specify estimation results to be saved; can be specified more than once

estat(estat_spec) specify postestimation results to be saved; can be specified more than once

* frame(framename [, replace]) generate data in new frame

* replace replace data in current frame

* saving(filename [, replace]) save data to file

double use storage type double

* At least one of the options frame(), replace, or saving() is required.
Option frame() requires Stata version 16 or higher. Option replace is required under Stata version 15 or lower.

coef_spec is

[b] [se] [ciub] [cilb]: [varlist] [numlist]

estat_spec is

# [chi2|F] [p]: estat_cmdline

See kinkyreg for estimation options and kinkyreg postestimation for features available after estimation.

Description

kinkyreg2dta creates a data set with the KLS estimation and postestimation results that can be used for further analysis and reporting. Multiple endogenous regressors are supported.
kinkyreg2dta neither produces any graphs nor estimation or postestimation output.

Options

Model

range(#_1 #_2 [#_3 #_4 ...]) requests to compute the KLS estimator for all feasible endogeneity correlations in the joint intervals [#_1 #_2] for the first endogenous variable in varlist2,
[#_3 #_4] for the second endogenous variable in varlist2, and so on. range(#_1 #_2) with only two elements yields identical intervals for all endogenous variables. The default is range(-1 1).

stepsize(#_1 [#_2 ...]) sets the step size for the intervals over which the KLS estimator is computed. Separate step sizes can be specified for each endogenous variable in the order in which they appear in varlist2.
stepsize(#_1) with only one element yields identical step sizes for all endogenous variables. The default is stepsize(0.01).

kinkyreg_options: ekurtosis(#), xkurtosis(#), noconstant, level(#), small, and lincom(#: exp); see kinkyreg.

Results

coef([b] [se] [ciub] [cilb]: [varlist] [numlist]) specifies the kinkyreg estimation results to be saved.
These can be coefficient estimates (b), standard errors (se), confidence interval upper bounds (ciub), and confidence interval lower bounds (cilb).
The respective results are saved for the coefficients of all variables in varlist and linear combinations with reference numbers # in numlist.
These linear combinations must be specified with the kinkyreg option lincom(#: exp); see kinkyreg.
If neither varlist nor numlist are specified, the results are saved for all endogenous variables in varlist2. You may specify as many sets of estimation results as you need.

estat(# [chi2|F] [p]: estat_cmdline) specifies the kinkyreg postestimation estimation results to be saved.
These can be the values of the test statistic (chi2 or F) and the p-values (p). estat_cmdline is the full syntax of the estat subcommand, including any options. The word estat is optional.
You may specify as many postestimation results, with different reference number #, as you need.

frame(framename [, replace]) requests to create a new frame with name framename in which the new variables are generated. The new frame is made the current frame;
see [D] frames. replace specifies that the frame may be replaced if it already exists.

replace specifies that the data in memory shall be replaced with the newly generated data, even if the current data have not been saved to disk.

saving(filename [, replace]) requests to save the newly generated data to disk under the name filename. replace permits to overwrite an existing data set.

double requests to use the storage type double for the variables in the new data set.

Remarks

If multiple endogenous variables are specified in varlist2, the kinkyreg2dta command calls the kinkyreg command and its postestimation commands in a loop
to obtain estimates for all points on the specified grid of endogeneity correlations. The number of grid points is restricted to the matrix dimension limit of the installed Stata flavor.
Variables in the new data set that identify the correlation values for each grid point are named _rho_varname, where varname is the name of an endogenous variable.

Variables for the estimation results requested to be saved with option coef() are named _result_varname|#, where result is one of b, se, ciub, or cilb.
varname is the name of a regressor, and # is a reference number of a linear combination.

Variables for the postestimation results requested to be saved with option estat() are named _test_#_result_coln,
where test is one of test, excl, reset, hett, or dur, according to the minimum abbreviation of the respective estat subcommand,
and where result is one of chi2, F, or p. The reference number # and the column name coln are used to uniquely identify the postestimation results.

Example

Setup

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

Create new frame with KLS estimation and postestimation results

. kinkyreg2dta lw s expr tenure rns smsa _I* (iq kww), range(-0.2 0) coef(b se:) estat(1 chi2 p: estat test iq = kww) frame(kinkyreg)

Twoway contour plot for the KLS postestimation test p-values

. twoway contour _test_1_p_1 _rho_iq _rho_kww, ccuts(0.01 0.05 0.1)

Authors

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

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