use correlation matrix in robust PCA functions R - r

I want to perform robust principal component analysis (PCA) on the correlation matrix. Namely, rrcov::PcaHubert.
I know that if I give to the function cor=TRUE, rrcov:CovMcd calculates the robust covariance and correlation matrix. How can I force the PCA to use the correlation matrix instead of the covariance matrix?
Thanks!

Related

Simulating data using gaussian copula when dealing with non-positive definite matrix

I am simulating data using a gaussian copula which requires a correlation matrix. To construct the correlation matrix, I got its correlation coefficients from literature/past studies. However, how do you deal with a non-positive definite matrix when simulating non-normal data using a Gaussian copula and ensuring that the final outcome presents a correlation that contains almost similar values as the correlation matrix used to simulate the data?
Approaches of dealing with the challenge stated above in R programming

Is there an R function to compare two variance-covariance matrices via fit indicators?

I obtained two variance-co-variance matrices from two different samples. Both contain data on the same variables. I would like to estimate their similarity according to fit indices, i.e., I am interested whether the pattern of covariances between the variables is similar or different in the two samples. I am familiar with fit indices from structural equation modeling (e.g., Chi-square, GFI, CFI, RMSEA, SRMR) which compare an empirical variance-covariance matrix with a model-implied variance-covariance matrix. Is there a way to obtain these fit indicators for the comparison of two empirical variance-covariance matrices?
I tried compareCov which only gives a visual comparison.

How do I extract the principal component`s values of all observations using psych package

I'm performing dimensionality reduction using the psych package. After analyzing the scree plot I decided to use the 9 most important PCs (out of 15 variables) to build a linear model.
My question is, how do I extract the values of the 9 most important PCs for each of the 500 observations I have? Is there any built in function for that, or do I have to manually compute it using the loadings matrix?
Returns eigen values, loadings, and degree of fit for a specified number of components after performing an eigen value decomposition. Essentially, it involves doing a principal components analysis (PCA) on n principal components of a correlation or covariance matrix. Can also display residual correlations.By comparing residual correlations to original correlations, the quality of the reduction in squared correlations is reported. In contrast to princomp, this only returns a subset of the best nfactors. To obtain component loadings more characteristic of factor analysis, the eigen vectors are rescaled by the sqrt of the eigen values.
principal(r, nfactors = 1, residuals = FALSE,rotate="varimax",n.obs=NA, covar=FALSE,
scores=TRUE,missing=FALSE,impute="median",oblique.scores=TRUE,
method="regression",...)
I think So.

How to calculate Godambe information matrix in R?

I have a likelihood function in R that I am optimizing using 'optim' and calculating the hessian matrix using hessian=T in the optim function. I want to calculate the Godambe Information matrix in R, which is defined as:
G(theta)= H(theta) J(theta)^-1 H(theta)
where J(theta) is the variability matrix and H(theta) is the sensitivity matrix.
I am not sure how to calculate these matrices in R for my likelihood function and the estimates obtained from the optim. Please help.

clustered covariance matrix from felm (lfe package)

I would like to extract the clustered covariance matrix from a felm object of the lfe package. When I use
felm(y~x|z|0|q,data)$vcv
I get the non-clustered covariance matrix and the standard errors computed from the covariance matrix and standard errors reported in the summary() function differ. Does anyone know how to extract the clustered covariance matrix?

Resources