Package 'Lifertable'

Title: Life and Fertility Tables Specially for Insects
Description: Life and Fertility Tables are appropriate to study the dynamics of arthropods populations. This package provides utilities for constructing Life Tables and Fertility Tables, related demographic parameters, and some simple graphs of interest. It also offers functions to transform the obtained data into a known format for better manipulation. This document is based on the article by Maia, Luiz, and Campanhola "Statistical Inference on Associated Fertility Life Table Parameters Using Jackknife Technique Computational Aspects" (April 2000, Journal of Economic Entomology, Volume 93, Issue 2) <doi:10.1603/0022-0493-93.2.511>.
Authors: Carlos Abimael Sarmiento Sanchez [aut, cre]
Maintainer: Carlos Abimael Sarmiento Sanchez <[email protected]>
License: MIT + file LICENSE
Version: 0.0.1
Built: 2024-10-27 06:22:16 UTC
Source: CRAN

Help Index


Coerce CI to a Data Frame

Description

Function to coerce the object displaying the Confidence Interval into a data frame.

Usage

## S3 method for class 'lifertableCI'
as.data.frame(x, row.names = NULL, ...)

Arguments

x

A lifertableCI object.

row.names

NULL or a character vector giving the row names for the data frame. Missing values are not allowed.

...

additional arguments to be passed to or from methods.

Value

as.data.frame.lifertableCI returns a data frame.

Examples

## Make the main object:
lft <- lifertable(Female, Age, Eggs, Sexrate,
                  ColumnGroups = Group,
                  data = Insects, jackknife = TRUE)


as.data.frame(lft$CI)

Coerce Life Table to a Data Frame

Description

Function to coerce the object displaying Life Table into a data frame.

Usage

## S3 method for class 'lifertableLFT'
as.data.frame(x, row.names = NULL, ...)

Arguments

x

A lifertableLFT object

row.names

NULL or a character vector giving the row names for the data frame. Missing values are not allowed.

...

additional arguments to be passed to or from methods.

Value

as.data.frame.lifertableLFT returns a data frame.

Examples

## Make the main object:
lft <- lifertable(Female, Age, Eggs, Sexrate,
                  ColumnGroups = Group, data = Insects)


as.data.frame(lft$LIFERTABLE)

Coerce Parameters to a Data Frame

Description

Function to coerce the object displaying Parameters into a data frame.

Usage

## S3 method for class 'lifertableParmEst'
as.data.frame(x, row.names = NULL, ...)

Arguments

x

A lifertableParmEst object

row.names

NULL or a character vector giving the row names for the data frame. Missing values are not allowed.

...

additional arguments to be passed to or from methods.

Value

as.data.frame.lifertableParmEst returns a data frame.

Examples

## Make the main object:
lft <- lifertable(Female, Age, Eggs, Sexrate,
                  ColumnGroups = Group, data = Insects)


as.data.frame(lft$PARAMETERS)

Coerce Total Eggs to a Data Frame

Description

Function to coerce the object displaying Total Eggs into a data frame.

Usage

## S3 method for class 'lifertableTotEggs'
as.data.frame(x, row.names = NULL, ...)

Arguments

x

A lifertableTotEggs object.

row.names

NULL or a character vector giving the row names for the data frame. Missing values are not allowed.

...

additional arguments to be passed to or from methods.

Value

as.data.frame.lifertableTotEggs returns a data frame.

Examples

## Make the main object:
lft <- lifertable(Female, Age, Eggs, Sexrate,
                  ColumnGroups = Group,
                  data = Insects, TotalEggs = TRUE)


as.data.frame(lft$TOTAL.EGGS)

Insects data

Description

This dataset provides reference information on two groups of insects to illustrate the usage of functions within this package.

Usage

Insects

Format

A data frame with 404 rows and 6 columns:

Group

Name of the group (Claudia, paty).

Female

The number of the female to which each row belongs.

Age

It is the age corresponding to the female. Stage in which it is found.

Eggs

Eggs laid by each female at each age.

Sexrate

Sexrate at each age.

Survival

Survival at each age.

Source

This dataset serves as an example for running the provided code snippets or as a reference for analyzing the functionality of this package.


Life and Fertility Table

Description

This function enables users to obtain life and fertility tables, offering various configuration options for optimal usage. See "Details" section.

Usage

lifertable(
  ColumnFemale,
  ColumnAge,
  ColumnEggs,
  SexRate,
  Survival = 1,
  ColumnGroups,
  data,
  InitiationOfAdultStage = 0,
  jackknife = FALSE,
  TotalEggs = FALSE
)

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

## S3 method for class 'lifertableCI'
print(x, title = TRUE, ...)

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

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

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

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

Arguments

ColumnFemale

