Confidence interval for the percentage of variance retained by the first k components | R Documentation |
\kappa
components
Confidence interval for the percentage of variance retained by the first \kappa
components.
eigci(x, k, alpha = 0.05, B = 1000, graph = TRUE)
x |
A numerical matrix with more rows than columns. |
k |
The number of principal components to use. |
alpha |
This is the significance level. Based on this, an |
B |
The number of bootstrap samples to generate. |
graph |
Should the plot of the bootstrap replicates appear? Default value is TRUE. |
The algorithm is taken by Mardia Kent and Bibby (1979, pg. 233–234). The percentage retained by the fist \kappa
principal components denoted by \hat{\psi}
is equal to
\hat{\psi}=\frac{ \sum_{i=1}^{\kappa}\hat{\lambda}_i }{\sum_{j=1}^p\hat{\lambda}_j },
where \hat{\psi}
is asymptotically normal with mean \psi
and variance
\tau^2 = \frac{2}{\left(n-1\right)\left(tr\pmb{\Sigma} \right)^2}\left[ \left(1-\psi\right)^2\left(\lambda_1^2+...+\lambda_k^2\right)+
\psi^2\left(\lambda_{\kappa+1}^2+...\lambda_p^2\right) \right],
where
a=\left( \lambda_1^2+...+\lambda_k^2\right)/\left( \lambda_1^2+...+\lambda_p^2\right)
and \text{tr}\pmb{\Sigma}^2=\lambda_1^2+...+\lambda_p^2
.
The bootstrap version provides an estimate of the bias, defined as \hat{\psi}_{boot}-\hat{\psi}
and confidence intervals calculated via the percentile method and via the standard (or normal) method Efron and Tibshirani (1993). The funciton gives the option to perform bootstrap.
A list including:
res |
If B=1 (no bootstrap) a vector with the esimated percentage of variance due to the first |
ci |
This appears if B>1 (bootstrap). The standard bootstrap and the empirical bootstrap |
Futher, if B>1 and "graph" was set equal to TRUE, a histogram with the bootstrap \hat{\psi}
values, the observed \hat{\psi}
value and its bootstrap estimate.
Michail Tsagris.
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
Mardia K.V., Kent, J.T. and Bibby, J.M. (1979). Multivariate Analysis. London: Academic Press.
Efron B. and Tibshirani R. J. (1993). An introduction to the bootstrap. Chapman & Hall/CRC.
pc.choose
x <- as.matrix(iris[, 1:4])
eigci(x, k = 2, B = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.