BAING - Chooses number of factors in linear factor model

Use this forum to post complete RATS "procedures". Please be sure to include instructions on using the procedure and detailed references where applicable.

BAING - Chooses number of factors in linear factor model

Postby TomDoan » Wed Jun 29, 2011 12:32 pm

This procedure estimates the required number of factors in a linear factor model using the formulas in Bai and Ng(2002), "Determining the Number of Factors in Approximate Factor Models", Econometrica, 2002, vol 70, pp 191-222.

baing.src
Procedure file
(3.3 KiB) Downloaded 89 times


@BaiNg( options ) x

Parameters:

x = nper x nvar matrix of data. The factors are nper x 1 vectors

Options:
[CENTER]/NOCENTER - subtract means from data columns
STANDARDIZE/[NOSTANDARDIZE] - standardize data columns to mean zero, unit variance
MAX=maximum number of factors to consider
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.

Code: Select all
*
* 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
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Return to RATS Procedures

Who is online

Users browsing this forum: No registered users and 2 guests