| predict.sven | R Documentation | 
This function makes point predictions and computes prediction intervals from a fitted "sven" object.
## S3 method for class 'sven'
predict(
  object,
  newdata,
  model = c("WAM", "MAP"),
  interval = c("none", "MC", "Z"),
  return.draws = FALSE,
  Nsim = 10000,
  level = 0.95,
  alpha = 1 - level,
  ...
)
| object | A fitted "sven" object | 
| newdata | Matrix of new values for  | 
| model | The model to be used to make predictions. Model "MAP" gives the predictions calculated using the MAP model; model "WAM" gives the predictions calculated using the WAM. Default: "WAM". | 
| interval | Type of interval calculation. If  | 
| return.draws | only required if  | 
| Nsim | only required if  | 
| level | Confidence level of the interval. Default: 0.95. | 
| alpha | Type one error rate. Default: 1- | 
| ... | Further arguments passed to or from other methods. | 
The object returned depends on "interval" argument. If interval = "none", the object is an 
\code{ncol(newdata)}\times 1 vector of the point predictions; otherwise, the object is an
\code{ncol(newdata)}\times 3 matrix with the point predictions in the first column and the lower and upper bounds 
of prediction intervals in the second and third columns, respectively.
if return.draws is TRUE, a list with the following components is returned:
| prediction | vector or matrix as above | 
| mc.draws | an  | 
Dongjin Li and Somak Dutta
 Maintainer:
Dongjin Li <dongjl@iastate.edu>
Li, D., Dutta, S., Roy, V.(2020) Model Based Screening Embedded Bayesian Variable Selection for Ultra-high Dimensional Settings http://arxiv.org/abs/2006.07561
n = 80; p = 100; nonzero = 5
trueidx <- 1:5
nonzero.value <- c(0.50, 0.75, 1.00, 1.25, 1.50)
TrueBeta = numeric(p)
TrueBeta[trueidx] <- nonzero.value
X <- matrix(rnorm(n*p), n, p)
y <- 0.5 + X %*% TrueBeta + rnorm(n)
res <- sven(X=X, y=y)
newx <- matrix(rnorm(20*p), 20, p)
# predicted values at a new data matrix using MAP model
yhat <- predict(object = res, newdata = newx, model = "MAP", interval = "none")
# 95% Monte Carlo prediction interval using WAM
MC.interval <- predict(object = res, model = "WAM", newdata = newx, interval = "MC", level=0.95)
# 95% Z-prediction interval using MAP model
Z.interval <- predict(object = res, model = "MAP", newdata = newx, interval = "Z", level = 0.95)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.