Package Rramas. November 25, 2017

Similar documents
Package replicatedpp2w

Package cgh. R topics documented: February 19, 2015

Package gains. September 12, 2017

Package mlegp. April 15, 2018

Package CINID. February 19, 2015

Package rknn. June 9, 2015

Package anidom. July 25, 2017

Package fbroc. August 29, 2016

Package weco. May 4, 2018

Package PTE. October 10, 2017

Package pvclust. October 23, 2015

Package qicharts. October 7, 2014

Package bootlr. July 13, 2015

Package MTLR. March 9, 2019

Package rpst. June 6, 2017

Package areaplot. October 18, 2017

Package listdtr. November 29, 2016

Package texteffect. November 27, 2017

Package sspline. R topics documented: February 20, 2015

Package EnQuireR. R topics documented: February 19, Type Package Title A package dedicated to questionnaires Version 0.

Package MIICD. May 27, 2017

Package waterfall. R topics documented: February 15, Type Package. Version Date Title Waterfall Charts in R

Package Daim. February 15, 2013

Package hextri. April 22, 2016

Package clustering.sc.dp

Package dyncorr. R topics documented: December 10, Title Dynamic Correlation Package Version Date

Package clustmixtype

Package glinternet. June 15, 2018

Package intccr. September 12, 2017

Package glmmml. R topics documented: March 25, Encoding UTF-8 Version Date Title Generalized Linear Models with Clustering

The simpleboot Package

Package logspline. February 3, 2016

Package JOP. February 19, 2015

Package svmpath. R topics documented: August 30, Title The SVM Path Algorithm Date Version Author Trevor Hastie

Package binmto. February 19, 2015

Package r2d2. February 20, 2015

Package qboxplot. November 12, qboxplot... 1 qboxplot.stats Index 5. Quantile-Based Boxplots

Package RNAseqNet. May 16, 2017

Package MixSim. April 29, 2017

Package RCA. R topics documented: February 29, 2016

Package spcadjust. September 29, 2016

Package fitplc. March 2, 2017

Package CausalImpact

Package Mondrian. R topics documented: March 4, Type Package

Package kofnga. November 24, 2015

Package inca. February 13, 2018

Package OLScurve. August 29, 2016

Package queuecomputer

Package sciplot. February 15, 2013

Package mixphm. July 23, 2015

Package simex. R topics documented: September 7, Type Package Version 1.7 Date Imports stats, graphics Suggests mgcv, nlme, MASS

Package maxnet. R topics documented: February 11, Type Package

Package uclaboot. June 18, 2003

Package swissmrp. May 30, 2018

Package SSRA. August 22, 2016

Package sizemat. October 19, 2018

Package datasets.load

Package corclass. R topics documented: January 20, 2016

Package rafalib. R topics documented: August 29, Version 1.0.0

Package GLDreg. February 28, 2017

Package cumseg. February 19, 2015

Package treedater. R topics documented: May 4, Type Package

Package REGENT. R topics documented: August 19, 2015

Package SAMUR. March 27, 2015

Package ICEbox. July 13, 2017

Package qvcalc. R topics documented: September 19, 2017

Package nplr. August 1, 2015

Package compeir. February 19, 2015

Package Kernelheaping

R topics documented: 2 genbernoullidata

The nor1mix Package. August 3, 2006

Package gems. March 26, 2017

Package fso. February 19, 2015

Package ArCo. November 5, 2017

Package EFS. R topics documented:

Package CorporaCoCo. R topics documented: November 23, 2017

Package longclust. March 18, 2018

Package robets. March 6, Type Package

Package kirby21.base

Package DiffCorr. August 29, 2016

Package logihist. R topics documented: November 17, 2017

Package TPD. June 14, 2018

Package hbm. February 20, 2015

Package lcc. November 16, 2018

The som Package. September 19, Description Self-Organizing Map (with application in gene clustering)

Package munfold. R topics documented: February 8, Type Package. Title Metric Unfolding. Version Date Author Martin Elff

Package optimus. March 24, 2017

Package catenary. May 4, 2018

