Closed
Description
Hi,
The following Stan program declares mu
as a matrix with 1 column.
data {
int N;
vector[N] y;
}
parameters {
matrix[N, 1] mu;
real<lower=0> sigma;
}
model {
target += normal_lupdf(y | mu[:, 1] , sigma);
}
After running Pathfinder and using this object as initial values for HMC, the following error is reported:
mod <- cmdstan_model("test.stan")
data <- list(N = 100, y = rnorm(100))
pf <- mod$pathfinder(data = data)
fit <- mod$sample(data = data, init = pf)
Chain 1 Unrecoverable error evaluating the log probability at the initial value.
Chain 1 Exception: mismatch in number dimensions declared and found in context; processing stage=parameter initialization; variable name=mu; dims declared=(100,1); dims found=(100)
So it seems like Stan doesn't recognise that mu
should be a matrix.
Thanks,
Matt