I am seeking some advice on avoiding initialization failure.

I am working on a modified version of an item response theory model that, for identification purposes, constrains the signs of some parameters. Specifically, certain elements of a parameter vector `beta`

(which is similar to the discrimination parameters in a conventional IRT model) are constrained to be positive in order to identify the polarity of the latent scale. To impose this constraint, I use the trick of defining two versions of the vector, `beta_pos`

and `beta_rest`

, the first of which has positive support, and assigning each of the constrained elements of `beta`

a value from `beta_pos`

instead of `beta_rest`

. Full code is attached, but here are the relevant sections:

```
vector<lower=0>[L] beta_pos[1]; // positive spatial coefficients
vector[L] beta_rest[1]; // unconstrained spatial coefficients
```

and

```
for (l in 1:L) {
for (d in 1:1) {
if (beta_sign[l, d] > 0) { // contrained to be positive
beta[d][l] = beta_pos[d][l];
}
if (beta_sign[l, d] == 0) { // unconstrained
beta[d][l] = beta_rest[d][l];
}
}
}
```

`beta_sign`

is a matrix that indicates whether each element of `beta`

is constrained to be positive (=+1) or unconstrained (=0). (d indexes latent dimensions, of which there is just 1 in this version of the model.)

Sampling from the model works fine as long as only a single element of beta is constrained. Imposing multiple constraints, however, results in a failed initialization. I have tried reducing `init_r`

as low as 0.01, but to no avail. I have not yet tried specifying initial values, in part because I am not sure which of the parameters I should do so for.

Any thoughts on why this parameterization does not work when more than one constraint is imposed?

Thank you for your help.

Devin

conjointIRT-1D.stan (2.2 KB)