R: Use predict() on an lmRob Object

predict.lmRob {robust} | R Documentation

## Use predict() on an lmRob Object

### Description

Extracts the fitted values from an `lmRob` object and returns a matrix of predictions.

### Usage

    ## S3 method for class 'lmRob'
    predict(object, newdata, type = "response", se.fit = FALSE, terms = labels(object), ...)

### Arguments

`object` | an lmRob object.
`newdata` | a data frame containing the values at which predictions are required. This argument can be missing, in which case predictions are made at the same values used to compute the object. Only those predictors referred to in the right side of the formula in object need be present by name in `newdata`.
`type` | a single character value specifying the type of prediction. The only choice is "response". If "response" is selected, the predictions are on the scale of the response.
`se.fit` | a logical value. If `TRUE`, pointwise standard errors are computed along with the predictions.
`terms` | this argument is presently unused.
`...` | additional arguments required by the generic `predict` function.

### Value

a vector of predictions, or a list consisting of the predictions and their standard errors if `se.fit = TRUE`.

### Warning

`predict` can produce incorrect predictions when the `newdata` argument is used if the formula in `object` involves data-dependent transformations, such as `poly(Age, 3)` or `sqrt(Age - min(Age))`.

### See Also

`lmRob`, `predict`.

### Examples

    data(stack.dat)
    stack.rob <- lmRob(Loss ~ ., data = stack.dat)
    predict(stack.rob)
    predict(stack.rob, newdata = stack.dat[c(1,2,4,21), ], se.fit = TRUE)

[Package robust version 0.5-0.0 Index]