Type: | Package |
Title: | Life and Fertility Tables Specially for Insects |
Version: | 0.1.0 |
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>. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.2 |
LazyData: | TRUE |
Imports: | ggplot2, methods, stats, tidyr |
Suggests: | openxlsx |
Depends: | R (≥ 3.5) |
Author: | Carlos Abimael Sarmiento Sanchez [aut, cre], Lauro Soto Rojas [ctb], Alejandro Corona Ambriz [ctb], Gabriel Arcangel Rodriguez Yam [ctb], Yolanda Franco Islas [ctb], Noe Ramirez Negrete [ctb] |
Maintainer: | Carlos Abimael Sarmiento Sanchez <cass9918@hotmail.com> |
NeedsCompilation: | no |
Packaged: | 2025-02-05 21:45:36 UTC; Milet |
Repository: | CRAN |
Date/Publication: | 2025-02-05 22:10:02 UTC |
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 ("Group1", "Group2"). It is a variable of class "character".
- Female
The number of the female to which each row belongs. It is a variable of class "integer".
- Age
It is the age corresponding to the female. Stage in which it is found. It is a variable of class "integer".
- Eggs
Eggs laid by each female at each age. It is a variable of class "integer".
- Sexrate
Sexrate at each age. It is a variable of class "numeric".
- Survival
Survival at each age. It is a variable of class "numeric".
Source
This dataset serves as an example for running the provided code snippets or as a reference for analyzing the functionality of this package.
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 |
Value
Returns an object of class
c("gg", "ggplot").
Examples
## The main object will be created using the Insects database:
lft <- lifertable(ColumnFemale = Female,
ColumnAge = Age,
ColumnEggs = Eggs,
SexRate = Sexrate,
ColumnGroups = Group,
data = Insects,
CI = TRUE)
PlotPseudoVals(lft)
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 |
|
... |
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(ColumnFemale = Female,
ColumnAge = Age,
ColumnEggs = Eggs,
SexRate = Sexrate,
ColumnGroups = Group,
data = Insects,
CI = 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 |
|
... |
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(ColumnFemale = Female,
ColumnAge = Age,
ColumnEggs = Eggs,
SexRate = 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 |
|
... |
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(ColumnFemale = Female,
ColumnAge = Age,
ColumnEggs = Eggs,
SexRate = 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 |
|
... |
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(ColumnFemale = Female,
ColumnAge = Age,
ColumnEggs = Eggs,
SexRate = Sexrate,
ColumnGroups = Group,
data = Insects,
TotalEggs = TRUE)
as.data.frame(lft$TOTAL.EGGS)
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,
CI = 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
|
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 |
CI |
Logical. If |
TotalEggs |
Logical. If |
x |
Object to be displayed. |
... |
Additional arguments to be passed to or from methods. |
title |
If |
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 repeating it each 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).
A similar situation applies to InitiationOfAdultStage
: you can enter either
a single value or a vector of values corresponding to the involved groups.
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:
\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 |
PARAMETERS |
An object of class |
TOTAL.EGGS |
If requested, an object of class |
CI |
If requested, an object of class |
T.TEST |
An object of class |
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 alifertable
object
Functions
-
print(lifertableCI)
: Print alifertableCI
object, this is the object showing the Confidence Interval -
print(lifertableLFT)
: Print alifertableLFT
object, this is the object showing the Life and Fertility Table -
print(lifertableParmEst)
: Print alifertableParmEst
object, this is the object showing the Estimated Parameters -
print(lifertableTest)
: Print alifertableTest
object, this is the object showing the Student t - test -
print(lifertableTotEggs)
: Print alifertableTotEggs
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(ColumnFemale = Female,
ColumnAge = Age,
ColumnEggs = Eggs,
SexRate = Sexrate,
Survival = Survival,
ColumnGroups = Group,
data = Insects,
CI = TRUE,
TotalEggs = TRUE)
## The following expressions will yield the same result as above:
## lifertable(ColumnFemale = Insects$Female,
## ColumnAge = Insects$Age,
## ColumnEggs = Insects$Eggs,
## SexRate = Insects$Sexrate,
## Survival = Insects$Survival,
## ColumnGroups = Insects$Group,
## CI = TRUE, TotalEggs = TRUE)
## lifertable(ColumnFemale = Insects$Female,
## ColumnAge = Insects$Age,
## ColumnEggs = Insects$Eggs,
## SexRate = 0.7, Survival = 0.9,
## ColumnGroups = Insects$Group,
## CI = TRUE, TotalEggs = TRUE)
## lifertable(ColumnFemale = Insects$Female,
## ColumnAge = Insects$Age,
## ColumnEggs = Insects$Eggs,
## SexRate = c(0.7, 0.7),
## Survival = c(0.9, 0.9),
## ColumnGroups = Insects$Group,
## CI = 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
|
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 |
Value
Returns an object of class
c("gg", "ggplot").
Examples
## The Insects database will be used to generate the plot.
plotDistrOvipos(ColumnFemale = Female,
ColumnAge = Age,
ColumnEggs = Eggs,
ColumnGroups = Group,
data = Insects)
## The following expression will yield the same result as described above:
plotDistrOvipos(ColumnFemale = Insects$Female,
ColumnAge = Insects$Age,
ColumnEggs = Insects$Eggs,
ColumnGroups = 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 |
|
Value
Returns an object of class
c("gg", "ggplot").
Examples
## The main object will be created using the Insects database:
lft <- lifertable(ColumnFemale = Female,
ColumnAge = Age,
ColumnEggs = Eggs,
SexRate = 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)
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 |
|
Value
Returns an object of class
c("gg", "ggplot").
Examples
## The main object will be created using the Insects database:
lft <- lifertable(ColumnFemale = Female,
ColumnAge = Age,
ColumnEggs = Eggs,
SexRate = 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)