Description Usage Arguments Details Value References See Also Examples
Given the data, this function draws a scree plot and a plot of the eigenvalue ratios. The eignevalue ratio test is used to estimate the number of factors. See Ahn and Horenstein(2013).
1 2 |
X |
an n x p data matrix with each row being a sample. |
K.scree |
an optional integer specifying the number of eigenvalues to be plotted in the scree plot. Default is min(n,p). |
K.factors |
an optional integer specifying the number of eigenvalues to be used for the eigenvalue ratio test. Default is min(n,p)/2. |
robust |
a TRUE/FALSE indicating whether to use a robust covariance estimator if TRUE, or the sample covariance estimator. Default is TRUE. |
cv |
a boolean, specifying whether or not to run cross-validation for the tuning parameter. Default is TRUE. Only used if |
tau |
|
show.plot |
a TRUE/FALSE indicating whether to show the resulting plots. Default is FALSE. |
The maximum eigenvalue ratio is marked differently on the plot. The index of this maximum ratio gives the number of estimated factors.
If show.plots=TRUE
, plots are output and user has to hit <Return> to see the second plot. Alternatively, one may use the plot method for this class.
The tuning parameter = tau * sigma * optimal rate
where optimal rate
is the optimal rate for the tuning parameter. For details, see Fan et al.(2017). sigma
is the standard deviation of the data.
An object with S3 class farm.scree
containing:
eigenvalues
Eigenvalues of the covariance matrix
proportions
Proportion of variance explained by the principal components
eigenvalue.ratios
Ratios calculated in the eigenvalue ratio test
nfactors
Number of factors found using the eigenvalue ratio test
K.scree
Number of eigenvalues plotted in the scree plot
K.factors
Number of eigenvalues used in the eigenvalue ratio test
If show.plots=TRUE
function returns two plots: First plot is the scree plot of the data. Second plot illustrates the eigenvalue ratio test.
Ahn, S. C. and Horenstein, A. R. (2013). "Eigenvalue Ratio Test for the Number of Factors," Econometrica, 81 (3), 1203–1227.
Fan, J., Ke, Y., Sun, Q. and Zhou, W-X. (2017). "FARM-Test: Factor-Adjusted Robust Multiple Testing with False Discovery Control", https://arxiv.org/abs/1711.05386.
Zhou, W-X., Bose, K., Fan, J. and Liu, H. (2017). "A New Perspective on Robust M-Estimation: Finite Sample Theory and Applications to Dependence-Adjusted Multiple Testing," Annals of Statistics, to appear, https://arxiv.org/abs/1711.05381.
plot.farm.scree
and print.farm.scree
1 2 3 4 5 6 7 8 9 10 11 | set.seed(100)
p = 100
n = 20
epsilon = matrix(rnorm( p*n, 0,1), nrow = n)
B = matrix(rnorm(p*3,0,1), nrow=p)
fx = matrix(rnorm(3*n, 0,1), nrow = n)
X = fx%*%t(B)+ epsilon
output = farm.scree(X,show.plot = TRUE, cv=FALSE)
output = farm.scree(X,show.plot = FALSE, cv=FALSE, K.scree=5, K.factors =10)
output
plot(output, scree.plot=FALSE, col="blue", main="Customized plot")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.