Skip to content

Instantly share code, notes, and snippets.

@SwampThingPaul
Created January 23, 2019 15:00
Show Gist options
  • Save SwampThingPaul/bde8117345261f3de074804252284643 to your computer and use it in GitHub Desktop.
Save SwampThingPaul/bde8117345261f3de074804252284643 to your computer and use it in GitHub Desktop.
Power analysis FUN
library(pwr)
##
r.val=seq(-0.9,-0.01,0.05)
n.val=4:20
power.rslt=data.frame()
for(j in 1:length(n.val)){
for(i in 1:length(r.val)){
tmp.rslt=pwr.r.test(n=n.val[j],r=r.val[i],sig.level=0.05)
rslt=data.frame(n.val=n.val[j],r.val=r.val[i],power=tmp.rslt$power)
power.rslt=rbind(power.rslt,rslt)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment