I am trying to fit a mixed model as below. In this model, I want to constraint my parameters such that their values are less than Intercept. However, I am unable to do this as a sampling error is occurring with the error message “Error transforming variable beta_EquBasePrice: ub_free: Upper bounded variable is 0, but must be less than or equal to -1.40317e-016”. Kindly let me know where I am doing it wrong.

data{

int N;

real VolumeVelocity[N];

real EquBasePrice[N];

real DISP[N];

real FEAT[N];

real MobileCoupon[N];

int Retailer[N];

int N_Retailer;

}

parameters{

real Intercept;

real<upper = Intercept> beta_EquBasePrice;

real<upper = Intercept> beta_DISP;

real<upper = Intercept> beta_FEAT;

real<upper = Intercept> beta_MobileCoupon;

real<lower=0> sigma;

real vary_Retailer[N_Retailer];

real<lower=0> sigma_Retailer;

}

model{

real vary[N];

real glm[N];

// Priors

Intercept ~ normal( 0 , 100 );

beta_EquBasePrice ~ normal( 0 , 100 );

beta_DISP ~ normal( 0 , 100 );

beta_FEAT ~ normal( 0 , 100 );

beta_MobileCoupon ~ normal( 0 , 100 );

sigma_Retailer ~ uniform( 0 , 100 );

sigma ~ uniform( 0 , 100 );

// Varying effects

for ( j in 1:N_Retailer ) vary_Retailer[j] ~ normal( 0 , sigma_Retailer );

// Fixed effects

for ( i in 1:N ) {

vary[i] <- vary_Retailer[Retailer[i]];

glm[i] <- vary[i] + Intercept

+ beta_EquBasePrice * EquBasePrice[i]

+ beta_DISP * DISP[i]

+ beta_FEAT * FEAT[i]

+ beta_MobileCoupon * MobileCoupon[i];

}

VolumeVelocity ~ normal( glm , sigma );

}

generated quantities{

real dev;

real vary[N];

real glm[N];

dev <- 0;

for ( i in 1:N ) {

vary[i] <- vary_Retailer[Retailer[i]];

glm[i] <- vary[i] + Intercept

+ beta_EquBasePrice * EquBasePrice[i]

+ beta_DISP * DISP[i]

+ beta_FEAT * FEAT[i]

+ beta_MobileCoupon * MobileCoupon[i];

dev <- dev + (-2) * normal_log( VolumeVelocity[i] , glm[i] , sigma );

}

}"