countryside_extrap: Use a sar_countryside() model object to predict richness

View source: R/sar_countryside.R

countryside_extrapR Documentation

Use a sar_countryside() model object to predict richness

Description

Use a fitted model object from sar_countryside() to predict richness, given a set of habitat area values.

Usage

countryside_extrap <- function(fits, area)

Arguments

fits

A fitted model object from sar_countryside.

area

A vector of area values - the number (and order) of area values (i.e., the length of the vector) should match the number (and order) of habitats in the dataset used in the sar_countryside fit.

Details

Takes a model fit generated using sar_countryside and uses it to predict richness values for a set of user-provided habitat area values. Note this can either be interpolated or extrapolated predictions, depending on the range of area values used in the original model fits. A ubiquitous model prediction is included if a ubiquitous component model is included in fits.

The habitat area values provided through area need to be in the same order as the habitat columns in the original dataset used in sar_countryside.

The function does work with failed component model fits, as long as at least one component model was successfully fitted. However, arguably it does not make sense to predict richness values unless all component models were successfully fitted.

Value

A list with three elements. The first contains the predicted richness values from the individual component models. The second contains the predicted total richness of the site (i.e., the summed component model predictions), and the third is a logical value highlighting whether there were any failed models in fits, i.e., component models that could not be fitted in sar_countryside.

Author(s)

Thomas J. Matthews

Examples

## Not run: 
data(countryside)
#Fit the sar_countryside model (power version)
s3 <- sar_countryside(data = countryside, modType = "power",
gridStart = "partial", ubiSp = TRUE, habNam = c("AG", "SH",
"F"), spNam = c("AG_Sp", "SH_Sp", "F_Sp", “UB_Sp”))
#Predict the richness of a site which comprises 1000 area units
#of agricultural land, 1000 of shrubland and 1000 of forest.
countryside_extrap(s3, area = c(1000, 1000, 1000))

## End(Not run)

txm676/mmSAR2 documentation built on Nov. 21, 2024, 5:03 a.m.