Credibility intervals for one group

Hello all,
I would like to have a good interpret for the credible interval for one treatment group in the clinical trial, what does that mean? and how I can compute that for different sample sizes with rstanarm package.

I simulated the event and treatment variables then I applied stan_glm with different prior. Does this true?

Thanks in advance

pi = 0.2 # event rate
n= c(30, 50, 100)
j=1

event = rep(1, n[j])
n0 = round(n[j]*pi,0)
event[sample(n[j],n0)] = 0 
mydata= data.frame(event = event, trt= rep(1, length(event
                                                     )))

glm_prior <- normal(location = 0, scale = 0.2, autoscale = FALSE )
model.or <- stan_glm(event~trt, data = mydata,
                     family =  "binomial",
                     prior = glm_prior,
                     prior_intercept = NULL,
                     #prior_aux = prior_aux,
                     QR=FALSE,
                     mean_PPD = FALSE,
                     seed = 123450,
                     chains=10,
                     #iter= 500,
                     #cores=ncores,
                     refresh = 0)
post = as.data.frame(model.or)

post = apply(post, 2, function(x) exp(x))

ci.beta.l = round(apply(post, 2, function(x) quantile(x, 0.025) ), 2) 
ci.beta.u = round(apply(post, 2, function(x) quantile(x, 0.975) ), 2)

CI = cat("(", ci.beta.l, ",",ci.beta.u, ")" )

Hi,
questions on rstanarm are most likely to get good responses on the Stan Discourse (discourse.mc-stan.org/). Also I don't think I understand the question completely - are you trying to design an experiment, i.e. do you want to run some sort of power analysis? Or are you trying to analyze already collected data?

1 Like

I want to compute the credible interval when I have just one treatment group. That is it.