bootstrapDiscardData: Bootstrap uncertainty and summarize WCGOP discard data

View source: R/BootstrapDiscardData.R

bootstrapDiscardDataR Documentation

Bootstrap uncertainty and summarize WCGOP discard data

Description

Bootstrap uncertainty and summarize WCGOP discard data

Usage

bootstrapDiscardData(
  ob,
  sp,
  B,
  colnms,
  colnms.new,
  colLevs,
  stratNms,
  ratioType = c("proportion", "expansion"),
  switch_names = TRUE,
  sectorLevs = list(c("Catch Shares", "LE CA Halibut", "Shoreside Hake")),
  bootFile,
  resultsFile
)

Arguments

ob

observer discard data frame

sp

species name that should match the name in the ob data file, can be single species or multiple names (e.g. c("Gopher Rockfish", "Black and Yellow Rockfish"))

colnms

: the names of the columns to subset over (i.e., c("GEAR_TYPE","COMMON_NAME") ). Do not include year columns here, that is kept separate. If numeric, it refers to the column number

colnms.new

new user specified column names which should be consistent with those defined by colnms (e.g., c("Gear.Out", "State"))

colLevs

A list of the levels to cut at, or select from each column. The list elements must be in the same order as colnms If numeric, then it will cut. If character, it will select that specific value. Year is always selected for a particular year

ratioType
bootFile

file with the bootstap output

resultsFile

file with the summarized and final bootstap values

stratNms:

Optional names for levels in each strata. This must be a list with an element for each column. Within each element is a vector of names for each stratum in the same order as colLevs

Author(s)

Allan Hicks and Chantel Wetzel

Examples


  ## Not run: 
     # define what data  you want to bootstrap
     gearLevels <- c("Bottom Trawl")
	gearNames <- c("BottomTrawl")
`		stateLevels <- list("CA","OR","WA")  #r_state
	stateNames <- c("CA","OR","WA")

    # Call function
    out <- bootstrapDiscardData(ob, sp="Petrale Sole", B=10000,
            colnms=c("gear2","r_state"),
            colnms.new=c("gear3","State"),
			colLevs=list(gearLevels,stateLevels),
			stratNms=list(gearNames,stateNames),
			bootFile='Petrale_bootstap.out',
			resultsFile='Petrale_bootstap.out')

   write.csv(out$ncs, 'Petrale_OB_DisRatios_ncs.csv', row.names=F)
   write.csv(out$cs,  'Petrale_OB_DisRatios_cs.csv', row.names=F)

  
## End(Not run)


nwfsc-assess/nwfscDiscard documentation built on June 28, 2023, 6:06 p.m.