TABLE OF CONTENTS


estimation/fmakealphars2 [ Functions ]

NAME

    fmakealphars2 --- Fortran wrapper for fmkalpha2

FUNCTION

Compute the MLEs for the baseline hazard parameters alphars, given estimates of regression parameters andf frailties, for a single recurrent event process.

This works in the same way as makealphars2

SYNOPSIS

327 fmakealphars2 <- function(m, Ji, datamat, betahat, as, Uijmat, smooth)

INPUTS

    m          number of clusters
    Ji         cluster sizes
    datamat    data matrix generated by makedatamat
    betahat    vector of regression parameter estimates
    as         matrix of discretization breakpoints for each stratum
    Uijmat     matrix of frailty estimates
    smooth     boolean to indicate whether the output should be smoothed

OUTPUTS

    alphars    matrix of baseline hazard parameters of size p x K
               containing the hazard estimate for each stratum and
               discretization interval

SOURCE

330 {
331     # Allocate storage
332     alphars <- matrix(0, dim(as)[1], dim(as)[2])
333     # Split the data matrix into different components
334     covs <- matrix(datamat[, -(1:8)], dim(datamat)[1], dim(datamat)[2] - 8)
335     ncovs <- dim(covs)[2]
336     d <- dim(covs)[1]
337     index <- datamat[, c("i", "j", "k", "r", "smin", "smax")]
338     delta <- datamat[, "delta"]
339     times <- datamat[, "time"]
340     
341     # Fortran call
342      out <- .Fortran("fmkalpha2", 
343         betahat = as.double(betahat), 
344         index = as.integer(index), 
345         delta = as.double(delta), 
346         times = as.double(times), 
347         Z = as.double(covs), 
348         alphars = as.double(alphars), 
349         as = as.double(as), 
350         Uijmat = as.double(Uijmat),
351         d = as.integer(d), 
352         ncovs = as.integer(ncovs), 
353         nr = as.integer(dim(as)[1]), 
354         ns = as.integer(dim(as)[2]), 
355         m = as.integer(m), 
356         maxj = as.integer(max(Ji))
357       )
358      # Extract output
359      alphars <- matrix(out$alphars, dim(alphars)[1], dim(alphars)[2])
360      
361      if(smooth){
362         alphars <- smoothalpha(alphars, as)
363      }
364      
365      return(alphars)
366 }