I’m trying to fit a relatively simple hierarchical logistic regression mode but I keep running into

Rejecting initial value:

Error evaluating the log probability at the initial value.[RFEPEATED 100 TIMES]

Initialization between (-2, 2) failed after 100 attempts.

Try specifying initial values, reducing ranges of constrained values, or reparameterizing the model.

[1] “Error in sampler$call_sampler(args_list[[i]]) : Initialization failed.”

[1] “error occurred during calling the sampler; sampling not done”

I’ve tried every trick I can think of – I am scaling the polynomial times to lie between 0 and 1, I’ve used starting values from a logistic regression fit. As far as I can tell by code matches the examples given in the Stan documentation. This model also fits in SAS using a standard frequentist mixed model approach. The data size is large – about 100 clusters and 60K observations.

Any obvious stupidities?

stanmodelcode <-“

data {

int<lower=0> n;

int<lower=0> N;

int<lower=0> P;

int<lower=0> Q;

int<lower=0> cumidcount[(n+1)];

int<lower=0> cumidcountl[(n+1)];

int<lower=1,upper=n> jj[N];

matrix[N,P] x;

matrix[N,Q] z;

vector[Q] zero;

vector[P] mbeta;

matrix[P,P] vbeta;

int<lower=0,upper=1> y[N];

}

parameters {

real alpha;

vector[P] beta;

row_vector[Q] b;

corr_matrix[Q] Omega; // prior correlation

vector<lower=0>[Q] tau; // prior scale

}

model {

tau ~ cauchy(0, 2.5);

Omega ~ lkj_corr(5);

beta ~ multi_normal(mbeta,vbeta);

{

for(i in 1:n)

b ~ multi_normal(zero,quad_form_diag(Omega, tau));

}

for(j in 1:N)

y[j] ~ bernoulli_logit(alpha + x[j] * beta + z[j] * b[jj[j]]);

}

”