Hi all,
I am having a strange issue all of a sudden. The code used to run fine, but I am in a R&R now and stan_model gives me a strange error. I did update R in the meantime (I did re-install all the packages and Rtools, ect.)
The error I get is the following;
Error in basename(fname) : path too long
I will give my fill code below. Does anyone know what is going on?
Many thanks!
Alex
model_string = "
data {
int<lower=0> N; // number of obs
int<lower=0> Nt; // number of time periods
int<lower=0> Nx;
int<lower=0,upper=Nt> sell[N]; // index sell
int<lower=0,upper=Nt> buy[N]; // index buy
vector[N] ror; // y variables (returns)
vector[N] xm; // change in NOI
matrix[Nt,Nx] xt; // state variable
}
parameters {
real pLambda;
real<lower=0> sigLambda;
vector[(Nx-1)] innovLambda;
real<lower=0> beta;
real<lower=0> sigEta; // sigma state
real<lower=0> sigEps; // sigma measurement
vector[Nt-1] innovMu; // index returns
}
transformed parameters {
vector[Nt] mu; // index levels
vector[N] yHat; // predicted returns (measurement)
vector[Nx] lambda;
lambda[1] = pLambda;
for(t in 2:Nx)
lambda[t] = lambda[t-1] +
innovLambda[t-1]*sigLambda;
mu[1] = 0;
for(t in 2:Nt)
mu[t] = mu[t-1] +
dot_product(lambda,xt[t]) +
innovMu[t-1]*sigEta;
for(i in 1:N)
yHat[i] = mu[sell[i]] - mu[buy[i]] + beta*xm[i];
}
model {
sigLambda ~ normal(0,1);
pLambda ~ normal(0,1);
innovLambda ~ normal(0,1);
innovMu ~ normal(0,1);
sigEta ~ normal(0,1);
sigEps ~ normal(0,1);
beta ~ normal(0,1);
ror ~ normal(yHat,sigEps);
}
generated quantities {
vector[N] log_lik;
for(i in 1:N)
log_lik[i] = normal_lpdf(ror[i]|yHat[i], sigEps );
}"
model_rw = stan_model(model_string)
EDIT:
I also try to run sampling() directly, instead of stan(). Now I get the following error;
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘sampling’ for signature ‘"character"’
What’s going on!?
EDIT 2:
My other stan programs on my laptop still work fine. So it only has to do with this project.