JenniNiku/gllvm

Number of provided distance matrices should equal the number of spatially structured row effects.

AlainZuur opened this issue · 2 comments

Bert..you must have changed something here between the CRAN version (which works fine with the code below) and the development version which throws this error:
Number of provided distance matrices should equal the number of spatially structured row effects.

Any suggestions? It is the last question of the day!

Alain

#' Grab the spatial coordinates. These are in km?
CoordData <- data.frame(Xkm = Fish3$X,
Ykm = Fish3$Y)
CoordData <- as.matrix(CoordData)
CoordData

#' Define a group structure
GroupStruc <- data.frame(Group = 1:nrow(Fish3))

#' Then this should do the job.
M10 <- gllvm(y = SpecData,
X = CovX.s,
num.lv = 0,
num.RR = 2,
lv.formula = ~ Altitude + LogSlope + MMDischarge +
pH + Calcium + Nitrate + Ammonium +
DisOxygen + OxygenDemand,
family = "poisson",
studyDesign = GroupStruc,
row.eff = ~corExp(1 | Group),
dist = CoordData,
#corWithin = FALSE,
control = list(optimizer = "alabama"), #alabama
control.start = list(n.init = 5, jitter.var = 0.1))

See ?gllvm documentation, and "news" for what's changed. "dist" should be a list. Try that, see if it solves your issue. This is because -technically- you can now include multiple row effects, so you could provide multiple matrices of coordinates.

I'll see later if i can do something about backwards compatibility, i.e., if you pass a single matrix to "dist" it should probably accept that too.

dist = list(CoordData),

solves it.
Thanks.
That's it for today!