Skip to content

Commit

Permalink
version 2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
elweiser authored and cran-robot committed Jan 11, 2018
1 parent f93c874 commit 5d47ba9
Show file tree
Hide file tree
Showing 14 changed files with 470 additions and 156 deletions.
12 changes: 6 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
Package: AlleleRetain
Type: Package
Title: Allele Retention, Inbreeding, and Demography
Version: 1.3.4
Depends: R (>= 2.11.0)
Version: 2.0.2
Depends: R (>= 3.4.0)
Suggests: pedigree
Date: 2017-08-15
Author: Emily Weiser
Date: 2018-01-11
Author: Emily L. Weiser
Maintainer: Emily Weiser <emily.l.weiser@gmail.com>
Description: Simulate the effect of management or demography on allele retention and inbreeding accumulation in bottlenecked populations of animals with overlapping generations.
License: GPL (>= 2)
ZipData: yes
URL: https://sites.google.com/site/alleleretain/
NeedsCompilation: no
Packaged: 2017-08-16 01:35:17 UTC; Emily
Packaged: 2018-01-11 18:50:13 UTC; Emily
Repository: CRAN
Date/Publication: 2017-08-16 03:24:05 UTC
Date/Publication: 2018-01-11 19:29:41 UTC
22 changes: 12 additions & 10 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
1d6538692e9a4c3b2eab2db8e262f532 *DESCRIPTION
0e56824a0dbdb5cf76bf472deae7161c *NAMESPACE
68764e4ac76aa0cd7e5206e94da74c84 *R/AlleleRetain.R
2c749f8b2c1b29396d6c64031f89196d *inst/CITATION
14e6882817dec3fb39e72ee9bb022ae3 *inst/doc/AlleleRetain_User_Guide.pdf
4bd3bea9c67b5482ca9d48d416ffa6b7 *man/AlleleRetain-package.Rd
463dd1bfd46bc46365407435dc270fef *man/aRetain.Rd
5a22546e54a1db7477b36eaa6434e579 *man/aRetain.summary.Rd
398a6a7ab9cadc3c931042dcd66ee703 *man/indiv.summary.Rd
d1e50d168da0c9fa3a2e22acdfd4d764 *man/pedigree.summary.Rd
12f92aea37ef1cdbbad3bf3cb0be61ab *DESCRIPTION
06ba0b4ac424ac36c45ef36409774360 *NAMESPACE
bd4f8d3f134911db0ec8da31de29f966 *R/AlleleRetain.R
b915f280b08e9ae6501a432a88b21201 *inst/CITATION
f9f1d196303d9e1a124180d2319e3446 *inst/doc/AlleleRetain2.0_User_Guide.pdf
c10ed21f34e7285ae28c34100bad232e *man/AlleleRetain-package.Rd
fae2214e034f067e9b4399b779ca6405 *man/LRS.summary.Rd
7c2f4002342984c6615fdc0cce200247 *man/aRetain.Rd
c0fe7751321d9757ce4f1c2dca1e7b35 *man/aRetain.summary.Rd
0be5896cc1bef2ff8be1a5b497082fd5 *man/agerepro.summary.Rd
406acee9fe9c56eaff688e4bf135445c *man/indiv.summary.Rd
e36bffa5877ea70403c90c8a55e41322 *man/pedigree.summary.Rd
4 changes: 3 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
importFrom("graphics", "close.screen", "plot", "screen",
"split.screen")
importFrom("stats", "qnorm", "rbinom", "rgamma", "rnorm", "rpois",
importFrom("stats", "sd", "qnorm", "rbinom", "rgamma", "rnorm", "rpois",
"var")
importFrom("utils", "flush.console")

export (aRetain)
export (aRetain.summary)
export (indiv.summary)
export (LRS.summary)
export (agerepro.summary)
export (pedigree.summary)
370 changes: 266 additions & 104 deletions R/AlleleRetain.R

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/CITATION
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ year <- sub(".*(2[[:digit:]]{3})-.*", "\\1", meta$Date)
vers <- paste("R package version", meta$Version)
citEntry(entry="Manual",
title = "AlleleRetain: a stochastic model for simulating allele retention, demography, and inbreeding accumulation in bottlenecked populations",
author = personList(as.person("Emily Weiser")),
author = personList(as.person("Emily L. Weiser")),
year = year,
note = vers,
textVersion =
Expand Down
Binary file added inst/doc/AlleleRetain2.0_User_Guide.pdf
Binary file not shown.
Binary file removed inst/doc/AlleleRetain_User_Guide.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion man/AlleleRetain-package.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ with overlapping generations.

\details{

Typically, the user will run \code{aRetain}, then \code{aRetain.summary} to assess characteristics of the simulated population. \code{indiv.summary} and \code{pedigree.summary} (requires package \bold{pedigree}) will provide further output.
Typically, the user will run \code{aRetain}, then \code{aRetain.summary} to assess characteristics of the simulated population. \code{indiv.summary}, \code{pedigree.summary} (requires package \bold{pedigree}), \code{LRS.summary}, and \code{agerepro.summary} will provide further output.

}
41 changes: 41 additions & 0 deletions man/LRS.summary.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
\name{LRS.summary}
\alias{LRS.summary}

\title{ Summary of Lifetime Reproductive Success }

\description{

List of number of matings for each individual of the specified sex, over whole
lifetime and all years, as simulated by \code{aRetain}. Must be run after
\code{aRetain} is run with \code{trackall = TRUE}.

}
\usage{
LRS.summary(adata, sex)
}

\arguments{
\item{adata}{ list of output from \code{aRetain} }
\item{sex}{ sex to summarize; "male" or "female" }
}


\value{

A matrix with one row for each individual and two columns:

\item{ID}{ ID number of the individual. ID numbers are unique within each replicate, but will be repeated across replicates }
\item{NMatings}{ number of times the individual mated during its lifetime. The
individual-level data is not expected to be useful, but can be used to calculate
the mean or a histogram of mating success }

}
\references{

Weiser, E.L., Grueber, C. E., and I. G. Jamieson. 2012. AlleleRetain: A program
to assess management options for conserving allelic diversity in small, isolated
populations. Molecular Ecology Resources 12:1161-1167.

}

\author{ Emily L. Weiser \email{emily.l.weiser@gmail.com} }
99 changes: 74 additions & 25 deletions man/aRetain.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@ with overlapping generations.
}
\usage{

aRetain(q0 = 0.05, sourceN = Inf, startN = 20, startAge = "juvenile",
startSR = 0.5, exactSR= FALSE, inisurv = 0.90, addN = 0, addyrs = c(0),
migrN = 0, migrfreq = 1, mpriority = FALSE, removeL = FALSE, K = 100,
Klag = 0, KAdults = FALSE, reprolag = 0, mature = 1, matingSys =
"monogamy", matingLength = "seasonal", meanMLRS = 1, sdMLRS = 0,
reproAgeM = c(1:200), AgeOnMLRS = "age/age", nMatings = 1,
retainBreeders = "male", MaxAge = 25, SenesAge = 10, adsurvivalF = 0.80,
adsurvivalM = 0.80, nonbrsurv = 0.80, nonbrsurvK = 0.80, juvsurv =
0.80, juvsurvK = 0.80, youngperF = 1.5, SDypF = 0.25, ypF1 = 1, ypF1yr
= 1, MAXypF = 2, MAXypFK = 2, ypFsex = "female", youngSR = 0.5,
trackall = TRUE, GeneCount = "adult", nyears = 50, nrepl = 100,
nreplprint = 10, printplots = FALSE)
aRetain(q0 = 0.05, sourceN = Inf,
startN = 20, startAge = "juvenile", startSR = 0.5, exactSSR= FALSE,
inisurv = c(1,1,1), addN = 0, addyrs = c(0), addSR = 0.5, exactASR = FALSE,
migrN = 0, migrfreq = 1, migrSR = 0.5, exactMSR = FALSE, mpriority = FALSE,
removeL = FALSE, harvN = 0, harvAge = "all", harvyrs = 0, K = 100, Klag = 0,
KAdults = FALSE, reprolag = 0, mature = 1, matingSys = "monogamy",
matingLength = "seasonal", meanMLRS = 1, sdMLRS = 0, reproAgeM = c(1:200),
AgeOnMLRS = "age/age", nMatings = 1, retainBreeders = "male", MaxAge = 25,
SenesAge = 10, adsurvivalF = 0.80, adsurvivalM = 0.80, nonbrsurv = 0.80,
nonbrsurvK = 0.80, juvsurv = 0.80, juvsurvK = 0.80, youngperF = 1.5,
SDypF = 0.25, ypF1 = 1, ypF1yr = 1, MAXypF = 2, MAXypFK = 2,
ypFsex = "female", youngSR = 0.5, trackall = TRUE, GeneCount = "adult",
nyears = 50, nrepl = 100, nreplprint = 10, printplots = FALSE)

}

Expand All @@ -40,26 +41,47 @@ aRetain(q0 = 0.05, sourceN = Inf, startN = 20, startAge = "juvenile",
and senescence specified below) }
\item{startSR}{ sex ratio (proportion male) of starters, supplementals,
and migrants }
\item{exactSR}{ logical: whether startSR gives the exact sex ratio of
individuals released }
\item{exactSSR}{ logical: whether startSR gives the exact sex ratio
of individuals released }
\item{inisurv}{ initial survival rate, as a proportion (range 0-1), of
starters, supplementals, and migrants immediately post-release; annual
mortality applies after this value is used }
individuals released. Given as a vector, where the first value is for
starters, the second is for additional releases, and third is for migrants.
Annual mortality applies after this value is used. Defaults to 1 for all three
groups. }
\item{addN}{ list of numbers of individuals to release in years soon after
population establishment ("supplementals") }
\item{addyrs}{ list of years in which to release supplementals. Each year
corresponds to the number of individuals in the same position in the addN
list }
\item{addSR}{ sex ratio (proportion male) of supplementals; defaults to 0.5
(must be between 0 and 1). This can be either a single value, or a vector,
with each element in the vector corresponding to each instance of
supplementation (must be the same length as addN)}
\item{exactASR}{ whether addSR gives the exact sex ratio of individuals
released (TRUE) or sexes are assigned randomly based on the probability given
by addSR (FALSE); defaults to FALSE. This can be either a single value, or a
vector, with each element in the vector corresponding to each instance of
supplementation (must be the same length as addN)}
\item{migrN}{ number of migrants to add }
\item{migrfreq}{ interval (number of years) at which to add migrN
migrants; must be between 1 and nyears, below }
\item{migrSR}{ sex ratio (proportion male) of supplementals; defaults to 0.5
(must be between 0 and 1) }
\item{exactMSR}{ whether addSR gives the exact sex ratio of individuals
released (TRUE) or sexes are assigned randomly based on the probability given
by migrSR (FALSE); defaults to FALSE }
\item{mpriority}{ logical: whether migrants are given priority over
locally produced offspring to recruit into any available breeding
vacancies }
\item{removeL}{ logical: whether to remove the corresponding number of
locally produced adults to make room for migrants in the population; only
necessary if retainBreeders = "both"/"female"/"male"; will only come into
play when population is at K }
\item{harvN}{ number to be removed in each harvest year }
\item{harvAge}{ age of individuals to be harvested (as for 'startAge'). If not
enough individuals of this age are available, the harvest quota (harvN) will
not be filled }
\item{harvyrs}{ vector of years in which harvest occurs }
\item{K}{ carrying capacity (population ceiling) }
\item{Klag}{ number of years for which population is held at or below
initial size (breeding still occurs); indicates a prolonged bottleneck }
Expand Down Expand Up @@ -173,13 +195,21 @@ aRetain(q0 = 0.05, sourceN = Inf, startN = 20, startAge = "juvenile",
\item{trackall}{ logical: whether to track all individuals from the
population through the whole simulation; must be TRUE to use indiv.summary
or pedigree.summary after running the simulation }
\item{GeneCount}{ which alleles to count as retained: those in the "adult" population only, or those in "all" individuals (including subadults and other nonbreeders)}
\item{GeneCount}{ which alleles to count as retained: those in the "adult"
population only, or those in "all" individuals (including subadults and other
nonbreeders)}
\item{nyears}{ number of years to run the simulation }
\item{nrepl}{ number of iterations (replicates) to run }
\item{nreplprint}{ interval (number of replicates) at which to print a
message with the current system time. Allows the user to gauge model
progress and to estimate time to completion }
\item{printplots}{ logical: whether to plot the population growth (number of individuals, as defined by KAdults, present each year) and allele frequency (in the pool defined by GeneCount) as they change over time (TRUE or FALSE). One line will be plotted for each replicate immediately after it runs. Can be used to immediately gauge the demographics of the population (e.g. if it will grow as expected); will slow down the simulation by ~ 10-20 percent. Defaults to FALSE. }
\item{printplots}{ logical: whether to plot the population growth (number of
individuals, as defined by KAdults, present each year) and allele frequency (in
the pool defined by GeneCount) as they change over time (TRUE or FALSE). One
line will be plotted for each replicate immediately after it runs. Can be used
to immediately gauge the demographics of the population (e.g. if it will grow
as expected); will slow down the simulation by ~ 10-20 percent. Defaults to
FALSE. }
}
\details{
Expand Down Expand Up @@ -243,21 +273,38 @@ immigrant) in the population. A pedigree summary function
(\code{pedigree.summary}) can be used to describe accumulation of inbreeding
in the population by calling R package \bold{pedigree}.
See the AlleleRetain Model Guide (available as a PDF file with this installation, or from the model's website at https://sites.google.com/site/alleleretain/) for more details and an example.
See the AlleleRetain Model Guide (available as a PDF file with this
installation, or from the model's website at
https://sites.google.com/site/alleleretain/) for more details and an example.

}

\value{
\code{aRetain} returns a list of sub-lists, with one sub-list for each replicate which contains two matrices: one that summarizes the population information for that replicate (one row for each year; columns = number of adults, number of breeding females, number of breeding males, number of copies of the rare allele, number of pairs, number of nonbreeders, number of founders remaining, number of migrants alive, mean age of breeding pairs), and one that gives pertinent information for all individuals in that replicate (one row for each individual; columns = ID, dam, sire, origin [1=starter, 2=supplemental, 3=local, 4=immigrant], birth year, number of years alive in the population, number of years bred, year added to population). The latter matrix includes all individuals if \code{trackall = TRUE}, or only those alive at the end of the simulation if \code{trackall = FALSE}. Run \code{aRetain.summary}, \code{indiv.summary}, and \code{pedigree.summary} to generate useful output from this information (averaged across replicates).
\code{aRetain} returns a list of sub-lists, with one sub-list for each replicate
which contains two matrices: one that summarizes the population information for
that replicate (one row for each year; columns = number of adults, number of
breeding females, number of breeding males, number of copies of the rare allele,
number of pairs, number of nonbreeders, number of founders remaining, number of
migrants alive, mean age of breeding pairs), and one that gives pertinent
information for all individuals in that replicate (one row for each individual;
columns = ID, dam, sire, origin [1=starter, 2=supplemental, 3=local,
4=immigrant], birth year, number of years alive in the population, number of
years bred, year added to population). The latter matrix includes all
individuals if \code{trackall = TRUE}, or only those alive at the end of the
simulation if \code{trackall = FALSE}. Run \code{aRetain.summary},
\code{indiv.summary}, and \code{pedigree.summary} to generate useful output from
this information (averaged across replicates).

}
\references{

Weiser, E.L., Grueber, C. E., and I. G. Jamieson. In review. AlleleRetain: A program to assess management options for conserving allelic diversity in small, isolated populations. Molecular Ecology Resources.
Weiser, E.L., Grueber, C. E., and I. G. Jamieson. 2012. AlleleRetain: A program
to assess management options for conserving allelic diversity in small, isolated
populations. Molecular Ecology Resources 12:1161-1167.

}

\author{ Emily Weiser \email{emily.l.weiser@gmail.com} }
\author{ Emily L. Weiser \email{emily.l.weiser@gmail.com} }

\examples{

Expand All @@ -268,8 +315,10 @@ Weiser, E.L., Grueber, C. E., and I. G. Jamieson. In review. AlleleRetain: A
## monogamous passerine bird species with a 5-yr average lifespan. Only 30
## iterations are run so the confidence intervals will be wide.

\dontrun{

aR.temp <- aRetain(q0 = 0.05, sourceN = 2000, startN = 20, startAge =
"adult", startSR = 0.5, exactSR = FALSE, inisurv = 0.90, addN = 0, addyrs
"adult", startSR = 0.5, exactSSR = FALSE, inisurv = 0.90, addN = 0, addyrs
= c(0), migrN = 5, migrfreq = 10, mpriority = FALSE, removeL = FALSE, K =
100, KAdults = FALSE, mature = 1, matingSys = "monogamy", matingLength =
"seasonal", retainBreeders = "male", MaxAge = 16, SenesAge = 5, adsurvivalF =
Expand All @@ -279,8 +328,8 @@ ypFsex = "female", youngSR = 0.5, trackall = TRUE, GeneCount = "all", nyears =
10, nrepl = 20, nreplprint = 10)

aRetain.summary(aR.temp, GeneCount = "all", alpha=0.05, dropextinct = TRUE)
indiv.summary(aR.temp, genlength=5, alpha=0.05)
pedigree.summary(aR.temp)

}

}

6 changes: 4 additions & 2 deletions man/aRetain.summary.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ population }
}
\references{

Weiser, E.L., Grueber, C. E., and I. G. Jamieson. In review. AlleleRetain: A program to assess management options for conserving allelic diversity in small, isolated populations. Molecular Ecology Resources.
Weiser, E.L., Grueber, C. E., and I. G. Jamieson. 2012. AlleleRetain: A program
to assess management options for conserving allelic diversity in small, isolated
populations. Molecular Ecology Resources 12:1161-1167.

}

