Calculates the Maximum likelihood Factor analysis with a dataset.

Description

Calculates the Maximum likelihood Factor analysis with a dataset.

Usage

1
2
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

1
2
3
4
5
6
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)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.