weight_aimlmf: Calculate weights for analyses combining AIM and LMF data

View source: R/weighting.R

weight_aimlmfR Documentation

Calculate weights for analyses combining AIM and LMF data

Description

When combining AIM and LMF designs for a single weighted analysis, the process of calculating weights is complicated by the two-stage nature of the LMF design. This calculates a relative weight for each point first based on whether or not it falls inside an LMF segment that was selected for sampling and how many points total fall in any given LMF segment. Those relative weights are then used to calculate combined design weights.

Usage

weight_aimlmf(
  aim_points,
  lmf_points,
  aim_idvar,
  lmf_idvar,
  aim_fatevar = NULL,
  observed_fates = c("TS"),
  invalid_fates = NULL,
  wgtcats = NULL,
  wgtcat_var,
  wgtcat_area_var = NULL,
  segments = NULL,
  segment_var,
  projection = NULL,
  verbose = FALSE
)

Arguments

aim_points

Data frame or spatial points data frame. The AIM point information, including unique identities in the variable aim_idvar. If this is just a data frame OR if wgtcats is not a spatial polygons data frame then it must already have the weight category and LMF segment memberships assigned in the variables wgtcat_var and segment_var (there should be an NA for any observation that does not fall in an LMF segment). If this is spatial and so are either wgtcats or segments, then the points will be attributed with the memberships useing sp::over(). This must also include aim_fate_var if any of the points were not observed/sampled, e.g. rejected, inaccessible, or had an unknown fate, otherwise they will all be assumed to've been observed/sampled.

lmf_points

Data frame or spatial points data frame. The LMF point information, including unique identities in the variable lmf_idvar. If this is just a data frame OR if wgtcats is not a spatial polygons data frame then it must already have the weight category and LMF segment memberships assigned in the variables wgtcat_var and segment_var (there should be an NA for any observation that does not fall in an LMF segment). If this is spatial and so are either wgtcats or segments, then the points will be attributed with the memberships useing sp::over(). All LMF points are assumed to be observed/sampled.

aim_idvar

Character string. The name of the variable in aim_points that contains the unique identities for the points.

lmf_idvar

Character string. The name of the variable in lmf_points that contains the unique identities for the points.

aim_fatevar

Optional character string. The name of the variable in aim_points that contains the fates of the points. If NULL then the fate of all points in aim_points will be assumed to be sampled/observed. Defaults to NULL

observed_fates

Optional vector of character strings. The strings present in aim_points$aim_fatevar that correspond to a sampled/observed fate. Defaults to NULL

invalid_fates

Optional vector of character strings. The strings present in aim_points$aim_fatevar that correspond to fates that SHOULD NOT BE INCLUDED IN WEIGHTING, e.g. unneeded or not yet evaluated as in future points or unused oversample. Defaults to NULL

wgtcats

Data frame or spatial polygons data frame. The information about the weight categories. This must contain the weight category identities in a variable named wgtcat_var. If this is a data frame, it must also contain the AREAS IN HECTARES in a variable named wgtcat_area_var. Defaults to NULL

wgtcat_var

Character string. The name of the variable in wgtcats (and, if wgtcats is not spatial, aim_points and lmf_points) that contains the weight category identities/memberships.

wgtcat_area_var

Optional character string. The name of the variable in wgtcats that contains the AREAS IN HECTARES. Only optional if wgtcats is spatial. Defaults to NULL

segments

Optional spatial polygons data frame. The information about the LMF segments, this is only optional if segment_var is not already assigned to aim_points and lmf_points. This must contain the weight category identities in a variable named segment_var. Defaults to NULL

segment_var

Character string. The name of the variable in segments (or, if segments is not provided, aim_points and lmf_points) that contains the LMF segment identities.

projection

Optional CRS object. Used to reproject all spatial data. If NULL then the projection is taken from wgtcats unless it's not spatial in which case it's taken from segments unless it's not provided in which case no reprojection occurs. Defaults to NULL

verbose

Logical. If TRUE then the function will produce informative messages as it executes its steps. Useful for debugging. Defaults to FALSE.

Value

A list of two data frames: point_weights which contains information for each point that did not have a fate in invalid_fates and wgtcat_summary which contains information about each weight category.


nstauffer/aim.analysis documentation built on Nov. 2, 2023, 12:52 a.m.