Looking for help on setting up a Weibull distribution model (RStan)

Hello Everyone,

I’m new to Stan. I’m trying to do some Bayesian analysis on data that follows a Weibull distribution in RStan. I’d like to obtain a posterior distribution for the two parameters (shape and scale) and then understand the full predictive distribution of the data.

The code I have now is pasted below. Can anyone help refine the code to meet my goals? Thank you.

my_weibull_code ← "

data {
int<lower=0> N; // number of observations
vector [N] my_data; // observed data
}

parameters {
real<lower=0> lambda; // scale
real<lower=0> k; // shape
}

model {
// prior
target + = -log(lambda) // Un-informative Jeffrey’s prior, open to suggestions here
k ~ normal(0,3) // Weakly informative

// model
my_data ~ weibull (lambda, k);
}
"
my_weibull ← stan_model(model_code = my_weibull_code)

Are you having issues with this code?

After you construct the stan_model, you need to provide data for it via the sampling method, which will sample from the posterior for you.