simr
simr copied to clipboard
Bug with power curve for sensitivity analysis
Hi again,
I'm trying to do the sensitivity analysis by effect sizes from literature. When I use the powerCurve function, it generates a plot, but the plot does not make sense as it depicts around 0 participants are needed for 100% power. I've included the syntax and plot below. Thanks so much.
Observation <- as.factor(rep(1:3)) Subject <- as.factor(rep(1:85)) CAR<- rnorm(255, 119.06, 106.39) Slope<- rnorm(255, -.74, .24) Total<- rnorm(255, 72.15, 60.93)
dataset <- expand.grid(Observation, Subject)
dataset<-cbind(dataset,Slope,CAR,Total) names(dataset)[1]<- "Observation" names(dataset)[2]<- "Subject" names(dataset)[3]<- "Slope" names(dataset)[4]<- "CAR" names(dataset)[5]<- "Total"
b <- c(0, -2.76, 0.24, -.87)
V1 <- 192.92 s <- 18.95
model1 <- makeLmer(y ~ CAR + Total + Slope + (1|Subject), fixef=b, VarCorr=V1, sigma=s, data=dataset) print(model1) powerSim(model1, nsim=100)
pc2 <- powerCurve(model1, along="Subject") plot(pc2) summary(pc2) print(pc2)
Those results look fine given the parameter values you're using.
3 subjects is 9 observations which normally isn't many but you're specifying very large effect sizes.