methods-predict: Model Prediction.

Description Usage Arguments Value Author(s) Examples

Description

Executes the prediction method for an object of class modelObjFit.

Usage

1
2
 ## S4 method for signature 'modelObjFit'
predict(object, newdata = NULL, ...) 

Arguments

object

an object of class modelObjFit containing the regression object which which predictions are to be obtained.

newdata

An optional data frame of variables with which to make predictions. If not provided, fitted values from the regression analysis are returned.

...

ignored

Value

A matrix of the predicted response for the fitted model.

Author(s)

Shannon T. Holloway <sthollow@ncsu.edu>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
    #----------------------------------------------------#
    # 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)

    pred <- predict(object=fit.obj, newdata=X)

    head(pred)


Search within the modelObj package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.