Page 1 of 1

Determining the Number of Factors

Posted: Tue May 17, 2011 5:09 am
by Frauke
Hello,

I want to analyse a money demand function for a panel of countries and would like to determine the number of factors to apply the PANIC methodology proposed by Bai and Ng (2004), A PANIC attack on unit roots and cointegration. Econometrica, 72, 1127–1177. Thus, I use the RATS procedure baing.scr (with fewer features since I work with RATS 6.3) to estimate the required number of factors of the set of countries for each variable (using the formulas in Bai and Ng, "Determining the Number of Factors in Approximate Factor Models", Econometrica, 2002, vol 70, pp 191-222).

First of all, I am not sure whether I have to define the original (differenced)* variables as matrix x or already estimated factors (using principal component analysis) or even both (I attach both as xls-file).
(Parameters: x = nper x nvar matrix of data. The factors are nper x 1 vectors)

Further, even though there are no error messages I get no output as I would expect from the code:

report(action=define)
report(atrow=1,atcol=1,align=center) "Factors" "PCP1" "PCP2" "ICP1" "ICP2"
report(atrow=2,atcol=1,fillby=cols) %seq(1,max)
report(atrow=2,atcol=2) stats
report(action=format,atcol=2,tocol=2,tag=min,special=onestar)
report(action=format,atcol=3,tocol=3,tag=min,special=onestar)
report(action=format,atcol=4,tocol=4,tag=min,special=onestar)
report(action=format,atcol=5,tocol=5,tag=min,special=onestar)
report(action=format,atrow=2,atcol=2,picture="*.#####",align=decimal)
report(action=show)

What might be the problem(s)?

Thanks in advance!
Frauke

*Following the PANIC methodology proposed by Bai and Ng (2004) I want to apply the method of principal components to the first differenced data.

Re: Determining the Number of Factors

Posted: Thu May 19, 2011 3:54 pm
by TomDoan
Frauke wrote:Hello,

I want to analyse a money demand function for a panel of countries and would like to determine the number of factors to apply the PANIC methodology proposed by Bai and Ng (2004), A PANIC attack on unit roots and cointegration. Econometrica, 72, 1127–1177. Thus, I use the RATS procedure baing.scr (with fewer features since I work with RATS 6.3) to estimate the required number of factors of the set of countries for each variable (using the formulas in Bai and Ng, "Determining the Number of Factors in Approximate Factor Models", Econometrica, 2002, vol 70, pp 191-222).

First of all, I am not sure whether I have to define the original (differenced)* variables as matrix x or already estimated factors (using principal component analysis) or even both (I attach both as xls-file).
(Parameters: x = nper x nvar matrix of data. The factors are nper x 1 vectors)

Further, even though there are no error messages I get no output as I would expect from the code:

report(action=define)
report(atrow=1,atcol=1,align=center) "Factors" "PCP1" "PCP2" "ICP1" "ICP2"
report(atrow=2,atcol=1,fillby=cols) %seq(1,max)
report(atrow=2,atcol=2) stats
report(action=format,atcol=2,tocol=2,tag=min,special=onestar)
report(action=format,atcol=3,tocol=3,tag=min,special=onestar)
report(action=format,atcol=4,tocol=4,tag=min,special=onestar)
report(action=format,atcol=5,tocol=5,tag=min,special=onestar)
report(action=format,atrow=2,atcol=2,picture="*.#####",align=decimal)
report(action=show)

What might be the problem(s)?

Thanks in advance!
Frauke

*Following the PANIC methodology proposed by Bai and Ng (2004) I want to apply the method of principal components to the first differenced data.
You indeed want to apply BaiNg to the first differenced data. This seems to work. I tested it with an older version of RATS.

Code: Select all

open data moneydemand.xls
data(format=xls,org=columns,sheet="dm1") 1 98 m1_au m1_cn m1_dk m1_fr m1_bd $
  m1_it m1_jp m1_nl m1_sd m1_sw m1_us
make x
# m1_au to m1_us
@baing(max=4,standardize) x

Re: Determining the Number of Factors

Posted: Fri May 20, 2011 3:14 am
by Frauke
Thanks a lot!
Now it works without any problems.

However, can you please confirm that it is correct to include the original, i.e. not decomposed, data in x but not the already estimated factors?
Or to put it in another way: Implies baing.scr a principal component analysis?

Regards,
Frauke

Re: Determining the Number of Factors

Posted: Fri May 20, 2011 6:04 am
by TomDoan
Frauke wrote:Thanks a lot!
Now it works without any problems.

However, can you please confirm that it is correct to include the original, i.e. not decomposed, data in x but not the already estimated factors?
Or to put it in another way: Implies baing.scr a principal component analysis?

Regards,
Frauke
That's correct. You input the original set of data (in this case in differences). Once you've decided upon the number of components, you use either PRINCOMP or PRINFACTORS (both standard RATS procedures) to extract the desired principal components for the next step.

Re: Determining the Number of Factors

Posted: Fri May 20, 2011 7:49 am
by Frauke
Thanks for the quick and informative reply!