Hi all,
I’m trying to setup a simple model. I defined a custom generalized Gaussian distribution (see code). However, running the data, I get the error that the initialization failed. Can someone guide me with this?
functions {
real generalized_gaussian_lpdf(real x, real mu, real scale, real beta){
return log(beta) - log(2) - log(scale) - lgamma(1 / beta) - pow((fabs(x-mu) / scale), beta);
}
}
data {
int N; // number of points
vector[N] Y; // demonstration segment
vector[2] bounds; // bounds of space (for discretization)
}
parameters {
real<lower=bounds[1], upper=bounds[2]> center;
real<lower=0, upper=bounds[2]-bounds[1]> width;
}
transformed parameters {
ordered[2] intervals;
intervals[1] = center - (width / 2);
intervals[2] = center + (width / 2);
}
model {
// priors
//lower_interval ~ uniform(bounds[1], bounds[2]);
//upper_interval ~ uniform(bounds[1], bounds[2]);
//likelihood
for (i in 1:N)
Y[i] ~ generalized_gaussian(center, width/2, 5);
}
Any direction is appreciated!