From bolker at zoo.ufl.edu  Mon Sep  3 17:15:14 2007
From: bolker at zoo.ufl.edu (Ben Bolker)
Date: Mon, 03 Sep 2007 11:15:14 -0400
Subject: [Rd] buglet?? in nlme:::corRatio documentation
Message-ID: <46DC2502.9040302@zoo.ufl.edu>


  [hoping to redeem myself for my last spurious bug report]

 From ?corRatio:

   Letting d denote the range and n denote the nugget effect, the
     correlation between two observations a distance r apart is
     (r/d)^2/(1+(r/d)^2) when no nugget effect is present and
     (1-n)*(r/d)^2/(1+(r/d)^2) when a nugget effect is  assumed.

  This disagrees with the C code (corStruct.c)

/* Rational class */

static double
ratio_corr(double val)
{
    double val2 = val * val;
    return(1/(1+val2));
}

  and with common sense (correlation structures should start from
1 and reach zero for large distances; the structure listed in the
documentation starts at 0 and goes to 1 [or (1-n)] for large distances) --
if you don't want to think about it, use R instead:
 
curve(x^2/(1+x^2),from=0,to=5)
curve(1/(1+x^2),add=TRUE,col=2,from=0)

  What's odd, and makes me really nervous, is that the expression found
in the documentation is also that found in Pinheiro and Bates 2000
(Table 5.2, p. 232).  It's not listed in the errata for the first printing
http://cm.bell-labs.com/cm/ms/departments/sia/project/nlme/MEMSS/Errata ;
I have the second printing.

  (I haven't dug out my geostats books to check this, but found at least
one paper that cites the "correct" (1/(1+(d/r)^2) formula -- see below

 cheers
    Ben Bolker

@ARTICLE{Ekstrom+2005,
  author = {Ekstr{\o}m, Claus T. and Bak, S{\o}ren and Rudemo, Mats},
  title = {Pixel-level Signal Modelling with Spatial Correlation for 
Two-Colour
    Microarrays},
  journal = {Statistical Applications in Genetics and Molecular Biology},
  year = {2005},
  volume = {4},
  number = {1}
  timestamp = {2007.09.03},
  url = {http://www.bepress.com/sagmb/vol4/iss1/art6}
}



[Rd] buglet?? in nlme:::corRatio documentation
Ben Bolker