% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bai_ng.R
\name{.bai_ng}
\alias{.bai_ng}
\title{Bai and Ng (2002) Information Criteria for Number of Factors}
\usage{
.bai_ng(eigenvalues, V0, kmax, N, TT)
}
\arguments{
\item{eigenvalues}{Numeric vector of eigenvalues in descending order of
length kmax + 1, typically obtained from \code{.extract_eigenvalues()}.}

\item{V0}{Numeric scalar. Total mean squared value of the panel,
\code{sum(X^2) / (N * TT)}, computed from unstandardized demeaned data.}

\item{kmax}{Integer. Maximum number of factors to consider.}

\item{N}{Integer. Number of cross-sectional units.}

\item{TT}{Integer. Number of time periods.}
}
\value{
A named list with the following elements:
\describe{
\item{k_pc1}{Integer. Selected number of factors by PC_p1.}
\item{k_pc2}{Integer. Selected number of factors by PC_p2.}
\item{k_pc3}{Integer. Selected number of factors by PC_p3.}
\item{k_ic1}{Integer. Selected number of factors by IC_p1.}
\item{k_ic2}{Integer. Selected number of factors by IC_p2.}
\item{k_ic3}{Integer. Selected number of factors by IC_p3.}
\item{pc1}{Numeric vector of length kmax. Full PC_p1 criterion sequence.}
\item{pc2}{Numeric vector of length kmax. Full PC_p2 criterion sequence.}
\item{pc3}{Numeric vector of length kmax. Full PC_p3 criterion sequence.}
\item{ic1}{Numeric vector of length kmax. Full IC_p1 criterion sequence.}
\item{ic2}{Numeric vector of length kmax. Full IC_p2 criterion sequence.}
\item{ic3}{Numeric vector of length kmax. Full IC_p3 criterion sequence.}
}
}
\description{
Estimates the number of factors using the six penalty-based criteria
of Bai and Ng (2002). Includes three PC criteria (minimize penalized
residual variance) and three IC criteria (minimize penalized log residual
variance).
}
\details{
The six criteria are defined as follows. Let \eqn{V(k)} denote the
residual variance from a k-factor model, \eqn{m = \min(N, T)}, and
\eqn{\hat{\sigma}^2 = V(k_{max})}.

PC criteria (minimize penalized residual variance):
\deqn{PC_{p1}(k) = V(k) + k\hat{\sigma}^2 \frac{N+T}{NT} \ln\left(\frac{NT}{N+T}\right)}
\deqn{PC_{p2}(k) = V(k) + k\hat{\sigma}^2 \frac{N+T}{NT} \ln(m)}
\deqn{PC_{p3}(k) = V(k) + k\hat{\sigma}^2 \frac{\ln(m)}{m}}

IC criteria (minimize penalized log residual variance):
\deqn{IC_{p1}(k) = \ln(V(k)) + k \frac{N+T}{NT} \ln\left(\frac{NT}{N+T}\right)}
\deqn{IC_{p2}(k) = \ln(V(k)) + k \frac{N+T}{NT} \ln(m)}
\deqn{IC_{p3}(k) = \ln(V(k)) + k \frac{\ln(m)}{m}}

\eqn{V(k)} is computed from the eigenvalues of \eqn{XX'/(NT)} as:
\deqn{V(k) = \frac{1}{NT} \sum_{j=k+1}^{m} \lambda_j}
which is the mean residual variance after removing the first k factors.

All six criteria are minimized over \eqn{k = 0, 1, \ldots, k_{max}}.
Note that \eqn{k = 0} is included to allow for the possibility of no
factors.

These estimators require both N and T to be large for consistent
estimation. They may perform poorly when either dimension is small.
For more robust estimation, consider \code{.ahn_horenstein()}.
}
\references{
Bai, J. and Ng, S. (2002). Determining the Number of Factors in
Approximate Factor Models. \emph{Econometrica}, 70(1), 191-221.
}
\seealso{
\code{.ahn_horenstein()}, \code{.extract_eigenvalues()},
\code{\link{select_factors}}
}
