Function to calculate predictions and uncertainties of predictions from estimates from hierarchical multivariate regression analysis of survey data with the item count technique.
# S3 method for ictregBayesHier predict(object, newdata, se.fit = FALSE, interval = c("none", "confidence"), level = 0.95, sensitive.item, ...)
object | Object of class inheriting from "ictregBayes" or "ictregBayesMulti" |
---|---|
newdata | An optional data frame containing data that will be used to make predictions from. If omitted, the data used to fit the regression are used. |
se.fit | A switch indicating if standard errors are required. |
interval | Type of interval calculation. |
level | Significance level for confidence intervals. |
sensitive.item | For the multiple sensitive item design, the integer indicating which sensitive item coefficients will be used for prediction. |
... | further arguments to be passed to or from other methods. |
predict.ictreg
produces a vector of predictions or a matrix
of predictions and bounds with column names fit, lwr, and upr if interval is
set. If se.fit is TRUE, a list with the following components is returned:
vector or matrix as above
standard error of prediction
predict.ictregBayesHier
produces predicted values, obtained by
evaluating the regression function in the frame newdata (which defaults to
model.frame(object)
. If the logical se.fit
is TRUE
,
standard errors of the predictions are calculated. Setting interval
specifies computation of confidence intervals at the specified level or no
intervals.
The mean prediction across all observations in the dataset is calculated,
and if the se.fit
option is set to TRUE
a standard error for
this mean estimate will be provided. The interval
option will output
confidence intervals instead of only the point estimate if set to
TRUE
.
In the multiple sensitive item design, prediction can only be based on the
coefficients from one of the sensitive item fits. The sensitive.item
option allows you to specify which is used, using integers from 1 to the
number of sensitive items.
Blair, Graeme and Kosuke Imai. (2012) ``Statistical Analysis of List Experiments." Political Analysis, Vol. 20, No 1 (Winter). available at http://imai.princeton.edu/research/listP.html
Imai, Kosuke. (2011) ``Multivariate Regression Analysis for the Item Count Technique.'' Journal of the American Statistical Association, Vol. 106, No. 494 (June), pp. 407-416. available at http://imai.princeton.edu/research/list.html
ictreg
for model fitting
data(race)# NOT RUN { mle.estimates.multi <- ictreg(y ~ male + college, data = multi, constrained = TRUE) draws <- mvrnorm(n = 3, mu = coef(mle.estimates.multi), Sigma = vcov(mle.estimates.multi) * 9) bayes.fit <- ictregBayesHier(y ~ male + college, formula.level.2 = ~ 1, delta.start.level.1 = list(draws[1, 8:9], draws[1, 2:3], draws[1, 5:6]), data = multi, treat = "treat", delta.tune = list(rep(0.005, 2), rep(0.05, 2), rep(0.05, 2)), alpha.tune = rep(0.001, length(unique(multi$state))), J = 3, group.level.2 = "state", n.draws = 100, burnin = 10, thin = 1) bayes.predict <- predict(bayes.fit, interval = "confidence", se.fit = TRUE) # }