TABLE OF CONTENTS


ZZdebug/mkproflik [ Functions ]

NAME

    mkproflik --- compute profile likelihood

FUNCTION

Compute profile likelihood of regression parameters for a single process. This is an R implementation of the Fortran routine fproflik and is for debugging only.

SYNOPSIS

1583 mkproflik <- function(m, Ji, betahat, datamat, as, Uijmat)

INPUTS

    m          number of clusters
    Ji         cluster sizes
    betahat    regression coefficient estimates 
    datamat    data matrix generated by makedatamat 
    as         matrix of discretization breakpoints 
    Uijmat     matrix of frailty estimates

OUTPUTS

    loglik     profile loglikelihood of betahat conditional on the other parameters

SOURCE

1586 {
1587     # Compute mrs using makemrs function
1588     mrss <- makemrs(m, Ji, datamat, as, betahat, Uijmat)
1589     mrs <- mrss$mrs
1590     loglik <- 0
1591     covs <- as.matrix(datamat[, -c(1:8)], dim(datamat)[1], length(betahat))
1592     # Loop over the entries in the data matrix, but do not loop over the s 
1593     # values (delta can only be 1 on smax)
1594     for(ind in 1:dim(datamat)[1]){
1595         i <- datamat[ind, "i"]
1596         j <- datamat[ind, "j"]
1597         k <- datamat[ind, "k"]
1598         smax <- datamat[ind, "smax"]
1599         smin <- datamat[ind, "smin"]
1600         r <- datamat[ind, "r"]
1601         delta <- datamat[ind, "delta"]
1602         # Add the term corresponding to each row in the data matrix 
1603         # to the loglikelihood
1604         loglik <- loglik + delta * (log(Uijmat[i, j]) - log(mrs[r, smax]) +
1605             as.matrix(betahat)%*%covs[ind, ])
1606     } 
1607     return(loglik)   
1608 }