SurvLogLik {Temporal}R Documentation

Log Likelihood

Description

Evaluates the log-likelihood for a parametric survival distribution.

Usage

SurvLogLik(
  data,
  dist,
  theta,
  log_scale = FALSE,
  status_name = "status",
  time_name = "time"
)

Arguments

data

Data.frame

dist

Distribution, from among: "exp","gamma","gen-gamma","log-normal","weibull".

theta

Parameters, which will vary according to the distribution.

log_scale

Are strictly positive parameters on log-scale?

status_name

Status indicator, coded as 1 if an event was observed, 0 if censored.

time_name

Name of column containing the time to event.

Details

The parameter vector theta should contain the following elements, in order, depending on the distribution:

Exponential

Rate \lambda.

Gamma

Shape \alpha, rate \lambda.

Generalized Gamma

Shape 1 \alpha, shape 2 \beta, rate \lambda.

Log-Normal

Location \mu, scale \sigma.

Weibull

Shape \alpha, rate \lambda.

Value

Scalar value of the log likelihood.

Examples

# Generate gamma event time data with 10% censoring.
data <- GenData(n = 1e3, dist = "gamma", theta = c(2, 2), p = 0.1)

# Evaluate log likelihood.
ll <- SurvLogLik(data, dist = "gamma", theta = c(2, 2))

# Generate Weibull event time data with 20% censoring.
data <- GenData(n = 1e3, dist = "weibull", theta = c(2, 2), p = 0.2)

# Evaluate log likelihood.
ll <- SurvLogLik(data, dist = "weibull", theta = c(2, 2))

[Package Temporal version 0.3.0.1 Index]