weight.gen: Calculate sample weights for points using design polygons

View source: R/weighting.R

weight.genR Documentation

Calculate sample weights for points using design polygons

Description

Calculate the weight for points in a sample design based on the sample frame or strata used to draw them and the point fate. The outputs are a data frame of the points and their weights, a data frame summary of the fates of the points (optionally by year), and a data frame summary of the strata (optionally by year) if strata were used. No spatial checks are done, so make sure that pts and frame.spdf are from the same design, limited to the extent of the original sample frame, and have complete overlap.

Usage

weight.gen(
  pts,
  pts.fatefield = NULL,
  pts.groupfield = NULL,
  frame.spdf,
  frame.groupfield = NULL,
  target.values = NULL,
  unknown.values = NULL,
  nontarget.values = NULL,
  inaccessible.values = NULL,
  unneeded.values = NULL
)

Arguments

pts

Data frame or spatial points data frame. This should be the points information. At minimum, it must contain a field matching the string pts.fatefield containing string values matching those in target.values, unknown.values, etc. If providing pts.groupfield it must also have a field matching that containing values matching values found in frame.spdf$frame.groupfield. If date.field or year.source.field is provided, then fields matching those must exist.

pts.fatefield

Character string. This must exactly match the name of the field in pts that contains string values matching those in target.values, unknown.values, etc.

pts.groupfield

Optional character string. This must exactly match the name of the field in pts that contains values matching those found in frame.spdf$frame.groupfield. This will most often be the field containing strata identities.

frame.spdf

Spatial polygons data frame. This must be the design's sample frame or strata restricted to the sample frame extent. If providing frame.groupfield it must also have a field matching that containing values matching values found in pts$pts.groupfield.

frame.groupfield

Optional character string. This must exactly match the name of the field in frame.spdf that contains values matching those found in pts$pts.groupfield. This will most often be the field containing strata identities.

target.values

Character string or character vector. This defines what values in the point fate field count as target points. When using AIM design databases, this should be at minimum c("Target Sampled", "TS"). This is case insensitive.

unknown.values

Character string or character vector. This defines what values in the point fate field count as unknown points. When using AIM design databases, this should be at minimum c("Unknown", "Unk"). This is case insensitive.

nontarget.values

Character string or character vector. This defines what values in the point fate field count as non-target points. When using AIM design databases, this should be at minimum c("Non-Target", "NT", NA). This is case insensitive.

inaccessible.values

Character string or character vector. This defines what values in the point fate field count as non-target points. When using AIM design databases, this should be at minimum c("Inaccessible"). This is case insensitive.

unneeded.values

Character string or character vector. This defines what values in the point fate field count as not needed or unneeded points. When using AIM design databases, this should be at minimum c("Not needed"). This is case insensitive.

Value

A list containing the named data frames frame.stats, frame.summary (if groupfield strings were provided), and point.weights.


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