Fit PSD model with EM algorithm, and use the loss function as a stopping criterion.
Arguments
- G
 The I x J matrix of counts; all entries of G should be taken from {0,1,2}.
- K
 An integer 2 or greater giving the matrix rank.
- epsilon
 Convergence criterion.
- maxiter
 The maximum number of iterations.
Value
A List with the following parameters:
PThe population scale matrix of the individuals.
FThe gene scale matrix of the populations.
LossA vector represents the value of the loss function which records once for 10 iterations.
IterationsAn integer represents the number of iterations.
Examples
G <- matrix(c(0,0,1, 0,2,1, 1,0,1, 0,1,0, 1,0,0), 3, 5)
psd_fit_em(G, 2, 1e-5, 10)
#> $P
#>            [,1]      [,2]
#> [1,] 0.24315675 0.7568432
#> [2,] 0.84536946 0.1546305
#> [3,] 0.05866193 0.9413381
#> 
#> $F
#>              [,1]      [,2]        [,3]         [,4]       [,5]
#> [1,] 3.768704e-09 0.9888850 0.007484014 4.803227e-01 0.26048475
#> [2,] 2.830281e-01 0.2292077 0.546114078 6.231043e-06 0.09856123
#> 
#> $Loss
#> [1] -0.8519469
#> 
#> $Iterations
#> [1] 10
#> 
