From ripley at stats.ox.ac.uk  Sat Dec 27 07:11:56 2008
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Sat, 27 Dec 2008 06:11:56 +0000 (GMT)
Subject: [Rd] Variogram.gls (PR#13418)
In-Reply-To: <20081224183014.B98AC282EFF6@mail.pubhealth.ku.dk>
References: <20081224183014.B98AC282EFF6@mail.pubhealth.ku.dk>
Message-ID: <alpine.LFD.2.00.0812270559310.20482@gannet.stats.ox.ac.uk>

It seems this was intended to be

                 distance <- lapply(covar,
                                    function(el, metric) dist(as.matrix(el), method=metric),
                                    metric = metric)

similarly to Variogram.lme.

Thank you for the report: it will be fixed in the next release of nlme.


On Wed, 24 Dec 2008, agalecki at umich.edu wrote:

> Hello,
>
> 1. Illustrating example:
>    sessionInfo at the end of this email
>
> library(nlme)
> fm1 <- gls(weight ~ Time * Diet, BodyWeight)
> Variogram(fm1, form = ~ Time | Rat)[1:10,]
>
> Error in FUN(X[[1L]], ...) : unused argument(s) (method = "euclidean")
>
> 2. It appears that the error is caused by the statement:
>
> distance <- lapply(covar, function(el, metric) dist(as.matrix(el),
>                  metric), method = metric)
>
> in Variogram.gls() method
>
> 3. After replacing the statement in question with:
>
> distance <- lapply(covar, function(el) dist(as.matrix(el), metric))
>
> Variogram.gls  appears to work properly as shown below.
>
> library(nlme)
> fm1 <- gls(weight ~ Time * Diet, BodyWeight)
> Variogram(fm1, form = ~ Time | Rat)[1:10,]
>
>        variog dist n.pairs
> 1  0.007239522    1      16
> 2  0.014584634    6      16
> 3  0.014207936    7     144
> 4  0.018442267    8      16
> 5  0.011128505   13      16
> 6  0.019910082   14     128
> 7  0.027072311   15      16
> 8  0.034140379   20      16
> 9  0.028320657   21     112
> 10 0.037525507   22      16
>
> Happy Holiday Season and Happy New Year
>
> Andrzej Galecki
> University of Michigan
>
>
>
> > sessionInfo()
> R version 2.7.2 (2008-08-25)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
> States.1252;LC_MONETARY=English_United
> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] nlme_3.1-89
>
> loaded via a namespace (and not attached):
> [1] grid_2.7.2      lattice_0.17-13 tools_2.7.2
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at 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] Variogram.gls (PR#13418)
Prof Brian Ripley