Data vector containing information on Females.

ColumnAge

Data vector containing information on Age.

ColumnEggs

Data vector containing information on the Number of Eggs Laid.

SexRate

Sex rate of eggs laid by the female at a certain age.

Survival

Percent of offspring females alive until adulthood. By default, the value is set to 1, assuming that all offspring will survive to adulthood.

ColumnGroups

Optional data vector containing information on the Groups. It is optional if the database only contains information about one group.

data

An optional data frame containing the variables. If not found in data, the variables are taken from environment.

InitiationOfAdultStage

Age at which females became adults. If the database contains records from birth, entering this value is unnecessary. ONLY ENTER THIS VALUE if the database begins from the adult stage, and the values in ColumnAge do not reflect the preceding stage (i.e. they contain the ages: 1, 2, 3, ...).

jackknife

Logical. If TRUE, Jackknife estimations will be conducted to obtain Confidence Intervals for the Parameters and, if necessary, to compare between groups. Default is FALSE

TotalEggs

Logical. If TRUE, the calculation of the number of eggs laid by each female during the entire experiment will be conducted. Default is FALSE.

x

Object to be displayed.

...

Additional arguments to be passed to or from methods.

title

If TRUE (the default), displays the title of the object (this is for internal use only).

Details

ColumnFemale and ColumnGroups can be either a numeric vector or a character vector. This means they may contain either numerical values or labels corresponding to the female and to their respective group assignments.

The standard approach for storing the Sex Rate and Survival rate during the experiment is to input this information into the corresponding columns for each variable. If this information remains consistent within a group, you can input that value without the need to repeat it every time. If your database encompasses a single experimental group, simply enter the corresponding value in the SexRate and Survival arguments. In the case of having more than one group, you can input the values of SexRate and Survival correspondingly into a vector containing as many elements as there are groups (one sex ratio and one survival rate for each group).

Estimated Parameters:

Net Reproductive Rate (Ro)

Mean net contribution per female to the next generation.

Intrinsic Rate of Increase (Rm)

Rate of natural increase in a closed population that has been subject to a constant age-specific schedule of fertility and mortality for a long period, and has converged to be a stable population.

Mean Generation Time (GT)

Mean time span between the birth of individuals of a generation and that of the next generation.

Doubling Time (DT)

Time span necessary for doubling the initial population.

Finite Rate of Increase (Lambda)

It is a multiplication factor of the original population at each time period.

Rm it was determined by analytical approximation using Lotka’s (1907, 1913) equation:

x=0expRmxlxmx=1\sum_{x=0}^{\infty}{\exp^{-R_{m}x}l_x m_x} = 1

Value

lifertable returns an object of class "lifertable".

An object of class "lifertable" is a list containing the following components:

LIFERTABLE

An object of class lifertableLFT containing the Life and Fertility Table.

PARAMETERS

An object of class lifertableParmEst containing the Parameter Estimations

TOTAL.EGGS

If requested, an object of class lifertableTotEggs containing the total number of eggs laid by each female throughout the entire experiment.

CI

If requested, an object of class lifertableCI containing the Confidence Intervals for the Parameter Estimates.

T.TEST

An object of class lifertableTest containing the Student t-test for pairwise group comparison. This component only appears if the experiment in question contains more than one group and a Jackknife estimation has been performed.

PSEUDOS

A list containing the pseudo values generated from the Jackknife estimation

GROUPS

A list of the groups involved in the experiment.

Methods (by generic)

  • print(lifertable): Print a lifertable object

Functions

  • print(lifertableCI): Print a lifertableCI object, this is the object showing the Confidence Interval

  • print(lifertableLFT): Print a lifertableLFT object, this is the object showing the Life and Fertility Table

  • print(lifertableParmEst): Print a lifertableParmEst object, this is the object showing the Estimated Parameters

  • print(lifertableTest): Print a lifertableTest object, this is the object showing the Student t - test

  • print(lifertableTotEggs): Print a lifertableTotEggs object, this is the object showing the Eggs laid per Female

References

Maia, A. H., Luis, A. J., & Campanhola, C. (2000). "Statistical Inference on Associated Fertility Life Table Parameters Using Jackknife Technique: Computational Aspects". Journal of Economic Entomology, 93(2), 511-518. doi:10.1603/0022-0493-93.2.511

Portilla, M., Morales-Ramos, J. A., Guadalupe Rojas, M., & Blanco, C. A. (2014). "Chapter 8 - Life Tables as Tools of Evaluation and Quality Control for Arthropod Mass Production". Mass Production of Beneficial Organisms (241-275). doi:10.1016/B978-0-12-391453-8.00008-X

Examples

## The Insects database will be utilized:

