Chapter 3 Preliminaries II: Data Formatting

The most merciful thing in the world, I think, is the inability of the human mind to correlate all its contents.

— H.P. Lovecraft, The Call of Cthulhu

Matrix projection models are estimated with demographic data. Regardless of whether the goal is a set of raw (empirical) or function-based matrices, the dataset used needs to follow a particular format to make the estimation of elements or vital rate models possible. Package lefko3 utilizes a standardized format similar to formats required by other protocols, such as the projection.matrix() function in package popbio. However, unlike other packages, lefko3 includes functions that can standardize a variety of starting dataset formats into the right format. These functions likely do not cover all possibilities, but deal with most of the interesting differences among the protocols that different demographers use.

The format used in analysis is similar to what one would expect in setting up a data frame for a linear model in R or another statistical analysis environment. If we start with a record of observations of a single individual across several years, where each observation was conducted during a single monitoring session per time interval (such as year), then our data needs to be formatted in a way that allows us to assess at the very least whether the state of an individual at some time depends on the state at the previous time. For a historical model, this dependence extends one further time step back, meaning that we have to be able to assess demographic patterns across groups of three consecutive monitoring times.

In order to analyze these patterns of dependence, we break the data up into pairs of consecutive observation times (or groups of three consecutive times if analyzing historical models). These broken up pairs are then stacked together into a data frame. For example, if we have data for an individual in years 2010, 2011, 2012, and 2013, then we would break up these data into a data set for the years 2010 and 2011, followed by the years 2011 and 2012, followed by the years 2012 and 2013 (if historical, then we would break up 2010-2011-2012, followed by 2011-2012-2013). In terms of the language of matrix projection models, these standardized datasets are arranged with time t followed by time t+1 if ahistorical, and time t-1, followed by time t, followed by time t+1 if in historical format. Thinking of this in terms of the language of linear modeling, individual status in the final time in each group can be viewed as the response variable, while status in the previous one or two times can be seen as the causal variable(s). We refer to this stacked format as vertical format, because it stretches the data for a single individual vertically across rows. This format can be further divided into historically-formatted vertical (hfv) format (Shefferson et al. 2021), in which groups of three consecutive monitoring times are stacked, and ahistorically-formatted vertical (ahfv) format, in which pairs of consecutive years are stacked. Note that analysis in lefko3 requires historically-formatted vertical (hfv) format.

The different aspects of the states of individuals can be described by different variables per observation time. There may be one or more measures of size, an age metric, a measure of reproductive status, and perhaps fecundity, among other variables. Each monitoring occasion should have the same variables for use in analysis. Thus, concatenating states for consecutive pairs or triplets of times in this way will generally result in data frames with many more than two or three columns. Stacking the data in this fashion also ends up typically leading to multiple rows of data originating from the same individual. Until recently, these rows were treated as independent data points, and the simplest analyses still assume independence. However, if a separate variable is created to record the identity of the individual across rows within the dataset, then the non-independence of data points can be dealt with statistically by treating individual identity as a random factor in mixed modeling of vital rates (more on this in later chapters).

3.1 Kinds of individual state variables that may be included

What sorts of variables can be handled in MPM analysis through lefko3? Because this package was originally developed to handle historical size-classified Lefkovitch models, it can of course handle size variables. From version 4.0.0 onward, up to three different size variables can be included in a single analysis. However, lefko3 can handle many, many more variables. At the very least, variables denoting reproductive status and fecundity can be included. These three groups of variables - size, reproductive status, and fecundity - are the classic three variable types used for classification purposes in stage-based models. Wildlife demographers may be more interested in age than size, and so age at each time can also be included. In fact, lefko3 automates the estimation of age and related variables, such as observed age at time t and observed lifespan, and can be used to estimate both Leslie (age-based) and age-by-stage MPMs. Plant demographers may be particularly interested in variables denoting observation status, which is a binomial variable used to denote whether an individual is in an observable stage (lefko3 can automate the identification of these occurrences within the dataset). Some ecologists may also be interest in using multiple measures of reproductive status and fecundity, since many plants and animals have multiple modes of reproduction, and often actual fecundity cannot be accurately known and so must be estimated.

Identity variables may be included and used in analysis. Such variables include population identity, patch identity or subpopulation identity, individual identity, and monitoring occasion or time (denoting the time at time t). Package lefko3 can use these to subset the data accordingly, and also to estimate variables such as observed age at timet and observed lifespan. If the user has already determined stages for all individuals at all times, then these data may be incorporated as well (although lefko3 can automatically assign stages).

Demographers commonly include censoring variables to denote data points that are suspect. These can also be included in lefko3, and those data points can also be easily removed from analysis. For example, individuals with damaged tags from which identity cannot be properly read can be marked differently in a censor variable, and analyses can then be performed with and without these potentially biasing data. Alternatively, ornithologists may mark individuals with partially missing bands with censor variables. Censor data can be added once per individual, or for each individual in each monitoring occasion.

Spatial coordinates can be included in datasets. When used, spatial coordinates should be Cartesian, and so paired as X-Y coordinates. Package lefko3 includes automated density estimation, and so these coordinates can be used to estimate spatial density.

Finally, variables can be included covering status as alive or dead, status as observed or unobserved, and up to three separate individual or environmental covariates that can be numeric or categorical. Individual covariates may be particularly useful as a means to include environmental variables, or further information on status, such as management regime or presence of injury.

3.2 Formatting demographic data properly for analysis

Regardless of how the dataset should be structured for analysis, demographers themselves often have their own ways of structuring data. In general, most demographers keep their data either in some variant of vertical format (explained above), or in some variant of horizontal format, in which the data for each single individual spans only a single row that contains all data on state across all monitoring occasions. In figure 3.1, we see an example of an ahistorically-formatted vertical dataset. In figure 3.2, we see an example of a horizontally-formatted dataset.

Figure 3.1: Vertically-formatted dataset covering the Cypripedium candidum data

Figure 3.2: Horizontally-formatted dataset covering the Cypripedium candidum data

Every demographer has their own way of keeping data, and I personally do not feel it is up to me to judge (the level of chaos in my own record-keeping prevents me from making any harsh judgments). I have therefore created two powerful functions that can take most datasets falling into these two general types and standardize them into formats that can be analyzed by lefko3. These functions are verticalize3() and historicalize3(). We will start by describing the former.

3.3 Function verticalize3()

Many demographers (including the author) prefer horizontal data formats for demographic record-keeping. Here, individual life histories are recorded in a spreadsheet with each unique individual’s data organized within a single row. The columns then correspond to descriptor variables and to condition at different times. This format has the advantage that of making an individual’s resighting history easy to analyze even by eye, since it must occur all within a single row. In these circumstances, the verticalize3() function can standardize these data into hfv format.

The verticalize3() function takes a number of inputs. Naturally, it needs the data frame being used for analysis (the data field). It also requires input corresponding to the number of monitoring occasions that the dataset covers (field noyears), and which columns identify the population, patch or subpopulation, and individual (fields popidcol, patchidcol, and individcol, respectively).

After these most basic of fields have been entered, the columns conveying each kind of demographic variable need to be identified (this is a very flexible function, so only those variables that actually occur in the dataset need be identified and all others can be ignored). Up to three separate size variables can be identified (sizeacol, sizebcol, and sizeccol), as can up to two reproductive status variables (repstracol and restrbcol), and up to two fecundity variables (fecacol and fecbcol). These variables will naturally repeat across monitoring occasions, and so each variable represents as many actual columns as monitoring occasions covered by the dataset.

To ensure that R finds all columns corresponding to a variable, the user may take one of two approaches. The most flexible is to treat each input field as a vector, and to input the name or column number of each variable in order of monitoring occasion. For example, if we decided to use only one size variable, perhaps the height of a plant in centimeters, and this variable is labelled ht.2010, ht.2011, ht.2012, and ht.2013 for the years 2010, 2011, 2012, and 2013, the we can input:

sizeacol = c("ht.2010", "ht.2011", "ht.2012", "ht.2013").

All other variables covering status across time can be input in the same way, yielding equal length vectors in the same temporal order.

Alternatively, if the data is arranged such that each monitoring occasion has its data arranged in a strictly repeating order, and each variable is a fixed number of columns away from the equivalent variable in the preceding time and in the next time, then only the first of these columns needs to be designated, and the blocksize field can be set to the number of columns separating these entries. In the plant height example, if each size variable is 10 columns after the previous size variable and this pattern holds for all other variable types, then this would mean entering only

noyears = 4, blocksize = 10, sizeacol = "ht.2010"

Note that the use of the blocksize option absolutely requires that each instance of a particular variable occurs exactly blocksize columns after the previous instance, with no exceptions allowed. Users who occasionally add empty columns here and there in their dataset will likely find mistakes in the resulting standardization if they do not make sure that the exact number of columns between instances is always the same.

While standardizing the data, function verticalize3() can also assign stage designations if given a proper stageframe (the stageassign field). For this purpose, lefko3 also needs the proper size variable designations. Currently, the options include:

  • sizea, sizeb, or sizec if only one of these size metrics determines stage
  • sizeab, sizeac, or sizebc if stage assignment is based on a pair of size metrics
  • sizeabc if stage assignment should utilize three size metrics; or
  • sizeadded, if stage assignment should proceed on the basis of the sum of all used size metrics.

Stage assignment is automated using these size metrics as well as reproductive status, observation status, and status as propagule, immature, and mature. Stage assignment will yield warnings and unassigned stages if any combination of variables is found in the demographic dataset that does not fit exactly one stage in the stage frame. We also encourage the use of this function without stage assignment on the first pass, since this will allow users to explore the data more fully prior to the development of a life history model and stageframe.

Function verticalize3() includes a few more fields of interest. The repstrrel and fecrel fields provide means of equalizing reproductive status variables and fecundity variables, respectively, that are set on different scales. For example, if two reproductive status variables are used - the first covering single-flowered individuals and the second covering double-flowered individual - then setting repstrrel = 2 will tell R that the second variable counts for twice the reproductive status of the first. The same applies to fecundity, if two different fecundity measures are used.

Demographers using censoring variables will find powerful options in this function. First, censorcol can be set to a static censor variable covering an individual’s entire resighting history, or to censor variables across time. This can be set with the censorRepeat field, which defaults to FALSE and so assumes that censor values do not vary across time. The value of the censor variable used to denote which individuals to keep can be set to any numeric value (the censorkeep option). The default is censorkeep = 0, meaning that any data points marked 0 are considered OK, while any other value is assumed to be subject to removal. Any character or numeric value may be used to mark data to keep, even NA. Finally, if all options are set as described, then function verticalize3() will format the data with censor variables but will not remove any data points. To force verticalize3() to remove censored data points, set censor = TRUE.

Function verticalize3() can handle spatial coordinates, and can even estimate spatial density. Cartesian coordinates for each individual are assumed to be a single set. However, if coordinates can change across time and each time point has its own set of coordinates for each individual present, then users can set coordsRepeat = TRUE. If the intent in using these coordinates is to estimate spatial density, then this function will calculate the number of individuals within some radius of each focal individual in each monitoring time if given the length of the radius to use via option spacing (e.g. spacing = 1 sets the distance radius to check for other individuals nearby at one unit of distance).

This function includes further parameters handling miscellaneous cases. First, demographers often treat missing data as blanks within their spreadsheets. Setting NAas0 = TRUE tells R to interpret missing data as zeros. This can be useful in many circumstances. For example, if fecundity is estimated as the number of flowers per individual in a plant demographic study, but the number of flowers per individual is only recorded if flowers actually exist, then setting NAas0 = TRUE can allow 0 values to be incorporated in analyses of this fecundity variable when no data were entered for flower number. Second, the NRasRep option allows stage classification to proceed without matching stage reproductive characteristics to the data. For example, if stages are defined such that mature stages are reproductive but it is nonetheless possible for fecundity to equal 0, then setting NRasRep = TRUE tells R not to use reproductive status in stage classification. Otherwise, R will assume that a mature individual that produces offspring is in a different stage than a mature individual that does not, leading to warnings, unassigned stages, and further difficulties if the stageframe does not include stages to cover the non-reproductive category. Third, the NAasObs option provides a means of telling R that unobservable stages should be treated as observed during stage classification, if set to TRUE (the default is FALSE). Fourth, the reduce option, if set to TRUE, will tell R that any columns in the output dataset with a single constant value across all rows should be removed, as invariant variables yield no influence on response variables. Fifth, the a2check field should generally be kept to FALSE (the default), but if set to TRUE, then the resulting standardized dataset will include data for individuals not alive in time t (these instances are removed automatically under the default, since it is only individuals alive in time t that can transition to anything in time t+1). This function also assumes that monitoring studies are conducted using pre-breeding life history models, making the earliest observed age be 1 time unit. To set to post-breeding, set prebreeding = FALSE. Finally, the age_offset option can be used to add a specific number to all ages, as might happen if the first few years of life cannot be monitored.

3.3.1 An example of verticalize3()

Now that we have explained the options, let’s standardize data frames for the stageframes created in the last chapter (chapter 2). Let’s first standardize the vertical dataset for the raw MPM. For this purpose, we will utilize the verticalize3() function. Because we are lumping reproductive and non-reproductive individuals into the non-dormant adult classes, we need to set NRasRep = TRUE. Otherwise, verticalize3() will attempt to use the reproductive status of individuals in classification, and will fail due to the presence of non-reproductive adults. We also need to set NAas0 = TRUE to make sure that NA values in size are turned into 0 entries where necessary, and so aid in the assignment of the vegetative dormancy stage. Note that we will set up three different size variables here, as sizea, sizeb, and sizec, and that we will tell R that we want overall stage classification size to be the sum of these (stagesize = "sizeadded"). Finally, since the individuals in this dataset must be at least five years old when they are first seen as adults, we will use the age_offset option to adjust the estimated age.

cypraw_v1 <- verticalize3(data = cypdata, noyears = 6, firstyear = 2004, 
  patchidcol = "patch", individcol = "plantid", blocksize = 4,
  sizeacol = "Inf2.04", sizebcol = "Inf.04", sizeccol = "Veg.04",
  repstracol = "Inf.04", repstrbcol = "Inf2.04", fecacol = "Pod.04",
  stageassign = cypframe_raw, stagesize = "sizeadded", NAas0 = TRUE,
  NRasRep = TRUE, age_offset = 4)

Let’s now take a look at a summary of this dataset. We have two options for this. First, we could use R’s summary() function, which would treat our new historically vertically (hfv) formatted dataset as a standard data frame and use the standard summary procedure for data frames. Or, we may use lefko3’s summary_hfv() function, which gives us a little extra information.

summary_hfv(cypraw_v1)
> 
> This hfv dataset contains 320 rows, 54 variables, 1 population, 
> 3 patches, 74 individuals, and 5 time steps.
>      rowid       popid  patchid   individ              year2     
>  Min.   : 1.00   :320   A: 93   Length:320         Min.   :2004  
>  1st Qu.:21.00          B:154   Class :character   1st Qu.:2005  
>  Median :37.50          C: 73   Mode  :character   Median :2006  
>  Mean   :38.45                                     Mean   :2006  
>  3rd Qu.:56.00                                     3rd Qu.:2007  
>  Max.   :77.00                                     Max.   :2008  
>    firstseen       lastseen        obsage       obslifespan   
>  Min.   :2004   Min.   :2004   Min.   :5.000   Min.   :0.000  
>  1st Qu.:2004   1st Qu.:2009   1st Qu.:6.000   1st Qu.:5.000  
>  Median :2004   Median :2009   Median :7.000   Median :5.000  
>  Mean   :2004   Mean   :2009   Mean   :6.853   Mean   :4.556  
>  3rd Qu.:2004   3rd Qu.:2009   3rd Qu.:8.000   3rd Qu.:5.000  
>  Max.   :2008   Max.   :2009   Max.   :9.000   Max.   :5.000  
>      sizea1             sizeb1            sizec1       size1added    
>  Min.   :0.000000   Min.   : 0.0000   Min.   : 0.0   Min.   : 0.000  
>  1st Qu.:0.000000   1st Qu.: 0.0000   1st Qu.: 0.0   1st Qu.: 0.000  
>  Median :0.000000   Median : 0.0000   Median : 1.0   Median : 2.000  
>  Mean   :0.009375   Mean   : 0.7469   Mean   : 1.9   Mean   : 2.656  
>  3rd Qu.:0.000000   3rd Qu.: 1.0000   3rd Qu.: 3.0   3rd Qu.: 4.000  
>  Max.   :1.000000   Max.   :18.0000   Max.   :13.0   Max.   :21.000  
>     repstra1          repstrb1            feca1          juvgiven1
>  Min.   : 0.0000   Min.   :0.000000   Min.   :0.0000   Min.   :0  
>  1st Qu.: 0.0000   1st Qu.:0.000000   1st Qu.:0.0000   1st Qu.:0  
>  Median : 0.0000   Median :0.000000   Median :0.0000   Median :0  
>  Mean   : 0.7469   Mean   :0.009375   Mean   :0.2656   Mean   :0  
>  3rd Qu.: 1.0000   3rd Qu.:0.000000   3rd Qu.:0.0000   3rd Qu.:0  
>  Max.   :18.0000   Max.   :1.000000   Max.   :7.0000   Max.   :0  
>    obsstatus1       repstatus1       fecstatus1       matstatus1    
>  Min.   :0.0000   Min.   :0.0000   Min.   :0.0000   Min.   :0.0000  
>  1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:1.0000  
>  Median :1.0000   Median :0.0000   Median :0.0000   Median :1.0000  
>  Mean   :0.7469   Mean   :0.2875   Mean   :0.1344   Mean   :0.7688  
>  3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:0.0000   3rd Qu.:1.0000  
>  Max.   :1.0000   Max.   :1.0000   Max.   :1.0000   Max.   :1.0000  
>      alive1          stage1           stage1index         sizea2        
>  Min.   :0.0000   Length:320         Min.   : 0.000   Min.   :0.000000  
>  1st Qu.:1.0000   Class :character   1st Qu.: 6.000   1st Qu.:0.000000  
>  Median :1.0000   Mode  :character   Median : 8.000   Median :0.000000  
>  Mean   :0.7688                      Mean   : 6.144   Mean   :0.009375  
>  3rd Qu.:1.0000                      3rd Qu.: 8.000   3rd Qu.:0.000000  
>  Max.   :1.0000                      Max.   :11.000   Max.   :1.000000  
>      sizeb2            sizec2         size2added        repstra2      
>  Min.   : 0.0000   Min.   : 0.000   Min.   : 0.000   Min.   : 0.0000  
>  1st Qu.: 0.0000   1st Qu.: 1.000   1st Qu.: 1.000   1st Qu.: 0.0000  
>  Median : 0.0000   Median : 2.000   Median : 2.000   Median : 0.0000  
>  Mean   : 0.8969   Mean   : 2.416   Mean   : 3.322   Mean   : 0.8969  
>  3rd Qu.: 1.0000   3rd Qu.: 3.000   3rd Qu.: 4.000   3rd Qu.: 1.0000  
>  Max.   :18.0000   Max.   :13.000   Max.   :24.000   Max.   :18.0000  
>     repstrb2            feca2          juvgiven2   obsstatus2    
>  Min.   :0.000000   Min.   :0.0000   Min.   :0   Min.   :0.0000  
>  1st Qu.:0.000000   1st Qu.:0.0000   1st Qu.:0   1st Qu.:1.0000  
>  Median :0.000000   Median :0.0000   Median :0   Median :1.0000  
>  Mean   :0.009375   Mean   :0.2906   Mean   :0   Mean   :0.9531  
>  3rd Qu.:0.000000   3rd Qu.:0.0000   3rd Qu.:0   3rd Qu.:1.0000  
>  Max.   :1.000000   Max.   :7.0000   Max.   :0   Max.   :1.0000  
>    repstatus2       fecstatus2       matstatus2     alive2     stage2         
>  Min.   :0.0000   Min.   :0.0000   Min.   :1    Min.   :1   Length:320        
>  1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:1    1st Qu.:1   Class :character  
>  Median :0.0000   Median :0.0000   Median :1    Median :1   Mode  :character  
>  Mean   :0.3688   Mean   :0.1562   Mean   :1    Mean   :1                     
>  3rd Qu.:1.0000   3rd Qu.:0.0000   3rd Qu.:1    3rd Qu.:1                     
>  Max.   :1.0000   Max.   :1.0000   Max.   :1    Max.   :1                     
>   stage2index         sizea3             sizeb3           sizec3      
>  Min.   : 6.000   Min.   :0.000000   Min.   : 0.000   Min.   : 0.000  
>  1st Qu.: 7.000   1st Qu.:0.000000   1st Qu.: 0.000   1st Qu.: 1.000  
>  Median : 8.000   Median :0.000000   Median : 0.000   Median : 1.000  
>  Mean   : 7.919   Mean   :0.009375   Mean   : 1.069   Mean   : 2.209  
>  3rd Qu.: 8.000   3rd Qu.:0.000000   3rd Qu.: 1.000   3rd Qu.: 3.000  
>  Max.   :11.000   Max.   :1.000000   Max.   :18.000   Max.   :13.000  
>    size3added        repstra3         repstrb3            feca3       
>  Min.   : 0.000   Min.   : 0.000   Min.   :0.000000   Min.   :0.0000  
>  1st Qu.: 1.000   1st Qu.: 0.000   1st Qu.:0.000000   1st Qu.:0.0000  
>  Median : 2.000   Median : 0.000   Median :0.000000   Median :0.0000  
>  Mean   : 3.288   Mean   : 1.069   Mean   :0.009375   Mean   :0.4562  
>  3rd Qu.: 4.000   3rd Qu.: 1.000   3rd Qu.:0.000000   3rd Qu.:0.0000  
>  Max.   :24.000   Max.   :18.000   Max.   :1.000000   Max.   :8.0000  
>    juvgiven3   obsstatus3    repstatus3    fecstatus3       matstatus3
>  Min.   :0   Min.   :0.0   Min.   :0.0   Min.   :0.0000   Min.   :1   
>  1st Qu.:0   1st Qu.:1.0   1st Qu.:0.0   1st Qu.:0.0000   1st Qu.:1   
>  Median :0   Median :1.0   Median :0.0   Median :0.0000   Median :1   
>  Mean   :0   Mean   :0.9   Mean   :0.4   Mean   :0.2219   Mean   :1   
>  3rd Qu.:0   3rd Qu.:1.0   3rd Qu.:1.0   3rd Qu.:0.0000   3rd Qu.:1   
>  Max.   :0   Max.   :1.0   Max.   :1.0   Max.   :1.0000   Max.   :1   
>      alive3          stage3           stage3index    
>  Min.   :0.0000   Length:320         Min.   : 0.000  
>  1st Qu.:1.0000   Class :character   1st Qu.: 7.000  
>  Median :1.0000   Mode  :character   Median : 8.000  
>  Mean   :0.9469                      Mean   : 7.544  
>  3rd Qu.:1.0000                      3rd Qu.: 8.000  
>  Max.   :1.0000                      Max.   :11.000

