In the R spatstat package (I am using the current version 1.31-0 ), there is the use.gam option. When you set it to true, you can include smooth terms in a linear predictor, just like with the mgcv R package. For instance,
g <- ppm(nztrees, ~1+s(x,y), use.gam=TRUE)
Now, if I need a confidence interval for interception, you can usually use summary or vcov , which works when you don't use gam , but fails when you use gam
vcov(g)
which gives an error message
Error in model.frame.default(formula = fmla, data = list(.mpl.W = c(7.09716796875, :invalid type (list) for variable 's(x, y)'
I know that this standard error approximation is not justified here when using gam , but it displays a warning message:
In addition: Warning message: model was fitted by gam(); asymptotic variance calculation ignores this
I am not worried about this - I am ready to justify using these standard errors for the purpose that I use them - I just want numbers and would like to avoid "write by myself" like that.
The error message I received above does not seem to depend on the dataset I use. I used the nztrees example here because I know that it is loaded using spatstat . He seems to be complaining about this variable, but the model clearly understands the syntax because it matches the model (and the predicted values โโfor my own dataset look pretty good, so I know it's not just dumping garbage).
Does anyone have any tips or ideas? This is mistake? To my surprise, I could not find a discussion of this online. Any help or hints are welcome.
Edit: Although I finally answered my own question here, I will not accept my answer yet. Thus, if someone is interested and wants to make an effort to find a โworkaroundโ for this, without waiting for the next spatstat release, I can award him a reward. Otherwise, I will simply accept my answer at the end of the period of generosity.