Getting started with simulating data in R: some helpful functions and how to use them Ariel Muldoon August 28, 2018

The nor1mix Package. June 12, 2007

Package oaxaca. January 3, Index 11

Package visualizationtools

Age & Stage Structure: Elephant Model

Package ClustGeo. R topics documented: July 14, Type Package

Package ECctmc. May 1, 2018

Package simr. April 30, 2018

Package RTConnect. R topics documented: February 19, 2015

Package OptimaRegion

Package manet. September 19, 2017

Package quickreg. R topics documented:

Transcription:

Package Rramas November 25, 2017 Type Package Title Matrix Population Models Version 0.1-5 Date 2017-11-24 Depends diagram Author Marcelino de la Cruz Maintainer Marcelino de la Cruz <marcelino.delacruz@urjc.es> Description Imitating the 'Ramas' (c) software, analyzes and predicts from matrix population models, (Caswell 2006) <doi:10.1002/9781118445112.stat07481>. License GPL (>= 2) LazyLoad yes NeedsCompilation no Repository CRAN Date/Publication 2017-11-24 23:30:07 UTC R topics documented: as.tmatrix.......................................... 2 coryphanthaa........................................ 3 decline............................................ 4 projectn........................................... 5 Index 10 1

2 as.tmatrix as.tmatrix Population Transition Matrix Description Convert a matrix to transition matrix (class tmatrix) and display some of its properties. Usage as.tmatrix(x, names.st = NULL,...) ## S3 method for class 'tmatrix' plot(x,...) ## S3 method for class 'tmatrix' print(x,...) ## S3 method for class 'tmatrix' summary(object,...) ## S3 method for class 'summary.tmatrix' print(x,...) Arguments x Details object names.st For as.tmatrix, x is a square matrix,; for the plot, print and summary methods,x is a matrix of class tmatrix. An object of class tmatrix, i.e, resulting from as.tmatrix. A vector of names to rename the rows and columns of the transition matrix.... Other parameters passed to print and plot methods. The purpose of as.tmatrix is to class a transition matrix as an object of class tmatrix, allowing the use of specific methods for transition matrices. Value as.tmatrix returns a matrix of class tmatrix. summary.tmatrix prints the main parameters of the transition matrix: the finite rate of increase ("lambda"), the stable stage distribution, the reproductive value and the sensitivities and elasticities matrices. This function is equivalent to the "Display" button in Ramas-EcoLab (r) software. plot.tmatrix draw barplots of the stable stage distribution and the reproductive value and plot also a diagram of the life stage cycle. Author(s) Marcelino de la Cruz Rot

coryphanthaa 3 References Akcakaya, H. R., Burgman, M. A. and Ginzburg L.R. 1999. Applied Population Ecology. Sinauer. Caswell, H. 2003. Matrix Population Models: Construction, Analysis, and Interpretation. Sinauer. Examples data(coryphanthaa) coryphanthaa coryphanthaa <- as.tmatrix(coryphanthaa) summary(coryphanthaa) plot(coryphanthaa) coryphanthaa Transition Matrices of Three Coryphantha robbinsorum Populations Description Transition matrices of three Coryphantha robbinsorum populations. Usage data(coryphanthaa) Format 3x3 matrix. Source Although the original data are from Schmalzel et al (1995), these matrices have been transcribed from Gurevitch et al. (2002). References Gurevitch, J., Scheiner, S. M. and Fox, G. A. 2002. The Ecology of Plants. Sinauer. Schmalzel, R.J., F.W. Reichenbacher, and S. Rutman. 1995. Demographic study of the rare Coryphantha robbinsorum (Cactaceae) in southeastern Arizona. Madrono 42:332-348. Examples data(coryphanthaa)

