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

From: Dan Bebber <danbebber_at_forestecology.co.uk>
Date: Thu, 17 Jan 2008 21:12:37 -0000


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



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 17 Jan 2008 - 21:21:12 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 17 Jan 2008 - 21:30:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive