Type: | Package |
Title: | Stratified Weibull Regression Model |
Version: | 1.1 |
Date: | 2019-11-17 |
Author: | Xiangdong Gu and Raji Balasubramanian |
Maintainer: | Xiangdong Gu <ustcgxd@gmail.com> |
Description: | The main function is icweib(), which fits a stratified Weibull proportional hazards model for left censored, right censored, interval censored, and non-censored survival data. We parameterize the Weibull regression model so that it allows a stratum-specific baseline hazard function, but where the effects of other covariates are assumed to be constant across strata. Please refer to Xiangdong Gu, David Shapiro, Michael D. Hughes and Raji Balasubramanian (2014) <doi:10.32614/RJ-2014-003> for more details. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
RoxygenNote: | 6.1.1 |
Encoding: | UTF-8 |
LazyData: | true |
NeedsCompilation: | no |
Packaged: | 2019-11-17 14:54:07 UTC; xiangdong |
Repository: | CRAN |
Date/Publication: | 2019-11-17 15:10:02 UTC |
Estimate hazard ratio between two subjects
Description
This function estimates the hazard ratio between two subjects at given times, along with the associated 95% confidence interval.
Usage
HRatio(x, times, NumStra, NumZ = NULL, DemStra, DemZ = NULL)
Arguments
x |
results from the model fit returned by the icweib function. |
times |
the vector of times at which the hazard ratio is estimated. |
NumStra |
the strata of the subject in the numerator. If the model is unstratified, then set it to be the constant that is used for strata argument in icweib function, e.g. "ALL". |
NumZ |
the vector of values of the explanatory variables for the subject in the numerator. The order and length should match the estimated coefficients as shown in x$coef. The default is NULL, corresponding to all 0 or baseline. |
DemStra |
the strata of the subject in the denominator. If the model is unstratified, then set it to be the constant that is used for strata argument in icweib function, e.g. "ALL". |
DemZ |
the vector of values of the explanatory variables for the subject in the denominator. The order and length should match the estimated coefficients as shown in x$coef. The default is NULL, corresponding to all 0 or baseline. |
Details
The hazard ratio between two subjects is obtained from the maximum likelihood estimates from the stratified Weibull regression model, along with the corresponding 95% confidence interval.
Value
A data frame of estimated hazard ratios and confidence intervals for two subjects at each time point is returned.
See Also
Examples
data(tooth24)
fit <- icweib(L = left, R = right, data = tooth24,
strata = dmf, covariates = ~sex)
HRatio(fit, times = 1:7, NumStra = 0, NumZ=0, DemStra = 1, DemZ=0)
Treatment of hypernephroma data
Description
This dataset contains survival times for 36 patients with malignant tumour in the kidney. Some of the patients received nephrectomy. See Example 3.4 and example 5.9 of the Collett (2003) for more details. The event time in this example is right censored.
Usage
hyper
Format
A data frame with 36 observations on the following 4 variables:
nephrectomy
indicator on whether or not the patient had recived a nephrectomy
age
age group at the time of diagnosis. 1 = <60, 2 = 60-70, 3 = >70.
time
observed time.
status
status of the observed time. 0 = censored, 1 = event.
Details
The data uses time and status to represent the observed survival time. To fit into the icweib function, left and right endpoints of censoring interval need to be derived (see examples).
References
Collett, D. (2003). Modelling Survival Data in Medical Research, Second Edition, Texts in statistical science. Taylor & Francis.
Examples
data(hyper)
## Derive left and right endpoints from time and status
hyper$left <- hyper$time
hyper$right <- ifelse(hyper$status==1, hyper$time, Inf)
Fit stratified Weibull regression model
Description
This function fits a stratified Weibull regression model using maximum likelihood estimation. The function can incorporate right, left, interval censored outcomes in addition to fully observed (i.e. uncensored) time to event data. (see details).
Usage
icweib(L, R, data, strata = "ALL", covariates = NULL)
Arguments
L |
left endpoint of censoring interval. To indicate left censoring, set L=0. |
R |
right endpoint of censoring interval. To indicate right censoring, set R=Inf. |
data |
dataset |
strata |
variable for stratification. Set it to a character or numeric constant for un-stratified model. |
covariates |
a formula to specify explanatory variables in the proportional hazards model. The input is a right hand formula object, such as ~x1 + x2. The default is NULL, corresponding to the no covariate case. |
Details
As in the stratified Cox proportional hazards model (Collett (2003)), this model allows a baseline hazard function that is stratum-specific. However, the model assumes that the regression coefficients for all other explanatory variables (excluding the stratum indicator) are constant across strata. Assuming a Weibull distribution for the random variable corresponding to the time to event in conjunction with the Cox proportional hazards model, the survival function can be expressed as S(t | Z) = exp(-lambda*exp(beta*Z)*t^(gamma)), where Z denotes the vector of covariates, gamma denotes the shape parameter and lambda the scale parameter. To allow stratum-specific baseline hazard functions, we generalize the model given above by expressing the survival function as S(t | Z, Stratum=i) = exp(-lambda_i*exp(beta*Z)*t^(gamma_i)), where i denotes the stratum, Z denotes the vector of covariates, gamma_i and lambda_i denote the shape and scale parameters for stratum i, respectively. In particular, the model assumes that the coefficients for explanatory covariates Z (denoted by beta) are the same for all strata i.
In the likelihood optimization, u_i=log(lambda_i) and v_i=log(gamma_i) are used as
parameters to remove the parameters' range constriction. The likelihood function is
optimized using optim() function. The maximum likelihood estimates are used to
estimate baseline hazard ratios between two subjects (see HRatio
),
and survival function (see plot.icweib
).
This function can accommondate different types of censored time-to-event outcomes: left censoring, right censoring, interval censoring, and non-censoring (event), by appropriately setting L and R,
L | R | INTERPRETATION |
a | b | interval censoring, [a, b] |
0 | b | left censoring, [0, b] |
a | Inf | right censoring, [a, Inf] |
a | a | no censoring, event time = a |
Value
This function returns an object with class icweib. The items in the object are,
loglik |
log-likelihood functions of the full, reduced, and null models. Reduced model refers to the model that all shape parameters are same. Null model refers to the model that there is no covariate in the model. |
coef |
results for estimated coefficients for explanatory variables. |
weib |
estimated Weibull shape and scale parameters for each stratum. |
stratatest |
results of likelihood ratio test and Wald test corresponding to the null hypothesis that all the strata specific shape parameters are equal. |
cov |
covariance matrix of the parameters |
ns |
information of different counts |
delete |
observation numbers in the data that are deleted due to inappropriate input. |
maxT |
maximum observed time in the data |
q |
returned object from the optim function for the full model. |
References
Collett, D. (2003). Modelling Survival Data in Medical Research, Second Edition, Texts in statistical science. Taylor & Francis.
See Also
Examples
## Analyze tooth data
data(tooth24) ## load data
## Stratified on dmf, and sex as explanatory variable
fit <- icweib(L = left, R = right, data = tooth24, strata = dmf, covariates = ~sex)
## Analyze hypernephroma data
data(hyper)
## Derive left and right endpoints from time and status
hyper$left <- hyper$time
hyper$right <- ifelse(hyper$status==1, hyper$time, Inf)
## Stratified on nephrectomy, and age group as explanatory variable
fit1 <- icweib(L = left, R = right, data = hyper, strata = nephrectomy, covariates = ~factor(age))
Plot estimated survival function
Description
This function plots the estimated survival function along with associated pointwise 95% confidence intervals corresponding to the input strata and values of explanatory variables.
Usage
## S3 method for class 'icweib'
plot(x, strata = NULL, Z = NULL, tRange = NULL,
tEst = NULL, ...)
Arguments
x |
output returned by icweib function. |
strata |
the vector of strata for which the survival function is estimated and plotted. The default is NULL, corresponding to all strata. |
Z |
the vector of values of explanatory variables for which the survival function is estimated and plotted. The order and length should match the estimated coefficients as shown in x$coef. The default is NULL, corresponding to all 0 or baseline. |
tRange |
the range of time to plot. It should be in the format of c(t1, t2), which means that the range of time is t1 to t2. The default is NULL, corresponding to 0 to maximum observed time in the data. |
tEst |
the vector of times at which the survival function along with associated pointwise 95% confidence internval is estimated and output. The default is NULL, which means no estimated survival function is output. |
... |
arguments of |
Details
The survival function and associated pointwise 95% confidence intervals are estimated for input values of time and covariates.
Value
If tEst is specified, then a dataframe of estimated survival function along with 95% confidence interval is returned.
See Also
Examples
data(tooth24)
fit <- icweib(L = left, R = right, data = tooth24, strata = dmf, covariates = ~sex)
surv <- plot(fit, Z = 1, tRange = c(1, 7), tEst=1:7, xlab = "Time", ylab = "Survival Function",
main = "Estimated survival function for sex = 1 (girls)")
Print icweib object
Description
This function prints the summary of the fitting results from icweib.
Usage
## S3 method for class 'icweib'
print(x, digits = 3, ...)
Arguments
x |
output returned by icweib function. |
digits |
digits to print. |
... |
other arguments to be passed from print function. |
Examples
data(tooth24)
fit <- icweib(L = left, R = right, data = tooth24, strata = dmf, covariates = ~sex)
fit
Simulated data with mixed types of events
Description
This simulated data contains event times that are left censored, right censored, interval censored, or non-censored (observed event). The data is generated from a stratified Weibull distribution model in which each stratum is assumed to have an independent stratum-specific shape parameter. In addition, the regression coefficients corresponding to the vector of explanatory variables excluding the stratum indicator are assumed to be constant across strata.
Usage
simdata
Format
A data frame with 298 observations on the following 6 variables:
ID
subject id
strata
strata
cov1
a continuous covariate
cov2
a continuous covariate
left
left endpoint of censoring interval
right
right endpoint of censoring interval
References
see icweib
for details on how to set L and
R for different types of events.
Examples
data(simdata)
Tooth data
Description
This data set contains data from the Signal Tandmobiel study, which is described in the paper by Gomez G and others (2009). The time to event is interval censored.
Usage
tooth24
Format
A data frame with 4386 observations on the following 5 variables:
id
child id
left
left endpoint of censoring interval.
right
right endpoint of censoring interval.
sex
child's gender. 0 = boy, 1 = girl.
dmf
status of primary predecessor of the tooth. 0 = sound, 1 = decayed or missing due to caries or filled
Source
http://grass.upc.edu/software/tooth24/copy_of_tooth24-data-set/view
References
G. Gomez, M. Calle, R. Oller, and K. Langohr (2009). Tutorial on methods for interval-censored data and their implementation in R. Statistical Modeling 9(4), 259
Examples
data(tooth24)