gsspFactorm {TOSI}R Documentation

High Dimensional Sparse Factor Model

Description

sparse factor analysis to extract latent linear factor and estimate row-sparse and entry-wise-sparse loading matrix.

Usage

  gsspFactorm(X, q=NULL, lambda1=nrow(X)^(1/4), lambda2=nrow(X)^(1/4))

Arguments

X

a n-by-p matrix, the observed data

q

an integer between 1 and p or NULL, default as NULL and automatically choose q by the eigenvalue ratio method.

lambda1

a non-negative number, the row-sparse penalty parameter, default as n^(1/4).

lambda2

a non-negative number, the entry-sparse penalty parameter, default as n^(1/4).

Value

return a list with class named fac, including following components:

hH

a n-by-q matrix, the extracted lantent factor matrix.

sphB

a p-by-q matrix, the estimated row-sparseloading matrix.

hB

a p-by-q matrix, the estimated loading matrix without penalty.

q

an integer between 1 and p, the number of factor extracted.

propvar

a positive number between 0 and 1, the explained propotion of cummulative variance by the q factors.

egvalues

a n-dimensional(n<=p) or p-dimensional(p<n) vector, the eigenvalues of sample covariance matrix.

Note

nothing

Author(s)

Liu Wei

References

Liu, W., Lin, H., Liu, J., & Zheng, S. (2020). Two-directional simultaneous inference for high-dimensional models. arXiv preprint arXiv:2012.11100.

See Also

factor, Factorm

Examples

  dat <- gendata_Fac(n = 300, p = 500)
  res <- gsspFactorm(dat$X)
  ccorFun(res$hH, dat$H0) # the smallest canonical correlation
  ## comparison of l2 norm
  oldpar <- par(mar = c(5, 5, 2, 2), mfrow = c(1, 2))
  plot(rowSums(dat$B0^2), type='o', ylab='l2B', main='True')
  l2B <- rowSums(res$sphB^2)
  plot(l2B, type='o', main='Est.')

  Bind <- ifelse(dat$B0==0, 0, 1)
  hBind <- ifelse(res$sphB==0, 0, 1)

  ## Select good penalty parameters
  dat <- gendata_Fac(n = 300, p = 200)
  res <- gsspFactorm(dat$X, lambda1=0.04*nrow(dat$X)^(1/4) ,lambda2=1*nrow(dat$X)^(1/4))
  ccorFun(res$hH, dat$H0) # the smallest canonical correlation

  ## comparison of l2 norm
  plot(rowSums(dat$B0^2), type='o', ylab='l2B', main='True')
  l2B <- rowSums(res$sphB^2)
  plot(l2B, type='o', main='Est.')

  ## comparison of structure of loading matrix
  Bind <- ifelse(dat$B0==0, 0, 1)
  hBind <- ifelse(res$sphB==0, 0, 1)
  par(oldpar)



[Package TOSI version 0.3.0 Index]