This function estimates a regression model with parameters, where the model can be one of a set of pre-defined models.

EstimateBioticRegression(
  InputDataType = c("IndividualsData", "SuperIndividualsData"),
  RegressionModel = c("SimpleLinear", "Power"),
  DependentVariable = character(),
  DependentResolutionVariable = character(),
  IndependentVariable = character(),
  IndependentResolutionVariable = character(),
  GroupingVariables = character(),
  IndividualsData,
  SuperIndividualsData
)

Arguments

InputDataType

The type of biotic data to estimate the regression parameters based on, one of "IndividualsData" and "SuperIndividualsData". See Details.

RegressionModel

Character: A string naming the model to use for the regression. See Details for options.

DependentVariable

The name of the dependent variable (response variable).

DependentResolutionVariable

(Optional) The name of the variable that gives the resolution of the DependentVariable. If the DependentResolutionVariable is given, half of the resolution is added to the DependentVariable, and the regression model is fitted at those values. E.g., if DependentVariable = "IndividualTotalLength" and DependentResolutionVariable = "LengthResolution", the regression model is fitted at IndividualTotalLength + LengthResolution/2.

IndependentVariable

The name of the independent variable (explanatory variable).

IndependentResolutionVariable

(Optional) The name of the variable that gives the resolution of the IndependentVariable. See also DependentResolutionVariable.

GroupingVariables

An optional vector of strings defining variables seving as grouping variables in the RegressionTable. Setting this adds the its elements as columns in the RegressionTable in the GUI.

IndividualsData

The IndividualsData data.

SuperIndividualsData

The SuperIndividualsData data.

Value

An object of StoX data type Regression.

Details

The RegressionModel "Power" performs a log-log transformed simple linear regression of the model Y ~ a X^b exp(epsilon), where the error term epsilon is assumed to follow the normal distibution with mean 0 (see fishR).

When using IndividualTotalLength as DependentVariable it can happen that IndividualTotalLength = 0 in SuperIndividualsData due to lower length resolution in the QuantityData than in the IndividualsData going in to the SuperIndividuals function. In such cases the only option is to use InputDataType = "IndividualsData".

See also

DefineRegression for defining regression parameters directly of from a file.