File: gm.default.R

package info (click to toggle)
r-cran-ctmcd 1.4.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 1,384 kB
  • sloc: cpp: 183; ansic: 19; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 1,331 bytes parent folder | download
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
gm.default <-
function (tm, te, method, gmguess = NULL, prior = NULL, burnin = NULL, 
    eps = 1e-06, conv_pvalue = 0.05, conv_freq = 10, niter = 10000, 
    sampl_func = NULL, combmat = NULL, sampl_method = "Unif", 
    logmethod = "Eigen", expmethod = "PadeRBS", verbose = FALSE, 
    ...) 
{
    tm = as.matrix(tm)
    te = as.numeric(te)
    est = list()
    if (method == "DA") {
        est$par = gmDA(tmrel = tm, te, logmethod = logmethod)
        est$method = "Diagonal Adjustment"
    }
    else if (method == "WA") {
        est$par = gmWA(tmrel = tm, te, logmethod = logmethod)
        est$method = "Weighted Adjustment"
    }
    else if (method == "QO") {
        est$par = gmQO(tmrel = tm, te, logmethod = logmethod)
        est$method = "Quasi Optimization"
    }
    else if (method == "EM") {
        est = gmEM(tmabs = tm, te, gmguess, eps, niter, expmethod, 
            verbose)
        est$method = "Expectation-Maximization Algorithm"
    }
    else if (method == "GS") {
        est = gmGS(tmabs = tm, te, prior, burnin, conv_pvalue, 
            conv_freq, niter, sampl_method, expmethod, verbose, 
            combmat, sampl_func)
        est$method = "Gibbs Sampler"
    }
    est$call = match.call()
    est$tm = tm
    est$te = te
    class(est) = "gm"
    est
}