Learn R Programming

frailtyEM (version 0.7.2)

emfrail_pll: Profile log-likelihood calculation

Description

Profile log-likelihood calculation

Usage

emfrail_pll(formula, data, distribution = emfrail_dist(), values)

Arguments

formula

Same as in emfrail

data

Same as in emfrail

distribution

Same as in emfrail

values

A vector of values on where to calculate the profile likelihood. See details.

Value

The profile log-likelihood at the specific value of the frailty parameter

Details

This function can be used to calculate the profile log-likelihood for different values of \(\theta\). The scale is that of theta as defined in emfrail_dist(). For the gamma and pvf frailty, that is the inverse of the frailty variance.

Examples

Run this code
# NOT RUN {
fr_var <- c(0.001, 0.01, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9)
profloglik <- emfrail_pll(Surv(time, status) ~ rx + sex + cluster(litter), rats,
                          values = 1/fr_var)
plot(fr_var, profloglik, xlab = "frailty variance", ylab = "profile log-likelihood")

# check with coxph:
profloglik_cph<- sapply(fr_var, function(th)
  coxph(data =  rats, formula = Surv(time, status) ~ rx + sex + frailty(litter, theta = th),
                 method = "breslow")$history[[1]][[3]])

lines(fr_var, profloglik_cph, col = 2)

# }

Run the code above in your browser using DataLab