TABLE OF CONTENTS
ZZdebug/fmkprofgr [ Functions ]
NAME
fmkprofgr --- profile likelihood gradient
FUNCTION
Compute the gradient of the profile likelihood, conditional on the frailties and other parameters. This is superseded by the faster wrapper fmkproflik2, but is still in the code for debugging.
SYNOPSIS
1764 fmkprofgr <- 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
likgr gradient of profile loglikelihood of betahat conditional on the other parameters
SOURCE
1767 { 1768 # Prepare data for Fortran computation 1769 gr <- rep(0, length(betahat)) 1770 covs <- matrix(datamat[, -(1:8)], dim(datamat)[1], dim(datamat)[2] - 8) 1771 ncovs <- dim(covs)[2] 1772 d <- dim(covs)[1] 1773 index <- datamat[, c("i", "j", "k", "r", "smin", "smax")] 1774 delta <- datamat[, "delta"] 1775 times <- datamat[, "time"] 1776 # Fortran call 1777 out <- .Fortran("fprofgr", 1778 betahat = as.double(betahat), 1779 index = as.integer(index), 1780 delta = as.double(delta), 1781 times = as.double(times), 1782 Z = as.double(covs), 1783 as = as.double(as), 1784 Uijmat = as.double(Uijmat), 1785 d = as.integer(d), 1786 ncovs = as.integer(ncovs), 1787 nr = as.integer(dim(as)[1]), 1788 ns = as.integer(dim(as)[2]), 1789 m = as.integer(m), 1790 maxj = as.integer(max(Ji)), 1791 gr = as.double(gr)) 1792 return(out$gr) 1793 }