Learn R Programming

BayesCR (version 2.1)

Bayes.CR: Bayesian Analysis of Censored Regression Models Under Scale Mixture of Skew Normal Distributions

Description

Bayes.CR Propose a parametric fit for censored linear regression models based on SMSN distributions, from a Bayesian perspective.

Usage

Bayes.CR(cc, x, y, cens = "left", dist = "Normal", criteria = "FALSE",
  influence = "FALSE", spacing = "NULL", prior = NULL, hyper = NULL,
  n.thin = 10, burnin = 100, n.iter = 2000, n.chains = 2,
  chain = "TRUE")

Arguments

cc

Vector of censoring indicators. For each observation: 0 if non-censored, 1 if censored.

x

Matrix or vector of covariates.

y

Vector of responses in case of right/left censoring.

cens

"left" for left censoring, "right" for right censoring.

dist

Distribution to be used: "Normal" for Normal model, "T" for Student-t model, "Slash" for slash model, "NormalC" for contaminated Normal model, "SN" for Skew-Normal model, "ST" for Skew-t model and "SSL" for Skew-Slash model.

criteria

"TRUE" or "FALSE". Indicates if model selection criteria (LPML, DIC, EAIC, EBIC and WAIC) should be computed.

influence

"TRUE" or "FALSE". Indicates if the divergence measures (KL divergence, J, L and Chi Distance) should be computed.

spacing

Should only be specified if at least one of "influence" or "criteria" is TRUE. This is the lag between observations of the final chain (after burn-in and thinning) used to compute these measures. If spacing=1, all the chain is used.

prior

Prior distribution to be used for the degrees of freedom under Student-t model: "Exp" for exponential distribution, "Jeffreys" for Jeffreys prior, "Unif" for Uniforme distribution and "Hierar" for Hierarchical prior (exponential with a parameter that follows a uniform distribution). Must be "NULL" for other models.

hyper

Value of hyperparameter for the exponential prior. Must not be provided in case of others prior distributions.

n.thin

Lag for posterior sample.

burnin

Burn-in for posterior sample.

n.iter

The number of iterations to be considered (before burnin and thinning).

n.chains

The number of chains to be considered. It must be less than 5.

chain

If "TRUE", all the posterior chains are stored for posterior analysis.

Value

Mean

Posterior mean for the parameters.

Sd

Standard deviations for the parameters.

HPD

HPD(95%) interval for the parameters.

LPML

Log-marginal pseudo likelihood for model selection.

DIC

DIC criterion for model selection.

EAIC

EAIC criterion for model selection.

EBIC

EBIC criterion for model selection.

WAIC1

First version of Watanabe-Akaike information criterion.

WAIC2

Second version of Watanabe-Akaike information criterion.

Details

Specification of the priors distributions is given in reference papers (Garay et. al 2013 and Cancho et. al 2010). See Gelman et. al for the difference between the two versions of WAIC criterion. Calculations under the Skew-slash model may take a while, as it involves numerical integrations - you may want to specify big values to "spacing" under this model. For the Contaminated Normal model, a observation y comes from a normal distribution with mean "x beta" and variance "sigma2/rho" with probabilty "nu" and comes from a normal distribution with mean "x beta" and variance "sigma2" with probability 1-"nu".

See Also

rSMSN, motorettes

##Load the data

data(motorettes)

attach(motorettes)

##Set design matrix

x <- cbind(1,x)

##Fits a right censored normal model

Normal <- Bayes.CR(cc,x,y,cens="right",dist="Normal",n.thin=10,burnin=200,n.iter=800, n.chains=1,chain="TRUE")