Hi all,

I am trying to solve this code. When I run it I get the error message written below. However, the only way to solve the function is by adding vector[] model3 and not vector model3 as the program is suggesting to do, also it says that I should add an int value where I did not define prior any int, and all my values are real type, any idea why this?

I have also tried to change my parameters of the function as reals and change the vector type equations to reals as well but I still get the same error message.

Semantic error in ‘string’, line 40, column 25 to column 72:

Ill-typed arguments supplied to function ‘ode_bdf_tol’. Expected arguments:

(real, vector) => vector, vector, real, real[], real, real, int

Instead supplied arguments of incompatible type:

(real, vector, vector, vector, vector) => vector[], vector, real, real[], real, real, real

```
functions {
vector[] model3(real t, vector y, vector pAB,
vector uAB, vector uASC) {
vector[rows(y)] dAB_dt = pAB*y[2]-uAB*y[1];
vector[rows(y)] dASC_dt = -uASC*y[2];
vector[rows(y)] out[2];
out = {dAB_dt, dASC_dt};
return (out);
}
}
data {
int <lower=1> nobs;
real t0;
vector[2] y0;
array[nobs] real ts;
int <lower=1> indivs;
array[nobs] real antib;
real <lower=1, upper=indivs> subj[nobs];
}
parameters {
//real <lower=0> AB0;
row_vector[1] pAB0;
row_vector[1] uAB0;
row_vector[1] uASC0;
//real <lower=0> sigmaAB0;
real <lower=0> sigma;
vector[indivs] rpAB;
vector[indivs] ruAB;
vector[indivs] ruASC;
}
transformed parameters {
real <lower=0> pAB;
pAB = pAB0*rpAB;
real <lower=0> uAB;
uAB = uAB0*ruAB;
real <lower=0> uASC;
uASC = uASC0*ruASC;
vector[nobs] yhat[2] = ode_bdf_tol(model3, y0, t0, ts, pAB, uAB, uASC);
}
model {
rpAB ~ lognormal(-2, sqrt(4));
ruAB ~ lognormal(-1, sqrt(2));
ruASC ~ lognormal(-0.1, 0.44);
//AB0 ~ lognormal(-2, 4);
//sigmaAB0 ~ gamma(0.001, 0.001);
sigma ~ normal(0, 1);
//for (i in 1:nobs) {
//antib[i] ~ lognormal(yhat[i,1], sigma);
//}
antib ~ lognormal(log(yhat[ : , 2]), sigma);
}
generated quantities {
array[nobs] real z_pred;
for (j in 1:nobs) {
z_pred[j] = lognormal_rng(log(yhat[j,2]), sigma);
}
}
```

.