*! version 1 19jun2020
help baing

Title

baing -- Determines and estimates the number of common factors following Bai and Ng (2002).

Syntax

baing varlist [if] [in] [, options]

by is not allowed.

You must tsset your data before using baing; see [TS] tsset.

varlist may not contain time-series operators; see tsvarlist.

Sample may not contain gaps.

Description

baing Determines the number of common factors in approximate factor models following Bai and Ng (2002).

Options

criteria(integer) specifies one of the three information criteria (IC) proposed by Bai and Ng (2002, p.201).
By default IC1 is used, that is, crit(1). Otherwise, use crit(2) or crit(3) for IC2 or IC3, respectively.

maxpc(integer) specifies the maximum number of factors.
By default, the number of variables in varlist is used.

stand standardises the variables in varlist by subtracting the mean and dividing by the standard deviation of each variable.

prefix(string) stores the estimated common factors in string, as string1, string2, .... .
If this option is not used, only the number of common factors is determined.

Examples

We illustrate the use of baing with the following example:

. clear all

. set obs 50

. set seed 123

. gen t = _n

. gen x1 = rnormal()

. gen x2 = rnormal()

. gen x3 = rnormal()

. gen x4 = rnormal()

. gen x5 = rnormal()

. gen x6 = rnormal()

. gen x7 = rnormal()

. gen x8 = rnormal()

. gen x9 = rnormal()

. gen x10 = rnormal()

. tsset t

To determine the number of common factors using the raw variables x1, ..., x10 and the first criterion (IC1, which is used as default):

. baing x*

Same as before but using standardised data:

. baing x*, stand

Same as before and setting the maximum number of factors equal to, say, 5:

. baing x*, stand max(5)

Same as before and storing the resulting common factor variables as myfactors1, myfactors2, ...:

. baing x*, stand max(5) prefix(myfactors)

To use standardised data, maximum number of factors set equal to 5 and IC2:

. baing x*, stand max(5) crit(2)

Stored results

baing stores:

Scalars

r(baing_ic) number of factors

References

Bai J., S. Ng. 2002. Determining the number of factors in approximate factor models. Econometrica 70: 191-221.

Chudik A., G. Kapetanios and M. H. Pesaran. 2018. A one covariate at a time, multiple testing approach to variable selection in high-dimensional linear regression models. Econometrica 86: 1479-1512.

Acknowledgement

The routine to determine the number of factors is based on the Eviews code snippet presented in:

http://blog.eviews.com/2018/11/principal-component-analysis-part-ii.html

The routine to estimate the factors is based on the Matlab code panelFactorNew.m developed by Chudik, Kapetanios and Pesaran (2018), included in the supplemental material of their paper. The interested reader is referred to:

http://www.econ.cam.ac.uk/people/emeritus/mhp1/published-articles#2018

Authors

Héctor M. Núñez

Centro de Investigación y Docencia Económicas (CIDE)

Aguscalientes, México

hector.nunez@cide.edu

Jesús Otero

Universidad del Rosario

Bogotá, Colombia

jesus.otero@urosario.edu.co