R/dlpl.R

dlpl <- function(event, b, X, Ri, Ci){
    n <- length(event)
    ef <- exp(as.numeric(X%*%b))
    dummy <- secondpart <- rep(0, n)
    for (i in 1:n) {
        dummy[i] <- sum(ef[Ri[[i]]])
    }
    dummy[which(dummy==0)] <- 1e-05
    for (i in 1:n) {
        secondpart[i] <- sum(1/dummy[Ci[[i]]])
    }
    gradients <- event - (ef*secondpart)
    return(gradients)}

Try the penMSM package in your browser

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

penMSM documentation built on May 2, 2019, 11:06 a.m.