\author{ Emily Weiser \email{emily.l.weiser@gmail.com} }
\author{ Emily L. Weiser \email{emily.l.weiser@gmail.com} }


48 changes: 48 additions & 0 deletions man/agerepro.summary.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
\name{agerepro.summary}
\alias{agerepro.summary}

\title{ Summary of Average Reproductive Success by Age }

\description{

average reproductive success, by age and sex, in the final year of the simulation
by \code{aRetain}. Must be run after \code{aRetain} is run with \code{trackall =
TRUE}.

}
\usage{
agerepro.summary(adata, maxage, sex)
}

\arguments{
\item{adata}{ list of output from \code{aRetain} }
\item{maxage}{ value of MaxAge used in \code{aRetain}, or the maximum age of
interest for the summary, whichever is smaller }
\item{sex}{ sex to summarize; "male" or "female" }
}


\value{

A matrix with one row for each age and seven columns:

\item{age}{ age of each individual, from 0 to MaxAge }
\item{alive.mean}{ mean number of individuals that lived to this age }
\item{alive.sd}{ SD across replicates in the number of individuals that lived
to this age }
\item{matings.mean}{ mean number of matings per individual at this age }
\item{matings.sd}{ SD among individuals in matings.mean }
\item{offspring.mean}{ mean number of offspring produced by individuals
of this age }
\item{offspring.sd}{ SD among individuals in offspring.mean }

}
\references{

Weiser, E.L., Grueber, C. E., and I. G. Jamieson. 2012. AlleleRetain: A program
to assess management options for conserving allelic diversity in small, isolated
populations. Molecular Ecology Resources 12:1161-1167.

}

