Error in sampler$call_sampler(args_list[[i]]) :
Error in function stan::prob::multi_normal_cholesky_log(l): i and j must be same. Found i=235, j=3
error occurred during calling the sampler; sampling not done
MRegMod = '
data {
int<lower=1> nData;
int<lower=1> nVars;
real x3[nData];
matrix[nData, nVars] y;
matrix[nVars, nVars] Imat;
vector[nVars] b0p;
vector[nVars] b3p;
}
parameters {
vector[nVars] b0;
vector[nVars] b3;
cov_matrix[nVars] Omega;
cov_matrix[nVars] Omega0;
cov_matrix[nVars] Omega3;
real<lower=0,upper=100> sd[nVars];
}
transformed parameters {
matrix[nData, nVars] mu;
for ( np in 1:nVars){
for ( i in 1:nData){
mu[i, np] <- b0[np] + b3[np] * x3[i];
}
}
}
model {
//Priors
b0 ~ multi_normal(b0p , Omega0);
b3 ~ multi_normal(b3p , Omega3);
Omega0 ~ inv_wishart(nVars+1, Imat);
Omega3 ~ inv_wishart(nVars+1, Imat);
//Likelihood
for(i in 1:nData){
col(y, i) ~ multi_normal(col(mu,i), Omega);
}
Omega ~ inv_wishart(nVars+1, Imat);
}
'
I'm combining a users list and dev list post here (see
below).
Matt (user):
Thanks for the careful error report -- it helps us
immensely.
I believe that one of the size tests is failing
(mu must be same size as y, and the rows and columns
of Omega must be the same).
This is puzzling given your model, the declarations
for which are
> matrix[nData, nVars] y;
> matrix[nData, nVars] mu;
> cov_matrix[nVars] Omega;
seem to me to be compatible with the usage:
> col(y, i) ~ multi_normal(col(mu,i), Omega);
--
You received this message because you are subscribed to the Google Groups "stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
I'm not sure what to try next. Any help to get this going would be much appreciated. I've attached a small chunk of the data if it helps.
for(i in 1:nData){
row(y, i) ~ multi_normal(row(mu,i), Omega);
}TRANSLATING MODEL 'albMRegMod' FROM Stan CODE TO C++ CODE NOW.
Error in stanc(file = file, model_code = model_code, model_name = model_name, :
failed to parse Stan model 'albMRegMod' with error message:
EXPECTATION FAILURE LOCATION: file=input; line=37, column=7
row(y, i) ~ multi_normal(row(mu,i), Omega);
^-- here
DIAGNOSTIC(S) FROM PARSER:
no matches for function name="multi_normal_log"
arg 0 type=row vector
arg 1 type=row vector
arg 2 type=matrix
unknown distribution=multi_normal
Parser expecting: "}"
--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.