fit
and then plots a given function to help diagnosis where covariate effect follows model assumption (i.e. either proportional hazards or proportional odds). See details
for descriptions of the plots.
If varName
is not provided, will attempt to figure out how to divide up each covariate and plot all of them, although this may fail.
diag_covar(object, varName, data, model, weights = NULL, yType = 'meanRemovedTransform', factorSplit = TRUE, numericCuts, col, xlab, ylab, main, lgdLocation = NULL)
ic_sp
or ic_par
object
is a fit'ph'
or 'po'
fractorSplit == FALSE
, cut points of covariate to stratify data onyType
, the function to plot, are "transform"
, which is the transformed functions without the means subtracted and "survival"
, which is the baseline survival distribution is plotted for each strata.
Currently does not support stratifying covariates that are involved in an interaction term.
For variables that are factors, it will create a strata for each level of the covariate, up to 20 levels. If factorSplit == FALSE
, will divide up numeric covariates according to the cuts provided to numericCuts.
lgdLocation
is an argument placed to legend
dictating where the legend will be placed. If lgdLocation = NULL
, will use standard placement given yType
. See ?legend
for more details.
data(IR_diabetes)
diag_covar(cbind(left, right) ~ gender,
data = IR_diabetes, model = 'po')
diag_covar(cbind(left, right) ~ gender,
data = IR_diabetes, model = 'ph')
#Neither fit is perfect, but not terrible
#Proportional odds looks better
Run the code above in your browser using DataLab