Type: | Package |
Title: | Bayesian Misclassified-Failure Survival Model |
Version: | 0.1.0 |
Description: | Contains a split population survival estimator that models the misclassification probability of failure versus right-censored events. The split population survival estimator is described in Bagozzi et al. (2019) <doi:10.1017/pan.2019.6>. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
LazyData: | true |
Depends: | R (≥ 3.5.0) |
Imports: | MCMCpack, FastGP, stats, Rcpp (≥ 1.0.3), coda, mvtnorm, |
LinkingTo: | Rcpp, RcppArmadillo |
RoxygenNote: | 7.0.2 |
NeedsCompilation: | yes |
Packaged: | 2019-12-19 03:31:08 UTC; Nicolás Schmidt |
Author: | Minnie M. Joo [aut], Sergio Bejar [aut], Nicolas Schmidt [aut, cre], Bumba Mukherjee [aut] |
Maintainer: | Nicolas Schmidt <nschmidt@cienciassociales.edu.uy> |
Repository: | CRAN |
Date/Publication: | 2019-12-22 16:40:02 UTC |
Buhaugetal_2009_JCR
Description
Subsetted version of survival database extracted from Buhaug et al. (2009). It has precisely dated duration data of internal conflict as well as geographic data. Variables Y, Y0 and C were later added by Bagozzi et al. (2019). It is used to estimate the Bayesian Misclassified Failure (MF) Weibull model presented in Bagozzi et al. (2019).
Usage
data(Buhaugetal_2009_JCR)
Format
A data frame with 1562 rows and 13 variables
Details
- lndistx
log conflict-capital distance.
- confbord
conflict zone at border.
- borddist
confbord * lndistx centred.
- figcapdum
rebel fighting capacity at least moderate.
- lgdp_onset
gdp capita in onset year.
- sip2l_onset
Gates et al. (2006) SIP code (1 year lag) for the onset year.
- pcw
post cold war period, 1989+.
- frst
percentage of forest in conflict zone.
- mt
percentage of mountains in conflict zone.
- Y
conflict duration.
- Y0
elapsed time since inception to Y (t-1).
- C
censoring variable.
- coupx
coup d'etat, except if overlapping with other gov't conflict (PHI 1989).
Source
Buhaug, Halvard, Scott Gates, and Päivi Lujala (2009), Geography, rebel capability, and the duration of civil conflict, Journal of Conflict Resolution 53(4), 544 - 569.
mfsurv
Description
mfsurv
fits a parametric Bayesian MF model via Markov Chain Monte Carlo (MCMC) to estimate the misclassification in the first stage
and the hazard in the second stage.
Usage
mfsurv(
formula,
Y0,
data = list(),
N,
burn,
thin,
w = c(1, 1, 1),
m = 10,
form = c("Weibull", "Exponential"),
na.action = c("na.omit", "na.fail")
)
Arguments
formula |
a formula in the form Y ~ X1 + X2... | C ~ Z1 + Z2 ... where Y is the duration until failure or censoring, and C is a binary indicator of observed failure. |
Y0 |
the elapsed time since inception until the beginning of time period (t-1). |
data |
list object of data. |
N |
number of MCMC iterations. |
burn |
burn-ins to be discarded. |
thin |
thinning to prevent autocorrelation of chain of samples by only taking the n-th values. |
w |
size of the slice in the slice sampling for (betas, gammas, lambda). The default is c(1,1,1). This value may be changed by the user to meet one's needs. |
m |
limit on steps in the slice sampling. The default is 10. This value may be changed by the user to meet one's needs. |
form |
type of parametric model distribution to be used. Options are "Exponential" or "Weibull". The default is "Weibull". |
na.action |
a function indicating what should happen when NAs are included in the data. Options are "na.omit" or "na.fail". The default is "na.omit". |
Value
mfsurv returns an object of class "mfsurv"
.
A "mfsurv"
object has the following elements:
Y |
the vector of ‘Y’. |
Y0 |
the vector of ‘Y0’. |
C |
the vector of ‘C’. |
X |
matrix X's variables. |
Z |
the vector of ‘Z’. |
betas |
data.frame, X.intercept and X variables. |
gammas |
data.frame, Z.intercept and Z variables. |
lambda |
integer. |
post |
integer. |
iterations |
number of MCMC iterations. |
burn_in |
burn-ins to be discarded. |
thinning |
integer. |
betan |
integer, length of posterior sample for betas. |
gamman |
integer, length of posterior sample for gammas. |
distribution |
character, type of distribution. |
call |
the call. |
formula |
description for the model to be estimated. |
Examples
set.seed(95)
bgl <- Buhaugetal_2009_JCR
bgl <- subset(bgl, coupx == 0)
bgl <- na.omit(bgl)
Y <- bgl$Y
X <- as.matrix(cbind(1, bgl[,1:7]))
C <- bgl$C
Z1 <- matrix(1, nrow = nrow(bgl))
Y0 <- bgl$Y0
model1 <- mfsurv(Y ~ X | C ~ Z1, Y0 = Y0,
N = 50,
burn = 20,
thin = 15,
w = c(0.1, .1, .1),
m = 5,
form = "Weibull",
na.action = 'na.omit')
mfsurv.stats
Description
A function to calculate the deviance information criterion (DIC) for fitted model objects of class mfsurv
for which a log-likelihood can be obtained, according to the formula DIC = -2 * (L - P),
where L is the log likelihood of the data given the posterior means of the parameter and
P is the estimate of the effective number of parameters in the model.
Usage
mfsurv.stats(object)
Arguments
object |
an object of class |
Value
list.
Examples
set.seed(95)
bgl <- Buhaugetal_2009_JCR
bgl <- subset(bgl, coupx == 0)
bgl <- na.omit(bgl)
Y <- bgl$Y
X <- as.matrix(cbind(1, bgl[,1:7]))
C <- bgl$C
Z1 <- matrix(1, nrow = nrow(bgl))
Y0 <- bgl$Y0
model1 <- mfsurv(Y ~ X | C ~ Z1, Y0 = Y0,
N = 50,
burn = 20,
thin = 15,
w = c(0.1, .1, .1),
m = 5,
form = "Weibull",
na.action = 'na.omit')
mfsurv.stats(model1)
mfsurv.summary()
Description
Returns a summary of a mfsurv object via summary.mcmc
.
Usage
mfsurv.summary(object, parameter = c("betas", "gammas", "lambda"))
Arguments
object |
an object of class |
parameter |
one of three parameters of the mfsurv output. Indicate either "betas", "gammas" or "lambda". |
Value
list. Empirical mean, standard deviation and quantiles for each variable.
Examples
set.seed(95)
bgl <- Buhaugetal_2009_JCR
bgl <- subset(bgl, coupx == 0)
bgl <- na.omit(bgl)
Y <- bgl$Y
X <- as.matrix(cbind(1, bgl[,1:7]))
C <- bgl$C
Z1 <- matrix(1, nrow = nrow(bgl))
Y0 <- bgl$Y0
model1 <- mfsurv(Y ~ X | C ~ Z1, Y0 = Y0,
N = 50,
burn = 20,
thin = 15,
w = c(0.1, .1, .1),
m = 5,
form = "Weibull",
na.action = 'na.omit')
mfsurv.summary(model1, "betas")