lifertable(Female, Age, Eggs, Sexrate, Survival, Group, data = Insects,
           jackknife = TRUE, TotalEggs = TRUE)

## The following expressions will yield the same result as above:

## lifertable(Insects$Female, Insects$Age, Insects$Eggs, Insects$Sexrate,
##            Insects$Survival, Insects$Group, jackknife = TRUE,
##            TotalEggs = TRUE)

## lifertable(Insects$Female, Insects$Age, Insects$Eggs,
##            SexRate = 0.7, Survival = 0.9, Insects$Group,
##            jackknife = TRUE, TotalEggs = TRUE)

## lifertable(Insects$Female, Insects$Age, Insects$Eggs,
##            SexRate = c(0.7, 0.7), Survival = c(0.9, 0.9),
##            Insects$Group, jackknife = TRUE, TotalEggs = TRUE)

Plot for Distribution of Age at Oviposition

Description

This function generates a plot illustrating the Distribution of Oviposition (y-axis) versus Age (x-axis), with separate representations for each group if multiple groups exist. The data is sourced from the original database.

Usage

plotDistrOvipos(
  ColumnFemale,
  ColumnAge,
  ColumnEggs,
  ColumnGroups,
  data,
  InitiationOfAdultStage = 0
)

Arguments

ColumnFemale

Data vector containing information on Females.

ColumnAge

Data vector containing information on Age.

ColumnEggs

Data vector containing information on the Number of Eggs Laid.

ColumnGroups

Optional data vector containing information on the Groups. It is optional if the database only contains information about one group.

data

An optional data frame containing the variables. If not found in data, the variables are taken from environment.

InitiationOfAdultStage

Age at which females became adults. If the database contains records from birth, entering this value is unnecessary. ONLY ENTER THIS VALUE if the database begins from the adult stage, and the values in ColumnAge do not reflect the preceding stage (i.e. they contain the ages: 1, 2, 3, ...).

Value

Returns an object of class c("gg", "ggplot").

Examples

## The Insects database will be used to generate the plot.

plotDistrOvipos(Female, Age, Eggs, Group, data = Insects)

## The following expression will yield the same result as described above:

plotDistrOvipos(Insects$Female, Insects$Age, Insects$Eggs, Insects$Group)

Plot for the Number of Eggs Laid per Female

Description

This function generates a Plot representing the number of Eggs Laid by each Female throughout the entire experiment.

Usage

plotEggs(object)

Arguments

object

object accepts 2 classes of objects:

  • An object inheriting from lifertable(), representing the Life and Fertility Table.

  • An object of class lifertableTotEggs inherited from lifertable(). This is the object that displays the total number of eggs laid per female.

Value

Returns an object of class c("gg", "ggplot").

Examples

## The main object will be created using the Insects database:
lft <- lifertable(Female, Age, Eggs, Sexrate, ColumnGroups = Group,
                  data = Insects, TotalEggs = TRUE)

## Possible usage scenarios

## 1. Direct Usage of the "lft" Object:
plotEggs(lft)

## 2. Assigning the component "TOTAL.EGGS" to an object:
TEggs <- lft$TOTAL.EGGS
plotEggs(TEggs)

## 3. Direct usage of the component:
plotEggs(lft$TOTAL.EGGS)

Plot for the Pseudo-Values of Parameters

Description

Construction of Plots for the pseudo-values of associated Life Table parameters.

Usage

PlotPseudoVals(object)

Arguments

object

An object inheriting from lifertable(), representing the Life and Fertility Table.

Value

Returns an object of class c("gg", "ggplot").

Examples

## The main object will be created using the Insects database:
lft <- lifertable(Female, Age, Eggs, Sexrate, ColumnGroups = Group,
                  data = Insects, jackknife = TRUE)

PlotPseudoVals(lft)

Survival curve for the Life and Fertility Table

Description

This function generates the graphical representation of the Life Table. Survival (y-axis) versus Age (x-axis)

Usage

plotSurvivalCurve(object)

Arguments

object

object accepts 2 classes of objects:

  • An object inheriting from lifertable(), representing the Life and Fertility Table.

  • An object of class lifertableLFT inherited from lifertable(). This is the object that displays the Life and Fertility Table.

Value

Returns an object of class c("gg", "ggplot").

Examples

## The main object will be created using the Insects database:
lft <- lifertable(Female, Age, Eggs, Sexrate, ColumnGroups = Group,
                  data = Insects)

## Possible usage scenarios

## 1. Direct Usage of the "lft" Object:
plotSurvivalCurve(lft)

## 2. Assigning the component "LIFERTABLE" to an object:
lifeTable <- lft$LIFERTABLE
plotSurvivalCurve(lifeTable)

## 3. Direct usage of the component:
plotSurvivalCurve(lft$LIFERTABLE)