4 decline decline Compute Declination and Explosion Probabilities Description Compute declination (or explosion) probabilities for a stage-structured population. From a vector of initial stage abundances and a transition matrix, decline and explosion compute respectively the probability that the population size falls below or surpasses some abundance thresholds during a given time interval. Usage decline(rmas, bootsp = 1000) explosion(rmas, bootsp = 1000) ## S3 method for class 'rmas.risk' summary(object, q = c(0.025, 0.975),...) ## S3 method for class 'summary.rmas.risk' plot(x, ylim = NULL, col = NULL, xlab = NULL, ylab = NULL, main = NULL,...) Arguments rmas An object of class rmas,i.e., resulting from projectn. bootsp number of botstraped samples. object An object of class rmas.rsik, i.e. resulting from declineor explosion. x An object of class summary.rmas.rsik. q vector of quantiles to compute bootstraped confidence intervals. ylim Vector with max and min values of the y (abundances) axis. col Color or vector of colors to draw the trajectories. xlab Label for the x-axis. ylab Label for the y-axis. main Text to appear as title.... Other parameters passed to plot and other methods. Details Both decline and explosion require that some stochastic simulations for a given time interval had been previously constructed (using projectn). Using those simulations decline computes the probability of falling bellow some population threshold (and explosion the probability of surpassing it) as the ratio between the number of times that these threshold has been attained and the number of replications. The set of abundances in each time interval (in all the simulations) are bootstraped (i.e. sampled with replacement) to build a confidence interval.

projectn 5 Value Both decline and explosion return an object of class rmas.rsik, basically a list with the following elements cf.obs cf.boot abminbot main a data.frame with the evaluated thresholds and their probabilities. a list of data.frames similar to cf.obs for each bootstraped sample. a list of bootstraped minimum (or maximum for explosion) abundances for each replica in the rmas object. Text to appear as title when plotting the summary. The methods summary and plot.summary summarize the results and print and plot probabilities and bootstraped confidence interval of attainning a particular population threshold. Author(s) Marcelino de la Cruz Rot References Akcakaya, H. R., Burgman, M. A. and Ginzburg L.R. 1999. Applied Population Ecology. Sinauer. Caswell, H. 2003. Matrix Population Models: Construction, Analysis, and Interpretation. Sinauer. Examples data(coryphanthaa) coryphanthaa <- as.tmatrix(coryphanthaa) #initial abundances: v0 <- c(100,0,0) # run 1000 simulations of 20 years with demographic stochasticity: simu20.ds <- projectn(v0=v0, mat=coryphanthaa, time = 20, estdem=true, nrep=1000) # compute declination probabilities simu20.ds.dec <- decline(simu20.ds) summary(simu20.ds.dec) projectn Demographic Projections Description Make deterministic and stochastic demographic projections according to a transition matrix.

6 projectn Usage projectn(v0, mat, matsd = NULL, estamb = FALSE, estdem = FALSE, equalsign = TRUE,stmat=NULL, fecundity1=true, nrep = 1, time = 10, management=null, round=true) project1(v0, mat, matsd=null, estamb=false, estdem=false, equalsign=true, stmat=null, fecundity1=true) estambi(mat, matsd, equalsign) estdemo(v0,mat,stmat=null, fecundity1=true) ## S3 method for class 'rmas' plot(x, sum = TRUE, mean=false, type="l", harvest=false,...) ## S3 method for class 'rmas' summary(object, stage=null, harvest=false,...) ## S3 method for class 'summary.rmas' plot(x, ylim=null, col=null, xlab=null, ylab=null, main=null,...) Arguments v0 mat matsd estamb estdem equalsign stmat fecundity1 nrep time management round object x Vector with the initial abundance of each stage. Transition matrix. Matrix with the standard deviation of the probabilities in mat. Logical. Should environmental stochasticity be considered to projet the dynamics of the population? Logical. Should demographic stochasticity be employed to project the dynamics of the population? Logical. Should the environmental deviations have all the same sign and magnitude? See details section. Matrix indicating for each transition probability in mat which part (i.e. which proportion) should be considered resulting from fecundity (and the rest will be considered resulting from survival). See details. Logical. Should the first row of mat be considered exclusively as fecundities? See details Number of replications to evaluate the effects of stochasticity. length of the demographic trajectory Vector (or matrix) of management actions to be applied each time step. Logical. Should the projections be rounded to the next integer each time step (i.e. consider finite indiviuals)? An object of class rmas, i.e. resulting from projectn. An object resulting from projectn or summary.rmas. stage Print only the trajectory of the stage called... harvest Logical. Should the harvest history be summarized or ploted instead of the population one? sum Logical. If TRUE, print the trajectory of the whole population. If FALSE, print the individual trajectory of all stages.

