我想根据图中的单元编号勾画出一个栅格单元。我制作了一个简化的示例,我可以在 power point 中制作该示例,但可能有一个更难以执行此操作的分辨率(720 x 360 与 3 x 5)。生成样本数据:
library(raster)
x = raster(matrix(seq(1,15), nrow = 3))
plot(x)
Run Code Online (Sandbox Code Playgroud)
我想修改绘图命令(最好),这样如果我选择第五个单元格,结果看起来像这样:

我正在尝试创建一个线性混合模型(lmm),它允许点之间的空间相关性(每个点都有纬度/经度)。我希望空间相关性基于点之间的大圆距离。
\n\n该包ramps包含一个相关结构,用于计算 \xe2\x80\x98havesine\xe2\x80\x99 距离 \xe2\x80\x93 尽管我在实现它时遇到了麻烦。我以前使用过其他相关结构(corGaus,corExp)并且没有遇到任何困难。我假设corRGaus“haversine”指标可以以相同的方式实现。
我能够使用该lme函数成功创建一个具有在平面距离上计算的空间相关性的 lmm。
我还能够创建一个线性模型(未混合),并使用大圆距离计算空间相关性,尽管使用该gls命令的相关结构存在错误。
当尝试使用gls具有大圆距离的线性模型的命令时,我遇到以下错误:
x = runif(20, 1,50)\ny = runif(20, 1,50)\ngls(x ~ y, cor = corRGaus(form = ~ x + y))\n\nGeneralized least squares fit by REML\n Model: x ~ y \n Data: NULL \nLog-restricted-likelihood: -78.44925\n\nCoefficients:\n (Intercept) y \n24.762656602 0.007822469 \n\nCorrelation Structure: corRGaus\n Formula: ~x + y \n Parameter estimate(s):\nError in attr(object, "fixed") && unconstrained : …Run Code Online (Sandbox Code Playgroud) r ×2
cell ×1
correlation ×1
distance ×1
mixed-models ×1
plot ×1
raster ×1
selection ×1
statistics ×1