Scale parameter (\sigma in stan manual) seems to impose strong bound on the Weibull distribution random variable; which led to the following parisplot of length_GP_engine
and length_engine_scale
. (green dot: divergence)
- Does this pairsplot indicate the need for reparameterization? If so, what could be the reason? (e.g. does uneven density causes pathology in sampling geometry?)
- Apart from its need, is the following the right parameterization? Unlike the reparameterization example of normal distribution in stan manual, I am not sure scale parameter could be linearly multiplied for Weibull distribution.
original code
parameters{
...
real<lower=0> length_GP_engine;
real <lower = 0> length_engine_scale;
}
transformed parameters{
...
cov_engine = cov_exp_quad(ages, sigma_GP_engine, length_GP_engine);
cov_ship = cov_exp_quad(ages, sigma_GP_ship, length_GP_ship);
}
model {
vector[N] obs_mu;
for (n in 1:N) {
obs_mu[n] = mu
+ age_re[age_ind[n]] //fixed effects
+ engine_re[ship_engine_ind[ship_ind[n]]]
+ ship_re[ship_ind[n]]
+ GP_engine[age_ind[n],ship_engine_ind[ship_ind[n]]] //f_engine
+ GP_ship[age_ind[n],ship_ind[n]]; //f_ship
}
y ~ normal(obs_mu, sigma_error_ship);
to_vector(GP_engine_std) ~ normal(0, 1);
to_vector(GP_ship_std) ~ normal(0, 1);
age_std ~ normal(0, 1);
ship_std ~ normal(0, 1);
engine_std ~ normal(0, 1);
mu ~ normal(.5, .5);
tot_var ~ gamma(3, 3);
length_engine_scale ~ normal(3, 1);
length_ship_scale ~ normal(3, 1);
length_engine_shape ~ normal(20, 10);
length_ship_shape ~ normal(20, 10);
length_GP_engine ~ weibull(length_engine_shape, length_engine_scale);
length_GP_ship~ weibull(length_ship_shape, length_ship_scale);
}
reparameterized
parameters{
real <lower = 0> eta;
real <lower = 0> length_engine_scale_s;
real <lower = 0> length_GP_engine_s;
}
transformed parameters{
real length_engine_scale = length_engine_scale_s * eta;
real length_GP_engine = length_engine_scale * length_GP_engine_s;
}
model{
length_engine_scale_s ~ std_normal();
length_GP_engine_s ~ weibull(length_engine_shape,1);
}