ZIPExt {ZIPBayes} | R Documentation |
Zero-inflated Poisson model under measurement error and external validation data are available
Description
The function implements the MCMC algorithm with data augmentation to estimate the parameters in the zero-inflated Poisson model while correcting for the measurement error arising from the responses. The function returns the trace of the sampled parameters in each interaction. To obtain the summary estimation, use summary
().
Usage
ZIPExt (Ystar, Covarmainphi, Covarmainmu, Covarplus, Covarminus,
Ystarval, Yval, Covarvalplus, Covarvalminus,
betaphi, betamu, alphaplus, alphaminus,
Uibound = c(7,11),
priorgamma, priormu, priorSigma,
propsigmaphi, propsigmamu = propsigmaphi,
propsigmaplus = propsigmaphi, propsigmaminus = propsigmaphi,
seed = 1, nmcmc = 500)
Arguments
Ystar |
a count vector of length |
Covarmainphi |
a |
Covarmainmu |
a |
Covarplus |
a |
Covarminus |
a |
Ystarval |
a count vector of length |
Yval |
a count vector of length |
Covarvalplus |
a |
Covarvalminus |
a |
betaphi |
a vector of length |
betamu |
a vector of length |
alphaplus |
a vector of length |
alphaminus |
a vector of length |
Uibound |
a vector of length |
priorgamma |
a vector of length |
priormu |
a vector of length |
priorSigma |
a vector of length |
propsigmaphi |
a vector of length |
propsigmamu |
a vector of length |
propsigmaplus |
a vector of length |
propsigmaminus |
a vector of length |
seed |
a numeric value specifying the seed for random generator |
nmcmc |
a integer specify the number of the generation of MCMC algorithm |
Details
Comparing to the ZIPMErr function, this function has an addition component – validation data. Here, the argument “Ystarval”, “Yval”, “Covarvalplus”, “Covarvalminus”, are new for the sceanrio with external validation.
Value
BayesResults |
the list of trace of generated parameters for each component of the models. Data frame “betaphi_trace” corresponds to the probability component of ZIP response model; “betamu_trace” refers to the mean component of the ZIP response model. Data frames “alphaplus_trace” and “alphaminus_trace”, respectively, correspond to the add-in error and leave-out error process in the measruement error model. |
Author(s)
Qihuang Zhang and Grace Y. Yi
References
Zhang, Qihuang. “Inference Methods for Noisy Correlated Responses with Measurement Error.” (2020).
See Also
Examples
## load data
data(datasimExt)
set.seed(0)
example_ZIP_Ext <- ZIPExt (Ystar = datasimExt$main$Ystar,
Covarmainphi = datasimExt$main[,c("intercept","X1")],
Covarmainmu = datasimExt$main[,c("intercept","X2")],
Covarplus = datasimExt$main[,c("intercept","Zplus")],
Covarminus = datasimExt$main[,c("intercept","Zminus")],
Ystarval = datasimExt$validation$Ystar,
Yval = datasimExt$validation$Y,
Covarvalplus = datasimExt$validation[,3:4],
Covarvalminus = datasimExt$validation[,3:4],
betaphi = c(0.7,-0.7), betamu = c(1,-1.5),
alphaplus = c(0,0), alphaminus=c(0,0),
priorgamma = c(0.001,0.001), priormu = c(0,0),
priorSigma = c(1,1), propsigmaphi = c(0.05,0.05),
nmcmc = 10)
summary(example_ZIP_Ext)