SupParafacEM: Using EM algorithm to fit the SupCP model

Description Usage Arguments Value Examples

View source: R/SupParafacEM.R

Description

Using EM algorithm to fit the SupCP model

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
SupParafacEM(
  Y,
  X,
  R,
  AnnealIters = 100,
  ParafacStart = 0,
  max_niter = 1000,
  convg_thres = 10^-3,
  Sf_diag = 1
)

Arguments

Y

n*q full column rank reponse matrix(necessarily n>=q)

X

n*p1*...*pk design array

R

fixed rankd of approximation, R<=min(n,p)

AnnealIters

Annealing iterations (default = 100)

ParafacStart

binary argument for wether to initialize with Parafac factorization (default = 0)

max_niter

maximum number of iterations (default = 1000)

convg_thres

convergence threshold for difference in log likelihood (default = 10^-3)

Sf_diag

whether Sf is diagnal (default=1,diagnoal)

Value

list with components

B:

q*r coefficient matrix for U~Y

V

list of length K-1. V[k] is a p*r coefficient matrix with columns of norm 1

U:

Conditional expectation of U: n*r

se2:

scalar, var(E)

Sf:

r*r diagonal matrix, cov(F)

rec:

log likelihood for each iteration

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
sigmaF <- diag(c(100,64,36,16,4))
# F matrix n*r
Fmatrix1 <- matrix(MASS::mvrnorm(n=100,rep(0,5),sigmaF),100,5)
U<-Fmatrix1
V1 <- matrix(stats::rnorm(10*5),10,5)
V2 <- matrix(stats::rnorm(10*5),10,5)
L <- list(U,V1,V2)
X <- TensProd(L)
Y <- matrix(stats::rnorm(100*10),100,10)
R <-3
SupParafacEM(Y,X,R)

SuperPCA documentation built on July 26, 2021, 5:06 p.m.