predict {modelObj} | R Documentation |
Model Predictions
Description
Predictions from the results of a fit object.
Usage
predict(object, ...)
## S4 method for signature 'modelObjFit'
predict(object, newdata, ...)
Arguments
object |
An object of class |
newdata |
An object of class data.frame containing the variables in the model. |
... |
ignored |
Value
Model predictions, the form of which depend on the regression analysis.
Examples
# generate data
X <- matrix(rnorm(1000,0,1),
ncol=4,
dimnames=list(NULL,c("X1","X2","X3","X4")))
Y <- X %*% c(0.1, 0.2, 0.3, 0.4) + rnorm(250)
X <- data.frame(X)
# create modeling object using a formula
mo <- buildModelObj(model=Y ~ X1 + X2 + X3 + X4,
solver.method='lm')
# fit model
fit.obj <- fit(object=mo, data=X, response=Y)
predict(fit.obj)
predict(fit.obj, newdata = X[1:10,])
[Package modelObj version 4.2 Index]