In the summary of the resulting data frame, we first see that there are 320 rows, 54 variables, one population, three patches, 74 individuals, and five time steps. This information gives us a good understanding of the dimensions of the dataset. This is followed by R’s data frame summary, where we see that the first four variables are identifying information - they show the data row (rowid), the population ID (popid), the patch ID (patchid), and the individual ID (individ), in order. These are followed by two variables identifying in what monitoring occasion the individual was first seen (firstseen), and in what occasion it was last seen (lastseen). The next variable, obsage, gives the estimated age at time t. The next variable, obslifespan, gives the full length of time that the individual was observed in the dataset. After that, we see a group of 15 variables typically ending with the number 1. These 15 variables correspond to the state of each individual in time t-1 (generally referred to as time1 in the actual code). Similarly, the next 15 variables typically end with the number 2 and represent state in time t, while the last 15 variables typically end in the number 3 and refer to state in time t+1. Most of these variables should be obvious to interpret given the names (definitions are in the help file for this function). Note that the final seven variables in each group are calculated by verticalize3(). These variables represent observation status, reproductive status, fecundity status, maturity status, status as alive or dead, stage name, and stage number (with reference to the stageframe), in order.

The summary-hfv() function can also produce just the initial dimensional output, as below.

summary_hfv(cypraw_v1, full = FALSE)
> 
> This hfv dataset contains 320 rows, 54 variables, 1 population, 
> 3 patches, 74 individuals, and 5 time steps.

Let’s also create our standardized data frame for the function-based MPM, as below. Remember that some of the settings need to change here because we will use a different life history model. Particularly, we are now going to separate adults not just by size but by reproductive status. So, we will NOT set NRasRep = TRUE here (the default is NRasRep = FALSE).

cypfb_v1 <- verticalize3(data = cypdata, noyears = 6, firstyear = 2004, 
  patchidcol = "patch", individcol = "plantid", blocksize = 4, 
  sizeacol = "Inf2.04", sizebcol = "Inf.04", sizeccol = "Veg.04", 
  repstracol = "Inf.04", repstrbcol = "Inf2.04", fecacol = "Pod.04", 
  stageassign = cypframe_fb, stagesize = "sizeadded", NAas0 = TRUE,
  age_offset = 4)

summary_hfv(cypfb_v1)
> 
> This hfv dataset contains 320 rows, 54 variables, 1 population, 
> 3 patches, 74 individuals, and 5 time steps.
>      rowid       popid  patchid   individ              year2     
>  Min.   : 1.00   :320   A: 93   Length:320         Min.   :2004  
>  1st Qu.:21.00          B:154   Class :character   1st Qu.:2005  
>  Median :37.50          C: 73   Mode  :character   Median :2006  
>  Mean   :38.45                                     Mean   :2006  
>  3rd Qu.:56.00                                     3rd Qu.:2007  
>  Max.   :77.00                                     Max.   :2008  
>    firstseen       lastseen        obsage       obslifespan   
>  Min.   :2004   Min.   :2004   Min.   :5.000   Min.   :0.000  
>  1st Qu.:2004   1st Qu.:2009   1st Qu.:6.000   1st Qu.:5.000  
>  Median :2004   Median :2009   Median :7.000   Median :5.000  
>  Mean   :2004   Mean   :2009   Mean   :6.853   Mean   :4.556  
>  3rd Qu.:2004   3rd Qu.:2009   3rd Qu.:8.000   3rd Qu.:5.000  
>  Max.   :2008   Max.   :2009   Max.   :9.000   Max.   :5.000  
>      sizea1             sizeb1            sizec1       size1added    
>  Min.   :0.000000   Min.   : 0.0000   Min.   : 0.0   Min.   : 0.000  
>  1st Qu.:0.000000   1st Qu.: 0.0000   1st Qu.: 0.0   1st Qu.: 0.000  
>  Median :0.000000   Median : 0.0000   Median : 1.0   Median : 2.000  
>  Mean   :0.009375   Mean   : 0.7469   Mean   : 1.9   Mean   : 2.656  
>  3rd Qu.:0.000000   3rd Qu.: 1.0000   3rd Qu.: 3.0   3rd Qu.: 4.000  
>  Max.   :1.000000   Max.   :18.0000   Max.   :13.0   Max.   :21.000  
>     repstra1          repstrb1            feca1          juvgiven1
>  Min.   : 0.0000   Min.   :0.000000   Min.   :0.0000   Min.   :0  
>  1st Qu.: 0.0000   1st Qu.:0.000000   1st Qu.:0.0000   1st Qu.:0  
>  Median : 0.0000   Median :0.000000   Median :0.0000   Median :0  
>  Mean   : 0.7469   Mean   :0.009375   Mean   :0.2656   Mean   :0  
>  3rd Qu.: 1.0000   3rd Qu.:0.000000   3rd Qu.:0.0000   3rd Qu.:0  
>  Max.   :18.0000   Max.   :1.000000   Max.   :7.0000   Max.   :0  
>    obsstatus1       repstatus1       fecstatus1       matstatus1    
>  Min.   :0.0000   Min.   :0.0000   Min.   :0.0000   Min.   :0.0000  
>  1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:1.0000  
>  Median :1.0000   Median :0.0000   Median :0.0000   Median :1.0000  
>  Mean   :0.7469   Mean   :0.2875   Mean   :0.1344   Mean   :0.7688  
>  3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:0.0000   3rd Qu.:1.0000  
>  Max.   :1.0000   Max.   :1.0000   Max.   :1.0000   Max.   :1.0000  
>      alive1          stage1           stage1index        sizea2        
>  Min.   :0.0000   Length:320         Min.   : 0.00   Min.   :0.000000  
>  1st Qu.:1.0000   Class :character   1st Qu.: 6.00   1st Qu.:0.000000  
>  Median :1.0000   Mode  :character   Median : 8.00   Median :0.000000  
>  Mean   :0.7688                      Mean   :14.17   Mean   :0.009375  
>  3rd Qu.:1.0000                      3rd Qu.:31.00   3rd Qu.:0.000000  
>  Max.   :1.0000                      Max.   :51.00   Max.   :1.000000  
>      sizeb2            sizec2         size2added        repstra2      
>  Min.   : 0.0000   Min.   : 0.000   Min.   : 0.000   Min.   : 0.0000  
>  1st Qu.: 0.0000   1st Qu.: 1.000   1st Qu.: 1.000   1st Qu.: 0.0000  
>  Median : 0.0000   Median : 2.000   Median : 2.000   Median : 0.0000  
>  Mean   : 0.8969   Mean   : 2.416   Mean   : 3.322   Mean   : 0.8969  
>  3rd Qu.: 1.0000   3rd Qu.: 3.000   3rd Qu.: 4.000   3rd Qu.: 1.0000  
>  Max.   :18.0000   Max.   :13.000   Max.   :24.000   Max.   :18.0000  
>     repstrb2            feca2          juvgiven2   obsstatus2    
>  Min.   :0.000000   Min.   :0.0000   Min.   :0   Min.   :0.0000  
>  1st Qu.:0.000000   1st Qu.:0.0000   1st Qu.:0   1st Qu.:1.0000  
>  Median :0.000000   Median :0.0000   Median :0   Median :1.0000  
>  Mean   :0.009375   Mean   :0.2906   Mean   :0   Mean   :0.9531  
>  3rd Qu.:0.000000   3rd Qu.:0.0000   3rd Qu.:0   3rd Qu.:1.0000  
>  Max.   :1.000000   Max.   :7.0000   Max.   :0   Max.   :1.0000  
>    repstatus2       fecstatus2       matstatus2     alive2     stage2         
>  Min.   :0.0000   Min.   :0.0000   Min.   :1    Min.   :1   Length:320        
>  1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:1    1st Qu.:1   Class :character  
>  Median :0.0000   Median :0.0000   Median :1    Median :1   Mode  :character  
>  Mean   :0.3688   Mean   :0.1562   Mean   :1    Mean   :1                     
>  3rd Qu.:1.0000   3rd Qu.:0.0000   3rd Qu.:1    3rd Qu.:1                     
>  Max.   :1.0000   Max.   :1.0000   Max.   :1    Max.   :1                     
>   stage2index        sizea3             sizeb3           sizec3      
>  Min.   : 6.00   Min.   :0.000000   Min.   : 0.000   Min.   : 0.000  
>  1st Qu.: 7.00   1st Qu.:0.000000   1st Qu.: 0.000   1st Qu.: 1.000  
>  Median :10.00   Median :0.000000   Median : 0.000   Median : 1.000  
>  Mean   :18.17   Mean   :0.009375   Mean   : 1.069   Mean   : 2.209  
>  3rd Qu.:32.00   3rd Qu.:0.000000   3rd Qu.: 1.000   3rd Qu.: 3.000  
>  Max.   :54.00   Max.   :1.000000   Max.   :18.000   Max.   :13.000  
>    size3added        repstra3         repstrb3            feca3       
>  Min.   : 0.000   Min.   : 0.000   Min.   :0.000000   Min.   :0.0000  
>  1st Qu.: 1.000   1st Qu.: 0.000   1st Qu.:0.000000   1st Qu.:0.0000  
>  Median : 2.000   Median : 0.000   Median :0.000000   Median :0.0000  
>  Mean   : 3.288   Mean   : 1.069   Mean   :0.009375   Mean   :0.4562  
>  3rd Qu.: 4.000   3rd Qu.: 1.000   3rd Qu.:0.000000   3rd Qu.:0.0000  
>  Max.   :24.000   Max.   :18.000   Max.   :1.000000   Max.   :8.0000  
>    juvgiven3   obsstatus3    repstatus3    fecstatus3       matstatus3
>  Min.   :0   Min.   :0.0   Min.   :0.0   Min.   :0.0000   Min.   :1   
>  1st Qu.:0   1st Qu.:1.0   1st Qu.:0.0   1st Qu.:0.0000   1st Qu.:1   
>  Median :0   Median :1.0   Median :0.0   Median :0.0000   Median :1   
>  Mean   :0   Mean   :0.9   Mean   :0.4   Mean   :0.2219   Mean   :1   
>  3rd Qu.:0   3rd Qu.:1.0   3rd Qu.:1.0   3rd Qu.:0.0000   3rd Qu.:1   
>  Max.   :0   Max.   :1.0   Max.   :1.0   Max.   :1.0000   Max.   :1   
>      alive3          stage3           stage3index   
>  Min.   :0.0000   Length:320         Min.   : 0.00  
>  1st Qu.:1.0000   Class :character   1st Qu.: 7.00  
>  Median :1.0000   Mode  :character   Median :10.00  
>  Mean   :0.9469                      Mean   :18.57  
>  3rd Qu.:1.0000                      3rd Qu.:33.00  
>  Max.   :1.0000                      Max.   :54.00

The output dataset includes a number of summary variables, but the data is essentially broken down into groups of three consecutive monitoring occasions each (occasions t+1, t, and t-1, corresponding to year3, year2, and year1 in the output, respectively), with individuals spread across multiple rows. The output dataset is further limited to those entries in which the individual is alive in occasion t (year2), meaning that all rows in which an individual is dead or not yet recruited in occasion t are dropped. Since the input data is the same, we should see the same numbers of rows and columns in the raw and function-based cases, regardless of the different stageframes used. Thus, we have 320 rows of data and 54 variables in the raw case, and 320 rows of data and 54 variables in the function-based case.

3.4 Function historicalize3()

What should be done if the dataset is in ahistorical vertical format, in which an individual’s condition across time is recorded across rows in a spreadsheet, with a single row corresponding to either a single observation or to a pair of consecutive observations? In that case, the historicalize3() function can standardize the dataset properly. The inputs to this function are very similar to verticalize3(). However, the historicalize3() function assumes that the input dataset is organized with rows corresponding to individual status in either only one monitoring occasion, or two consecutive occasions. Inputs include a series of variables more or less equivalent to input options in verticalize3(), but some variable names end with 2col, and others end with 3col. The former variables denote status in time t, and are the minimum required for this function to run. If each row includes status in paired consecutive times, then variables ending in 3col can be used to designate status in time t+1. Additionally, this function requires a single variable identifying individuals across rows (individcol), so that each individual’s resighting history can be inferred and each group of three consecutive monitoring times can be put together. All other fields work essentially the same as in verticalize3().

3.4.1 An example of historicalize3()

Package lefko3 also includes dataset cypvert, which is the same dataset as cypdata but set in ahistorical vertical format. Here, we will use the historicalize3() function to standardize this dataset, using the plantid variable as the individual identity term.

data(cypvert)

cypraw_v2 <- historicalize3(data = cypvert, patchidcol = "patch",
  individcol = "plantid", year2col = "year2", sizea2col = "Inf2.2",
  sizea3col = "Inf2.3", sizeb2col = "Inf.2", sizeb3col = "Inf.3",
  sizec2col = "Veg.2", sizec3col = "Veg.3", repstra2col = "Inf2.2",
  repstra3col = "Inf2.3", repstrb2col = "Inf.2", repstrb3col = "Inf.3",
  feca2col = "Pod.2", feca3col = "Pod.3", repstrrel = 2,
  stageassign = cypframe_raw, stagesize = "sizeadded", censorcol = "censor",
  censorkeep = 1, censor = FALSE, NAas0 = TRUE, NRasRep = TRUE, age_offset = 4,
  reduce = TRUE)

summary_hfv(cypraw_v2)
> 
> This hfv dataset contains 320 rows, 54 variables, 1 population, 
> 3 patches, 74 individuals, and 5 time steps.
>      rowid           popid             patchid            individ         
>  Min.   :  0.00   Length:320         Length:320         Length:320        
>  1st Qu.: 79.75   Class :character   Class :character   Class :character  
>  Median :159.50   Mode  :character   Mode  :character   Mode  :character  
>  Mean   :159.70                                                           
>  3rd Qu.:239.25                                                           
>  Max.   :321.00                                                           
>      year2        firstseen       lastseen        obsage       obslifespan   
>  Min.   :2004   Min.   :2004   Min.   :2004   Min.   :5.000   Min.   :0.000  
>  1st Qu.:2005   1st Qu.:2004   1st Qu.:2009   1st Qu.:6.000   1st Qu.:5.000  
>  Median :2006   Median :2004   Median :2009   Median :7.000   Median :5.000  
>  Mean   :2006   Mean   :2004   Mean   :2009   Mean   :6.853   Mean   :4.556  
>  3rd Qu.:2007   3rd Qu.:2004   3rd Qu.:2009   3rd Qu.:8.000   3rd Qu.:5.000  
>  Max.   :2008   Max.   :2008   Max.   :2009   Max.   :9.000   Max.   :5.000  
>      sizea1             sizeb1            sizec1       size1added    
>  Min.   :0.000000   Min.   : 0.0000   Min.   : 0.0   Min.   : 0.000  
>  1st Qu.:0.000000   1st Qu.: 0.0000   1st Qu.: 0.0   1st Qu.: 0.000  
>  Median :0.000000   Median : 0.0000   Median : 1.0   Median : 2.000  
>  Mean   :0.009375   Mean   : 0.7469   Mean   : 1.9   Mean   : 2.656  
>  3rd Qu.:0.000000   3rd Qu.: 1.0000   3rd Qu.: 3.0   3rd Qu.: 4.000  
>  Max.   :1.000000   Max.   :18.0000   Max.   :13.0   Max.   :21.000  
>     repstra1           repstrb1           feca1          juvgiven1
>  Min.   :0.000000   Min.   : 0.0000   Min.   :0.0000   Min.   :0  
>  1st Qu.:0.000000   1st Qu.: 0.0000   1st Qu.:0.0000   1st Qu.:0  
>  Median :0.000000   Median : 0.0000   Median :0.0000   Median :0  
>  Mean   :0.009375   Mean   : 0.7469   Mean   :0.2656   Mean   :0  
>  3rd Qu.:0.000000   3rd Qu.: 1.0000   3rd Qu.:0.0000   3rd Qu.:0  
>  Max.   :1.000000   Max.   :18.0000   Max.   :7.0000   Max.   :0  
>    obsstatus1       repstatus1       fecstatus1       matstatus1    
>  Min.   :0.0000   Min.   :0.0000   Min.   :0.0000   Min.   :0.0000  
>  1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:1.0000  
>  Median :1.0000   Median :0.0000   Median :0.0000   Median :1.0000  
>  Mean   :0.7469   Mean   :0.2875   Mean   :0.1344   Mean   :0.7688  
>  3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:0.0000   3rd Qu.:1.0000  
>  Max.   :1.0000   Max.   :1.0000   Max.   :1.0000   Max.   :1.0000  
>      alive1          stage1           stage1index         sizea2        
>  Min.   :0.0000   Length:320         Min.   : 0.000   Min.   :0.000000  
>  1st Qu.:1.0000   Class :character   1st Qu.: 6.000   1st Qu.:0.000000  
>  Median :1.0000   Mode  :character   Median : 8.000   Median :0.000000  
>  Mean   :0.7688                      Mean   : 6.144   Mean   :0.009375  
>  3rd Qu.:1.0000                      3rd Qu.: 8.000   3rd Qu.:0.000000  
>  Max.   :1.0000                      Max.   :11.000   Max.   :1.000000  
>      sizeb2            sizec2         size2added        repstra2       
>  Min.   : 0.0000   Min.   : 0.000   Min.   : 0.000   Min.   :0.000000  
>  1st Qu.: 0.0000   1st Qu.: 1.000   1st Qu.: 1.000   1st Qu.:0.000000  
>  Median : 0.0000   Median : 2.000   Median : 2.000   Median :0.000000  
>  Mean   : 0.8969   Mean   : 2.416   Mean   : 3.322   Mean   :0.009375  
>  3rd Qu.: 1.0000   3rd Qu.: 3.000   3rd Qu.: 4.000   3rd Qu.:0.000000  
>  Max.   :18.0000   Max.   :13.000   Max.   :24.000   Max.   :1.000000  
>     repstrb2           feca2          juvgiven2   obsstatus2    
>  Min.   : 0.0000   Min.   :0.0000   Min.   :0   Min.   :0.0000  
>  1st Qu.: 0.0000   1st Qu.:0.0000   1st Qu.:0   1st Qu.:1.0000  
>  Median : 0.0000   Median :0.0000   Median :0   Median :1.0000  
>  Mean   : 0.8969   Mean   :0.2906   Mean   :0   Mean   :0.9531  
>  3rd Qu.: 1.0000   3rd Qu.:0.0000   3rd Qu.:0   3rd Qu.:1.0000  
>  Max.   :18.0000   Max.   :7.0000   Max.   :0   Max.   :1.0000  
>    repstatus2       fecstatus2       matstatus2     alive2     stage2         
>  Min.   :0.0000   Min.   :0.0000   Min.   :1    Min.   :1   Length:320        
>  1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:1    1st Qu.:1   Class :character  
>  Median :0.0000   Median :0.0000   Median :1    Median :1   Mode  :character  
>  Mean   :0.3688   Mean   :0.1562   Mean   :1    Mean   :1                     
>  3rd Qu.:1.0000   3rd Qu.:0.0000   3rd Qu.:1    3rd Qu.:1                     
>  Max.   :1.0000   Max.   :1.0000   Max.   :1    Max.   :1                     
>   stage2index         sizea3             sizeb3           sizec3      
>  Min.   : 6.000   Min.   :0.000000   Min.   : 0.000   Min.   : 0.000  
>  1st Qu.: 7.000   1st Qu.:0.000000   1st Qu.: 0.000   1st Qu.: 1.000  
>  Median : 8.000   Median :0.000000   Median : 0.000   Median : 1.000  
>  Mean   : 7.919   Mean   :0.009375   Mean   : 1.069   Mean   : 2.209  
>  3rd Qu.: 8.000   3rd Qu.:0.000000   3rd Qu.: 1.000   3rd Qu.: 3.000  
>  Max.   :11.000   Max.   :1.000000   Max.   :18.000   Max.   :13.000  
>    size3added        repstra3           repstrb3          feca3       
>  Min.   : 0.000   Min.   :0.000000   Min.   : 0.000   Min.   :0.0000  
>  1st Qu.: 1.000   1st Qu.:0.000000   1st Qu.: 0.000   1st Qu.:0.0000  
>  Median : 2.000   Median :0.000000   Median : 0.000   Median :0.0000  
>  Mean   : 3.288   Mean   :0.009375   Mean   : 1.069   Mean   :0.4562  
>  3rd Qu.: 4.000   3rd Qu.:0.000000   3rd Qu.: 1.000   3rd Qu.:0.0000  
>  Max.   :24.000   Max.   :1.000000   Max.   :18.000   Max.   :8.0000  
>    juvgiven3   obsstatus3    repstatus3    fecstatus3       matstatus3
>  Min.   :0   Min.   :0.0   Min.   :0.0   Min.   :0.0000   Min.   :1   
>  1st Qu.:0   1st Qu.:1.0   1st Qu.:0.0   1st Qu.:0.0000   1st Qu.:1   
>  Median :0   Median :1.0   Median :0.0   Median :0.0000   Median :1   
>  Mean   :0   Mean   :0.9   Mean   :0.4   Mean   :0.2219   Mean   :1   
>  3rd Qu.:0   3rd Qu.:1.0   3rd Qu.:1.0   3rd Qu.:0.0000   3rd Qu.:1   
>  Max.   :0   Max.   :1.0   Max.   :1.0   Max.   :1.0000   Max.   :1   
>      alive3          stage3           stage3index    
>  Min.   :0.0000   Length:320         Min.   : 0.000  
>  1st Qu.:1.0000   Class :character   1st Qu.: 7.000  
>  Median :1.0000   Mode  :character   Median : 8.000  
>  Mean   :0.9469                      Mean   : 7.544  
>  3rd Qu.:1.0000                      3rd Qu.: 8.000  
>  Max.   :1.0000                      Max.   :11.000

