Predict from an resistant regression fitted by lqs.

# S3 method for class 'lqs'
predict(object, newdata, na.action = na.pass, ...)

Arguments

object

object inheriting from class "lqs"

newdata

matrix or data frame of cases to be predicted or, if object has a formula, a data frame with columns of the same names as the variables used. A vector will be interpreted as a row vector. If newdata is missing, an attempt will be made to retrieve the data used to fit the lqs object.

na.action

function determining what should be done with missing values in newdata. The default is to predict NA.

...

arguments to be passed from or to other methods.

Value

A vector of predictions.

Details

This function is a method for the generic function predict() for class lqs. It can be invoked by calling predict(x) for an object x of the appropriate class, or directly by calling predict.lqs(x) regardless of the class of the object.

Missing values in newdata are handled by returning NA if the linear fit cannot be evaluated. If newdata is omitted and the na.action of the fit omitted cases, these will be omitted on the prediction.

Author

B.D. Ripley

See also

Examples

set.seed(123)
fm <- lqs(stack.loss ~ ., data = stackloss, method = "S", nsamp = "exact")
predict(fm, stackloss)
#>       1       2       3       4       5       6       7       8       9      10 
#> 35.5000 35.5796 30.4093 19.4779 18.5929 19.0354 19.0000 19.0000 15.7345 14.0796 
#>      11      12      13      14      15      16      17      18      19      20 
#> 13.3628 13.0000 13.9204 13.4867  6.7611  7.0000  8.5575  8.0000  8.3628 13.1549 
#>      21 
#> 23.9912