Learn R Programming

UHM (version 0.3.0)

ZIHR: Zero-inflation hurdle regression models

Description

Fits zero-inflated hurdle regression models

Usage

ZIHR(
  modelY,
  modelZ,
  data,
  n.chains = n.chains,
  n.iter = n.iter,
  n.burnin = n.burnin,
  n.thin = n.thin,
  family = "Gaussian"
)

Value

  • MCMC chains for the unknown parameters

  • Est list of posterior mean for each parameter

  • SD list of standard error for each parameter

  • L_CI list of 2.5th percentiles of the posterior distribution serves as the lower bound of the Bayesian credible interval

  • U_CI list of 97.5th percentiles of the posterior distribution serves as the lower bound of the Bayesian credible interval

  • Rhat Gelman and Rubin diagnostic for all parameter

  • beta the regression coefficients of mean of the hurdle model

  • alpha the regression coefficients of probability of the hurdle model

  • The variance, over-dispersion, dispersion, or scale parameters of models depend on the family used

  • DIC deviance information criterion

  • LPML Log Pseudo Marginal Likelihood (LPML) criterion

Arguments

modelY

a formula for the mean of the count response. This argument is identical to the one in the "glm" function.

modelZ

a formula for the probability of zero. This argument is identical to the one in the "glm" function.

data

data set of observed variables.

n.chains

the number of parallel chains for the model; default is 1.

n.iter

integer specifying the total number of iterations; default is 1000.

n.burnin

integer specifying how many of n.iter to discard as burn-in ; default is 5000.

n.thin

integer specifying the thinning of the chains; default is 1.

family

Family objects streamline the specification of model details for functions like glm. They cover various distributions like "Gaussian", "Exponential", "Weibull", "Gamma", "Beta", "inverse.gaussian", "Poisson", "NB", "Logarithmic", "Bell", "GP", and "Binomial". Specifically, "NB" and "GP" are tailored for hurdle negative binomial and hurdle generalized Poisson models, respectively, while the others are utilized for the corresponding models based on their names.

Author

Taban Baghfalaki t.baghfalaki@gmail.com, Mojtaba Ganjali m-ganjali@sbu.ac.ir

Details

A function utilizing the 'JAGS' software to estimate the linear hurdle regression model.

Examples

Run this code
# Example 1
data(dataD)
index <- 1:(dim(dataD)[1])
IND_new <- sample(index, .5 * length(index))
datat <- dataD[IND_new, ]
datav <- dataD[-IND_new, ]
modelY <- y~x1 + x2
modelZ <- z~x1
D1 <- ZIHR(modelY, modelZ,
           data = datat, n.chains = 2, n.iter = 1000,
           n.burnin = 500, n.thin = 1, family = "Poisson"
)

# \donttest{
  SummaryZIHR(D1)
  Prediction(D1, data = datav)


  D2 <- ZIHR(modelY, modelZ,
             data = datat, n.chains = 2, n.iter = 1000,
             n.burnin = 500, n.thin = 1, family = "Bell"
  )
  SummaryZIHR(D2)



  # Example 2
  data(dataC)
  modelY <- y~x1 + x2
  modelZ <- z~x1
  C <- ZIHR(modelY, modelZ,
            data = dataC, n.chains = 2, n.iter = 1000,
            n.burnin = 500, n.thin = 1, family = "Gaussian"
  )
  SummaryZIHR(C)

  Prediction(C, data = datav)



  # Example 3
  data(dataP)
  modelY <- y~x1 + x2
  modelZ <- z~x1
  P1 <- ZIHR(modelY, modelZ,
             data = dataP, n.chains = 2, n.iter = 1000,
             n.burnin = 500, n.thin = 1, family = "Exponential"
  )
  SummaryZIHR(P1)

  P2 <- ZIHR(modelY, modelZ,
             data = dataP, n.chains = 2, n.iter = 1000,
             n.burnin = 500, n.thin = 1, family = "Gamma"
  )
  SummaryZIHR(P2)

  P3 <- ZIHR(modelY, modelZ,
             data = dataP, n.chains = 2, n.iter = 1000,
             n.burnin = 500, n.thin = 1, family = "Weibull"
  )
  SummaryZIHR(P3)


  # Example B
  data(dataB)
  modelY <- y~x1 + x2
  modelZ <- z~x1
  P <- ZIHR(modelY, modelZ,
            data = dataB, n.chains = 2, n.iter = 1000,
            n.burnin = 500, n.thin = 1, family = "Beta"
  )
  SummaryZIHR(P)

  # Example C
  data(dataI)
  modelY <- y~x1 + x2
  modelZ <- z~x1
  P4 <- ZIHR(modelY, modelZ,
             data = dataI, n.chains = 2, n.iter = 1000,
             n.burnin = 500, n.thin = 1, family = "inverse.gaussian"
  )
  SummaryZIHR(P4)
# }

Run the code above in your browser using DataLab