Package 'FACTMLE'

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

Help Index


Calculates the Maximum likelihood Factor analysis with a dataset.

Description

Calculates the Maximum likelihood Factor analysis with a dataset.

Usage

Factmle(data, rnk, Psi_init = c(), lb = 0.01, index = c(), lb2 = 0.01,
  tol = 10^-7, Max_iter = 1000)

Arguments

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.

Value

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.

See Also

svds

Examples

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.

Description

Calculates the Maximum likelihood Factor analysis with a covariance Matrix.

Usage

Factmle_cov(S, rnk, Psi_init = c(), lb = 0.01, index = c(), lb2 = 0.01,
  tol = 10^-7, Max_iter = 1000)

Arguments

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.

Value

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.

See Also

eigs_sym

Examples

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)