projectn 7 mean type ylim col xlab ylab main Details Logical. If TRUE, print the mean trajectory of all replications. If FALSE, print all the replicated trajectories. Type of plot to represent the trajectories. By default, a line. Vector with max and min values of the y (abundances) axis. Color or vector of colors to draw the trajectories. Label for the x-axis. Label for the y-axis. Text to appear as title.... Other parameters passed to plot and other methods. The function projectn makes demographic proyections by repetedly calling (as long as the time argument) to project1. If no environmental or demographic stochasticity is required, project1 will multiply the transition matrix mat by the vector of stage abundances. If demographic stochasticity is required, project1 will call to estdemo function, that for each time will assign abundances to each stage based in sampling from both a binomial and a poisson distribution. Sampling from rbinom with probability mat[i,j] will assign "survival" chances to each individual accounted for in the abundance vector, i.e. it would allow some of them to remain in the same stages (for transitions mat[i,i]) or to pass to another stage (for transitions mat[i,j]). Sampling from rpois with mean mat[i,j] will assign to each individual of stage[j] a random number of offspring of type stage[i]. In the current implementation there are 3 options to generate demographic stochasticity. By deafult ( stmat=null and fecundity1=true) probabilities in the first row of the transition matrix (i.e mat[1,j]) are assumed to represent only fecundities, i.e., they would not account for "survival" transitions from stage[j] to stage[1], but only for newborns. This means that these probabilities will only be used as the mean for sampling from rpois. Transitions in rows others than first row will be assumed to represent "survival" transitions if its value is <=1 and accordingly will be employed to sample from rbinom. Transitions >1 will be assumed to represent fecundities and will be employed to sample from rpois. If stmat=null and fecundity1=false transition probabilities in all the rows of the matrix mat are treated in the same way, i.e. probabilities <=1 will be sampled from rbinom and probabilities >1 will be sampled from rpois. If a stmat matrix (a matrix with values between 0 and 1) is provided, it will be used to divide transition probabilities mat[i,j] into fecundities (mat[i,j] * stmat[i,j]) and survival probabilities (mat[i,j] - (mat[i,j] * stmat[i,j])) and these matrices will be used to sample from rbinom and rpois respectively. The current implementation of estdemo assumes that reproduction takes place before "survival sorting", so even for individuals that wouldn t survive (according to its sampled binomial probability) offspring is computed (if approppriate) and accounted for. If environmental stochasticity is required (i.e., a matsd matrix is provided), project1 will call to estambi function, that for each time will change mat[i,j] probabilities sampling from rnorm with mean= mat[i,j] and sd = matsd[i,j]. If equalsign=true the random changes in all cells of mat will have the same sign and the same magnitude (relative to each individual matsd[i,j]). If equalsign=false every transition probability will change independently.

