unmarkedPowerList: Create or summarize a series of unmarked power analyses

unmarkedPowerListR Documentation

Create or summarize a series of unmarked power analyses

Description

A list of power analyses created with powerAnalysis can be combined using unmarkedPowerList, allowing comparison e.g. between different study designs/sample sizes. Additionally an unmarkedPowerList can be created directly from an unmarkedFit template model by specifying a series of study designs (number of sites, number of observations) as a data.frame. A series of methods for unmarkedPowerList objects are available including a plot method.

Usage

## S4 method for signature 'list'
unmarkedPowerList(object, ...)
## S4 method for signature 'unmarkedFit'
unmarkedPowerList(object, coefs, design, alpha=0.05,
                                          nulls=list(), nsim=100, parallel=FALSE, ...)
## S4 method for signature 'unmarkedPowerList'
show(object)
## S4 method for signature 'unmarkedPowerList'
summary(object, ...)
## S4 method for signature 'unmarkedPowerList,ANY'
plot(x, power=NULL, param=NULL, ...)

Arguments

object, x

A list of unmarkedPower objects, a fitted model inheriting class unmarkedFit, or an unmarkedPowerList object, depending on the method

coefs

A named list of effect sizes, see documentation for powerAnalysis

design

A data.frame with one row per study design to test, and at least 2 named columns: M for number of sites and J for number of observations. If you have >1 primary period a T column must also be provided

alpha

Type I error rate

nulls

If provided, a list matching the structure of coefs which defines the null hypothesis value for each parameter. By default the null is 0 for all parameters.

nsim

The number of simulations to run for each scenario/study design

parallel

If TRUE, run simulations in parallel

power

When plotting, the target power. Draws a horizontal line at a given value of power on the plot

param

When plotting, the model parameter to plot power vs. sample size for. By default this is the first parameter (which is usually an intercept, so not very interesting)

...

Not used

Value

A unmarkedPowerList object, a summary of the object in the console, or a summary plot, depending on the method

Author(s)

Ken Kellner contact@kenkellner.com

See Also

powerAnalysis

Examples


## Not run: 

# Simulate an occupancy dataset and build template model
forms <- list(state=~elev, det=~1)
coefs <- list(state=c(intercept=0, elev=-0.4), det=c(intercept=0))
design <- list(M=300, J=8) # 300 sites, 8 occasions per site
occu_umf <- simulate("occu", formulas=forms, coefs=coefs, design=design)
template_model <- occu(~1~elev, occu_umf)

# Generate two power analysis
effect_sizes <- list(state=c(intercept=0, elev=-0.4), det=c(intercept=0))
pa <- powerAnalysis(template_model, coefs=effect_sizes, alpha=0.05)
pa2 <- powerAnalysis(template_model, effect_sizes, design=list(M=100,J=2))

# Build unmarkedPowerList and look at summary
(pl <- unmarkedPowerList(list(pa,pa2)))

# Run a bunch of power analyses for different scenarios all at once
scenarios <- expand.grid(M=c(50,200,400),
                         J=c(3,5,8))
(pl2 <- unmarkedPowerList(template_model, effect_sizes, design=scenarios, nsim=20))

# Look at summary plot for elev effect
plot(pl2, power=0.8, param='elev')


## End(Not run)

rbchan/unmarked documentation built on April 3, 2024, 10:11 p.m.