Let’s also create the function-based MPM version.

cypfb_v2 <- historicalize3(data = cypvert, patchidcol = "patch",
  individcol = "plantid", year2col = "year2", sizea2col = "Inf2.2", 
  sizea3col = "Inf2.3", sizeb2col = "Inf.2", sizeb3col = "Inf.3", 
  sizec2col = "Veg.2", sizec3col = "Veg.3", repstra2col = "Inf2.2", 
  repstra3col = "Inf2.3", repstrb2col = "Inf.2", repstrb3col = "Inf.3", 
  feca2col = "Pod.2", feca3col = "Pod.3", repstrrel = 2,
  stageassign = cypframe_fb, stagesize = "sizeadded", censorcol = "censor",
  censorkeep = 1, censor = FALSE, NAas0 = TRUE, age_offset = 4, reduce = TRUE)

summary_hfv(cypfb_v2)
> 
> This hfv dataset contains 320 rows, 54 variables, 1 population, 
> 3 patches, 74 individuals, and 5 time steps.
>      rowid           popid             patchid            individ         
>  Min.   :  0.00   Length:320         Length:320         Length:320        
>  1st Qu.: 79.75   Class :character   Class :character   Class :character  
>  Median :159.50   Mode  :character   Mode  :character   Mode  :character  
>  Mean   :159.70                                                           
>  3rd Qu.:239.25                                                           
>  Max.   :321.00                                                           
>      year2        firstseen       lastseen        obsage       obslifespan   
>  Min.   :2004   Min.   :2004   Min.   :2004   Min.   :5.000   Min.   :0.000  
>  1st Qu.:2005   1st Qu.:2004   1st Qu.:2009   1st Qu.:6.000   1st Qu.:5.000  
>  Median :2006   Median :2004   Median :2009   Median :7.000   Median :5.000  
>  Mean   :2006   Mean   :2004   Mean   :2009   Mean   :6.853   Mean   :4.556  
>  3rd Qu.:2007   3rd Qu.:2004   3rd Qu.:2009   3rd Qu.:8.000   3rd Qu.:5.000  
>  Max.   :2008   Max.   :2008   Max.   :2009   Max.   :9.000   Max.   :5.000  
>      sizea1             sizeb1            sizec1       size1added    
>  Min.   :0.000000   Min.   : 0.0000   Min.   : 0.0   Min.   : 0.000  
>  1st Qu.:0.000000   1st Qu.: 0.0000   1st Qu.: 0.0   1st Qu.: 0.000  
>  Median :0.000000   Median : 0.0000   Median : 1.0   Median : 2.000  
>  Mean   :0.009375   Mean   : 0.7469   Mean   : 1.9   Mean   : 2.656  
>  3rd Qu.:0.000000   3rd Qu.: 1.0000   3rd Qu.: 3.0   3rd Qu.: 4.000  
>  Max.   :1.000000   Max.   :18.0000   Max.   :13.0   Max.   :21.000  
>     repstra1           repstrb1           feca1          juvgiven1
>  Min.   :0.000000   Min.   : 0.0000   Min.   :0.0000   Min.   :0  
>  1st Qu.:0.000000   1st Qu.: 0.0000   1st Qu.:0.0000   1st Qu.:0  
>  Median :0.000000   Median : 0.0000   Median :0.0000   Median :0  
>  Mean   :0.009375   Mean   : 0.7469   Mean   :0.2656   Mean   :0  
>  3rd Qu.:0.000000   3rd Qu.: 1.0000   3rd Qu.:0.0000   3rd Qu.:0  
>  Max.   :1.000000   Max.   :18.0000   Max.   :7.0000   Max.   :0  
>    obsstatus1       repstatus1       fecstatus1       matstatus1    
>  Min.   :0.0000   Min.   :0.0000   Min.   :0.0000   Min.   :0.0000  
>  1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:1.0000  
>  Median :1.0000   Median :0.0000   Median :0.0000   Median :1.0000  
>  Mean   :0.7469   Mean   :0.2875   Mean   :0.1344   Mean   :0.7688  
>  3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:0.0000   3rd Qu.:1.0000  
>  Max.   :1.0000   Max.   :1.0000   Max.   :1.0000   Max.   :1.0000  
>      alive1          stage1           stage1index        sizea2        
>  Min.   :0.0000   Length:320         Min.   : 0.00   Min.   :0.000000  
>  1st Qu.:1.0000   Class :character   1st Qu.: 6.00   1st Qu.:0.000000  
>  Median :1.0000   Mode  :character   Median : 8.00   Median :0.000000  
>  Mean   :0.7688                      Mean   :14.17   Mean   :0.009375  
>  3rd Qu.:1.0000                      3rd Qu.:31.00   3rd Qu.:0.000000  
>  Max.   :1.0000                      Max.   :51.00   Max.   :1.000000  
>      sizeb2            sizec2         size2added        repstra2       
>  Min.   : 0.0000   Min.   : 0.000   Min.   : 0.000   Min.   :0.000000  
>  1st Qu.: 0.0000   1st Qu.: 1.000   1st Qu.: 1.000   1st Qu.:0.000000  
>  Median : 0.0000   Median : 2.000   Median : 2.000   Median :0.000000  
>  Mean   : 0.8969   Mean   : 2.416   Mean   : 3.322   Mean   :0.009375  
>  3rd Qu.: 1.0000   3rd Qu.: 3.000   3rd Qu.: 4.000   3rd Qu.:0.000000  
>  Max.   :18.0000   Max.   :13.000   Max.   :24.000   Max.   :1.000000  
>     repstrb2           feca2          juvgiven2   obsstatus2    
>  Min.   : 0.0000   Min.   :0.0000   Min.   :0   Min.   :0.0000  
>  1st Qu.: 0.0000   1st Qu.:0.0000   1st Qu.:0   1st Qu.:1.0000  
>  Median : 0.0000   Median :0.0000   Median :0   Median :1.0000  
>  Mean   : 0.8969   Mean   :0.2906   Mean   :0   Mean   :0.9531  
>  3rd Qu.: 1.0000   3rd Qu.:0.0000   3rd Qu.:0   3rd Qu.:1.0000  
>  Max.   :18.0000   Max.   :7.0000   Max.   :0   Max.   :1.0000  
>    repstatus2       fecstatus2       matstatus2     alive2     stage2         
>  Min.   :0.0000   Min.   :0.0000   Min.   :1    Min.   :1   Length:320        
>  1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:1    1st Qu.:1   Class :character  
>  Median :0.0000   Median :0.0000   Median :1    Median :1   Mode  :character  
>  Mean   :0.3688   Mean   :0.1562   Mean   :1    Mean   :1                     
>  3rd Qu.:1.0000   3rd Qu.:0.0000   3rd Qu.:1    3rd Qu.:1                     
>  Max.   :1.0000   Max.   :1.0000   Max.   :1    Max.   :1                     
>   stage2index        sizea3             sizeb3           sizec3      
>  Min.   : 6.00   Min.   :0.000000   Min.   : 0.000   Min.   : 0.000  
>  1st Qu.: 7.00   1st Qu.:0.000000   1st Qu.: 0.000   1st Qu.: 1.000  
>  Median :10.00   Median :0.000000   Median : 0.000   Median : 1.000  
>  Mean   :18.17   Mean   :0.009375   Mean   : 1.069   Mean   : 2.209  
>  3rd Qu.:32.00   3rd Qu.:0.000000   3rd Qu.: 1.000   3rd Qu.: 3.000  
>  Max.   :54.00   Max.   :1.000000   Max.   :18.000   Max.   :13.000  
>    size3added        repstra3           repstrb3          feca3       
>  Min.   : 0.000   Min.   :0.000000   Min.   : 0.000   Min.   :0.0000  
>  1st Qu.: 1.000   1st Qu.:0.000000   1st Qu.: 0.000   1st Qu.:0.0000  
>  Median : 2.000   Median :0.000000   Median : 0.000   Median :0.0000  
>  Mean   : 3.288   Mean   :0.009375   Mean   : 1.069   Mean   :0.4562  
>  3rd Qu.: 4.000   3rd Qu.:0.000000   3rd Qu.: 1.000   3rd Qu.:0.0000  
>  Max.   :24.000   Max.   :1.000000   Max.   :18.000   Max.   :8.0000  
>    juvgiven3   obsstatus3    repstatus3    fecstatus3       matstatus3
>  Min.   :0   Min.   :0.0   Min.   :0.0   Min.   :0.0000   Min.   :1   
>  1st Qu.:0   1st Qu.:1.0   1st Qu.:0.0   1st Qu.:0.0000   1st Qu.:1   
>  Median :0   Median :1.0   Median :0.0   Median :0.0000   Median :1   
>  Mean   :0   Mean   :0.9   Mean   :0.4   Mean   :0.2219   Mean   :1   
>  3rd Qu.:0   3rd Qu.:1.0   3rd Qu.:1.0   3rd Qu.:0.0000   3rd Qu.:1   
>  Max.   :0   Max.   :1.0   Max.   :1.0   Max.   :1.0000   Max.   :1   
>      alive3          stage3           stage3index   
>  Min.   :0.0000   Length:320         Min.   : 0.00  
>  1st Qu.:1.0000   Class :character   1st Qu.: 7.00  
>  Median :1.0000   Mode  :character   Median :10.00  
>  Mean   :0.9469                      Mean   :18.57  
>  3rd Qu.:1.0000                      3rd Qu.:33.00  
>  Max.   :1.0000                      Max.   :54.00

One important consideration is the use of censor variables. Censoring a demographic dataset is typically accomplished by including a binary variable in the dataset denoting whether an individual datum is to be kept or excluded. The objects cypraw_v2 and cpyfb_v2 were both created without using censoring variables. However, because the datasets actually included censor variables (all data were set to be included, with no suspect data), we wished to incorporate those variables in the final datasets. Hence, although censor = FALSE in both the call to verticalize3() and the call to historicalize3(), we also noted censorcol = "censor" and censorkeep = 1 in the call to historicalize3(). Failing to add these options to the call to historicalize3() will produce approximately the same dataset, but with some zeros entering variables censor1, censor2, and censor3 in the historicalized dataset that do not exist in the first, verticalized dataset. This occurs because the vertical dataset that we standardized only includes entries for each individual actually observed at each time, while the horizontal dataset includes entries for all individuals at all times, regardless of whether they were observed. Thus, by setting these options, we have produced datasets that are exactly the same except for variable order. We can see hints of that by looking at the dimensions of our datasets, as below.

summary_hfv(cypraw_v1, full = FALSE)
> 
> This hfv dataset contains 320 rows, 54 variables, 1 population, 
> 3 patches, 74 individuals, and 5 time steps.
summary_hfv(cypraw_v2, full = FALSE)
> 
> This hfv dataset contains 320 rows, 54 variables, 1 population, 
> 3 patches, 74 individuals, and 5 time steps.
summary_hfv(cypfb_v1, full = FALSE)
> 
> This hfv dataset contains 320 rows, 54 variables, 1 population, 
> 3 patches, 74 individuals, and 5 time steps.
summary_hfv(cypfb_v2, full = FALSE)
> 
> This hfv dataset contains 320 rows, 54 variables, 1 population, 
> 3 patches, 74 individuals, and 5 time steps.

One final consideration in historicalize3() regards the use of the 3col sets of options. If users have vertical datasets with pairs of consecutive states, then setting the 3col options to the latter state in each row means that the final year will be included in the historicalized dataset. Failing to enter the 3col set in these cases would mean that the final monitoring occasion would be dropped, since it likely only appears in rows holding data for the second to last monitoring occasion.

3.5 Handling spatial data and density

Both functions verticalize3() and historicalize3() handle the formatting of spatial coordinates and the estimation of density. There are four important settings that need to be used in the former case, and three in the latter. In both functions, the first two settings correspond to the columns coding for the X coordinate (xcol), and the Y coordinate (ycol). In both cases, the name of the variable or the column number can be used. The third setting (spacing), used in both functions, sets the radius from the coordinate of the individual to search for other individuals. The approach used for density estimation is to find and count all individuals in the same occasion within this radius from each individual, with density estimation performed for each individual in each time. The final setting, used only in verticalize3(), is a logical variable telling R whether the X and Y coordinate variables are single variables for the individual, or whether each individual has potentially new X and Y coordinates at each time that it is observed (coordsRepeat).

Here, we will produce a new version of the function-based cypdata hfv dataset with density at time t estimated using a 1m radius. Notice that the result includes xpos and ypos variables for times t+1, t, and t-1, and local density (density) at time t.

cypfb_vdens <- verticalize3(data = cypdata, noyears = 6, firstyear = 2004, 
  patchidcol = "patch", individcol = "plantid", blocksize = 4, 
  xcol = "X", ycol = "Y", sizeacol = "Inf2.04", sizebcol = "Inf.04",
  sizeccol = "Veg.04", repstracol = "Inf.04", repstrbcol = "Inf2.04",
  fecacol = "Pod.04", stageassign = cypframe_fb, stagesize = "sizeadded",
  NAas0 = TRUE, age_offset = 4, coordsRepeat = FALSE, spacing = 1)

summary_hfv(cypfb_vdens)
> 
> This hfv dataset contains 320 rows, 61 variables, 1 population, 
> 3 patches, 74 individuals, and 5 time steps.
>      rowid       popid  patchid   individ              year2     
>  Min.   : 1.00   :320   A: 93   Length:320         Min.   :2004  
>  1st Qu.:21.00          B:154   Class :character   1st Qu.:2005  
>  Median :37.50          C: 73   Mode  :character   Median :2006  
>  Mean   :38.45                                     Mean   :2006  
>  3rd Qu.:56.00                                     3rd Qu.:2007  
>  Max.   :77.00                                     Max.   :2008  
>    firstseen       lastseen        obsage       obslifespan        xpos1       
>  Min.   :2004   Min.   :2004   Min.   :5.000   Min.   :0.000   Min.   :  0.00  
>  1st Qu.:2004   1st Qu.:2009   1st Qu.:6.000   1st Qu.:5.000   1st Qu.: 54.40  
>  Median :2004   Median :2009   Median :7.000   Median :5.000   Median : 60.80  
>  Mean   :2004   Mean   :2009   Mean   :6.853   Mean   :4.556   Mean   : 72.53  
>  3rd Qu.:2004   3rd Qu.:2009   3rd Qu.:8.000   3rd Qu.:5.000   3rd Qu.: 97.40  
>  Max.   :2008   Max.   :2009   Max.   :9.000   Max.   :5.000   Max.   :166.30  
>      ypos1            sizea1             sizeb1            sizec1    
>  Min.   :-28.00   Min.   :0.000000   Min.   : 0.0000   Min.   : 0.0  
>  1st Qu.:  0.00   1st Qu.:0.000000   1st Qu.: 0.0000   1st Qu.: 0.0  
>  Median : 70.90   Median :0.000000   Median : 0.0000   Median : 1.0  
>  Mean   : 44.93   Mean   :0.009375   Mean   : 0.7469   Mean   : 1.9  
>  3rd Qu.: 79.85   3rd Qu.:0.000000   3rd Qu.: 1.0000   3rd Qu.: 3.0  
>  Max.   :142.40   Max.   :1.000000   Max.   :18.0000   Max.   :13.0  
>    size1added        repstra1          repstrb1            feca1       
>  Min.   : 0.000   Min.   : 0.0000   Min.   :0.000000   Min.   :0.0000  
>  1st Qu.: 0.000   1st Qu.: 0.0000   1st Qu.:0.000000   1st Qu.:0.0000  
>  Median : 2.000   Median : 0.0000   Median :0.000000   Median :0.0000  
>  Mean   : 2.656   Mean   : 0.7469   Mean   :0.009375   Mean   :0.2656  
>  3rd Qu.: 4.000   3rd Qu.: 1.0000   3rd Qu.:0.000000   3rd Qu.:0.0000  
>  Max.   :21.000   Max.   :18.0000   Max.   :1.000000   Max.   :7.0000  
>    juvgiven1   obsstatus1       repstatus1       fecstatus1    
>  Min.   :0   Min.   :0.0000   Min.   :0.0000   Min.   :0.0000  
>  1st Qu.:0   1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:0.0000  
>  Median :0   Median :1.0000   Median :0.0000   Median :0.0000  
>  Mean   :0   Mean   :0.7469   Mean   :0.2875   Mean   :0.1344  
>  3rd Qu.:0   3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:0.0000  
>  Max.   :0   Max.   :1.0000   Max.   :1.0000   Max.   :1.0000  
>    matstatus1         alive1          stage1           stage1index   
>  Min.   :0.0000   Min.   :0.0000   Length:320         Min.   : 0.00  
>  1st Qu.:1.0000   1st Qu.:1.0000   Class :character   1st Qu.: 6.00  
>  Median :1.0000   Median :1.0000   Mode  :character   Median : 8.00  
>  Mean   :0.7688   Mean   :0.7688                      Mean   :14.17  
>  3rd Qu.:1.0000   3rd Qu.:1.0000                      3rd Qu.:31.00  
>  Max.   :1.0000   Max.   :1.0000                      Max.   :51.00  
>      xpos2            ypos2            sizea2             sizeb2       
>  Min.   : 46.50   Min.   :-28.00   Min.   :0.000000   Min.   : 0.0000  
>  1st Qu.: 60.10   1st Qu.: 23.30   1st Qu.:0.000000   1st Qu.: 0.0000  
>  Median : 90.65   Median : 77.00   Median :0.000000   Median : 0.0000  
>  Mean   : 91.19   Mean   : 56.98   Mean   :0.009375   Mean   : 0.8969  
>  3rd Qu.:141.80   3rd Qu.: 80.40   3rd Qu.:0.000000   3rd Qu.: 1.0000  
>  Max.   :173.00   Max.   :142.40   Max.   :1.000000   Max.   :18.0000  
>      sizec2         size2added        repstra2          repstrb2       
>  Min.   : 0.000   Min.   : 0.000   Min.   : 0.0000   Min.   :0.000000  
>  1st Qu.: 1.000   1st Qu.: 1.000   1st Qu.: 0.0000   1st Qu.:0.000000  
>  Median : 2.000   Median : 2.000   Median : 0.0000   Median :0.000000  
>  Mean   : 2.416   Mean   : 3.322   Mean   : 0.8969   Mean   :0.009375  
>  3rd Qu.: 3.000   3rd Qu.: 4.000   3rd Qu.: 1.0000   3rd Qu.:0.000000  
>  Max.   :13.000   Max.   :24.000   Max.   :18.0000   Max.   :1.000000  
>      feca2          juvgiven2   obsstatus2       repstatus2    
>  Min.   :0.0000   Min.   :0   Min.   :0.0000   Min.   :0.0000  
>  1st Qu.:0.0000   1st Qu.:0   1st Qu.:1.0000   1st Qu.:0.0000  
>  Median :0.0000   Median :0   Median :1.0000   Median :0.0000  
>  Mean   :0.2906   Mean   :0   Mean   :0.9531   Mean   :0.3688  
>  3rd Qu.:0.0000   3rd Qu.:0   3rd Qu.:1.0000   3rd Qu.:1.0000  
>  Max.   :7.0000   Max.   :0   Max.   :1.0000   Max.   :1.0000  
>    fecstatus2       matstatus2     alive2     stage2           stage2index   
>  Min.   :0.0000   Min.   :1    Min.   :1   Length:320         Min.   : 6.00  
>  1st Qu.:0.0000   1st Qu.:1    1st Qu.:1   Class :character   1st Qu.: 7.00  
>  Median :0.0000   Median :1    Median :1   Mode  :character   Median :10.00  
>  Mean   :0.1562   Mean   :1    Mean   :1                      Mean   :18.17  
>  3rd Qu.:0.0000   3rd Qu.:1    3rd Qu.:1                      3rd Qu.:32.00  
>  Max.   :1.0000   Max.   :1    Max.   :1                      Max.   :54.00  
>      xpos3            ypos3            sizea3             sizeb3      
>  Min.   : 46.50   Min.   :-28.00   Min.   :0.000000   Min.   : 0.000  
>  1st Qu.: 60.10   1st Qu.: 23.30   1st Qu.:0.000000   1st Qu.: 0.000  
>  Median : 90.65   Median : 77.00   Median :0.000000   Median : 0.000  
>  Mean   : 91.19   Mean   : 56.98   Mean   :0.009375   Mean   : 1.069  
>  3rd Qu.:141.80   3rd Qu.: 80.40   3rd Qu.:0.000000   3rd Qu.: 1.000  
>  Max.   :173.00   Max.   :142.40   Max.   :1.000000   Max.   :18.000  
>      sizec3         size3added        repstra3         repstrb3       
>  Min.   : 0.000   Min.   : 0.000   Min.   : 0.000   Min.   :0.000000  
>  1st Qu.: 1.000   1st Qu.: 1.000   1st Qu.: 0.000   1st Qu.:0.000000  
>  Median : 1.000   Median : 2.000   Median : 0.000   Median :0.000000  
>  Mean   : 2.209   Mean   : 3.288   Mean   : 1.069   Mean   :0.009375  
>  3rd Qu.: 3.000   3rd Qu.: 4.000   3rd Qu.: 1.000   3rd Qu.:0.000000  
>  Max.   :13.000   Max.   :24.000   Max.   :18.000   Max.   :1.000000  
>      feca3          juvgiven3   obsstatus3    repstatus3    fecstatus3    
>  Min.   :0.0000   Min.   :0   Min.   :0.0   Min.   :0.0   Min.   :0.0000  
>  1st Qu.:0.0000   1st Qu.:0   1st Qu.:1.0   1st Qu.:0.0   1st Qu.:0.0000  
>  Median :0.0000   Median :0   Median :1.0   Median :0.0   Median :0.0000  
>  Mean   :0.4562   Mean   :0   Mean   :0.9   Mean   :0.4   Mean   :0.2219  
>  3rd Qu.:0.0000   3rd Qu.:0   3rd Qu.:1.0   3rd Qu.:1.0   3rd Qu.:0.0000  
>  Max.   :8.0000   Max.   :0   Max.   :1.0   Max.   :1.0   Max.   :1.0000  
>    matstatus3     alive3          stage3           stage3index   
>  Min.   :1    Min.   :0.0000   Length:320         Min.   : 0.00  
>  1st Qu.:1    1st Qu.:1.0000   Class :character   1st Qu.: 7.00  
>  Median :1    Median :1.0000   Mode  :character   Median :10.00  
>  Mean   :1    Mean   :0.9469                      Mean   :18.57  
>  3rd Qu.:1    3rd Qu.:1.0000                      3rd Qu.:33.00  
>  Max.   :1    Max.   :1.0000                      Max.   :54.00  
>     density      
>  Min.   : 0.000  
>  1st Qu.: 0.000  
>  Median : 1.000  
>  Mean   : 1.931  
>  3rd Qu.: 3.000  
>  Max.   :10.000

