R/gmWA.R

gmWA <-
function (tmrel, te, logmethod = "Eigen") 
{
    n = nrow(tmrel)
    gmest = logm(tmrel, method = logmethod)/te
    for (i in 1:(n - 1)) {
        gmiNeg = -sum((gmest * (gmest < 0))[i, setdiff(1:n, i)])
        gmiPos = sum((gmest * (gmest > 0))[i, ])
        gmest[i, setdiff(1:n, i)] = gmest[i, setdiff(1:n, i)] - 
            gmiNeg/gmiPos * abs(gmest[i, setdiff(1:n, i)])
    }
    gmest[setdiff(which(gmest < 0), seq(1, n^2, n + 1))] = 0
    return(gmest)
}

Try the ctmcd package in your browser

Any scripts or data that you put into this service are public.

ctmcd documentation built on May 29, 2024, 5:23 a.m.