I am interested in a power analysis for a Poisson regression of the form:
$Y_{i,1} = \beta_{0}+\beta_{1}Y_{i,0}+\beta_{2}Z_{i}$
where...
$Y_{i,1} $=The count from the 'post period' for case $i$
$Y_{i,0} $=The count from the 'pre period' for case $i$
$Z_{i} $=An indicator (0 or 1) of treatment for case $i$
There are $n_{0}$ and $n_{1}$ samples from each the control and treatment cases respectively.
I am wondering how to best simulate for a power analysis? What I know:
- We need to declare a minimally important effect size in terms of a multiplier for the treatment, the $\beta_{2}$. Lets say this is a six percent increase on average so effect is log(1.06)
- I do have data without a treatment and ran the model above with the treatment indicator and have the parameter estimates $\beta_{0}$ = 5.083739 and $\beta_{1}$ = 0.002056
- Since I have the values of $Y_{i,0}$ from the time without a treatment, I could use
fitdist()
in R for example to estimate the parameters of this data in say a poisson
Question: What uncertainty needs to be captured in a power analysis like this?
Is it sufficient to do the following (repeated nsim times) or is this not capturing enough uncertainty by using the static values of $\beta_{0}$ and $\beta_{1}$ ? If not how?
#loop this nsims times
n0<-30
n1<-30
B0<-5.083739
B1<-0.002056
effect<-1.06
#treatment indicator
treat<-c(rep(0,n0),rep(1,n1))
#sample of values for the "pre-period" based on prior data this is how the pre-period is distributed
Y0<-as.integer(rpois(n0+n1,505))
lin_pred<-B0+B1*Y0+log(effect)*treat
Y1<-as.integer(exp(lin_pred))
mod<-glm(Y1~Y0+treat,family=poisson)
#extract the p-value from here
summary(mod)
ADD #1
To Greg's questions, the data is paired in the sense that the same units (geographical units such as markets) are measured twice. $Y_{i,1}$ is the response variable after the intervention period (only some markets are treated of course) and $Y_{i,0}$ is the value before the intervention period....a "Pre-test" sometimes called.
This methodology comes from Google's Data Science team here and Andrew Gelman (Here)
a snippet of the former is:
a snippet of this later reference is: