Closed timcdlucas closed 2 weeks ago
@timcdlucas
I'm fairly sure this can't be done with {fmesher}
but I can get the first two matrices with this:
rspde <- rSPDE::matern.operators(mesh = data$mesh, alpha = 2)$fem_mesh_matrices
You might be able to look at the docs and make sense of how we get the third? https://cran.r-project.org/web/packages/rSPDE/rSPDE.pdf
Current usage is here: https://github.com/aknandi/disaggregation/blob/cd7e7ef9a9f1714bba199e55e604bbfb64080959/R/fit_model.R#L359
compute_higher_order = TRUE
is what we need
Full example. identical
doesn't give TRUE
for M1
and M2
but I'm not sure why as the values are identical.
spde <- (INLA::inla.spde2.matern(data$mesh, alpha = 2)$param.inla)[c("M0", "M1", "M2")]
rspde <- rSPDE::matern.operators(mesh = data$mesh, alpha = 2, compute_higher_order = TRUE)$fem_mesh_matrices
rspde[[4]] <- NULL
names(rspde) <- c("M0", "M1", "M2")
identical(spde[[1]], rspde[[1]])
identical(spde[[2]], rspde[[2]])
identical(spde[[3]], rspde[[3]])
sum(spde[[2]] - rspde[[2]])
sum(spde[[3]] - rspde[[3]])
@timcdlucas I think we can remove skip_on_cran()
once this is done, but thought best to check.
Yup we should be able to. There's CI routines (can't remember the word) that test as if it's on CRAN I think. So we should be able to check that everything works fine as well.
@timcdlucas Can you close this?
inla.spde2.matern()