inlabru-org / inlabru

inlabru
https://inlabru-org.github.io/inlabru/
78 stars 21 forks source link

Error when trying to fit a lgcp Model in inlabru #99

Closed ManuelSpinola closed 3 years ago

ManuelSpinola commented 3 years ago

I am trying to fitófaga a lgcp Model in inlabru but I gol the following error.

mesh_dr <- inla.mesh.2d(loc = dr_sp_crtm05, max.edge = c(5000, 50000), cutoff = 5000, boundary = bdry, crs = CRS("+proj=tmerc +lat_0=0 +lon_0=-84 +k=0.9999 +x_0=500000 +y_0=0 +ellps=WGS84 +units=m"))

matern_dr <- inla.spde2.pcmatern(mesh_dr, prior.sigma = c(0.1, 0.01), prior.range = c(5, 0.01))

mod_01 <- coordinates ~ mySmooth(map = coordinates, model = matern_dr) + Intercept(1)

dr_sp_crtm05 is a Spatial Point Datáfono Frame

cr_crtm05 is a Spatial Polygons Data Frame

fit_01 <- lgcp(mod_01, data = dr_sp_crtm05, samplers = cr_crtm05, domain = list(coordinates = mesh_dr))

Error in $<-.data.frame(*tmp*, "group", value = 1) : replacement has 1 row, data has 0

I can share the data if it neccesary.

best,

Manuel

finnlindgren commented 3 years ago

Please provide the sessionInfo() output.

finnlindgren commented 3 years ago

Since you have "map=coordinates", I think you're using an old version (likely 2.1.13 from CRAN?). Since the latest testing version on github is 2.2.5 and that will soon be submitted to CRAN, I would recommend you install the new version and update your code to try if that fixes the problem (I think your code should run with just a few warnings about changed syntax; map= should now be main= or an unnamed argument).

ManuelSpinola commented 3 years ago

Thank you very much Finn.

It solved the problem.

El mié, 3 feb 2021 a las 9:24, Finn Lindgren (notifications@github.com) escribió:

Since you have "map=coordinates", I think you're using an old version (likely 2.1.13 from CRAN?). Since the latest testing version on github is 2.2.5 and that will soon be submitted to CRAN, I would recommend you install the new version and update your code to try if that fixes the problem (I think your code should run with just a few warnings about changed syntax; map= should now be main= or an unnamed argument).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/inlabru-org/inlabru/issues/99#issuecomment-772591383, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFI3FB77US7QTC72LBAQPBLS5FTENANCNFSM4XA75IHA .

-- Manuel Spínola, Ph.D. Instituto Internacional en Conservación y Manejo de Vida Silvestre Universidad Nacional Apartado 1350-3000 Heredia COSTA RICA mspinola@una.cr mspinola@una.ac.cr mspinola10@gmail.com Teléfono: (506) 8706 - 4662 Personal website: Lobito de río https://sites.google.com/site/lobitoderio/ Institutional website: ICOMVIS http://www.icomvis.una.ac.cr/