Perform a post-estimation prediction with uncertainty quantification via parametric bootstrap
cmpredict_p(
out,
newdata = NULL,
zval = NULL,
typical = NULL,
type = c("response", "link"),
nsim = 1000L,
seed = NULL,
draws = FALSE
)
cmpredict.p(...)An output of cmreg_p.
A named data frame, list, or vector supplying values for every covariate in the fitted formula. A data frame returns absent/present latent- trait scenarios for every row.
Optional named vector for one covariate to vary. Its name must match a formula variable; all remaining covariates are supplied through `newdata` or `typical`.
Optional named vector or list of fixed covariate values. This is a convenience alternative to `newdata` when used with `zval`.
Prediction scale: `"response"` (default) or `"link"`. The Gaussian outcome model has an identity link, so these are currently equal.
Number of parametric-bootstrap draws.
Optional integer seed for reproducible bootstrap draws. When set, the caller's RNG state is restored before returning.
If `TRUE`, attach the raw bootstrap draw matrix as a `"draws"` attribute on the returned data frame.
Arguments passed to cmpredict_p().
A data frame with `estimate`, `conf.low`, and `conf.high` columns. Each input scenario contributes an absent-trait row followed by a present- trait row. When `draws = TRUE`, its `"draws"` attribute contains the raw parametric-bootstrap matrix.
Atsusaka, Y. and Stevenson, R. T. (2023). The crosswise model for sensitive survey questions. doi:10.1017/pan.2021.43 .
[cmreg_p()] to fit the required predictor-model object and [cmpredict()] for predictions from an outcome model.
m2 <- cmreg_p(V ~ age + female, crosswise = Y, anchor = A, p = 0.1,
p.prime = 0.15, data = cmdata3)
predictions <- cmpredict_p(m2, newdata = data.frame(age = 30, female = 1))
predictions
#> estimate conf.low conf.high
#> 1: trait absent 0.5600254 0.4714755 0.6528083
#> 1: trait present 1.5459544 1.4292256 1.6682708