Reputation: 17
I am trying to simulate a point pattern based on a model fit to a dataset of several multitype point patterns. However, I can't run simulate.mppm without raising an error. I attached the code below (using optimbase_1.0-9
and spatstat_1.62-2
):
library(spatstat)
library(optimbase)
flusubset <- flu[1:4]
typelist <- lapply(lapply(flusubset$pattern, marks), levels)
num_marks <- length(typelist[[1]])
iradii <- 50*ones(num_marks,num_marks)
hradii <- 3*ones(num_marks,num_marks)
Int <- anylist()
for (i in 1:dim(flusubset)[1]) {
Int[[i]] <- MultiStraussHard(iradii=iradii, hradii=hradii)
}
Int <- as.hyperframe(Int)
multmodel <- mppm(pattern ~ 1, data=flusubset, interaction=Int)
simulate(multmodel)
Whenever I run this code, I encounter the error:
Error in check.nvector(w, nrow(x), things = "rows of x") : The length of ‘w’ (=16744) should equal the number of rows of x (=15424)
9. stop(whinge)
8. check.nvector(w, nrow(x), things = "rows of x")
7. sumouter(mom, lam * wt * glmsub)
6. vcmGibbs(object, ..., what = what, err = err)
5. vcov.mppm(object, what = "fisher", err = "null")
4. vcov(object, what = "fisher", err = "null")
3. subfits(object)
2. simulate.mppm(multmodel)
1. simulate(multmodel)
Thank you for the help!
Upvotes: 0
Views: 42
Reputation: 2973
This is a bug in current versions of spatstat
.
I have fixed it in the development version spatstat 1.62-2.011
available from the GitHub repository. The next public release of spatstat
containing the bug fix will be in February 2020.
For bugs in spatstat
, please post an Issue on the issues page at the GitHub repository.
Upvotes: 1