Next, let’s try creating the same formatted dataset, but using the historicalize3() function applied on cypvert. The options to add here are the same as in verticalize3(), except for coordsRepeat (the latter is only available for horizontally formatted dataset inputs). Note that the summaries look essentially the same for both standardized versions of the dataset.

cypfb_hdens <- historicalize3(data = cypvert, patchidcol = "patch",
  individcol = "plantid", xcol = "X", ycol = "Y", year2col = "year2",
  sizea2col = "Inf2.2", sizea3col = "Inf2.3", sizeb2col = "Inf.2",
  sizeb3col = "Inf.3", sizec2col = "Veg.2", sizec3col = "Veg.3",
  repstra2col = "Inf2.2", repstra3col = "Inf2.3", repstrb2col = "Inf.2",
  repstrb3col = "Inf.3", feca2col = "Pod.2", feca3col = "Pod.3", repstrrel = 2,
  stageassign = cypframe_fb, stagesize = "sizeadded", censorcol = "censor",
  censorkeep = 1, censor = FALSE, NAas0 = TRUE, age_offset = 4, spacing = 1,
  reduce = TRUE)

summary_hfv(cypfb_hdens)
> 
> This hfv dataset contains 320 rows, 61 variables, 1 population, 
> 3 patches, 74 individuals, and 5 time steps.
>      rowid           popid             patchid            individ         
>  Min.   :  0.00   Length:320         Length:320         Length:320        
>  1st Qu.: 79.75   Class :character   Class :character   Class :character  
>  Median :159.50   Mode  :character   Mode  :character   Mode  :character  
>  Mean   :159.70                                                           
>  3rd Qu.:239.25                                                           
>  Max.   :321.00                                                           
>      year2        firstseen       lastseen        obsage       obslifespan   
>  Min.   :2004   Min.   :2004   Min.   :2004   Min.   :5.000   Min.   :0.000  
>  1st Qu.:2005   1st Qu.:2004   1st Qu.:2009   1st Qu.:6.000   1st Qu.:5.000  
>  Median :2006   Median :2004   Median :2009   Median :7.000   Median :5.000  
>  Mean   :2006   Mean   :2004   Mean   :2009   Mean   :6.853   Mean   :4.556  
>  3rd Qu.:2007   3rd Qu.:2004   3rd Qu.:2009   3rd Qu.:8.000   3rd Qu.:5.000  
>  Max.   :2008   Max.   :2008   Max.   :2009   Max.   :9.000   Max.   :5.000  
>      xpos1            ypos1            sizea1             sizeb1       
>  Min.   : 46.50   Min.   :-28.00   Min.   :0.000000   Min.   : 0.0000  
>  1st Qu.: 60.10   1st Qu.: 23.30   1st Qu.:0.000000   1st Qu.: 0.0000  
>  Median : 90.65   Median : 77.00   Median :0.000000   Median : 0.0000  
>  Mean   : 91.19   Mean   : 56.98   Mean   :0.009375   Mean   : 0.7469  
>  3rd Qu.:141.80   3rd Qu.: 80.40   3rd Qu.:0.000000   3rd Qu.: 1.0000  
>  Max.   :173.00   Max.   :142.40   Max.   :1.000000   Max.   :18.0000  
>      sizec1       size1added        repstra1           repstrb1      
>  Min.   : 0.0   Min.   : 0.000   Min.   :0.000000   Min.   : 0.0000  
>  1st Qu.: 0.0   1st Qu.: 0.000   1st Qu.:0.000000   1st Qu.: 0.0000  
>  Median : 1.0   Median : 2.000   Median :0.000000   Median : 0.0000  
>  Mean   : 1.9   Mean   : 2.656   Mean   :0.009375   Mean   : 0.7469  
>  3rd Qu.: 3.0   3rd Qu.: 4.000   3rd Qu.:0.000000   3rd Qu.: 1.0000  
>  Max.   :13.0   Max.   :21.000   Max.   :1.000000   Max.   :18.0000  
>      feca1          juvgiven1   obsstatus1       repstatus1    
>  Min.   :0.0000   Min.   :0   Min.   :0.0000   Min.   :0.0000  
>  1st Qu.:0.0000   1st Qu.:0   1st Qu.:0.0000   1st Qu.:0.0000  
>  Median :0.0000   Median :0   Median :1.0000   Median :0.0000  
>  Mean   :0.2656   Mean   :0   Mean   :0.7469   Mean   :0.2875  
>  3rd Qu.:0.0000   3rd Qu.:0   3rd Qu.:1.0000   3rd Qu.:1.0000  
>  Max.   :7.0000   Max.   :0   Max.   :1.0000   Max.   :1.0000  
>    fecstatus1       matstatus1         alive1          stage1         
>  Min.   :0.0000   Min.   :0.0000   Min.   :0.0000   Length:320        
>  1st Qu.:0.0000   1st Qu.:1.0000   1st Qu.:1.0000   Class :character  
>  Median :0.0000   Median :1.0000   Median :1.0000   Mode  :character  
>  Mean   :0.1344   Mean   :0.7688   Mean   :0.7688                     
>  3rd Qu.:0.0000   3rd Qu.:1.0000   3rd Qu.:1.0000                     
>  Max.   :1.0000   Max.   :1.0000   Max.   :1.0000                     
>   stage1index        xpos2            ypos2            sizea2        
>  Min.   : 0.00   Min.   : 46.50   Min.   :-28.00   Min.   :0.000000  
>  1st Qu.: 6.00   1st Qu.: 60.10   1st Qu.: 23.30   1st Qu.:0.000000  
>  Median : 8.00   Median : 90.65   Median : 77.00   Median :0.000000  
>  Mean   :14.17   Mean   : 91.19   Mean   : 56.98   Mean   :0.009375  
>  3rd Qu.:31.00   3rd Qu.:141.80   3rd Qu.: 80.40   3rd Qu.:0.000000  
>  Max.   :51.00   Max.   :173.00   Max.   :142.40   Max.   :1.000000  
>      sizeb2            sizec2         size2added        repstra2       
>  Min.   : 0.0000   Min.   : 0.000   Min.   : 0.000   Min.   :0.000000  
>  1st Qu.: 0.0000   1st Qu.: 1.000   1st Qu.: 1.000   1st Qu.:0.000000  
>  Median : 0.0000   Median : 2.000   Median : 2.000   Median :0.000000  
>  Mean   : 0.8969   Mean   : 2.416   Mean   : 3.322   Mean   :0.009375  
>  3rd Qu.: 1.0000   3rd Qu.: 3.000   3rd Qu.: 4.000   3rd Qu.:0.000000  
>  Max.   :18.0000   Max.   :13.000   Max.   :24.000   Max.   :1.000000  
>     repstrb2           feca2          juvgiven2   obsstatus2    
>  Min.   : 0.0000   Min.   :0.0000   Min.   :0   Min.   :0.0000  
>  1st Qu.: 0.0000   1st Qu.:0.0000   1st Qu.:0   1st Qu.:1.0000  
>  Median : 0.0000   Median :0.0000   Median :0   Median :1.0000  
>  Mean   : 0.8969   Mean   :0.2906   Mean   :0   Mean   :0.9531  
>  3rd Qu.: 1.0000   3rd Qu.:0.0000   3rd Qu.:0   3rd Qu.:1.0000  
>  Max.   :18.0000   Max.   :7.0000   Max.   :0   Max.   :1.0000  
>    repstatus2       fecstatus2       matstatus2     alive2     stage2         
>  Min.   :0.0000   Min.   :0.0000   Min.   :1    Min.   :1   Length:320        
>  1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:1    1st Qu.:1   Class :character  
>  Median :0.0000   Median :0.0000   Median :1    Median :1   Mode  :character  
>  Mean   :0.3688   Mean   :0.1562   Mean   :1    Mean   :1                     
>  3rd Qu.:1.0000   3rd Qu.:0.0000   3rd Qu.:1    3rd Qu.:1                     
>  Max.   :1.0000   Max.   :1.0000   Max.   :1    Max.   :1                     
>   stage2index        xpos3            ypos3            sizea3        
>  Min.   : 6.00   Min.   : 46.50   Min.   :-28.00   Min.   :0.000000  
>  1st Qu.: 7.00   1st Qu.: 60.10   1st Qu.: 23.30   1st Qu.:0.000000  
>  Median :10.00   Median : 90.65   Median : 77.00   Median :0.000000  
>  Mean   :18.17   Mean   : 91.19   Mean   : 56.98   Mean   :0.009375  
>  3rd Qu.:32.00   3rd Qu.:141.80   3rd Qu.: 80.40   3rd Qu.:0.000000  
>  Max.   :54.00   Max.   :173.00   Max.   :142.40   Max.   :1.000000  
>      sizeb3           sizec3         size3added        repstra3       
>  Min.   : 0.000   Min.   : 0.000   Min.   : 0.000   Min.   :0.000000  
>  1st Qu.: 0.000   1st Qu.: 1.000   1st Qu.: 1.000   1st Qu.:0.000000  
>  Median : 0.000   Median : 1.000   Median : 2.000   Median :0.000000  
>  Mean   : 1.069   Mean   : 2.209   Mean   : 3.288   Mean   :0.009375  
>  3rd Qu.: 1.000   3rd Qu.: 3.000   3rd Qu.: 4.000   3rd Qu.:0.000000  
>  Max.   :18.000   Max.   :13.000   Max.   :24.000   Max.   :1.000000  
>     repstrb3          feca3          juvgiven3   obsstatus3    repstatus3 
>  Min.   : 0.000   Min.   :0.0000   Min.   :0   Min.   :0.0   Min.   :0.0  
>  1st Qu.: 0.000   1st Qu.:0.0000   1st Qu.:0   1st Qu.:1.0   1st Qu.:0.0  
>  Median : 0.000   Median :0.0000   Median :0   Median :1.0   Median :0.0  
>  Mean   : 1.069   Mean   :0.4562   Mean   :0   Mean   :0.9   Mean   :0.4  
>  3rd Qu.: 1.000   3rd Qu.:0.0000   3rd Qu.:0   3rd Qu.:1.0   3rd Qu.:1.0  
>  Max.   :18.000   Max.   :8.0000   Max.   :0   Max.   :1.0   Max.   :1.0  
>    fecstatus3       matstatus3     alive3          stage3         
>  Min.   :0.0000   Min.   :1    Min.   :0.0000   Length:320        
>  1st Qu.:0.0000   1st Qu.:1    1st Qu.:1.0000   Class :character  
>  Median :0.0000   Median :1    Median :1.0000   Mode  :character  
>  Mean   :0.2219   Mean   :1    Mean   :0.9469                     
>  3rd Qu.:0.0000   3rd Qu.:1    3rd Qu.:1.0000                     
>  Max.   :1.0000   Max.   :1    Max.   :1.0000                     
>   stage3index       density      
>  Min.   : 0.00   Min.   : 0.000  
>  1st Qu.: 7.00   1st Qu.: 0.000  
>  Median :10.00   Median : 1.000  
>  Mean   :18.57   Mean   : 1.931  
>  3rd Qu.:33.00   3rd Qu.: 3.000  
>  Max.   :54.00   Max.   :10.000

Before moving on to supplying R with the proxy transitions that we need to properly parameterize our models, let’s take a look at how we might explore our standardized dataset.

3.6 Exploring standardized datasets after stage classification

It is often useful to explore our data before using it to build MPMs. One way to explore the data is to look at the frequencies of the stage assignments that R has developed for each monitoring occasion. For this purpose, we can use function actualstage3(). Below, we show the simplest use of this function - to explore single stage assignments, as for ahistorical MPM development.

explore_2 <- actualstage3(cypraw_v1)

explore_2
>       rowid stageindex stage stage2 stage1 year2 Freq actual_prop
> 1    2004 D          6     D      D         2004    0  0.00000000
> 2  2004 XSm          7   XSm    XSm         2004   23  0.35384615
> 3   2004 Sm          8    Sm     Sm         2004   24  0.36923077
> 4   2004 Md          9    Md     Md         2004   10  0.15384615
> 5   2004 Lg         10    Lg     Lg         2004    7  0.10769231
> 6  2004 XLg         11   XLg    XLg         2004    1  0.01538462
> 7    2005 D          6     D      D         2005    1  0.01470588
> 8  2005 XSm          7   XSm    XSm         2005   23  0.33823529
> 9   2005 Sm          8    Sm     Sm         2005   27  0.39705882
> 10  2005 Md          9    Md     Md         2005    9  0.13235294
> 11  2005 Lg         10    Lg     Lg         2005    6  0.08823529
> 12 2005 XLg         11   XLg    XLg         2005    2  0.02941176
> 13   2006 D          6     D      D         2006    3  0.04687500
> 14 2006 XSm          7   XSm    XSm         2006   22  0.34375000
> 15  2006 Sm          8    Sm     Sm         2006   27  0.42187500
> 16  2006 Md          9    Md     Md         2006    9  0.14062500
> 17  2006 Lg         10    Lg     Lg         2006    2  0.03125000
> 18 2006 XLg         11   XLg    XLg         2006    1  0.01562500
> 19   2007 D          6     D      D         2007    3  0.04838710
> 20 2007 XSm          7   XSm    XSm         2007   20  0.32258065
> 21  2007 Sm          8    Sm     Sm         2007   25  0.40322581
> 22  2007 Md          9    Md     Md         2007    8  0.12903226
> 23  2007 Lg         10    Lg     Lg         2007    6  0.09677419
> 24 2007 XLg         11   XLg    XLg         2007    0  0.00000000
> 25   2008 D          6     D      D         2008    8  0.13114754
> 26 2008 XSm          7   XSm    XSm         2008   20  0.32786885
> 27  2008 Sm          8    Sm     Sm         2008   17  0.27868852
> 28  2008 Md          9    Md     Md         2008   12  0.19672131
> 29  2008 Lg         10    Lg     Lg         2008    2  0.03278689
> 30 2008 XLg         11   XLg    XLg         2008    2  0.03278689
> 31   2009 D          6     D      D         2009    0  0.00000000
> 32 2009 XSm          7   XSm    XSm         2009   15  0.26315789
> 33  2009 Sm          8    Sm     Sm         2009   23  0.40350877
> 34  2009 Md          9    Md     Md         2009   11  0.19298246
> 35  2009 Lg         10    Lg     Lg         2009    6  0.10526316
> 36 2009 XLg         11   XLg    XLg         2009    2  0.03508772

Each stage is shown in each year for which data is available. The number of individuals in each stage (column frequency), and the proportion of individual in that stage in each year (column actual_prop), are both shown. Deaths have been removed, yielding proportions that sum to 1.0.

Function actualstage3() can also be used to explore the frequencies of ages, age-stages, and historical stage pairs. For example, below we show the frequencies of ages.

explore_age <- actualstage3(cypraw_v1, check_stage = FALSE, check_age = TRUE)

explore_age
>      rowid age year2 Freq actual_prop
> 1   2004 5   5  2004   65  1.00000000
> 2   2004 6   6  2004    0  0.00000000
> 3   2004 7   7  2004    0  0.00000000
> 4   2004 8   8  2004    0  0.00000000
> 5   2004 9   9  2004    0  0.00000000
> 6  2004 10  10  2004    0  0.00000000
> 7   2005 5   5  2005    4  0.05882353
> 8   2005 6   6  2005   64  0.94117647
> 9   2005 7   7  2005    0  0.00000000
> 10  2005 8   8  2005    0  0.00000000
> 11  2005 9   9  2005    0  0.00000000
> 12 2005 10  10  2005    0  0.00000000
> 13  2006 5   5  2006    0  0.00000000
> 14  2006 6   6  2006    3  0.04687500
> 15  2006 7   7  2006   61  0.95312500
> 16  2006 8   8  2006    0  0.00000000
> 17  2006 9   9  2006    0  0.00000000
> 18 2006 10  10  2006    0  0.00000000
> 19  2007 5   5  2007    1  0.01612903
> 20  2007 6   6  2007    0  0.00000000
> 21  2007 7   7  2007    2  0.03225806
> 22  2007 8   8  2007   59  0.95161290
> 23  2007 9   9  2007    0  0.00000000
> 24 2007 10  10  2007    0  0.00000000
> 25  2008 5   5  2008    4  0.06557377
> 26  2008 6   6  2008    1  0.01639344
> 27  2008 7   7  2008    0  0.00000000
> 28  2008 8   8  2008    2  0.03278689
> 29  2008 9   9  2008   54  0.88524590
> 30 2008 10  10  2008    0  0.00000000
> 31  2009 5   5  2009    0  0.00000000
> 32  2009 6   6  2009    4  0.06557377
> 33  2009 7   7  2009    1  0.01639344
> 34  2009 8   8  2009    0  0.00000000
> 35  2009 9   9  2009    2  0.03278689
> 36 2009 10  10  2009   54  0.88524590
The results show a pattern in which only age 5 individuals are alive in the first year, followed by age 5 and age 6 in the second year, etc. This pattern occurs because R has assigned age 5 to all individuals seen in the first year automatically (this is due to the age.offset and prebreeding fields in functions verticalize3() and historicalize3()).

Other explorations are possible. For example, if we removed the check_stage = FALSE option from the inputs, then we would get the frequencies of age-stage combinations for each year. Finally, if we remove check_stage = FALSE, check_age = TRUE and add historical = TRUE, then we can see the frequencies of historical stage pairs, as below.

explore_3 <- actualstage3(cypraw_v1, historical = TRUE)

