Learn R Programming

tipse (version 1.2)

fit_model: Fit parametric model for selected subjects

Description

Fit parametric model for selected subjects

Usage

fit_model(dat, reason, impute, imputation_model = c("weibull", "exponential"))

Value

data.frame with flags and fitted model parameters to be used for imputation

Arguments

dat

data.frame containing at least 5 columns: TRT01P (treatment arm as factor), AVAL (survival time), EVENT (event indicator), CNSRRS (censoring reason) and MAXAVAL (maximum potential survival time, duration between randomization to data cut-off)

reason

a string specifying the censoring reasons which require imputation. It must be one of the reasons from column CNSRRS.

impute

a string specifying the treatment arm(s) which require imputation. It must be one of the arms from column TRT01P.

imputation_model

a string specifying the parametric distribution used for imputation, can be "Weibull" or "exponential".

Details

The data.frame contains original columns, plus the following columns appended:

AVAL4Placeholder column to keep imputed survival times
EVENT4Placeholder column to keep imputed events
imputeFlag indicating whether the subject was selected for imputation
aShape parameter, equal to 1 if exponential
bScale parameter
cdfCumulative distribution function
...Some temporary columns