[R] nlme: Variogram.gls error with grouping factor

Dan Bebber danbebber at forestecology.co.uk
Thu Jan 17 22:12:37 CET 2008


I am using gls to fit a linear model with spatially-autocorrelated errors.
My first step is to fit a simple model, and inspect a semivariogram of
residuals.

The following example gives this error:
Error in FUN(X[[1L]], ...) : unused argument(s) (method = "euclidean")

#Example
library(nlme)
x <- runif(60, 0, 1) # location in x
y <- runif(60, 0, 1) # location in y
f <- factor(rep(c("A", "B", "C"), each = 20)) # grouping factor
pred <- runif(60, 0 , 1) # predictor variable
resp <- pred + rnorm(60, 0, 0.5) #response variable
dat <- data.frame(x, y, f, pred, resp) #make data frame
rm(x,y,f,pred,resp) #remove variables
m1 <- gls(resp ~ pred*f, dat) # simple model assuming independent errors
Vm1 <- Variogram(m1, form = ~ x + y, metric = "euclidean") # works fine
Vgm1 <- Variogram(m1, form = ~ x + y | f, metric = "euclidean") # gives
error
#End

Running the example in ?Variogram.gls gives the same error
fm1 <- gls(weight ~ Time * Diet, BodyWeight)
Variogram(fm1, form = ~ Time | Rat)[1:10,]

Any ideas most appreciated.

Dan Bebber


Checked by AVG Free Edition. 

09:01




More information about the R-help mailing list