calcPopSummaryStats: Calculate Summary Statistics for Patch Population Data

View source: R/calculatePopSummaryStats.R

calcPopSummaryStatsR Documentation

Calculate Summary Statistics for Patch Population Data

Description

Calculates summary statistics for patch population data, including summary statistics about $m$ (minimum, maximum, mean, and variance) for each network and population as a whole, and the number of networks with $m>1$.

Usage

calcPopSummaryStats(
  popdata,
  summaryvar,
  rvar = NULL,
  popvar,
  weights = "S",
  nrow,
  ncol
)

Arguments

popdata

Data on multiple realizations of patches of the species of interest within the grid of locations (created by createSpeciesPatchPopulations function).

summaryvar

Vector of variables for which summary statistics should be calculated.

rvar

Vector of ratio variables. The total vector of variables (c(avar, ovar, rvar)) should be a length of at least 1.

popvar

Categorical variable used to identify different populations.

weights

A vector giving spatial weight matrix styles to use to calculate the Join Count and Moran's I statistics. Can take on values "W", "B", "C", "U", "S", and "minmax". See nb2listw for more details.

nrow

the number of rows in the grid that creates the population

ncol

the number of columns in the grid that creates the population

Value

A list of two dataframes, where the first dataframe includes network- and population-specific summary statistics about $m$, summarizes across unique networks as well as unique units within each population, and where the second list includes summary statistics about the summaryvar.

Examples

library(magrittr)
library(dplyr)
ovar = c(
	"Stricta",
	"Pusilla",
	"Cactus",
	"CACA_on_Pusilla",
	"CACA_on_Stricta",
	"MEPR_on_Pusilla",
	"MEPR_on_Stricta",
	"Old_Moth_Evidence_Pusilla",
	"Old_Moth_Evidence_Stricta",
	"Percent_Cover_Pusilla", #how do I do these? they are occupancy nor abundance
	"Percent_Cover_Stricta",
	"Height_Pusilla",
	"Height_Stricta"
)
summaryvar = ovar
# WHAT WAS I THINK HERE? for grouping variables?
popvar = "n.networks" # c("n.networks", "realization")
# create realizations
x_start = 1
x_end = 30
y_start = 1
y_end = 30
n.networks = c(5, 15, 10, 20, 30, 40)
n.realizations = 1
SpeciesInfo = PlotSurveys_season1
start.seed=1
buffer=5
rvar = c("CACA_on_Stricta", "CACA_on_Pusilla")
cactus.realizations <- createRealizations(x_start, x_end,
	y_start, y_end, buffer, n.networks, n.realizations, SpeciesInfo, start.seed,
	ovar, "Cactus")
patch_data_summary <- calcPopSummaryStats(popdata=cactus.realizations,
	summaryvar=ovar, popvar=popvar, nrow=30, ncol=30)

ksauby/ACS documentation built on Aug. 18, 2022, 3:33 a.m.