emfa: Expectation-Maximization (EM) estimation of a factor model.

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/emfa.R

Description

This function implements the EM algorithm by Thayer and Rubin (1982) for the ML estimation of a factor model. It is an internal function used to estimate the factor model parameters in the factor-adjustment methods.

Usage

1
emfa(dta, nbf, min.err = 1e-06, verbose = FALSE, svd.method = c("fast.svd", "irlba"))

Arguments

dta

n x m matrix which rows are multivariate m-profiles for n individuals. n can be much smaller than m.

nbf

number of factors. It has to be a positive integer, smaller than the rank of dta.

min.err

stopping criterion for the iterative algorithm. Maximum difference between the estimated parameters in the last two iterations.

verbose

logical value. If verbose=TRUE, then some information is printed along the calculation.

svd.method

the EM algorithm starts from an SVD estimation of the factor model parameters. The default option to implement this SVD is fast.svd. An alternative option is an approximate but faster SVD by function irlba.

Details

Data are centered but not scaled. If a factor model for a correlation matrix is to be estimated, then a scaled dataset is required as an input of the function.

Value

B

m x nbf matrix of loadings

Psi

m-vector of specific variances

Factors

n x nbf matrix of factor scores

Objective

Final value of the stopping criterion, after convergence.

Author(s)

David Causeur, IRMAR, UMR 6625 CNRS, Agrocampus Ouest, Rennes, France.

References

Friguet, C., Kloareg, M. and Causeur, D. (2009). A factor model approach to multiple testing under dependence. Journal of the American Statistical Association. 104 (488), 1406-1415.

Rubin, D. B., and Thayer, D. T. (1982), EM Algorithms for ML Factor Analysis, Psychometrika, 47 (1), 69-76.

See Also

factanal

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
data(impulsivity)

erpdta = as.matrix(impulsivity[,5:505]) # erpdta contains the whole set of ERP curves  
   
fa = emfa(erpdta,nbf=1) # 1-factor modelling of the ERP curves
fa$Objective            # Final difference between the last two iterations
Semp = var(erpdta)      # Sample estimation of the variance of ERP curves
Sfa = diag(fa$Psi)+tcrossprod(fa$B) # Factorial estimation of the variance 
max(abs(Semp-Sfa))      # Distance between the two estimates 

fa = emfa(erpdta,nbf=20) # 20-factor modelling of the ERP curves in erpdta
fa$Objective             # Final difference between the last two iterations
Semp = var(erpdta)       # Sample estimation of the variance of ERP curves
Sfa = diag(fa$Psi)+tcrossprod(fa$B) # Factorial estimation of the variance 
max(abs(Semp-Sfa))       # Distance between the two estimates

ERP documentation built on Dec. 16, 2019, 1:35 a.m.