R/jacobian.R

jacobian <-
function (thetas, constrained, ind1, ind2, p) {
    lis.mat <- vector("list", p)
    for (j in 1:p) {
        theta <- if (constrained) thetas[seq(ind1[j], ind2[j])] else thetas[seq(ind1[j], ind2[j] - 1)]
        nth <- length(theta)
        etheta <- exp(theta)
        mat <- matrix(0, nth, nth)
        mat[, 1] <- rep(1, nth)
        if (nth > 1) {
            for (i in 2:nth)
                mat[i:nth, i] <- etheta[i]
        }
        lis.mat[[j]] <- mat
    }
    lis.mat
}

Try the ltm package in your browser

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

ltm documentation built on March 18, 2022, 6:36 p.m.