Markov Chain Monte Carlo (MCMC) to run Bayesian split population survival model with no frailties.

Returns a summary of a SPsurv object via summary.mcmc.

Print method for a pooledSPsurv x.

Returns a plot of a pooledSPsurv object via plot.mcmc.

pooledSPsurv(
  duration,
  immune,
  Y0,
  LY,
  data,
  N,
  burn,
  thin,
  w = c(1, 1, 1),
  m = 10,
  form = c("Weibull", "exponential", "loglog")
)

# S3 method for SPsurv
summary(object, parameter = character(), ...)

# S3 method for SPsurv
print(x, ...)

# S3 method for SPsurv
plot(x, parameter = character(), ...)

Arguments

duration

survival stage equation written in a formula of the form Y ~ X1 + X2 + ... where Y is duration until failure or censoring.

immune

split stage equation written in a formula of the form C ~ Z1 + Z2 + ... where C is a binary indicator of immunity.

Y0

the elapsed time since inception until the beginning of time period (t-1).

LY

last observation year (coded as 1; 0 otherwise) due to censoring or failure.

data

data.frame.

N

number of MCMC iterations.

burn

burn-in to be discarded.

thin

thinning to prevent from autocorrelation.

w

size of the slice in the slice sampling for (betas, gammas, rho). Write it as a vector. E.g. c(1,1,1).

m

limit on steps in the slice sampling. A vector of values for beta, gamma, rho.

form

type of parametric model (Weibull, Exponential, or Log-Logistic).

object

an object of class SPsurv, the output of pooledSPsurv.

parameter

one of Four parameters of the pooledSPsurv output. Indicate either "betas," "gammas", "rho" or "delta".

...

additional parameter.

x

an object of class SPsurv, the output of pooledSPsurv.

Value

pooledSPsurv returns an object of class "SPsurv".

A "pooledSPsurv" object has the following elements:

betas

matrix, numeric values of the posterior for each variable in the duration equation .

gammas

matrix, numeric values of the posterior for each variable in the immune equation.

rho

vector, numeric values of rho.

delta

vector, numeric values of delta.

X

matrix of X's variables.

Z

matrix of Z's variables.

Y

vector of `Y'.

Y0

vector of `Y0'.

C

vector of `C'.

form

character, type of distribution.

call

description for the model to be estimated.

list. Empirical mean, standard deviation and quantiles for each variable. list. Empirical mean, standard deviation and quantiles for each variable.

Examples

# \donttest{ walter <- spduration::add_duration(Walter_2015_JCR,"renewed_war", unitID = "ccode", tID = "year", freq = "year", ongoing = FALSE)
#> Warning: Converting to 'Date' class with yyyy-06-30
set.seed(123456) model <- pooledSPsurv( duration = duration ~ fhcompor1 + lgdpl + comprehensive + victory + instabl + intensityln + ethfrac + unpko, immune = cured ~ fhcompor1 + lgdpl + victory, Y0 = 't.0', LY = 'lastyear', data = walter, N = 100, burn = 10, thin = 10, w = c(1,1,1), m = 10, form = "Weibull" ) print(model)
#> Call: #> pooledSPsurv(duration = duration ~ fhcompor1 + lgdpl + comprehensive + #> victory + instabl + intensityln + ethfrac + unpko, immune = cured ~ #> fhcompor1 + lgdpl + victory, Y0 = "t.0", LY = "lastyear", #> data = walter, N = 100, burn = 10, thin = 10, w = c(1, 1, #> 1), m = 10, form = "Weibull") #> #> #> Iterations = 1:9 #> Thinning interval = 1 #> Number of chains = 1 #> Sample size per chain = 9 #> #> Empirical mean and standard deviation for each variable, #> plus standard error of the mean: #> #> #> Duration equation: #> Mean SD Naive SE Time-series SE #> (Intercept) 1.69150492 1.13842191 0.37947397 0.72836286 #> fhcompor1 -0.95879645 0.71976455 0.23992152 0.23992152 #> lgdpl -0.01711938 0.10324308 0.03441436 0.03308852 #> comprehensive -0.88064889 0.48338727 0.16112909 0.16112909 #> victory 0.36350782 0.58901831 0.19633944 0.19633944 #> instabl 0.68810472 0.60268434 0.20089478 0.20089478 #> intensityln 0.10202337 0.05913569 0.01971190 0.01202436 #> ethfrac -0.21938349 0.70877869 0.23625956 0.23625956 #> unpko 0.84936611 0.65902802 0.21967601 0.21967601 #> #> Inmune equation: #> Mean SD Naive SE Time-series SE #> (Intercept) 0.7645582 1.878438 0.6261459 1.2225668 #> fhcompor1 3.4480967 4.610149 1.5367162 2.8349533 #> lgdpl -3.1381824 2.568191 0.8560636 0.8560636 #> victory -0.6346364 3.068650 1.0228834 1.0228834 #>
summary(model, parameter = "betas")
#> #> Iterations = 1:9 #> Thinning interval = 1 #> Number of chains = 1 #> Sample size per chain = 9 #> #> 1. Empirical mean and standard deviation for each variable, #> plus standard error of the mean: #> #> Mean SD Naive SE Time-series SE #> (Intercept) 1.69150 1.13842 0.37947 0.72836 #> fhcompor1 -0.95880 0.71976 0.23992 0.23992 #> lgdpl -0.01712 0.10324 0.03441 0.03309 #> comprehensive -0.88065 0.48339 0.16113 0.16113 #> victory 0.36351 0.58902 0.19634 0.19634 #> instabl 0.68810 0.60268 0.20089 0.20089 #> intensityln 0.10202 0.05914 0.01971 0.01202 #> ethfrac -0.21938 0.70878 0.23626 0.23626 #> unpko 0.84937 0.65903 0.21968 0.21968 #> #> 2. Quantiles for each variable: #> #> 2.5% 25% 50% 75% 97.5% #> (Intercept) -0.13664 1.06496 1.84080 2.326544 3.27727 #> fhcompor1 -2.08731 -1.58665 -0.80098 -0.589260 -0.05586 #> lgdpl -0.14048 -0.07796 -0.02347 -0.003296 0.15663 #> comprehensive -1.69718 -1.12879 -0.88757 -0.601159 -0.27984 #> victory -0.44365 0.25385 0.28800 0.321501 1.45898 #> instabl -0.11008 0.28032 0.66443 1.119573 1.59026 #> intensityln 0.01332 0.06036 0.12142 0.140956 0.17080 #> ethfrac -1.13836 -0.55928 -0.44751 0.427076 0.84619 #> unpko -0.15069 0.51824 0.93883 1.298319 1.71663 #>
# plot(model) # }