Closed
Description
This has lead to stan-dev/stanc3#1446 and the seven duplicates therein.
I think the issue is the code that reads from a file is returning a vector of strings, rather than just one string. No idea why this is OS-specific.
This might be related to my pr #1124 which touches some of the same code
Description:
This model consistently raises an error on Windows, but not on other platforms:
data {
int<lower=0> T; # rows
int<lower=0> N; # cols
matrix[T, N] x;
matrix[T, N] y;
}
parameters {
real alpha;
real beta;
real mu_alpha;
real<lower=0> sigma_alpha;
real mu_beta;
real<lower=0> sigma_beta;
}
model {
for(i in 1:T){
for(j in 1:N){
y[i, j] ~ poisson(exp(alpha + beta*x[i, j]))
}
}
alpha ~ normal(mu_alpha, sigma_alpha);
beta ~ normal(mu_beta, sigma_beta);
mu_alpha ~ normal(0, 1)
sigma_alpha ~ gamma(2, 2)
mu_beta ~ normal(0, 1)
sigma_beta ~ gamma(2, 2)
}
> rstan::stanc("./m2.stan")
yields
Error in rstan::stanc("./m2.stan") : 0
Internal compiler error:
TypeError: b.charCodeAt is not a function
By replacing the stanc.js
with the non-minified version, and adding some extra printing code to it, this became clear:
b
above is the code string- In this case, the code is not actually a string, but an array of strings.
That is why this code does not lead to a crash:
code <- paste(readLines('./m2.stan'), collapse="")
rstan::stanc(model_code=code)
(though, it does raise a genuine syntax error, which is good!)
RStan Version:
‘2.36.0.9000’
R Version:
"R version 4.4.2 (2024-10-31 ucrt)"
Operating System:
Windows 11
Metadata
Metadata
Assignees
Labels
No labels