predict.BVCfit {spinBayes} | R Documentation |
make predictions from a BVCfit object
Description
make predictions from a BVCfit object
Usage
## S3 method for class 'BVCfit'
predict(object, X.new, Z.new, E.new = NULL, clin.new = NULL, Y.new = NULL, ...)
## S3 method for class 'VarLin'
predict(object, X.new, Z.new, E.new, clin.new = NULL, Y.new = NULL, ...)
## S3 method for class 'VarOnly'
predict(object, X.new, Z.new, clin.new = NULL, Y.new = NULL, ...)
## S3 method for class 'LinOnly'
predict(object, X.new, Z.new, E.new = NULL, clin.new = NULL, Y.new = NULL, ...)
Arguments
object |
BVCfit object. |
X.new |
a matrix of new values for X at which predictions are to be made. |
Z.new |
a vector of new values for Z at which predictions are to be made. |
E.new |
a vector of new values for E at which predictions are to be made. |
clin.new |
a vector or matrix of new values for clin at which predictions are to be made. |
Y.new |
a vector of the response of new observations. If provided, the prediction mean squared error (PMSE) will be computed based on Y.new. |
... |
other predict arguments |
Details
X.new (clin.new) must have the same number of columns as X (clin) used for fitting the model. If E and clin are provided when fit the model, E.new and clin.new must not be NULL, and vice versa. The predictions are made based on the posterior estimates of coefficients in the BVCfit object. Note that the main effects of environmental exposures Z and E are not subject to selection.
Value
an object of class "BVCfit.pred" is returned, which is a list with components:
pmse |
predictions mean squared error. pmse is NULL is Y.new=NULL. |
y.pred |
predicted values of the new observations. |
See Also
Examples
data(gExp)
spbayes=BVCfit(X, Y, Z, E, clin)
spbayes
data(gExp.new)
pred = predict(spbayes, X.new, Z.new, E.new, clin.new, Y.new)
pred$pmse
# pred$y.pred