RATS 11.1
RATS 11.1

@BAING estimates the required number of factors in a linear factor model using the formulas in Bai and Ng(2002).
 

@BaiNg( options )   x

Parameters

X

nper x nvar matrix of data. The factors will be nper x 1 vectors

Options

MAX=maximum number of factors to consider [5]
 

[CENTER]/NOCENTER

With CENTER, subtract means from data columns

 

STANDARDIZE/[NOSTANDARDIZE]

With STANDARDIZE, standardize data columns to mean zero, unit variance

 

TITLE="title for report" ["Bai-Ng Factor Determination"]

Example

This is an example from Tsay's Analysis of Financial Time Series. The data set has 36 time periods with returns from 40 securities. Note that the data needs to be put into a rectangular array of data before being input to the procedure.

 

*

* Tsay, Analysis of Financial Time Series, 3rd edition

* Example 9.6.2 from pp 500-501

*

open data m-apca0103.txt

calendar(panelobs=36,m) 2001

data(format=free,org=columns) 1//2001:01 40//2003:12 id date retn

*

compute nper=36

compute nvar=40

*

* Repackage data into an nper x nvar matrix

*

dec rect rmat(nper,nvar)

ewise rmat(i,j)=retn((j-1)*nper+i)

*

* Do Bai-Ng analysis of number of factors

*

@BaiNg(max=10,center) rmat

 

Sample Output

Bai and Ng propose four different criteria, each of which you are attempting to minimize. The *'s indicate the minimizer in the column. The PCP1 and PCP2 criteria choose 9 factors (from a maximum of 10), while ICP1 picks 6 and ICP2 picks 5.

 

Bai-Ng Factor Determination

Factors   PCP1     PCP2     ICP1      ICP2

      1 0.02045  0.02057  -3.76184  -3.72796

      2 0.01612  0.01636  -3.88833  -3.82058

      3 0.01350  0.01387  -3.97048  -3.86885

      4 0.01167  0.01215  -4.04093  -3.90543

      5 0.01035  0.01095  -4.10687  -3.93749*

      6 0.00978  0.01051  -4.11160* -3.90835

      7 0.00941  0.01026  -4.11076  -3.87363

      8 0.00923  0.01020  -4.09915  -3.82815

      9 0.00910* 0.01019* -4.09656  -3.79168

     10 0.00912  0.01033  -4.08175  -3.74299


 


Copyright © 2026 Thomas A. Doan