Please share your Stan program and accompanying data if possible.

Hello everyone,

I’m trying to utilize bayesian survival analysis using generalized extreme value distribution (3-parameter). In my model only one parameter behaves as a random variable out of three parameters (i’m using empirical bayesian approach). I.e i have only one prior for the variable which behave as a random variable. Other two parameters, sigma and xi are constants. Now i want to use this concept with stan. Please see the following code (which is obtain from the stan forum) and data related to my question. Any help would be really appreciated.

Thank you.

####Data

Y<-c(161, 67, 142, 134, 132, 167, 96, 164,120,74,161,135,153,167,132,40,163,2,132,120,138,111,106,124,40, 6,96,120,138, 122, 80,76, 80,77,118,57,47,93 )

stancode<- "

functions{

real gev_lpdf(vector y, real mu, real sigma, real xi) {

vector[rows(y)] t;

vector[rows(y)] lp;

int N;

N = rows(y);

for(n in 1:N){

t[n] = xi==0 ? exp((mu - y[n]) / sigma) : pow(1 + xi * ((y[n] - mu ) / sigma), -1/xi);

lp[n] = -log(sigma) + (xi + 1) * log(t[n]) - t[n];

}

return sum(lp);

}

}

data {

int<lower=0> N;

vector[N] y;

}

parameters {

real xi;

real<lower=0> sigma;

real mu;

}

model {

// Priors – these can be modified depending on your context

real mu_sigma;

mu_sigma = mu / sigma;

mu_sigma ~ normal(2, 0.5); // prior on mu/sigma

xi ~ normal(0, 0.125); // sorta-weakly informative

// Data Model

y ~ gev(mu, sigma, xi);

}

"