1

我之前曾将 INLA 与 SpatialPolygonsDataFrame 一起使用过,但我从未将它与光栅一起使用过。我已经在互联网上搜索了好几个小时,阅读了小插图和我能找到的所有内容,但仍然无法弄清楚如何将 INLA 与光栅一起使用。下面只是我的数据的一个简单示例:

library("raster")
library("INLA")

lat = c(10, 10, 10, 10, 14, 14, 14, 14, 10, 10, 10, 10, 14, 14, 14, 14)
lon = c(20 ,24, 28, 32, 20, 24, 28, 32, 20, 24, 28, 32, 20, 24, 28, 32)
response = c(17.3, 17.4, 17.6, 17.9, 17.1, 17.0, 17.4, 17.5, 17.4, 17.4,
17.7, 17.8, 17.2, 17.1, 17.7, 17.9)
explan1 = c(31, 35, 33, 36, 32, 37, 36, 40, 32, 34, 33, 37, 35, 35, 39, 38)
explan2 = c(112, 116, 111, 114, 115, 117, 117, 112, 110, 114, 113, 117, 112,
113, 115, 116) 

data.df = data.frame(lat = lat, lon = lon, response = response, explan1 = 
explan1, explan2 = explan2)

myGrid = raster(ncol = 5, nrow = 5)

于是,我就站在你们面前,以这种方式乞求怜悯和帮助。

4

1 回答 1

2

为了拟合数据,请使用您的 data.df (和您的时空模型)。

要在栅格上进行预测/投影,请使用 inla.mesh.project。您可以投影 result$summary.linear.predictor、result$summary.fitted.values 或 result$summary.random,具体取决于您的代码和您想要获得的内容。

如果您想要样本而不是摘要,请使用 inla.posterior.sample,并投影正确的部分(取决于您的模型)。

时空模型很复杂,工作示例很长。请参阅 spde 教程 http://www.r-inla.org/examples/tutorials/spde-tutorial

于 2016-12-10T18:18:47.003 回答