plot.bayesCureModel {bayesCureRateModel}R Documentation

Plot method

Description

Plots and computes HDIs.

Usage

## S3 method for class 'bayesCureModel'
plot(x, burn = NULL, alpha = 0.05, gamma_mix = TRUE, 
	K_gamma = 5, plot_graphs = TRUE, bw = "nrd0", what = NULL, p_cured_output = NULL,  
	index_of_main_mode = NULL, draw_legend = TRUE,...)

Arguments

x

An object of class bayesCureModel

burn

Number of iterations to discard as burn-in period.

alpha

A value between 0 and 1 in order to compute the 1-\alpha Highest Posterior Density regions.

gamma_mix

Boolean. If TRUE, the density of the marginal posterior distribution of the \gamma parameter is estimated from the sampled MCMC values by fitting a normal mixture model.

K_gamma

Used only when gamma_mix = TRUE and corresponds to the number of normal mixture components used to estimate the marginal posterior density of the \gamma parameter.

plot_graphs

Boolean, if FALSE only HDIs are computed.

bw

bandwidth

what

Integer or a character string with possible values equal to 'cured_prob' or 'survival'. An integer entry indicates which parameter should be plotted. If set to NULL (default), all parameters are plotted one by one. If set to 'cured_prob' or 'survival' the estimated cured probability or survival function is plotted, conditional on a set of covariates defined in the p_cured_output argument.

p_cured_output

Optional argument (list) which is required only when what = 'cured_prob' or what = 'survival'. It is returned by the summary.bayesCureRateModel function.

index_of_main_mode

If NULL (default), all modes are plotted. Otherwise, it is a subset of the retained MCMC iterations in order to identify the main mode of the posterior distribution, as returned by the index_of_main_mode value of the summary.bayesCureRateModel function.

draw_legend

Boolean. If TRUE (default), a legend is plotted in the case where what = 'survival' or what = 'cured_prob'.

...

arguments passed by other methods.

Value

The function plots graphic output on the plot device if plot_graphs = TRUE. Furthermore, a list of 100(1-\alpha)\% Highest Density Intervals per parameter is returned.

Author(s)

Panagiotis Papastamoulis

Examples

# simulate toy data just for cran-check purposes        
        set.seed(1)
        n = 4
        stat = rbinom(n, size = 1, prob = 0.5)
        # simulate design matrix
        #	first column consists of 1s (const)
        #	and second and third column contain
        #	the values of two covariates
        x <- cbind(1, matrix(rnorm(2*n), n, 2))
        colnames(x) <- c('const', 'x1', 'x2')
        y <- rexp(n)
	fit1 <- cure_rate_MC3(y = y, X = x, Censoring_status = stat, 
		promotion_time = list(distribution = 'exponential'),
		nChains = 2, nCores = 1,
		mcmc_cycles = 3, sweep = 2)
	# plot the marginal posterior distribution of the first parameter in returned mcmc output
	plot(fit1, what = 1, burn = 0)
# using 'cured_prob'

	#compute cured probability for two individuals with 
	#	x1 = 0.2 and x2 = -1
	#	and 
	#	x1 = -1 and x2 = 0
	covariate_levels1 <- rbind(c(1,0.2,-1), c(1,-1,0))
	summary1 <- summary(fit1, covariate_levels = covariate_levels1, burn = 0)
	plot(fit1, what='cured_prob', p_cured_output = summary1$p_cured_output, 
	  ylim = c(0,1))
	




[Package bayesCureRateModel version 1.1 Index]