library(WebPower)
library(purrr)
library(plotly)
params <- expand.grid(exp0_v = seq.default(from=0,to=2,by=.2),
exp1_v = seq.default(from=0,to=2,by=.2))
params$n_result <- map2_dbl(.x=params$exp0_v,
.y=params$exp1_v,
.f=~tryCatch(wp.poisson(n = NULL,
exp0 = .x,
exp1 = .y,
alpha = 0.05,
power = 0.8,
alternative = "two.sided",
family = "Poisson",
parameter = 1)$n
, error = function(e) NA)
)
plot_ly(data=params,
x=~exp0_v,
y=~exp1_v,
z=~n_result,
type="scatter3d", mode="markers", color=~n_result,
text=~paste0("exp0 : " ,exp0_v, "\n",
"exp1 : " ,exp1_v, "\n",
"n_result : " ,n_result, "\n"),
hoverinfo="text")
with the other params you set, values above 1 for exp1 will give NA values due to infinities in the calculations