Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add power.prop.test #2

Open
avallecam opened this issue Mar 23, 2021 · 1 comment
Open

add power.prop.test #2

avallecam opened this issue Mar 23, 2021 · 1 comment

Comments

@avallecam
Copy link
Owner

library(pwr)

power.prop.test(p1 = 0.198, 
                p2 = 0.087, 
                sig.level = 0.05, 
                power = .80,
                alternative = "two.sided")

library(powder)

expand_grid(p1=0.198,p2=seq(0.18,0.08,-0.01)) %>% 
  mutate(h=purrr::pmap_dbl(.l = select(.,p1,p2),.f = ES.h)) %>% 
  mutate(power = 0.8,
         sig.level = 0.05,
         alternative = "two.sided") %>% 
  pwr_tidy(test_function = pwr.2p.test)
@avallecam
Copy link
Owner Author

alternativa: habilitar argumentos para que usen la función ES.h desde el inicio

library(pwr)
pwr.p.test(h = ES.h(p1 = 0.28, p2 = 0.50), # effect size
           sig.level = 0.05,
           power = 0.80)

library(tidyverse)
library(powder)
expand_grid(p1=0.28,p2=seq(0.55,0.05,-0.1)) %>% 
  mutate(h=purrr::pmap_dbl(.l = select(.,p1,p2),.f = ES.h)) %>% 
  mutate(power = 0.8,
         sig.level = 0.05,
         alternative = "two.sided") %>% 
  pwr_tidy(test_function = pwr.p.test)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant