One can't assume an arbitrary function necessarily works with zoo objects although many do; however, for functions that are sufficiently similar to lm, like lmrob, dyn in the dyn package can transform it to work with zoo (as well as with ts and a number of other time series classes). Just preface lmrob with dyn$ like this:
library(dyn) mod1<-dyn$lmrob(as.zooreg(dad)~seq(58)) summary(mod1) On Thu, Mar 12, 2009 at 6:13 AM, Víctor Homar <victor.ho...@uib.cat> wrote: > Hi all and thanks for your time in advance, > > I can't figure out why summary.lmrob complains when lmrob is used on a > zooreg object. If the zooreg object is converted to vector before > calling lmrob, no problems appear. > > Let me clarify this with an example: > >>library(robustbase) >>library(zoo) >>dad<-c(801.4625,527.2062,545.2250,608.2313,633.8875,575.9500,797.0500,706.4188, > 816.7000,619.1187,430.6188,852.1750,574.9937,528.1250,376.6187,507.7437, > 443.0813,463.6250,716.1063,529.1250,705.7437,959.2937,653.0187,717.4438, > 644.3125,718.1000,620.5187,759.3312,712.9750,606.6688,451.9250,560.2313, > 308.1875,551.7687,615.3312,673.1250,678.4562,485.5312,491.8875,568.5688, > 689.5750,507.0875,467.9125,539.4875,461.8625,827.3750,507.9250,526.5688, > 363.9625,355.8813,585.9750,792.8438,698.6250,625.1063,463.4875,619.4688, > 684.9438,815.3438) > >> mod1<-lmrob(dad~seq(58)) >> summary(mod1) > > Call: > lmrob(formula = dad ~ seq(58)) > > Weighted Residuals: > Min 1Q Median 3Q Max > -291.106 -98.083 0.912 102.219 349.697 > > Coefficients: > Estimate Std. Error t value Pr(>|t|) > (Intercept) 630.2021 38.5583 16.344 <2e-16 *** > seq(58) -0.9366 1.1639 -0.805 0.424 > --- > Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > > Robust residual standard error: 147.3 > Convergence in 8 IRWLS iterations > > Robustness weights: > 4 weights are ~= 1. The remaining 54 ones are summarized as > Min. 1st Qu. Median Mean 3rd Qu. Max. > 0.5522 0.8858 0.9537 0.9212 0.9831 0.9990 > Algorithmic parameters: > tuning.chi bb tuning.psi refine.tol rel.tol > 1.5476400 0.5000000 4.6850610 0.0000001 0.0000001 > nResample max.it groups n.group best.r.s k.fast.s > k.max > 500 50 5 400 2 1 > 200 > trace.lev compute.rd > 0 0 > seed : int(0) >> >> mod1<-lmrob(as.zooreg(dad)~seq(58)) >> summary(mod1) > > Call: > lmrob(formula = as.zooreg(dad) ~ seq(58)) > > Weighted Residuals: > Error in if (xi == xj) 0L else if (xi > xj) 1L else -1L : > argument is of length zero > > > > > My problem is I typically work with zooreg objects and summary.lmrob > complains unless I convert them to vector in the lmrob call. Any idea > what is going wrong? > > > Thanks a lot, > > Víctor. > > -- > -------------------------------------------------------------------- > Víctor Homar Santaner > Grup de Meteorologia > > Edif. Mateu Orfila Tel: +34 971 17 1376 > Universitat de les Illes Balears Fax: +34 971 17 3426 > 07122 Palma de Mallorca (SPAIN) Email: victor.ho...@uib.es > > Knowledge is contagious. Infect truth. > -------------------------------------------------------------------- > > > [[alternative HTML version deleted]] > > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.