Greetings, I am trying to fit an errors-in-variables linear regression model in stan. I got warnings
Warning messages:
1: There were 3 chains where the estimated Bayesian Fraction of Missing Information was low. See
https://mc-stan.org/misc/warnings.html#bfmi-low
2: Examine the pairs() plot to diagnose sampling problems
3: Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
Running the chains for more iterations may help. See
https://mc-stan.org/misc/warnings.html#bulk-ess
4: Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable.
Running the chains for more iterations may help. See
https://mc-stan.org/misc/warnings.html#tail-ess
The model is below:
data{
int nobs;
real xobs[nobs];
real y[nobs];
}
parameters {
real<upper=0> alpha;
real<lower=0> beta;
real<lower=0> sigmay;
real<lower=0> sigmax;
real x[nobs];
}
model {
// priors
alpha ~ normal(0, 10);
beta ~ normal(0, 10);
sigmax ~ cauchy(0, 1);
sigmay ~ cauchy(0, 1);
// model structure
for (i in 1:nobs){
xobs[i] ~ normal(x[i], sigmax);
y[i] ~ normal(alpha + beta*x[i], sigmay);
}
}
I have run this in R and there I generate the data via
# Simulated true data
alpha = -10
beta = 2
nobs = 40
x <- runif(nobs, -3, 3)
# observed data with measurement errors
xsd <- .5 # measurement error
xerr <- rnorm(nobs, 0, xsd)
xobs <- x + xerr
ysd <- .5 # observation error on y
y <- alpha + beta*x + rnorm(nobs, 0, ysd)
I set chain=3, iter=8000, warmup=4000, thin=1. And here is the pairs plot:
I’m quite new to RStan, and I’m grateful for your assistance.