Я хочу использовать пакет QRM в R, чтобы соответствовать самовозбуждающимся моделям с отмеченными точечными процессами, где отметка каждого прибытия в процесс влияет на самовозбуждение. Когда я запускаю пример кода из документации с помощью fit.seMPP () и mark.influence = TRUE, я получаю следующую ошибку:
require(QRM)
data(sp500)
l <- -returns(sp500)
lw <- window(l, start = "1995-12-31", end = end(l))
mod1 <- extremalPP(lw, ne = 100)
mod2b <- fit.seMPP(mod1, mark.influence = TRUE)
Error in SEprocExciteFunc(as.vector(anytimes), as.vector(times), as.vector(marks), :
Expecting a single value: [extent=2].
Github находится на https://github.com/cran/QRM, и я посмотрел документацию, но это не помогло. Не уверен, что это ошибка, связанная с интеграцией кода C ++ с Rcpp, использованием неправильной функции или чем-то еще. Ниже приведен код в пакете для SEprocExciteFunc:
// [[Rcpp::export]]
NumericVector SEprocExciteFunc(NumericVector anytimes, NumericVector times, NumericVector marks, double theta, int model)
{
int i = 0, j = 0, n = anytimes.size(), nmarks = times.size();
double thetime, delta = 0.0, rho = 0.0, tmp;
NumericVector ans(n);
if (model == 2L)
/* Hawkes with mark influence */
delta = theta + 1;
if (model == 3L)
/* ETAS without mark influence */
rho = theta + 1;
if (model == 4L){
/* ETAS with mark influence */
rho = theta + 1;
delta = theta + 2;
}
while (i < n){
tmp = 0.0;
thetime = times[i];
j = 0;
while ((times[j] < thetime) & (j < nmarks)){
if (model == 1L)
tmp += contribH((thetime - times[j]), 0.0, theta, delta);
if (model == 2L)
tmp += contribH((thetime - times[j]), marks[j], theta, delta);
if (model == 3L)
tmp += contribE((thetime - times[j]), 0.0, theta, rho, delta);
if (model == 4L)
tmp += contribE((thetime - times[j]), marks[j], theta, rho, delta);
j++;
}
ans[i] = tmp;
i++;
}
return ans;
}
Любая помощь будет оценена, спасибо.