predict.sven {bravo} R Documentation

## Make predictions from a fitted "sven" object.

### Description

This function makes point predictions and computes prediction intervals from a fitted "sven" object.

### Usage

## 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,
...
)


### Arguments

 object A fitted "sven" object newdata Matrix of new values for X at which predictions are to be made. Must be a matrix; can be sparse as in Matrix package. 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 interval = "none", only point predictions are returned; if interval = "MC", Monte Carlo prediction intervals are returned; if interval = "Z", Z prediction intervals are returned. return.draws only required if interval = "MC". if TRUE, the Monte Carlo samples are returned. Default: FALSE. Nsim only required if interval = "MC". The Monte Carlo sample size. Default: 10000. level Confidence level of the interval. Default: 0.95. alpha Type one error rate. Default: 1-level. ... Further arguments passed to or from other methods.

### Value

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 \code{ncol(newdata)} \times \code{Nsim} matrix of the Monte Carlo samples

### Author(s)

Dongjin Li and Somak Dutta
Maintainer: Dongjin Li <dongjl@iastate.edu>

### References

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

### Examples

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)


[Package bravo version 2.1.2 Index]