I think this is a bug, but perhap someone could confirm that it is not just me doing something stupid. (I vaguely recall something like this previously getting fixed in 1.7.0.) R : Copyright 2003, The R Development Core Team Version 1.7.1 (2003-06-16)> z <-matrix(rnorm(100), 100,1) > acf(as.ts(z), type="partial")Error in inherits(x, "ts") : evaluation is nested too deeply: infinite recursion?> version_ platform sparc-sun-solaris2.8 arch sparc os solaris2.8 system sparc, solaris2.8 status major 1 minor 7.1 year 2003 month 06 day 16 language R I also get the same problem in Linux. Paul Gilbert>[[alternative HTML version deleted]]
Paul Gilbert wrote:> I think this is a bug, but perhap someone could confirm that it is not just me doing something stupid. (I vaguely recall something like this previously getting fixed in 1.7.0.) > > R : Copyright 2003, The R Development Core Team > Version 1.7.1 (2003-06-16) > > >>z <-matrix(rnorm(100), 100,1) >>acf(as.ts(z), type="partial") > > Error in inherits(x, "ts") : evaluation is nested too deeply: infinite recursion?I can can confirm that it's a bug the 1.8 development branch, but not in 1.7.0. (I don't have a 1.7.1 on this machine at present.) The problem seems to be in the acf.R in the ts library. 1.7.1, 1.8.0 etc. have < if(is.matrix(x)) < return(pacf(as.ts(x), lag.max=lag.max, plot=plot, < na.action=na.action, ...)) while 1.7.0 has. > if(is.matrix(x)) { > m <- match.call() > m[[1]] <- as.name("pacf.mts") > return(eval(m, parent.frame())) > } If I had to guess, I'd say that the call to the generic from a method is producing a loop. -- Ross Ihaka Email: ihaka@stat.auckland.ac.nz Department of Statistics Phone: (64-9) 373-7599 x 85054 University of Auckland Fax: (64-9) 373-7018 Private Bag 92019, Auckland New Zealand
It's not the same problem as was fixed for 1.7.0, which was namespace-related. It's clearer if you do z <- as.ts(matrix(rnorm(100), , 1)) class(z) pacf(z) The problem is that you have an n x 1 matrix as a time series. That _is_ somewhat silly, and avoiding that avoids the problem (and it does not occur in any of our test suites, unsurprisingly). I think as.ts/ts ought to drop() such matrices. The test if (is.matrix(x)) has always been wrong in that case: it should be if (is.matrix(x) && ncol(x) > 1) The problem has long been there, just the wrong method was called and coped in the past. I've put a fix in R-patched. On Wed, 18 Jun 2003, Paul Gilbert wrote:> I think this is a bug, but perhap someone could confirm that it is not > just me doing something stupid. (I vaguely recall something like this > previously getting fixed in 1.7.0.) > > R : Copyright 2003, The R Development Core Team > Version 1.7.1 (2003-06-16) > > > z <-matrix(rnorm(100), 100,1) > > acf(as.ts(z), type="partial") > Error in inherits(x, "ts") : evaluation is nested too deeply: infinite recursion? > > version-- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
At Thursday 07:45 AM 6/19/2003 +0100, Prof Brian Ripley wrote:>[...] > >The problem is that you have an n x 1 matrix as a time series. That _is_ >somewhat silly, and avoiding that avoids the problem (and it does not >occur in any of our test suites, unsurprisingly). > >I think as.ts/ts ought to drop() such matrices.Please don't! Functions that return qualitatively different values (e.g., different classes or number of dimensions) depending on input data values or lengths of dimensions lead to nasty surprises in automated analyses and simulations. This sort of thing might be nice for interactive use, but it makes robust programming difficult.>[...] >-- >Brian D. Ripley, ripley@stats.ox.ac.uk >Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ >University of Oxford, Tel: +44 1865 272861 (self) >1 South Parks Road, +44 1865 272866 (PA) >Oxford OX1 3TG, UK Fax: +44 1865 272595-- Tony Plate