Description Usage Arguments Details Value Examples
flash provide rank one matrix decomposition
1 2 | flash_hd(Y, tol = 1e-05, numtau = 500, partype = "constant",
sigmae2 = 1)
|
Y |
is the data matrix (N by P) |
tol |
which is the stop criterion for the convergence, default is 1e-5 |
numtau |
number of iteration, default is 500. for the backfitting case, the number of tau should be 5 or 10. |
partype |
type for the noise variance, which takes values from "constant": constant variance, "anova": variance is from anova model, "loganova": log variance is from anova model, "poisson": variance is equal to mean, else user should provide known value for sigmae2 |
sigmae2 |
which is a matrix for the known noise variance matrix. the default is 1 which is not useful |
flash_hd privide rank one matrix decomposition with variational EM algorithm.
list of factor, loading and variance of noise matrix
l
is a N vector for loadings
f
is a P vector for factors
sigmae2
is mean of sigma square which is estimation for the noise variance
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | sim_hd = function(N, P, SF, SL, signal, a = rchisq(N,3),b = rchisq(P,1),mu = 0){
E = matrix(rep(0,N*P),nrow=N)
sig2_true = matrix(rep(0,N*P),nrow=N)
for(i in 1:N){
for(j in 1:P){
sig2_true[i,j] = mu + a[i] + b[j]
E[i,j] = rnorm(1,0,sqrt(mu + a[i] + b[j]))
}
}
K=1
lstart = rnorm(N, 0, signal)
fstart = rnorm(P, 0, signal)
index = sample(seq(1:N),(N*SL))
lstart[index] = 0
index = sample(seq(1:P),(P*SF))
fstart[index] = 0
Y = lstart %*% t(fstart) + E
return(list(Y = Y, L_true = lstart, F_true = fstart, Error = E,sig2_true = sig2_true))
}
N = 200
P = 500
SF = 0.5
SL = 0.5
signal = 1
data = sim_hd(N, P, SF, SL, signal, a = rchisq(N,1),b = rchisq(P,2),mu = 0)
sigmae2_true = data$sig2_true
Y = data$Y
E = data$Error
gc = flash_hd(Y,tol = 1e-04,maxiter_r1 = 300)
f = gc$f
l = gc$l
sqrt(mean(((Y - l %*% t(f))-E)^2))/sqrt(mean((Y - E)^2))
gc = flash_r1(Y,tol = 1e-04,maxiter_r1 = 300)
f = gc$f
l = gc$l
sqrt(mean(((Y - l %*% t(f))-E)^2))/sqrt(mean((Y - E)^2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.