SurvLogLik | R Documentation |
Evaluates the log-likelihood for a parametric survival distribution.
SurvLogLik(
data,
dist,
theta,
log_scale = FALSE,
status_name = "status",
time_name = "time"
)
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. |
The parameter vector theta should contain the following elements, in order, depending on the distribution:
Rate \lambda
.
Shape \alpha
, rate \lambda
.
Shape 1 \alpha
, shape 2 \beta
, rate \lambda
.
Location \mu
, scale \sigma
.
Shape \alpha
, rate \lambda
.
Scalar value of the log likelihood.
# 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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.