Better way of modelling stick-breaking process?

Hey thanks for the reply.

Why do you want to model the stick-breaking process?

Mostly just as an academic exercise in trying to write a program that would take a set of N samples from one truncated at length M and estimate the parameter used to generate them. I wasn’t aware of the simplex type but I will definitely read up on it.

You can’t assign to data. So I’m not even sure what you’re trying to do here.

Okay, I see that now, my bad. My basic understanding of Bayesian inference is that one comes up with a story about how their data was generated and then creates a model to replicate that, so I just kind of wrote how one gets to the broken sticks from a list of beta random variables (since that’s how I generated them) and wanted to “explain” the input data by saying “y = B”.

I’ll study the code you’ve posted, but I’d also like to ask about a revised version that I wrote, which is as follows:

data {
    int<lower=0> N;
    int<lower=0> M;
    real<lower=0, upper=1> y[N,M];
}
parameters {
    real<lower=0> a;
}
transformed parameters {
    real<lower=0, upper=1> y_[N,M];
    y_ = y;
    for (i in 1:N)
        for (j in 1:M)
            for (k in 1:j-1)
                y_[i,j] /= 1 - y_[i,k];
}
model {
    for (i in 1:N)
        y_[i] ~ beta(1, a);
}

This kind of explains the input data in reverse. working from the broken sticks back to the list of beta distributed RVs. This seems to do the job without any hacks and runs much more quickly. However, I’m still getting a warning about non-linear transformations for the line “y_[i] ~ beta(1, a);”, so is this still improper?

Thanks again for the reply.