help for genspec

Title

genspec -- A General-to-Specific modelling algorithm

Syntax

genspec depvar indepvars [if] [in] [weight] [, options]

Options
vce(vcetype) determines the type of standard error (robust, cluster, bootstrap, or jackknife) to be reported in
the estimated regression model

xt(be|fe|re) specifies that the model is based upon panel data, and whether a random-effects (RE), fixed-effects (FE),
or between-effects (BE) model should be estimated. xtset must be specified prior to using this option

ts specifies that the model is based upon time-series data. tsset must be specified prior to using this option

nodiagnostic turns off the initial diagnostic tests for model misspecification; this should be used with caution

tlimit(#) sets the critical t-value for diagnostic tests (by default this value is 1.96)

numsearch(#) defines the number of search paths to follow in the algorithm (5 by default), if a large dataset is used,
fewer search paths may be preferred

nopartition uses the full sample of data in all search paths, and does not run out of sample testing

noserial requests that no serial correlation test is performed on panel data models; this option should only
be specified with the xt option

verbose requests full program output for each search path explored

Description

genspec is an algorithm for general-to-specific model prediction in Stata. It is designed to search a large number of variables, and from these
select the 'best' model based upon a criteria of relevance and explanatory power. From a user-defined general unrestricted model, or `GUM', (often
comprised of all independent variables the user considers potentially important, plus nonlinearities and lags), genspec
searches for the best possible final model among optimal subsets of the general model, as per the general-to-specific modelling process described in
the econometric literature. The user passes the GUM to genspec as a depvar and a group of indepvars which
are potentially important elements in the GUM. The initial GUM is tested for congruence, and then multiple search paths are followed. A potential
final specification is reached when no further restrictions of the GUM remain congruent, and/or no further insignificant variables remain.

genspec allows the user to run the model prediction algorithm for time-series, cross-sectional, or panel data models. The genspec command runs a
series of linear regressions when searching for the final (specific) model, so is a wrapper for either the regress or xtreg command. In
the case of time series or panel data models, the user must specifiy the ts or xt option, and tsset or xtset the data
respectively. For panel data models, the user written xtserial command is used. This option does not accept factor variable
operators. If factor variable operators are used with the xt option, noserial should be specified. The genspec command accepts
factor variables of the form # and c#, however does not accept the i. operator. For users who wish to include a full set of
dummy variables, these should be generated and passed as indepvars perhaps via Stata's tab, gen() command.

For further details regarding the functionality of genspec or general-to-specific modelling in general, refer to
General to Specific Modelling in Stata available at: https://sites.google.com/site/damiancclarke/research.

Examples

Search the auto dataset for the significant predictors of car price

. sysuse auto

. genspec price mpg rep78 headroom trunk weight length foreign turn displace

Search the National Longitudinal (panel) Survey for significant predictors of log wages

Setup

. webuse nlswork

. genspec ln_w grade age c.age#c.age ttl_exp c.ttl_exp#c.ttl_exp tenure c.tenure#c.tenure 2.race not_smsa south msp nev_mar union, xt(fe) numsearch(2)

Predict variables for Hoover and Perez (1999)'s time-series model 5

Setup

. webuse set http://users.ox.ac.uk/~ball3491/

. webuse gets_data

. qui ds y* u* time, not

. local xvars `r(varlist)'

. local lags l.dcoinc l.gd l.ggeq l.ggfeq l.ggfr l.gnpq l.gydq l.gpiq l.fmrra l.fmbase l.fm1dq l.fm2dq l.fsdj l.fyaaac l.lhc l.lhur l.mu l.mo

. genspec y5 `xvars' `lags' l.y5 l2.y5 l3.y5 l4.y5, ts

Saved results

genspec saves the following in e():

Scalars

e(fit) Bayesian Information Criterion of final specification

Macros

e(cmd) List of variables from the final specification

References

Clarke D.C., 2013.
General to Specific Modelling in Stata.
Manuscript.

Drukker D.M., 2003.
Testing for serial correlation in linear panel-data models,
Stata Journal 3(2): 168-177.

Hoover, K.D. and S.J. Perez., 1999.
Data mining reconsidered: encompassing the general-to-specific approach to specification search,
Econometrics Journal 2: 167-191.

Acknowledgements

I thank Marta Dormal, Dr. Bent Nielsen, Dr. Nicolas Van de Sijpe and George Vega Yon for useful
comments and advice. I also thank the Comisión Nacional de Investigación Científica
y Tecnológica of the Government of Chile who supported my research during the writing of this
program.

Also see

Online: [R] regress postestimation, [R] regress postestimation times series, [XT] xtreg postestimation

Author

Damian C. Clarke, Department of Economics, University of Oxford. damian.clarke@economics.ox.ac.uk