GlobalGrowthFit: GlobalGrowthFit class

GlobalGrowthFitR Documentation

GlobalGrowthFit class

Description

[Stable]

The GlobalGrowthFit class contains a growth model fitted to data using a global approach. Its constructor is fit_growth().

It is a subclass of list with the items:

  • algorithm: type of algorithm as in fit_growth()

  • data: data used for model fitting

  • start: initial guess of the model parameters

  • known: fixed model parameters

  • primary_model: a character describing the primary model

  • fit_results: an instance of modFit or modMCMC with the results of the fit

  • best_prediction: Instance of GrowthPrediction with the best growth fit

  • sec_models: a named vector with the secondary models assigned for each environmental factor. NULL for environment="constant"

  • env_conditions: a list with the environmental conditions used for model fitting. NULL for environment="constant"

  • niter: number of iterations of the Markov chain. NULL if algorithm != "MCMC"

  • logbase_mu: base of the logarithm for the definition of parameter mu (check the relevant vignette)

  • logbase_logN: base of the logarithm for the definition of the population size (check the relevant vignette)

  • environment: "dynamic". Always

Usage

## S3 method for class 'GlobalGrowthFit'
print(x, ...)

## S3 method for class 'GlobalGrowthFit'
coef(object, ...)

## S3 method for class 'GlobalGrowthFit'
summary(object, ...)

## S3 method for class 'GlobalGrowthFit'
predict(object, env_conditions, times = NULL, ...)

## S3 method for class 'GlobalGrowthFit'
residuals(object, ...)

## S3 method for class 'GlobalGrowthFit'
vcov(object, ...)

## S3 method for class 'GlobalGrowthFit'
deviance(object, ...)

## S3 method for class 'GlobalGrowthFit'
fitted(object, ...)

## S3 method for class 'GlobalGrowthFit'
logLik(object, ...)

## S3 method for class 'GlobalGrowthFit'
AIC(object, ..., k = 2)

## S3 method for class 'GlobalGrowthFit'
plot(
  x,
  y = NULL,
  ...,
  add_factor = NULL,
  ylims = NULL,
  label_x = "time",
  label_y1 = NULL,
  label_y2 = add_factor,
  line_col = "black",
  line_size = 1,
  line_type = "solid",
  line_col2 = "black",
  line_size2 = 1,
  line_type2 = "dashed",
  point_size = 3,
  point_shape = 16,
  subplot_labels = "AUTO"
)

## S3 method for class 'GlobalGrowthFit'
predictMCMC(
  model,
  times,
  env_conditions,
  niter,
  newpars = NULL,
  formula = . ~ time
)

Arguments

x

an instance of GlobalGrowthFit

...

ignored

object

an instance of GlobalGrowthFit

env_conditions

Tibble with the (dynamic) environmental conditions during the experiment. It must have one column named 'time' with the storage time and as many columns as required with the environmental conditions.

times

Numeric vector of storage times for the predictions.

k

penalty for the parameters (k=2 by default)

y

ignored

add_factor

whether to plot also one environmental factor. If NULL (default), no environmental factor is plotted. If set to one character string that matches one entry of x$env_conditions, that condition is plotted in the secondary axis

ylims

A two dimensional vector with the limits of the primary y-axis.

label_x

label of the x-axis

label_y1

Label of the primary y-axis.

label_y2

Label of the secondary y-axis.

line_col

Aesthetic parameter to change the colour of the line geom in the plot, see: geom_line()

line_size

Aesthetic parameter to change the thickness of the line geom in the plot, see: geom_line()

line_type

Aesthetic parameter to change the type of the line geom in the plot, takes numbers (1-6) or strings ("solid") see: geom_line()

line_col2

Same as lin_col, but for the environmental factor.

line_size2

Same as line_size, but for the environmental factor.

line_type2

Same as lin_type, but for the environmental factor.

point_size

Size of the data points

point_shape

shape of the data points

subplot_labels

labels of the subplots according to plot_grid.

model

An instance of GlobalGrowthFit

niter

Number of iterations.

newpars

A named list defining new values for the some model parameters. The name must be the identifier of a model already included in the model. These parameters do not include variation, so defining a new value for a fitted parameters "fixes" it. NULL by default (no new parameters).

formula

A formula stating the column named defining the elapsed time in env_conditions. By default, . ~ time.

Value

An instance of MCMCgrowth.

Methods (by generic)

  • print(GlobalGrowthFit): print of the model

  • coef(GlobalGrowthFit): vector of fitted model parameters.

  • summary(GlobalGrowthFit): statistical summary of the fit.

  • predict(GlobalGrowthFit): vector of model predictions

  • residuals(GlobalGrowthFit): model residuals. They are returned as a tibble with 4 columns: time (storage time), logN (observed count), exp (name of the experiment) and res (residual).

  • vcov(GlobalGrowthFit): variance-covariance matrix of the model, estimated as 1/(0.5*Hessian) for regression and as the variance-covariance of the draws for MCMC

  • deviance(GlobalGrowthFit): deviance of the model.

  • fitted(GlobalGrowthFit): fitted values. They are returned as a tibble with 3 columns: time (storage time), exp (experiment identifier) and fitted (fitted value).

  • logLik(GlobalGrowthFit): loglikelihood of the model

  • AIC(GlobalGrowthFit): Akaike Information Criterion

  • plot(GlobalGrowthFit): comparison between the fitted model and the experimental data.

  • predictMCMC(GlobalGrowthFit): prediction including parameter uncertainty


biogrowth documentation built on Aug. 19, 2023, 1:06 a.m.