How can i get the WAIC and AIC using rstan for censored

for this model??

R code>

```
functions{
//defined survival
vector log_s(vector t, real shape, vector scale){
vector[num_elements(t)] log_s;
for(i in 1:num_elements(t)){
log_s[i]=log((shape*exp(-t[i] / scale[i]))/(shape+(1-shape)*(1-exp(-t[i] / scale[i]))));
}
return log_s;
}
//define log_ft
vector log_ft(vector t, real shape, vector scale){
vector[num_elements(t)] log_ft;
for(i in 1:num_elements(t)){
log_ft[i]=log((shape/scale[i]*exp(-t[i] / scale[i]))/(shape+(1-shape)*(1-exp(-t[i] / scale[i])))^2);
}
return log_ft;
}
//define log hazard
vector log_h(vector t, real shape, vector scale){
vector[num_elements(t)] log_h;
vector[num_elements(t)] logft;
vector[num_elements(t)] logs;
logft=log_ft(t,shape,scale);
logs=log_s(t,shape,scale);
log_h=logft-logs;
return log_h;
}
//define the sampling distribution
real surv_MOEXP_lpdf(vector t, vector d, real shape, vector scale){
vector[num_elements(t)] log_lik;
real prob;
log_lik=d .* log_h(t,shape,scale)+log_s(t,shape,scale);
prob=sum(log_lik);
return prob;
}
}
//data block
data {
int N; // number of observations
vector<lower=0>[N] y; // observed times
vector<lower=0,upper=1>[N] censor;//censoring indicator (1=observed, 0=censored)
int M; // number of covariates
matrix[N, M] x; // matrix of covariates (with n rows and H columns)
}
parameters {
vector[M] beta; // Coefficients in the linear predictor (including intercept)
real<lower=0> shape; // shape parameter
}
transformed parameters {
vector[N] linpred;
vector[N] scale;
vector[N] log_lik;
linpred = x*beta;
for (i in 1:N) {
scale[i] = exp(linpred[i]);
}
for (n in 1:N){
log_lik[n] <- surv_MOEXP_lpdf(y[n]|censor[n], shape, x[n]*scale);
}
}
model {
shape ~ cauchy(0,25);
beta ~ normal(0,1000);
y ~ surv_MOEXP(censor, shape, scale);
}
generated quantities{
real dev;
dev=0;
dev=dev + (-2)*surv_MOEXP_lpdf(y|censor,shape,scale);
}
```

[edit: escaped code and auto-indented]