| SamplePred | R Documentation | 
Obtains posterior samples of E(Y) = h(Znew) + beta*Xnew or of g^{-1}[E(y)]
SamplePred(
  fit,
  Znew = NULL,
  Xnew = NULL,
  Z = NULL,
  X = NULL,
  y = NULL,
  sel = NULL,
  type = c("link", "response"),
  ...
)
fit | 
 An object containing the results returned by a the   | 
Znew | 
 optional matrix of new predictor values at which to predict new   | 
Xnew | 
 optional matrix of new covariate values at which to obtain predictions. If not specified, defaults to using observed X values  | 
Z | 
 an   | 
X | 
 an   | 
y | 
 a vector of outcome data of length   | 
sel | 
 A vector selecting which iterations of the BKMR fit should be retained for inference. If not specified, will default to keeping every 10 iterations after dropping the first 50% of samples, or if this results in fewer than 100 iterations, than 100 iterations are kept  | 
type | 
 whether to make predictions on the scale of the link or of the response; only relevant for the binomial outcome family  | 
... | 
 other arguments; not currently used  | 
For guided examples, go to https://jenfb.github.io/bkmr/overview.html
a matrix with the posterior samples at the new points
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)
med_vals <- apply(Z, 2, median)
Znew <- matrix(med_vals, nrow = 1)
h_true <- dat$HFun(Znew)
set.seed(111)
samps3 <- SamplePred(fitkm, Znew = Znew, Xnew = cbind(0))
head(samps3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.