From ripley at stats.ox.ac.uk  Thu Jun 19 08:45:41 2003
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Thu Jun 19 08:45:51 2003
Subject: [Rd] acf   inherits problem
In-Reply-To: <029D5E4CC620344D9A54430DABC37F4307B6E3@BOC-EXMAIL1.bocad.bank-banque-canada.ca>
Message-ID: <Pine.LNX.4.44.0306190720430.2359-100000@gannet.stats>

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


[Rd] acf inherits problem
Prof Brian Ripley