# Comparing proportions in brms

#1

Quick question I hope - I was just wondering what the recommended method was in brms to compare two proportions if all I know is 1) a single denominator and 2) 2 numerators. I believe I’ve seen a hypothesis test referenced before for this sort of question but can’t find it now.

Thanks!

Please also provide the following information in addition to your question:

• Operating System: Win 10
• brms Version: 2.3.1

#2

Can you elaborate on your question a little bit more?

#3

I’d like to test the probability of two proportions being the same or different, say x/z vs y/z. I don’t have individual observations, like a vector of z length, I only have the total numbers. Specifically I’m looking at the proportion of people with a certain exposure is different at two observation periods.

I can easily enough just do prop.test( x , z ) and prop.test( y , z ) and show that the confidence intervals of the proportion are different and non-overlapping, but I was wondering if there is a method to do that in brms.

#4

or prop.test( c( x , y ) , c( z , z ) ) also gives me CIs around the difference in proportions…

#5

Try out

``````dat <- data.frame(
count = c(x, y),
z = z,
group = c("a", "b")
)
fit <- brm(count | trials(z) ~ group, data = dat, family = binomial())
summary(fit)
``````

#6

If the denominator z is the same does that not imply that the binary observations are paired (correlated)?

#7

It’s comparing the same observation at two different time points. More specifically it’s a study of access to obstetrical care in Rwanda. I know a single population figure of pregnant women. In 2017 the number of hospitals with OB services had increased compared with 2012.

So I have drawn 10 and 25 km buffers from each hospital and I’d like to report the % of total pregnant women falling into these buffers in 2012 vs 2017.

Paul

#8

Thanks, I’ll give that a try.

#9

Paul,
Thanks, that was easy enough and worked. I recall in John Kruschke’s ‘BEST’ script (‘bayesian estimation supecedes the t test’) there was a quick visualization to show the distribution of the two different means on the same axis to show how much (if any) overlap there is in the two distributions. I haven’t done too much with this sort of model, is there a stanplot function that might be useful here?