Model the effect of between 0 and 2 categorical variables on taxa richness within a context. Highlight, based on thresholds, contexts where taxa richness is 'excessively' high or low.
make_effort_mod(
df,
context = "cell",
cat_cols = NULL,
threshold_lo = 0.05/2,
threshold_hi = 0.05/2,
use_family = rstanarm::neg_binomial_2(),
...
)
Dataframe. Cleaned data specifying context.
Character. Column names that define context, usually a 'visit' to a 'cell'.
Character. Name of column(s) (0 to 2) specifying the
categorical variables to model. Usually a taxonomic level (say, class) and a
geographic level (say, IBRA Region). If NULL (default), model is y ~ 1
.
Numeric between 0 and 1 specifying the threshold above/below which richness is excessively above or below 'normal' and should be filtered.
Passed to rstanarm::stan_glm
family
argument.
Other arguments passed to rstanarm::stan_glm
(e.g. chains, iter).
List of model outputs:
dataframe of data used in pre-model data exploration
model object
dataframe resulting from rstanarm::posterior_predict
dataframe of residuals
plot of residuals (ggplot object)
dataframe of summarised mod_pred
results
plot of distribution of credible values, faceted by any variables in the model
dataframe of all contexts with column keep
indicating whether the context is outside acceptable taxa richness
dataframe tabulating how many contexts were above and below the acceptable richness quantile thresholds