transect.pwr: Power analysis function for transect design

View source: R/transect_pwr.R

transect.pwrR Documentation

Power analysis function for transect design

Description

Taking a single set of transects from a HiDef digital aerial survey will compute the statistical power for detecting population change.

Usage

transect.pwr(
  CC,
  Species,
  nseq = NULL,
  t.space,
  kseq = seq(0, -1, by = -0.1),
  nSim = 10000,
  plot = TRUE,
  by.density = FALSE,
  alternative = "two.sided"
)

Arguments

CC

An sf object. The opened cent count shapefile to process

Species

A vector. The vector of species (using the two letter code) that will be tested. E.G., c("S_CX","S_SP","S_RH","S_GN","S_GD","S_CA")

nseq

A vector (optional). The number of transects to test. If NULL then the code will test a halving, a doubling, and 1.5 times the spacing of the original transects.

t.space

Numeric. A value representing the transect spacing in the cent count.

kseq

Numeric sequence. Defaults to seq(0,1,by=0.1). The vector of effect sizes to test (i.e., the statistical power is to be tested).

nSim

Number of simulations to run power analysis on.

plot

Boolean. Whether or not to plot the output in the console. A plot will be returned in the output list.

by.density

Boolean. If TRUE, will use density rather than count

alternative

indicates the alternative hypothesis and must be one of "two.sided" (default), "less", or "greater". You can specify just the initial letter of the value, but the argument name must be given in full. See ‘Details’ of stats::ks.test() for the meanings of the possible values.

Value

A list. Contains plotobj (the plot as a ggplot), powervals (the data frame with power values), and samplesize (the sample sizes as a data frame)

Examples

CentCount <- "D:/Power_Analysis/Data/Zone113_M02_S01_21_Output/Zone113_M02_S01_21_Output-CentCount.shp"
## Read the CentCount and convert to a data frame
CC <- sf::st_read(CentCount)

## Create the sequences of the original population (effect size)
kseq <- seq(0,-1,by=-0.1)
## Create the number of transects to test
nseq <- c(21,43,64,86)
labs <- c("5km","2.5km","1.68km","1.25km")
names(nseq) <- labs
Species <- c("S_CX","S_SP","S_RH","S_GN","S_GD","S_CA")
poweranalysis <- transect.pwr(CC=CC,Species = Species,nseq = nseq,kseq = kseq,t.space = 2.5,nSim = 1000, plot = TRUE, alternative = "less")

HiDef-Aerial-Surveying/HiDEF documentation built on Nov. 21, 2023, 5:54 a.m.