Markov Chain Monte Carlo (MCMC) to run time-varying Bayesian split population survival model with spatial frailties.

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

Print method for a spatialSPsurv x.

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

spatialSPsurv(
  duration,
  immune,
  Y0,
  LY,
  S,
  A,
  data,
  N,
  burn,
  thin,
  w = c(1, 1, 1),
  m = 10,
  ini.beta = 0,
  ini.gamma = 0,
  ini.W = 0,
  ini.V = 0,
  form = c("Weibull", "exponential", "loglog"),
  prop.varV,
  prop.varW,
  id_WV = colnames(A)
)

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

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

# S3 method for spatialSPsurv
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.

S

spatial information (e.g. district ID) for each observation that matches the spatial matrix row/column information.

A

an a times a spatial weights matrix where a is the number of unique spatial units (S) load as a separate file.

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.

ini.beta

initial value for the parameter vector beta. By default is 0.

ini.gamma

initial value for the parameter vector gamma. By default is 0.

ini.W

initial value for the parameter vector W. By default is 0.

ini.V

initial value for the parameter vector V. By default is 0.

form

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

prop.varV

proposal for variance of V in Metropolis-Hastings.

prop.varW

proposal for variance of W in Metropolis-Hastings.

id_WV

vector of type character that modifies the colnames of W and V in the model’s result. By default is colnames(A).

object

an object of class spatialSPsurv, the output of spatialSPsurv.

parameter

one of five parameters of the spatialSPsurv output. Indicate either "betas," "gammas," "rho", "lambda" or "delta".

...

additional parameter.

x

an object of class spatialSPsurv, the output of spatialSPsurv.

Value

spatialSPsurv returns an object of class "spatialSPsurv".

A "spatialSPsurv" 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.

lambda

vector, numeric values of lambda.

delta

vector, numeric values of delta.

W

matrix, numeric values of the posterior for Ws.

V

matrix, numeric values of the posterior for Vs.

X

matrix of X's variables.

Z

matrix of Z's variables.

Y

vector of `Y'.

Y0

vector of `Y0'.

C

vector of `C'.

S

vector of `S'.

ini.beta

numeric initial values of beta.

ini.gamma

numeric initial values of gamma.

ini.W

numeric initial values of W.

ini.V

numeric initial values of V.

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
walter <- spatial_SA(data = walter, var_ccode = "ccode", threshold = 800L) set.seed(123456) model <- spatialSPsurv( duration = duration ~ fhcompor1 + lgdpl + comprehensive + victory + instabl + intensityln + ethfrac + unpko, immune = cured ~ fhcompor1 + lgdpl + victory, Y0 = 't.0', LY = 'lastyear', S = 'sp_id' , data = walter[[1]], N = 100, burn = 10, thin = 10, w = c(1,1,1), m = 10, form = "Weibull", prop.varV = 1e-05, prop.varW = 1e-05, A = walter[[2]] ) print(model)
#> Call: #> spatialSPsurv(duration = duration ~ fhcompor1 + lgdpl + comprehensive + #> victory + instabl + intensityln + ethfrac + unpko, immune = cured ~ #> fhcompor1 + lgdpl + victory, Y0 = "t.0", LY = "lastyear", #> S = "sp_id", A = walter[[2]], data = walter[[1]], N = 100, #> burn = 10, thin = 10, w = c(1, 1, 1), m = 10, form = "Weibull", #> prop.varV = 1e-05, prop.varW = 1e-05) #> #> #> 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) -0.007201969 0.66130836 0.22043612 0.26789018 #> fhcompor1 -1.061114953 0.41744747 0.13914916 0.13914916 #> lgdpl 0.165102666 0.05750428 0.01916809 0.01804033 #> comprehensive -0.900192682 0.24683578 0.08227859 0.08227859 #> victory 0.459614177 0.36403873 0.12134624 0.12134624 #> instabl 0.993314336 0.61545544 0.20515181 0.20515181 #> intensityln 0.077556779 0.11611075 0.03870358 0.08824995 #> ethfrac 0.287245928 0.40197028 0.13399009 0.07084927 #> unpko 0.930642210 0.72474516 0.24158172 0.24158172 #> #> Immune equation: #> Mean SD Naive SE Time-series SE #> (Intercept) -1.8859005 4.217679 1.4058929 1.4058929 #> fhcompor1 -0.6911851 3.279678 1.0932261 1.0932261 #> lgdpl -3.1980281 3.281575 1.0938583 1.0938583 #> victory 1.6578210 2.834405 0.9448017 0.9448017 #>
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) -0.007202 0.6613 0.22044 0.26789 #> fhcompor1 -1.061115 0.4174 0.13915 0.13915 #> lgdpl 0.165103 0.0575 0.01917 0.01804 #> comprehensive -0.900193 0.2468 0.08228 0.08228 #> victory 0.459614 0.3640 0.12135 0.12135 #> instabl 0.993314 0.6155 0.20515 0.20515 #> intensityln 0.077557 0.1161 0.03870 0.08825 #> ethfrac 0.287246 0.4020 0.13399 0.07085 #> unpko 0.930642 0.7247 0.24158 0.24158 #> #> 2. Quantiles for each variable: #> #> 2.5% 25% 50% 75% 97.5% #> (Intercept) -0.72636 -0.474098 -0.14557 0.3283 1.0874 #> fhcompor1 -1.79121 -1.006467 -0.88788 -0.7696 -0.7236 #> lgdpl 0.09600 0.125091 0.16211 0.2041 0.2596 #> comprehensive -1.23909 -1.099777 -0.82024 -0.7503 -0.5811 #> victory 0.05352 0.255383 0.39102 0.7578 1.0533 #> instabl 0.13204 0.795864 0.83648 1.1202 2.0308 #> intensityln -0.05380 -0.016493 0.04289 0.1900 0.2475 #> ethfrac -0.24589 -0.009066 0.31607 0.6467 0.7384 #> unpko -0.33668 0.531894 1.05486 1.1717 1.9152 #>
# plot(model) # }