explore_3
> Warning in format.data.frame(if (omit) x[seq_len(n0), , drop = FALSE] else x, :
> corrupt data frame: columns will be truncated or padded with NAs
>                 rowid stageindex        stage stage2   stage1 year2 Freq
> 1     2004 D NotAlive          0   D NotAlive      D NotAlive  2004    0
> 2   2004 XSm NotAlive          0 XSm NotAlive    XSm NotAlive  2004   23
> 3    2004 Sm NotAlive          0  Sm NotAlive     Sm NotAlive  2004   24
> 4    2004 Md NotAlive          0  Md NotAlive     Md NotAlive  2004   10
> 5    2004 Lg NotAlive          0  Lg NotAlive     Lg NotAlive  2004    7
> 6   2004 XLg NotAlive          0 XLg NotAlive    XLg NotAlive  2004    1
> 7     2004 D NotAlive          0   D NotAlive      D NotAlive  2004    0
> 8          2004 XSm D          0        XSm D    XSm        D  2004    0
> 9           2004 Sm D          0         Sm D     Sm        D  2004    0
> 10          2004 Md D          0         Md D     Md        D  2004    0
> 11          2004 Lg D          0         Lg D     Lg        D  2004    0
> 12         2004 XLg D          0        XLg D    XLg        D  2004    0
> 13           2004 D D          0          D D      D        D  2004    0
> 14         2004 XSm D          0        XSm D    XSm        D  2004    0
> 15        2004 Sm XSm          0       Sm XSm     Sm      XSm  2004    0
> 16        2004 Md XSm          0       Md XSm     Md      XSm  2004    0
> 17        2004 Lg XSm          0       Lg XSm     Lg      XSm  2004    0
> 18       2004 XLg XSm          0      XLg XSm    XLg      XSm  2004    0
> 19         2004 D XSm          0        D XSm      D      XSm  2004    0
> 20       2004 XSm XSm          0      XSm XSm    XSm      XSm  2004    0
> 21        2004 Sm XSm          0       Sm XSm     Sm      XSm  2004    0
> 22         2004 Md Sm          0        Md Sm     Md       Sm  2004    0
> 23         2004 Lg Sm          0        Lg Sm     Lg       Sm  2004    0
> 24        2004 XLg Sm          0       XLg Sm    XLg       Sm  2004    0
> 25          2004 D Sm          0         D Sm      D       Sm  2004    0
> 26        2004 XSm Sm          0       XSm Sm    XSm       Sm  2004    0
> 27         2004 Sm Sm          0        Sm Sm     Sm       Sm  2004    0
> 28         2004 Md Sm          0        Md Sm     Md       Sm  2004    0
> 29         2004 Lg Md          0        Lg Md     Lg       Md  2004    0
> 30        2004 XLg Md          0       XLg Md    XLg       Md  2004    0
> 31          2004 D Md          0         D Md      D       Md  2004    0
> 32        2004 XSm Md          0       XSm Md    XSm       Md  2004    0
> 33         2004 Sm Md          0        Sm Md     Sm       Md  2004    0
> 34         2004 Md Md          0        Md Md     Md       Md  2004    0
> 35         2004 Lg Md          0        Lg Md     Lg       Md  2004    0
> 36        2004 XLg Lg          0       XLg Lg    XLg       Lg  2004    0
> 37          2004 D Lg          0         D Lg      D       Lg  2004    0
> 38        2004 XSm Lg          0       XSm Lg    XSm       Lg  2004    0
> 39         2004 Sm Lg          0        Sm Lg     Sm       Lg  2004    0
> 40         2004 Md Lg          0        Md Lg     Md       Lg  2004    0
> 41         2004 Lg Lg          0        Lg Lg     Lg       Lg  2004    0
> 42        2004 XLg Lg          0       XLg Lg    XLg       Lg  2004    0
> 43         2005 D XLg          0        D XLg      D      XLg  2005    0
> 44       2005 XSm XLg          0      XSm XLg    XSm      XLg  2005    0
> 45        2005 Sm XLg          0       Sm XLg     Sm      XLg  2005    0
> 46        2005 Md XLg          0       Md XLg     Md      XLg  2005    0
> 47        2005 Lg XLg          0       Lg XLg     Lg      XLg  2005    0
> 48       2005 XLg XLg          0      XLg XLg    XLg      XLg  2005    1
> 49         2005 D XLg          0        D XLg      D      XLg  2005    0
> 50  2005 XSm NotAlive          0 XSm NotAlive    XSm NotAlive  2005    2
> 51   2005 Sm NotAlive          0  Sm NotAlive     Sm NotAlive  2005    2
> 52   2005 Md NotAlive          0  Md NotAlive     Md NotAlive  2005    0
> 53   2005 Lg NotAlive          0  Lg NotAlive     Lg NotAlive  2005    0
> 54  2005 XLg NotAlive          0 XLg NotAlive    XLg NotAlive  2005    0
> 55    2005 D NotAlive          0   D NotAlive      D NotAlive  2005    0
> 56  2005 XSm NotAlive          0 XSm NotAlive    XSm NotAlive  2005    2
> 57          2005 Sm D          0         Sm D     Sm        D  2005    0
> 58          2005 Md D          0         Md D     Md        D  2005    0
> 59          2005 Lg D          0         Lg D     Lg        D  2005    0
> 60         2005 XLg D          0        XLg D    XLg        D  2005    0
> 61           2005 D D          0          D D      D        D  2005    0
> 62         2005 XSm D          0        XSm D    XSm        D  2005    0
> 63          2005 Sm D          0         Sm D     Sm        D  2005    0
> 64        2005 Md XSm          0       Md XSm     Md      XSm  2005    0
> 65        2005 Lg XSm          0       Lg XSm     Lg      XSm  2005    1
> 66       2005 XLg XSm          0      XLg XSm    XLg      XSm  2005    0
> 67         2005 D XSm          0        D XSm      D      XSm  2005    1
> 68       2005 XSm XSm          0      XSm XSm    XSm      XSm  2005   15
> 69        2005 Sm XSm          0       Sm XSm     Sm      XSm  2005    5
> 70        2005 Md XSm          0       Md XSm     Md      XSm  2005    0
> 71         2005 Lg Sm          0        Lg Sm     Lg       Sm  2005    0
> 72        2005 XLg Sm          0       XLg Sm    XLg       Sm  2005    0
> 73          2005 D Sm          0         D Sm      D       Sm  2005    0
> 74        2005 XSm Sm          0       XSm Sm    XSm       Sm  2005    6
> 75         2005 Sm Sm          0        Sm Sm     Sm       Sm  2005   14
> 76         2005 Md Sm          0        Md Sm     Md       Sm  2005    4
> 77         2005 Lg Sm          0        Lg Sm     Lg       Sm  2005    0
> 78        2005 XLg Md          0       XLg Md    XLg       Md  2005    0
> 79          2005 D Md          0         D Md      D       Md  2005    0
> 80        2005 XSm Md          0       XSm Md    XSm       Md  2005    0
> 81         2005 Sm Md          0        Sm Md     Sm       Md  2005    5
> 82         2005 Md Md          0        Md Md     Md       Md  2005    4
> 83         2005 Lg Md          0        Lg Md     Lg       Md  2005    1
> 84        2005 XLg Md          0       XLg Md    XLg       Md  2005    0
> 85          2006 D Lg          0         D Lg      D       Lg  2006    0
> 86        2006 XSm Lg          0       XSm Lg    XSm       Lg  2006    0
> 87         2006 Sm Lg          0        Sm Lg     Sm       Lg  2006    2
> 88         2006 Md Lg          0        Md Lg     Md       Lg  2006    3
> 89         2006 Lg Lg          0        Lg Lg     Lg       Lg  2006    1
> 90        2006 XLg Lg          0       XLg Lg    XLg       Lg  2006    0
> 91          2006 D Lg          0         D Lg      D       Lg  2006    0
> 92       2006 XSm XLg          0      XSm XLg    XSm      XLg  2006    0
> 93        2006 Sm XLg          0       Sm XLg     Sm      XLg  2006    0
> 94        2006 Md XLg          0       Md XLg     Md      XLg  2006    0
> 95        2006 Lg XLg          0       Lg XLg     Lg      XLg  2006    1
> 96       2006 XLg XLg          0      XLg XLg    XLg      XLg  2006    1
> 97         2006 D XLg          0        D XLg      D      XLg  2006    0
> 98       2006 XSm XLg          0      XSm XLg    XSm      XLg  2006    0
> 99   2006 Sm NotAlive          0  Sm NotAlive     Sm NotAlive  2006    0
> 100  2006 Md NotAlive          0  Md NotAlive     Md NotAlive  2006    0
> 101  2006 Lg NotAlive          0  Lg NotAlive     Lg NotAlive  2006    0
> 102 2006 XLg NotAlive          0 XLg NotAlive    XLg NotAlive  2006    0
> 103   2006 D NotAlive          0   D NotAlive      D NotAlive  2006    0
> 104 2006 XSm NotAlive          0 XSm NotAlive    XSm NotAlive  2006    0
> 105  2006 Sm NotAlive          0  Sm NotAlive     Sm NotAlive  2006    0
> 106         2006 Md D          0         Md D     Md        D  2006    0
> 107         2006 Lg D          0         Lg D     Lg        D  2006    0
> 108        2006 XLg D          0        XLg D    XLg        D  2006    0
> 109          2006 D D          0          D D      D        D  2006    0
> 110        2006 XSm D          0        XSm D    XSm        D  2006    0
> 111         2006 Sm D          0         Sm D     Sm        D  2006    1
> 112         2006 Md D          0         Md D     Md        D  2006    0
> 113       2006 Lg XSm          0       Lg XSm     Lg      XSm  2006    0
> 114      2006 XLg XSm          0      XLg XSm    XLg      XSm  2006    0
> 115        2006 D XSm          0        D XSm      D      XSm  2006    2
> 116      2006 XSm XSm          0      XSm XSm    XSm      XSm  2006   14
> 117       2006 Sm XSm          0       Sm XSm     Sm      XSm  2006    4
> 118       2006 Md XSm          0       Md XSm     Md      XSm  2006    0
> 119       2006 Lg XSm          0       Lg XSm     Lg      XSm  2006    0
> 120       2006 XLg Sm          0       XLg Sm    XLg       Sm  2006    0
> 121         2006 D Sm          0         D Sm      D       Sm  2006    1
> 122       2006 XSm Sm          0       XSm Sm    XSm       Sm  2006    7
> 123        2006 Sm Sm          0        Sm Sm     Sm       Sm  2006   16
> 124        2006 Md Sm          0        Md Sm     Md       Sm  2006    2
> 125        2006 Lg Sm          0        Lg Sm     Lg       Sm  2006    0
> 126       2006 XLg Sm          0       XLg Sm    XLg       Sm  2006    0
> 127         2007 D Md          0         D Md      D       Md  2007    0
> 128       2007 XSm Md          0       XSm Md    XSm       Md  2007    1
> 129        2007 Sm Md          0        Sm Md     Sm       Md  2007    3
> 130        2007 Md Md          0        Md Md     Md       Md  2007    4
> 131        2007 Lg Md          0        Lg Md     Lg       Md  2007    1
> 132       2007 XLg Md          0       XLg Md    XLg       Md  2007    0
> 133         2007 D Md          0         D Md      D       Md  2007    0
> 134       2007 XSm Lg          0       XSm Lg    XSm       Lg  2007    0
> 135        2007 Sm Lg          0        Sm Lg     Sm       Lg  2007    0
> 136        2007 Md Lg          0        Md Lg     Md       Lg  2007    0
> 137        2007 Lg Lg          0        Lg Lg     Lg       Lg  2007    2
> 138       2007 XLg Lg          0       XLg Lg    XLg       Lg  2007    0
> 139         2007 D Lg          0         D Lg      D       Lg  2007    0
> 140       2007 XSm Lg          0       XSm Lg    XSm       Lg  2007    0
> 141       2007 Sm XLg          0       Sm XLg     Sm      XLg  2007    0
> 142       2007 Md XLg          0       Md XLg     Md      XLg  2007    0
> 143       2007 Lg XLg          0       Lg XLg     Lg      XLg  2007    1
> 144      2007 XLg XLg          0      XLg XLg    XLg      XLg  2007    0
> 145        2007 D XLg          0        D XLg      D      XLg  2007    0
> 146      2007 XSm XLg          0      XSm XLg    XSm      XLg  2007    0
> 147       2007 Sm XLg          0       Sm XLg     Sm      XLg  2007    0
> 148  2007 Md NotAlive          0  Md NotAlive     Md NotAlive  2007    0
> 149  2007 Lg NotAlive          0  Lg NotAlive     Lg NotAlive  2007    0
> 150 2007 XLg NotAlive          0 XLg NotAlive    XLg NotAlive  2007    0
> 151   2007 D NotAlive          0   D NotAlive      D NotAlive  2007    0
> 152 2007 XSm NotAlive          0 XSm NotAlive    XSm NotAlive  2007    1
> 153  2007 Sm NotAlive          0  Sm NotAlive     Sm NotAlive  2007    0
> 154  2007 Md NotAlive          0  Md NotAlive     Md NotAlive  2007    0
> 155         2007 Lg D          0         Lg D     Lg        D  2007    0
> 156        2007 XLg D          0        XLg D    XLg        D  2007    0
> 157          2007 D D          0          D D      D        D  2007    0
> 158        2007 XSm D          0        XSm D    XSm        D  2007    2
> 159         2007 Sm D          0         Sm D     Sm        D  2007    1
> 160         2007 Md D          0         Md D     Md        D  2007    0
> 161         2007 Lg D          0         Lg D     Lg        D  2007    0
> 162      2007 XLg XSm          0      XLg XSm    XLg      XSm  2007    0
> 163        2007 D XSm          0        D XSm      D      XSm  2007    0
> 164      2007 XSm XSm          0      XSm XSm    XSm      XSm  2007   11
> 165       2007 Sm XSm          0       Sm XSm     Sm      XSm  2007    7
> 166       2007 Md XSm          0       Md XSm     Md      XSm  2007    1
> 167       2007 Lg XSm          0       Lg XSm     Lg      XSm  2007    0
> 168      2007 XLg XSm          0      XLg XSm    XLg      XSm  2007    0
> 169         2008 D Sm          0         D Sm      D       Sm  2008    3
> 170       2008 XSm Sm          0       XSm Sm    XSm       Sm  2008    7
> 171        2008 Sm Sm          0        Sm Sm     Sm       Sm  2008    7
> 172        2008 Md Sm          0        Md Sm     Md       Sm  2008    6
> 173        2008 Lg Sm          0        Lg Sm     Lg       Sm  2008    0
> 174       2008 XLg Sm          0       XLg Sm    XLg       Sm  2008    0
> 175         2008 D Sm          0         D Sm      D       Sm  2008    3
> 176       2008 XSm Md          0       XSm Md    XSm       Md  2008    2
> 177        2008 Sm Md          0        Sm Md     Sm       Md  2008    3
> 178        2008 Md Md          0        Md Md     Md       Md  2008    3
> 179        2008 Lg Md          0        Lg Md     Lg       Md  2008    0
> 180       2008 XLg Md          0       XLg Md    XLg       Md  2008    0
> 181         2008 D Md          0         D Md      D       Md  2008    0
> 182       2008 XSm Md          0       XSm Md    XSm       Md  2008    2
> 183        2008 Sm Lg          0        Sm Lg     Sm       Lg  2008    1
> 184        2008 Md Lg          0        Md Lg     Md       Lg  2008    2
> 185        2008 Lg Lg          0        Lg Lg     Lg       Lg  2008    1
> 186       2008 XLg Lg          0       XLg Lg    XLg       Lg  2008    2
> 187         2008 D Lg          0         D Lg      D       Lg  2008    0
> 188       2008 XSm Lg          0       XSm Lg    XSm       Lg  2008    0
> 189        2008 Sm Lg          0        Sm Lg     Sm       Lg  2008    1
> 190       2008 Md XLg          0       Md XLg     Md      XLg  2008    0
> 191       2008 Lg XLg          0       Lg XLg     Lg      XLg  2008    0
> 192      2008 XLg XLg          0      XLg XLg    XLg      XLg  2008    0
> 193        2008 D XLg          0        D XLg      D      XLg  2008    0
> 194      2008 XSm XLg          0      XSm XLg    XSm      XLg  2008    0
> 195       2008 Sm XLg          0       Sm XLg     Sm      XLg  2008    0
> 196       2008 Md XLg          0       Md XLg     Md      XLg  2008    0
> 197  2008 Lg NotAlive          0  Lg NotAlive     Lg NotAlive  2008    0
> 198 2008 XLg NotAlive          0 XLg NotAlive    XLg NotAlive  2008    0
> 199   2008 D NotAlive          0   D NotAlive      D NotAlive  2008    0
> 200 2008 XSm NotAlive          0 XSm NotAlive    XSm NotAlive  2008    3
> 201  2008 Sm NotAlive          0  Sm NotAlive     Sm NotAlive  2008    1
> 202  2008 Md NotAlive          0  Md NotAlive     Md NotAlive  2008    0
> 203  2008 Lg NotAlive          0  Lg NotAlive     Lg NotAlive  2008    0
> 204        2008 XLg D          0        XLg D    XLg        D  2008    0
> 205          2008 D D          0          D D      D        D  2008    1
> 206        2008 XSm D          0        XSm D    XSm        D  2008    1
> 207         2008 Sm D          0         Sm D     Sm        D  2008    0
> 208         2008 Md D          0         Md D     Md        D  2008    0
> 209         2008 Lg D          0         Lg D     Lg        D  2008    1
> 210        2008 XLg D          0        XLg D    XLg        D  2008    0
> 211        2009 D XSm          0        D XSm      D      XSm  2009    0
> 212      2009 XSm XSm          0      XSm XSm    XSm      XSm  2009    9
> 213       2009 Sm XSm          0       Sm XSm     Sm      XSm  2009    9
> 214       2009 Md XSm          0       Md XSm     Md      XSm  2009    0
> 215       2009 Lg XSm          0       Lg XSm     Lg      XSm  2009    0
> 216      2009 XLg XSm          0      XLg XSm    XLg      XSm  2009    0
> 217        2009 D XSm          0        D XSm      D      XSm  2009    0
> 218       2009 XSm Sm          0       XSm Sm    XSm       Sm  2009    1
> 219        2009 Sm Sm          0        Sm Sm     Sm       Sm  2009   11
> 220        2009 Md Sm          0        Md Sm     Md       Sm  2009    2
> 221        2009 Lg Sm          0        Lg Sm     Lg       Sm  2009    1
> 222       2009 XLg Sm          0       XLg Sm    XLg       Sm  2009    0
> 223         2009 D Sm          0         D Sm      D       Sm  2009    0
> 224       2009 XSm Sm          0       XSm Sm    XSm       Sm  2009    1
> 225        2009 Sm Md          0        Sm Md     Sm       Md  2009    0
> 226        2009 Md Md          0        Md Md     Md       Md  2009    9
> 227        2009 Lg Md          0        Lg Md     Lg       Md  2009    3
> 228       2009 XLg Md          0       XLg Md    XLg       Md  2009    0
> 229         2009 D Md          0         D Md      D       Md  2009    0
> 230       2009 XSm Md          0       XSm Md    XSm       Md  2009    0
> 231        2009 Sm Md          0        Sm Md     Sm       Md  2009    0
> 232        2009 Md Lg          0        Md Lg     Md       Lg  2009    0
> 233        2009 Lg Lg          0        Lg Lg     Lg       Lg  2009    2
> 234       2009 XLg Lg          0       XLg Lg    XLg       Lg  2009    0
> 235         2009 D Lg          0         D Lg      D       Lg  2009    0
> 236       2009 XSm Lg          0       XSm Lg    XSm       Lg  2009    0
> 237        2009 Sm Lg          0        Sm Lg     Sm       Lg  2009    0
> 238        2009 Md Lg          0        Md Lg     Md       Lg  2009    0
> 239       2009 Lg XLg          0       Lg XLg     Lg      XLg  2009    0
> 240      2009 XLg XLg          0      XLg XLg    XLg      XLg  2009    2
> 241        2009 D XLg          0        D XLg      D      XLg  2009    0
> 242      2009 XSm XLg          0      XSm XLg    XSm      XLg  2009    0
> 243       2009 Sm XLg          0       Sm XLg     Sm      XLg  2009    0
> 244       2009 Md XLg          0       Md XLg     Md      XLg  2009    0
> 245       2009 Lg XLg          0       Lg XLg     Lg      XLg  2009    0
> 246 2009 XLg NotAlive          0 XLg NotAlive    XLg NotAlive  2009    0
> 247   2009 D NotAlive          0   D NotAlive      D NotAlive  2009    0
> 248 2009 XSm NotAlive          0 XSm NotAlive    XSm NotAlive  2009    0
> 249  2009 Sm NotAlive          0  Sm NotAlive     Sm NotAlive  2009    0
> 250  2009 Md NotAlive          0  Md NotAlive     Md NotAlive  2009    0
> 251  2009 Lg NotAlive          0  Lg NotAlive     Lg NotAlive  2009    0
> 252 2009 XLg NotAlive          0 XLg NotAlive    XLg NotAlive  2009    0
>     actual_prop
> 1    0.00000000
> 2    0.35384615
> 3    0.36923077
> 4    0.15384615
> 5    0.10769231
> 6    0.01538462
> 7    0.00000000
> 8    0.00000000
> 9    0.00000000
> 10   0.00000000
> 11   0.00000000
> 12   0.00000000
> 13   0.00000000
> 14   0.00000000
> 15   0.00000000
> 16   0.00000000
> 17   0.00000000
> 18   0.00000000
> 19   0.00000000
> 20   0.00000000
> 21   0.00000000
> 22   0.00000000
> 23   0.00000000
> 24   0.00000000
> 25   0.00000000
> 26   0.00000000
> 27   0.00000000
> 28   0.00000000
> 29   0.00000000
> 30   0.00000000
> 31   0.00000000
> 32   0.00000000
> 33   0.00000000
> 34   0.00000000
> 35   0.00000000
> 36   0.00000000
> 37   0.00000000
> 38   0.00000000
> 39   0.00000000
> 40   0.00000000
> 41   0.00000000
> 42   0.00000000
> 43   0.00000000
> 44   0.00000000
> 45   0.00000000
> 46   0.00000000
> 47   0.00000000
> 48   0.01587302
> 49   0.00000000
> 50   0.03174603
> 51   0.03174603
> 52   0.00000000
> 53   0.00000000
> 54   0.00000000
> 55   0.00000000
> 56   0.03174603
> 57   0.00000000
> 58   0.00000000
> 59   0.00000000
> 60   0.00000000
> 61   0.00000000
> 62   0.00000000
> 63   0.00000000
> 64   0.00000000
> 65   0.01587302
> 66   0.00000000
> 67   0.01587302
> 68   0.23809524
> 69   0.07936508
> 70   0.00000000
> 71   0.00000000
> 72   0.00000000
> 73   0.00000000
> 74   0.09523810
> 75   0.22222222
> 76   0.06349206
> 77   0.00000000
> 78   0.00000000
> 79   0.00000000
> 80   0.00000000
> 81   0.07936508
> 82   0.06349206
> 83   0.01587302
> 84   0.00000000
> 85   0.00000000
> 86   0.00000000
> 87   0.03636364
> 88   0.05454545
> 89   0.01818182
> 90   0.00000000
> 91   0.00000000
> 92   0.00000000
> 93   0.00000000
> 94   0.00000000
> 95   0.01818182
> 96   0.01818182
> 97   0.00000000
> 98   0.00000000
> 99   0.00000000
> 100  0.00000000
> 101  0.00000000
> 102  0.00000000
> 103  0.00000000
> 104  0.00000000
> 105  0.00000000
> 106  0.00000000
> 107  0.00000000
> 108  0.00000000
> 109  0.00000000
> 110  0.00000000
> 111  0.01818182
> 112  0.00000000
> 113  0.00000000
> 114  0.00000000
> 115  0.03636364
> 116  0.25454545
> 117  0.07272727
> 118  0.00000000
> 119  0.00000000
> 120  0.00000000
> 121  0.01818182
> 122  0.12727273
> 123  0.29090909
> 124  0.03636364
> 125  0.00000000
> 126  0.00000000
> 127  0.00000000
> 128  0.02857143
> 129  0.08571429
> 130  0.11428571
> 131  0.02857143
> 132  0.00000000
> 133  0.00000000
> 134  0.00000000
> 135  0.00000000
> 136  0.00000000
> 137  0.05714286
> 138  0.00000000
> 139  0.00000000
> 140  0.00000000
> 141  0.00000000
> 142  0.00000000
> 143  0.02857143
> 144  0.00000000
> 145  0.00000000
> 146  0.00000000
> 147  0.00000000
> 148  0.00000000
> 149  0.00000000
> 150  0.00000000
> 151  0.00000000
> 152  0.02857143
> 153  0.00000000
> 154  0.00000000
> 155  0.00000000
> 156  0.00000000
> 157  0.00000000
> 158  0.05714286
> 159  0.02857143
> 160  0.00000000
> 161  0.00000000
> 162  0.00000000
> 163  0.00000000
> 164  0.31428571
> 165  0.20000000
> 166  0.02857143
> 167  0.00000000
> 168  0.00000000
> 169  0.06000000
> 170  0.14000000
> 171  0.14000000
> 172  0.12000000
> 173  0.00000000
> 174  0.00000000
> 175  0.06000000
> 176  0.04000000
> 177  0.06000000
> 178  0.06000000
> 179  0.00000000
> 180  0.00000000
> 181  0.00000000
> 182  0.04000000
> 183  0.02000000
> 184  0.04000000
> 185  0.02000000
> 186  0.04000000
> 187  0.00000000
> 188  0.00000000
> 189  0.02000000
> 190  0.00000000
> 191  0.00000000
> 192  0.00000000
> 193  0.00000000
> 194  0.00000000
> 195  0.00000000
> 196  0.00000000
> 197  0.00000000
> 198  0.00000000
> 199  0.00000000
> 200  0.06000000
> 201  0.02000000
> 202  0.00000000
> 203  0.00000000
> 204  0.00000000
> 205  0.02000000
> 206  0.02000000
> 207  0.00000000
> 208  0.00000000
> 209  0.02000000
> 210  0.00000000
> 211  0.00000000
> 212  0.18000000
> 213  0.18000000
> 214  0.00000000
> 215  0.00000000
> 216  0.00000000
> 217  0.00000000
> 218  0.02000000
> 219  0.22000000
> 220  0.04000000
> 221  0.02000000
> 222  0.00000000
> 223  0.00000000
> 224  0.02000000
> 225  0.00000000
> 226  0.18000000
> 227  0.06000000
> 228  0.00000000
> 229  0.00000000
> 230  0.00000000
> 231  0.00000000
> 232  0.00000000
> 233  0.04000000
> 234  0.00000000
> 235  0.00000000
> 236  0.00000000
> 237  0.00000000
> 238  0.00000000
> 239  0.00000000
> 240  0.04000000
> 241  0.00000000
> 242  0.00000000
> 243  0.00000000
> 244  0.00000000
> 245  0.00000000
> 246  0.00000000
> 247  0.00000000
> 248  0.00000000
> 249  0.00000000
> 250  0.00000000
> 251  0.00000000
> 252  0.00000000

Historical stage pairs include stage in time t and stage in time t-1. In the first year of observation, the stage in time t-1 is unknowable, so is shown above as NotAlive (although it is certainly possible that the individual was alive in the previous year). Starting from the second year, we see many knowable stage pairs with individuals, and as before their proportions within each year sum to 1.0.

Let’s now move on to adding supplemental information to our MPMs.

3.7 Formatting supplemental data needed for matrix estimation

MPMs are often estimated only partially from available demographic datasets. Some transitions are parameterized using information gathered from other studies, whether through direct input in the matrix or through the development of kernels contingent on external information. Other transitions might also be estimated via proxy transitions elsewhere in the matrix. In lefko3, this information can be provided in one of two ways. The preferred and most recently developed method is the supplement table, which can be developed using the supplemental() function. This function allows users to create a data frame detailing:

  1. specific transitions to set as constants
  2. specific transitions to estimate via proxy transitions, which can also be multiplied by fixed values
  3. specific multipliers for fecundity in cases in which fecundity estimates resulting from linear modeling must be modified to characterize the full transition.

Examples might illustrate where this approach is useful. If I lack my own data on subterranean juvenile stages in a plant species, but I have estimates of survival for those stages form another study, then I might use those estimates as constants in the MPM. Further, if I lack demographic data on the development of germinated seeds to the seedling or earliest adult stage, but I have reason to believe that the survival probabilities should be similar to the survival within an observed stage of seedlings or small adults, then I can use the latter survival-transitions as proxies. Finally, if fecundity is a function of seed production, survival to the next year, and germination probability, then germination probability might be estimated via a separate field germination study. I might wish to incorporate this germination probability both as a constant transition, and as a multiplier on estimated fecundity. Supplement tables provide a means to include all of this information.

Function supplemental() was developed to provide a robust, general solution to the addition of these data to MPMs. To use this function, first identify each transition that needs to be altered, and split each transition into stage in times t+1, t, and, if conducting a historical analysis, t-1. These stages must then be entered in the same order across the stage3, stage2, and stage1 fields. For example, if I wished to alter the historical transitions from stage A to B to C, and from A to A to C, then I would enter these two transitions as

stage3 = c("C", "C"), stage2 = c("B", "A"), stage1 = c("A", "A")

If I were interested in ahistorical transitions, then I would either set all stage1 values to NA, such as stage1 = c(NA, NA), or simply not include stage1 in the input (the default is a vector of NA elements). If I wished to replace my two transitions with proxy transitions that lefko3 will estimate, then I can designate those proxy transitions using the eststage fields. For example:

eststage3 = c("F", "F"), eststage2 = c("E", "D"), eststage1 = c("D", "D")

The above would replace my original transitions (A-B-C and A-A-C) with the values estimated for transitions D-E-F and D-D-F, respectively. Alternatively, if I wished to set these two transitions to fixed constants, then I could designate those with givenrate. For example, givenrate = c(0.15, 0.25) would set these two transitions to 0.15 and 0.25, respectively. Estimated fecundity, as well as proxy values, can be modified by a multiplier using the multiplier field, and it is important to identify the kind of transition to modify as a survival transition or a fecundity rate using the type field (use type12 also to designate the kind of transition occurs between times t-1 and t in the historical case). Fecundity multipliers should be identified separately, since they are not proxy values. The function requires the input of the stageframe used to generate the stages.

We will start off by creating two supplement tables taking all of these sorts of data for the function-based MPMs. The first is the supplement table for the historical analysis, and the second table covers the ahistorical analysis. Each row refers to a specific transition, and in the historical case, there are codes for 23 given transitions (12 for the ahistorical case). The first nine of the historical transitions are set to specific probabilities (six in the ahistorical case), and the next 12 are transitions that will be set to other, estimated transitions (four in the ahistorical case; these are the non-NA transitions in eststage set below) multiplied by specific constants (either 0.7 or 1.0). The final two terms are fecundity multipliers, which will here be used to handle the seed dormancy rate and the germination rate (both including seed survival over the course of the year). Based on the literature, the proxies for entry into the adult classes are transitions from dormancy, as below. However, in the raw dataset, dormancy is not common enough to use as an effective proxy in raw matrix creation. Hence, we can use different proxies for function-based matrix estimation than for raw matrix estimation. Where necessary, we also use rep and mat as shorthand to code for all reproductive stages and all mature stages, respectively.

Here is the historical supplement table. We will also introduce a variable representing the number of seeds expected per fruit. Note that the number of seeds per fruit is actually likely higher than this, but we are using this number to reflect the relatively stable population dynamics that we see in the population.

seeds_per_fruit <- 5000
sl_mult <- 0.7

cypsupp3_fb <- supplemental(stage3 = c("SD", "SD", "P1", "P1", "P2", "P3", "SL",
    "SL", "SL", "D", "V1", "V2", "V3", "D", "V1", "V2", "V3", "mat", "mat",
    "mat", "mat", "SD", "P1"), 
  stage2 = c("SD", "SD", "SD", "SD", "P1", "P2", "P3", "SL", "SL", "SL", "SL", 
    "SL", "SL", "SL", "SL", "SL", "SL", "D", "V1", "V2", "V3", "rep", "rep"), 
  stage1 = c("SD", "rep", "SD", "rep", "SD", "P1", "P2", "P3", "SL", "P3", "P3",
    "P3", "P3", "SL", "SL", "SL", "SL", "SL", "SL", "SL", "SL", "mat", "mat"), 
  eststage3 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, "D", "V1", "V2", "V3", "D",
    "V1", "V2", "V3", "mat", "mat", "mat", "mat", NA, NA), 
  eststage2 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, "D", "D", "D", "D", "D", 
    "D", "D", "D", "D", "V1", "V2", "V3", NA, NA), 
  eststage1 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, "D", "D", "D", "D", "D", 
    "D", "D", "D", "V1", "V1", "V1", "V1", NA, NA), 
  givenrate = c(0.08, 0.08, 0.1, 0.1, 0.1, 0.1, 0.1, 0.05, 0.05, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  multiplier = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, sl_mult, sl_mult,
    sl_mult, sl_mult, sl_mult, sl_mult, sl_mult, sl_mult, 1, 1, 1, 1,
    0.5 * seeds_per_fruit, 0.5 * seeds_per_fruit),
  type = c("S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S",
    "S", "S", "S", "S", "S", "S", "S", "R", "R"), 
  type_t12 = c("S", "F", "S", "F", "S", "S", "S", "S", "S", "S", "S", "S", "S",
    "S", "S", "S", "S", "S", "S", "S", "S", "S", "S"),
  stageframe = cypframe_fb, historical = TRUE)

