# table of rhat and effective sample size
coef.table <- function(m=drnma_RE,
ref.lab='placebo',
drug.lab=levels(antidep$drug), ...){
# data
ndrugs <- length(drug.lab)
ref.index <- which(levels(as.factor(drug.lab))==ref.lab)
labs <- drug.lab[drug.lab!=ref.lab]
# beta1
mm1 <- m$BUGSoutput$summary %>%
t() %>%
data.frame() %>%
select(!ends_with(paste0(ref.index,'.'))& # exclude ref
starts_with('beta1.')
)%>%
t()%>%
data.frame()%>%
select(1:7)
row.names(mm1) <- labs
colnames(mm1) <- c('mean','sd','2.5%','25%','50%','75%','97.5%')
# beta 2
mm2 <- m$BUGSoutput$summary %>%
t() %>%
data.frame() %>%
select(!ends_with(paste0(ref.index,'.'))& # exclude ref
starts_with('beta2.')
)%>%
t()%>%
data.frame()%>%
select(1:7)
row.names(mm2) <- labs
colnames(mm2) <- c('mean','sd','2.5%','25%','50%','75%','97.5%')
# table to return
return(list(as_tibble(mm1),as_tibble(mm2)))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.