powergrid
Power Analysis Across a Grid of Assumptions
Description
Evaluate a function across a grid of parameters. The function may be evaluated once, or many times for simulation. Parallel computing is facilitated. Utilities aim at performing analyses of power and sample size, allowing for easy search of minimum n (or min/max of any other parameter) to achieve a desired minimal level of power (or maximum of any other objective). Plotting functions are included that present the dependency of n and power in relation to further assumptions.
Downloads
215
Last 30 days
20698th
515
Last 90 days
1.4K
Last year
Trend: +110.8% (30d vs prior 30d)
7
Last 30 days
19
Last 90 days
47
Last year
Trend: -36.4% (30d vs prior 30d)
CRAN Check Status
Show all 13 flavors
| Flavor | Status |
|---|---|
| r-devel-linux-x86_64-debian-clang | ERROR |
| r-devel-linux-x86_64-debian-gcc | ERROR |
| r-devel-linux-x86_64-fedora-clang | ERROR |
| r-devel-linux-x86_64-fedora-gcc | ERROR |
| r-devel-windows-x86_64 | ERROR |
| r-oldrel-macos-arm64 | OK |
| r-oldrel-macos-x86_64 | OK |
| r-oldrel-windows-x86_64 | OK |
| r-patched-linux-x86_64 | OK |
| r-release-linux-x86_64 | OK |
| r-release-macos-arm64 | OK |
| r-release-macos-x86_64 | OK |
| r-release-windows-x86_64 | OK |
Check details (10 non-OK)
examples
Running examples in ‘powergrid-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: AddExample
> ### Title: Add an example to an existing PowerPlot or GridPlot
> ### Aliases: AddExample
>
> ### ** Examples
>
>
> ## For more examples, see ?PowerPlot
>
> ## Set up a grid of n, delta and sd:
> sse_pars = list(
+ n = seq(from = 10, to = 60, by = 4),
+ delta = seq(from = 0.5, to = 1.5, by = 0.1), # effect size
+ sd = seq(.1, 1.1, .2)) # Standard deviation
> ## Define a power function using these parameters:
> PowFun <- function(n, delta, sd){ # power for a t-test at alpha = .05
+ ptt = power.t.test(n = n/2, delta = delta, sd = sd,
+ sig.level = 0.05)
+ return(ptt$power)
+ }
> ## Evaluate PowFun across the grid defined by sse_pars:
> power_array = PowerGrid(pars = sse_pars, fun = PowFun, n_iter = NA)
>
> ## ======================
> ## PowerPlot
> ## ======================
> PowerPlot(power_a
...[truncated]...
a = .9),
+ target_value = .9,
+ col = 'blue')
> AddExample(power_array,
+ slicer = list(sd = .7),
+ example = list(delta = c(.7, 1)), # multiple examples
+ target_value = .9,
+ col = 'yellow')
> ## Careful, you can move the slicer argument to example:
> AddExample(power_array,
+ example = list(delta = 1.2, sd = .7), # delta (x-axis) first
+ target_value = .9,
+ col = 'green')
> ## Careful, because you can put the wrong value on x-axis!
> AddExample(power_array,
+ example = list(sd = .7, delta = 1.2), # sd first?!
+ target_value = .9,
+ col = 'red')
>
> ## ======================
> ## GridPlot
> ## ======================
> GridPlot(power_array, target_value = .9)
Warning: The target value wasn't achieved at any of the parameter combinations in x. Therefore, no lines can be drawn.
Error in 1:ncol(y_rec) : argument of length 0
Calls: GridPlot
Execution halted
re-building of vignette outputs
Error(s) in re-building vignettes:
...
--- re-building ‘powergrid.Rmd’ using rmarkdown
Quitting from powergrid.Rmd:212-216 [GridPlot]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error in `1:ncol(y_rec)`:
! argument of length 0
---
Backtrace:
▆
1. └─powergrid::GridPlot(...)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: processing vignette 'powergrid.Rmd' failed with diagnostics:
argument of length 0
--- failed re-building ‘powergrid.Rmd’
SUMMARY: processing the following file failed:
‘powergrid.Rmd’
Error: Vignette re-building failed.
Execution halted
examples
Running examples in ‘powergrid-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: AddExample
> ### Title: Add an example to an existing PowerPlot or GridPlot
> ### Aliases: AddExample
>
> ### ** Examples
>
>
> ## For more examples, see ?PowerPlot
>
> ## Set up a grid of n, delta and sd:
> sse_pars = list(
+ n = seq(from = 10, to = 60, by = 4),
+ delta = seq(from = 0.5, to = 1.5, by = 0.1), # effect size
+ sd = seq(.1, 1.1, .2)) # Standard deviation
> ## Define a power function using these parameters:
> PowFun <- function(n, delta, sd){ # power for a t-test at alpha = .05
+ ptt = power.t.test(n = n/2, delta = delta, sd = sd,
+ sig.level = 0.05)
+ return(ptt$power)
+ }
> ## Evaluate PowFun across the grid defined by sse_pars:
> power_array = PowerGrid(pars = sse_pars, fun = PowFun, n_iter = NA)
>
> ## ======================
> ## PowerPlot
> ## ======================
> PowerPlot(power_a
...[truncated]...
a = .9),
+ target_value = .9,
+ col = 'blue')
> AddExample(power_array,
+ slicer = list(sd = .7),
+ example = list(delta = c(.7, 1)), # multiple examples
+ target_value = .9,
+ col = 'yellow')
> ## Careful, you can move the slicer argument to example:
> AddExample(power_array,
+ example = list(delta = 1.2, sd = .7), # delta (x-axis) first
+ target_value = .9,
+ col = 'green')
> ## Careful, because you can put the wrong value on x-axis!
> AddExample(power_array,
+ example = list(sd = .7, delta = 1.2), # sd first?!
+ target_value = .9,
+ col = 'red')
>
> ## ======================
> ## GridPlot
> ## ======================
> GridPlot(power_array, target_value = .9)
Warning: The target value wasn't achieved at any of the parameter combinations in x. Therefore, no lines can be drawn.
Error in 1:ncol(y_rec) : argument of length 0
Calls: GridPlot
Execution halted
re-building of vignette outputs
Error(s) in re-building vignettes:
...
--- re-building ‘powergrid.Rmd’ using rmarkdown
Quitting from powergrid.Rmd:212-216 [GridPlot]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error in `1:ncol(y_rec)`:
! argument of length 0
---
Backtrace:
▆
1. └─powergrid::GridPlot(...)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: processing vignette 'powergrid.Rmd' failed with diagnostics:
argument of length 0
--- failed re-building ‘powergrid.Rmd’
SUMMARY: processing the following file failed:
‘powergrid.Rmd’
Error: Vignette re-building failed.
Execution halted
examples
Running examples in ‘powergrid-Ex.R’ failed
The error most likely occurred in:
> ### Name: AddExample
> ### Title: Add an example to an existing PowerPlot or GridPlot
> ### Aliases: AddExample
>
> ### ** Examples
>
>
> ## For more examples, see ?PowerPlot
>
> ## Set up a grid of n, delta and sd:
> sse_pars = list(
+ n = seq(from = 10, to = 60, by = 4),
+ delta = seq(from = 0.5, to = 1.5, by = 0.1), # effect size
+ sd = seq(.1, 1.1, .2)) # Standard deviation
> ## Define a power function using these parameters:
> PowFun <- function(n, delta, sd){ # power for a t-test at alpha = .05
+ ptt = power.t.test(n = n/2, delta = delta, sd = sd,
+ sig.level = 0.05)
+ return(ptt$power)
+ }
> ## Evaluate PowFun across the grid defined by sse_pars:
> power_array = PowerGrid(pars = sse_pars, fun = PowFun, n_iter = NA)
>
> ## ======================
> ## PowerPlot
> ## ======================
> PowerPlot(power_array,
+ slicer = list(sd = .7),
+ )
>
...[truncated]...
a = .9),
+ target_value = .9,
+ col = 'blue')
> AddExample(power_array,
+ slicer = list(sd = .7),
+ example = list(delta = c(.7, 1)), # multiple examples
+ target_value = .9,
+ col = 'yellow')
> ## Careful, you can move the slicer argument to example:
> AddExample(power_array,
+ example = list(delta = 1.2, sd = .7), # delta (x-axis) first
+ target_value = .9,
+ col = 'green')
> ## Careful, because you can put the wrong value on x-axis!
> AddExample(power_array,
+ example = list(sd = .7, delta = 1.2), # sd first?!
+ target_value = .9,
+ col = 'red')
>
> ## ======================
> ## GridPlot
> ## ======================
> GridPlot(power_array, target_value = .9)
Warning: The target value wasn't achieved at any of the parameter combinations in x. Therefore, no lines can be drawn.
Error in 1:ncol(y_rec) : argument of length 0
Calls: GridPlot
Execution halted
re-building of vignette outputs
Error(s) in re-building vignettes:
--- re-building ‘powergrid.Rmd’ using rmarkdown
Quitting from powergrid.Rmd:212-216 [GridPlot]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error in `1:ncol(y_rec)`:
! argument of length 0
---
Backtrace:
▆
1. └─powergrid::GridPlot(...)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: processing vignette 'powergrid.Rmd' failed with diagnostics:
argument of length 0
--- failed re-building ‘powergrid.Rmd’
SUMMARY: processing the following file failed:
‘powergrid.Rmd’
Error: Vignette re-building failed.
Execution halted
examples
Running examples in ‘powergrid-Ex.R’ failed
The error most likely occurred in:
> ### Name: AddExample
> ### Title: Add an example to an existing PowerPlot or GridPlot
> ### Aliases: AddExample
>
> ### ** Examples
>
>
> ## For more examples, see ?PowerPlot
>
> ## Set up a grid of n, delta and sd:
> sse_pars = list(
+ n = seq(from = 10, to = 60, by = 4),
+ delta = seq(from = 0.5, to = 1.5, by = 0.1), # effect size
+ sd = seq(.1, 1.1, .2)) # Standard deviation
> ## Define a power function using these parameters:
> PowFun <- function(n, delta, sd){ # power for a t-test at alpha = .05
+ ptt = power.t.test(n = n/2, delta = delta, sd = sd,
+ sig.level = 0.05)
+ return(ptt$power)
+ }
> ## Evaluate PowFun across the grid defined by sse_pars:
> power_array = PowerGrid(pars = sse_pars, fun = PowFun, n_iter = NA)
>
> ## ======================
> ## PowerPlot
> ## ======================
> PowerPlot(power_array,
+ slicer = list(sd = .7),
+ )
>
...[truncated]...
a = .9),
+ target_value = .9,
+ col = 'blue')
> AddExample(power_array,
+ slicer = list(sd = .7),
+ example = list(delta = c(.7, 1)), # multiple examples
+ target_value = .9,
+ col = 'yellow')
> ## Careful, you can move the slicer argument to example:
> AddExample(power_array,
+ example = list(delta = 1.2, sd = .7), # delta (x-axis) first
+ target_value = .9,
+ col = 'green')
> ## Careful, because you can put the wrong value on x-axis!
> AddExample(power_array,
+ example = list(sd = .7, delta = 1.2), # sd first?!
+ target_value = .9,
+ col = 'red')
>
> ## ======================
> ## GridPlot
> ## ======================
> GridPlot(power_array, target_value = .9)
Warning: The target value wasn't achieved at any of the parameter combinations in x. Therefore, no lines can be drawn.
Error in 1:ncol(y_rec) : argument of length 0
Calls: GridPlot
Execution halted
re-building of vignette outputs
Error(s) in re-building vignettes:
--- re-building ‘powergrid.Rmd’ using rmarkdown
Quitting from powergrid.Rmd:212-216 [GridPlot]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error in `1:ncol(y_rec)`:
! argument of length 0
---
Backtrace:
▆
1. └─powergrid::GridPlot(...)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: processing vignette 'powergrid.Rmd' failed with diagnostics:
argument of length 0
--- failed re-building ‘powergrid.Rmd’
SUMMARY: processing the following file failed:
‘powergrid.Rmd’
Error: Vignette re-building failed.
Execution halted
examples
Running examples in 'powergrid-Ex.R' failed
The error most likely occurred in:
> ### Name: AddExample
> ### Title: Add an example to an existing PowerPlot or GridPlot
> ### Aliases: AddExample
>
> ### ** Examples
>
>
> ## For more examples, see ?PowerPlot
>
> ## Set up a grid of n, delta and sd:
> sse_pars = list(
+ n = seq(from = 10, to = 60, by = 4),
+ delta = seq(from = 0.5, to = 1.5, by = 0.1), # effect size
+ sd = seq(.1, 1.1, .2)) # Standard deviation
> ## Define a power function using these parameters:
> PowFun <- function(n, delta, sd){ # power for a t-test at alpha = .05
+ ptt = power.t.test(n = n/2, delta = delta, sd = sd,
+ sig.level = 0.05)
+ return(ptt$power)
+ }
> ## Evaluate PowFun across the grid defined by sse_pars:
> power_array = PowerGrid(pars = sse_pars, fun = PowFun, n_iter = NA)
>
> ## ======================
> ## PowerPlot
> ## ======================
> PowerPlot(power_array,
+ slicer = list(sd = .7),
+ )
>
...[truncated]...
a = .9),
+ target_value = .9,
+ col = 'blue')
> AddExample(power_array,
+ slicer = list(sd = .7),
+ example = list(delta = c(.7, 1)), # multiple examples
+ target_value = .9,
+ col = 'yellow')
> ## Careful, you can move the slicer argument to example:
> AddExample(power_array,
+ example = list(delta = 1.2, sd = .7), # delta (x-axis) first
+ target_value = .9,
+ col = 'green')
> ## Careful, because you can put the wrong value on x-axis!
> AddExample(power_array,
+ example = list(sd = .7, delta = 1.2), # sd first?!
+ target_value = .9,
+ col = 'red')
>
> ## ======================
> ## GridPlot
> ## ======================
> GridPlot(power_array, target_value = .9)
Warning: The target value wasn't achieved at any of the parameter combinations in x. Therefore, no lines can be drawn.
Error in 1:ncol(y_rec) : argument of length 0
Calls: GridPlot
Execution halted
re-building of vignette outputs
Error(s) in re-building vignettes:
--- re-building 'powergrid.Rmd' using rmarkdown
Quitting from powergrid.Rmd:212-216 [GridPlot]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error in `1:ncol(y_rec)`:
! argument of length 0
---
Backtrace:
▆
1. └─powergrid::GridPlot(...)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: processing vignette 'powergrid.Rmd' failed with diagnostics:
argument of length 0
--- failed re-building 'powergrid.Rmd'
SUMMARY: processing the following file failed:
'powergrid.Rmd'
Error: Vignette re-building failed.
Execution halted
Check History
ERROR 11 OK · 0 NOTE · 0 WARNING · 2 ERROR · 0 FAILURE Jun 19, 2026
examples
Running examples in ‘powergrid-Ex.R’ failed The error most likely occurred in: > ### Name: AddExample > ### Title: Add an example to an existing PowerPlot or GridPlot > ### Aliases: AddExample > > ### ** Examples > > > ## For more examples, see ? ...[truncated]... ========= > GridPlot(power_array, target_value = .9) Warning: The target value wasn't achieved at any of the parameter combinations in x. Therefore, no lines can be drawn. Error in 1:ncol(y_rec) : argument of length 0 Calls: GridPlot Execution halted
examples
Running examples in ‘powergrid-Ex.R’ failed The error most likely occurred in: > ### Name: AddExample > ### Title: Add an example to an existing PowerPlot or GridPlot > ### Aliases: AddExample > > ### ** Examples > > > ## For more examples, see ? ...[truncated]... ========= > GridPlot(power_array, target_value = .9) Warning: The target value wasn't achieved at any of the parameter combinations in x. Therefore, no lines can be drawn. Error in 1:ncol(y_rec) : argument of length 0 Calls: GridPlot Execution halted
OK 13 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Jun 13, 2026
ERROR 12 OK · 0 NOTE · 0 WARNING · 1 ERROR · 0 FAILURE Jun 4, 2026
examples
Running examples in ‘powergrid-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: AddExample
> ### Title: Add an example to an existing PowerPlot or GridPlot
> ### Aliases: AddExampl
...[truncated]...
=========
> GridPlot(power_array, target_value = .9)
Warning: The target value wasn't achieved at any of the parameter combinations in x. Therefore, no lines can be drawn.
Error in 1:ncol(y_rec) : argument of length 0
Calls: GridPlot
Execution halted
OK 13 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE May 14, 2026
ERROR 11 OK · 0 NOTE · 0 WARNING · 2 ERROR · 0 FAILURE May 11, 2026
examples
Running examples in ‘powergrid-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: AddExample
> ### Title: Add an example to an existing PowerPlot or GridPlot
> ### Aliases: AddExampl
...[truncated]...
=========
> GridPlot(power_array, target_value = .9)
Warning: The target value wasn't achieved at any of the parameter combinations in x. Therefore, no lines can be drawn.
Error in 1:ncol(y_rec) : argument of length 0
Calls: GridPlot
Execution halted
examples
Running examples in 'powergrid-Ex.R' failed The error most likely occurred in: > ### Name: AddExample > ### Title: Add an example to an existing PowerPlot or GridPlot > ### Aliases: AddExample > > ### ** Examples > > > ## For more examples, see ? ...[truncated]... ========= > GridPlot(power_array, target_value = .9) Warning: The target value wasn't achieved at any of the parameter combinations in x. Therefore, no lines can be drawn. Error in 1:ncol(y_rec) : argument of length 0 Calls: GridPlot Execution halted
OK 14 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Mar 10, 2026
Version History
1 trackedR Observatory began tracking this package on Mar 10, 2026; it first appeared on CRAN Sep 30, 2025. Releases before tracking aren’t shown.