Predict mean probabilities and credible intervals given success/trial data

For the below type of model, how can I get the mean probabilities and credible intervals? Is what I did to use posterior_linpred and plogis correct?

# Model fit
fit_11 <- brm(data = model2,
      family = binomial(link = "logit"), pDST_Resistance|trials(Number_mutation) ~ CONSURF + BLOSUM
+ DNA_binding_affected + DNA_Dynamut_deltaG + LIG_Dynamut_deltaG + DNA_PPI_RSA + dimerization_affected + DNA_mCSM_Stability_deltaG + (1 |CLASS),
             prior = prior)

# extract the posterior draws for the linear predictor
posterior_linpred <- posterior_linpred(fit_11, new_data= new_data1,allow_new_levels = TRUE)

# apply the inverse logit function to obtain the probabilities
posterior_probs <- plogis(posterior_linpred)

# calculate the mean, median, and credible intervals for each observation
summary_data1 <- new_data1 %>%
  mutate(mean_prob = round(colMeans(posterior_probs),3),
         median_prob = round(apply(posterior_probs, 2, median),3),
         ci_low = round(apply(posterior_probs, 2, function(x) quantile(x, probs = 0.025)),3),
         ci_high = round(apply(posterior_probs, 2, function(x) quantile(x, probs = 0.975)),3))%>%
  dplyr::select(., rv0678,CLASS, mean_prob, ci_low, ci_high) %>%
  rename(., pooling = mean_prob, pool_ci_low = ci_low, pool_ci_high = ci_high) 


Hey @Tafadzwa, it will be easier to answer your question if you provide the code for a minimally reproducible example from an open data set.