Skip to content

[RsR] Wanted: predict.lmrob

1 message · Locher René (lore)

#
Dear Matias

predict.lmrob() seems not to exist and predict.lm() gives an incorrect result. Is there another convenient trick to predict other data than the fitted? Below you 'll find a short example.


library(robustbase)
xy <- data.frame(x=1:10, y=(1:10)+rnorm(10))

res <- lmrob(y~x, xy)

fitted(res)
## correct

predict(res,newdata=data.frame(x=10:20))
## Error in predict(res, newdata = data.frame(x = 10:20)) : 
##	no applicable method for "predict"

predict.lm(res,newdata=data.frame(x=10:20))
## does not work properly!

sessionInfo()
## R version 2.5.1 (2007-06-27) 
## i386-pc-mingw32 
## 
## locale:
## LC_COLLATE=German_Switzerland.1252;LC_CTYPE=German_Switzerland.1252;LC_MONETARY=German_Switzerland.1252;LC_NUMERIC=C;LC_TIME=German_Switzerland.1252
## 
## attached base packages:
## [1] "stats"     "graphics"  "grDevices" "utils"     "datasets"  "methods"  
## [7] "base"     
## 
## other attached packages:
## robustbase 
##    "0.2-8" 


Kind regards and thanks in advance

Ren?

Ren? Locher                                       E-Mail: rene.locher at zhaw.ch
Institut f?r Datenanalyse und Prozessdesign       Tel:    +41 58 934 7810
Z?rcher Hochschule f?r angewandte Wissenschaften  Fax:    +41 58 935 7810
Rosenstrasse 3                   
Postfach
CH-8400 Winterthur                                http://www.idp.zhaw.ch