cypsupp3_fb
>    stage3 stage2 stage1 eststage3 eststage2 eststage1 givenrate multiplier
> 1      SD     SD     SD      <NA>      <NA>      <NA>      0.08        1.0
> 2      SD     SD    rep      <NA>      <NA>      <NA>      0.08        1.0
> 3      P1     SD     SD      <NA>      <NA>      <NA>      0.10        1.0
> 4      P1     SD    rep      <NA>      <NA>      <NA>      0.10        1.0
> 5      P2     P1     SD      <NA>      <NA>      <NA>      0.10        1.0
> 6      P3     P2     P1      <NA>      <NA>      <NA>      0.10        1.0
> 7      SL     P3     P2      <NA>      <NA>      <NA>      0.10        1.0
> 8      SL     SL     P3      <NA>      <NA>      <NA>      0.05        1.0
> 9      SL     SL     SL      <NA>      <NA>      <NA>      0.05        1.0
> 10      D     SL     P3         D         D         D        NA        0.7
> 11     V1     SL     P3        V1         D         D        NA        0.7
> 12     V2     SL     P3        V2         D         D        NA        0.7
> 13     V3     SL     P3        V3         D         D        NA        0.7
> 14      D     SL     SL         D         D         D        NA        0.7
> 15     V1     SL     SL        V1         D         D        NA        0.7
> 16     V2     SL     SL        V2         D         D        NA        0.7
> 17     V3     SL     SL        V3         D         D        NA        0.7
> 18    mat      D     SL       mat         D        V1        NA        1.0
> 19    mat     V1     SL       mat        V1        V1        NA        1.0
> 20    mat     V2     SL       mat        V2        V1        NA        1.0
> 21    mat     V3     SL       mat        V3        V1        NA        1.0
> 22     SD    rep    mat      <NA>      <NA>      <NA>        NA     2500.0
> 23     P1    rep    mat      <NA>      <NA>      <NA>        NA     2500.0
>    convtype convtype_t12
> 1         1            1
> 2         1            2
> 3         1            1
> 4         1            2
> 5         1            1
> 6         1            1
> 7         1            1
> 8         1            1
> 9         1            1
> 10        1            1
> 11        1            1
> 12        1            1
> 13        1            1
> 14        1            1
> 15        1            1
> 16        1            1
> 17        1            1
> 18        1            1
> 19        1            1
> 20        1            1
> 21        1            1
> 22        3            1
> 23        3            1

Now we can input the ahistorical supplement table.

cypsupp2_fb <- supplemental(stage3 = c("SD", "P1", "P2", "P3", "SL", "SL", "D",
    "V1", "V2", "V3", "SD", "P1"), 
  stage2 = c("SD", "SD", "P1", "P2", "P3", "SL", "SL", "SL", "SL", "SL", "rep",
    "rep"), 
  eststage3 = c(NA, NA, NA, NA, NA, NA, "D", "V1", "V2", "V3", NA, NA), 
  eststage2 = c(NA, NA, NA, NA, NA, NA, "D", "D", "D", "D", NA, NA), 
  givenrate = c(0.08, 0.1, 0.1, 0.1, 0.05, 0.05, NA, NA, NA, NA, NA, NA), 
  multiplier = c(NA, NA, NA, NA, NA, NA, sl_mult, sl_mult, sl_mult, sl_mult,
    0.5 * seeds_per_fruit, 0.5 * seeds_per_fruit),
  type = c("S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "R", "R"),
  stageframe = cypframe_fb, historical = FALSE)

cypsupp2_fb
>    stage3 stage2 stage1 eststage3 eststage2 eststage1 givenrate multiplier
> 1      SD     SD   <NA>      <NA>      <NA>      <NA>      0.08        1.0
> 2      P1     SD   <NA>      <NA>      <NA>      <NA>      0.10        1.0
> 3      P2     P1   <NA>      <NA>      <NA>      <NA>      0.10        1.0
> 4      P3     P2   <NA>      <NA>      <NA>      <NA>      0.10        1.0
> 5      SL     P3   <NA>      <NA>      <NA>      <NA>      0.05        1.0
> 6      SL     SL   <NA>      <NA>      <NA>      <NA>      0.05        1.0
> 7       D     SL   <NA>         D         D      <NA>        NA        0.7
> 8      V1     SL   <NA>        V1         D      <NA>        NA        0.7
> 9      V2     SL   <NA>        V2         D      <NA>        NA        0.7
> 10     V3     SL   <NA>        V3         D      <NA>        NA        0.7
> 11     SD    rep   <NA>      <NA>      <NA>      <NA>        NA     2500.0
> 12     P1    rep   <NA>      <NA>      <NA>      <NA>        NA     2500.0
>    convtype convtype_t12
> 1         1            1
> 2         1            1
> 3         1            1
> 4         1            1
> 5         1            1
> 6         1            1
> 7         1            1
> 8         1            1
> 9         1            1
> 10        1            1
> 11        3            1
> 12        3            1

These supplement tables provide the best means of adding external data to our MPMs because they allow both specific transitions to be isolated. They also allow the use of shorthand to identify large groups of transitions (e.g. using mat, rep, immat, prop, npr, obs, nobs, or all to signify all mature stages, reproductive stages, immature stages, propagule stages, non-propagule stages, observable stages, unobservable stages, or simply all stages, respectively). Let’s now also supply the supplement tables for the raw MPMs.

cypsupp3_raw <- supplemental(stage3 = c("SD", "SD", "P1", "P1", "P2", "P2",
    "P3", "SL", "SL", "SL", "D", "XSm", "Sm", "D", "XSm", "Sm", "mat", "mat",
    "mat", "SD", "P1"),
  stage2 = c("SD", "SD", "SD", "SD", "P1", "P1", "P2", "P3", "SL", "SL", "SL",
    "SL", "SL", "SL", "SL", "SL", "D", "XSm", "Sm", "rep", "rep"),
  stage1 = c("SD", "rep", "SD", "rep", "SD", "rep", "P1", "P2", "P3", "SL",
    "SL", "SL", "SL", "P3", "P3", "P3", "SL", "SL", "SL", "mat", "mat"),
  eststage3 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "D", "XSm", "Sm", "D",
    "XSm", "Sm", "mat", "mat", "mat", NA, NA), 
  eststage2 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "XSm", "XSm", "XSm",
    "XSm", "XSm", "XSm", "D", "XSm", "Sm", NA, NA),
  eststage1 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "XSm", "XSm", "XSm",
    "XSm", "XSm", "XSm", "XSm", "XSm", "XSm", NA, NA),
  givenrate = c(0.08, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10, 0.05, 0.05, 0.05, NA,
    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  multiplier = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, sl_mult, sl_mult,
    sl_mult, sl_mult, sl_mult, sl_mult, 1, 1, 1, 0.5 * seeds_per_fruit,
    0.5 * seeds_per_fruit),
  type =c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3),
  stageframe = cypframe_raw, historical = TRUE)

cypsupp3_raw
>    stage3 stage2 stage1 eststage3 eststage2 eststage1 givenrate multiplier
> 1      SD     SD     SD      <NA>      <NA>      <NA>      0.08        1.0
> 2      SD     SD    rep      <NA>      <NA>      <NA>      0.10        1.0
> 3      P1     SD     SD      <NA>      <NA>      <NA>      0.10        1.0
> 4      P1     SD    rep      <NA>      <NA>      <NA>      0.10        1.0
> 5      P2     P1     SD      <NA>      <NA>      <NA>      0.10        1.0
> 6      P2     P1    rep      <NA>      <NA>      <NA>      0.10        1.0
> 7      P3     P2     P1      <NA>      <NA>      <NA>      0.10        1.0
> 8      SL     P3     P2      <NA>      <NA>      <NA>      0.05        1.0
> 9      SL     SL     P3      <NA>      <NA>      <NA>      0.05        1.0
> 10     SL     SL     SL      <NA>      <NA>      <NA>      0.05        1.0
> 11      D     SL     SL         D       XSm       XSm        NA        0.7
> 12    XSm     SL     SL       XSm       XSm       XSm        NA        0.7
> 13     Sm     SL     SL        Sm       XSm       XSm        NA        0.7
> 14      D     SL     P3         D       XSm       XSm        NA        0.7
> 15    XSm     SL     P3       XSm       XSm       XSm        NA        0.7
> 16     Sm     SL     P3        Sm       XSm       XSm        NA        0.7
> 17    mat      D     SL       mat         D       XSm        NA        1.0
> 18    mat    XSm     SL       mat       XSm       XSm        NA        1.0
> 19    mat     Sm     SL       mat        Sm       XSm        NA        1.0
> 20     SD    rep    mat      <NA>      <NA>      <NA>        NA     2500.0
> 21     P1    rep    mat      <NA>      <NA>      <NA>        NA     2500.0
>    convtype convtype_t12
> 1         1            1
> 2         1            1
> 3         1            1
> 4         1            1
> 5         1            1
> 6         1            1
> 7         1            1
> 8         1            1
> 9         1            1
> 10        1            1
> 11        1            1
> 12        1            1
> 13        1            1
> 14        1            1
> 15        1            1
> 16        1            1
> 17        1            1
> 18        1            1
> 19        1            1
> 20        3            1
> 21        3            1

cypsupp2_raw <- supplemental(stage3 = c("SD", "P1", "P2", "P3", "SL", "SL", "D",
    "XSm", "Sm", "SD", "P1"),
  stage2 = c("SD", "SD", "P1", "P2", "P3", "SL", "SL", "SL", "SL", "rep","rep"), 
  eststage3 = c(NA, NA, NA, NA, NA, NA, "D", "XSm", "Sm", NA, NA), 
  eststage2 = c(NA, NA, NA, NA, NA, NA, "XSm", "XSm", "XSm", NA, NA), 
  givenrate = c(0.08, 0.10, 0.10, 0.10, 0.05, 0.05, NA, NA, NA, NA, NA),
  multiplier = c(NA, NA, NA, NA, NA, NA, sl_mult, sl_mult, sl_mult,
    0.5 * seeds_per_fruit, 0.5 * seeds_per_fruit),
  type =c(1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3),
  stageframe = cypframe_raw, historical = FALSE)

