From agalecki at umich.edu  Wed Dec 24 19:30:14 2008
From: agalecki at umich.edu (agalecki at umich.edu)
Date: Wed, 24 Dec 2008 19:30:14 +0100 (CET)
Subject: [Rd] Variogram.gls (PR#13418)
Message-ID: <20081224183014.B98AC282EFF6@mail.pubhealth.ku.dk>

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



[Rd] Variogram.gls (PR#13418)
agalecki at umich.edu