creating the vector of pointwise log likelihood in the generated quantities can someone apart from loo evaluation, calculate the other criteria as well?Is that correct?

```
logisticLoo = "data {
int<lower=0> N;
int<lower=0> P;
matrix[N,P] X;
int<lower=0,upper=1> y[N];
}
parameters {
vector[P] beta;
real eta;
}
model {
beta ~ normal(0, 1);
y ~ bernoulli_logit(X * beta);
}
generated quantities {
vector[N] log_lik;
for (n in 1:N) {
log_lik[n] = bernoulli_logit_lpmf(y[n] | X[n] * beta);}
}"
library(loo)
library(rstan)
library(brms)
library(MASS)
data(birthwt)
head(birthwt)
as.factor(birthwt$low)
X <- model.matrix(~ race+lwt,birthwt)
standata <- list(y =birthwt$low , X = X, N = nrow(X), P = ncol(X))
# Fit model
fit_1 <- stan(model_code = logisticLoo,
data = standata,
control = list(max_treedepth=15))
print(fit_1)
pars = c("log_lik")
# Extract pointwise log-likelihood and compute AIC,BIC,DIC,LOO
log_lik_1 <- extract_log_lik(fit_1,parameter_name = pars, merge_chains = FALSE)
r_eff <- relative_eff(exp(log_lik_1))
loo_1 <- loo(log_lik_1, r_eff = r_eff, cores = 2)
print(loo_1)
nrow(log_lik_1)
pars = c("log_lik")
loglik1 = extract_log_lik(fit_1,pars,merge_chains = FALSE)
dev = sum(loglik1)
n = nrow(loglik1)
K = 2
dm = 3
pm = dev - mean(loglik1)
AIC = -2 * dev + dm*k
BIC = -2 * dev + dm*log(n)
DIC = -2 * dev + 2 * pm
print(c(dev,AIC,BIC,DIC))
compfunc(fit_1,2)
```