Help ensure the shape parameter is positive finite


I have the following pareto model. cmdstan_diagnose() says no problems detected. But there are a lot of warnings shown below.

Please, kindly help me ensure the shape parameter is positive finite. Plus, if possible, please help improve the overall model performance, etc. Thanks in advance for any input.

(similar warnings for chains 1:3)
Chain 4
Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
Chain 4 Exception: pareto_lpdf: Shape parameter[1] is inf, but must be positive finite! (in ‘C:/…/Temp/Rtmps3tany/model-210031a771bb.stan’, line 22, column 1 to column 38)
Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.


data {
	int<lower=0> N;      
    vector<lower=0>[N] y;      
	int<lower=0> K;     
	matrix[N, K] x;      
    real<lower=0> y_min; 
transformed data {
  matrix[N, K] x_c;
  for (k in 1:K){
  x_c[,k] = (x[,k] - mean(x[,k]));

parameters { 
  real a;        
  vector[K] beta; 

model {
	y ~ pareto(y_min, exp(a + x_c*beta));
	target += student_t_lpdf(a |3, 0, 1);
	target += student_t_lpdf(beta |3, 0, 1);

Do you see this warning exclusively during the early parts of warmup, or do you see it during sampling as well?

1 Like

Correction: I verified and found that it is during warmup actually; NOT during sampling. Sorry for the mistake. Any thoughts? Thanks.

1 Like

So what’s happening is that your exp is overflowing to infinity. This only happens early during warmup because the model quickly learns that the only values of a and beta that yield non-negligible posterior density are those that do not come close to overflowing. This warning should be safe to ignore, provided that it only happens early in warmup. However, it’s not immediately obvious why this thing would even wander into a region where it could overflow. One possibility would be if some values of x_c have very large magnitude, which might mean that both your prior and Stan’s default inits on beta are on an unrealistic scale.

1 Like

x values range between 0 and 100, so x_c should be around there or so, not very large magnitude. However, y has very high magnitude. Any thoughts how to solve this, if necessary/possible? Happy to know that these warnings should be safe to ignore.Thanks

An x_c*beta value of 100 is very, very large, especially because it’s getting exponentiated. I would suggest thinking carefully about how large the Pareto parameter could realistically be, and then formulating a prior that respects that. You can do this by modifying the prior, or by re-scaling x. The latter will carry the additional benefit of making the default inits more reasonable. But again, if this message about overflow occurs only early in warmup it can be safely ignored (except as a hint to re-examine your assumptions about what a reasonable model configuration should look like).

1 Like

I will try re-scaling x and share the outcome. Thanks for the input.