cypsupp2_raw
>    stage3 stage2 stage1 eststage3 eststage2 eststage1 givenrate multiplier
> 1      SD     SD   <NA>      <NA>      <NA>      <NA>      0.08        1.0
> 2      P1     SD   <NA>      <NA>      <NA>      <NA>      0.10        1.0
> 3      P2     P1   <NA>      <NA>      <NA>      <NA>      0.10        1.0
> 4      P3     P2   <NA>      <NA>      <NA>      <NA>      0.10        1.0
> 5      SL     P3   <NA>      <NA>      <NA>      <NA>      0.05        1.0
> 6      SL     SL   <NA>      <NA>      <NA>      <NA>      0.05        1.0
> 7       D     SL   <NA>         D       XSm      <NA>        NA        0.7
> 8     XSm     SL   <NA>       XSm       XSm      <NA>        NA        0.7
> 9      Sm     SL   <NA>        Sm       XSm      <NA>        NA        0.7
> 10     SD    rep   <NA>      <NA>      <NA>      <NA>        NA     2500.0
> 11     P1    rep   <NA>      <NA>      <NA>      <NA>        NA     2500.0
>    convtype convtype_t12
> 1         1            1
> 2         1            1
> 3         1            1
> 4         1            1
> 5         1            1
> 6         1            1
> 7         1            1
> 8         1            1
> 9         1            1
> 10        3            1
> 11        3            1

3.7.1 Historical transitions and supplement tables

The supplement tables above have different dimensions depending both on the life history model used, and on whether the MPM is to be historical or not. A full introduction to historical MPMs is provided in the next chapter, but here we will illustrate why there is such a difference in dimension and why users should be careful in creating these tables.

A standard MPM includes information on the rates and probabilities associated with transitions from the different life history stages at one time to the next. We generally say that such an MPM shows the probability of transition from one stage at the current time to the next, or the expected rate of offspring production from the current time to the next. Because conceptually such a matrix shows the expected rates and probabilities moving forward from the current time, the standard MPM is not considered to have any individual history. As such, we may refer to these MPMs as ahistorical.

A historical MPM includes information on the rates and probabilities associated with the transition from the current time and one time step back, to the next time forward. Such a MPM includes one extra time step of information from the individual’s history. For example, in a historical model, the probability of transition from an extra small adult to a small adult will differ depending on what stage the individual was in immediately before being extra small. So, the probability of transition from extra small at time t to small in time t+1 will differ between those individuals that were extra small in time t-1 and those individuals that were small in time t-1. In an ahistorical model, these transition probabilities would all have the exact same value.

Supplement tables for historical MPMs and IPMs need to be written to include all three-time transitions that cannot be estimated from the dataset. Because a single ahistorical transition represents a transition that does no depend on stage in time t-1, this means that a single ahistorical transition is broken down into potentially many historical transitions. The result is that supplement tables for historical MPMs are bigger than those for ahistorical MPMs. Failing to account for any relevant historical transition that is not represented in a dataset forces its value to zero, meaning that failing to account for all relevant transitions in a supplement table will cause a break in the life history that will yield a set of matrices leading to low population growth and often complete insensitivity to alterations in fecundity and other vital rates.

For example, in the raw historical supplement table above, the final two transitions noted are the fecundity transitions. The last of these is mat -> rep -> P1, and is shorthand showing that we are setting the transition from all mature stages in time t-1 and all reproductive stages in time t to the 1st year protocorm stage in time t+1. Since we do not have actual individual demographic data for juvenile stages in our dataset, we also need to specify the next transition, which is the survival transition set rep -> P1 -> P2. Note that here, the transition between times t-1 and t is actually a fecundity step, and so refers to the production of offspring by the mother, while the transition from time t to time t+1 is a survival probability for the offspring itself. In deVries format, we would instead use AlmostBorn -> P1 -> P2, since deVries format does not allow mixing fecundity and survival transitions together in historical transitions unless they refer to the same individual (more on this issue in the next chapter). We need still more transitions here, including at least the following to connect offspring stages to the adult portions of the life history:

\(P1 \rightarrow P2 \rightarrow P3\)

\(P2 \rightarrow P3 \rightarrow SL\)

\(P3 \rightarrow SL \rightarrow D\)

\(P3 \rightarrow SL \rightarrow XSm\)

\(P3 \rightarrow SL \rightarrow Sm\)

\(SL \rightarrow D \rightarrow mat\)

\(SL \rightarrow XSm \rightarrow mat\)

\(SL \rightarrow Sm \rightarrow mat\)

Let’s consider another example. In figure 3.3 below, we show the portion of the life history most closely tied to fecundity. The "rep" argument refers to reproductive stages, and the "mat" argument refers to mature stages. The "rep" to "DS" ahistorical transition, then, refers to 24 different transitions in the function-based stageframe, because there are 24 reproductive (i.e. flowering) stages. Counting up the ahistorical transitions, then, we find that we have 24 + 24 + 1 + 1 + 1 = 51 ahistorical transitions shown. In the historical case, the "mat" to "rep" to "DS" transition set refers to \(24 \times 49 = 1176\) transitions. So, counting everything up, we actually see 1176 + 1176 + 24 + 24 + 1 + 1 = 2402 transitions here. Missing even a single one of these impacts projected population dynamics.

Figure 3.3: The fecundity transition and directly related survival transitions in both ahistorical and historical format

The most important thing to consider in building a supplement table, then, is that all stages must be connected to all other stages as diagrammed in the original life history model. If a single transition noted in the above paragraph is missed, then at least one stage is not properly connected to the other stages in the model, and there is a probability of zero associated with a particular transition that should have a non-zero value. In that circumstance, users will find that their MPM or IPM likely predicts a declining growth rate, and nothing that they do will be able to change it (typically, the asymptotic growth rate will not just decline, but be completely insensitive to changes in survival or fecundity transitions).

3.7.2 An older alternative to the supplement table

Supplement tables provide all of the supplemental information that we need. However, there is an alternative means of supplying this information, and that is through the creation of a reproductive matrix and an overwrite table. The reproductive matrix is an ahistorical matrix detailing where fecundity rates are set, and at what level. Cypripedium candidum produces seeds that germinate by the following growing season (stage P1, or a first year protocorm), or that remain dormant for the next year (stage SD). In the following matrix, we detail that the fecundity of each reproductive stage needs to be split into two between each of these output stages. The actual split places 50% of the fecundity of a reproductive stage into each category of recruit, where the full fecundity is estimated by linear models that we will create. This reproductive matrix can be used in historical MPM construction, and it is assumed that stage at occasion t-1 is set to all.

