Hi all,
I have N=45
measures of the air temperature made on fixed coordinates (x
,y
) and I would like to fit a 2D Gaussian Process.
The values are stored in a dataframe (named measured
) with three columns(x
, y
, VALUE
).
A snippet of my STAN code is :
data {
int<lower=1> N; //number of observation
vector[N] X[2]; //coordinates
vector[N] Y; //observation
...
}
parameters {
real<lower=0> rho;
real<lower=0> sigma;
real<lower=0> alpha;
...
}
model {
matrix[N, N] K = cov_exp_quad(X, alpha, rho);
....
The structure of the STAN model for the GP follows the manual.
But when I try to run the model:
fit = sampling(model1, data = list(N=nrow(measured), X= matrix(c(measured$xsc,measured$ysc), nrow= nrow(measured)), Y=measured$VALUE), iter=200)
I receive the error
trying deprecated constructor; please alert package maintainer
Error in new_CppObject_xp(fields$.module, fields$.pointer, …) :
no valid constructor available for the argument list
failed to create the sampler; sampling not done
I understood that the reason of the error is in the use of the matrix notation between R and STAN for the input argument of the cov_exp_quad_function(...)
What is the correct data structure?
Session info ------------------------------------------------------------------
setting value
version R version 3.4.2 (2017-09-28)
system x86_64, linux-gnu
ui X11
language
collate en_US.UTF-8
tz Europe/Rome
date 2018-01-09
Packages ----------------------------------------------------------------------
package * version date source
rstan * 2.17.2 2017-12-21 CRAN (R 3.4.2)
StanHeaders * 2.17.1 2017-12-20 CRAN (R 3.4.2)