Closed miguel-porto closed 7 years ago
I just made the correction ! Thanks
As for the tests, I am working on writing test scripts that I will upload hopefully in the near future
Sorry for posting here; I have a question/doubt about what seems to be an inconsistency when defining the models; what is the best place to post it / or who should I email?
If this is related to the package, post it here, otherwise, you can send me an e-mail. I prefer to keep GitHub for package related issues, comments and suggestions.
Well, I think it's related to the package, but maybe the problem is just me! Suppose I have a design like 100 plots dispersed in a region, each of which with 3 sampling units. The distance between sampling units of the same plot is negligible compared with the distance between plots, so we use the center coordinates of each plot for the spatial structure. In the manual it says:
(...) The number of units at each level is denoted by np(r). xy(r)-matrix: a np(r) x d matrix containing the spatial (or temporal) coordinates of the np(r) units at level r. This matrix is defined for those levels r for which the study design has an explicit spatial (or temporal) structure. (...)
What I read from here is that I can supply a list of Auto data frames, one for each random effect level, specifying the coordinates of the units at that level. In my case, I would supply a dataframe for the plot level with the coordinates for each plot (not for the sampling units within the plots). However, as.HMSCdata won't let me do it because it requires that the number of rows of all Auto dataframes be the same as the sampling units at the lowest level. If, otherwise, I use the same coordinates for all units in the same plot, it also stops because there are duplicated coordinates. In terms of code, what I was expecting to work is
md = as.HMSCdata(Y = as.matrix(species), X = climate
, Random = data.frame(plot = factor( <the plot code of each unit> ))
, Auto = list(plot = data.frame(plot = factor(rownames(coordinates.plot)), coordinates.plot))
)
that is, a Random data frame with the plot to which each sampling unit belongs, and an Auto dataframe for the plot level, with the coordinates of each plot. But it doesn't accept this. Does my question make sense or I'm just not getting the logic? Thanks.
Hi again, I think these lines here should be enclosed in
if(!is.null(Random)){ ... }
...otherwise we can't specify a model without Random (but with Auto). Or am I thinking wrong? In any case, an explicit test should be included, to avoid a cryptic error message. Best, Miguel