rep.assumptions_fb <- matrix(0, 54, 54)
rep.assumptions_fb[1:2,31:54] <- 0.5 * seeds_per_fruit
rep.assumptions_fb
>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
>  [1,]    0    0    0    0    0    0    0    0    0     0     0     0     0
>  [2,]    0    0    0    0    0    0    0    0    0     0     0     0     0
>  [3,]    0    0    0    0    0    0    0    0    0     0     0     0     0
>  [4,]    0    0    0    0    0    0    0    0    0     0     0     0     0
>  [5,]    0    0    0    0    0    0    0    0    0     0     0     0     0
>  [6,]    0    0    0    0    0    0    0    0    0     0     0     0     0
>  [7,]    0    0    0    0    0    0    0    0    0     0     0     0     0
>  [8,]    0    0    0    0    0    0    0    0    0     0     0     0     0
>  [9,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [10,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [11,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [12,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [13,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [14,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [15,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [16,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [17,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [18,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [19,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [20,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [21,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [22,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [23,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [24,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [25,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [26,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [27,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [28,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [29,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [30,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [31,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [32,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [33,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [34,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [35,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [36,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [37,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [38,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [39,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [40,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [41,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [42,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [43,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [44,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [45,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [46,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [47,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [48,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [49,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [50,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [51,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [52,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [53,]    0    0    0    0    0    0    0    0    0     0     0     0     0
> [54,]    0    0    0    0    0    0    0    0    0     0     0     0     0
>       [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
>  [1,]     0     0     0     0     0     0     0     0     0     0     0     0
>  [2,]     0     0     0     0     0     0     0     0     0     0     0     0
>  [3,]     0     0     0     0     0     0     0     0     0     0     0     0
>  [4,]     0     0     0     0     0     0     0     0     0     0     0     0
>  [5,]     0     0     0     0     0     0     0     0     0     0     0     0
>  [6,]     0     0     0     0     0     0     0     0     0     0     0     0
>  [7,]     0     0     0     0     0     0     0     0     0     0     0     0
>  [8,]     0     0     0     0     0     0     0     0     0     0     0     0
>  [9,]     0     0     0     0     0     0     0     0     0     0     0     0
> [10,]     0     0     0     0     0     0     0     0     0     0     0     0
> [11,]     0     0     0     0     0     0     0     0     0     0     0     0
> [12,]     0     0     0     0     0     0     0     0     0     0     0     0
> [13,]     0     0     0     0     0     0     0     0     0     0     0     0
> [14,]     0     0     0     0     0     0     0     0     0     0     0     0
> [15,]     0     0     0     0     0     0     0     0     0     0     0     0
> [16,]     0     0     0     0     0     0     0     0     0     0     0     0
> [17,]     0     0     0     0     0     0     0     0     0     0     0     0
> [18,]     0     0     0     0     0     0     0     0     0     0     0     0
> [19,]     0     0     0     0     0     0     0     0     0     0     0     0
> [20,]     0     0     0     0     0     0     0     0     0     0     0     0
> [21,]     0     0     0     0     0     0     0     0     0     0     0     0
> [22,]     0     0     0     0     0     0     0     0     0     0     0     0
> [23,]     0     0     0     0     0     0     0     0     0     0     0     0
> [24,]     0     0     0     0     0     0     0     0     0     0     0     0
> [25,]     0     0     0     0     0     0     0     0     0     0     0     0
> [26,]     0     0     0     0     0     0     0     0     0     0     0     0
> [27,]     0     0     0     0     0     0     0     0     0     0     0     0
> [28,]     0     0     0     0     0     0     0     0     0     0     0     0
> [29,]     0     0     0     0     0     0     0     0     0     0     0     0
> [30,]     0     0     0     0     0     0     0     0     0     0     0     0
> [31,]     0     0     0     0     0     0     0     0     0     0     0     0
> [32,]     0     0     0     0     0     0     0     0     0     0     0     0
> [33,]     0     0     0     0     0     0     0     0     0     0     0     0
> [34,]     0     0     0     0     0     0     0     0     0     0     0     0
> [35,]     0     0     0     0     0     0     0     0     0     0     0     0
> [36,]     0     0     0     0     0     0     0     0     0     0     0     0
> [37,]     0     0     0     0     0     0     0     0     0     0     0     0
> [38,]     0     0     0     0     0     0     0     0     0     0     0     0
> [39,]     0     0     0     0     0     0     0     0     0     0     0     0
> [40,]     0     0     0     0     0     0     0     0     0     0     0     0
> [41,]     0     0     0     0     0     0     0     0     0     0     0     0
> [42,]     0     0     0     0     0     0     0     0     0     0     0     0
> [43,]     0     0     0     0     0     0     0     0     0     0     0     0
> [44,]     0     0     0     0     0     0     0     0     0     0     0     0
> [45,]     0     0     0     0     0     0     0     0     0     0     0     0
> [46,]     0     0     0     0     0     0     0     0     0     0     0     0
> [47,]     0     0     0     0     0     0     0     0     0     0     0     0
> [48,]     0     0     0     0     0     0     0     0     0     0     0     0
> [49,]     0     0     0     0     0     0     0     0     0     0     0     0
> [50,]     0     0     0     0     0     0     0     0     0     0     0     0
> [51,]     0     0     0     0     0     0     0     0     0     0     0     0
> [52,]     0     0     0     0     0     0     0     0     0     0     0     0
> [53,]     0     0     0     0     0     0     0     0     0     0     0     0
> [54,]     0     0     0     0     0     0     0     0     0     0     0     0
>       [,26] [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37]
>  [1,]     0     0     0     0     0  2500  2500  2500  2500  2500  2500  2500
>  [2,]     0     0     0     0     0  2500  2500  2500  2500  2500  2500  2500
>  [3,]     0     0     0     0     0     0     0     0     0     0     0     0
>  [4,]     0     0     0     0     0     0     0     0     0     0     0     0
>  [5,]     0     0     0     0     0     0     0     0     0     0     0     0
>  [6,]     0     0     0     0     0     0     0     0     0     0     0     0
>  [7,]     0     0     0     0     0     0     0     0     0     0     0     0
>  [8,]     0     0     0     0     0     0     0     0     0     0     0     0
>  [9,]     0     0     0     0     0     0     0     0     0     0     0     0
> [10,]     0     0     0     0     0     0     0     0     0     0     0     0
> [11,]     0     0     0     0     0     0     0     0     0     0     0     0
> [12,]     0     0     0     0     0     0     0     0     0     0     0     0
> [13,]     0     0     0     0     0     0     0     0     0     0     0     0
> [14,]     0     0     0     0     0     0     0     0     0     0     0     0
> [15,]     0     0     0     0     0     0     0     0     0     0     0     0
> [16,]     0     0     0     0     0     0     0     0     0     0     0     0
> [17,]     0     0     0     0     0     0     0     0     0     0     0     0
> [18,]     0     0     0     0     0     0     0     0     0     0     0     0
> [19,]     0     0     0     0     0     0     0     0     0     0     0     0
> [20,]     0     0     0     0     0     0     0     0     0     0     0     0
> [21,]     0     0     0     0     0     0     0     0     0     0     0     0
> [22,]     0     0     0     0     0     0     0     0     0     0     0     0
> [23,]     0     0     0     0     0     0     0     0     0     0     0     0
> [24,]     0     0     0     0     0     0     0     0     0     0     0     0
> [25,]     0     0     0     0     0     0     0     0     0     0     0     0
> [26,]     0     0     0     0     0     0     0     0     0     0     0     0
> [27,]     0     0     0     0     0     0     0     0     0     0     0     0
> [28,]     0     0     0     0     0     0     0     0     0     0     0     0
> [29,]     0     0     0     0     0     0     0     0     0     0     0     0
> [30,]     0     0     0     0     0     0     0     0     0     0     0     0
> [31,]     0     0     0     0     0     0     0     0     0     0     0     0
> [32,]     0     0     0     0     0     0     0     0     0     0     0     0
> [33,]     0     0     0     0     0     0     0     0     0     0     0     0
> [34,]     0     0     0     0     0     0     0     0     0     0     0     0
> [35,]     0     0     0     0     0     0     0     0     0     0     0     0
> [36,]     0     0     0     0     0     0     0     0     0     0     0     0
> [37,]     0     0     0     0     0     0     0     0     0     0     0     0
> [38,]     0     0     0     0     0     0     0     0     0     0     0     0
> [39,]     0     0     0     0     0     0     0     0     0     0     0     0
> [40,]     0     0     0     0     0     0     0     0     0     0     0     0
> [41,]     0     0     0     0     0     0     0     0     0     0     0     0
> [42,]     0     0     0     0     0     0     0     0     0     0     0     0
> [43,]     0     0     0     0     0     0     0     0     0     0     0     0
> [44,]     0     0     0     0     0     0     0     0     0     0     0     0
> [45,]     0     0     0     0     0     0     0     0     0     0     0     0
> [46,]     0     0     0     0     0     0     0     0     0     0     0     0
> [47,]     0     0     0     0     0     0     0     0     0     0     0     0
> [48,]     0     0     0     0     0     0     0     0     0     0     0     0
> [49,]     0     0     0     0     0     0     0     0     0     0     0     0
> [50,]     0     0     0     0     0     0     0     0     0     0     0     0
> [51,]     0     0     0     0     0     0     0     0     0     0     0     0
> [52,]     0     0     0     0     0     0     0     0     0     0     0     0
> [53,]     0     0     0     0     0     0     0     0     0     0     0     0
> [54,]     0     0     0     0     0     0     0     0     0     0     0     0
>       [,38] [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49]
>  [1,]  2500  2500  2500  2500  2500  2500  2500  2500  2500  2500  2500  2500
>  [2,]  2500  2500  2500  2500  2500  2500  2500  2500  2500  2500  2500  2500
>  [3,]     0     0     0     0     0     0     0     0     0     0     0     0
>  [4,]     0     0     0     0     0     0     0     0     0     0     0     0
>  [5,]     0     0     0     0     0     0     0     0     0     0     0     0
>  [6,]     0     0     0     0     0     0     0     0     0     0     0     0
>  [7,]     0     0     0     0     0     0     0     0     0     0     0     0
>  [8,]     0     0     0     0     0     0     0     0     0     0     0     0
>  [9,]     0     0     0     0     0     0     0     0     0     0     0     0
> [10,]     0     0     0     0     0     0     0     0     0     0     0     0
> [11,]     0     0     0     0     0     0     0     0     0     0     0     0
> [12,]     0     0     0     0     0     0     0     0     0     0     0     0
> [13,]     0     0     0     0     0     0     0     0     0     0     0     0
> [14,]     0     0     0     0     0     0     0     0     0     0     0     0
> [15,]     0     0     0     0     0     0     0     0     0     0     0     0
> [16,]     0     0     0     0     0     0     0     0     0     0     0     0
> [17,]     0     0     0     0     0     0     0     0     0     0     0     0
> [18,]     0     0     0     0     0     0     0     0     0     0     0     0
> [19,]     0     0     0     0     0     0     0     0     0     0     0     0
> [20,]     0     0     0     0     0     0     0     0     0     0     0     0
> [21,]     0     0     0     0     0     0     0     0     0     0     0     0
> [22,]     0     0     0     0     0     0     0     0     0     0     0     0
> [23,]     0     0     0     0     0     0     0     0     0     0     0     0
> [24,]     0     0     0     0     0     0     0     0     0     0     0     0
> [25,]     0     0     0     0     0     0     0     0     0     0     0     0
> [26,]     0     0     0     0     0     0     0     0     0     0     0     0
> [27,]     0     0     0     0     0     0     0     0     0     0     0     0
> [28,]     0     0     0     0     0     0     0     0     0     0     0     0
> [29,]     0     0     0     0     0     0     0     0     0     0     0     0
> [30,]     0     0     0     0     0     0     0     0     0     0     0     0
> [31,]     0     0     0     0     0     0     0     0     0     0     0     0
> [32,]     0     0     0     0     0     0     0     0     0     0     0     0
> [33,]     0     0     0     0     0     0     0     0     0     0     0     0
> [34,]     0     0     0     0     0     0     0     0     0     0     0     0
> [35,]     0     0     0     0     0     0     0     0     0     0     0     0
> [36,]     0     0     0     0     0     0     0     0     0     0     0     0
> [37,]     0     0     0     0     0     0     0     0     0     0     0     0
> [38,]     0     0     0     0     0     0     0     0     0     0     0     0
> [39,]     0     0     0     0     0     0     0     0     0     0     0     0
> [40,]     0     0     0     0     0     0     0     0     0     0     0     0
> [41,]     0     0     0     0     0     0     0     0     0     0     0     0
> [42,]     0     0     0     0     0     0     0     0     0     0     0     0
> [43,]     0     0     0     0     0     0     0     0     0     0     0     0
> [44,]     0     0     0     0     0     0     0     0     0     0     0     0
> [45,]     0     0     0     0     0     0     0     0     0     0     0     0
> [46,]     0     0     0     0     0     0     0     0     0     0     0     0
> [47,]     0     0     0     0     0     0     0     0     0     0     0     0
> [48,]     0     0     0     0     0     0     0     0     0     0     0     0
> [49,]     0     0     0     0     0     0     0     0     0     0     0     0
> [50,]     0     0     0     0     0     0     0     0     0     0     0     0
> [51,]     0     0     0     0     0     0     0     0     0     0     0     0
> [52,]     0     0     0     0     0     0     0     0     0     0     0     0
> [53,]     0     0     0     0     0     0     0     0     0     0     0     0
> [54,]     0     0     0     0     0     0     0     0     0     0     0     0
>       [,50] [,51] [,52] [,53] [,54]
>  [1,]  2500  2500  2500  2500  2500
>  [2,]  2500  2500  2500  2500  2500
>  [3,]     0     0     0     0     0
>  [4,]     0     0     0     0     0
>  [5,]     0     0     0     0     0
>  [6,]     0     0     0     0     0
>  [7,]     0     0     0     0     0
>  [8,]     0     0     0     0     0
>  [9,]     0     0     0     0     0
> [10,]     0     0     0     0     0
> [11,]     0     0     0     0     0
> [12,]     0     0     0     0     0
> [13,]     0     0     0     0     0
> [14,]     0     0     0     0     0
> [15,]     0     0     0     0     0
> [16,]     0     0     0     0     0
> [17,]     0     0     0     0     0
> [18,]     0     0     0     0     0
> [19,]     0     0     0     0     0
> [20,]     0     0     0     0     0
> [21,]     0     0     0     0     0
> [22,]     0     0     0     0     0
> [23,]     0     0     0     0     0
> [24,]     0     0     0     0     0
> [25,]     0     0     0     0     0
> [26,]     0     0     0     0     0
> [27,]     0     0     0     0     0
> [28,]     0     0     0     0     0
> [29,]     0     0     0     0     0
> [30,]     0     0     0     0     0
> [31,]     0     0     0     0     0
> [32,]     0     0     0     0     0
> [33,]     0     0     0     0     0
> [34,]     0     0     0     0     0
> [35,]     0     0     0     0     0
> [36,]     0     0     0     0     0
> [37,]     0     0     0     0     0
> [38,]     0     0     0     0     0
> [39,]     0     0     0     0     0
> [40,]     0     0     0     0     0
> [41,]     0     0     0     0     0
> [42,]     0     0     0     0     0
> [43,]     0     0     0     0     0
> [44,]     0     0     0     0     0
> [45,]     0     0     0     0     0
> [46,]     0     0     0     0     0
> [47,]     0     0     0     0     0
> [48,]     0     0     0     0     0
> [49,]     0     0     0     0     0
> [50,]     0     0     0     0     0
> [51,]     0     0     0     0     0
> [52,]     0     0     0     0     0
> [53,]     0     0     0     0     0
> [54,]     0     0     0     0     0

Next we will create the overwrite tables, which outline transitions that cannot be estimated from the data set and need to be set by other means. Here is an example of two overwrite tables for the Cypripedium candidum analysis. Note that they are fundamentally similar to supplement tables, but do not allow the addition of multipliers and transition types from occasion t-1 to t, nor do they involve a check of entered stages against the stageframe.

cypover3_fb <- overwrite(stage3 = c("SD", "SD", "P1", "P1", "P2", "P3", "SL",
    "SL", "SL", "D", "V1", "V2", "V3", "D", "V1", "V2", "V3", "mat", "mat",
    "mat", "mat"), 
  stage2 = c("SD", "SD", "SD", "SD", "P1", "P2", "P3", "SL", "SL", "SL", "SL", 
    "SL", "SL", "SL", "SL", "SL", "SL", "D", "V1", "V2", "V3"), 
  stage1 = c("SD", "rep", "SD", "rep", "SD", "P1", "P2", "P3", "SL", "P3", "P3",
    "P3", "P3", "SL", "SL", "SL", "SL", "SL", "SL", "SL", "SL"), 
  eststage3 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, "D", "V1", "V2", "V3", "D",
    "V1", "V2", "V3", "mat", "mat", "mat", "mat"), 
  eststage2 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, "D", "D", "D", "D", "D", 
    "D", "D", "D", "D", "V1", "V2", "V3"), 
  eststage1 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, "D", "D", "D", "D", "D", 
    "D", "D", "D", "V1", "V1", "V1", "V1"), 
  givenrate = c(0.08, 0.08, 0.1, 0.1, 0.1, 0.1, 0.1, 0.05, 0.05, NA, NA, NA, NA, 
    NA, NA, NA, NA, NA, NA, NA, NA))

cypover3_fb
>    stage3 stage2 stage1 eststage3 eststage2 eststage1 givenrate convtype
> 1      SD     SD     SD      <NA>      <NA>      <NA>      0.08        1
> 2      SD     SD    rep      <NA>      <NA>      <NA>      0.08        1
> 3      P1     SD     SD      <NA>      <NA>      <NA>      0.10        1
> 4      P1     SD    rep      <NA>      <NA>      <NA>      0.10        1
> 5      P2     P1     SD      <NA>      <NA>      <NA>      0.10        1
> 6      P3     P2     P1      <NA>      <NA>      <NA>      0.10        1
> 7      SL     P3     P2      <NA>      <NA>      <NA>      0.10        1
> 8      SL     SL     P3      <NA>      <NA>      <NA>      0.05        1
> 9      SL     SL     SL      <NA>      <NA>      <NA>      0.05        1
> 10      D     SL     P3         D         D         D        NA        1
> 11     V1     SL     P3        V1         D         D        NA        1
> 12     V2     SL     P3        V2         D         D        NA        1
> 13     V3     SL     P3        V3         D         D        NA        1
> 14      D     SL     SL         D         D         D        NA        1
> 15     V1     SL     SL        V1         D         D        NA        1
> 16     V2     SL     SL        V2         D         D        NA        1
> 17     V3     SL     SL        V3         D         D        NA        1
> 18    mat      D     SL       mat         D        V1        NA        1
> 19    mat     V1     SL       mat        V1        V1        NA        1
> 20    mat     V2     SL       mat        V2        V1        NA        1
> 21    mat     V3     SL       mat        V3        V1        NA        1
>    convtype_t12
> 1             1
> 2             1
> 3             1
> 4             1
> 5             1
> 6             1
> 7             1
> 8             1
> 9             1
> 10            1
> 11            1
> 12            1
> 13            1
> 14            1
> 15            1
> 16            1
> 17            1
> 18            1
> 19            1
> 20            1
> 21            1

cypover2_fb <- overwrite(stage3 = c("SD", "P1", "P2", "P3", "SL", "SL", "D",
    "V1", "V2", "V3"), 
  stage2 = c("SD", "SD", "P1", "P2", "P3", "SL", "SL", "SL", "SL", "SL"), 
  eststage3 = c(NA, NA, NA, NA, NA, NA, "D", "V1", "V2", "V3"), 
  eststage2 = c(NA, NA, NA, NA, NA, NA, "D", "D", "D", "D"), 
  givenrate = c(0.08, 0.1, 0.1, 0.1, 0.05, 0.05, NA, NA, NA, NA), 
  type = c("S", "S", "S", "S", "S", "S", "S", "S", "S"))

cypover2_fb
>    stage3 stage2 stage1 eststage3 eststage2 eststage1 givenrate convtype
> 1      SD     SD   <NA>      <NA>      <NA>      <NA>      0.08        1
> 2      P1     SD   <NA>      <NA>      <NA>      <NA>      0.10        1
> 3      P2     P1   <NA>      <NA>      <NA>      <NA>      0.10        1
> 4      P3     P2   <NA>      <NA>      <NA>      <NA>      0.10        1
> 5      SL     P3   <NA>      <NA>      <NA>      <NA>      0.05        1
> 6      SL     SL   <NA>      <NA>      <NA>      <NA>      0.05        1
> 7       D     SL   <NA>         D         D      <NA>        NA        1
> 8      V1     SL   <NA>        V1         D      <NA>        NA        1
> 9      V2     SL   <NA>        V2         D      <NA>        NA        1
> 10     V3     SL   <NA>        V3         D      <NA>        NA        1
>    convtype_t12
> 1             1
> 2             1
> 3             1
> 4             1
> 5             1
> 6             1
> 7             1
> 8             1
> 9             1
> 10            1

Let’s now also supply the overwrite tables and reproductive matrix for the raw MPMs.

rep_cyp_raw <- matrix(0, 11, 11)
rep_cyp_raw[1:2,7:11] <- 0.5 * seeds_per_fruit

rep_cyp_raw
>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
>  [1,]    0    0    0    0    0    0 2500 2500 2500  2500  2500
>  [2,]    0    0    0    0    0    0 2500 2500 2500  2500  2500
>  [3,]    0    0    0    0    0    0    0    0    0     0     0
>  [4,]    0    0    0    0    0    0    0    0    0     0     0
>  [5,]    0    0    0    0    0    0    0    0    0     0     0
>  [6,]    0    0    0    0    0    0    0    0    0     0     0
>  [7,]    0    0    0    0    0    0    0    0    0     0     0
>  [8,]    0    0    0    0    0    0    0    0    0     0     0
>  [9,]    0    0    0    0    0    0    0    0    0     0     0
> [10,]    0    0    0    0    0    0    0    0    0     0     0
> [11,]    0    0    0    0    0    0    0    0    0     0     0

cypover2_raw <- overwrite(stage3 = c("SD", "P1", "P2", "P3", "SL", "SL", "D",
    "XSm", "Sm"),
  stage2 = c("SD", "SD", "P1", "P2", "P3", "SL", "SL", "SL", "SL"), 
  eststage3 = c(NA, NA, NA, NA, NA, NA, "D", "XSm", "Sm"), 
  eststage2 = c(NA, NA, NA, NA, NA, NA, "XSm", "XSm", "XSm"), 
  givenrate = c(0.08, 0.10, 0.10, 0.10, 0.05, 0.05, NA, NA, NA),
  type = c("S", "S", "S", "S", "S", "S", "S", "S", "S"))

cypover2_raw
>   stage3 stage2 stage1 eststage3 eststage2 eststage1 givenrate convtype
> 1     SD     SD   <NA>      <NA>      <NA>      <NA>      0.08        1
> 2     P1     SD   <NA>      <NA>      <NA>      <NA>      0.10        1
> 3     P2     P1   <NA>      <NA>      <NA>      <NA>      0.10        1
> 4     P3     P2   <NA>      <NA>      <NA>      <NA>      0.10        1
> 5     SL     P3   <NA>      <NA>      <NA>      <NA>      0.05        1
> 6     SL     SL   <NA>      <NA>      <NA>      <NA>      0.05        1
> 7      D     SL   <NA>         D       XSm      <NA>        NA        1
> 8    XSm     SL   <NA>       XSm       XSm      <NA>        NA        1
> 9     Sm     SL   <NA>        Sm       XSm      <NA>        NA        1
>   convtype_t12
> 1            1
> 2            1
> 3            1
> 4            1
> 5            1
> 6            1
> 7            1
> 8            1
> 9            1

cypover3_raw <- overwrite(stage3 = c("SD", "SD", "P1", "P1", "P2", "P2",
    "P3", "SL", "SL", "SL", "D", "XSm", "Sm", "D", "XSm", "Sm", "mat", "mat",
    "mat"),
  stage2 = c("SD", "SD", "SD", "SD", "P1", "P1", "P2", "P3", "SL", "SL", "SL",
    "SL", "SL", "SL", "SL", "SL", "D", "XSm", "Sm"),
  stage1 = c("SD", "rep", "SD", "rep", "SD", "rep", "P1", "P2", "P3", "SL",
    "SL", "SL", "SL", "P3", "P3", "P3", "SL", "SL", "SL"),
  eststage3 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "D", "XSm", "Sm", "D",
    "XSm", "Sm", "mat", "mat", "mat"), 
  eststage2 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "XSm", "XSm", "XSm",
    "XSm", "XSm", "XSm", "D", "XSm", "Sm"),
  eststage1 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "XSm", "XSm", "XSm",
    "XSm", "XSm", "XSm", "XSm", "XSm", "XSm"),
  givenrate = c(0.08, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10, 0.05, 0.05, 0.05, NA,
    NA, NA, NA, NA, NA, NA, NA, NA),
  type = c("S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S", "S"))

cypover3_raw
>    stage3 stage2 stage1 eststage3 eststage2 eststage1 givenrate convtype
> 1      SD     SD     SD      <NA>      <NA>      <NA>      0.08        1
> 2      SD     SD    rep      <NA>      <NA>      <NA>      0.10        1
> 3      P1     SD     SD      <NA>      <NA>      <NA>      0.10        1
> 4      P1     SD    rep      <NA>      <NA>      <NA>      0.10        1
> 5      P2     P1     SD      <NA>      <NA>      <NA>      0.10        1
> 6      P2     P1    rep      <NA>      <NA>      <NA>      0.10        1
> 7      P3     P2     P1      <NA>      <NA>      <NA>      0.10        1
> 8      SL     P3     P2      <NA>      <NA>      <NA>      0.05        1
> 9      SL     SL     P3      <NA>      <NA>      <NA>      0.05        1
> 10     SL     SL     SL      <NA>      <NA>      <NA>      0.05        1
> 11      D     SL     SL         D       XSm       XSm        NA        1
> 12    XSm     SL     SL       XSm       XSm       XSm        NA        1
> 13     Sm     SL     SL        Sm       XSm       XSm        NA        1
> 14      D     SL     P3         D       XSm       XSm        NA        1
> 15    XSm     SL     P3       XSm       XSm       XSm        NA        1
> 16     Sm     SL     P3        Sm       XSm       XSm        NA        1
> 17    mat      D     SL       mat         D       XSm        NA        1
> 18    mat    XSm     SL       mat       XSm       XSm        NA        1
> 19    mat     Sm     SL       mat        Sm       XSm        NA        1
>    convtype_t12
> 1             1
> 2             1
> 3             1
> 4             1
> 5             1
> 6             1
> 7             1
> 8             1
> 9             1
> 10            1
> 11            1
> 12            1
> 13            1
> 14            1
> 15            1
> 16            1
> 17            1
> 18            1
> 19            1

The overwrite() approach is much less powerful than the supplement table approach, particularly because it lacks the ability to handle multipliers, it lacks some shorthand stage abbreviations, and it lacks inconsistency checks, but some might prefer it.

3.8 Handling complex life histories with stage groups and supplement tables

Situations may occur in which the life history of the organism includes two sets of stages with transitions only occurring in one direction between them. For example, let’s consider the following life history model (figure 3.4).

Figure 3.4: Imaginary life history for perennial plant species X, with a pre-adult non-reproductive set of 3 stages that eventually leads to a reproductive set of stages, from which the plant cannot return.

Raw MPMs have no problem with this situation, provided that each stage has its own, unique set of characteristics. However, function-based MPMs (including IPMs) will have a default tendency to estimate survival transitions from the adult reproductive stages (in blue box) back to the pre-adult non-reproductive stages (in red box). We can deal with this problem using stage grouping.

First, we will create a new stageframe that encapsulates all of the stages above. Note that the primary addition that we will make to the sf_create() input is the group option.

sizevector <- c(0, 0, 0, 0, 0, 0, 1, 3, 1, 3, 6, 11, 20, 31)
stagevector <- c("SD", "P1", "P2", "P3", "SL", "pD", "pXSm", "pSm", "XSm", "Sm",
  "Md", "Lg", "XLg", "XXLg")
repvector <- c(0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1)
obsvector <- c(0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1)
matvector <- c(0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1)
immvector <- c(0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0)
propvector <- c(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
indataset <- c(0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1)
binvec <- c(0, 0, 0, 0, 0, 0.5, 0.5, 1.5, 0.5, 1.5, 1.5, 3.5, 5.5, 5.5)
group <- c(0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2)

comments <- c("Dormant seed", "1st yr protocorm", "2nd yr protocorm",
  "3rd yr protocorm", "Seedling", "Dormant pre-adult", 
  "Extra small pre-adult (1 shoot)", "Small pre-adult (2-4 shoots)",
  "Extra small adult (1 shoot)", "Small adult (2-4 shoots)",
  "Medium adult (5-7 shoots)", "Large adult (8-14 shoots)",
  "Extra large adult (20 shoots)", "Extra extra large adult (>24.5 shoots")

cypframe_alt <- sf_create(sizes = sizevector, stagenames = stagevector, 
  repstatus = repvector, obsstatus = obsvector, matstatus = matvector,
  propstatus = propvector, immstatus = immvector, indataset = indataset, 
  binhalfwidth = binvec, group = group, comments = comments)

cypframe_alt
>    stage size size_b size_c min_age max_age repstatus obsstatus propstatus
> 1     SD    0     NA     NA      NA      NA         0         0          1
> 2     P1    0     NA     NA      NA      NA         0         0          0
> 3     P2    0     NA     NA      NA      NA         0         0          0
> 4     P3    0     NA     NA      NA      NA         0         0          0
> 5     SL    0     NA     NA      NA      NA         0         0          0
> 6     pD    0     NA     NA      NA      NA         0         0          0
> 7   pXSm    1     NA     NA      NA      NA         0         1          0
> 8    pSm    3     NA     NA      NA      NA         0         1          0
> 9    XSm    1     NA     NA      NA      NA         1         1          0
> 10    Sm    3     NA     NA      NA      NA         1         1          0
> 11    Md    6     NA     NA      NA      NA         1         1          0
> 12    Lg   11     NA     NA      NA      NA         1         1          0
> 13   XLg   20     NA     NA      NA      NA         1         1          0
> 14  XXLg   31     NA     NA      NA      NA         1         1          0
>    immstatus matstatus indataset binhalfwidth_raw sizebin_min sizebin_max
> 1          0         0         0              0.0         0.0         0.0
> 2          1         0         0              0.0         0.0         0.0
> 3          1         0         0              0.0         0.0         0.0
> 4          1         0         0              0.0         0.0         0.0
> 5          1         0         0              0.0         0.0         0.0
> 6          1         0         1              0.5        -0.5         0.5
> 7          1         0         1              0.5         0.5         1.5
> 8          1         0         1              1.5         1.5         4.5
> 9          0         1         1              0.5         0.5         1.5
> 10         0         1         1              1.5         1.5         4.5
> 11         0         1         1              1.5         4.5         7.5
> 12         0         1         1              3.5         7.5        14.5
> 13         0         1         1              5.5        14.5        25.5
> 14         0         1         1              5.5        25.5        36.5
>    sizebin_center sizebin_width binhalfwidthb_raw sizebinb_min sizebinb_max
> 1               0             0                NA           NA           NA
> 2               0             0                NA           NA           NA
> 3               0             0                NA           NA           NA
> 4               0             0                NA           NA           NA
> 5               0             0                NA           NA           NA
> 6               0             1                NA           NA           NA
> 7               1             1                NA           NA           NA
> 8               3             3                NA           NA           NA
> 9               1             1                NA           NA           NA
> 10              3             3                NA           NA           NA
> 11              6             3                NA           NA           NA
> 12             11             7                NA           NA           NA
> 13             20            11                NA           NA           NA
> 14             31            11                NA           NA           NA
>    sizebinb_center sizebinb_width binhalfwidthc_raw sizebinc_min sizebinc_max
> 1               NA             NA                NA           NA           NA
> 2               NA             NA                NA           NA           NA
> 3               NA             NA                NA           NA           NA
> 4               NA             NA                NA           NA           NA
> 5               NA             NA                NA           NA           NA
> 6               NA             NA                NA           NA           NA
> 7               NA             NA                NA           NA           NA
> 8               NA             NA                NA           NA           NA
> 9               NA             NA                NA           NA           NA
> 10              NA             NA                NA           NA           NA
> 11              NA             NA                NA           NA           NA
> 12              NA             NA                NA           NA           NA
> 13              NA             NA                NA           NA           NA
> 14              NA             NA                NA           NA           NA
>    sizebinc_center sizebinc_width group                              comments
> 1               NA             NA     0                          Dormant seed
> 2               NA             NA     0                      1st yr protocorm
> 3               NA             NA     0                      2nd yr protocorm
> 4               NA             NA     0                      3rd yr protocorm
> 5               NA             NA     0                              Seedling
> 6               NA             NA     1                     Dormant pre-adult
> 7               NA             NA     1       Extra small pre-adult (1 shoot)
> 8               NA             NA     1          Small pre-adult (2-4 shoots)
> 9               NA             NA     2           Extra small adult (1 shoot)
> 10              NA             NA     2              Small adult (2-4 shoots)
> 11              NA             NA     2             Medium adult (5-7 shoots)
> 12              NA             NA     2             Large adult (8-14 shoots)
> 13              NA             NA     2         Extra large adult (20 shoots)
> 14              NA             NA     2 Extra extra large adult (>24.5 shoots

Now that we have our stageframe, the only thing we need to do is to specify that survival-transitions from group 2 stages to group 1 stages are equal to 0. We can do this with the supplemental() function. Here, we will set these transitions, and also set the fecundity multipliers as before.

cypsupp2_alt <- supplemental(stage3 = c("group1", "SD", "P1"),
  stage2 = c("group2", "rep", "rep"), eststage3 = c(NA, NA, NA),
  eststage2 = c(NA, NA, NA), givenrate = c(0, NA, NA),
  multiplier = c(NA, (0.5 * seeds_per_fruit), (0.5 * seeds_per_fruit)),
  type =c(1, 3, 3), stageframe = cypframe_alt, historical = FALSE)

cypsupp2_alt
>   stage3 stage2 stage1 eststage3 eststage2 eststage1 givenrate multiplier
> 1 group1 group2   <NA>        NA        NA      <NA>         0          1
> 2     SD    rep   <NA>        NA        NA      <NA>        NA       2500
> 3     P1    rep   <NA>        NA        NA      <NA>        NA       2500
>   convtype convtype_t12
> 1        1            1
> 2        3            1
> 3        3            1

This supplement table can now be input into a matrix estimator function to tell that function that these transitions must be 0. We will see how to do this with different styles of MPM in the next four chapters.

We can now proceed in the next chapter to create raw matrices.

3.9 Points to remember

  1. Functions verticalize3() and historicalize3() can be used to take horizontally or vertically arranged demographic data and standardize it into the appropriate format for MPM creation and analysis.
  2. Function summary_hfv() provides summaries of hfv datasets, including the overall dimensions.
  3. Function actualstage3() provides a means of exploring standardized datasets, showing the actual frequencies and proportions of each stage, age, age-stage, or historical stage-pair alive in each year.
  4. Function supplemental() provides the means to incorporate given transition values obtained from external studies, set transitions to proxy values to be estimated by lefko3, and incorporate multipiers on survival transitions, fecundity estimates, and proxy survival transitions.
  5. Great care must be taken to include every missing transition within the supplement table. Otherwise, models will predict dying populations, and asymptotic analyses will be invariant to changes in survival and fecundity terms.
  6. Stage groups can be used to add directionality and other complex relationships between groups of life history stages.

References

Shefferson, R.P., Kurokawa, S. & Ehrlén, J. (2021). lefko3: Analysing individual history through size-classified matrix population models. Methods in Ecology and Evolution, 12, 378–382.