\author{ Emily L. Weiser \email{emily.l.weiser@gmail.com} }
11 changes: 8 additions & 3 deletions man/indiv.summary.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ indiv.summary(adata, genlength, alpha=0.05)

\arguments{
\item{adata}{ list of output from \code{aRetain} }
\item{genlength}{ mean age of simulated individuals (breeding pairs only), as returned by \code{census.summary} (use the MeanAge value where it stabilizes after recovering from any founder age effects) }
\item{genlength}{ mean age of simulated individuals (breeding pairs only), as
returned by \code{census.summary} (use the MeanAge value where it stabilizes
after recovering from any founder age effects) }
\item{alpha}{ confidence level e.g. 0.05 for 95\% intervals}
}

Expand All @@ -35,12 +37,15 @@ bred) }
\item{YrsBredBr}{ mean # of years bred per individual (that bred at least once) }
\item{lifespan}{ mean lifespan in the population }
\item{effectivegen}{ mean # of individuals that bred each generation }
\item{NMatings}{ mean # of total lifetime matings, across individuals }

}
\references{

Weiser, E.L., Grueber, C. E., and I. G. Jamieson. In review. AlleleRetain: A program to assess management options for conserving allelic diversity in small, isolated populations. Molecular Ecology Resources.
Weiser, E.L., Grueber, C. E., and I. G. Jamieson. 2012. AlleleRetain: A program
to assess management options for conserving allelic diversity in small, isolated
populations. Molecular Ecology Resources 12:1161-1167.

}

\author{ Emily Weiser \email{emily.l.weiser@gmail.com} }
\author{ Emily L. Weiser \email{emily.l.weiser@gmail.com} }

0 comments on commit 5d47ba9

Please sign in to comment.