View source: R/PredictorResponseFunctions.R
PredictorResponseBivarPair | R Documentation |
Plot bivariate predictor-response function on a new grid of points
PredictorResponseBivarPair( fit, y = NULL, Z = NULL, X = NULL, whichz1 = 1, whichz2 = 2, whichz3 = NULL, method = "approx", prob = 0.5, q.fixed = 0.5, sel = NULL, ngrid = 50, min.plot.dist = 0.5, center = TRUE, ... )
fit |
An object containing the results returned by a the |
y |
a vector of outcome data of length |
Z |
an |
X |
an |
whichz1 |
vector identifying the first predictor that (column of |
whichz2 |
vector identifying the second predictor that (column of |
whichz3 |
vector identifying the third predictor that will be set to a pre-specified fixed quantile (determined by |
method |
method for obtaining posterior summaries at a vector of new points. Options are "approx" and "exact"; defaults to "approx", which is faster particularly for large datasets; see details |
prob |
pre-specified quantile to set the third predictor (determined by |
q.fixed |
vector of quantiles at which to fix the remaining predictors in |
sel |
logical expression indicating samples to keep; defaults to keeping the second half of all samples |
ngrid |
number of grid points to cover the range of each predictor (column in |
min.plot.dist |
specifies a minimum distance that a new grid point needs to be from an observed data point in order to compute the prediction; points further than this will not be computed |
center |
flag for whether to scale the exposure-response function to have mean zero |
... |
other arguments to pass on to the prediction function |
a data frame with value of the first predictor, the value of the second predictor, the posterior mean estimate, and the posterior standard deviation
## First generate dataset set.seed(111) dat <- SimData(n = 50, M = 4) y <- dat$y Z <- dat$Z X <- dat$X ## Fit model with component-wise variable selection ## Using only 100 iterations to make example run quickly ## Typically should use a large number of iterations for inference set.seed(111) fitkm <- kmbayes(y = y, Z = Z, X = X, iter = 100, verbose = FALSE, varsel = TRUE) ## Obtain predicted value on new grid of points ## Using only a 10-by-10 point grid to make example run quickly pred.resp.bivar12 <- PredictorResponseBivarPair(fit = fitkm, min.plot.dist = 1, ngrid = 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.