predict.lm.spike {BoomSpikeSlab}  R Documentation 
Predictions using spikeandslab regression.
Description
Generate draws from the posterior predictive distribution of a spike and slab regression.
Usage
## S3 method for class 'lm.spike'
predict(object, newdata = NULL, burn = 0,
na.action = na.pass, mean.only = FALSE, ...)
## S3 method for class 'logit.spike'
predict(object, newdata, burn = 0,
type = c("prob", "logit", "link", "response"),
na.action = na.pass, ...)
## S3 method for class 'poisson.spike'
predict(object, newdata = NULL,
exposure = NULL, burn = 0,
type = c("mean", "log", "link", "response"),
na.action = na.pass, ...)
## S3 method for class 'probit.spike'
predict(object, newdata, burn = 0,
type = c("prob", "probit", "link", "response"),
na.action = na.pass, ...)
## S3 method for class 'qreg.spike'
predict(object, newdata, burn = 0,
na.action = na.pass, ...)
## S3 method for class 'BayesNnet'
predict(object, newdata = NULL, burn = 0,
na.action = na.pass, mean.only = FALSE, seed = NULL, ...)
Arguments
object 
A model object of class 
newdata 
Either If If 
exposure 
A vector of positive real numbers the same size as
newdata, or 
burn 
The number of MCMC iterations in the object to be discarded as burnin. 
na.action 
a function which indicates what should happen when
the data contain 
type 
The type of prediction desired. For For Both cases also accept 
mean.only 
Logical. If 
seed 
Random seed for the C++ random number generator. This is only needed for models that require C++ to implement their predict method. 
... 
Unused, but present for compatibility with generic

Value
Returns a matrix of predictions, with each row corresponding to a row in newdata, and each column to an MCMC iteration.
Author(s)
Steven L. Scott
See Also
lm.spike
SpikeSlabPrior
summary.lm.spike
plot.lm.spike
Examples
niter < 1000
n < 100
p < 10
ngood < 3
x < cbind(1, matrix(rnorm(n * (p1)), nrow=n))
beta < rep(0, p)
good < sample(1:p, ngood)
beta[good] < rnorm(ngood)
sigma < 1
y < rnorm(n, x %*% beta, sigma)
model < lm.spike(y ~ x  1, niter=niter)
plot(model)
plot.ts(model$beta)
hist(model$sigma) ## should be near true value
new.x < cbind(1, matrix(rnorm(100 * (p1)), ncol = (p1)))
pred < predict(model, newdata = new.x, burn = 100)