dynfrail_fit: Inner maximization of the log-likelihood

Description Usage Arguments Details Value Examples

View source: R/dynfrail_fit.R

Description

Inner maximization of the log-likelihood

Usage

1
2
dynfrail_fit(logfrailtypar, dist, pvfm, Y, Xmat, atrisk, basehaz_line,
  mcox = list(), c_vecs, inner_control, return_loglik = TRUE)

Arguments

logfrailtypar

A vector containing the natural logarithm of the two parameters (theta - for the distribution, lambda - for the autocorrelation)

dist

Argument of dynfrail_dist

pvfm

Argument of dynfrail_dist

Y

A Surv object obtained by splitting the original data at all the time points where the frailty process takes new values

Xmat

A model matrix obtained by splitting the original data at all the time points where the frailty process takes new values

atrisk

A list of various calculations that are used in the maximization process.

basehaz_line

A vector with the baseline hazard estimate at each right hand side time point from Y (can be 0 for the others)

mcox

An initial Cox model

c_vecs

A list of the length equal to the number of clusters; each element contains a vector of the length of different values that Z(t) takes in that cluster. Each element of this vector contains the sum of the cumulative hazards associated with that value of the frailty.

inner_control

Argument of dynfrail_control

return_loglik

Logical. If TRUE, then this just returns the log-likelihood, otherwise it returns also the estimates and information matrix

Details

This is an internal function that is used by dynfrail. It is not recommended to use this directly unless you know exactly what you are doing. On the other hand, this might be useful if someone wants, for example, to use different maximizers, or to calculate the log-likelihood at specific values of theta, lambda. Most of the input can be produced by dynfrail_prep.

Value

The log-likelihood if return_loglik = TRUE or a list with the log-likelihood and estimates if return_loglik = FALSE.

Examples

1
2
3
4
5
arglist1 <- dynfrail_prep(Surv(time, status) ~ rx + sex + cluster(litter),
data = rats)

# using list() inside is because of the way that R converts lists and vectors
mod1 <- do.call(dynfrail_fit, c(logfrailtypar = list(log(c(0.5, 0.1))), arglist1))

dynfrail documentation built on Nov. 17, 2017, 6:15 a.m.