8 projectn Value If both environmental and demographic stochasticity are required project1 will call first to estambi and using the modified mat will call to estdemo. If management is required, a vector or matrix of magement actions should be provided. In the simplest case (i.e., a vector), each element in the vector will be interpreted as the management action that will be applied each time step to the corresponding stage. Positive and negative elements in the vector represent respectively the introduction or extraction of individuals from the corresponding stage. Elements whose absolute value is >= 1 will be interpreted as the introduction or extraction of exactly that number of individuals; absolute values < 1 will be interpreted as the introduction or extraction of that proportion of individuals from the existing individuals in the corresponding stage. If "management" is a matrix, each time step the management actions represented by each column of the matrix will be applied sequentially, from first to last. project1, estdemo and estambi return a vector of stage abundances with the same length that v0. projectn return an object of class rmas, basically a list with four elements: vn, with length = (nrep) where each of its elements represents a replicate simulation and consist of a matrix of dimensions [lengtth(v0), time] representing the abundance of each stage at each time. If the simulation included management actions, harvest will be a list of length (nrep) where each of its elements represents the trajectory of harvest in a replicate simulation and consist of a matrix of dimensions [lengtth(v0), time] representing the number of individuals extracted of each stage at each time. The other two elements, mat and management, are respectively the transition matrix and the managenet matrix employed in the simulations. The plot method will draw the demographic trajectory of the population. By default (sum = TRUE, mean=false) it will plot the abundance of the whole population (i.e. the the sum of abundances in each stage) vs. time. If nrep >1 it will plot together the trajectory of each replicated population. If ( sum = TRUE, mean=true) it will plot the mean of all repplicated populations. If (sum = FALSE, mean=true) it wil plot the abundance (or the mean abundance in all the replications) of each stage vs. time. The summary and plot.summary methods will print a table and draw a plot respectively with the maximun, mean + 1 sd, mean, mean - 1 sd and minimum values of population abundance in all the simulations. Author(s) Marcelino de la Cruz Rot References Akcakaya, H. R., Burgman, M. A. and Ginzburg L.R. 1999. Applied Population Ecology. Sinauer. Caswell, H. 2003. Matrix Population Models: Construction, Analysis, and Interpretation. Sinauer. Examples data(coryphanthaa) coryphanthaa <- as.tmatrix(coryphanthaa) # run a deterministic simulation of 20 years from an initial state of # 100 small juveniles:

projectn 9 v0 <- c(100,0,0) simu20 <- projectn(v0=v0, mat=coryphanthaa, time = 20) plot(simu20, sum=false) summary(simu20) # run 100 simulations of 20 years with demographic stochasticity: simu20.ds <- projectn(v0=v0, mat=coryphanthaa, time = 20, estdem=true, nrep=100) plot(simu20.ds) summary(simu20.ds) # run 100 simulations of 20 years with demographic stochasticity but # assuming that the first row of the transition matrix represent both # fecundity and survival, each with a 50% contribution # first generate the stmat matrix: stmat <- (coryphanthaa >0) stmat <- stmat*c(0.5,0,0) stmat simu20.ds2 <- projectn(v0=v0, mat=coryphanthaa, time = 20, estdem=true, stmat=stmat, nrep=100) plot(simu20.ds2) summary(simu20.ds2) # run 100 simulations of 20 years with both demographic and environmental # stochasticity: # first generate a sd matrix to describe environmental stochasticity: sdenv <- coryphanthaa/20 sdenv simu20.eds <- projectn(v0=v0, mat=coryphanthaa, matsd =sdenv, time = 20, estdem=true,estamb=true, nrep=100) plot(simu20.eds) summary(simu20.eds) # Example of management actions # each time step, 10 individuals will be added to the first stage,10 individuals # will be added to the second stage, and 50 percent of the individuals in the # third stage will be extracted man <- c(10, 10, -0.5) p1 <- projectn(v0 = c(100, 100,100), mat= coryphanthaa, management=man) # summarize and plot population trajectory summary(p1) # summarizes and plots harvest history summary(p1, harvest=true)

Index Topic algebra as.tmatrix, 2 projectn, 5 Topic datasets coryphanthaa, 3 Topic models as.tmatrix, 2 decline, 4 projectn, 5 as.tmatrix, 2 coryphanthaa, 3 coryphanthab (coryphanthaa), 3 coryphanthac (coryphanthaa), 3 decline, 4, 4 estambi (projectn), 5 estdemo (projectn), 5 explosion, 4 explosion (decline), 4 plot.rmas (projectn), 5 plot.summary.rmas (projectn), 5 plot.summary.rmas.risk (decline), 4 plot.summary.tmatrix (as.tmatrix), 2 plot.tmatrix (as.tmatrix), 2 print.summary.tmatrix (as.tmatrix), 2 print.tmatrix (as.tmatrix), 2 project1 (projectn), 5 projectn, 4, 5 rbinom, 7 rnorm, 7 rpois, 7 summary.rmas (projectn), 5 summary.rmas.risk (decline), 4 summary.tmatrix (as.tmatrix), 2 10