Title: | Maximum Likelihood Factor Analysis |
---|---|
Description: | Perform Maximum Likelihood Factor analysis on a covariance matrix or data matrix. |
Authors: | Koulik Khamaru <[email protected]>, Rahul Mazumder<[email protected] > |
Maintainer: | Koulik Khamaru <[email protected]> |
License: | GPL-3 |
Version: | 1.1 |
Built: | 2024-11-20 06:32:33 UTC |
Source: | CRAN |
Calculates the Maximum likelihood Factor analysis with a dataset.
Factmle(data, rnk, Psi_init = c(), lb = 0.01, index = c(), lb2 = 0.01, tol = 10^-7, Max_iter = 1000)
Factmle(data, rnk, Psi_init = c(), lb = 0.01, index = c(), lb2 = 0.01, tol = 10^-7, Max_iter = 1000)
data |
The dataset. It is a n*p numeric matrix, where n is the number of observations and p is the number of variables. |
rnk |
Rank constraint for the Factor analysis problem. It must a positive integer less than the number of variables p |
Psi_init |
The initial value of Psi. It is a p*1 numeric vetor, where p is the number of variables. Default value is a vector of uniform random numbers. |
lb |
The lower bound on the Psi values. The default value is set to 0.05 |
index |
This option is for modified version of factmle.The default value is a null vector. If assigned a zero vector, it will perform MLFA keeping some of the Psi values specified by the index at a specifed level *lb2* |
lb2 |
This option of modified version of factmle algorithm. The default value is 0.001. The Psi values specified by the *index* is kept constant at *lb2* while doing MLFA. |
tol |
Precision parameter. Default is 10^-7 |
Max_iter |
Maximum number of iterations. Default is 1000. |
A list with the following components
Psi |
A vector containing the unique variances. |
Lambda |
A p*rnk matrix containing the factor loadings in the columns. |
Nll |
A vector containing the negative Log-likelihood values at every iteration. |
Nllopt |
The value of the negative log-likelihood upon convergence. |
svds
library(MASS) library(stats) Psi=runif(15,min=0.2,max=1.3) Lambda=mvrnorm(n=15,mu=rep(0,3),Sigma = diag(rep(1,3))) data=mvrnorm(n=5000,mu=rep(0,15),Sigma = diag(Psi)+Lambda%*%t(Lambda)) x=Factmle(data,3)
library(MASS) library(stats) Psi=runif(15,min=0.2,max=1.3) Lambda=mvrnorm(n=15,mu=rep(0,3),Sigma = diag(rep(1,3))) data=mvrnorm(n=5000,mu=rep(0,15),Sigma = diag(Psi)+Lambda%*%t(Lambda)) x=Factmle(data,3)
Calculates the Maximum likelihood Factor analysis with a covariance Matrix.
Factmle_cov(S, rnk, Psi_init = c(), lb = 0.01, index = c(), lb2 = 0.01, tol = 10^-7, Max_iter = 1000)
Factmle_cov(S, rnk, Psi_init = c(), lb = 0.01, index = c(), lb2 = 0.01, tol = 10^-7, Max_iter = 1000)
S |
The Covariance Matrix. It is a p*p numeric matrix, where p is the number of variables. |
rnk |
Rank constraint for the Factor analysis problem. It must a positive integer less than the number of variables p |
Psi_init |
The initial value of Psi. It is a p*1 numeric vetor, where p is the number of variables.Default value is a vector of uniform random numbers. |
lb |
The lower bound on the Psi values. The default value is set to 0.05 |
index |
This option is for modified version of factmle.The default value is a null vector. If assigned a zero vector, it will perform MLFA keeping some of the Psi values specified by the index at a specifed level *lb2* |
lb2 |
This option of modified version of factmle algorithm. The default value is 0.001. The Psi values specified by the *index* is kept constant at *lb2* while doing MLFA. |
tol |
Precision parameter. Default is 10^-7 |
Max_iter |
Maximum number of iterations. Default is 1000. |
A list with the following components
A vector containing the unique variances.
A p*rnk matrix containing the factor loadings in the columns.
A vector containing the negative Log-likelihood values at every iteration.
The value of the negative log-likelihood upon convergence.
eigs_sym
library(MASS) library(stats) Psi=runif(15,min=0.2,max=1.3) Lambda=mvrnorm(n=15,mu=rep(0,3),Sigma = diag(rep(1,3))) data=mvrnorm(n=5000,mu=rep(0,15),Sigma = diag(Psi)+Lambda%*%t(Lambda)) S=cov(data) x=Factmle_cov(S,3)
library(MASS) library(stats) Psi=runif(15,min=0.2,max=1.3) Lambda=mvrnorm(n=15,mu=rep(0,3),Sigma = diag(rep(1,3))) data=mvrnorm(n=5000,mu=rep(0,15),Sigma = diag(Psi)+Lambda%*%t(Lambda)) S=cov(data) x=Factmle_cov(S,3)