I have clustered randomized control trial data from 26 sites, 11 receiving the treatment and 15 receiving the control. Each site has a different number of participants.
For each site, the treatment or control is labelled 1 or 0. I have the odds ratio, log odds ratio and probability of treatment success in each site. For example the points for the sites with a higher number of participants should have a bigger data point.
What I would like to do is have a graph plotting the mean odd or log odds of each site as a data point. However, I want each data point to be bigger or smaller to reflect the sample size at each site.
The x-axis will be labeled treatment and control, the y-axis will be either odds or log odds.
Only using ggplot2
's basic function qplot
, you can go miles...
# Generate data
seed(1234)
dat <- data.frame(site=1:26, treatment=factor(c(rep(1,11),rep(0,15))), n.part=rbinom(26, size = 400, prob = .5), OddsRatio = runif(n = 26, min = 0.3, max=2.0))
library(ggplot2)
qplot(x = treatment, y = OddsRatio, size = n.part, data = dat, xlab = "Treatment")