Sizing based on initial data – look a ficticious data
- Sizing based on initial data is often the best approach
estd = 50
set.seed(1000)
gdata <- data.frame(
group=c(
rep("g1",5 ),
rep("g2",5 ),
rep("g3",5 )),
outcome=c(
rnorm(5, mean=1000, sd=estd),
rnorm(5, mean=1000, sd=estd),
rnorm(5, mean=1050, sd=estd))
)
library(DT)
DT::datatable(gdata) %>% formatRound(columns="outcome",digits=1)
means <- c(
mean(gdata[gdata$group=="g1","outcome"]),
mean(gdata[gdata$group=="g2","outcome"]),
mean(gdata[gdata$group=="g3","outcome"]))
sds <- c(
sd(gdata[gdata$group=="g1","outcome"]),
sd(gdata[gdata$group=="g2","outcome"]),
sd(gdata[gdata$group=="g3","outcome"]))
DT::datatable(data.frame(group=c("g1","g2","g3"),means=means, sds=sds)) %>% formatRound(columns=c("means","sds"),digits=1)