predict.ictregBayesHier: Predict Method for the Item Count Technique with Bayesian...

View source: R/ictregBayesHier.R

predict.ictregBayesHierR Documentation

Predict Method for the Item Count Technique with Bayesian Hierarchical Regression

Description

Function to calculate predictions and uncertainties of predictions from estimates from hierarchical multivariate regression analysis of survey data with the item count technique.

Usage

## S3 method for class 'ictregBayesHier'
predict(
  object,
  newdata,
  se.fit = FALSE,
  interval = c("none", "confidence"),
  level = 0.95,
  sensitive.item,
  ...
)

Arguments

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.

Details

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.

Value

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:

fit

vector or matrix as above

se.fit

standard error of prediction

Author(s)

Graeme Blair, UCLA, graeme.blair@ucla.edu and Kosuke Imai, Princeton University, kimai@princeton.edu

References

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

See Also

ictreg for model fitting

Examples


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)


## End(Not run)



list documentation built on May 29, 2024, 11:57 a.m.