Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
r中的NPPEN模型_R - Fatal编程技术网

r中的NPPEN模型

r中的NPPEN模型,r,R,我想运行一个NPPEN模型,但是我发现这些代码需要学习,但我对光栅化上瘾了。有人能告诉我哪里出了问题吗?或者有没有其他方法可以运行NPPEN模型 # # # Test the NPPEN method from Beaugrand et al 2011 # # (c) Copyright 2011 Jean-Olivier Irisson # GNU General Public License v3 # #------------------------------------

我想运行一个NPPEN模型,但是我发现这些代码需要学习,但我对光栅化上瘾了。有人能告诉我哪里出了问题吗?或者有没有其他方法可以运行NPPEN模型

#
#
#     Test the NPPEN method from Beaugrand et al 2011
#
# (c) Copyright 2011 Jean-Olivier Irisson
#     GNU General Public License v3
#
#------------------------------------------------------------
pdf("nppen_plots.pdf")
set.seed(1234)
## Simulate data                                            {
# reference matrix
n = 1000
X = data.frame(T = rnorm(n, mean=5),S = 36+rnorm(n)#,
+ # bathy = rnorm(n, mean=300, sd=30)
+ )
# add some data in a given location of the state space
X2 = data.frame(
+ T = rnorm(n*3, mean=5),
+ S = 36+rnorm(n)#,
+ # bathy = rnorm(n, mean=300, sd=30)
+ )
X2 <- X2[X2$T>5.5 & X2$T<6.5 & X2$S<37 & X2$S>34.5,]
X <- rbind(X, X2)
# prediction matrix
m = 200
Y = data.frame(
+ T = rnorm(m, mean=5, sd=0.4),
+ S = 36+rnorm(m, sd=0.5)#,
+ # bathy = rnorm(m, mean=280, sd=10)
+ )
# Visualize the relative range of X and Y
library("ggplot2")
library("reshape")
# put all data in the same data.frame
Z <- rbind(data.frame(X, source="X"), data.frame(Y, source="Y"))
ggplot(Z) + geom_point(aes(x=T, y=S, colour=source), alpha=0.5)
# -> OK, Y is distributed within the distribution of X
# }
#source("nppen.R")
## Test rasterization                                       {
Xr <- rasterize(X, precision=c(0.2, 0.3))
Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘rasterize’ for signature ‘"data.frame",
#
#
#测试Beaugrand等人2011年的NPPEN方法
#
#(c)2011年Jean-Olivier Irisson版权所有
#GNU通用公共许可证v3
#
#------------------------------------------------------------
pdf(“nppen_plots.pdf”)
种子集(1234)
##模拟数据{
#参考矩阵
n=1000
X=数据帧(T=rnorm(n,平均值=5),S=36+rnorm(n)#,
+#bathy=rnorm(n,平均值=300,标准差=30)
+ )
#在状态空间的给定位置添加一些数据
X2=数据帧(
+T=rnorm(n*3,平均值=5),
+S=36+r形式(n)#,
+#bathy=rnorm(n,平均值=300,标准差=30)
+ )

X2 5.5和X2$t可能是的副本,但问题尚未得到回答,希望有人能提供帮助。感谢您安装光栅包。库(“光栅”)我安装了instal raster,但仍然收到错误消息:您不是在寻找此
光栅化
函数吗:它来自托管您在问题中显示的函数的同一个GitHub。可能是的副本,但问题尚未回答,希望有人能帮上忙。感谢您安装光栅包。库(“光栅”)我安装了光栅,但仍然收到错误消息:您不是在寻找此
光栅化
功能吗:它来自托管您在问题中显示的功能的同一GitHub。