pomp中的骨架给出错误(未使用的参数)

时间:2017-09-10 12:50:41

标签: r

我使用pomp在R中编写了以下代码。除了骨架函数之外,一切正常。错误就在那里,skel.skel函数中未使用的参数返回void。我正在添加数据作为示例。请求帮助,并提前感谢。错误是这样的: C:/Users/admin/AppData/Local/Temp/RtmpmEz0jw/1892/pomp_dfb36bbab4b5ee3a8b4cbc45a0b63e0c.c:在功能' __ pomp_skelfn': C:/Users/admin/AppData/Local/Temp/RtmpmEz0jw/1892/pomp_dfb36bbab4b5ee3a8b4cbc45a0b63e0c.c:96:39:警告:'返回'带有值,函数返回void                                        返回(I);

t   y1  y2
1   -0.058886245    0.018451378
2   -0.045854389    -0.012812011
3   0   -0.025850852
4   -0.06009386 0.021278254
5   0.053712929 -0.008261274
6   0   0.025270473
7   0.047628037 -0.008357995
8   0.061425641 -0.0146046
9   0   -0.03778035
10  0   -0.004632415

library(magrittr)
library(pomp)
library(ggplot2)
data <- read.csv("C:/Users/admin/Documents/phd/book2.csv", stringsAsFactors = FALSE)
data <- as.data.frame(data)

pomp(
  data,times="t", t0=0,
  rmeasure=Csnippet("
                    y1 = rnorm(x1+x2,sigma1);
                    y2 = rnorm(x2-x1,sigma2);
                    "),
  dmeasure=Csnippet("
                    lik = dnorm(y1,x1+x2,sigma1,1)+dnorm(y2,x2-x1,sigma2,1);
                    lik = (give_log) ? lik : exp(lik);
                    "),
  rprocess=discrete.time.sim(
    step.fun=Csnippet("
                      double tx1, tx2;
                      tx1 = rnorm(a11*x1 + a12*x2,nu1);
                      tx2 = rnorm(a21*x1 + a22*x2,nu2);
                      x1 = tx1; x2 = tx2;
                      "),
    delta.t=1),
  initializer=Csnippet("
                       x1 = 0;
                       x2 = 0;
                       "),
  skeleton = vectorfield(
                    skel = Csnippet("double I;
                                     I = a11 + a12*x1 + a22 + a21*x2;
                                      return(I);                    
                                         ")
                    ),
  toEstimationScale = logtrans <- Csnippet("
                                              Tr1 = log(a11);
                                                TK1 = log(a21);
                                                 Tsigma1 = log(sigma1);

                                          "),

  fromEstimationScale=exptransexptrans <- Csnippet("
                                                   Tr1 = exp(a11);
                                                      TK1 = exp(21);
                                                     Tsigma1 = exp(sigma1);

                                                   "),
  statenames=c("x1","x2"),
  paramnames=c("a11","a12","a21","a22","sigma1","sigma2","nu1","nu2"),
  params=c(a11=0.5,a12=-0.1,a21=0.2,a22=-1,nu1=0.3,nu2=0.1,sigma1=0.1,sigma2=0.3)
  ) -> parus

0 个答案:

没有答案