Model the effect of principal components on taxa richness.

make_effort_mod_pca(
  df,
  env_prcomp,
  context = "cell",
  cores = 4,
  response = "sr",
  response_min_thresh = 2,
  threshold_lo = 0.05/2,
  threshold_hi = 0.05/2,
  effort_col = "qsize",
  effort_col_thresh = 3 * 3,
  out_file = NULL,
  ...
)

Arguments

df

Dataframe. Cleaned data specifying context.

env_prcomp

Output from env_pca.

context

Character. Column names that define context, usually a 'visit' to a 'cell'.

cores

Numeric. Number of cores available for running chains in rstanarm model.

response

Character. Name to give the 'response' variable column. Default is 'sr' for 'species richness'.

response_min_thresh

Numeric. Threshold below which to filter df before running the model. Default '2' excludes singleton sites.

threshold_lo, threshold_hi

Numeric between 0 and 1 specifying the threshold above/below which richness is excessively above or below 'normal' and should be filtered.

effort_col

Character (or NULL). Name of column with some measure of effort. If NULL, all contexts will be used.

effort_col_thresh

Numeric. effort_col (if used) will be filtered below this threshold. This could be used to, say, filter very small quadrats.

out_file

Character. Optional path to save output.

...

Passed to rstanarm::stan_glm().

Value

List of model outputs.