This document was built in Markdown in R 4.1.3 and compiled on 17 March 2022. It covers package lefko3 version 5.0.1. This is a long-format vignette, meaning that we have tried to include a good deal more code and output than is permissible in the standard CRAN-packaged vignette. Note, however, that code that results in dramatically long output has been hashtagged to prevent the inclusion of tens of pages of output that may confuse the user. In these cases, please remove the hashtag to see the output.

CASE STUDIES OF AMERICAN Cypripedium candidum POPULATION

In this vignette, we use the cypdata and cypvert datasets to illustrate the estimation of raw MPMs and function-based MPMs (the latter essentially an IPM). Please see the other vignettes included in package lefko3, as well as further vignettes posted online on the projects page of the Shefferson lab website, for further demonstrations of raw MPMs, function-based MPMs, IPMs, age-by-stage MPMs, and Leslie (age-based) MPMs.

ORGANISM AND POPULATION

The white lady’s slipper, Cypripedium candidum, is a North American perennial herb in the family Orchidaceae. It is long-lived and of conservation concern. This plant begins life by germinating from a dust seed, and then develops into a protocorm, which is a special subterranean life stage found in orchids and pyroloids. During this stage, the plant is non-photosynthetic and completely parasitic on its mycorrhizal fungi. It spends several years as a protocorm, and previous studies suggest that it typically spends three years before becoming a seedling. As a seedling, it may or may not produce aboveground sprouts, often remaining entirely subterranean and continuing its parasitic lifestyle. It may persist this way for many years before attaining adult size, at which point it may sprout with or without flowers, or may remain underground in a condition referred to as vegetative dormancy. The latter condition may continue for many years, with over a decade of continuous dormancy documented in the literature (Shefferson et al. 2018).

Figure 3L.1. Field work finding and measuring Cypripedium candidum individuals, yielding the demographic dataset included with package lefko3. Photo courtesy of R. Shefferson.

The population from which the dataset originates is located within a wet meadow in a state nature preserve located in northeastern Illinois, USA (Figure 3L.1). The population was monitored annually from 2004 to 2009, with two monitoring sessions per year. Monitoring sessions took roughly two weeks each, and included complete censuses of the population divided into sections referred to as patches. Each monitoring session consisted of searches for previously recorded individuals, which were located according to coordinates relative to fixed stakes at the site, followed by a search for new individuals. Data recorded per individual included: the location, the number of non-flowering sprouts, the number of flowering sprouts, the number of flowers per flowering sprout, and the number of fruit pods per sprout (only in the second monitoring session per year, once fruiting had occurred). Location was used to infer individual identity. More information about this population and its characteristics is given in Shefferson et al. (2001) and Shefferson, Mizuta, and Hutchings (2017).

OVERALL GOALS AND INITIAL CONSIDERATIONS

Our goal in this exercise will be to produce ahistorical and historical raw and function-based matrices for full comparison. We will assess the influence of history, and showcase the pros and cons of several styles of MPMs. We will also illustrate the use of multiple demographic data formats via comparisons of the cypdata and cypvert datasets, which present the same information but in different input format. Where appropriate, we will provide commentary to illustrate where analyses may be shortened or altered for more typical analyses.

The horizontal dataset cypdata, and the ahistorical vertical dataset cypvert which is the same as cypdata but is structured differently, both include only data for the adult stages because the monitoring protocol did not include monitoring of juveniles. This is due to the substantial time belowground that juveniles spend - being almost entirely subterranean, they often cannot be tracked and identified. Let’s begin by clearing the memory, loading the package, and loading the vertical and horizontal datasets.

rm(list=ls(all=TRUE))
library(lefko3)

data(cypdata)
data(cypvert)

The dataset cypdata is organized in horizontal format, meaning that rows correspond to unique individuals and columns correspond to stage in particular years. Looking at the original Excel spreadsheet (below), you will note a repeating pattern in the names of the columns. Package lefko3 includes functions to handle data in horizontal format, as well as functions to handle vertically formatted data (i.e. data for individuals is broken up across rows, where each row is a unique combination of individual and year in time t).

Figure 3L.2. Organization of the Cypripedium candidum horizontal dataset, as viewed in Microsoft Excel.

When we imported the dataset into R, we utilized this structure, and R handles the variables accordingly. We can see this in the summary for the dataset, as below (we also use dim() to calculate the dimensions of the dataset).

writeLines("Dimensions of dataset, in rows (data points) followed by columns (variables): ")
#> Dimensions of dataset, in rows (data points) followed by columns (variables):
dim(cypdata)
#> [1] 77 29
writeLines("\nSummary: ")
#> 
#> Summary:
summary(cypdata)
#>     plantid       patch        X               Y              censor 
#>  Min.   : 164.0   A:23   Min.   : 46.5   Min.   :-28.00   Min.   :1  
#>  1st Qu.: 265.0   B:35   1st Qu.: 60.1   1st Qu.: 22.50   1st Qu.:1  
#>  Median : 455.0   C:19   Median : 91.4   Median : 75.60   Median :1  
#>  Mean   : 669.1          Mean   : 92.9   Mean   : 55.54   Mean   :1  
#>  3rd Qu.: 829.0          3rd Qu.:142.2   3rd Qu.: 80.10   3rd Qu.:1  
#>  Max.   :1560.0          Max.   :173.0   Max.   :142.40   Max.   :1  
#>                                                                      
#>     Inf2.04       Inf.04           Veg.04           Pod.04       Inf2.05       
#>  Min.   :0    Min.   :0.0000   Min.   : 0.000   Min.   :0.0   Min.   :0.00000  
#>  1st Qu.:0    1st Qu.:0.0000   1st Qu.: 1.000   1st Qu.:0.0   1st Qu.:0.00000  
#>  Median :0    Median :0.0000   Median : 2.000   Median :0.0   Median :0.00000  
#>  Mean   :0    Mean   :0.6923   Mean   : 2.923   Mean   :0.2   Mean   :0.04478  
#>  3rd Qu.:0    3rd Qu.:1.0000   3rd Qu.: 4.000   3rd Qu.:0.0   3rd Qu.:0.00000  
#>  Max.   :0    Max.   :8.0000   Max.   :12.000   Max.   :3.0   Max.   :1.00000  
#>  NA's   :12   NA's   :12       NA's   :12       NA's   :12    NA's   :10       
#>      Inf.05           Veg.05          Pod.05          Inf2.06  
#>  Min.   : 0.000   Min.   :0.000   Min.   :0.0000   Min.   :0   
#>  1st Qu.: 0.000   1st Qu.:1.000   1st Qu.:0.0000   1st Qu.:0   
#>  Median : 0.000   Median :1.000   Median :0.0000   Median :0   
#>  Mean   : 1.537   Mean   :2.134   Mean   :0.6567   Mean   :0   
#>  3rd Qu.: 2.000   3rd Qu.:3.000   3rd Qu.:1.0000   3rd Qu.:0   
#>  Max.   :18.000   Max.   :9.000   Max.   :7.0000   Max.   :0   
#>  NA's   :10       NA's   :10      NA's   :10       NA's   :16  
#>      Inf.06            Veg.06           Pod.06       Inf2.07       
#>  Min.   : 0.0000   Min.   : 0.000   Min.   :0.0000   Mode:logical  
#>  1st Qu.: 0.0000   1st Qu.: 1.000   1st Qu.:0.0000   NA's:77       
#>  Median : 0.0000   Median : 2.000   Median :0.0000                 
#>  Mean   : 0.9016   Mean   : 2.213   Mean   :0.3934                 
#>  3rd Qu.: 1.0000   3rd Qu.: 3.000   3rd Qu.:0.0000                 
#>  Max.   :18.0000   Max.   :13.000   Max.   :4.0000                 
#>  NA's   :16        NA's   :16       NA's   :16                     
#>      Inf.07           Veg.07           Pod.07          Inf2.08  
#>  Min.   :0.0000   Min.   : 0.000   Min.   :0.0000   Min.   :0   
#>  1st Qu.:0.0000   1st Qu.: 1.000   1st Qu.:0.0000   1st Qu.:0   
#>  Median :0.0000   Median : 2.000   Median :0.0000   Median :0   
#>  Mean   :0.6271   Mean   : 2.627   Mean   :0.0678   Mean   :0   
#>  3rd Qu.:1.0000   3rd Qu.: 4.000   3rd Qu.:0.0000   3rd Qu.:0   
#>  Max.   :7.0000   Max.   :13.000   Max.   :1.0000   Max.   :0   
#>  NA's   :18       NA's   :18       NA's   :18       NA's   :24  
#>      Inf.08            Veg.08          Pod.08          Inf2.09  
#>  Min.   : 0.0000   Min.   : 0.00   Min.   :0.0000   Min.   :0   
#>  1st Qu.: 0.0000   1st Qu.: 1.00   1st Qu.:0.0000   1st Qu.:0   
#>  Median : 0.0000   Median : 2.00   Median :0.0000   Median :0   
#>  Mean   : 0.8868   Mean   : 2.83   Mean   :0.1509   Mean   :0   
#>  3rd Qu.: 1.0000   3rd Qu.: 4.00   3rd Qu.:0.0000   3rd Qu.:0   
#>  Max.   :11.0000   Max.   :13.00   Max.   :2.0000   Max.   :0   
#>  NA's   :24        NA's   :24      NA's   :24       NA's   :17  
#>      Inf.09           Veg.09           Pod.09     
#>  Min.   : 0.000   Min.   : 0.000   Min.   :0.000  
#>  1st Qu.: 0.000   1st Qu.: 1.000   1st Qu.:0.000  
#>  Median : 1.000   Median : 1.000   Median :1.000  
#>  Mean   : 1.833   Mean   : 2.233   Mean   :1.133  
#>  3rd Qu.: 2.000   3rd Qu.: 3.000   3rd Qu.:1.000  
#>  Max.   :11.000   Max.   :10.000   Max.   :8.000  
#>  NA's   :17       NA's   :17       NA's   :17

In this dataset, there are 77 individuals, so there are 77 rows with data (not counting the header). There are 27 columns, which are the variables in the dataset. Note that the first three columns are variables giving identifying information about each individual, with each individual’s data entirely restricted to one row. This is followed by a number of sets of four columns, each named Inf2.XX, Inf.XX, Veg.XX, and Pod.XX. The XX in each case corresponds to a specific year, which are organized consecutively. Thus, columns 4-7 refer to year 04 (short for 2004), columns 8-11 refer to year 05, columns 12-15 refer to year 06, columns 16-19 refer to year 07, columns 20-23 refer to year 08, and columns 24-27 refer to year 09. Within each set of years, we see a repeating pattern of our four variables, which makes standardization easier later (although this repeating pattern is actually not required). To properly conduct this exercise, we need to know the exact number of years used, which is six years here (includes all years from 2004 to 2009).

Although this dataset is in horizontal structure, many demographers prefer to keep their data in a vertical structure. Data cypvert is essentially the same dataset as cypdata, but supplied in vertical structure. Let’s look at a screenshot of the Excel spreadsheet.

Figure 3L.3. Organization of the Cypripedium candidum vertical dataset, as viewed in Microsoft Excel.

There are a number of differences from the horizontal dataset. One key difference is that each row includes not just identifying information about the individual, but also there is a column identifying the year that each datum was recorded. Here, the column year2 represents the monitoring occasion in time t. Some demographers include a single year of data per row, while others include two years in order to use the dataset directly in matrix estimation. Package lefko3 can handle all of these variations.

Here we view the vertical dataset’s dimensions and summary.

writeLines("Dimensions of dataset, in rows (data points) followed by columns (variables): ")
#> Dimensions of dataset, in rows (data points) followed by columns (variables):
dim(cypvert)
#> [1] 322  14
writeLines("\nSummary: ")
#> 
#> Summary:
summary(cypvert)
#>     plantid       patch         X               Y             censor 
#>  Min.   : 164.0   A: 94   Min.   : 46.5   Min.   :-28.0   Min.   :1  
#>  1st Qu.: 391.0   B:153   1st Qu.: 60.1   1st Qu.: 23.3   1st Qu.:1  
#>  Median : 453.0   C: 75   Median : 91.3   Median : 77.0   Median :1  
#>  Mean   : 656.3           Mean   : 91.5   Mean   : 56.5   Mean   :1  
#>  3rd Qu.: 476.0           3rd Qu.:141.8   3rd Qu.: 80.4   3rd Qu.:1  
#>  Max.   :1560.0           Max.   :173.0   Max.   :142.4   Max.   :1  
#>                                                                      
#>      year2          Inf2.2             Inf.2            Veg.2       
#>  Min.   :2004   Min.   :0.000000   Min.   : 0.000   Min.   : 0.000  
#>  1st Qu.:2005   1st Qu.:0.000000   1st Qu.: 0.000   1st Qu.: 1.000  
#>  Median :2006   Median :0.000000   Median : 0.000   Median : 2.000  
#>  Mean   :2006   Mean   :0.009868   Mean   : 0.941   Mean   : 2.534  
#>  3rd Qu.:2007   3rd Qu.:0.000000   3rd Qu.: 1.000   3rd Qu.: 3.000  
#>  Max.   :2008   Max.   :1.000000   Max.   :18.000   Max.   :13.000  
#>                 NA's   :18         NA's   :17       NA's   :17      
#>      Pod.2            Inf2.3            Inf.3            Veg.3       
#>  Min.   :0.0000   Min.   :0.00000   Min.   : 0.000   Min.   : 0.000  
#>  1st Qu.:0.0000   1st Qu.:0.00000   1st Qu.: 0.000   1st Qu.: 1.000  
#>  Median :0.0000   Median :0.00000   Median : 0.000   Median : 2.000  
#>  Mean   :0.3049   Mean   :0.01034   Mean   : 1.192   Mean   : 2.436  
#>  3rd Qu.:0.0000   3rd Qu.:0.00000   3rd Qu.: 1.000   3rd Qu.: 3.000  
#>  Max.   :7.0000   Max.   :1.00000   Max.   :18.000   Max.   :13.000  
#>  NA's   :17       NA's   :32        NA's   :31       NA's   :31      
#>      Pod.3       
#>  Min.   :0.0000  
#>  1st Qu.:0.0000  
#>  Median :0.0000  
#>  Mean   :0.5086  
#>  3rd Qu.:0.5000  
#>  Max.   :8.0000  
#>  NA's   :31

This dataset is longer and narrower, with more rows and fewer columns. This is because we constructed the dataset by splitting the data for each individual across multiple rows. After three columns of identifying information (plantid, patch, and censor), a single column designates the time of occasion t, given as year2. This dataset then includes columns showing individual state in pairs of consecutive years corresponding to occasions t and t+1. State in occasion t-1 is not presented because this is an ahistorical dataset. This dataset includes the plantid variable, which is an individual identity term that allows us to associate rows with their individuals and so allows conversion.

Regardless of the approach used, each dataset must conform to some basic rules to make sure that R can properly process them. One important convention is that the name of each variable must appear only in the very first row of the spreadsheet, because name terms in rows below the first will likely change the variable definitions upon import. Another convention is that blank rows should be avoided, as these are typically interpreted as extra blank data points. The most important convention, however, is consistency of data type within variables. This generally means that variables should not include both numbers and text unless ALL entries are to be interpreted as text rather than true numbers. In essence, R interprets any variable with a single text entry as being purely text, and a variable cannot include a combination of true numbers and text. So, if you wish a variable to include true numbers for use in calculations, such as size measurements or binomial indicators of reproduction, then these variables must include ONLY NUMBERS and missing entries.

Before going further and standardizing our datasets, let’s consider the life history model(s) that we will be using.

Step 1. Life history model development

Our first key decision is how to model the life history of the organism. We generally use the life cycle graph approach, and encourage its use as it simplifies the process of life history model development. The decision of the life history model, however, may be more complicated than simply diagramming the life cycle of the organism. Particularly, we must decide what life stages to include, how these life stages will be defined, and how these life stages are connected to one another via survival and fecundity transitions. These considerations will be strongly influenced by whether we wish to create a raw MPM or a function-based MPM.

It might be easiest to begin our discussion with consideration of the function-based MPM, and what sort of life history model works best if we choose this approach. With a function-based MPM (which includes the integral projection model, or IPM), there are really only two considerations that we need to be concerned about. First, what stages should be included based on a purely biological understanding of the organism’s life history? Some stages may never be monitored, and so these will have to be included but dealt with via proxy rates later. In our case, for example, we never monitored germinated seeds, protocorms, and seedlings, because it is essentially impossible to do so. We will include these stages in our life history model, but we will use proxy rates for their survival transitions, since we cannot use our dataset to estimate them. Second, what is the range of stages and/or sizes that actually occur in the dataset? This question is really focused on determining which survival and fecundity transitions we CAN estimate given our dataset. One key consideration here is to assess the complete range of sizes occurring within our dataset, since we do not wish to create stages in our life cycle model that go beyond the limits of what was actually observed (models that make predictions outside of the range of data they were parameterized with have a tendency to produce erroneous and at times egregiously strange predictions).

Let’s explore the range of sizes in our dataset. There is no one variable that encapsulates the entire size of the individual in our dataset, so we will create a series of vectors that sums the numbers of sprouts that are single-flowered flowering, double-flowered flowering, and non-flowering, and use these sums as plant sizes. If we use the horizontal dataset for this purpose, then we get the following exploration.

size.04 <- cypdata$Inf2.04 + cypdata$Inf.04 + cypdata$Veg.04
size.05 <- cypdata$Inf2.05 + cypdata$Inf.05 + cypdata$Veg.05
size.06 <- cypdata$Inf2.06 + cypdata$Inf.06 + cypdata$Veg.06
size.07 <- cypdata$Inf2.07 + cypdata$Inf.07 + cypdata$Veg.07
size.08 <- cypdata$Inf2.08 + cypdata$Inf.08 + cypdata$Veg.08
size.09 <- cypdata$Inf2.09 + cypdata$Inf.09 + cypdata$Veg.09

summary(c(size.04, size.05, size.06, size.07, size.08, size.09))
#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
#>   1.000   1.000   2.000   3.644   5.000  24.000     156

The summary shows that the smallest recorded size is a single sprout, and the largest is 24 sprouts. The 156 NAs are a combination of vegetative dormancy and instances of individuals being dead or not yet born. Given this, we might utilize the following life history model for our function-based MPMs.

Figure 3L.4. Life history model of Cypripedium candidum for use in function-based MPMs.

We can see a variety of transitions within this figure. The juvenile stages have fairly simple transitions. New recruits may enter the population directly from germination of a seed produced the previous year, in which case they start in the protocorm 1 stage, or they may begin as dormant seed. Dormant seed may remain dormant, die, or germinate into the protocorm 1 stage. Protocorms exist for up to three years, yielding the protocorm 1, 2, and 3 stages, without any possibility of staying within each of these stages for more than a single year. Protocorm 3 leads to a seedling stage, in which the plant may persist for many years before becoming mature. Here, maturity does not really refer to reproduction per se, but rather to a morphology indistinguishable from a reproductive plant except for the lack of a flower. The first mature stage is usually either vegetative dormancy (dorm), during which time the plant does not sprout, or a small, non-flowering adult (1V). Once in this portion of the life history, the plant may transition among 49 mature stages, including vegetative dormancy, 1-24 shoots without flowers, or 1-24 shoots with at least one flower.

Now that we have our life history model, we will need to describe the life history characterizing the dataset, matching it to our analyses properly with a stageframe for our Cypripedium candidum dataset. This is a vitally important step, and most instances of errors occurring in the use of lefko3 originate from an inappropriate stageframe being used in an analysis. Since this analysis will be function-based, we will include all possible size classes here. If constructing raw matrices, all sizes that occur in the dataset need to be accounted for in a way that is both natural and parsimonious with respect to the numbers of individuals moving through actual transitions. If constructing function-based matrices, such as IPMs, then representative sizes at systematic increments will be satisfactory. Since size is count-based in the Cypripedium candidum case, we will use all numbers of stems that might occur from zero to the maximum in the dataset, representing the life history diagram shown in the beginning of this chapter.

sizevector <- c(0, 0, 0, 0, 0, seq(from = 0, t = 24), seq(from = 1, to = 24))
stagevector <- c("SD", "P1", "P2", "P3", "SL", "D", "V1", "V2", "V3", "V4", "V5", 
  "V6", "V7", "V8", "V9", "V10", "V11", "V12", "V13", "V14", "V15", "V16", "V17", 
  "V18", "V19", "V20", "V21", "V22", "V23", "V24", "F1", "F2", "F3", "F4", "F5",
  "F6", "F7", "F8", "F9", "F10", "F11", "F12", "F13", "F14", "F15", "F16", "F17",
  "F18", "F19", "F20", "F21", "F22", "F23", "F24")
repvector <- c(0, 0, 0, 0, 0, rep(0, 25), rep(1, 24))
obsvector <- c(0, 0, 0, 0, 0, 0, rep(1, 48))
matvector <- c(0, 0, 0, 0, 0, rep(1, 49))
immvector <- c(0, 1, 1, 1, 1, rep(0, 49))
propvector <- c(1, rep(0, 53))
indataset <- c(0, 0, 0, 0, 0, rep(1, 49))
comments <- c("Dormant seed", "Yr1 protocorm", "Yr2 protocorm", "Yr3 protocorm",
  "Seedling", "Veg dorm", "Veg adult 1 stem", "Veg adult 2 stems",
  "Veg adult 3 stems", "Veg adult 4 stems", "Veg adult 5 stems",
  "Veg adult 6 stems", "Veg adult 7 stems", "Veg adult 8 stems",
  "Veg adult 9 stems", "Veg adult 10 stems", "Veg adult 11 stems",
  "Veg adult 12 stems", "Veg adult 13 stems", "Veg adult 14 stems",
  "Veg adult 15 stems", "Veg adult 16 stems", "Veg adult 17 stems",
  "Veg adult 18 stems", "Veg adult 19 stems", "Veg adult 20 stems",
  "Veg adult 21 stems", "Veg adult 22 stems", "Veg adult 23 stems",
  "Veg adult 24 stems", "Flo adult 1 stem", "Flo adult 2 stems",
  "Flo adult 3 stems", "Flo adult 4 stems", "Flo adult 5 stems",
  "Flo adult 6 stems", "Flo adult 7 stems", "Flo adult 8 stems",
  "Flo adult 9 stems", "Flo adult 10 stems", "Flo adult 11 stems",
  "Flo adult 12 stems", "Flo adult 13 stems", "Flo adult 14 stems",
  "Flo adult 15 stems", "Flo adult 16 stems", "Flo adult 17 stems",
  "Flo adult 18 stems", "Flo adult 19 stems", "Flo adult 20 stems",
  "Flo adult 21 stems", "Flo adult 22 stems", "Flo adult 23 stems",
  "Flo adult 24 stems")

cypframe_fb <- sf_create(sizes = sizevector, stagenames = stagevector, 
  repstatus = repvector, obsstatus = obsvector, matstatus = matvector, 
  propstatus = propvector, immstatus = immvector, indataset = indataset,
  comments = comments)
cypframe_fb
#>    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      D    0     NA     NA      NA      NA         0         0          0
#> 7     V1    1     NA     NA      NA      NA         0         1          0
#> 8     V2    2     NA     NA      NA      NA         0         1          0
#> 9     V3    3     NA     NA      NA      NA         0         1          0
#> 10    V4    4     NA     NA      NA      NA         0         1          0
#> 11    V5    5     NA     NA      NA      NA         0         1          0
#> 12    V6    6     NA     NA      NA      NA         0         1          0
#> 13    V7    7     NA     NA      NA      NA         0         1          0
#> 14    V8    8     NA     NA      NA      NA         0         1          0
#> 15    V9    9     NA     NA      NA      NA         0         1          0
#> 16   V10   10     NA     NA      NA      NA         0         1          0
#> 17   V11   11     NA     NA      NA      NA         0         1          0
#> 18   V12   12     NA     NA      NA      NA         0         1          0
#> 19   V13   13     NA     NA      NA      NA         0         1          0
#> 20   V14   14     NA     NA      NA      NA         0         1          0
#> 21   V15   15     NA     NA      NA      NA         0         1          0
#> 22   V16   16     NA     NA      NA      NA         0         1          0
#> 23   V17   17     NA     NA      NA      NA         0         1          0
#> 24   V18   18     NA     NA      NA      NA         0         1          0
#> 25   V19   19     NA     NA      NA      NA         0         1          0
#> 26   V20   20     NA     NA      NA      NA         0         1          0
#> 27   V21   21     NA     NA      NA      NA         0         1          0
#> 28   V22   22     NA     NA      NA      NA         0         1          0
#> 29   V23   23     NA     NA      NA      NA         0         1          0
#> 30   V24   24     NA     NA      NA      NA         0         1          0
#> 31    F1    1     NA     NA      NA      NA         1         1          0
#> 32    F2    2     NA     NA      NA      NA         1         1          0
#> 33    F3    3     NA     NA      NA      NA         1         1          0
#> 34    F4    4     NA     NA      NA      NA         1         1          0
#> 35    F5    5     NA     NA      NA      NA         1         1          0
#> 36    F6    6     NA     NA      NA      NA         1         1          0
#> 37    F7    7     NA     NA      NA      NA         1         1          0
#> 38    F8    8     NA     NA      NA      NA         1         1          0
#> 39    F9    9     NA     NA      NA      NA         1         1          0
#> 40   F10   10     NA     NA      NA      NA         1         1          0
#> 41   F11   11     NA     NA      NA      NA         1         1          0
#> 42   F12   12     NA     NA      NA      NA         1         1          0
#> 43   F13   13     NA     NA      NA      NA         1         1          0
#> 44   F14   14     NA     NA      NA      NA         1         1          0
#> 45   F15   15     NA     NA      NA      NA         1         1          0
#> 46   F16   16     NA     NA      NA      NA         1         1          0
#> 47   F17   17     NA     NA      NA      NA         1         1          0
#> 48   F18   18     NA     NA      NA      NA         1         1          0
#> 49   F19   19     NA     NA      NA      NA         1         1          0
#> 50   F20   20     NA     NA      NA      NA         1         1          0
#> 51   F21   21     NA     NA      NA      NA         1         1          0
#> 52   F22   22     NA     NA      NA      NA         1         1          0
#> 53   F23   23     NA     NA      NA      NA         1         1          0
#> 54   F24   24     NA     NA      NA      NA         1         1          0
#>    immstatus matstatus indataset binhalfwidth_raw sizebin_min sizebin_max
#> 1          0         0         0              0.5        -0.5         0.5
#> 2          1         0         0              0.5        -0.5         0.5
#> 3          1         0         0              0.5        -0.5         0.5
#> 4          1         0         0              0.5        -0.5         0.5
#> 5          1         0         0              0.5        -0.5         0.5
#> 6          0         1         1              0.5        -0.5         0.5
#> 7          0         1         1              0.5         0.5         1.5
#> 8          0         1         1              0.5         1.5         2.5
#> 9          0         1         1              0.5         2.5         3.5
#> 10         0         1         1              0.5         3.5         4.5
#> 11         0         1         1              0.5         4.5         5.5
#> 12         0         1         1              0.5         5.5         6.5
#> 13         0         1         1              0.5         6.5         7.5
#> 14         0         1         1              0.5         7.5         8.5
#> 15         0         1         1              0.5         8.5         9.5
#> 16         0         1         1              0.5         9.5        10.5
#> 17         0         1         1              0.5        10.5        11.5
#> 18         0         1         1              0.5        11.5        12.5
#> 19         0         1         1              0.5        12.5        13.5
#> 20         0         1         1              0.5        13.5        14.5
#> 21         0         1         1              0.5        14.5        15.5
#> 22         0         1         1              0.5        15.5        16.5
#> 23         0         1         1              0.5        16.5        17.5
#> 24         0         1         1              0.5        17.5        18.5
#> 25         0         1         1              0.5        18.5        19.5
#> 26         0         1         1              0.5        19.5        20.5
#> 27         0         1         1              0.5        20.5        21.5
#> 28         0         1         1              0.5        21.5        22.5
#> 29         0         1         1              0.5        22.5        23.5
#> 30         0         1         1              0.5        23.5        24.5
#> 31         0         1         1              0.5         0.5         1.5
#> 32         0         1         1              0.5         1.5         2.5
#> 33         0         1         1              0.5         2.5         3.5
#> 34         0         1         1              0.5         3.5         4.5
#> 35         0         1         1              0.5         4.5         5.5
#> 36         0         1         1              0.5         5.5         6.5
#> 37         0         1         1              0.5         6.5         7.5
#> 38         0         1         1              0.5         7.5         8.5
#> 39         0         1         1              0.5         8.5         9.5
#> 40         0         1         1              0.5         9.5        10.5
#> 41         0         1         1              0.5        10.5        11.5
#> 42         0         1         1              0.5        11.5        12.5
#> 43         0         1         1              0.5        12.5        13.5
#> 44         0         1         1              0.5        13.5        14.5
#> 45         0         1         1              0.5        14.5        15.5
#> 46         0         1         1              0.5        15.5        16.5
#> 47         0         1         1              0.5        16.5        17.5
#> 48         0         1         1              0.5        17.5        18.5
#> 49         0         1         1              0.5        18.5        19.5
#> 50         0         1         1              0.5        19.5        20.5
#> 51         0         1         1              0.5        20.5        21.5
#> 52         0         1         1              0.5        21.5        22.5
#> 53         0         1         1              0.5        22.5        23.5
#> 54         0         1         1              0.5        23.5        24.5
#>    sizebin_center sizebin_width binhalfwidthb_raw sizebinb_min sizebinb_max
#> 1               0             1                NA           NA           NA
#> 2               0             1                NA           NA           NA
#> 3               0             1                NA           NA           NA
#> 4               0             1                NA           NA           NA
#> 5               0             1                NA           NA           NA
#> 6               0             1                NA           NA           NA
#> 7               1             1                NA           NA           NA
#> 8               2             1                NA           NA           NA
#> 9               3             1                NA           NA           NA
#> 10              4             1                NA           NA           NA
#> 11              5             1                NA           NA           NA
#> 12              6             1                NA           NA           NA
#> 13              7             1                NA           NA           NA
#> 14              8             1                NA           NA           NA
#> 15              9             1                NA           NA           NA
#> 16             10             1                NA           NA           NA
#> 17             11             1                NA           NA           NA
#> 18             12             1                NA           NA           NA
#> 19             13             1                NA           NA           NA
#> 20             14             1                NA           NA           NA
#> 21             15             1                NA           NA           NA
#> 22             16             1                NA           NA           NA
#> 23             17             1                NA           NA           NA
#> 24             18             1                NA           NA           NA
#> 25             19             1                NA           NA           NA
#> 26             20             1                NA           NA           NA
#> 27             21             1                NA           NA           NA
#> 28             22             1                NA           NA           NA
#> 29             23             1                NA           NA           NA
#> 30             24             1                NA           NA           NA
#> 31              1             1                NA           NA           NA
#> 32              2             1                NA           NA           NA
#> 33              3             1                NA           NA           NA
#> 34              4             1                NA           NA           NA
#> 35              5             1                NA           NA           NA
#> 36              6             1                NA           NA           NA
#> 37              7             1                NA           NA           NA
#> 38              8             1                NA           NA           NA
#> 39              9             1                NA           NA           NA
#> 40             10             1                NA           NA           NA
#> 41             11             1                NA           NA           NA
#> 42             12             1                NA           NA           NA
#> 43             13             1                NA           NA           NA
#> 44             14             1                NA           NA           NA
#> 45             15             1                NA           NA           NA
#> 46             16             1                NA           NA           NA
#> 47             17             1                NA           NA           NA
#> 48             18             1                NA           NA           NA
#> 49             19             1                NA           NA           NA
#> 50             20             1                NA           NA           NA
#> 51             21             1                NA           NA           NA
#> 52             22             1                NA           NA           NA
#> 53             23             1                NA           NA           NA
#> 54             24             1                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
#> 15              NA             NA                NA           NA           NA
#> 16              NA             NA                NA           NA           NA
#> 17              NA             NA                NA           NA           NA
#> 18              NA             NA                NA           NA           NA
#> 19              NA             NA                NA           NA           NA
#> 20              NA             NA                NA           NA           NA
#> 21              NA             NA                NA           NA           NA
#> 22              NA             NA                NA           NA           NA
#> 23              NA             NA                NA           NA           NA
#> 24              NA             NA                NA           NA           NA
#> 25              NA             NA                NA           NA           NA
#> 26              NA             NA                NA           NA           NA
#> 27              NA             NA                NA           NA           NA
#> 28              NA             NA                NA           NA           NA
#> 29              NA             NA                NA           NA           NA
#> 30              NA             NA                NA           NA           NA
#> 31              NA             NA                NA           NA           NA
#> 32              NA             NA                NA           NA           NA
#> 33              NA             NA                NA           NA           NA
#> 34              NA             NA                NA           NA           NA
#> 35              NA             NA                NA           NA           NA
#> 36              NA             NA                NA           NA           NA
#> 37              NA             NA                NA           NA           NA
#> 38              NA             NA                NA           NA           NA
#> 39              NA             NA                NA           NA           NA
#> 40              NA             NA                NA           NA           NA
#> 41              NA             NA                NA           NA           NA
#> 42              NA             NA                NA           NA           NA
#> 43              NA             NA                NA           NA           NA
#> 44              NA             NA                NA           NA           NA
#> 45              NA             NA                NA           NA           NA
#> 46              NA             NA                NA           NA           NA
#> 47              NA             NA                NA           NA           NA
#> 48              NA             NA                NA           NA           NA
#> 49              NA             NA                NA           NA           NA
#> 50              NA             NA                NA           NA           NA
#> 51              NA             NA                NA           NA           NA
#> 52              NA             NA                NA           NA           NA
#> 53              NA             NA                NA           NA           NA
#> 54              NA             NA                NA           NA           NA
#>    sizebinc_center sizebinc_width group           comments
#> 1               NA             NA     0       Dormant seed
#> 2               NA             NA     0      Yr1 protocorm
#> 3               NA             NA     0      Yr2 protocorm
#> 4               NA             NA     0      Yr3 protocorm
#> 5               NA             NA     0           Seedling
#> 6               NA             NA     0           Veg dorm
#> 7               NA             NA     0   Veg adult 1 stem
#> 8               NA             NA     0  Veg adult 2 stems
#> 9               NA             NA     0  Veg adult 3 stems
#> 10              NA             NA     0  Veg adult 4 stems
#> 11              NA             NA     0  Veg adult 5 stems
#> 12              NA             NA     0  Veg adult 6 stems
#> 13              NA             NA     0  Veg adult 7 stems
#> 14              NA             NA     0  Veg adult 8 stems
#> 15              NA             NA     0  Veg adult 9 stems
#> 16              NA             NA     0 Veg adult 10 stems
#> 17              NA             NA     0 Veg adult 11 stems
#> 18              NA             NA     0 Veg adult 12 stems
#> 19              NA             NA     0 Veg adult 13 stems
#> 20              NA             NA     0 Veg adult 14 stems
#> 21              NA             NA     0 Veg adult 15 stems
#> 22              NA             NA     0 Veg adult 16 stems
#> 23              NA             NA     0 Veg adult 17 stems
#> 24              NA             NA     0 Veg adult 18 stems
#> 25              NA             NA     0 Veg adult 19 stems
#> 26              NA             NA     0 Veg adult 20 stems
#> 27              NA             NA     0 Veg adult 21 stems
#> 28              NA             NA     0 Veg adult 22 stems
#> 29              NA             NA     0 Veg adult 23 stems
#> 30              NA             NA     0 Veg adult 24 stems
#> 31              NA             NA     0   Flo adult 1 stem
#> 32              NA             NA     0  Flo adult 2 stems
#> 33              NA             NA     0  Flo adult 3 stems
#> 34              NA             NA     0  Flo adult 4 stems
#> 35              NA             NA     0  Flo adult 5 stems
#> 36              NA             NA     0  Flo adult 6 stems
#> 37              NA             NA     0  Flo adult 7 stems
#> 38              NA             NA     0  Flo adult 8 stems
#> 39              NA             NA     0  Flo adult 9 stems
#> 40              NA             NA     0 Flo adult 10 stems
#> 41              NA             NA     0 Flo adult 11 stems
#> 42              NA             NA     0 Flo adult 12 stems
#> 43              NA             NA     0 Flo adult 13 stems
#> 44              NA             NA     0 Flo adult 14 stems
#> 45              NA             NA     0 Flo adult 15 stems
#> 46              NA             NA     0 Flo adult 16 stems
#> 47              NA             NA     0 Flo adult 17 stems
#> 48              NA             NA     0 Flo adult 18 stems
#> 49              NA             NA     0 Flo adult 19 stems
#> 50              NA             NA     0 Flo adult 20 stems
#> 51              NA             NA     0 Flo adult 21 stems
#> 52              NA             NA     0 Flo adult 22 stems
#> 53              NA             NA     0 Flo adult 23 stems
#> 54              NA             NA     0 Flo adult 24 stems

A close look at the resulting object, cypframe, shows a data frame that includes the following information in order for each stage: the stage’s name, the associated size (up to three possible size metrics), the minimum and maximum age the stage occurs in (only needed for age-by-stage MPMs), its reproductive status, its status as an observable stage, its status as a propagule stage, its status as an immature stage, its status as a mature stage, whether it occurs in the dataset, the half-width of its size class bin, the minimum and maximum of its size class bin, the centroid of its size class bin (currently the arithmetic mean), its full size class bin width, repeats of the bin width metrics for the secondary and tertiary size metrics, a stage group variable, and a comments field describing the stage. Stage names and combinations of characteristics must be unique to prevent estimation errors, and the comments field may be edited to include any information deemed pertinent.

The stageframe above is a bit long, and required some long vectors to create. Fortunately, functionsf_create() includes some shorthand codes to make large, complex life history models easy to fit into stageframe format. These shorthand approaches are particularly useful in building IPMs, which generally require discretized size bins that act as stages. In the next block, we show a shorter way of building the above stageframe, using the ipm and ipmbins options.

sizevector <- c(0, 0, 0, 0, 0, 0, 0.5, 24.5, 0.5, 24.5)
stagevector <- c("SD", "P1", "P2", "P3", "SL", "D", "ipm", "ipm", "ipm", "ipm")
repvector <- c(0, 0, 0, 0, 0, 0, 0, 0, 1, 1)
obsvector <- c(0, 0, 0, 0, 0, 0, 1, 1, 1, 1)
matvector <- c(0, 0, 0, 0, 0, 0, 1, 1, 1, 1)
immvector <- c(0, 1, 1, 1, 1, 0, 0, 0, 0, 0)
propvector <- c(1, 0, 0, 0, 0, 0, 0, 0, 0, 0)
indataset <- c(0, 0, 0, 0, 0, 1, 1, 1, 1, 1)
comments <- c("Dormant seed", "Yr1 protocorm", "Yr2 protocorm", "Yr3 protocorm",
  "Seedling", "Veg dorm", "non-reprod", "non-reprod", "reprod", "reprod")

cypframe_ipm <- sf_create(sizes = sizevector, stagenames = stagevector, 
  repstatus = repvector, obsstatus = obsvector, matstatus = matvector, 
  propstatus = propvector, immstatus = immvector, indataset = indataset,
  comments = comments, ipmbins = 24)
cypframe_ipm
#>           stage size size_b size_c min_age max_age repstatus obsstatus
#> 1            SD    0     NA     NA      NA      NA         0         0
#> 2            P1    0     NA     NA      NA      NA         0         0
#> 3            P2    0     NA     NA      NA      NA         0         0
#> 4            P3    0     NA     NA      NA      NA         0         0
#> 5            SL    0     NA     NA      NA      NA         0         0
#> 6             D    0     NA     NA      NA      NA         0         0
#> 7  sza_1.0000_0    1     NA     NA      NA      NA         0         1
#> 8  sza_2.0000_0    2     NA     NA      NA      NA         0         1
#> 9  sza_3.0000_0    3     NA     NA      NA      NA         0         1
#> 10 sza_4.0000_0    4     NA     NA      NA      NA         0         1
#> 11 sza_5.0000_0    5     NA     NA      NA      NA         0         1
#> 12 sza_6.0000_0    6     NA     NA      NA      NA         0         1
#> 13 sza_7.0000_0    7     NA     NA      NA      NA         0         1
#> 14 sza_8.0000_0    8     NA     NA      NA      NA         0         1
#> 15 sza_9.0000_0    9     NA     NA      NA      NA         0         1
#> 16 sza_10.000_0   10     NA     NA      NA      NA         0         1
#> 17 sza_11.000_0   11     NA     NA      NA      NA         0         1
#> 18 sza_12.000_0   12     NA     NA      NA      NA         0         1
#> 19 sza_13.000_0   13     NA     NA      NA      NA         0         1
#> 20 sza_14.000_0   14     NA     NA      NA      NA         0         1
#> 21 sza_15.000_0   15     NA     NA      NA      NA         0         1
#> 22 sza_16.000_0   16     NA     NA      NA      NA         0         1
#> 23 sza_17.000_0   17     NA     NA      NA      NA         0         1
#> 24 sza_18.000_0   18     NA     NA      NA      NA         0         1
#> 25 sza_19.000_0   19     NA     NA      NA      NA         0         1
#> 26 sza_20.000_0   20     NA     NA      NA      NA         0         1
#> 27 sza_21.000_0   21     NA     NA      NA      NA         0         1
#> 28 sza_22.000_0   22     NA     NA      NA      NA         0         1
#> 29 sza_23.000_0   23     NA     NA      NA      NA         0         1
#> 30 sza_24.000_0   24     NA     NA      NA      NA         0         1
#> 31 sza_1.0000_0    1     NA     NA      NA      NA         1         1
#> 32 sza_2.0000_0    2     NA     NA      NA      NA         1         1
#> 33 sza_3.0000_0    3     NA     NA      NA      NA         1         1
#> 34 sza_4.0000_0    4     NA     NA      NA      NA         1         1
#> 35 sza_5.0000_0    5     NA     NA      NA      NA         1         1
#> 36 sza_6.0000_0    6     NA     NA      NA      NA         1         1
#> 37 sza_7.0000_0    7     NA     NA      NA      NA         1         1
#> 38 sza_8.0000_0    8     NA     NA      NA      NA         1         1
#> 39 sza_9.0000_0    9     NA     NA      NA      NA         1         1
#> 40 sza_10.000_0   10     NA     NA      NA      NA         1         1
#> 41 sza_11.000_0   11     NA     NA      NA      NA         1         1
#> 42 sza_12.000_0   12     NA     NA      NA      NA         1         1
#> 43 sza_13.000_0   13     NA     NA      NA      NA         1         1
#> 44 sza_14.000_0   14     NA     NA      NA      NA         1         1
#> 45 sza_15.000_0   15     NA     NA      NA      NA         1         1
#> 46 sza_16.000_0   16     NA     NA      NA      NA         1         1
#> 47 sza_17.000_0   17     NA     NA      NA      NA         1         1
#> 48 sza_18.000_0   18     NA     NA      NA      NA         1         1
#> 49 sza_19.000_0   19     NA     NA      NA      NA         1         1
#> 50 sza_20.000_0   20     NA     NA      NA      NA         1         1
#> 51 sza_21.000_0   21     NA     NA      NA      NA         1         1
#> 52 sza_22.000_0   22     NA     NA      NA      NA         1         1
#> 53 sza_23.000_0   23     NA     NA      NA      NA         1         1
#> 54 sza_24.000_0   24     NA     NA      NA      NA         1         1
#>    propstatus immstatus matstatus indataset binhalfwidth_raw sizebin_min
#> 1           1         0         0         0              0.5        -0.5
#> 2           0         1         0         0              0.5        -0.5
#> 3           0         1         0         0              0.5        -0.5
#> 4           0         1         0         0              0.5        -0.5
#> 5           0         1         0         0              0.5        -0.5
#> 6           0         0         0         1              0.5        -0.5
#> 7           0         0         1         1              0.5         0.5
#> 8           0         0         1         1              0.5         1.5
#> 9           0         0         1         1              0.5         2.5
#> 10          0         0         1         1              0.5         3.5
#> 11          0         0         1         1              0.5         4.5
#> 12          0         0         1         1              0.5         5.5
#> 13          0         0         1         1              0.5         6.5
#> 14          0         0         1         1              0.5         7.5
#> 15          0         0         1         1              0.5         8.5
#> 16          0         0         1         1              0.5         9.5
#> 17          0         0         1         1              0.5        10.5
#> 18          0         0         1         1              0.5        11.5
#> 19          0         0         1         1              0.5        12.5
#> 20          0         0         1         1              0.5        13.5
#> 21          0         0         1         1              0.5        14.5
#> 22          0         0         1         1              0.5        15.5
#> 23          0         0         1         1              0.5        16.5
#> 24          0         0         1         1              0.5        17.5
#> 25          0         0         1         1              0.5        18.5
#> 26          0         0         1         1              0.5        19.5
#> 27          0         0         1         1              0.5        20.5
#> 28          0         0         1         1              0.5        21.5
#> 29          0         0         1         1              0.5        22.5
#> 30          0         0         1         1              0.5        23.5
#> 31          0         0         1         1              0.5         0.5
#> 32          0         0         1         1              0.5         1.5
#> 33          0         0         1         1              0.5         2.5
#> 34          0         0         1         1              0.5         3.5
#> 35          0         0         1         1              0.5         4.5
#> 36          0         0         1         1              0.5         5.5
#> 37          0         0         1         1              0.5         6.5
#> 38          0         0         1         1              0.5         7.5
#> 39          0         0         1         1              0.5         8.5
#> 40          0         0         1         1              0.5         9.5
#> 41          0         0         1         1              0.5        10.5
#> 42          0         0         1         1              0.5        11.5
#> 43          0         0         1         1              0.5        12.5
#> 44          0         0         1         1              0.5        13.5
#> 45          0         0         1         1              0.5        14.5
#> 46          0         0         1         1              0.5        15.5
#> 47          0         0         1         1              0.5        16.5
#> 48          0         0         1         1              0.5        17.5
#> 49          0         0         1         1              0.5        18.5
#> 50          0         0         1         1              0.5        19.5
#> 51          0         0         1         1              0.5        20.5
#> 52          0         0         1         1              0.5        21.5
#> 53          0         0         1         1              0.5        22.5
#> 54          0         0         1         1              0.5        23.5
#>    sizebin_max sizebin_center sizebin_width binhalfwidthb_raw sizebinb_min
#> 1          0.5              0             1                NA           NA
#> 2          0.5              0             1                NA           NA
#> 3          0.5              0             1                NA           NA
#> 4          0.5              0             1                NA           NA
#> 5          0.5              0             1                NA           NA
#> 6          0.5              0             1                NA           NA
#> 7          1.5              1             1                NA           NA
#> 8          2.5              2             1                NA           NA
#> 9          3.5              3             1                NA           NA
#> 10         4.5              4             1                NA           NA
#> 11         5.5              5             1                NA           NA
#> 12         6.5              6             1                NA           NA
#> 13         7.5              7             1                NA           NA
#> 14         8.5              8             1                NA           NA
#> 15         9.5              9             1                NA           NA
#> 16        10.5             10             1                NA           NA
#> 17        11.5             11             1                NA           NA
#> 18        12.5             12             1                NA           NA
#> 19        13.5             13             1                NA           NA
#> 20        14.5             14             1                NA           NA
#> 21        15.5             15             1                NA           NA
#> 22        16.5             16             1                NA           NA
#> 23        17.5             17             1                NA           NA
#> 24        18.5             18             1                NA           NA
#> 25        19.5             19             1                NA           NA
#> 26        20.5             20             1                NA           NA
#> 27        21.5             21             1                NA           NA
#> 28        22.5             22             1                NA           NA
#> 29        23.5             23             1                NA           NA
#> 30        24.5             24             1                NA           NA
#> 31         1.5              1             1                NA           NA
#> 32         2.5              2             1                NA           NA
#> 33         3.5              3             1                NA           NA
#> 34         4.5              4             1                NA           NA
#> 35         5.5              5             1                NA           NA
#> 36         6.5              6             1                NA           NA
#> 37         7.5              7             1                NA           NA
#> 38         8.5              8             1                NA           NA
#> 39         9.5              9             1                NA           NA
#> 40        10.5             10             1                NA           NA
#> 41        11.5             11             1                NA           NA
#> 42        12.5             12             1                NA           NA
#> 43        13.5             13             1                NA           NA
#> 44        14.5             14             1                NA           NA
#> 45        15.5             15             1                NA           NA
#> 46        16.5             16             1                NA           NA
#> 47        17.5             17             1                NA           NA
#> 48        18.5             18             1                NA           NA
#> 49        19.5             19             1                NA           NA
#> 50        20.5             20             1                NA           NA
#> 51        21.5             21             1                NA           NA
#> 52        22.5             22             1                NA           NA
#> 53        23.5             23             1                NA           NA
#> 54        24.5             24             1                NA           NA
#>    sizebinb_max sizebinb_center sizebinb_width binhalfwidthc_raw sizebinc_min
#> 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
#> 15           NA              NA             NA                NA           NA
#> 16           NA              NA             NA                NA           NA
#> 17           NA              NA             NA                NA           NA
#> 18           NA              NA             NA                NA           NA
#> 19           NA              NA             NA                NA           NA
#> 20           NA              NA             NA                NA           NA
#> 21           NA              NA             NA                NA           NA
#> 22           NA              NA             NA                NA           NA
#> 23           NA              NA             NA                NA           NA
#> 24           NA              NA             NA                NA           NA
#> 25           NA              NA             NA                NA           NA
#> 26           NA              NA             NA                NA           NA
#> 27           NA              NA             NA                NA           NA
#> 28           NA              NA             NA                NA           NA
#> 29           NA              NA             NA                NA           NA
#> 30           NA              NA             NA                NA           NA
#> 31           NA              NA             NA                NA           NA
#> 32           NA              NA             NA                NA           NA
#> 33           NA              NA             NA                NA           NA
#> 34           NA              NA             NA                NA           NA
#> 35           NA              NA             NA                NA           NA
#> 36           NA              NA             NA                NA           NA
#> 37           NA              NA             NA                NA           NA
#> 38           NA              NA             NA                NA           NA
#> 39           NA              NA             NA                NA           NA
#> 40           NA              NA             NA                NA           NA
#> 41           NA              NA             NA                NA           NA
#> 42           NA              NA             NA                NA           NA
#> 43           NA              NA             NA                NA           NA
#> 44           NA              NA             NA                NA           NA
#> 45           NA              NA             NA                NA           NA
#> 46           NA              NA             NA                NA           NA
#> 47           NA              NA             NA                NA           NA
#> 48           NA              NA             NA                NA           NA
#> 49           NA              NA             NA                NA           NA
#> 50           NA              NA             NA                NA           NA
#> 51           NA              NA             NA                NA           NA
#> 52           NA              NA             NA                NA           NA
#> 53           NA              NA             NA                NA           NA
#> 54           NA              NA             NA                NA           NA
#>    sizebinc_max sizebinc_center sizebinc_width group      comments
#> 1            NA              NA             NA     0  Dormant seed
#> 2            NA              NA             NA     0 Yr1 protocorm
#> 3            NA              NA             NA     0 Yr2 protocorm
#> 4            NA              NA             NA     0 Yr3 protocorm
#> 5            NA              NA             NA     0      Seedling
#> 6            NA              NA             NA     0      Veg dorm
#> 7            NA              NA             NA     0    non-reprod
#> 8            NA              NA             NA     0    non-reprod
#> 9            NA              NA             NA     0    non-reprod
#> 10           NA              NA             NA     0    non-reprod
#> 11           NA              NA             NA     0    non-reprod
#> 12           NA              NA             NA     0    non-reprod
#> 13           NA              NA             NA     0    non-reprod
#> 14           NA              NA             NA     0    non-reprod
#> 15           NA              NA             NA     0    non-reprod
#> 16           NA              NA             NA     0    non-reprod
#> 17           NA              NA             NA     0    non-reprod
#> 18           NA              NA             NA     0    non-reprod
#> 19           NA              NA             NA     0    non-reprod
#> 20           NA              NA             NA     0    non-reprod
#> 21           NA              NA             NA     0    non-reprod
#> 22           NA              NA             NA     0    non-reprod
#> 23           NA              NA             NA     0    non-reprod
#> 24           NA              NA             NA     0    non-reprod
#> 25           NA              NA             NA     0    non-reprod
#> 26           NA              NA             NA     0    non-reprod
#> 27           NA              NA             NA     0    non-reprod
#> 28           NA              NA             NA     0    non-reprod
#> 29           NA              NA             NA     0    non-reprod
#> 30           NA              NA             NA     0    non-reprod
#> 31           NA              NA             NA     0        reprod
#> 32           NA              NA             NA     0        reprod
#> 33           NA              NA             NA     0        reprod
#> 34           NA              NA             NA     0        reprod
#> 35           NA              NA             NA     0        reprod
#> 36           NA              NA             NA     0        reprod
#> 37           NA              NA             NA     0        reprod
#> 38           NA              NA             NA     0        reprod
#> 39           NA              NA             NA     0        reprod
#> 40           NA              NA             NA     0        reprod
#> 41           NA              NA             NA     0        reprod
#> 42           NA              NA             NA     0        reprod
#> 43           NA              NA             NA     0        reprod
#> 44           NA              NA             NA     0        reprod
#> 45           NA              NA             NA     0        reprod
#> 46           NA              NA             NA     0        reprod
#> 47           NA              NA             NA     0        reprod
#> 48           NA              NA             NA     0        reprod
#> 49           NA              NA             NA     0        reprod
#> 50           NA              NA             NA     0        reprod
#> 51           NA              NA             NA     0        reprod
#> 52           NA              NA             NA     0        reprod
#> 53           NA              NA             NA     0        reprod
#> 54           NA              NA             NA     0        reprod

In the above code, we find the minimum and maximum sizes that we wish to split among ipmbins stages. We define these in exactly the same way except for the minimum and maximum sizes, in terms of ALL other characteristics (here, the min and max refer to the lower bound of the lowest size bin and the highest bound of the highest size bin, respectively). We tell R how many size bins we want to split this group into with ipmbins. Here, we actually define two such groups, one of which is non-reproductive and the other of which is reproductive, and so it splits each of these groups into ipmbins size bins. The result is the same stageframe as before, but developed more efficiently and compactly.

How does the life history model differ if we wish to develop a raw MPM? The key difference is that we need to consider how large our dataset is, and to create only as many stages as can be routinely transitioned to and from based on the data. The life history model above in Fig. 3L.4, for example, is not usable for raw MPMs because we have cut the size bins too finely - it is likely that in a typical year, only some of these stages will have individuals actually transitioning between them. The impact of this is that we will end up with many zeros for transitions that, in a sufficiently large population, should not equal zero.

To deal with this problem, we need to explore the dataset to determine a reasonable number of life history stages and on where the breaks should occur between these stages. A number of means exist to do this, and users should see Caswell (2001) and Kendall et al. (2019) for good discussions of the topic. Here, we suggest plotting a size distribution and assessing a series of numbers of natural breaks using the Jenks natural breaks algorithm (Jenks 1967), or another such algorithm. Let’s take a look at a distribution plot of size.

plot(density(c(size.04, size.05, size.06, size.07, size.08, size.09), na.rm = TRUE), 
  main = "", xlab = "Size (# of sprouts)", bty = "n")
Figure 3L.5. Distribution of size in Cypripedium candidum

Figure 3L.5. Distribution of size in Cypripedium candidum

We can see here that most individuals are small, and so our size data is densest around 1-2 sprouts or so. Large individuals are rare, so we will need to make size bins larger for big plants than for small plants. Let’s try finding some natural breaks with the Jenks algorithm, separating into 3, 4, 5, and 6 stages. To separate the size data into these numbers of stages stages, we need to identify a total of 4, 5, 6, and 7 breaks including the minimum and maximum. Please make sure that you have installed the BAMMtools package for this to work properly.

BAMMtools::getJenksBreaks(c(size.04, size.05, size.06, size.07, size.08, size.09), 
  k = 4)
#> [1]  1  4 12 24
BAMMtools::getJenksBreaks(c(size.04, size.05, size.06, size.07, size.08, size.09), 
  k = 5)
#> [1]  1  3  7 14 24
BAMMtools::getJenksBreaks(c(size.04, size.05, size.06, size.07, size.08, size.09), 
  k = 6)
#> [1]  1  2  4  7 14 24
BAMMtools::getJenksBreaks(c(size.04, size.05, size.06, size.07, size.08, size.09), 
  k = 7)
#> [1]  1  2  4  7 11 16 24

The Jenks method gives us the borders of the size classes under different numbers of stages. So, a 3 stage model has the first stage include 1-4 sprouts, the second stage include 5-12 sprouts, and the 3rd stage include 13-24 sprouts. Given what we know about the size distribution, we will try to separate the data into 5 stages (1 sprout, 2-4 sprouts, 5-7 sprouts, 8-14 sprouts, and 15-24 sprouts), which would result in 11 total life history stages in our life history (1 dormant seed, 3 protocorms, 1 seedling, 1 vegetative dormant stage, and 5 size-classified adult stages).

Let’s now build a stageframe using these breaks.

sizevector <- c(0, 0, 0, 0, 0, 0, 1, 3, 6, 11, 19.5)
stagevector <- c("SD", "P1", "P2", "P3", "SL", "D", "XSm", "Sm", "Md", "Lg",
  "XLg")
repvector <- c(0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1)
obsvector <- c(0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1)
matvector <- c(0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1)
immvector <- c(0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0)
propvector <- c(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
indataset <- c(0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1)
binvec <- c(0, 0, 0, 0, 0, 0.5, 0.5, 1.5, 1.5, 3.5, 5)

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

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

cypframe_raw
#>    stage size size_b size_c min_age max_age repstatus obsstatus propstatus
#> 1     SD  0.0     NA     NA      NA      NA         0         0          1
#> 2     P1  0.0     NA     NA      NA      NA         0         0          0
#> 3     P2  0.0     NA     NA      NA      NA         0         0          0
#> 4     P3  0.0     NA     NA      NA      NA         0         0          0
#> 5     SL  0.0     NA     NA      NA      NA         0         0          0
#> 6      D  0.0     NA     NA      NA      NA         0         0          0
#> 7    XSm  1.0     NA     NA      NA      NA         1         1          0
#> 8     Sm  3.0     NA     NA      NA      NA         1         1          0
#> 9     Md  6.0     NA     NA      NA      NA         1         1          0
#> 10    Lg 11.0     NA     NA      NA      NA         1         1          0
#> 11   XLg 19.5     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          0         1         1              0.5        -0.5         0.5
#> 7          0         1         1              0.5         0.5         1.5
#> 8          0         1         1              1.5         1.5         4.5
#> 9          0         1         1              1.5         4.5         7.5
#> 10         0         1         1              3.5         7.5        14.5
#> 11         0         1         1              5.0        14.5        24.5
#>    sizebin_center sizebin_width binhalfwidthb_raw sizebinb_min sizebinb_max
#> 1             0.0             0                NA           NA           NA
#> 2             0.0             0                NA           NA           NA
#> 3             0.0             0                NA           NA           NA
#> 4             0.0             0                NA           NA           NA
#> 5             0.0             0                NA           NA           NA
#> 6             0.0             1                NA           NA           NA
#> 7             1.0             1                NA           NA           NA
#> 8             3.0             3                NA           NA           NA
#> 9             6.0             3                NA           NA           NA
#> 10           11.0             7                NA           NA           NA
#> 11           19.5            10                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
#>    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     0                  Dormant adult
#> 7               NA             NA     0    Extra small adult (1 shoot)
#> 8               NA             NA     0       Small adult (2-4 shoots)
#> 9               NA             NA     0      Medium adult (5-7 shoots)
#> 10              NA             NA     0      Large adult (8-14 shoots)
#> 11              NA             NA     0 Extra large adult (>14 shoots)

The life history model corresponding to this stageframe is different than in the previous case, primarily in that it has fewer adult stages. Further, all adult stages are now treated as reproductive in order to minimize the possibility that some transitions will equal zero simply from a lack of data (in contrast, we can separate reproductive and non-reproductive stages in the function-based case). Here is our new life history model:

Figure 3L.6. Life history model of Cypripedium candidum for use in raw-based MPMs.

Step 1a. Demographic data standardization

Now that we have our life history models for our raw MPM and function-based MPM analyses, we can create our standardized datasets. We will standardize these datasets using our stageframes, and so we need to create two standardized datasets - one for the raw MPM and another for the function-based MPM. 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 zeros where necessary, and so aid in the assignment of the vegetative dormancy stage. We will add an age_offset of four years, since the youngest individual we could possibly see is five years old and pre-breeding models such as this begin the life history model at age 1 rather than age 0. Finally, note that we set up three different size variables here, not as sizea, sizeb, and sizec, and that we tell R that we want overall size to be the sum of these (stagesize = "sizeadded").

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", age_offset = 4,
  NAas0 = TRUE, NRasRep = TRUE)

head(cypraw_v1)
#>   rowid popid patchid individ year2 firstseen lastseen obsage obslifespan
#> 1     1             A     164  2004      2004     2004      5           0
#> 2     2             A     165  2004      2004     2009      5           5
#> 3     3             A     240  2004      2004     2005      5           1
#> 4     4             A     242  2004      2004     2009      5           5
#> 5     5             A     243  2004      2004     2009      5           5
#> 6     6             A     246  2004      2004     2007      5           3
#>   sizea1 sizeb1 sizec1 size1added repstra1 repstrb1 feca1 juvgiven1 obsstatus1
#> 1      0      0      0          0        0        0     0         0          0
#> 2      0      0      0          0        0        0     0         0          0
#> 3      0      0      0          0        0        0     0         0          0
#> 4      0      0      0          0        0        0     0         0          0
#> 5      0      0      0          0        0        0     0         0          0
#> 6      0      0      0          0        0        0     0         0          0
#>   repstatus1 fecstatus1 matstatus1 alive1   stage1 stage1index sizea2 sizeb2
#> 1          0          0          0      0 NotAlive           0      0      0
#> 2          0          0          0      0 NotAlive           0      0      2
#> 3          0          0          0      0 NotAlive           0      0      1
#> 4          0          0          0      0 NotAlive           0      0      0
#> 5          0          0          0      0 NotAlive           0      0      0
#> 6          0          0          0      0 NotAlive           0      0      0
#>   sizec2 size2added repstra2 repstrb2 feca2 juvgiven2 obsstatus2 repstatus2
#> 1      1          1        0        0     0         0          1          0
#> 2      1          3        2        0     1         0          1          1
#> 3      0          1        1        0     0         0          1          1
#> 4      1          1        0        0     0         0          1          0
#> 5      5          5        0        0     0         0          1          0
#> 6      1          1        0        0     0         0          1          0
#>   fecstatus2 matstatus2 alive2 stage2 stage2index sizea3 sizeb3 sizec3
#> 1          0          1      1    XSm           7      0      0      0
#> 2          1          1      1     Sm           8      0      2      0
#> 3          0          1      1    XSm           7      0      0      1
#> 4          0          1      1    XSm           7      0      0      1
#> 5          0          1      1     Md           9      0      0      2
#> 6          0          1      1    XSm           7      0      0      1
#>   size3added repstra3 repstrb3 feca3 juvgiven3 obsstatus3 repstatus3 fecstatus3
#> 1          0        0        0     0         0          0          0          0
#> 2          2        2        0     0         0          1          1          0
#> 3          1        0        0     0         0          1          0          0
#> 4          1        0        0     0         0          1          0          0
#> 5          2        0        0     0         0          1          0          0
#> 6          1        0        0     0         0          1          0          0
#>   matstatus3 alive3   stage3 stage3index
#> 1          1      0 NotAlive           0
#> 2          1      1       Sm           8
#> 3          1      1      XSm           7
#> 4          1      1      XSm           7
#> 5          1      1       Sm           8
#> 6          1      1      XSm           7

In the code above, we used the head() function to take a look at the first six rows of the standardized data frame. The variable names and formats work with all functions in lefko3, and of course this data frame may be used in other packages, as well. Let’s now take a look at a summary of the full data frame.

summary(cypraw_v1)
#>      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

Let’s also create our standardized data for the function-based MPM, as below. Remember that some of the settings need to change here, primarily because 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", age_offset = 4,
  NAas0 = TRUE)

summary(cypfb_v1)
#>      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

Step 2b. Vertical dataset organization

We may also wish to see how to proceed if our original dataset is already in vertical, but ahistorical, format. This package 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 deal with this dataset, which uses an individual identity variable in order to put all of the data for each individual together. Here, the vertical dataset includes the plantid variable, which is an individual identity term and must be supplied for conversion. Here is the raw MPM dataset.

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, age_offset = 4, NAas0 = TRUE, NRasRep = TRUE,
  reduce = TRUE)

summary(cypraw_v2)
#>      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, age_offset = 4, NAas0 = TRUE, reduce = TRUE)

summary(cypfb_v2)
#>      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

We can compare the dimensions of these datasets.

dim(cypraw_v1)
#> [1] 320  54
dim(cypraw_v2)
#> [1] 320  54
dim(cypfb_v1)
#> [1] 320  54
dim(cypfb_v2)
#> [1] 320  54

The lengths of the datasets are the same in terms of rows and columns, and the variables and data are the same although the order of the columns and rows might not match (see the summaries for comparison).

Let’s now move on to supplying R with the proxy transitions that we need to properly parameterize our models.

Step 2c. Finalize standardized datasets

We will do one last standardization to the dataset. This time, to illustrate how we might use individual or environmental covariates in function-based MPM / IPM projection, we will incorporate some climatic covariates into the dataset. Here, we create a new copy of the original vertical dataset, add new variables coding for our climatic variables, and standardize. Note that we will only do this for the function-based case.

cypdata_env <- cypdata
cypdata_env$prec.04 <- 92.2
cypdata_env$prec.05 <- 57.6
cypdata_env$prec.06 <- 96.0
cypdata_env$prec.07 <- 109.8
cypdata_env$prec.08 <- 111.9
cypdata_env$prec.09 <- 106.8

cypfb_env <- verticalize3(data = cypdata_env, 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",
  indcovacol = c("prec.04", "prec.05", "prec.06", "prec.07", "prec.08", "prec.09"),
  stageassign = cypframe_fb, stagesize = "sizeadded", NAas0 = TRUE,
  age_offset = 4)

dim(cypfb_env)
#> [1] 320  57
summary(cypfb_env)
#>      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           indcova1     
#>  Min.   : 0.0000   Min.   :0.000000   Min.   :0.0000   Min.   :  0.00  
#>  1st Qu.: 0.0000   1st Qu.:0.000000   1st Qu.:0.0000   1st Qu.: 57.60  
#>  Median : 0.0000   Median :0.000000   Median :0.0000   Median : 92.20  
#>  Mean   : 0.7469   Mean   :0.009375   Mean   :0.2656   Mean   : 70.64  
#>  3rd Qu.: 1.0000   3rd Qu.:0.000000   3rd Qu.:0.0000   3rd Qu.: 96.00  
#>  Max.   :18.0000   Max.   :1.000000   Max.   :7.0000   Max.   :109.80  
#>    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  
#>      sizea2             sizeb2            sizec2         size2added    
#>  Min.   :0.000000   Min.   : 0.0000   Min.   : 0.000   Min.   : 0.000  
#>  1st Qu.:0.000000   1st Qu.: 0.0000   1st Qu.: 1.000   1st Qu.: 1.000  
#>  Median :0.000000   Median : 0.0000   Median : 2.000   Median : 2.000  
#>  Mean   :0.009375   Mean   : 0.8969   Mean   : 2.416   Mean   : 3.322  
#>  3rd Qu.:0.000000   3rd Qu.: 1.0000   3rd Qu.: 3.000   3rd Qu.: 4.000  
#>  Max.   :1.000000   Max.   :18.0000   Max.   :13.000   Max.   :24.000  
#>     repstra2          repstrb2            feca2           indcova2     
#>  Min.   : 0.0000   Min.   :0.000000   Min.   :0.0000   Min.   : 57.60  
#>  1st Qu.: 0.0000   1st Qu.:0.000000   1st Qu.:0.0000   1st Qu.: 92.20  
#>  Median : 0.0000   Median :0.000000   Median :0.0000   Median : 96.00  
#>  Mean   : 0.8969   Mean   :0.009375   Mean   :0.2906   Mean   : 92.77  
#>  3rd Qu.: 1.0000   3rd Qu.:0.000000   3rd Qu.:0.0000   3rd Qu.:109.80  
#>  Max.   :18.0000   Max.   :1.000000   Max.   :7.0000   Max.   :111.90  
#>    juvgiven2   obsstatus2       repstatus2       fecstatus2       matstatus2
#>  Min.   :0   Min.   :0.0000   Min.   :0.0000   Min.   :0.0000   Min.   :1   
#>  1st Qu.:0   1st Qu.:1.0000   1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:1   
#>  Median :0   Median :1.0000   Median :0.0000   Median :0.0000   Median :1   
#>  Mean   :0   Mean   :0.9531   Mean   :0.3688   Mean   :0.1562   Mean   :1   
#>  3rd Qu.:0   3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:0.0000   3rd Qu.:1   
#>  Max.   :0   Max.   :1.0000   Max.   :1.0000   Max.   :1.0000   Max.   :1   
#>      alive2     stage2           stage2index        sizea3        
#>  Min.   :1   Length:320         Min.   : 6.00   Min.   :0.000000  
#>  1st Qu.:1   Class :character   1st Qu.: 7.00   1st Qu.:0.000000  
#>  Median :1   Mode  :character   Median :10.00   Median :0.000000  
#>  Mean   :1                      Mean   :18.17   Mean   :0.009375  
#>  3rd Qu.:1                      3rd Qu.:32.00   3rd Qu.:0.000000  
#>  Max.   :1                      Max.   :54.00   Max.   :1.000000  
#>      sizeb3           sizec3         size3added        repstra3     
#>  Min.   : 0.000   Min.   : 0.000   Min.   : 0.000   Min.   : 0.000  
#>  1st Qu.: 0.000   1st Qu.: 1.000   1st Qu.: 1.000   1st Qu.: 0.000  
#>  Median : 0.000   Median : 1.000   Median : 2.000   Median : 0.000  
#>  Mean   : 1.069   Mean   : 2.209   Mean   : 3.288   Mean   : 1.069  
#>  3rd Qu.: 1.000   3rd Qu.: 3.000   3rd Qu.: 4.000   3rd Qu.: 1.000  
#>  Max.   :18.000   Max.   :13.000   Max.   :24.000   Max.   :18.000  
#>     repstrb3            feca3           indcova3       juvgiven3   obsstatus3 
#>  Min.   :0.000000   Min.   :0.0000   Min.   : 57.6   Min.   :0   Min.   :0.0  
#>  1st Qu.:0.000000   1st Qu.:0.0000   1st Qu.: 96.0   1st Qu.:0   1st Qu.:1.0  
#>  Median :0.000000   Median :0.0000   Median :106.8   Median :0   Median :1.0  
#>  Mean   :0.009375   Mean   :0.4562   Mean   : 96.1   Mean   :0   Mean   :0.9  
#>  3rd Qu.:0.000000   3rd Qu.:0.0000   3rd Qu.:109.8   3rd Qu.:0   3rd Qu.:1.0  
#>  Max.   :1.000000   Max.   :8.0000   Max.   :111.9   Max.   :0   Max.   :1.0  
#>    repstatus3    fecstatus3       matstatus3     alive3      
#>  Min.   :0.0   Min.   :0.0000   Min.   :1    Min.   :0.0000  
#>  1st Qu.:0.0   1st Qu.:0.0000   1st Qu.:1    1st Qu.:1.0000  
#>  Median :0.0   Median :0.0000   Median :1    Median :1.0000  
#>  Mean   :0.4   Mean   :0.2219   Mean   :1    Mean   :0.9469  
#>  3rd Qu.:1.0   3rd Qu.:0.0000   3rd Qu.:1    3rd Qu.:1.0000  
#>  Max.   :1.0   Max.   :1.0000   Max.   :1    Max.   :1.0000  
#>     stage3           stage3index   
#>  Length:320         Min.   : 0.00  
#>  Class :character   1st Qu.: 7.00  
#>  Mode  :character   Median :10.00  
#>                     Mean   :18.57  
#>                     3rd Qu.:33.00  
#>                     Max.   :54.00

Now we have a new version of the standardized dataset that includes the variables indcova1, indcova2, ans indcova3, which correspond to total annual precipitation in times t-1, t, and t+1, respectively.

Step 2d. Provide supplemental information for matrix estimation

The next steps involve adding some external data to parameterize the matrices properly. There are two approaches for this:

1. using the supplemental() function, or

2. creating a reproductive matrix and using the overwrite() function.

We advise the use of the first approach, the supplemental() function, which is more holistic and flexible than the other approach. We will not cover the second approach in this vignette. The supplemental() function provides a means of inputting four kinds of data into MPM construction:

1. fixed transition values derived from other studies and added as constants to matrices,

2. proxy transition values when data for particular transitions does not exist and other, estimable transitions will be used as proxies,

3. multipliers on proxy transition values, for example to set survival transitions to some fraction of the survival transitions estimated for other, particular transitions, and

4. reproductive multipliers to indicate which stages lead to the production of which stages, and at what level relative to estimated fecundity.

We will start off by creating two supplemental tables taking all of these sorts of data for the function-based MPMs. The first is the supplemental 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 16 given transitions (11 for the ahistorical case). The first nine of the historical transitions are set to specific probabilities, and the next five are transitions that will be set to other, estimated transitions (these are the non-NA transitions in eststage set below). The final two terms are fecundity multipliers. 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 supplemental table. We will also introduce a variable representing the number of seeds expected per pod (the term ‘pod’ refers to the fruits that orchids make). 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_pod <- 5000

cypsupp3_fb <- supplemental(stage3 = c("SD", "SD", "P1", "P1", "P2", "P3", "SL",
    "SL", "SL", "D", "V1", "D", "V1", "V2", "SD", "P1"), 
  stage2 = c("SD", "SD", "SD", "SD", "P1", "P2", "P3", "SL", "SL", "SL", "SL", 
    "SL", "SL", "SL", "rep", "rep"), 
  stage1 = c("SD", "rep", "SD", "rep", "SD", "P1", "P2", "P3", "SL", "P3", "P3",
    "SL", "SL", "SL", "mat", "mat"), 
  eststage3 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, "D", "V1", "D", "V1",
    "V2", NA, NA), 
  eststage2 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, "D", "D", "D", "D", 
    "D", NA, NA), 
  eststage1 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, "D", "D", "D", "D", 
    "D", NA, NA), 
  givenrate = c(0.01, 0.05, 0.10, 0.20, 0.1, 0.1, 0.05, 0.05, 0.05, NA, NA, NA,
    NA, NA, NA, NA),
  multiplier = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
    (0.5 * seeds_per_pod), (0.5 * seeds_per_pod)),
  type = c("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"), stageframe = cypframe_fb)

cypsupp3_fb
#>    stage3 stage2 stage1 eststage3 eststage2 eststage1 givenrate multiplier
#> 1      SD     SD     SD      <NA>      <NA>      <NA>      0.01          1
#> 2      SD     SD    rep      <NA>      <NA>      <NA>      0.05          1
#> 3      P1     SD     SD      <NA>      <NA>      <NA>      0.10          1
#> 4      P1     SD    rep      <NA>      <NA>      <NA>      0.20          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.05          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      D     SL     SL         D         D         D        NA          1
#> 13     V1     SL     SL        V1         D         D        NA          1
#> 14     V2     SL     SL        V2         D         D        NA          1
#> 15     SD    rep    mat      <NA>      <NA>      <NA>        NA       2500
#> 16     P1    rep    mat      <NA>      <NA>      <NA>        NA       2500
#>    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        3            1
#> 16        3            1

Now we can input the ahistorical table.

cypsupp2_fb <- supplemental(stage3 = c("SD", "P1", "P2", "P3", "SL", "SL", "D",
    "V1", "V2", "SD", "P1"), 
  stage2 = c("SD", "SD", "P1", "P2", "P3", "SL", "SL", "SL", "SL", "rep",
    "rep"), 
  eststage3 = c(NA, NA, NA, NA, NA, NA, "D", "V1", "V2", NA, NA), 
  eststage2 = c(NA, NA, NA, NA, NA, NA, "D", "D", "D", NA, NA), 
  givenrate = c(0.03, 0.15, 0.1, 0.1, 0.1, 0.05, NA, NA, NA, NA, NA), 
  multiplier = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, (0.5* seeds_per_pod),
    (0.5 * seeds_per_pod)),
  type = c("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.03          1
#> 2      P1     SD   <NA>      <NA>      <NA>      <NA>      0.15          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.10          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     SD    rep   <NA>      <NA>      <NA>      <NA>        NA       2500
#> 11     P1    rep   <NA>      <NA>      <NA>      <NA>        NA       2500
#>    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

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

cypsupp3_raw <- supplemental(stage3 = c("SD", "SD", "P1", "P1", "P2", "P3",
    "SL", "SL", "SL", "D", "D", "SD", "P1"),
  stage2 = c("SD", "SD", "SD", "SD", "P1", "P2", "P3", "SL", "SL", "SL", "SL",
    "rep", "rep"),
  stage1 = c("SD", "rep", "SD", "rep", "SD", "P1", "P2", "P3", "SL", "P3",
    "SL", "mat", "mat"),
  eststage3 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, "XSm", "D", NA, NA),
  eststage2 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, "XSm", "XSm", NA, NA),
  eststage1 = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, "XSm", "XSm", NA, NA),
  givenrate = c(0.01, 0.05, 0.10, 0.20, 0.1, 0.1, 0.05, 0.05, 0.05, NA, NA,
    NA, NA),
  multiplier = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
    (0.5 * seeds_per_pod), (0.5 * seeds_per_pod)),
  type = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3),
  type_t12 = c(1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1),
  stageframe = cypframe_raw, historical = TRUE)

cypsupp2_raw <- supplemental(stage3 = c("SD", "P1", "P2", "P3", "SL", "SL", "D", 
    "XSm", "SD", "P1"),
  stage2 = c("SD", "SD", "P1", "P2", "P3", "SL", "SL", "SL", "rep", "rep"),
  eststage3 = c(NA, NA, NA, NA, NA, NA, "D", "XSm", NA, NA),
  eststage2 = c(NA, NA, NA, NA, NA, NA, "XSm", "XSm", NA, NA),
  givenrate = c(0.03, 0.15, 0.1, 0.1, 0.1, 0.05, NA, NA, NA, NA),
  multiplier = c(NA, NA, NA, NA, NA, NA, NA, NA, (0.5 * seeds_per_pod),
    (0.5 * seeds_per_pod)),
  type =c(1, 1, 1, 1, 1, 1, 1, 1, 3, 3),
  stageframe = cypframe_raw, historical = FALSE)

cypsupp3_raw
#>    stage3 stage2 stage1 eststage3 eststage2 eststage1 givenrate multiplier
#> 1      SD     SD     SD      <NA>      <NA>      <NA>      0.01          1
#> 2      SD     SD    rep      <NA>      <NA>      <NA>      0.05          1
#> 3      P1     SD     SD      <NA>      <NA>      <NA>      0.10          1
#> 4      P1     SD    rep      <NA>      <NA>      <NA>      0.20          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.05          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       XSm       XSm       XSm        NA          1
#> 11      D     SL     SL         D       XSm       XSm        NA          1
#> 12     SD    rep    mat      <NA>      <NA>      <NA>        NA       2500
#> 13     P1    rep    mat      <NA>      <NA>      <NA>        NA       2500
#>    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        3            1
#> 13        3            1

cypsupp2_raw
#>    stage3 stage2 stage1 eststage3 eststage2 eststage1 givenrate multiplier
#> 1      SD     SD   <NA>      <NA>      <NA>      <NA>      0.03          1
#> 2      P1     SD   <NA>      <NA>      <NA>      <NA>      0.15          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.10          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      SD    rep   <NA>      <NA>      <NA>      <NA>        NA       2500
#> 10     P1    rep   <NA>      <NA>      <NA>      <NA>        NA       2500
#>    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         3            1
#> 10        3            1

Together with a properly defined stageframe, the supplement table provides a powerful means of providing rules for matrix construction. For example, if users have groups of stages within their life history model, and need to exclude the possibility of transitions moving in a specific direction between groups, then this can be set using the groups variable in the stageframe and then using the group option in function supplemental() to set those transitions to 0.0. Please see Chapter 2 and Chapter 5 of lefko3: a gentle introduction for further details.

Let’s now move on to tests of individual history and the parameterization of vital rate models for our function-based MPMs.

Step 3. Tests of history

Matrix creation can proceed either as raw (i.e. empirical) matrix creation, as initially outlined in Ehrlén (2000), or via the creation of function-based matrices, in many ways equivalent to complex integral projection models per Ellner and Rees (2006) and as further described in the non-Gaussian case in Shefferson, Warren II, and Pulliam (2014). The function-based approach requires the development of vital rate models, and these vital rate models serve not only to parameterize these matrices but also to allow us to test whether history is important to population dynamics in our study system. The importance of other factors, such as size, reproductive history, and age, can also be tested. We will proceed by developing vital rate models that test for history, and use these both to understand the overall demography of the system and to parameterize our function-based MPMs.

Prior to vital rate estimation, a number of key decisions need to be made regarding the assumptions underlying the vital rates, and their relationships with the factors under investigation. These decisions include the general modeling strategy, and the size and fecundity distributions.

Step 3a. General modeling strategy

Most function-based matrices, whether integral projection models or otherwise, are developed using either a generalized linear modeling (GLM) strategy, or a generalized linear mixed modeling (GLMM) strategy. The former is more common and is simpler, but the latter is more theoretically sound because it provides a means of correcting the lack of independence inherent in datasets incorporating repeated sampling of the same individuals. The difference between the two with regards to vital rate modeling is strongly related to assumptions regarding the individual and spatiotemporal variation in vital rates.

In both GLM and GLMM-based MPMs, the underlying dataset utilized is a vertical dataset. Each row of data gives the state of the individual in either two consecutive occasions (the ahistorical case), or three consecutive occasions (the historical case). Under a GLM framework, time in occasion t is a fixed categorical variable, and individual identity is ignored. Treating time as fixed implies that the actual monitoring occasions are the only times for which inference is sought. Thus, if time is treated as fixed, then it would not be correct to infer future population dynamics after 2009 for a dataset collected between 2004 and 2009. Ignoring individual identity treats all transitions as independent, even though data originating from the same sampled individual is clearly not independent of that individual’s previous transitions. This may be interpreted as a form of pseudoreplication because strongly related data is used to create matrices that are assumed to be statistically independent. This might impact demographic modeling by inflating Type 1 error in the linear modeling, yielding more significant terms in the chosen best-fit model and causing the retention of more terms than is warranted.

Under a GLMM (generalized linear mixed model) framework, both time and individual identity can be treated as random categorical terms. This has two major implications. First, both time and individual can be assumed to be random samples from a broader population of times and individuals for which inference is sought. Thus, sampled monitoring occasions represent a greater universe of years for which inference can be made, and so their associated coefficients can be assumed to come from a normal distribution with \(mean = 0\). Second, treating individual as a random categorical term eliminates the pseudoreplication that is inherent in the GLM approach to vital rate estimation when individuals are monitored potentially many times, because each individual is assumed to be randomly drawn and associated with its own response distribution. Subpopulations may also be considered random, in which case they are assumed to have been sampled from all possible spaces that the species might occupy. We encourage researchers to use the GLMM approach in their demographic work, but we have also included easy-to-use GLM functionality, since many will find the GLM approach particularly useful in cases where mixed modeling breaks down.

Step 3b. Size and fecundity distributions

Once a general approach is decided upon, the next step is to choose the underlying distributions. The probabilities of survival, observation, and reproductive status are automatically set to the binomial distribution, and this cannot be altered. However, the probability of size transition and the fecundity rate can be set to the Gaussian, gamma, Poisson, or negative binomial distributions, with zero-inflated and zero-truncated versions of the Poisson and negative binomial also available. If size or fecundity rate is a continuous variable (i.e., not an integer or count variable), then it should typically be set to the Gaussian distribution unless it has no zeros and appears dramatically right-skewed. However, if size or fecundity is a count variable, then it should be set to the Poisson distribution if the mean equals the variance. The negative binomial distribution is provided in cases where the assumption that the mean equals the variance is clearly broken. We do not encourage the use of the negative binomial except in such cases, as the extra parameters estimated for the negative binomial distribution reduce the power of the modeling exercises conducted.

The Poisson and the negative binomial distributions both predict specific numbers of zeros in the response variable. If excess zeros occur within the dataset, then a zero-inflated Poisson or negative binomial distribution may be used. These modeling approaches work by parameterizing a binomial model, typically with a logit link, to predict zero responses. The Poisson or negative binomial is then used to predict non-zero responses. This conditional model ends up really acting as two separate models in which zeros are assumed to be predicted under potentially different processes than the remaining counts. Users should be aware that, because an extra model is built to cover zeros, zero-inflated models are much more complex and can include many more parameters than their non-inflated counterparts. The principle of parsimony suggests that they should only be used when there are significantly more zeros than expected.

Cases may arise in which zeros do not exist in either size or fecundity. For these situations, we provide zero-truncated distributions. This may occur in size if all cases of size = 0 are absorbed by observation status, leaving only positive integers for the size of observed individuals. For example, if an unobservable stage such as vegetative dormancy occurs and absorbs all cases of size = 0, then a zero-truncated Poisson or negative binomial distribution will be more appropriate than the equivalent distribution without zero-truncation. It can also occur if all cases of fecundity = 0 are absorbed by reproductive status. Such distributions only involve the estimation of single, conditional models, and so are simpler than zero-inflated models.

Package lefko3 includes a function that can help in determining which distributions to use: sf_distrib(). Here, we use it to determine that we should use the zero-truncated negative binomial for size, and the zero-inflated Poisson for fecundity:

sf_distrib(cypfb_env, sizea = c("size3added", "size2added"), obs3 = "obsstatus3",
  fec = c("feca3", "feca2"), repst = c("repstatus3", "repstatus2"),
  zisizea = FALSE)
#> Mean sizea is 3.653
#> 
#> The variance in sizea is 13.41
#> 
#> The probability of this dispersion level by chance assuming that
#> the true mean sizea = variance in sizea,
#> and an alternative hypothesis of overdispersion, is 3.721e-138
#> 
#> Primary size is significantly overdispersed.
#> 
#> Mean fec is 0.8036
#> 
#> The variance in fec is 1.601
#> 
#> The probability of this dispersion level by chance assuming that
#> the true mean fec = variance in fec,
#> and an alternative hypothesis of overdispersion, is 0.07088
#> 
#> Dispersion level in fecundity matches expectation.
#> 
#> 
#> Mean lambda in fec is 0.4477
#> The actual number of 0s in fec is 65
#> The expected number of 0s in fec under the null hypothesis is 50.15
#> The probability of this deviation in 0s from expectation by chance is 1.742e-06
#> 
#> Fecundity is significantly zero-inflated.

Step 3c. Model building and selection

In lefko3, the modelsearch function is the workhorse that conducts vital rate model estimation. Here, we will create a full suite of vital rate models for the Cypripedium candidum dataset. Before proceeding, we need to decide on the linear model building strategy, the correct vital rates to model, the proper statistical distributions for estimated vital rates, the proper parameterizations for each vital rate, and the strategy for determination of the best-fit models.

First, we must determine the model building strategy. In most cases, the best procedure will be through mixed linear models in which monitoring occasion and individual identity are random terms. We will set monitoring occasion as random because we wish to make inferences for the population as a whole and do not wish to restrict ourselves to inference only for the years monitored (i.e. our distribution of monitoring occasions sampled is itself a sample of the population in time). We will set individual identity as random because many or most of the individuals that we have sampled to produce our dataset yield multiple observation data points across time. Thus, we will set approach = "mixed". To make sure that time and individual identity are treated as random, we will set the proper variable names for indiv and year, corresponding to individual identity (individ by default), and to occasion t (year2 by default). The year.as.random option is set to random by default, and leaving it this way also means that R will randomly draw coefficient values for years with inestimable coefficients. Setting year.as.random to FALSE would make time a fixed categorical variable.

The mixed modeling approach is usually preferable to the GLM approach. However, a mixed modeling strategy results in lower statistical power and a greater time used in estimating models (or, conversely, it yields truer statistical power while the GLM approach inflates Type I error). Users of package lefko3 wishing to use a standard generalized linear modeling strategy can set approach = "glm". In this case, individual identity is not used, time is a fixed categorical factor, and all observed transitions are treated as independent.

Next, we must determine which vital rates to model. Function modelsearch() estimates up to 14 vital rate models:

1. survival probability from occasion t to occasion t+1,

2. observation probability in occasion t+1 assuming survival until that time,

3. primary size in occasion t+1 assuming survival and observation in that time,

4. secondary size in occasion t+1 assuming survival and observation in that time,

5. tertiary size in occasion t+1 assuming survival and observation in that time,

6. reproduction status in occasion t+1 assuming survival and observation until that time,

7. fecundity rate assuming survival until and observation and reproduction in the occasion of production of offspring (occasion t or t+1; mature only),

8. juvenile survival probability from occasion t to occasion t+1,

9. juvenile observation probability in occasion t+1 assuming survival until that time,

10. juvenile primary size in occasion t+1 assuming survival and observation in that time,

11. juvenile secondary size in occasion t+1 assuming survival and observation in that time,

12. juvenile tertiary size in occasion t+1 assuming survival and observation in that time,

13. juvenile transition probability to reproductive status in occasion t+1 assuming survival and observation until that time of a juvenile in occasion t that is becoming mature in occasion t+1, and

14. juvenile transition probability to maturity in occasion t+1 assuming survival until that time of a juvenile in occasion t.

The default settings for modelsearch estimate 1) survival probability, 3) primary size distribution, and 7) fecundity, which are the minimum three vital rates required for a full MPM or IPM. Observation probability (option obs in vitalrates) should only be included when a life history stage or size exists that cannot be observed. For example, in the case of a plant with vegetative dormancy, the observation probability can be thought of as the sprouting probability, which is a biologically meaningful vital rate (Shefferson et al. 2001). Further, reproduction status (option repst in vitalrates) should only be modeled if size classification needs to be stratified by the ability to reproduce, as when zero fecundity occurs within stages that also produce offspring. Juvenile stages should only be used when juveniles exist as a single stage that should not be size-classified. Otherwise, juvenile stages should be treated as normal stages (transitions back to juvenile stages can be prevented later). Since Cypripedium candidum is capable of long bouts of vegetative dormancy, since we wish to stratify the population into reproductive and non-reproductive stages of the same size classes, and since we have no data derived from juvenile individuals, we will set vitalrates = c("surv", "obs", "size", "repst", "fec").

Third, we need to set the proper statistical distribution for each parameter. Survival probability, observation probability, and reproductive status are all modeled as binomial variables, and this cannot be changed. In the case of this population of Cypripedium candidum, size was measured as the number of stems and so is a count variable. Likewise, fecundity is actually estimated as the number of fruits produced per plant, and so is also a count variable. We have already performed tests for overdispersion and zero-inflation, and we are also aware that size in observed stages cannot be zero, requiring zero truncation in that parameter. So we will set size to the zero-truncated negative binomial distribution, and fecundity to the zero-inflated Poisson distribution.

Fourth, we need the proper model parameterizations for each vital rate, using the suite option. The default, suite = "main", under the mixed model setting (approach = "mixed") starts with the estimation of global models that include size and reproductive status in occasions t and t-1 as fixed factors, with individual identity and time in occasion t (year t) set as random categorical terms. Other terms can be specified, including individual covariates and age. Setting suite = "full" will yield global models that also include all two-way interactions. The global model under suite = "full" then includes all fixed factors noted before, plus time in occasion t and all two-way interactions between fixed factors (“full” is the only setting with interaction terms). If the population is not stratified by reproductive status, then suite = "size" will eliminate reproductive status terms and use all others in the global model. If size is not important, then suite = "rep" will eliminate size but keep reproductive status and all other terms. Finally, suite = "cons" will result in a global model in which neither reproductive status nor size are considered (although other terms, such as individual covariates and age, can still be included in the last case).

Finally, we need to determine the proper strategy for the determination of the best-fit model. Model building proceeds through the dredge function in package MuMIn (Bartoń 2014), and each model has an associated AICc value. The default setting in lefko3 (bestfit = "AICc&k") will compare all models within 2.0 AICc units of the model with \(\Delta AICc = 0\), and choose the one with the lowest degrees of freedom. This approach is generally better than the alternative, which simply uses the model with \(\Delta AICc = 0\) (bestfit = "AICc"), as all models within 2.0 AICc units of that model are equally parsimonious and so fewer degrees of freedom result from fewer parameters estimated (Burnham and Anderson 2002).

In the model building exercise below, we will use the suite = "main" option to run all main effects only. Normally we would set to suite = "full", but running all effects including their two-way interactions will likely tie up our computers for a few too many minutes. Once done, we can summarize the output with the summary() function.

cypmodels3p <- modelsearch(cypfb_env, historical = TRUE, approach = "mixed", 
  vitalrates = c("surv", "obs", "size", "repst", "fec"), patch = "patchid",
  sizedist = "negbin", size.trunc = TRUE, fecdist = "poisson", fec.zero = TRUE,
  suite = "main", size = c("size3added", "size2added", "size1added"),
  quiet = TRUE)
summary(cypmodels3p)
#> This LefkoMod object includes 5 linear models.
#> Best-fit model criterion used: aicc&k
#> 
#> 
#> 
#> Survival model:
#> Generalized linear mixed model fit by maximum likelihood (Laplace
#>   Approximation) [glmerMod]
#>  Family: binomial  ( logit )
#> Formula: alive3 ~ size2added + (1 | year2) + (1 | patchid) + (1 | individ)
#>    Data: subdata
#>      AIC      BIC   logLik deviance df.resid 
#> 130.1321 148.9737 -60.0660 120.1321      315 
#> Random effects:
#>  Groups  Name        Std.Dev. 
#>  individ (Intercept) 1.199e+00
#>  year2   (Intercept) 5.161e-05
#>  patchid (Intercept) 1.113e-05
#> Number of obs: 320, groups:  individ, 74; year2, 5; patchid, 3
#> Fixed Effects:
#> (Intercept)   size2added  
#>      2.0356       0.6343  
#> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
#> 
#> 
#> 
#> Observation model:
#> Generalized linear mixed model fit by maximum likelihood (Laplace
#>   Approximation) [glmerMod]
#>  Family: binomial  ( logit )
#> Formula: obsstatus3 ~ size2added + (1 | year2) + (1 | patchid) + (1 |  
#>     individ)
#>    Data: subdata
#>      AIC      BIC   logLik deviance df.resid 
#> 120.2567 138.8254 -55.1284 110.2567      298 
#> Random effects:
#>  Groups  Name        Std.Dev.
#>  individ (Intercept) 0.0000  
#>  year2   (Intercept) 0.8776  
#>  patchid (Intercept) 0.0000  
#> Number of obs: 303, groups:  individ, 70; year2, 5; patchid, 3
#> Fixed Effects:
#> (Intercept)   size2added  
#>      2.4904       0.3134  
#> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
#> 
#> 
#> 
#> Size model:
#> Formula:          size3added ~ size2added + (1 | year2) + (1 | patchid) + (1 |  
#>     individ)
#> Data: subdata
#>       AIC       BIC    logLik  df.resid 
#> 1009.3168 1031.2946 -498.6584       282 
#> Random-effects (co)variances:
#> 
#> Conditional model:
#>  Groups  Name        Std.Dev.
#>  year2   (Intercept) 0.1215  
#>  patchid (Intercept) 0.2052  
#>  individ (Intercept) 0.9497  
#> 
#> Number of obs: 288 / Conditional model: year2, 5; patchid, 3; individ, 70
#> 
#> Dispersion parameter for truncated_nbinom2 family (): 1.23e+09 
#> 
#> Fixed Effects:
#> 
#> Conditional model:
#> (Intercept)   size2added  
#>     0.54038      0.02191  
#> 
#> 
#> 
#> Secondary size model:
#> [1] 1
#> 
#> 
#> 
#> Tertiary size model:
#> [1] 1
#> 
#> 
#> 
#> Reproductive status model:
#> Generalized linear mixed model fit by maximum likelihood (Laplace
#>   Approximation) [glmerMod]
#>  Family: binomial  ( logit )
#> Formula: repstatus3 ~ repstatus2 + size2added + (1 | year2) + (1 | patchid) +  
#>     (1 | individ)
#>    Data: subdata
#>       AIC       BIC    logLik  deviance  df.resid 
#>  333.4037  355.3815 -160.7019  321.4037       282 
#> Random effects:
#>  Groups  Name        Std.Dev.
#>  individ (Intercept) 0.1776  
#>  year2   (Intercept) 0.6636  
#>  patchid (Intercept) 0.3501  
#> Number of obs: 288, groups:  individ, 70; year2, 5; patchid, 3
#> Fixed Effects:
#> (Intercept)   repstatus2   size2added  
#>     -1.3836       1.5543       0.1788  
#> 
#> 
#> 
#> Fecundity model:
#> Formula:          
#> feca2 ~ size1added + size2added + (1 | year2) + (1 | patchid) +  
#>     (1 | individ)
#> Zero inflation:         
#> ~size2added + (1 | year2) + (1 | patchid) + (1 | individ)
#> Data: subdata
#>       AIC       BIC    logLik  df.resid 
#>  252.3835  282.8610 -115.1917       107 
#> Random-effects (co)variances:
#> 
#> Conditional model:
#>  Groups  Name        Std.Dev. 
#>  year2   (Intercept) 6.043e-01
#>  patchid (Intercept) 2.130e-01
#>  individ (Intercept) 5.213e-10
#> 
#> Zero-inflation model:
#>  Groups  Name        Std.Dev. 
#>  year2   (Intercept) 4.136e-12
#>  patchid (Intercept) 1.460e-13
#>  individ (Intercept) 2.951e-04
#> 
#> Number of obs: 118 / Conditional model: year2, 5; patchid, 3; individ, 51 / Zero-inflation model: year2, 5; patchid, 3; individ, 51
#> 
#> Fixed Effects:
#> 
#> Conditional model:
#> (Intercept)   size1added   size2added  
#>    -0.51758     -0.03543      0.08305  
#> 
#> Zero-inflation model:
#> (Intercept)   size2added  
#>       3.857       -1.575  
#> 
#> 
#> Juvenile survival model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile observation model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile size model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile secondary size model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile tertiary size model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile reproduction model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile maturity model:
#> [1] 1
#> 
#> 
#> 
#> 
#> 
#> Number of models in survival table: 16
#> 
#> Number of models in observation table: 16
#> 
#> Number of models in size table: 16
#> 
#> Number of models in secondary size table: 1
#> 
#> Number of models in tertiary size table: 1
#> 
#> Number of models in reproduction status table: 16
#> 
#> Number of models in fecundity table: 240
#> 
#> Number of models in juvenile survival table: 1
#> 
#> Number of models in juvenile observation table: 1
#> 
#> Number of models in juvenile size table: 1
#> 
#> Number of models in juvenile secondary size table: 1
#> 
#> Number of models in juvenile tertiary size table: 1
#> 
#> Number of models in juvenile reproduction table: 1
#> 
#> Number of models in juvenile maturity table: 1
#> 
#> 
#> 
#> 
#> 
#> General model parameter names (column 1), and 
#> specific names used in these models (column 2): 
#>                       parameter_names mainparams
#> 1                              time t      year2
#> 2                          individual    individ
#> 3                               patch      patch
#> 4                   alive in time t+1      surv3
#> 5                observed in time t+1       obs3
#> 6                   sizea in time t+1      size3
#> 7                   sizeb in time t+1     sizeb3
#> 8                   sizec in time t+1     sizec3
#> 9     reproductive status in time t+1     repst3
#> 10              fecundity in time t+1       fec3
#> 11                fecundity in time t       fec2
#> 12                    sizea in time t      size2
#> 13                  sizea in time t-1      size1
#> 14                    sizeb in time t     sizeb2
#> 15                  sizeb in time t-1     sizeb1
#> 16                    sizec in time t     sizec2
#> 17                  sizec in time t-1     sizec1
#> 18      reproductive status in time t     repst2
#> 19    reproductive status in time t-1     repst1
#> 20        maturity status in time t+1     matst3
#> 21          maturity status in time t     matst2
#> 22                      age in time t        age
#> 23                  density in time t    density
#> 24   individual covariate a in time t   indcova2
#> 25 individual covariate a in time t-1   indcova1
#> 26   individual covariate b in time t   indcovb2
#> 27 individual covariate b in time t-1   indcovb1
#> 28   individual covariate c in time t   indcovc2
#> 29 individual covariate c in time t-1   indcovc1
#> 30              stage group in time t     group2
#> 31            stage group in time t-1     group1
#> 
#> 
#> 
#> 
#> 
#> Quality control:
#> 
#> Survival estimated with 74 individuals and 320 individual transitions.
#> Survival accuracy is 0.947.
#> Observation estimated with 70 individuals and 303 individual transitions.
#> Observation accuracy is 0.95.
#> Primary size estimated with 70 individuals and 288 individual transitions.
#> Primary size pseudo R-squared is NA.
#> Secondary size transition not estimated.
#> Tertiary size transition not estimated.
#> Reproductive status estimated with 70 individuals and 288 individual transitions.
#> Reproductive status accuracy is 0.74.
#> Fecundity estimated with 51 individuals and 118 individual transitions.
#> Fecundity pseudo R-squared is 0.344.
#> Juvenile survival not estimated.
#> Juvenile observation probability not estimated.
#> Juvenile primary size transition not estimated.
#> Juvenile secondary size transition not estimated.
#> Juvenile tertiary size transition not estimated.
#> Juvenile reproduction probability not estimated.
#> Juvenile maturity probability not estimated.

We can see that historical size is included in the best-fit fecundity model. This suggests that the historical MPM is the most parsimonious choice. However, in order to compare MPMs for educational purposes, we will also create an ahistorical model set. Note that a vital rate model set that includes historical terms CANNOT be used to make an ahistorical MPM. Here is an ahistorical model set.

cypmodels2p <- modelsearch(cypfb_env, historical = FALSE, approach = "mixed", 
  vitalrates = c("surv", "obs", "size", "repst", "fec"), patch = "patchid",
  sizedist = "negbin", size.trunc = TRUE, fecdist = "poisson", fec.zero = TRUE,
  suite = "main", size = c("size3added", "size2added", "size1added"),
  quiet = TRUE)

summary(cypmodels2p)
#> This LefkoMod object includes 5 linear models.
#> Best-fit model criterion used: aicc&k
#> 
#> 
#> 
#> Survival model:
#> Generalized linear mixed model fit by maximum likelihood (Laplace
#>   Approximation) [glmerMod]
#>  Family: binomial  ( logit )
#> Formula: alive3 ~ size2added + (1 | year2) + (1 | patchid) + (1 | individ)
#>    Data: subdata
#>      AIC      BIC   logLik deviance df.resid 
#> 130.1321 148.9737 -60.0660 120.1321      315 
#> Random effects:
#>  Groups  Name        Std.Dev. 
#>  individ (Intercept) 1.199e+00
#>  year2   (Intercept) 5.161e-05
#>  patchid (Intercept) 1.113e-05
#> Number of obs: 320, groups:  individ, 74; year2, 5; patchid, 3
#> Fixed Effects:
#> (Intercept)   size2added  
#>      2.0356       0.6343  
#> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
#> 
#> 
#> 
#> Observation model:
#> Generalized linear mixed model fit by maximum likelihood (Laplace
#>   Approximation) [glmerMod]
#>  Family: binomial  ( logit )
#> Formula: obsstatus3 ~ size2added + (1 | year2) + (1 | patchid) + (1 |  
#>     individ)
#>    Data: subdata
#>      AIC      BIC   logLik deviance df.resid 
#> 120.2567 138.8254 -55.1284 110.2567      298 
#> Random effects:
#>  Groups  Name        Std.Dev.
#>  individ (Intercept) 0.0000  
#>  year2   (Intercept) 0.8776  
#>  patchid (Intercept) 0.0000  
#> Number of obs: 303, groups:  individ, 70; year2, 5; patchid, 3
#> Fixed Effects:
#> (Intercept)   size2added  
#>      2.4904       0.3134  
#> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
#> 
#> 
#> 
#> Size model:
#> Formula:          size3added ~ size2added + (1 | year2) + (1 | patchid) + (1 |  
#>     individ)
#> Data: subdata
#>       AIC       BIC    logLik  df.resid 
#> 1009.3168 1031.2946 -498.6584       282 
#> Random-effects (co)variances:
#> 
#> Conditional model:
#>  Groups  Name        Std.Dev.
#>  year2   (Intercept) 0.1215  
#>  patchid (Intercept) 0.2052  
#>  individ (Intercept) 0.9497  
#> 
#> Number of obs: 288 / Conditional model: year2, 5; patchid, 3; individ, 70
#> 
#> Dispersion parameter for truncated_nbinom2 family (): 1.23e+09 
#> 
#> Fixed Effects:
#> 
#> Conditional model:
#> (Intercept)   size2added  
#>     0.54038      0.02191  
#> 
#> 
#> 
#> Secondary size model:
#> [1] 1
#> 
#> 
#> 
#> Tertiary size model:
#> [1] 1
#> 
#> 
#> 
#> Reproductive status model:
#> Generalized linear mixed model fit by maximum likelihood (Laplace
#>   Approximation) [glmerMod]
#>  Family: binomial  ( logit )
#> Formula: repstatus3 ~ repstatus2 + size2added + (1 | year2) + (1 | patchid) +  
#>     (1 | individ)
#>    Data: subdata
#>       AIC       BIC    logLik  deviance  df.resid 
#>  333.4037  355.3815 -160.7019  321.4037       282 
#> Random effects:
#>  Groups  Name        Std.Dev.
#>  individ (Intercept) 0.1776  
#>  year2   (Intercept) 0.6636  
#>  patchid (Intercept) 0.3501  
#> Number of obs: 288, groups:  individ, 70; year2, 5; patchid, 3
#> Fixed Effects:
#> (Intercept)   repstatus2   size2added  
#>     -1.3836       1.5543       0.1788  
#> 
#> 
#> 
#> Fecundity model:
#> Formula:          feca2 ~ (1 | year2) + (1 | patchid) + (1 | individ)
#> Zero inflation:         
#> ~size2added + (1 | year2) + (1 | patchid) + (1 | individ)
#> Data: subdata
#>       AIC       BIC    logLik  df.resid 
#>  256.6460  281.5822 -119.3230       109 
#> Random-effects (co)variances:
#> 
#> Conditional model:
#>  Groups  Name        Std.Dev.
#>  year2   (Intercept) 0.5908  
#>  patchid (Intercept) 0.1970  
#>  individ (Intercept) 0.3863  
#> 
#> Zero-inflation model:
#>  Groups  Name        Std.Dev. 
#>  year2   (Intercept) 2.458e-08
#>  patchid (Intercept) 3.189e-07
#>  individ (Intercept) 2.445e-04
#> 
#> Number of obs: 118 / Conditional model: year2, 5; patchid, 3; individ, 51 / Zero-inflation model: year2, 5; patchid, 3; individ, 51
#> 
#> Fixed Effects:
#> 
#> Conditional model:
#> (Intercept)  
#>     -0.2146  
#> 
#> Zero-inflation model:
#> (Intercept)   size2added  
#>       4.081       -1.597  
#> 
#> 
#> Juvenile survival model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile observation model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile size model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile secondary size model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile tertiary size model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile reproduction model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile maturity model:
#> [1] 1
#> 
#> 
#> 
#> 
#> 
#> Number of models in survival table: 4
#> 
#> Number of models in observation table: 4
#> 
#> Number of models in size table: 4
#> 
#> Number of models in secondary size table: 1
#> 
#> Number of models in tertiary size table: 1
#> 
#> Number of models in reproduction status table: 4
#> 
#> Number of models in fecundity table: 13
#> 
#> Number of models in juvenile survival table: 1
#> 
#> Number of models in juvenile observation table: 1
#> 
#> Number of models in juvenile size table: 1
#> 
#> Number of models in juvenile secondary size table: 1
#> 
#> Number of models in juvenile tertiary size table: 1
#> 
#> Number of models in juvenile reproduction table: 1
#> 
#> Number of models in juvenile maturity table: 1
#> 
#> 
#> 
#> 
#> 
#> General model parameter names (column 1), and 
#> specific names used in these models (column 2): 
#>                       parameter_names mainparams
#> 1                              time t      year2
#> 2                          individual    individ
#> 3                               patch      patch
#> 4                   alive in time t+1      surv3
#> 5                observed in time t+1       obs3
#> 6                   sizea in time t+1      size3
#> 7                   sizeb in time t+1     sizeb3
#> 8                   sizec in time t+1     sizec3
#> 9     reproductive status in time t+1     repst3
#> 10              fecundity in time t+1       fec3
#> 11                fecundity in time t       fec2
#> 12                    sizea in time t      size2
#> 13                  sizea in time t-1      size1
#> 14                    sizeb in time t     sizeb2
#> 15                  sizeb in time t-1     sizeb1
#> 16                    sizec in time t     sizec2
#> 17                  sizec in time t-1     sizec1
#> 18      reproductive status in time t     repst2
#> 19    reproductive status in time t-1     repst1
#> 20        maturity status in time t+1     matst3
#> 21          maturity status in time t     matst2
#> 22                      age in time t        age
#> 23                  density in time t    density
#> 24   individual covariate a in time t   indcova2
#> 25 individual covariate a in time t-1   indcova1
#> 26   individual covariate b in time t   indcovb2
#> 27 individual covariate b in time t-1   indcovb1
#> 28   individual covariate c in time t   indcovc2
#> 29 individual covariate c in time t-1   indcovc1
#> 30              stage group in time t     group2
#> 31            stage group in time t-1     group1
#> 
#> 
#> 
#> 
#> 
#> Quality control:
#> 
#> Survival estimated with 74 individuals and 320 individual transitions.
#> Survival accuracy is 0.947.
#> Observation estimated with 70 individuals and 303 individual transitions.
#> Observation accuracy is 0.95.
#> Primary size estimated with 70 individuals and 288 individual transitions.
#> Primary size pseudo R-squared is NA.
#> Secondary size transition not estimated.
#> Tertiary size transition not estimated.
#> Reproductive status estimated with 70 individuals and 288 individual transitions.
#> Reproductive status accuracy is 0.74.
#> Fecundity estimated with 51 individuals and 118 individual transitions.
#> Fecundity pseudo R-squared is 0.362.
#> Juvenile survival not estimated.
#> Juvenile observation probability not estimated.
#> Juvenile primary size transition not estimated.
#> Juvenile secondary size transition not estimated.
#> Juvenile tertiary size transition not estimated.
#> Juvenile reproduction probability not estimated.
#> Juvenile maturity probability not estimated.

In the preceding vital rate model sets, we created best-fit models that necessarily included a patch term. This will result necessarily in the creation of matrices at the patch level. To create matrices for the population level only, we remove the patch option from the preceding function calls, as below.

cypmodels3 <- modelsearch(cypfb_env, historical = TRUE, approach = "mixed", 
  vitalrates = c("surv", "obs", "size", "repst", "fec"),
  sizedist = "negbin", size.trunc = TRUE, fecdist = "poisson", fec.zero = TRUE,
  suite = "main", size = c("size3added", "size2added", "size1added"),
  quiet = TRUE)

cypmodels2 <- modelsearch(cypfb_env, historical = FALSE, approach = "mixed", 
  vitalrates = c("surv", "obs", "size", "repst", "fec"),
  sizedist = "negbin", size.trunc = TRUE, fecdist = "poisson", fec.zero = TRUE,
  suite = "main", size = c("size3added", "size2added"),
  quiet = TRUE)

summary(cypmodels3)
#> This LefkoMod object includes 5 linear models.
#> Best-fit model criterion used: aicc&k
#> 
#> 
#> 
#> Survival model:
#> Generalized linear mixed model fit by maximum likelihood (Laplace
#>   Approximation) [glmerMod]
#>  Family: binomial  ( logit )
#> Formula: alive3 ~ size2added + (1 | year2) + (1 | individ)
#>    Data: subdata
#>      AIC      BIC   logLik deviance df.resid 
#> 128.1324 143.2057 -60.0662 120.1324      316 
#> Random effects:
#>  Groups  Name        Std.Dev.
#>  individ (Intercept) 1.198361
#>  year2   (Intercept) 0.008826
#> Number of obs: 320, groups:  individ, 74; year2, 5
#> Fixed Effects:
#> (Intercept)   size2added  
#>      2.0352       0.6344  
#> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
#> 
#> 
#> 
#> Observation model:
#> Generalized linear mixed model fit by maximum likelihood (Laplace
#>   Approximation) [glmerMod]
#>  Family: binomial  ( logit )
#> Formula: obsstatus3 ~ size2added + (1 | year2) + (1 | individ)
#>    Data: subdata
#>      AIC      BIC   logLik deviance df.resid 
#> 118.2567 133.1117 -55.1284 110.2567      299 
#> Random effects:
#>  Groups  Name        Std.Dev. 
#>  individ (Intercept) 1.078e-05
#>  year2   (Intercept) 8.776e-01
#> Number of obs: 303, groups:  individ, 70; year2, 5
#> Fixed Effects:
#> (Intercept)   size2added  
#>      2.4904       0.3134  
#> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
#> 
#> 
#> 
#> Size model:
#> Formula:          size3added ~ (1 | year2) + (1 | individ)
#> Data: subdata
#>       AIC       BIC    logLik  df.resid 
#> 1008.2748 1022.9266 -500.1374       284 
#> Random-effects (co)variances:
#> 
#> Conditional model:
#>  Groups  Name        Std.Dev.
#>  year2   (Intercept) 0.1109  
#>  individ (Intercept) 1.0562  
#> 
#> Number of obs: 288 / Conditional model: year2, 5; individ, 70
#> 
#> Dispersion parameter for truncated_nbinom2 family (): 9.81e+08 
#> 
#> Fixed Effects:
#> 
#> Conditional model:
#> (Intercept)  
#>       0.576  
#> 
#> 
#> 
#> Secondary size model:
#> [1] 1
#> 
#> 
#> 
#> Tertiary size model:
#> [1] 1
#> 
#> 
#> 
#> Reproductive status model:
#> Generalized linear mixed model fit by maximum likelihood (Laplace
#>   Approximation) [glmerMod]
#>  Family: binomial  ( logit )
#> Formula: repstatus3 ~ repstatus2 + size2added + (1 | year2) + (1 | individ)
#>    Data: subdata
#>       AIC       BIC    logLik  deviance  df.resid 
#>  333.6176  351.9324 -161.8088  323.6176       283 
#> Random effects:
#>  Groups  Name        Std.Dev.
#>  individ (Intercept) 0.1829  
#>  year2   (Intercept) 0.6250  
#> Number of obs: 288, groups:  individ, 70; year2, 5
#> Fixed Effects:
#> (Intercept)   repstatus2   size2added  
#>     -1.4630       1.6457       0.1715  
#> 
#> 
#> 
#> Fecundity model:
#> Formula:          feca2 ~ size2added + (1 | year2) + (1 | individ)
#> Zero inflation:         ~size2added + (1 | year2) + (1 | individ)
#> Data: subdata
#>       AIC       BIC    logLik  df.resid 
#>  248.8609  271.0264 -116.4305       110 
#> Random-effects (co)variances:
#> 
#> Conditional model:
#>  Groups  Name        Std.Dev.
#>  year2   (Intercept) 0.5760  
#>  individ (Intercept) 0.1639  
#> 
#> Zero-inflation model:
#>  Groups  Name        Std.Dev. 
#>  year2   (Intercept) 1.642e-06
#>  individ (Intercept) 3.089e-04
#> 
#> Number of obs: 118 / Conditional model: year2, 5; individ, 51 / Zero-inflation model: year2, 5; individ, 51
#> 
#> Fixed Effects:
#> 
#> Conditional model:
#> (Intercept)   size2added  
#>    -0.54014      0.06174  
#> 
#> Zero-inflation model:
#> (Intercept)   size2added  
#>       3.865       -1.574  
#> 
#> 
#> Juvenile survival model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile observation model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile size model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile secondary size model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile tertiary size model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile reproduction model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile maturity model:
#> [1] 1
#> 
#> 
#> 
#> 
#> 
#> Number of models in survival table: 16
#> 
#> Number of models in observation table: 16
#> 
#> Number of models in size table: 16
#> 
#> Number of models in secondary size table: 1
#> 
#> Number of models in tertiary size table: 1
#> 
#> Number of models in reproduction status table: 16
#> 
#> Number of models in fecundity table: 239
#> 
#> Number of models in juvenile survival table: 1
#> 
#> Number of models in juvenile observation table: 1
#> 
#> Number of models in juvenile size table: 1
#> 
#> Number of models in juvenile secondary size table: 1
#> 
#> Number of models in juvenile tertiary size table: 1
#> 
#> Number of models in juvenile reproduction table: 1
#> 
#> Number of models in juvenile maturity table: 1
#> 
#> 
#> 
#> 
#> 
#> General model parameter names (column 1), and 
#> specific names used in these models (column 2): 
#>                       parameter_names mainparams
#> 1                              time t      year2
#> 2                          individual    individ
#> 3                               patch      patch
#> 4                   alive in time t+1      surv3
#> 5                observed in time t+1       obs3
#> 6                   sizea in time t+1      size3
#> 7                   sizeb in time t+1     sizeb3
#> 8                   sizec in time t+1     sizec3
#> 9     reproductive status in time t+1     repst3
#> 10              fecundity in time t+1       fec3
#> 11                fecundity in time t       fec2
#> 12                    sizea in time t      size2
#> 13                  sizea in time t-1      size1
#> 14                    sizeb in time t     sizeb2
#> 15                  sizeb in time t-1     sizeb1
#> 16                    sizec in time t     sizec2
#> 17                  sizec in time t-1     sizec1
#> 18      reproductive status in time t     repst2
#> 19    reproductive status in time t-1     repst1
#> 20        maturity status in time t+1     matst3
#> 21          maturity status in time t     matst2
#> 22                      age in time t        age
#> 23                  density in time t    density
#> 24   individual covariate a in time t   indcova2
#> 25 individual covariate a in time t-1   indcova1
#> 26   individual covariate b in time t   indcovb2
#> 27 individual covariate b in time t-1   indcovb1
#> 28   individual covariate c in time t   indcovc2
#> 29 individual covariate c in time t-1   indcovc1
#> 30              stage group in time t     group2
#> 31            stage group in time t-1     group1
#> 
#> 
#> 
#> 
#> 
#> Quality control:
#> 
#> Survival estimated with 74 individuals and 320 individual transitions.
#> Survival accuracy is 0.947.
#> Observation estimated with 70 individuals and 303 individual transitions.
#> Observation accuracy is 0.95.
#> Primary size estimated with 70 individuals and 288 individual transitions.
#> Primary size pseudo R-squared is 0.
#> Secondary size transition not estimated.
#> Tertiary size transition not estimated.
#> Reproductive status estimated with 70 individuals and 288 individual transitions.
#> Reproductive status accuracy is 0.715.
#> Fecundity estimated with 51 individuals and 118 individual transitions.
#> Fecundity pseudo R-squared is 0.32.
#> Juvenile survival not estimated.
#> Juvenile observation probability not estimated.
#> Juvenile primary size transition not estimated.
#> Juvenile secondary size transition not estimated.
#> Juvenile tertiary size transition not estimated.
#> Juvenile reproduction probability not estimated.
#> Juvenile maturity probability not estimated.
summary(cypmodels2)
#> This LefkoMod object includes 5 linear models.
#> Best-fit model criterion used: aicc&k
#> 
#> 
#> 
#> Survival model:
#> Generalized linear mixed model fit by maximum likelihood (Laplace
#>   Approximation) [glmerMod]
#>  Family: binomial  ( logit )
#> Formula: alive3 ~ size2added + (1 | year2) + (1 | individ)
#>    Data: subdata
#>      AIC      BIC   logLik deviance df.resid 
#> 128.1324 143.2057 -60.0662 120.1324      316 
#> Random effects:
#>  Groups  Name        Std.Dev.
#>  individ (Intercept) 1.198361
#>  year2   (Intercept) 0.008826
#> Number of obs: 320, groups:  individ, 74; year2, 5
#> Fixed Effects:
#> (Intercept)   size2added  
#>      2.0352       0.6344  
#> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
#> 
#> 
#> 
#> Observation model:
#> Generalized linear mixed model fit by maximum likelihood (Laplace
#>   Approximation) [glmerMod]
#>  Family: binomial  ( logit )
#> Formula: obsstatus3 ~ size2added + (1 | year2) + (1 | individ)
#>    Data: subdata
#>      AIC      BIC   logLik deviance df.resid 
#> 118.2567 133.1117 -55.1284 110.2567      299 
#> Random effects:
#>  Groups  Name        Std.Dev. 
#>  individ (Intercept) 1.078e-05
#>  year2   (Intercept) 8.776e-01
#> Number of obs: 303, groups:  individ, 70; year2, 5
#> Fixed Effects:
#> (Intercept)   size2added  
#>      2.4904       0.3134  
#> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
#> 
#> 
#> 
#> Size model:
#> Formula:          size3added ~ (1 | year2) + (1 | individ)
#> Data: subdata
#>       AIC       BIC    logLik  df.resid 
#> 1008.2748 1022.9266 -500.1374       284 
#> Random-effects (co)variances:
#> 
#> Conditional model:
#>  Groups  Name        Std.Dev.
#>  year2   (Intercept) 0.1109  
#>  individ (Intercept) 1.0562  
#> 
#> Number of obs: 288 / Conditional model: year2, 5; individ, 70
#> 
#> Dispersion parameter for truncated_nbinom2 family (): 9.81e+08 
#> 
#> Fixed Effects:
#> 
#> Conditional model:
#> (Intercept)  
#>       0.576  
#> 
#> 
#> 
#> Secondary size model:
#> [1] 1
#> 
#> 
#> 
#> Tertiary size model:
#> [1] 1
#> 
#> 
#> 
#> Reproductive status model:
#> Generalized linear mixed model fit by maximum likelihood (Laplace
#>   Approximation) [glmerMod]
#>  Family: binomial  ( logit )
#> Formula: repstatus3 ~ repstatus2 + size2added + (1 | year2) + (1 | individ)
#>    Data: subdata
#>       AIC       BIC    logLik  deviance  df.resid 
#>  333.6176  351.9324 -161.8088  323.6176       283 
#> Random effects:
#>  Groups  Name        Std.Dev.
#>  individ (Intercept) 0.1829  
#>  year2   (Intercept) 0.6250  
#> Number of obs: 288, groups:  individ, 70; year2, 5
#> Fixed Effects:
#> (Intercept)   repstatus2   size2added  
#>     -1.4630       1.6457       0.1715  
#> 
#> 
#> 
#> Fecundity model:
#> Formula:          feca2 ~ size2added + (1 | year2) + (1 | individ)
#> Zero inflation:         ~size2added + (1 | year2) + (1 | individ)
#> Data: subdata
#>       AIC       BIC    logLik  df.resid 
#>  248.8609  271.0264 -116.4305       110 
#> Random-effects (co)variances:
#> 
#> Conditional model:
#>  Groups  Name        Std.Dev.
#>  year2   (Intercept) 0.5760  
#>  individ (Intercept) 0.1639  
#> 
#> Zero-inflation model:
#>  Groups  Name        Std.Dev. 
#>  year2   (Intercept) 1.642e-06
#>  individ (Intercept) 3.089e-04
#> 
#> Number of obs: 118 / Conditional model: year2, 5; individ, 51 / Zero-inflation model: year2, 5; individ, 51
#> 
#> Fixed Effects:
#> 
#> Conditional model:
#> (Intercept)   size2added  
#>    -0.54014      0.06174  
#> 
#> Zero-inflation model:
#> (Intercept)   size2added  
#>       3.865       -1.574  
#> 
#> 
#> Juvenile survival model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile observation model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile size model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile secondary size model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile tertiary size model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile reproduction model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile maturity model:
#> [1] 1
#> 
#> 
#> 
#> 
#> 
#> Number of models in survival table: 4
#> 
#> Number of models in observation table: 4
#> 
#> Number of models in size table: 4
#> 
#> Number of models in secondary size table: 1
#> 
#> Number of models in tertiary size table: 1
#> 
#> Number of models in reproduction status table: 4
#> 
#> Number of models in fecundity table: 15
#> 
#> Number of models in juvenile survival table: 1
#> 
#> Number of models in juvenile observation table: 1
#> 
#> Number of models in juvenile size table: 1
#> 
#> Number of models in juvenile secondary size table: 1
#> 
#> Number of models in juvenile tertiary size table: 1
#> 
#> Number of models in juvenile reproduction table: 1
#> 
#> Number of models in juvenile maturity table: 1
#> 
#> 
#> 
#> 
#> 
#> General model parameter names (column 1), and 
#> specific names used in these models (column 2): 
#>                       parameter_names mainparams
#> 1                              time t      year2
#> 2                          individual    individ
#> 3                               patch      patch
#> 4                   alive in time t+1      surv3
#> 5                observed in time t+1       obs3
#> 6                   sizea in time t+1      size3
#> 7                   sizeb in time t+1     sizeb3
#> 8                   sizec in time t+1     sizec3
#> 9     reproductive status in time t+1     repst3
#> 10              fecundity in time t+1       fec3
#> 11                fecundity in time t       fec2
#> 12                    sizea in time t      size2
#> 13                  sizea in time t-1      size1
#> 14                    sizeb in time t     sizeb2
#> 15                  sizeb in time t-1     sizeb1
#> 16                    sizec in time t     sizec2
#> 17                  sizec in time t-1     sizec1
#> 18      reproductive status in time t     repst2
#> 19    reproductive status in time t-1     repst1
#> 20        maturity status in time t+1     matst3
#> 21          maturity status in time t     matst2
#> 22                      age in time t        age
#> 23                  density in time t    density
#> 24   individual covariate a in time t   indcova2
#> 25 individual covariate a in time t-1   indcova1
#> 26   individual covariate b in time t   indcovb2
#> 27 individual covariate b in time t-1   indcovb1
#> 28   individual covariate c in time t   indcovc2
#> 29 individual covariate c in time t-1   indcovc1
#> 30              stage group in time t     group2
#> 31            stage group in time t-1     group1
#> 
#> 
#> 
#> 
#> 
#> Quality control:
#> 
#> Survival estimated with 74 individuals and 320 individual transitions.
#> Survival accuracy is 0.947.
#> Observation estimated with 70 individuals and 303 individual transitions.
#> Observation accuracy is 0.95.
#> Primary size estimated with 70 individuals and 288 individual transitions.
#> Primary size pseudo R-squared is 0.
#> Secondary size transition not estimated.
#> Tertiary size transition not estimated.
#> Reproductive status estimated with 70 individuals and 288 individual transitions.
#> Reproductive status accuracy is 0.715.
#> Fecundity estimated with 51 individuals and 118 individual transitions.
#> Fecundity pseudo R-squared is 0.32.
#> Juvenile survival not estimated.
#> Juvenile observation probability not estimated.
#> Juvenile primary size transition not estimated.
#> Juvenile secondary size transition not estimated.
#> Juvenile tertiary size transition not estimated.
#> Juvenile reproduction probability not estimated.
#> Juvenile maturity probability not estimated.

Note that we now have no patch term in any model, and some of our models have changed in other ways as well.

Let’s try one more model set with individual our individual covariate included. We will only do ahistorical models, and we will not split the data up by patch.

cypmodels2p_env <- modelsearch(cypfb_env, historical = FALSE, approach = "mixed", 
  vitalrates = c("surv", "obs", "size", "repst", "fec"),
  sizedist = "negbin", size.trunc = TRUE, fecdist = "poisson", fec.zero = TRUE,
  suite = "main", size = c("size3added", "size2added", "size1added"),
  indcova = c("indcova3", "indcova2", "indcova1"), quiet = TRUE)

summary(cypmodels2p_env)
#> This LefkoMod object includes 5 linear models.
#> Best-fit model criterion used: aicc&k
#> 
#> 
#> 
#> Survival model:
#> Generalized linear mixed model fit by maximum likelihood (Laplace
#>   Approximation) [glmerMod]
#>  Family: binomial  ( logit )
#> Formula: alive3 ~ indcova2 + (1 | year2) + (1 | individ)
#>    Data: subdata
#>      AIC      BIC   logLik deviance df.resid 
#>  87.6075 102.6808 -39.8038  79.6075      316 
#> Random effects:
#>  Groups  Name        Std.Dev.
#>  individ (Intercept) 552.9   
#>  year2   (Intercept) 394.6   
#> Number of obs: 320, groups:  individ, 74; year2, 5
#> Fixed Effects:
#> (Intercept)     indcova2  
#>     476.174       -3.278  
#> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
#> 
#> 
#> 
#> Observation model:
#> Generalized linear mixed model fit by maximum likelihood (Laplace
#>   Approximation) [glmerMod]
#>  Family: binomial  ( logit )
#> Formula: obsstatus3 ~ size2added + (1 | year2) + (1 | individ)
#>    Data: subdata
#>      AIC      BIC   logLik deviance df.resid 
#> 118.2567 133.1117 -55.1284 110.2567      299 
#> Random effects:
#>  Groups  Name        Std.Dev. 
#>  individ (Intercept) 1.078e-05
#>  year2   (Intercept) 8.776e-01
#> Number of obs: 303, groups:  individ, 70; year2, 5
#> Fixed Effects:
#> (Intercept)   size2added  
#>      2.4904       0.3134  
#> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
#> 
#> 
#> 
#> Size model:
#> Formula:          
#> size3added ~ indcova2 + size2added + (1 | year2) + (1 | individ)
#> Data: subdata
#>       AIC       BIC    logLik  df.resid 
#> 1001.3778 1023.3555 -494.6889       282 
#> Random-effects (co)variances:
#> 
#> Conditional model:
#>  Groups  Name        Std.Dev.
#>  year2   (Intercept) 0.06554 
#>  individ (Intercept) 0.96060 
#> 
#> Number of obs: 288 / Conditional model: year2, 5; individ, 70
#> 
#> Dispersion parameter for truncated_nbinom2 family (): 1.87e+12 
#> 
#> Fixed Effects:
#> 
#> Conditional model:
#> (Intercept)     indcova2   size2added  
#>    0.070927     0.004918     0.023979  
#> 
#> 
#> 
#> Secondary size model:
#> [1] 1
#> 
#> 
#> 
#> Tertiary size model:
#> [1] 1
#> 
#> 
#> 
#> Reproductive status model:
#> Generalized linear mixed model fit by maximum likelihood (Laplace
#>   Approximation) [glmerMod]
#>  Family: binomial  ( logit )
#> Formula: repstatus3 ~ indcova2 + repstatus2 + size2added + (1 | year2) +  
#>     (1 | individ)
#>    Data: subdata
#>       AIC       BIC    logLik  deviance  df.resid 
#>  330.0418  352.0196 -159.0209  318.0418       282 
#> Random effects:
#>  Groups  Name        Std.Dev. 
#>  individ (Intercept) 0.0002695
#>  year2   (Intercept) 0.2479120
#> Number of obs: 288, groups:  individ, 70; year2, 5
#> Fixed Effects:
#> (Intercept)     indcova2   repstatus2   size2added  
#>    -4.23766      0.02954      1.71091      0.17187  
#> 
#> 
#> 
#> Fecundity model:
#> Formula:          feca2 ~ size2added + (1 | year2) + (1 | individ)
#> Zero inflation:         ~size2added + (1 | year2) + (1 | individ)
#> Data: subdata
#>       AIC       BIC    logLik  df.resid 
#>  248.8609  271.0264 -116.4305       110 
#> Random-effects (co)variances:
#> 
#> Conditional model:
#>  Groups  Name        Std.Dev.
#>  year2   (Intercept) 0.5760  
#>  individ (Intercept) 0.1639  
#> 
#> Zero-inflation model:
#>  Groups  Name        Std.Dev. 
#>  year2   (Intercept) 1.642e-06
#>  individ (Intercept) 3.089e-04
#> 
#> Number of obs: 118 / Conditional model: year2, 5; individ, 51 / Zero-inflation model: year2, 5; individ, 51
#> 
#> Fixed Effects:
#> 
#> Conditional model:
#> (Intercept)   size2added  
#>    -0.54014      0.06174  
#> 
#> Zero-inflation model:
#> (Intercept)   size2added  
#>       3.865       -1.574  
#> 
#> 
#> Juvenile survival model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile observation model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile size model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile secondary size model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile tertiary size model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile reproduction model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile maturity model:
#> [1] 1
#> 
#> 
#> 
#> 
#> 
#> Number of models in survival table: 8
#> 
#> Number of models in observation table: 8
#> 
#> Number of models in size table: 8
#> 
#> Number of models in secondary size table: 1
#> 
#> Number of models in tertiary size table: 1
#> 
#> Number of models in reproduction status table: 8
#> 
#> Number of models in fecundity table: 61
#> 
#> Number of models in juvenile survival table: 1
#> 
#> Number of models in juvenile observation table: 1
#> 
#> Number of models in juvenile size table: 1
#> 
#> Number of models in juvenile secondary size table: 1
#> 
#> Number of models in juvenile tertiary size table: 1
#> 
#> Number of models in juvenile reproduction table: 1
#> 
#> Number of models in juvenile maturity table: 1
#> 
#> 
#> 
#> 
#> 
#> General model parameter names (column 1), and 
#> specific names used in these models (column 2): 
#>                       parameter_names mainparams
#> 1                              time t      year2
#> 2                          individual    individ
#> 3                               patch      patch
#> 4                   alive in time t+1      surv3
#> 5                observed in time t+1       obs3
#> 6                   sizea in time t+1      size3
#> 7                   sizeb in time t+1     sizeb3
#> 8                   sizec in time t+1     sizec3
#> 9     reproductive status in time t+1     repst3
#> 10              fecundity in time t+1       fec3
#> 11                fecundity in time t       fec2
#> 12                    sizea in time t      size2
#> 13                  sizea in time t-1      size1
#> 14                    sizeb in time t     sizeb2
#> 15                  sizeb in time t-1     sizeb1
#> 16                    sizec in time t     sizec2
#> 17                  sizec in time t-1     sizec1
#> 18      reproductive status in time t     repst2
#> 19    reproductive status in time t-1     repst1
#> 20        maturity status in time t+1     matst3
#> 21          maturity status in time t     matst2
#> 22                      age in time t        age
#> 23                  density in time t    density
#> 24   individual covariate a in time t   indcova2
#> 25 individual covariate a in time t-1   indcova1
#> 26   individual covariate b in time t   indcovb2
#> 27 individual covariate b in time t-1   indcovb1
#> 28   individual covariate c in time t   indcovc2
#> 29 individual covariate c in time t-1   indcovc1
#> 30              stage group in time t     group2
#> 31            stage group in time t-1     group1
#> 
#> 
#> 
#> 
#> 
#> Quality control:
#> 
#> Survival estimated with 74 individuals and 320 individual transitions.
#> Survival accuracy is 1.
#> Observation estimated with 70 individuals and 303 individual transitions.
#> Observation accuracy is 0.95.
#> Primary size estimated with 70 individuals and 288 individual transitions.
#> Primary size pseudo R-squared is 0.011.
#> Secondary size transition not estimated.
#> Tertiary size transition not estimated.
#> Reproductive status estimated with 70 individuals and 288 individual transitions.
#> Reproductive status accuracy is 0.719.
#> Fecundity estimated with 51 individuals and 118 individual transitions.
#> Fecundity pseudo R-squared is 0.32.
#> Juvenile survival not estimated.
#> Juvenile observation probability not estimated.
#> Juvenile primary size transition not estimated.
#> Juvenile secondary size transition not estimated.
#> Juvenile tertiary size transition not estimated.
#> Juvenile reproduction probability not estimated.
#> Juvenile maturity probability not estimated.

Annual precipitation is important in explaining survival, primary size, and reproductive status. Let’s move on!

Further details on modeling vital rates are provided in Chapter 5 of lefko3: a gentle introduction.

Step 4. MPM estimation

Now we will work on developing the MPMs themselves. Note that these will be objects that include sets of matrices characterizing the years and subpopulations within the dataset. General function-based projections involving the development of new matrices at each step will be introduced at the end of Step 5. MPM analysis.

Step 4a. Modeling the main MPMs

We will now proceed to create our matrices. Since we have determined that individual history is important, we could settle for simply producing a historical MPM. However, we will produce both historical and ahistorical MPMs for comparison, and we will also produce these in both raw and function-based formats.

We will begin with the creation of a set of ahistorical matrices for the Cypripedium candidum dataset. The rlefko2 function was created to deal with the construction of ahistorical MPMs using raw data. Matrices may strongly differ, particularly if the demographic dataset is somewhat sparse. This happens because there may not be enough individuals per year to encounter all possible transitions, leading to seemingly random shifts in the location of non-zero elements within matrices across time. We strongly advise readers to build life history models that reflect the sample size that they are working with to prevent this issue from causing odd results in MPM analysis.

cypmatrix2rp <- rlefko2(data = cypraw_v1, stageframe = cypframe_raw,
  year = "all", patch = "all", stages = c("stage3", "stage2"),
  size = c("size3added", "size2added"), supplement = cypsupp2_raw, 
  yearcol = "year2", patchcol = "patchid", indivcol = "individ")

cypmatrix2rp
#> $A
#> $A$`1`
#>       [,1] [,2] [,3] [,4]      [,5] [,6]      [,7]  [,8]         [,9] [,10]
#>  [1,] 0.03  0.0  0.0  0.0 0.0000000    0 0.0000000 500.0 1666.6666667     0
#>  [2,] 0.15  0.0  0.0  0.0 0.0000000    0 0.0000000 500.0 1666.6666667     0
#>  [3,] 0.00  0.1  0.0  0.0 0.0000000    0 0.0000000   0.0    0.0000000     0
#>  [4,] 0.00  0.0  0.1  0.0 0.0000000    0 0.0000000   0.0    0.0000000     0
#>  [5,] 0.00  0.0  0.0  0.1 0.0500000    0 0.0000000   0.0    0.0000000     0
#>  [6,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000   0.0    0.0000000     0
#>  [7,] 0.00  0.0  0.0  0.0 0.6363636    0 0.6363636   0.2    0.0000000     0
#>  [8,] 0.00  0.0  0.0  0.0 0.0000000    0 0.2727273   0.6    0.6666667     1
#>  [9,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000   0.2    0.3333333     0
#> [10,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000   0.0    0.0000000     0
#> [11,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000   0.0    0.0000000     0
#>       [,11]
#>  [1,]     0
#>  [2,]     0
#>  [3,]     0
#>  [4,]     0
#>  [5,]     0
#>  [6,]     0
#>  [7,]     0
#>  [8,]     0
#>  [9,]     0
#> [10,]     0
#> [11,]     0
#> 
#> $A$`2`
#>       [,1] [,2] [,3] [,4]  [,5] [,6]    [,7]         [,8] [,9] [,10] [,11]
#>  [1,] 0.03  0.0  0.0  0.0 0.000    0 312.500 1111.1111111 1250     0     0
#>  [2,] 0.15  0.0  0.0  0.0 0.000    0 312.500 1111.1111111 1250     0     0
#>  [3,] 0.00  0.1  0.0  0.0 0.000    0   0.000    0.0000000    0     0     0
#>  [4,] 0.00  0.0  0.1  0.0 0.000    0   0.000    0.0000000    0     0     0
#>  [5,] 0.00  0.0  0.0  0.1 0.050    0   0.000    0.0000000    0     0     0
#>  [6,] 0.00  0.0  0.0  0.0 0.125    0   0.125    0.0000000    0     0     0
#>  [7,] 0.00  0.0  0.0  0.0 0.750    0   0.750    0.3333333    0     0     0
#>  [8,] 0.00  0.0  0.0  0.0 0.000    0   0.000    0.4444444    0     0     0
#>  [9,] 0.00  0.0  0.0  0.0 0.000    0   0.000    0.2222222    1     0     0
#> [10,] 0.00  0.0  0.0  0.0 0.000    0   0.000    0.0000000    0     0     0
#> [11,] 0.00  0.0  0.0  0.0 0.000    0   0.000    0.0000000    0     0     0
#> 
#> $A$`3`
#>       [,1] [,2] [,3] [,4]      [,5] [,6]      [,7] [,8] [,9] [,10] [,11]
#>  [1,] 0.03  0.0  0.0  0.0 0.0000000    0 0.0000000    0 0.00     0     0
#>  [2,] 0.15  0.0  0.0  0.0 0.0000000    0 0.0000000    0 0.00     0     0
#>  [3,] 0.00  0.1  0.0  0.0 0.0000000    0 0.0000000    0 0.00     0     0
#>  [4,] 0.00  0.0  0.1  0.0 0.0000000    0 0.0000000    0 0.00     0     0
#>  [5,] 0.00  0.0  0.0  0.1 0.0500000    0 0.0000000    0 0.00     0     0
#>  [6,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000    0 0.00     0     0
#>  [7,] 0.00  0.0  0.0  0.0 0.6666667    0 0.6666667    0 0.00     0     0
#>  [8,] 0.00  0.0  0.0  0.0 0.0000000    1 0.3333333    1 0.25     0     0
#>  [9,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000    0 0.75     0     0
#> [10,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000    0 0.00     0     0
#> [11,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000    0 0.00     0     0
#> 
#> $A$`4`
#>       [,1] [,2] [,3] [,4]      [,5] [,6]      [,7]      [,8]      [,9] [,10]
#>  [1,] 0.03  0.0  0.0  0.0 0.0000000    0 0.0000000 0.0000000 0.0000000     0
#>  [2,] 0.15  0.0  0.0  0.0 0.0000000    0 0.0000000 0.0000000 0.0000000     0
#>  [3,] 0.00  0.1  0.0  0.0 0.0000000    0 0.0000000 0.0000000 0.0000000     0
#>  [4,] 0.00  0.0  0.1  0.0 0.0000000    0 0.0000000 0.0000000 0.0000000     0
#>  [5,] 0.00  0.0  0.0  0.1 0.0500000    0 0.0000000 0.0000000 0.0000000     0
#>  [6,] 0.00  0.0  0.0  0.0 0.1666667    0 0.1666667 0.2222222 0.0000000     0
#>  [7,] 0.00  0.0  0.0  0.0 0.5000000    0 0.5000000 0.4444444 0.3333333     0
#>  [8,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.3333333 0.3333333     0
#>  [9,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.0000000 0.3333333     0
#> [10,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.0000000 0.0000000     0
#> [11,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.0000000 0.0000000     0
#>       [,11]
#>  [1,]     0
#>  [2,]     0
#>  [3,]     0
#>  [4,]     0
#>  [5,]     0
#>  [6,]     0
#>  [7,]     0
#>  [8,]     0
#>  [9,]     0
#> [10,]     0
#> [11,]     0
#> 
#> $A$`5`
#>       [,1] [,2] [,3] [,4]      [,5]      [,6]      [,7]  [,8] [,9] [,10] [,11]
#>  [1,] 0.03  0.0  0.0  0.0 0.0000000 0.0000000 0.0000000 500.0 5000     0     0
#>  [2,] 0.15  0.0  0.0  0.0 0.0000000 0.0000000 0.0000000 500.0 5000     0     0
#>  [3,] 0.00  0.1  0.0  0.0 0.0000000 0.0000000 0.0000000   0.0    0     0     0
#>  [4,] 0.00  0.0  0.1  0.0 0.0000000 0.0000000 0.0000000   0.0    0     0     0
#>  [5,] 0.00  0.0  0.0  0.1 0.0500000 0.0000000 0.0000000   0.0    0     0     0
#>  [6,] 0.00  0.0  0.0  0.0 0.0000000 0.0000000 0.0000000   0.0    0     0     0
#>  [7,] 0.00  0.0  0.0  0.0 0.4444444 0.3333333 0.4444444   0.0    0     0     0
#>  [8,] 0.00  0.0  0.0  0.0 0.0000000 0.6666667 0.4444444   0.6    0     0     0
#>  [9,] 0.00  0.0  0.0  0.0 0.0000000 0.0000000 0.0000000   0.0    0     0     0
#> [10,] 0.00  0.0  0.0  0.0 0.0000000 0.0000000 0.0000000   0.0    1     0     0
#> [11,] 0.00  0.0  0.0  0.0 0.0000000 0.0000000 0.0000000   0.0    0     0     0
#> 
#> $A$`6`
#>       [,1] [,2] [,3] [,4]      [,5] [,6]      [,7]        [,8]   [,9]   [,10]
#>  [1,] 0.03  0.0  0.0  0.0 0.0000000    0 0.0000000 166.6666667 625.00 1875.00
#>  [2,] 0.15  0.0  0.0  0.0 0.0000000    0 0.0000000 166.6666667 625.00 1875.00
#>  [3,] 0.00  0.1  0.0  0.0 0.0000000    0 0.0000000   0.0000000   0.00    0.00
#>  [4,] 0.00  0.0  0.1  0.0 0.0000000    0 0.0000000   0.0000000   0.00    0.00
#>  [5,] 0.00  0.0  0.0  0.1 0.0500000    0 0.0000000   0.0000000   0.00    0.00
#>  [6,] 0.00  0.0  0.0  0.0 0.1111111    0 0.1111111   0.0000000   0.00    0.00
#>  [7,] 0.00  0.0  0.0  0.0 0.6666667    0 0.6666667   0.2666667   0.00    0.00
#>  [8,] 0.00  0.0  0.0  0.0 0.0000000    0 0.1111111   0.6000000   0.50    0.00
#>  [9,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000   0.1333333   0.25    0.25
#> [10,] 0.00  0.0  0.0  0.0 0.0000000    0 0.1111111   0.0000000   0.25    0.50
#> [11,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000   0.0000000   0.00    0.25
#>       [,11]
#>  [1,]     0
#>  [2,]     0
#>  [3,]     0
#>  [4,]     0
#>  [5,]     0
#>  [6,]     0
#>  [7,]     0
#>  [8,]     0
#>  [9,]     0
#> [10,]     0
#> [11,]     0
#> 
#> $A$`7`
#>       [,1] [,2] [,3] [,4]       [,5] [,6]       [,7]         [,8]    [,9]
#>  [1,] 0.03  0.0  0.0  0.0 0.00000000    0 0.00000000 1.666667e+03 4375.00
#>  [2,] 0.15  0.0  0.0  0.0 0.00000000    0 0.00000000 1.666667e+03 4375.00
#>  [3,] 0.00  0.1  0.0  0.0 0.00000000    0 0.00000000 0.000000e+00    0.00
#>  [4,] 0.00  0.0  0.1  0.0 0.00000000    0 0.00000000 0.000000e+00    0.00
#>  [5,] 0.00  0.0  0.0  0.1 0.05000000    0 0.00000000 0.000000e+00    0.00
#>  [6,] 0.00  0.0  0.0  0.0 0.09090909    0 0.09090909 8.333333e-02    0.00
#>  [7,] 0.00  0.0  0.0  0.0 0.45454545    0 0.45454545 2.500000e-01    0.25
#>  [8,] 0.00  0.0  0.0  0.0 0.00000000    1 0.36363636 5.833333e-01    0.50
#>  [9,] 0.00  0.0  0.0  0.0 0.00000000    0 0.00000000 0.000000e+00    0.25
#> [10,] 0.00  0.0  0.0  0.0 0.00000000    0 0.00000000 0.000000e+00    0.00
#> [11,] 0.00  0.0  0.0  0.0 0.00000000    0 0.00000000 0.000000e+00    0.00
#>         [,10] [,11]
#>  [1,] 5000.00 17500
#>  [2,] 5000.00 17500
#>  [3,]    0.00     0
#>  [4,]    0.00     0
#>  [5,]    0.00     0
#>  [6,]    0.00     0
#>  [7,]    0.00     0
#>  [8,]    0.50     0
#>  [9,]    0.25     0
#> [10,]    0.25     0
#> [11,]    0.00     1
#> 
#> $A$`8`
#>       [,1] [,2] [,3] [,4]      [,5] [,6]        [,7]     [,8]   [,9] [,10]
#>  [1,] 0.03  0.0  0.0  0.0 0.0000000    0 277.7777778 781.2500 6250.0  5000
#>  [2,] 0.15  0.0  0.0  0.0 0.0000000    0 277.7777778 781.2500 6250.0  5000
#>  [3,] 0.00  0.1  0.0  0.0 0.0000000    0   0.0000000   0.0000    0.0     0
#>  [4,] 0.00  0.0  0.1  0.0 0.0000000    0   0.0000000   0.0000    0.0     0
#>  [5,] 0.00  0.0  0.0  0.1 0.0500000    0   0.0000000   0.0000    0.0     0
#>  [6,] 0.00  0.0  0.0  0.0 0.0000000    0   0.0000000   0.1875    0.0     0
#>  [7,] 0.00  0.0  0.0  0.0 0.3333333    1   0.3333333   0.3125    0.0     0
#>  [8,] 0.00  0.0  0.0  0.0 0.0000000    0   0.3333333   0.3750    0.5     0
#>  [9,] 0.00  0.0  0.0  0.0 0.0000000    0   0.1111111   0.0625    0.0     0
#> [10,] 0.00  0.0  0.0  0.0 0.0000000    0   0.0000000   0.0625    0.5     1
#> [11,] 0.00  0.0  0.0  0.0 0.0000000    0   0.0000000   0.0000    0.0     0
#>       [,11]
#>  [1,] 10000
#>  [2,] 10000
#>  [3,]     0
#>  [4,]     0
#>  [5,]     0
#>  [6,]     0
#>  [7,]     0
#>  [8,]     0
#>  [9,]     0
#> [10,]     1
#> [11,]     0
#> 
#> $A$`9`
#>       [,1] [,2] [,3] [,4]      [,5]      [,6]      [,7]  [,8] [,9]   [,10]
#>  [1,] 0.03  0.0  0.0  0.0 0.0000000 0.0000000 0.0000000 250.0  0.0 1250.00
#>  [2,] 0.15  0.0  0.0  0.0 0.0000000 0.0000000 0.0000000 250.0  0.0 1250.00
#>  [3,] 0.00  0.1  0.0  0.0 0.0000000 0.0000000 0.0000000   0.0  0.0    0.00
#>  [4,] 0.00  0.0  0.1  0.0 0.0000000 0.0000000 0.0000000   0.0  0.0    0.00
#>  [5,] 0.00  0.0  0.0  0.1 0.0500000 0.0000000 0.0000000   0.0  0.0    0.00
#>  [6,] 0.00  0.0  0.0  0.0 0.1818182 0.3333333 0.1818182   0.0  0.0    0.00
#>  [7,] 0.00  0.0  0.0  0.0 0.2727273 0.3333333 0.2727273   0.2  0.0    0.00
#>  [8,] 0.00  0.0  0.0  0.0 0.0000000 0.0000000 0.4545455   0.2  0.5    0.00
#>  [9,] 0.00  0.0  0.0  0.0 0.0000000 0.0000000 0.0000000   0.4  0.5    0.50
#> [10,] 0.00  0.0  0.0  0.0 0.0000000 0.3333333 0.0000000   0.0  0.0    0.25
#> [11,] 0.00  0.0  0.0  0.0 0.0000000 0.0000000 0.0000000   0.0  0.0    0.25
#>       [,11]
#>  [1,]     0
#>  [2,]     0
#>  [3,]     0
#>  [4,]     0
#>  [5,]     0
#>  [6,]     0
#>  [7,]     0
#>  [8,]     0
#>  [9,]     0
#> [10,]     0
#> [11,]     0
#> 
#> $A$`10`
#>       [,1] [,2] [,3] [,4]      [,5] [,6]      [,7]  [,8]        [,9] [,10]
#>  [1,] 0.03  0.0  0.0  0.0 0.0000000    0 0.0000000 0.000 714.2857143  1250
#>  [2,] 0.15  0.0  0.0  0.0 0.0000000    0 0.0000000 0.000 714.2857143  1250
#>  [3,] 0.00  0.1  0.0  0.0 0.0000000    0 0.0000000 0.000   0.0000000     0
#>  [4,] 0.00  0.0  0.1  0.0 0.0000000    0 0.0000000 0.000   0.0000000     0
#>  [5,] 0.00  0.0  0.0  0.1 0.0500000    0 0.0000000 0.000   0.0000000     0
#>  [6,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.000   0.0000000     0
#>  [7,] 0.00  0.0  0.0  0.0 0.5714286    1 0.5714286 0.125   0.0000000     0
#>  [8,] 0.00  0.0  0.0  0.0 0.0000000    0 0.2857143 0.750   0.0000000     0
#>  [9,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.125   0.7142857     0
#> [10,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.000   0.2857143     1
#> [11,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.000   0.0000000     0
#>       [,11]
#>  [1,]  2500
#>  [2,]  2500
#>  [3,]     0
#>  [4,]     0
#>  [5,]     0
#>  [6,]     0
#>  [7,]     0
#>  [8,]     0
#>  [9,]     0
#> [10,]     0
#> [11,]     1
#> 
#> $A$`11`
#>       [,1] [,2] [,3] [,4]      [,5] [,6]      [,7]   [,8]        [,9] [,10]
#>  [1,] 0.03  0.0  0.0  0.0 0.0000000    0 0.0000000 625.00 833.3333333     0
#>  [2,] 0.15  0.0  0.0  0.0 0.0000000    0 0.0000000 625.00 833.3333333     0
#>  [3,] 0.00  0.1  0.0  0.0 0.0000000    0 0.0000000   0.00   0.0000000     0
#>  [4,] 0.00  0.0  0.1  0.0 0.0000000    0 0.0000000   0.00   0.0000000     0
#>  [5,] 0.00  0.0  0.0  0.1 0.0500000    0 0.0000000   0.00   0.0000000     0
#>  [6,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000   0.00   0.0000000     0
#>  [7,] 0.00  0.0  0.0  0.0 0.6666667    0 0.6666667   0.25   0.0000000     0
#>  [8,] 0.00  0.0  0.0  0.0 0.0000000    0 0.3333333   0.50   0.3333333     0
#>  [9,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000   0.25   0.6666667     0
#> [10,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000   0.00   0.0000000     1
#> [11,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000   0.00   0.0000000     0
#>       [,11]
#>  [1,]  7500
#>  [2,]  7500
#>  [3,]     0
#>  [4,]     0
#>  [5,]     0
#>  [6,]     0
#>  [7,]     0
#>  [8,]     0
#>  [9,]     0
#> [10,]     0
#> [11,]     1
#> 
#> $A$`12`
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7]      [,8]         [,9] [,10] [,11]
#>  [1,] 0.03  0.0  0.0  0.0 0.00    0 0.00 0.0000000 4166.6666667  1250  5000
#>  [2,] 0.15  0.0  0.0  0.0 0.00    0 0.00 0.0000000 4166.6666667  1250  5000
#>  [3,] 0.00  0.1  0.0  0.0 0.00    0 0.00 0.0000000    0.0000000     0     0
#>  [4,] 0.00  0.0  0.1  0.0 0.00    0 0.00 0.0000000    0.0000000     0     0
#>  [5,] 0.00  0.0  0.0  0.1 0.05    0 0.00 0.0000000    0.0000000     0     0
#>  [6,] 0.00  0.0  0.0  0.0 0.00    0 0.00 0.0000000    0.0000000     0     0
#>  [7,] 0.00  0.0  0.0  0.0 0.75    0 0.75 0.1666667    0.0000000     0     0
#>  [8,] 0.00  0.0  0.0  0.0 0.00    0 0.00 0.8333333    0.6666667     0     0
#>  [9,] 0.00  0.0  0.0  0.0 0.00    0 0.00 0.0000000    0.3333333     1     0
#> [10,] 0.00  0.0  0.0  0.0 0.00    0 0.00 0.0000000    0.0000000     0     1
#> [11,] 0.00  0.0  0.0  0.0 0.00    0 0.00 0.0000000    0.0000000     0     0
#> 
#> $A$`13`
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7]         [,8]         [,9] [,10] [,11]
#>  [1,] 0.03  0.0  0.0  0.0 0.00    0 0.00 1071.4285714 2500.0000000  2500     0
#>  [2,] 0.15  0.0  0.0  0.0 0.00    0 0.00 1071.4285714 2500.0000000  2500     0
#>  [3,] 0.00  0.1  0.0  0.0 0.00    0 0.00    0.0000000    0.0000000     0     0
#>  [4,] 0.00  0.0  0.1  0.0 0.00    0 0.00    0.0000000    0.0000000     0     0
#>  [5,] 0.00  0.0  0.0  0.1 0.05    0 0.00    0.0000000    0.0000000     0     0
#>  [6,] 0.00  0.0  0.0  0.0 0.00    0 0.00    0.0000000    0.0000000     0     0
#>  [7,] 0.00  0.0  0.0  0.0 0.50    0 0.50    0.0000000    0.3333333     0     0
#>  [8,] 0.00  0.0  0.0  0.0 0.00    0 0.25    0.5714286    0.3333333     0     0
#>  [9,] 0.00  0.0  0.0  0.0 0.00    0 0.00    0.2857143    0.3333333     0     0
#> [10,] 0.00  0.0  0.0  0.0 0.00    0 0.00    0.1428571    0.0000000     1     0
#> [11,] 0.00  0.0  0.0  0.0 0.00    0 0.00    0.0000000    0.0000000     0     0
#> 
#> $A$`14`
#>       [,1] [,2] [,3] [,4]      [,5] [,6]      [,7]        [,8]      [,9] [,10]
#>  [1,] 0.03  0.0  0.0  0.0 0.0000000    0 0.0000000 416.6666667 0.0000000   0.0
#>  [2,] 0.15  0.0  0.0  0.0 0.0000000    0 0.0000000 416.6666667 0.0000000   0.0
#>  [3,] 0.00  0.1  0.0  0.0 0.0000000    0 0.0000000   0.0000000 0.0000000   0.0
#>  [4,] 0.00  0.0  0.1  0.0 0.0000000    0 0.0000000   0.0000000 0.0000000   0.0
#>  [5,] 0.00  0.0  0.0  0.1 0.0500000    0 0.0000000   0.0000000 0.0000000   0.0
#>  [6,] 0.00  0.0  0.0  0.0 0.3333333    0 0.3333333   0.1666667 0.0000000   0.0
#>  [7,] 0.00  0.0  0.0  0.0 0.3333333    0 0.3333333   0.1666667 0.3333333   0.0
#>  [8,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000   0.3333333 0.3333333   0.5
#>  [9,] 0.00  0.0  0.0  0.0 0.0000000    0 0.3333333   0.3333333 0.3333333   0.0
#> [10,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000   0.0000000 0.0000000   0.0
#> [11,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000   0.0000000 0.0000000   0.5
#>       [,11]
#>  [1,]     0
#>  [2,]     0
#>  [3,]     0
#>  [4,]     0
#>  [5,]     0
#>  [6,]     0
#>  [7,]     0
#>  [8,]     0
#>  [9,]     0
#> [10,]     0
#> [11,]     0
#> 
#> $A$`15`
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
#>  [1,] 0.03  0.0  0.0  0.0 0.00  0.0 0.00 0.00  625     0     0
#>  [2,] 0.15  0.0  0.0  0.0 0.00  0.0 0.00 0.00  625     0     0
#>  [3,] 0.00  0.1  0.0  0.0 0.00  0.0 0.00 0.00    0     0     0
#>  [4,] 0.00  0.0  0.1  0.0 0.00  0.0 0.00 0.00    0     0     0
#>  [5,] 0.00  0.0  0.0  0.1 0.05  0.0 0.00 0.00    0     0     0
#>  [6,] 0.00  0.0  0.0  0.0 0.00  0.0 0.00 0.00    0     0     0
#>  [7,] 0.00  0.0  0.0  0.0 0.25  0.5 0.25 0.00    0     0     0
#>  [8,] 0.00  0.0  0.0  0.0 0.00  0.5 0.75 0.50    0     0     0
#>  [9,] 0.00  0.0  0.0  0.0 0.00  0.0 0.00 0.25    1     0     0
#> [10,] 0.00  0.0  0.0  0.0 0.00  0.0 0.00 0.25    0     0     0
#> [11,] 0.00  0.0  0.0  0.0 0.00  0.0 0.00 0.00    0     0     1
#> 
#> 
#> $U
#> $U$`1`
#>       [,1] [,2] [,3] [,4]      [,5] [,6]      [,7] [,8]      [,9] [,10] [,11]
#>  [1,] 0.03  0.0  0.0  0.0 0.0000000    0 0.0000000  0.0 0.0000000     0     0
#>  [2,] 0.15  0.0  0.0  0.0 0.0000000    0 0.0000000  0.0 0.0000000     0     0
#>  [3,] 0.00  0.1  0.0  0.0 0.0000000    0 0.0000000  0.0 0.0000000     0     0
#>  [4,] 0.00  0.0  0.1  0.0 0.0000000    0 0.0000000  0.0 0.0000000     0     0
#>  [5,] 0.00  0.0  0.0  0.1 0.0500000    0 0.0000000  0.0 0.0000000     0     0
#>  [6,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000  0.0 0.0000000     0     0
#>  [7,] 0.00  0.0  0.0  0.0 0.6363636    0 0.6363636  0.2 0.0000000     0     0
#>  [8,] 0.00  0.0  0.0  0.0 0.0000000    0 0.2727273  0.6 0.6666667     1     0
#>  [9,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000  0.2 0.3333333     0     0
#> [10,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000  0.0 0.0000000     0     0
#> [11,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000  0.0 0.0000000     0     0
#> 
#> $U$`2`
#>       [,1] [,2] [,3] [,4]  [,5] [,6]  [,7]      [,8] [,9] [,10] [,11]
#>  [1,] 0.03  0.0  0.0  0.0 0.000    0 0.000 0.0000000    0     0     0
#>  [2,] 0.15  0.0  0.0  0.0 0.000    0 0.000 0.0000000    0     0     0
#>  [3,] 0.00  0.1  0.0  0.0 0.000    0 0.000 0.0000000    0     0     0
#>  [4,] 0.00  0.0  0.1  0.0 0.000    0 0.000 0.0000000    0     0     0
#>  [5,] 0.00  0.0  0.0  0.1 0.050    0 0.000 0.0000000    0     0     0
#>  [6,] 0.00  0.0  0.0  0.0 0.125    0 0.125 0.0000000    0     0     0
#>  [7,] 0.00  0.0  0.0  0.0 0.750    0 0.750 0.3333333    0     0     0
#>  [8,] 0.00  0.0  0.0  0.0 0.000    0 0.000 0.4444444    0     0     0
#>  [9,] 0.00  0.0  0.0  0.0 0.000    0 0.000 0.2222222    1     0     0
#> [10,] 0.00  0.0  0.0  0.0 0.000    0 0.000 0.0000000    0     0     0
#> [11,] 0.00  0.0  0.0  0.0 0.000    0 0.000 0.0000000    0     0     0
#> 
#> $U$`3`
#>       [,1] [,2] [,3] [,4]      [,5] [,6]      [,7] [,8] [,9] [,10] [,11]
#>  [1,] 0.03  0.0  0.0  0.0 0.0000000    0 0.0000000    0 0.00     0     0
#>  [2,] 0.15  0.0  0.0  0.0 0.0000000    0 0.0000000    0 0.00     0     0
#>  [3,] 0.00  0.1  0.0  0.0 0.0000000    0 0.0000000    0 0.00     0     0
#>  [4,] 0.00  0.0  0.1  0.0 0.0000000    0 0.0000000    0 0.00     0     0
#>  [5,] 0.00  0.0  0.0  0.1 0.0500000    0 0.0000000    0 0.00     0     0
#>  [6,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000    0 0.00     0     0
#>  [7,] 0.00  0.0  0.0  0.0 0.6666667    0 0.6666667    0 0.00     0     0
#>  [8,] 0.00  0.0  0.0  0.0 0.0000000    1 0.3333333    1 0.25     0     0
#>  [9,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000    0 0.75     0     0
#> [10,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000    0 0.00     0     0
#> [11,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000    0 0.00     0     0
#> 
#> $U$`4`
#>       [,1] [,2] [,3] [,4]      [,5] [,6]      [,7]      [,8]      [,9] [,10]
#>  [1,] 0.03  0.0  0.0  0.0 0.0000000    0 0.0000000 0.0000000 0.0000000     0
#>  [2,] 0.15  0.0  0.0  0.0 0.0000000    0 0.0000000 0.0000000 0.0000000     0
#>  [3,] 0.00  0.1  0.0  0.0 0.0000000    0 0.0000000 0.0000000 0.0000000     0
#>  [4,] 0.00  0.0  0.1  0.0 0.0000000    0 0.0000000 0.0000000 0.0000000     0
#>  [5,] 0.00  0.0  0.0  0.1 0.0500000    0 0.0000000 0.0000000 0.0000000     0
#>  [6,] 0.00  0.0  0.0  0.0 0.1666667    0 0.1666667 0.2222222 0.0000000     0
#>  [7,] 0.00  0.0  0.0  0.0 0.5000000    0 0.5000000 0.4444444 0.3333333     0
#>  [8,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.3333333 0.3333333     0
#>  [9,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.0000000 0.3333333     0
#> [10,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.0000000 0.0000000     0
#> [11,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.0000000 0.0000000     0
#>       [,11]
#>  [1,]     0
#>  [2,]     0
#>  [3,]     0
#>  [4,]     0
#>  [5,]     0
#>  [6,]     0
#>  [7,]     0
#>  [8,]     0
#>  [9,]     0
#> [10,]     0
#> [11,]     0
#> 
#> $U$`5`
#>       [,1] [,2] [,3] [,4]      [,5]      [,6]      [,7] [,8] [,9] [,10] [,11]
#>  [1,] 0.03  0.0  0.0  0.0 0.0000000 0.0000000 0.0000000  0.0    0     0     0
#>  [2,] 0.15  0.0  0.0  0.0 0.0000000 0.0000000 0.0000000  0.0    0     0     0
#>  [3,] 0.00  0.1  0.0  0.0 0.0000000 0.0000000 0.0000000  0.0    0     0     0
#>  [4,] 0.00  0.0  0.1  0.0 0.0000000 0.0000000 0.0000000  0.0    0     0     0
#>  [5,] 0.00  0.0  0.0  0.1 0.0500000 0.0000000 0.0000000  0.0    0     0     0
#>  [6,] 0.00  0.0  0.0  0.0 0.0000000 0.0000000 0.0000000  0.0    0     0     0
#>  [7,] 0.00  0.0  0.0  0.0 0.4444444 0.3333333 0.4444444  0.0    0     0     0
#>  [8,] 0.00  0.0  0.0  0.0 0.0000000 0.6666667 0.4444444  0.6    0     0     0
#>  [9,] 0.00  0.0  0.0  0.0 0.0000000 0.0000000 0.0000000  0.0    0     0     0
#> [10,] 0.00  0.0  0.0  0.0 0.0000000 0.0000000 0.0000000  0.0    1     0     0
#> [11,] 0.00  0.0  0.0  0.0 0.0000000 0.0000000 0.0000000  0.0    0     0     0
#> 
#> $U$`6`
#>       [,1] [,2] [,3] [,4]      [,5] [,6]      [,7]      [,8] [,9] [,10] [,11]
#>  [1,] 0.03  0.0  0.0  0.0 0.0000000    0 0.0000000 0.0000000 0.00  0.00     0
#>  [2,] 0.15  0.0  0.0  0.0 0.0000000    0 0.0000000 0.0000000 0.00  0.00     0
#>  [3,] 0.00  0.1  0.0  0.0 0.0000000    0 0.0000000 0.0000000 0.00  0.00     0
#>  [4,] 0.00  0.0  0.1  0.0 0.0000000    0 0.0000000 0.0000000 0.00  0.00     0
#>  [5,] 0.00  0.0  0.0  0.1 0.0500000    0 0.0000000 0.0000000 0.00  0.00     0
#>  [6,] 0.00  0.0  0.0  0.0 0.1111111    0 0.1111111 0.0000000 0.00  0.00     0
#>  [7,] 0.00  0.0  0.0  0.0 0.6666667    0 0.6666667 0.2666667 0.00  0.00     0
#>  [8,] 0.00  0.0  0.0  0.0 0.0000000    0 0.1111111 0.6000000 0.50  0.00     0
#>  [9,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.1333333 0.25  0.25     0
#> [10,] 0.00  0.0  0.0  0.0 0.0000000    0 0.1111111 0.0000000 0.25  0.50     0
#> [11,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.0000000 0.00  0.25     0
#> 
#> $U$`7`
#>       [,1] [,2] [,3] [,4]       [,5] [,6]       [,7]       [,8] [,9] [,10]
#>  [1,] 0.03  0.0  0.0  0.0 0.00000000    0 0.00000000 0.00000000 0.00  0.00
#>  [2,] 0.15  0.0  0.0  0.0 0.00000000    0 0.00000000 0.00000000 0.00  0.00
#>  [3,] 0.00  0.1  0.0  0.0 0.00000000    0 0.00000000 0.00000000 0.00  0.00
#>  [4,] 0.00  0.0  0.1  0.0 0.00000000    0 0.00000000 0.00000000 0.00  0.00
#>  [5,] 0.00  0.0  0.0  0.1 0.05000000    0 0.00000000 0.00000000 0.00  0.00
#>  [6,] 0.00  0.0  0.0  0.0 0.09090909    0 0.09090909 0.08333333 0.00  0.00
#>  [7,] 0.00  0.0  0.0  0.0 0.45454545    0 0.45454545 0.25000000 0.25  0.00
#>  [8,] 0.00  0.0  0.0  0.0 0.00000000    1 0.36363636 0.58333333 0.50  0.50
#>  [9,] 0.00  0.0  0.0  0.0 0.00000000    0 0.00000000 0.00000000 0.25  0.25
#> [10,] 0.00  0.0  0.0  0.0 0.00000000    0 0.00000000 0.00000000 0.00  0.25
#> [11,] 0.00  0.0  0.0  0.0 0.00000000    0 0.00000000 0.00000000 0.00  0.00
#>       [,11]
#>  [1,]     0
#>  [2,]     0
#>  [3,]     0
#>  [4,]     0
#>  [5,]     0
#>  [6,]     0
#>  [7,]     0
#>  [8,]     0
#>  [9,]     0
#> [10,]     0
#> [11,]     1
#> 
#> $U$`8`
#>       [,1] [,2] [,3] [,4]      [,5] [,6]      [,7]   [,8] [,9] [,10] [,11]
#>  [1,] 0.03  0.0  0.0  0.0 0.0000000    0 0.0000000 0.0000  0.0     0     0
#>  [2,] 0.15  0.0  0.0  0.0 0.0000000    0 0.0000000 0.0000  0.0     0     0
#>  [3,] 0.00  0.1  0.0  0.0 0.0000000    0 0.0000000 0.0000  0.0     0     0
#>  [4,] 0.00  0.0  0.1  0.0 0.0000000    0 0.0000000 0.0000  0.0     0     0
#>  [5,] 0.00  0.0  0.0  0.1 0.0500000    0 0.0000000 0.0000  0.0     0     0
#>  [6,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.1875  0.0     0     0
#>  [7,] 0.00  0.0  0.0  0.0 0.3333333    1 0.3333333 0.3125  0.0     0     0
#>  [8,] 0.00  0.0  0.0  0.0 0.0000000    0 0.3333333 0.3750  0.5     0     0
#>  [9,] 0.00  0.0  0.0  0.0 0.0000000    0 0.1111111 0.0625  0.0     0     0
#> [10,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.0625  0.5     1     1
#> [11,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.0000  0.0     0     0
#> 
#> $U$`9`
#>       [,1] [,2] [,3] [,4]      [,5]      [,6]      [,7] [,8] [,9] [,10] [,11]
#>  [1,] 0.03  0.0  0.0  0.0 0.0000000 0.0000000 0.0000000  0.0  0.0  0.00     0
#>  [2,] 0.15  0.0  0.0  0.0 0.0000000 0.0000000 0.0000000  0.0  0.0  0.00     0
#>  [3,] 0.00  0.1  0.0  0.0 0.0000000 0.0000000 0.0000000  0.0  0.0  0.00     0
#>  [4,] 0.00  0.0  0.1  0.0 0.0000000 0.0000000 0.0000000  0.0  0.0  0.00     0
#>  [5,] 0.00  0.0  0.0  0.1 0.0500000 0.0000000 0.0000000  0.0  0.0  0.00     0
#>  [6,] 0.00  0.0  0.0  0.0 0.1818182 0.3333333 0.1818182  0.0  0.0  0.00     0
#>  [7,] 0.00  0.0  0.0  0.0 0.2727273 0.3333333 0.2727273  0.2  0.0  0.00     0
#>  [8,] 0.00  0.0  0.0  0.0 0.0000000 0.0000000 0.4545455  0.2  0.5  0.00     0
#>  [9,] 0.00  0.0  0.0  0.0 0.0000000 0.0000000 0.0000000  0.4  0.5  0.50     0
#> [10,] 0.00  0.0  0.0  0.0 0.0000000 0.3333333 0.0000000  0.0  0.0  0.25     0
#> [11,] 0.00  0.0  0.0  0.0 0.0000000 0.0000000 0.0000000  0.0  0.0  0.25     0
#> 
#> $U$`10`
#>       [,1] [,2] [,3] [,4]      [,5] [,6]      [,7]  [,8]      [,9] [,10] [,11]
#>  [1,] 0.03  0.0  0.0  0.0 0.0000000    0 0.0000000 0.000 0.0000000     0     0
#>  [2,] 0.15  0.0  0.0  0.0 0.0000000    0 0.0000000 0.000 0.0000000     0     0
#>  [3,] 0.00  0.1  0.0  0.0 0.0000000    0 0.0000000 0.000 0.0000000     0     0
#>  [4,] 0.00  0.0  0.1  0.0 0.0000000    0 0.0000000 0.000 0.0000000     0     0
#>  [5,] 0.00  0.0  0.0  0.1 0.0500000    0 0.0000000 0.000 0.0000000     0     0
#>  [6,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.000 0.0000000     0     0
#>  [7,] 0.00  0.0  0.0  0.0 0.5714286    1 0.5714286 0.125 0.0000000     0     0
#>  [8,] 0.00  0.0  0.0  0.0 0.0000000    0 0.2857143 0.750 0.0000000     0     0
#>  [9,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.125 0.7142857     0     0
#> [10,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.000 0.2857143     1     0
#> [11,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.000 0.0000000     0     1
#> 
#> $U$`11`
#>       [,1] [,2] [,3] [,4]      [,5] [,6]      [,7] [,8]      [,9] [,10] [,11]
#>  [1,] 0.03  0.0  0.0  0.0 0.0000000    0 0.0000000 0.00 0.0000000     0     0
#>  [2,] 0.15  0.0  0.0  0.0 0.0000000    0 0.0000000 0.00 0.0000000     0     0
#>  [3,] 0.00  0.1  0.0  0.0 0.0000000    0 0.0000000 0.00 0.0000000     0     0
#>  [4,] 0.00  0.0  0.1  0.0 0.0000000    0 0.0000000 0.00 0.0000000     0     0
#>  [5,] 0.00  0.0  0.0  0.1 0.0500000    0 0.0000000 0.00 0.0000000     0     0
#>  [6,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.00 0.0000000     0     0
#>  [7,] 0.00  0.0  0.0  0.0 0.6666667    0 0.6666667 0.25 0.0000000     0     0
#>  [8,] 0.00  0.0  0.0  0.0 0.0000000    0 0.3333333 0.50 0.3333333     0     0
#>  [9,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.25 0.6666667     0     0
#> [10,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.00 0.0000000     1     0
#> [11,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.00 0.0000000     0     1
#> 
#> $U$`12`
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7]      [,8]      [,9] [,10] [,11]
#>  [1,] 0.03  0.0  0.0  0.0 0.00    0 0.00 0.0000000 0.0000000     0     0
#>  [2,] 0.15  0.0  0.0  0.0 0.00    0 0.00 0.0000000 0.0000000     0     0
#>  [3,] 0.00  0.1  0.0  0.0 0.00    0 0.00 0.0000000 0.0000000     0     0
#>  [4,] 0.00  0.0  0.1  0.0 0.00    0 0.00 0.0000000 0.0000000     0     0
#>  [5,] 0.00  0.0  0.0  0.1 0.05    0 0.00 0.0000000 0.0000000     0     0
#>  [6,] 0.00  0.0  0.0  0.0 0.00    0 0.00 0.0000000 0.0000000     0     0
#>  [7,] 0.00  0.0  0.0  0.0 0.75    0 0.75 0.1666667 0.0000000     0     0
#>  [8,] 0.00  0.0  0.0  0.0 0.00    0 0.00 0.8333333 0.6666667     0     0
#>  [9,] 0.00  0.0  0.0  0.0 0.00    0 0.00 0.0000000 0.3333333     1     0
#> [10,] 0.00  0.0  0.0  0.0 0.00    0 0.00 0.0000000 0.0000000     0     1
#> [11,] 0.00  0.0  0.0  0.0 0.00    0 0.00 0.0000000 0.0000000     0     0
#> 
#> $U$`13`
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7]      [,8]      [,9] [,10] [,11]
#>  [1,] 0.03  0.0  0.0  0.0 0.00    0 0.00 0.0000000 0.0000000     0     0
#>  [2,] 0.15  0.0  0.0  0.0 0.00    0 0.00 0.0000000 0.0000000     0     0
#>  [3,] 0.00  0.1  0.0  0.0 0.00    0 0.00 0.0000000 0.0000000     0     0
#>  [4,] 0.00  0.0  0.1  0.0 0.00    0 0.00 0.0000000 0.0000000     0     0
#>  [5,] 0.00  0.0  0.0  0.1 0.05    0 0.00 0.0000000 0.0000000     0     0
#>  [6,] 0.00  0.0  0.0  0.0 0.00    0 0.00 0.0000000 0.0000000     0     0
#>  [7,] 0.00  0.0  0.0  0.0 0.50    0 0.50 0.0000000 0.3333333     0     0
#>  [8,] 0.00  0.0  0.0  0.0 0.00    0 0.25 0.5714286 0.3333333     0     0
#>  [9,] 0.00  0.0  0.0  0.0 0.00    0 0.00 0.2857143 0.3333333     0     0
#> [10,] 0.00  0.0  0.0  0.0 0.00    0 0.00 0.1428571 0.0000000     1     0
#> [11,] 0.00  0.0  0.0  0.0 0.00    0 0.00 0.0000000 0.0000000     0     0
#> 
#> $U$`14`
#>       [,1] [,2] [,3] [,4]      [,5] [,6]      [,7]      [,8]      [,9] [,10]
#>  [1,] 0.03  0.0  0.0  0.0 0.0000000    0 0.0000000 0.0000000 0.0000000   0.0
#>  [2,] 0.15  0.0  0.0  0.0 0.0000000    0 0.0000000 0.0000000 0.0000000   0.0
#>  [3,] 0.00  0.1  0.0  0.0 0.0000000    0 0.0000000 0.0000000 0.0000000   0.0
#>  [4,] 0.00  0.0  0.1  0.0 0.0000000    0 0.0000000 0.0000000 0.0000000   0.0
#>  [5,] 0.00  0.0  0.0  0.1 0.0500000    0 0.0000000 0.0000000 0.0000000   0.0
#>  [6,] 0.00  0.0  0.0  0.0 0.3333333    0 0.3333333 0.1666667 0.0000000   0.0
#>  [7,] 0.00  0.0  0.0  0.0 0.3333333    0 0.3333333 0.1666667 0.3333333   0.0
#>  [8,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.3333333 0.3333333   0.5
#>  [9,] 0.00  0.0  0.0  0.0 0.0000000    0 0.3333333 0.3333333 0.3333333   0.0
#> [10,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.0000000 0.0000000   0.0
#> [11,] 0.00  0.0  0.0  0.0 0.0000000    0 0.0000000 0.0000000 0.0000000   0.5
#>       [,11]
#>  [1,]     0
#>  [2,]     0
#>  [3,]     0
#>  [4,]     0
#>  [5,]     0
#>  [6,]     0
#>  [7,]     0
#>  [8,]     0
#>  [9,]     0
#> [10,]     0
#> [11,]     0
#> 
#> $U$`15`
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
#>  [1,] 0.03  0.0  0.0  0.0 0.00  0.0 0.00 0.00    0     0     0
#>  [2,] 0.15  0.0  0.0  0.0 0.00  0.0 0.00 0.00    0     0     0
#>  [3,] 0.00  0.1  0.0  0.0 0.00  0.0 0.00 0.00    0     0     0
#>  [4,] 0.00  0.0  0.1  0.0 0.00  0.0 0.00 0.00    0     0     0
#>  [5,] 0.00  0.0  0.0  0.1 0.05  0.0 0.00 0.00    0     0     0
#>  [6,] 0.00  0.0  0.0  0.0 0.00  0.0 0.00 0.00    0     0     0
#>  [7,] 0.00  0.0  0.0  0.0 0.25  0.5 0.25 0.00    0     0     0
#>  [8,] 0.00  0.0  0.0  0.0 0.00  0.5 0.75 0.50    0     0     0
#>  [9,] 0.00  0.0  0.0  0.0 0.00  0.0 0.00 0.25    1     0     0
#> [10,] 0.00  0.0  0.0  0.0 0.00  0.0 0.00 0.25    0     0     0
#> [11,] 0.00  0.0  0.0  0.0 0.00  0.0 0.00 0.00    0     0     1
#> 
#> 
#> $F
#> $F$`1`
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]     [,9] [,10] [,11]
#>  [1,]    0    0    0    0    0    0    0  500 1666.667     0     0
#>  [2,]    0    0    0    0    0    0    0  500 1666.667     0     0
#>  [3,]    0    0    0    0    0    0    0    0    0.000     0     0
#>  [4,]    0    0    0    0    0    0    0    0    0.000     0     0
#>  [5,]    0    0    0    0    0    0    0    0    0.000     0     0
#>  [6,]    0    0    0    0    0    0    0    0    0.000     0     0
#>  [7,]    0    0    0    0    0    0    0    0    0.000     0     0
#>  [8,]    0    0    0    0    0    0    0    0    0.000     0     0
#>  [9,]    0    0    0    0    0    0    0    0    0.000     0     0
#> [10,]    0    0    0    0    0    0    0    0    0.000     0     0
#> [11,]    0    0    0    0    0    0    0    0    0.000     0     0
#> 
#> $F$`2`
#>       [,1] [,2] [,3] [,4] [,5] [,6]  [,7]     [,8] [,9] [,10] [,11]
#>  [1,]    0    0    0    0    0    0 312.5 1111.111 1250     0     0
#>  [2,]    0    0    0    0    0    0 312.5 1111.111 1250     0     0
#>  [3,]    0    0    0    0    0    0   0.0    0.000    0     0     0
#>  [4,]    0    0    0    0    0    0   0.0    0.000    0     0     0
#>  [5,]    0    0    0    0    0    0   0.0    0.000    0     0     0
#>  [6,]    0    0    0    0    0    0   0.0    0.000    0     0     0
#>  [7,]    0    0    0    0    0    0   0.0    0.000    0     0     0
#>  [8,]    0    0    0    0    0    0   0.0    0.000    0     0     0
#>  [9,]    0    0    0    0    0    0   0.0    0.000    0     0     0
#> [10,]    0    0    0    0    0    0   0.0    0.000    0     0     0
#> [11,]    0    0    0    0    0    0   0.0    0.000    0     0     0
#> 
#> $F$`3`
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
#>  [1,]    0    0    0    0    0    0    0    0    0     0     0
#>  [2,]    0    0    0    0    0    0    0    0    0     0     0
#>  [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
#> 
#> $F$`4`
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
#>  [1,]    0    0    0    0    0    0    0    0    0     0     0
#>  [2,]    0    0    0    0    0    0    0    0    0     0     0
#>  [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
#> 
#> $F$`5`
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
#>  [1,]    0    0    0    0    0    0    0  500 5000     0     0
#>  [2,]    0    0    0    0    0    0    0  500 5000     0     0
#>  [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
#> 
#> $F$`6`
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7]     [,8] [,9] [,10] [,11]
#>  [1,]    0    0    0    0    0    0    0 166.6667  625  1875     0
#>  [2,]    0    0    0    0    0    0    0 166.6667  625  1875     0
#>  [3,]    0    0    0    0    0    0    0   0.0000    0     0     0
#>  [4,]    0    0    0    0    0    0    0   0.0000    0     0     0
#>  [5,]    0    0    0    0    0    0    0   0.0000    0     0     0
#>  [6,]    0    0    0    0    0    0    0   0.0000    0     0     0
#>  [7,]    0    0    0    0    0    0    0   0.0000    0     0     0
#>  [8,]    0    0    0    0    0    0    0   0.0000    0     0     0
#>  [9,]    0    0    0    0    0    0    0   0.0000    0     0     0
#> [10,]    0    0    0    0    0    0    0   0.0000    0     0     0
#> [11,]    0    0    0    0    0    0    0   0.0000    0     0     0
#> 
#> $F$`7`
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7]     [,8] [,9] [,10] [,11]
#>  [1,]    0    0    0    0    0    0    0 1666.667 4375  5000 17500
#>  [2,]    0    0    0    0    0    0    0 1666.667 4375  5000 17500
#>  [3,]    0    0    0    0    0    0    0    0.000    0     0     0
#>  [4,]    0    0    0    0    0    0    0    0.000    0     0     0
#>  [5,]    0    0    0    0    0    0    0    0.000    0     0     0
#>  [6,]    0    0    0    0    0    0    0    0.000    0     0     0
#>  [7,]    0    0    0    0    0    0    0    0.000    0     0     0
#>  [8,]    0    0    0    0    0    0    0    0.000    0     0     0
#>  [9,]    0    0    0    0    0    0    0    0.000    0     0     0
#> [10,]    0    0    0    0    0    0    0    0.000    0     0     0
#> [11,]    0    0    0    0    0    0    0    0.000    0     0     0
#> 
#> $F$`8`
#>       [,1] [,2] [,3] [,4] [,5] [,6]     [,7]   [,8] [,9] [,10] [,11]
#>  [1,]    0    0    0    0    0    0 277.7778 781.25 6250  5000 10000
#>  [2,]    0    0    0    0    0    0 277.7778 781.25 6250  5000 10000
#>  [3,]    0    0    0    0    0    0   0.0000   0.00    0     0     0
#>  [4,]    0    0    0    0    0    0   0.0000   0.00    0     0     0
#>  [5,]    0    0    0    0    0    0   0.0000   0.00    0     0     0
#>  [6,]    0    0    0    0    0    0   0.0000   0.00    0     0     0
#>  [7,]    0    0    0    0    0    0   0.0000   0.00    0     0     0
#>  [8,]    0    0    0    0    0    0   0.0000   0.00    0     0     0
#>  [9,]    0    0    0    0    0    0   0.0000   0.00    0     0     0
#> [10,]    0    0    0    0    0    0   0.0000   0.00    0     0     0
#> [11,]    0    0    0    0    0    0   0.0000   0.00    0     0     0
#> 
#> $F$`9`
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
#>  [1,]    0    0    0    0    0    0    0  250    0  1250     0
#>  [2,]    0    0    0    0    0    0    0  250    0  1250     0
#>  [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
#> 
#> $F$`10`
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]     [,9] [,10] [,11]
#>  [1,]    0    0    0    0    0    0    0    0 714.2857  1250  2500
#>  [2,]    0    0    0    0    0    0    0    0 714.2857  1250  2500
#>  [3,]    0    0    0    0    0    0    0    0   0.0000     0     0
#>  [4,]    0    0    0    0    0    0    0    0   0.0000     0     0
#>  [5,]    0    0    0    0    0    0    0    0   0.0000     0     0
#>  [6,]    0    0    0    0    0    0    0    0   0.0000     0     0
#>  [7,]    0    0    0    0    0    0    0    0   0.0000     0     0
#>  [8,]    0    0    0    0    0    0    0    0   0.0000     0     0
#>  [9,]    0    0    0    0    0    0    0    0   0.0000     0     0
#> [10,]    0    0    0    0    0    0    0    0   0.0000     0     0
#> [11,]    0    0    0    0    0    0    0    0   0.0000     0     0
#> 
#> $F$`11`
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]     [,9] [,10] [,11]
#>  [1,]    0    0    0    0    0    0    0  625 833.3333     0  7500
#>  [2,]    0    0    0    0    0    0    0  625 833.3333     0  7500
#>  [3,]    0    0    0    0    0    0    0    0   0.0000     0     0
#>  [4,]    0    0    0    0    0    0    0    0   0.0000     0     0
#>  [5,]    0    0    0    0    0    0    0    0   0.0000     0     0
#>  [6,]    0    0    0    0    0    0    0    0   0.0000     0     0
#>  [7,]    0    0    0    0    0    0    0    0   0.0000     0     0
#>  [8,]    0    0    0    0    0    0    0    0   0.0000     0     0
#>  [9,]    0    0    0    0    0    0    0    0   0.0000     0     0
#> [10,]    0    0    0    0    0    0    0    0   0.0000     0     0
#> [11,]    0    0    0    0    0    0    0    0   0.0000     0     0
#> 
#> $F$`12`
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]     [,9] [,10] [,11]
#>  [1,]    0    0    0    0    0    0    0    0 4166.667  1250  5000
#>  [2,]    0    0    0    0    0    0    0    0 4166.667  1250  5000
#>  [3,]    0    0    0    0    0    0    0    0    0.000     0     0
#>  [4,]    0    0    0    0    0    0    0    0    0.000     0     0
#>  [5,]    0    0    0    0    0    0    0    0    0.000     0     0
#>  [6,]    0    0    0    0    0    0    0    0    0.000     0     0
#>  [7,]    0    0    0    0    0    0    0    0    0.000     0     0
#>  [8,]    0    0    0    0    0    0    0    0    0.000     0     0
#>  [9,]    0    0    0    0    0    0    0    0    0.000     0     0
#> [10,]    0    0    0    0    0    0    0    0    0.000     0     0
#> [11,]    0    0    0    0    0    0    0    0    0.000     0     0
#> 
#> $F$`13`
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7]     [,8] [,9] [,10] [,11]
#>  [1,]    0    0    0    0    0    0    0 1071.429 2500  2500     0
#>  [2,]    0    0    0    0    0    0    0 1071.429 2500  2500     0
#>  [3,]    0    0    0    0    0    0    0    0.000    0     0     0
#>  [4,]    0    0    0    0    0    0    0    0.000    0     0     0
#>  [5,]    0    0    0    0    0    0    0    0.000    0     0     0
#>  [6,]    0    0    0    0    0    0    0    0.000    0     0     0
#>  [7,]    0    0    0    0    0    0    0    0.000    0     0     0
#>  [8,]    0    0    0    0    0    0    0    0.000    0     0     0
#>  [9,]    0    0    0    0    0    0    0    0.000    0     0     0
#> [10,]    0    0    0    0    0    0    0    0.000    0     0     0
#> [11,]    0    0    0    0    0    0    0    0.000    0     0     0
#> 
#> $F$`14`
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7]     [,8] [,9] [,10] [,11]
#>  [1,]    0    0    0    0    0    0    0 416.6667    0     0     0
#>  [2,]    0    0    0    0    0    0    0 416.6667    0     0     0
#>  [3,]    0    0    0    0    0    0    0   0.0000    0     0     0
#>  [4,]    0    0    0    0    0    0    0   0.0000    0     0     0
#>  [5,]    0    0    0    0    0    0    0   0.0000    0     0     0
#>  [6,]    0    0    0    0    0    0    0   0.0000    0     0     0
#>  [7,]    0    0    0    0    0    0    0   0.0000    0     0     0
#>  [8,]    0    0    0    0    0    0    0   0.0000    0     0     0
#>  [9,]    0    0    0    0    0    0    0   0.0000    0     0     0
#> [10,]    0    0    0    0    0    0    0   0.0000    0     0     0
#> [11,]    0    0    0    0    0    0    0   0.0000    0     0     0
#> 
#> $F$`15`
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11]
#>  [1,]    0    0    0    0    0    0    0    0  625     0     0
#>  [2,]    0    0    0    0    0    0    0    0  625     0     0
#>  [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
#> 
#> 
#> $hstages
#> [1] NA
#> 
#> $agestages
#> [1] NA
#> 
#> $ahstages
#>    stage_id stage original_size original_size_b original_size_c min_age max_age
#> 1         1    SD           0.0              NA              NA       0      NA
#> 2         2    P1           0.0              NA              NA       0      NA
#> 3         3    P2           0.0              NA              NA       0      NA
#> 4         4    P3           0.0              NA              NA       0      NA
#> 5         5    SL           0.0              NA              NA       0      NA
#> 6         6     D           0.0              NA              NA       0      NA
#> 7         7   XSm           1.0              NA              NA       0      NA
#> 8         8    Sm           3.0              NA              NA       0      NA
#> 9         9    Md           6.0              NA              NA       0      NA
#> 10       10    Lg          11.0              NA              NA       0      NA
#> 11       11   XLg          19.5              NA              NA       0      NA
#>    repstatus obsstatus propstatus immstatus matstatus entrystage indataset
#> 1          0         0          1         0         0          1         0
#> 2          0         0          0         1         0          1         0
#> 3          0         0          0         1         0          0         0
#> 4          0         0          0         1         0          0         0
#> 5          0         0          0         1         0          0         0
#> 6          0         0          0         0         1          0         1
#> 7          1         1          0         0         1          0         1
#> 8          1         1          0         0         1          0         1
#> 9          1         1          0         0         1          0         1
#> 10         1         1          0         0         1          0         1
#> 11         1         1          0         0         1          0         1
#>    binhalfwidth_raw sizebin_min sizebin_max sizebin_center sizebin_width
#> 1               0.0         0.0         0.0            0.0             0
#> 2               0.0         0.0         0.0            0.0             0
#> 3               0.0         0.0         0.0            0.0             0
#> 4               0.0         0.0         0.0            0.0             0
#> 5               0.0         0.0         0.0            0.0             0
#> 6               0.5        -0.5         0.5            0.0             1
#> 7               0.5         0.5         1.5            1.0             1
#> 8               1.5         1.5         4.5            3.0             3
#> 9               1.5         4.5         7.5            6.0             3
#> 10              3.5         7.5        14.5           11.0             7
#> 11              5.0        14.5        24.5           19.5            10
#>    binhalfwidthb_raw sizebinb_min sizebinb_max sizebinb_center sizebinb_width
#> 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
#>    binhalfwidthc_raw sizebinc_min sizebinc_max sizebinc_center sizebinc_width
#> 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
#>    group                       comments alive almostborn
#> 1      0                   Dormant seed     1          0
#> 2      0               1st yr protocorm     1          0
#> 3      0               2nd yr protocorm     1          0
#> 4      0               3rd yr protocorm     1          0
#> 5      0                       Seedling     1          0
#> 6      0                  Dormant adult     1          0
#> 7      0    Extra small adult (1 shoot)     1          0
#> 8      0       Small adult (2-4 shoots)     1          0
#> 9      0      Medium adult (5-7 shoots)     1          0
#> 10     0      Large adult (8-14 shoots)     1          0
#> 11     0 Extra large adult (>14 shoots)     1          0
#> 
#> $labels
#>    pop patch year2
#> 1    1     A  2004
#> 2    1     A  2005
#> 3    1     A  2006
#> 4    1     A  2007
#> 5    1     A  2008
#> 6    1     B  2004
#> 7    1     B  2005
#> 8    1     B  2006
#> 9    1     B  2007
#> 10   1     B  2008
#> 11   1     C  2004
#> 12   1     C  2005
#> 13   1     C  2006
#> 14   1     C  2007
#> 15   1     C  2008
#> 
#> $matrixqc
#> [1] 255  70  15
#> 
#> $dataqc
#> [1]  74 320
#> 
#> attr(,"class")
#> [1] "lefkoMat"

The output from this analysis is a lefkoMat object, which is a list object with the following elements:

A: a list of full population projection matrices, in order of population, patch, and year

U: a list of matrices showing only survival-transition elements, in the same order as A

F: a list of matrices showing only fecundity elements, in the same order as A

hstages: a data frame showing the order of paired stages (given if matrices are historical, otherwise NA)

agestages: this is a data frame showing the order of age-stages (if an age-by-stage MPM has been created, otherwise NA)

ahstages: this is the stageframe used in analysis, with stages reordered and edited as they occur in the matrix

labels: a table showing the order of matrices, according to population, patch, and year

matrixqc: a short vector used in summary() statements to describe the overall quality of each matrix

dataqc: a short vector used in summary() statements to describe key sampling aspects of the dataset (in raw MPMs)

modelqc: a short vector used in summary() statements to describe the vital rate models (in function-based MPMs)

Calling particular values and elements within lefkoMat objects is not complicated, once you know the structure. The figure below illustrates how to call a particular element from one of the A matrices, for example.

Figure 3L.7. Organization of a lefkoMat object, and how to call a specific element.

Objects of class lefkoMat have their own summary() statements, which we can use to understand more about them.

summary(cypmatrix2rp)
#> 
#> This ahistorical lefkoMat object contains 15 matrices.
#> 
#> Each matrix is square with 11 rows and columns, and a total of 121 elements.
#> A total of 255 survival transitions were estimated, with 17 per matrix.
#> A total of 70 fecundity transitions were estimated, with 4.667 per matrix.
#> This lefkoMat object covers 1 population, 3 patches, and 5 time steps.
#> 
#> The dataset contains a total of 74 unique individuals and 320 unique transitions.
#> 
#> Survival probability sum check (each matrix represented by column in order):
#>          [,1]  [,2]  [,3]  [,4]  [,5]  [,6]  [,7]  [,8]  [,9] [,10] [,11] [,12]
#> Min.    0.000 0.000 0.000 0.000 0.000 0.000 0.100 0.100 0.000 0.100 0.000 0.000
#> 1st Qu. 0.100 0.050 0.100 0.050 0.100 0.100 0.140 0.140 0.100 0.140 0.100 0.100
#> Median  0.180 0.100 0.180 0.100 0.180 0.180 0.909 0.778 0.505 0.857 0.717 0.750
#> Mean    0.461 0.389 0.472 0.351 0.406 0.483 0.627 0.604 0.518 0.633 0.563 0.548
#> 3rd Qu. 0.955 0.900 1.000 0.692 0.744 1.000 1.000 1.000 0.955 1.000 1.000 1.000
#> Max.    1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000
#>         [,13] [,14] [,15]
#> Min.    0.000 0.000 0.000
#> 1st Qu. 0.100 0.100 0.100
#> Median  0.180 0.180 0.300
#> Mean    0.435 0.472 0.525
#> 3rd Qu. 0.875 1.000 1.000
#> Max.    1.000 1.000 1.000

We start off learning that 15 matrices have been estimated. This is followed by the matrix dimensions. Of note here is the output telling us how many elements were actually estimated as non-zero, both overall and per matrix, and the number of individuals and transitions the matrices are based on. It is typical for population ecologists to consider the total number of transitions in a dataset as a measure of the statistical power of a matrix, but the number of individuals used is just as important because each transition that an individual experiences is dependent on the other transitions that it also experiences. Then we see the number of populations, subpopulations / patches, and time steps covered by the MPM. The final bit of the summary shows us the range of survival probabilities of stages in the matrices, where the survival probabilities are calculated as column sums of each U matrix. Since there are 15 matrices, there are 15 column sum summaries. It is important to check to see that no stage survives outside the realm of possibility (i.e. no probability should be greater than 1.0 or lower than 0.0). Unusual stage survival probabilities will result in a warning as a part of the summary() output.

The input for the rlefko2() function includes patch = "all" and year = "all", but can be set to focus on any set of patches / subpopulations or years included within the data. Package lefko3 includes a great deal of flexibility here, and can estimate many matrices covering all of the populations, patches, and years occurring in a specific dataset. For example, if we had wished to skip the patch divisions within the population and instead estimate only annual matrices at the population level, then we could have eliminated the patch option altogether from the input, as below.

cypmatrix2r <- rlefko2(data = cypraw_v1, stageframe = cypframe_raw,
  year = "all", stages = c("stage3", "stage2"),
  size = c("size3added", "size2added"), supplement = cypsupp2_raw, 
  yearcol = "year2", patchcol = "patchid", indivcol = "individ")

summary(cypmatrix2r)
#> 
#> This ahistorical lefkoMat object contains 5 matrices.
#> 
#> Each matrix is square with 11 rows and columns, and a total of 121 elements.
#> A total of 115 survival transitions were estimated, with 23 per matrix.
#> A total of 40 fecundity transitions were estimated, with 8 per matrix.
#> This lefkoMat object covers 1 population, 1 patch, and 5 time steps.
#> 
#> The dataset contains a total of 74 unique individuals and 320 unique transitions.
#> 
#> Survival probability sum check (each matrix represented by column in order):
#>          [,1]  [,2]  [,3]  [,4]  [,5]
#> Min.    0.000 0.100 0.100 0.000 0.100
#> 1st Qu. 0.100 0.140 0.140 0.100 0.140
#> Median  0.746 0.870 0.864 0.600 0.882
#> Mean    0.562 0.642 0.627 0.532 0.615
#> 3rd Qu. 1.000 1.000 1.000 0.960 1.000
#> Max.    1.000 1.000 1.000 1.000 1.000

Notice what happened here. The first call to rlefko2() yielded 15 matrices, because there are three patches in our dataset, and there are a total of six years of data, yielding five transitions between years (also referred to as time steps or periods). So, there are \(3 \times 5 = 15\) matrices. But in the second call, we no longer recognize patches and so have only estimated one set of five matrices covering the whole population. We can also focus in on specific patches and specific sets of years, setting the options appropriately.

Now let’s estimate a raw, historical MPM, using the rlefko3() function.

cypmatrix3rp <- rlefko3(data = cypraw_v1, stageframe = cypframe_raw,
  year = "all", patch = "all", stages = c("stage3", "stage2", "stage1"), 
  size = c("size3added", "size2added", "size1added"), supplement = cypsupp3_raw, 
  yearcol = "year2", patchcol = "patchid", indivcol = "individ")

summary(cypmatrix3rp)
#> 
#> This historical lefkoMat object contains 12 matrices.
#> 
#> Each matrix is square with 121 rows and columns, and a total of 14641 elements.
#> A total of 386 survival transitions were estimated, with 32.167 per matrix.
#> A total of 68 fecundity transitions were estimated, with 5.667 per matrix.
#> This lefkoMat object covers 1 population, 3 patches, and 4 time steps.
#> 
#> The dataset contains a total of 74 unique individuals and 320 unique transitions.
#> 
#> Survival probability sum check (each matrix represented by column in order):
#>           [,1]   [,2]   [,3]   [,4]  [,5] [,6]  [,7]  [,8]   [,9] [,10]  [,11]
#> Min.    0.0000 0.0000 0.0000 0.0000 0.000 0.00 0.000 0.000 0.0000 0.000 0.0000
#> 1st Qu. 0.0000 0.0000 0.0000 0.0000 0.000 0.00 0.000 0.000 0.0000 0.000 0.0000
#> Median  0.0000 0.0000 0.0000 0.0000 0.000 0.00 0.000 0.000 0.0000 0.000 0.0000
#> Mean    0.0862 0.0706 0.0665 0.0754 0.124 0.13 0.123 0.135 0.0968 0.072 0.0968
#> 3rd Qu. 0.0000 0.0000 0.0000 0.0000 0.000 0.00 0.000 0.000 0.0000 0.000 0.0000
#> Max.    1.0000 1.0000 1.0000 1.0000 1.000 1.00 1.000 1.000 1.0500 1.000 1.0000
#>         [,12]
#> Min.    0.000
#> 1st Qu. 0.000
#> Median  0.000
#> Mean    0.113
#> 3rd Qu. 0.000
#> Max.    1.000
#> Warning: Some matrices include stages with survival probability greater than
#> 1.0.

Quickly scanning this output shows a number of important differences. First, there are three fewer matrices here than in the ahistorical case. There are three patches that we are estimating matrices for, and six years of data for each patch, leading to five possible ahistorical time steps and 15 possible ahistorical matrices. Since historical matrices require three consecutive years of transition data to estimate a single matrix element, only four historical transitions are possible per patch, leading to 12 total historical matrices. Second, the dimensionality of the matrices is the square of the dimensions of the ahistorical matrices. This leads to vastly more matrix elements within each matrix, although it turns out that most of these matrix elements are structural zeros because they reflect impossible transitions. Indeed, in this case, although there are 14,641 elements in each matrix, on average only 37.83 are actually estimated to values greater than zero. Finally, we see that one of our matrices has a survival probability greater than 1.0. This is a problem for us, and normally we would need to correct the situation via the supplemental table. However, for the time being we will proceed without any correction (no other MPMs here will have this problem).

Let’s look at the first historical matrix, corresponding to the transition from 2004 and 2005 to 2006 in the first patch. Because this is a huge matrix, we will only look at the top corner, followed by a middle section. The full matrix is not shown here, but we can focus on portions of it if we wish. These matrices may also be exported to Excel or another spreadsheet program to look over in detail. Particularly note the sparseness - most elements are zeros, because most transitions are actually impossible.

cypmatrix3rp$A[[1]][1:20,1:10]
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
#>  [1,] 0.01  0.0    0    0    0    0    0    0    0     0
#>  [2,] 0.10  0.0    0    0    0    0    0    0    0     0
#>  [3,] 0.00  0.0    0    0    0    0    0    0    0     0
#>  [4,] 0.00  0.0    0    0    0    0    0    0    0     0
#>  [5,] 0.00  0.0    0    0    0    0    0    0    0     0
#>  [6,] 0.00  0.0    0    0    0    0    0    0    0     0
#>  [7,] 0.00  0.0    0    0    0    0    0    0    0     0
#>  [8,] 0.00  0.0    0    0    0    0    0    0    0     0
#>  [9,] 0.00  0.0    0    0    0    0    0    0    0     0
#> [10,] 0.00  0.0    0    0    0    0    0    0    0     0
#> [11,] 0.00  0.0    0    0    0    0    0    0    0     0
#> [12,] 0.00  0.0    0    0    0    0    0    0    0     0
#> [13,] 0.00  0.0    0    0    0    0    0    0    0     0
#> [14,] 0.00  0.1    0    0    0    0    0    0    0     0
#> [15,] 0.00  0.0    0    0    0    0    0    0    0     0
#> [16,] 0.00  0.0    0    0    0    0    0    0    0     0
#> [17,] 0.00  0.0    0    0    0    0    0    0    0     0
#> [18,] 0.00  0.0    0    0    0    0    0    0    0     0
#> [19,] 0.00  0.0    0    0    0    0    0    0    0     0
#> [20,] 0.00  0.0    0    0    0    0    0    0    0     0
print(cypmatrix3rp$A[[1]][66:85,73:81], digits = 3)
#>          [,1]     [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
#>  [1,]   0.000    0.000    0    0    0    0    0    0    0
#>  [2,] 357.143    0.000    0    0    0    0    0    0    0
#>  [3,] 357.143    0.000    0    0    0    0    0    0    0
#>  [4,]   0.000    0.000    0    0    0    0    0    0    0
#>  [5,]   0.000    0.000    0    0    0    0    0    0    0
#>  [6,]   0.000    0.000    0    0    0    0    0    0    0
#>  [7,]   0.143    0.000    0    0    0    0    0    0    0
#>  [8,]   0.714    0.000    0    0    0    0    0    0    0
#>  [9,]   0.000    0.000    0    0    0    0    0    0    0
#> [10,]   0.000    0.000    0    0    0    0    0    0    0
#> [11,]   0.000    0.000    0    0    0    0    0    0    0
#> [12,]   0.000    0.000    0    0    0    0    0    0    0
#> [13,]   0.000 1666.667    0    0    0    0    0    0    0
#> [14,]   0.000 1666.667    0    0    0    0    0    0    0
#> [15,]   0.000    0.000    0    0    0    0    0    0    0
#> [16,]   0.000    0.000    0    0    0    0    0    0    0
#> [17,]   0.000    0.000    0    0    0    0    0    0    0
#> [18,]   0.000    0.000    0    0    0    0    0    0    0
#> [19,]   0.000    0.667    0    0    0    0    0    0    0
#> [20,]   0.000    0.333    0    0    0    0    0    0    0

Now let’s estimate the function-based matrices. Let’s start off with the ahistorical function-based matrix. Note that we have far fewer terms required to build a basic function-based MPM than to build a raw MPM, because so much of the parameterization is coded within the lefkoMod object holding the vital rate models.

cypmatrix2fp <- flefko2(stageframe = cypframe_fb, supplement = cypsupp2_fb, 
  modelsuite = cypmodels2p, data = cypfb_env)

summary(cypmatrix2fp)
#> 
#> This ahistorical lefkoMat object contains 15 matrices.
#> 
#> Each matrix is square with 54 rows and columns, and a total of 2916 elements.
#> A total of 36150 survival transitions were estimated, with 2410 per matrix.
#> A total of 720 fecundity transitions were estimated, with 48 per matrix.
#> This lefkoMat object covers 1 population, 3 patches, and 5 time steps.
#> 
#> Vital rate modeling quality control:
#> 
#> Survival estimated with 74 individuals and 320 individual transitions.
#> Observation estimated with 70 individuals and 303 individual transitions.
#> Primary size estimated with 70 individuals and 288 individual transitions.
#> Secondary size transition not estimated.
#> Tertiary size transition not estimated.
#> Reproductive status estimated with 70 individuals and 288 individual transitions.
#> Fecundity estimated with 51 individuals and 118 individual transitions.
#> Juvenile survival not estimated.
#> Juvenile observation probability not estimated.
#> Juvenile primary size transition not estimated.
#> Juvenile secondary size transition not estimated.
#> Juvenile tertiary size transition not estimated.
#> Juvenile reproduction probability not estimated.
#> Juvenile maturity transition probability not estimated.
#> 
#> Survival probability sum check (each matrix represented by column in order):
#>          [,1]  [,2]  [,3]  [,4]  [,5]  [,6]  [,7]  [,8]  [,9] [,10] [,11] [,12]
#> Min.    0.100 0.100 0.100 0.100 0.100 0.100 0.100 0.100 0.100 0.100 0.100 0.100
#> 1st Qu. 0.991 0.991 0.991 0.991 0.991 0.991 0.991 0.991 0.991 0.991 0.991 0.991
#> Median  0.999 1.000 1.000 1.000 0.999 0.998 1.000 0.999 0.999 0.999 0.997 0.999
#> Mean    0.918 0.920 0.920 0.920 0.916 0.917 0.920 0.919 0.919 0.916 0.915 0.919
#> 3rd Qu. 1.000 1.000 1.000 1.000 1.000 0.999 1.000 1.000 1.000 0.999 0.999 1.000
#> Max.    1.000 1.000 1.000 1.000 1.000 0.999 1.000 1.000 1.000 1.000 0.999 1.000
#>         [,13] [,14] [,15]
#> Min.    0.100 0.100 0.100
#> 1st Qu. 0.991 0.991 0.991
#> Median  0.999 0.998 0.997
#> Mean    0.918 0.918 0.914
#> 3rd Qu. 0.999 0.999 0.999
#> Max.    1.000 0.999 0.999

Here we have the same number of patches, and patch-level matrices were estimated without us needing to specify anything because patch was a factor in the vital rate models. The same number of matrices were created as in the raw case, but the raw MPM process yielded an average of 21.667 estimated transitions and only 11 rows and 11 columns per matrix. In contrast, the function-based MPM process led to 2,458 elements and 54 rows and 54 columns per matrix. This happens because we are using a different life history model with many more stagesm and because we are using our vital rate models to propagate every matrix element that is biologically possible. To see the impact, let’s compare the first raw matrix to the first function-based matrix, as below.

writeLines("First matrix in raw ahMPM:")
#> First matrix in raw ahMPM:
print(cypmatrix2rp$A[[1]], digits = 3)
#>       [,1] [,2] [,3] [,4]  [,5] [,6]  [,7]  [,8]     [,9] [,10] [,11]
#>  [1,] 0.03  0.0  0.0  0.0 0.000    0 0.000 500.0 1666.667     0     0
#>  [2,] 0.15  0.0  0.0  0.0 0.000    0 0.000 500.0 1666.667     0     0
#>  [3,] 0.00  0.1  0.0  0.0 0.000    0 0.000   0.0    0.000     0     0
#>  [4,] 0.00  0.0  0.1  0.0 0.000    0 0.000   0.0    0.000     0     0
#>  [5,] 0.00  0.0  0.0  0.1 0.050    0 0.000   0.0    0.000     0     0
#>  [6,] 0.00  0.0  0.0  0.0 0.000    0 0.000   0.0    0.000     0     0
#>  [7,] 0.00  0.0  0.0  0.0 0.636    0 0.636   0.2    0.000     0     0
#>  [8,] 0.00  0.0  0.0  0.0 0.000    0 0.273   0.6    0.667     1     0
#>  [9,] 0.00  0.0  0.0  0.0 0.000    0 0.000   0.2    0.333     0     0
#> [10,] 0.00  0.0  0.0  0.0 0.000    0 0.000   0.0    0.000     0     0
#> [11,] 0.00  0.0  0.0  0.0 0.000    0 0.000   0.0    0.000     0     0
writeLines("\nFirst matrix in function-based ahMPM:")
#> 
#> First matrix in function-based ahMPM:
print(cypmatrix2fp$A[[1]], digits = 3)
#>       [,1] [,2] [,3] [,4]  [,5]     [,6]     [,7]     [,8]     [,9]    [,10]
#>  [1,] 0.03  0.0  0.0  0.0 0.000 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [2,] 0.15  0.0  0.0  0.0 0.000 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [3,] 0.00  0.1  0.0  0.0 0.000 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [4,] 0.00  0.0  0.1  0.0 0.000 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [5,] 0.00  0.0  0.0  0.1 0.050 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [6,] 0.00  0.0  0.0  0.0 0.047 4.70e-02 3.69e-02 2.81e-02 2.10e-02 1.56e-02
#>  [7,] 0.00  0.0  0.0  0.0 0.237 2.37e-01 2.40e-01 2.34e-01 2.23e-01 2.09e-01
#>  [8,] 0.00  0.0  0.0  0.0 0.149 1.49e-01 1.52e-01 1.50e-01 1.44e-01 1.36e-01
#>  [9,] 0.00  0.0  0.0  0.0 0.000 9.37e-02 9.63e-02 9.55e-02 9.25e-02 8.80e-02
#> [10,] 0.00  0.0  0.0  0.0 0.000 5.89e-02 6.11e-02 6.10e-02 5.96e-02 5.71e-02
#> [11,] 0.00  0.0  0.0  0.0 0.000 3.71e-02 3.87e-02 3.90e-02 3.84e-02 3.71e-02
#> [12,] 0.00  0.0  0.0  0.0 0.000 2.33e-02 2.45e-02 2.49e-02 2.47e-02 2.41e-02
#> [13,] 0.00  0.0  0.0  0.0 0.000 1.47e-02 1.56e-02 1.59e-02 1.59e-02 1.56e-02
#> [14,] 0.00  0.0  0.0  0.0 0.000 9.22e-03 9.86e-03 1.02e-02 1.02e-02 1.01e-02
#> [15,] 0.00  0.0  0.0  0.0 0.000 5.80e-03 6.25e-03 6.50e-03 6.60e-03 6.58e-03
#> [16,] 0.00  0.0  0.0  0.0 0.000 3.64e-03 3.96e-03 4.16e-03 4.25e-03 4.27e-03
#> [17,] 0.00  0.0  0.0  0.0 0.000 2.29e-03 2.51e-03 2.66e-03 2.74e-03 2.77e-03
#> [18,] 0.00  0.0  0.0  0.0 0.000 1.44e-03 1.59e-03 1.70e-03 1.76e-03 1.80e-03
#> [19,] 0.00  0.0  0.0  0.0 0.000 9.06e-04 1.01e-03 1.08e-03 1.14e-03 1.17e-03
#> [20,] 0.00  0.0  0.0  0.0 0.000 5.70e-04 6.40e-04 6.93e-04 7.31e-04 7.58e-04
#> [21,] 0.00  0.0  0.0  0.0 0.000 3.58e-04 4.06e-04 4.43e-04 4.71e-04 4.92e-04
#> [22,] 0.00  0.0  0.0  0.0 0.000 2.25e-04 2.57e-04 2.83e-04 3.03e-04 3.19e-04
#> [23,] 0.00  0.0  0.0  0.0 0.000 1.42e-04 1.63e-04 1.81e-04 1.95e-04 2.07e-04
#> [24,] 0.00  0.0  0.0  0.0 0.000 8.91e-05 1.03e-04 1.15e-04 1.26e-04 1.34e-04
#> [25,] 0.00  0.0  0.0  0.0 0.000 5.60e-05 6.55e-05 7.38e-05 8.10e-05 8.73e-05
#> [26,] 0.00  0.0  0.0  0.0 0.000 3.52e-05 4.15e-05 4.72e-05 5.22e-05 5.66e-05
#> [27,] 0.00  0.0  0.0  0.0 0.000 2.21e-05 2.63e-05 3.01e-05 3.36e-05 3.68e-05
#> [28,] 0.00  0.0  0.0  0.0 0.000 1.39e-05 1.67e-05 1.93e-05 2.16e-05 2.39e-05
#> [29,] 0.00  0.0  0.0  0.0 0.000 8.76e-06 1.06e-05 1.23e-05 1.39e-05 1.55e-05
#> [30,] 0.00  0.0  0.0  0.0 0.000 5.51e-06 6.70e-06 7.86e-06 8.98e-06 1.00e-05
#> [31,] 0.00  0.0  0.0  0.0 0.000 7.38e-02 8.92e-02 1.04e-01 1.19e-01 1.33e-01
#> [32,] 0.00  0.0  0.0  0.0 0.000 4.64e-02 5.65e-02 6.65e-02 7.64e-02 8.63e-02
#> [33,] 0.00  0.0  0.0  0.0 0.000 2.92e-02 3.58e-02 4.25e-02 4.92e-02 5.60e-02
#> [34,] 0.00  0.0  0.0  0.0 0.000 1.83e-02 2.27e-02 2.72e-02 3.17e-02 3.63e-02
#> [35,] 0.00  0.0  0.0  0.0 0.000 1.15e-02 1.44e-02 1.74e-02 2.04e-02 2.36e-02
#> [36,] 0.00  0.0  0.0  0.0 0.000 7.25e-03 9.13e-03 1.11e-02 1.31e-02 1.53e-02
#> [37,] 0.00  0.0  0.0  0.0 0.000 4.56e-03 5.79e-03 7.09e-03 8.47e-03 9.94e-03
#> [38,] 0.00  0.0  0.0  0.0 0.000 2.87e-03 3.67e-03 4.53e-03 5.45e-03 6.45e-03
#> [39,] 0.00  0.0  0.0  0.0 0.000 1.80e-03 2.33e-03 2.89e-03 3.51e-03 4.18e-03
#> [40,] 0.00  0.0  0.0  0.0 0.000 1.13e-03 1.47e-03 1.85e-03 2.26e-03 2.72e-03
#> [41,] 0.00  0.0  0.0  0.0 0.000 7.13e-04 9.34e-04 1.18e-03 1.46e-03 1.76e-03
#> [42,] 0.00  0.0  0.0  0.0 0.000 4.48e-04 5.92e-04 7.55e-04 9.38e-04 1.14e-03
#> [43,] 0.00  0.0  0.0  0.0 0.000 2.82e-04 3.75e-04 4.82e-04 6.04e-04 7.43e-04
#> [44,] 0.00  0.0  0.0  0.0 0.000 1.77e-04 2.38e-04 3.08e-04 3.89e-04 4.82e-04
#> [45,] 0.00  0.0  0.0  0.0 0.000 1.11e-04 1.51e-04 1.97e-04 2.51e-04 3.13e-04
#> [46,] 0.00  0.0  0.0  0.0 0.000 7.01e-05 9.56e-05 1.26e-04 1.61e-04 2.03e-04
#> [47,] 0.00  0.0  0.0  0.0 0.000 4.41e-05 6.06e-05 8.04e-05 1.04e-04 1.32e-04
#> [48,] 0.00  0.0  0.0  0.0 0.000 2.77e-05 3.84e-05 5.14e-05 6.69e-05 8.55e-05
#> [49,] 0.00  0.0  0.0  0.0 0.000 1.74e-05 2.44e-05 3.28e-05 4.31e-05 5.55e-05
#> [50,] 0.00  0.0  0.0  0.0 0.000 1.10e-05 1.54e-05 2.10e-05 2.78e-05 3.60e-05
#> [51,] 0.00  0.0  0.0  0.0 0.000 6.89e-06 9.79e-06 1.34e-05 1.79e-05 2.34e-05
#> [52,] 0.00  0.0  0.0  0.0 0.000 4.33e-06 6.21e-06 8.56e-06 1.15e-05 1.52e-05
#> [53,] 0.00  0.0  0.0  0.0 0.000 2.72e-06 3.93e-06 5.47e-06 7.41e-06 9.85e-06
#> [54,] 0.00  0.0  0.0  0.0 0.000 1.71e-06 2.49e-06 3.50e-06 4.77e-06 6.39e-06
#>          [,11]    [,12]    [,13]    [,14]    [,15]    [,16]    [,17]    [,18]
#>  [1,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [2,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [3,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [4,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [5,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [6,] 1.15e-02 8.47e-03 6.21e-03 4.55e-03 3.33e-03 2.44e-03 1.78e-03 1.30e-03
#>  [7,] 1.93e-01 1.77e-01 1.60e-01 1.43e-01 1.27e-01 1.12e-01 9.81e-02 8.52e-02
#>  [8,] 1.26e-01 1.16e-01 1.06e-01 9.58e-02 8.57e-02 7.61e-02 6.70e-02 5.86e-02
#>  [9,] 8.26e-02 7.67e-02 7.04e-02 6.41e-02 5.78e-02 5.16e-02 4.58e-02 4.03e-02
#> [10,] 5.40e-02 5.05e-02 4.67e-02 4.28e-02 3.89e-02 3.50e-02 3.13e-02 2.77e-02
#> [11,] 3.53e-02 3.33e-02 3.10e-02 2.86e-02 2.62e-02 2.38e-02 2.14e-02 1.91e-02
#> [12,] 2.31e-02 2.19e-02 2.06e-02 1.92e-02 1.76e-02 1.61e-02 1.46e-02 1.31e-02
#> [13,] 1.51e-02 1.45e-02 1.37e-02 1.28e-02 1.19e-02 1.09e-02 9.97e-03 9.03e-03
#> [14,] 9.89e-03 9.53e-03 9.08e-03 8.57e-03 8.01e-03 7.42e-03 6.81e-03 6.21e-03
#> [15,] 6.47e-03 6.28e-03 6.03e-03 5.73e-03 5.39e-03 5.03e-03 4.65e-03 4.27e-03
#> [16,] 4.23e-03 4.14e-03 4.00e-03 3.83e-03 3.63e-03 3.41e-03 3.18e-03 2.94e-03
#> [17,] 2.77e-03 2.73e-03 2.66e-03 2.56e-03 2.45e-03 2.32e-03 2.17e-03 2.02e-03
#> [18,] 1.81e-03 1.80e-03 1.76e-03 1.71e-03 1.65e-03 1.57e-03 1.48e-03 1.39e-03
#> [19,] 1.18e-03 1.18e-03 1.17e-03 1.15e-03 1.11e-03 1.07e-03 1.01e-03 9.56e-04
#> [20,] 7.74e-04 7.80e-04 7.77e-04 7.66e-04 7.48e-04 7.23e-04 6.92e-04 6.57e-04
#> [21,] 5.06e-04 5.14e-04 5.16e-04 5.12e-04 5.04e-04 4.90e-04 4.73e-04 4.52e-04
#> [22,] 3.31e-04 3.39e-04 3.42e-04 3.43e-04 3.39e-04 3.33e-04 3.23e-04 3.11e-04
#> [23,] 2.16e-04 2.23e-04 2.27e-04 2.29e-04 2.28e-04 2.26e-04 2.21e-04 2.14e-04
#> [24,] 1.42e-04 1.47e-04 1.51e-04 1.53e-04 1.54e-04 1.53e-04 1.51e-04 1.47e-04
#> [25,] 9.26e-05 9.69e-05 1.00e-04 1.02e-04 1.04e-04 1.04e-04 1.03e-04 1.01e-04
#> [26,] 6.05e-05 6.38e-05 6.65e-05 6.85e-05 6.98e-05 7.04e-05 7.03e-05 6.96e-05
#> [27,] 3.96e-05 4.21e-05 4.42e-05 4.58e-05 4.70e-05 4.78e-05 4.81e-05 4.79e-05
#> [28,] 2.59e-05 2.77e-05 2.93e-05 3.06e-05 3.17e-05 3.24e-05 3.28e-05 3.29e-05
#> [29,] 1.69e-05 1.83e-05 1.95e-05 2.05e-05 2.13e-05 2.20e-05 2.24e-05 2.27e-05
#> [30,] 1.11e-05 1.20e-05 1.29e-05 1.37e-05 1.44e-05 1.49e-05 1.53e-05 1.56e-05
#> [31,] 1.47e-01 1.61e-01 1.74e-01 1.86e-01 1.98e-01 2.09e-01 2.18e-01 2.27e-01
#> [32,] 9.61e-02 1.06e-01 1.15e-01 1.25e-01 1.33e-01 1.41e-01 1.49e-01 1.56e-01
#> [33,] 6.28e-02 6.97e-02 7.66e-02 8.33e-02 8.98e-02 9.60e-02 1.02e-01 1.07e-01
#> [34,] 4.11e-02 4.59e-02 5.08e-02 5.57e-02 6.05e-02 6.51e-02 6.95e-02 7.37e-02
#> [35,] 2.69e-02 3.03e-02 3.37e-02 3.72e-02 4.07e-02 4.42e-02 4.75e-02 5.07e-02
#> [36,] 1.76e-02 2.00e-02 2.24e-02 2.49e-02 2.74e-02 3.00e-02 3.25e-02 3.49e-02
#> [37,] 1.15e-02 1.31e-02 1.49e-02 1.67e-02 1.85e-02 2.03e-02 2.22e-02 2.40e-02
#> [38,] 7.52e-03 8.66e-03 9.87e-03 1.11e-02 1.24e-02 1.38e-02 1.51e-02 1.65e-02
#> [39,] 4.92e-03 5.71e-03 6.55e-03 7.45e-03 8.38e-03 9.35e-03 1.03e-02 1.13e-02
#> [40,] 3.22e-03 3.76e-03 4.35e-03 4.98e-03 5.65e-03 6.34e-03 7.07e-03 7.81e-03
#> [41,] 2.10e-03 2.48e-03 2.89e-03 3.33e-03 3.80e-03 4.30e-03 4.83e-03 5.37e-03
#> [42,] 1.38e-03 1.63e-03 1.92e-03 2.23e-03 2.56e-03 2.92e-03 3.30e-03 3.69e-03
#> [43,] 9.00e-04 1.08e-03 1.27e-03 1.49e-03 1.73e-03 1.98e-03 2.25e-03 2.54e-03
#> [44,] 5.88e-04 7.09e-04 8.45e-04 9.96e-04 1.16e-03 1.34e-03 1.54e-03 1.75e-03
#> [45,] 3.85e-04 4.67e-04 5.61e-04 6.66e-04 7.83e-04 9.11e-04 1.05e-03 1.20e-03
#> [46,] 2.52e-04 3.08e-04 3.72e-04 4.45e-04 5.27e-04 6.18e-04 7.18e-04 8.27e-04
#> [47,] 1.65e-04 2.03e-04 2.47e-04 2.98e-04 3.55e-04 4.19e-04 4.91e-04 5.69e-04
#> [48,] 1.08e-04 1.34e-04 1.64e-04 1.99e-04 2.39e-04 2.84e-04 3.35e-04 3.91e-04
#> [49,] 7.04e-05 8.81e-05 1.09e-04 1.33e-04 1.61e-04 1.93e-04 2.29e-04 2.69e-04
#> [50,] 4.60e-05 5.81e-05 7.23e-05 8.91e-05 1.09e-04 1.31e-04 1.56e-04 1.85e-04
#> [51,] 3.01e-05 3.83e-05 4.80e-05 5.96e-05 7.31e-05 8.88e-05 1.07e-04 1.27e-04
#> [52,] 1.97e-05 2.52e-05 3.19e-05 3.98e-05 4.92e-05 6.02e-05 7.30e-05 8.76e-05
#> [53,] 1.29e-05 1.66e-05 2.12e-05 2.66e-05 3.32e-05 4.09e-05 4.98e-05 6.02e-05
#> [54,] 8.42e-06 1.09e-05 1.40e-05 1.78e-05 2.23e-05 2.77e-05 3.41e-05 4.14e-05
#>          [,19]    [,20]    [,21]    [,22]    [,23]    [,24]    [,25]    [,26]
#>  [1,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [2,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [3,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [4,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [5,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [6,] 9.54e-04 6.97e-04 5.10e-04 3.73e-04 2.72e-04 1.99e-04 1.46e-04 1.06e-04
#>  [7,] 7.35e-02 6.30e-02 5.38e-02 4.56e-02 3.86e-02 3.25e-02 2.72e-02 2.28e-02
#>  [8,] 5.09e-02 4.39e-02 3.77e-02 3.22e-02 2.74e-02 2.32e-02 1.96e-02 1.65e-02
#>  [9,] 3.53e-02 3.06e-02 2.65e-02 2.28e-02 1.95e-02 1.66e-02 1.41e-02 1.19e-02
#> [10,] 2.44e-02 2.14e-02 1.86e-02 1.61e-02 1.38e-02 1.19e-02 1.02e-02 8.65e-03
#> [11,] 1.69e-02 1.49e-02 1.30e-02 1.14e-02 9.85e-03 8.50e-03 7.31e-03 6.26e-03
#> [12,] 1.17e-02 1.04e-02 9.15e-03 8.02e-03 7.00e-03 6.08e-03 5.26e-03 4.54e-03
#> [13,] 8.11e-03 7.24e-03 6.42e-03 5.67e-03 4.98e-03 4.35e-03 3.79e-03 3.29e-03
#> [14,] 5.62e-03 5.05e-03 4.51e-03 4.00e-03 3.54e-03 3.11e-03 2.73e-03 2.38e-03
#> [15,] 3.89e-03 3.52e-03 3.16e-03 2.83e-03 2.51e-03 2.23e-03 1.96e-03 1.72e-03
#> [16,] 2.69e-03 2.45e-03 2.22e-03 2.00e-03 1.79e-03 1.59e-03 1.41e-03 1.25e-03
#> [17,] 1.87e-03 1.71e-03 1.56e-03 1.41e-03 1.27e-03 1.14e-03 1.02e-03 9.04e-04
#> [18,] 1.29e-03 1.19e-03 1.09e-03 9.96e-04 9.03e-04 8.15e-04 7.32e-04 6.54e-04
#> [19,] 8.95e-04 8.31e-04 7.67e-04 7.04e-04 6.42e-04 5.83e-04 5.27e-04 4.74e-04
#> [20,] 6.19e-04 5.79e-04 5.38e-04 4.97e-04 4.56e-04 4.17e-04 3.79e-04 3.43e-04
#> [21,] 4.29e-04 4.04e-04 3.78e-04 3.51e-04 3.24e-04 2.98e-04 2.73e-04 2.49e-04
#> [22,] 2.97e-04 2.82e-04 2.65e-04 2.48e-04 2.31e-04 2.13e-04 1.96e-04 1.80e-04
#> [23,] 2.06e-04 1.96e-04 1.86e-04 1.75e-04 1.64e-04 1.53e-04 1.41e-04 1.30e-04
#> [24,] 1.42e-04 1.37e-04 1.31e-04 1.24e-04 1.17e-04 1.09e-04 1.02e-04 9.44e-05
#> [25,] 9.87e-05 9.54e-05 9.16e-05 8.74e-05 8.28e-05 7.81e-05 7.32e-05 6.84e-05
#> [26,] 6.83e-05 6.65e-05 6.43e-05 6.17e-05 5.89e-05 5.59e-05 5.27e-05 4.95e-05
#> [27,] 4.73e-05 4.64e-05 4.51e-05 4.36e-05 4.19e-05 4.00e-05 3.79e-05 3.58e-05
#> [28,] 3.28e-05 3.23e-05 3.17e-05 3.08e-05 2.98e-05 2.86e-05 2.73e-05 2.60e-05
#> [29,] 2.27e-05 2.25e-05 2.22e-05 2.18e-05 2.12e-05 2.04e-05 1.97e-05 1.88e-05
#> [30,] 1.57e-05 1.57e-05 1.56e-05 1.54e-05 1.50e-05 1.46e-05 1.41e-05 1.36e-05
#> [31,] 2.34e-01 2.40e-01 2.44e-01 2.48e-01 2.51e-01 2.52e-01 2.53e-01 2.53e-01
#> [32,] 1.62e-01 1.67e-01 1.71e-01 1.75e-01 1.78e-01 1.80e-01 1.82e-01 1.83e-01
#> [33,] 1.12e-01 1.16e-01 1.20e-01 1.24e-01 1.27e-01 1.29e-01 1.31e-01 1.33e-01
#> [34,] 7.76e-02 8.12e-02 8.44e-02 8.74e-02 9.00e-02 9.23e-02 9.43e-02 9.61e-02
#> [35,] 5.37e-02 5.66e-02 5.93e-02 6.17e-02 6.40e-02 6.60e-02 6.79e-02 6.96e-02
#> [36,] 3.72e-02 3.95e-02 4.16e-02 4.36e-02 4.55e-02 4.72e-02 4.89e-02 5.04e-02
#> [37,] 2.58e-02 2.75e-02 2.92e-02 3.08e-02 3.23e-02 3.38e-02 3.52e-02 3.65e-02
#> [38,] 1.78e-02 1.92e-02 2.05e-02 2.17e-02 2.30e-02 2.42e-02 2.53e-02 2.64e-02
#> [39,] 1.24e-02 1.34e-02 1.44e-02 1.54e-02 1.63e-02 1.73e-02 1.82e-02 1.91e-02
#> [40,] 8.56e-03 9.32e-03 1.01e-02 1.09e-02 1.16e-02 1.24e-02 1.31e-02 1.39e-02
#> [41,] 5.93e-03 6.50e-03 7.08e-03 7.66e-03 8.25e-03 8.85e-03 9.44e-03 1.00e-02
#> [42,] 4.11e-03 4.53e-03 4.97e-03 5.41e-03 5.87e-03 6.33e-03 6.80e-03 7.27e-03
#> [43,] 2.84e-03 3.16e-03 3.49e-03 3.82e-03 4.17e-03 4.53e-03 4.89e-03 5.26e-03
#> [44,] 1.97e-03 2.20e-03 2.45e-03 2.70e-03 2.97e-03 3.24e-03 3.52e-03 3.81e-03
#> [45,] 1.36e-03 1.54e-03 1.72e-03 1.91e-03 2.11e-03 2.32e-03 2.53e-03 2.76e-03
#> [46,] 9.44e-04 1.07e-03 1.20e-03 1.35e-03 1.50e-03 1.66e-03 1.82e-03 2.00e-03
#> [47,] 6.54e-04 7.46e-04 8.45e-04 9.52e-04 1.07e-03 1.19e-03 1.31e-03 1.45e-03
#> [48,] 4.53e-04 5.20e-04 5.93e-04 6.72e-04 7.57e-04 8.48e-04 9.45e-04 1.05e-03
#> [49,] 3.14e-04 3.63e-04 4.16e-04 4.75e-04 5.38e-04 6.07e-04 6.80e-04 7.59e-04
#> [50,] 2.17e-04 2.53e-04 2.92e-04 3.35e-04 3.83e-04 4.34e-04 4.90e-04 5.50e-04
#> [51,] 1.50e-04 1.76e-04 2.05e-04 2.37e-04 2.72e-04 3.10e-04 3.52e-04 3.98e-04
#> [52,] 1.04e-04 1.23e-04 1.44e-04 1.67e-04 1.93e-04 2.22e-04 2.54e-04 2.88e-04
#> [53,] 7.21e-05 8.57e-05 1.01e-04 1.18e-04 1.37e-04 1.59e-04 1.83e-04 2.09e-04
#> [54,] 5.00e-05 5.97e-05 7.09e-05 8.35e-05 9.77e-05 1.14e-04 1.31e-04 1.51e-04
#>          [,27]    [,28]    [,29]    [,30]    [,31]    [,32]    [,33]    [,34]
#>  [1,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 2.31e+03 1.77e+03 8.24e+02 2.26e+02
#>  [2,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 2.31e+03 1.77e+03 8.24e+02 2.26e+02
#>  [3,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [4,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [5,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [6,] 7.78e-05 5.69e-05 4.16e-05 3.04e-05 3.69e-02 2.81e-02 2.10e-02 1.56e-02
#>  [7,] 1.90e-02 1.58e-02 1.31e-02 1.09e-02 1.19e-01 1.09e-01 9.72e-02 8.53e-02
#>  [8,] 1.38e-02 1.16e-02 9.69e-03 8.09e-03 7.55e-02 6.96e-02 6.26e-02 5.53e-02
#>  [9,] 1.01e-02 8.50e-03 7.14e-03 6.00e-03 4.79e-02 4.45e-02 4.03e-02 3.59e-02
#> [10,] 7.35e-03 6.23e-03 5.27e-03 4.44e-03 3.04e-02 2.84e-02 2.60e-02 2.33e-02
#> [11,] 5.35e-03 4.56e-03 3.88e-03 3.30e-03 1.92e-02 1.82e-02 1.67e-02 1.51e-02
#> [12,] 3.90e-03 3.34e-03 2.86e-03 2.44e-03 1.22e-02 1.16e-02 1.08e-02 9.82e-03
#> [13,] 2.84e-03 2.45e-03 2.11e-03 1.81e-03 7.73e-03 7.41e-03 6.93e-03 6.37e-03
#> [14,] 2.07e-03 1.80e-03 1.55e-03 1.34e-03 4.90e-03 4.74e-03 4.46e-03 4.14e-03
#> [15,] 1.51e-03 1.32e-03 1.15e-03 9.95e-04 3.11e-03 3.03e-03 2.88e-03 2.68e-03
#> [16,] 1.10e-03 9.65e-04 8.45e-04 7.38e-04 1.97e-03 1.93e-03 1.85e-03 1.74e-03
#> [17,] 8.01e-04 7.07e-04 6.23e-04 5.47e-04 1.25e-03 1.24e-03 1.19e-03 1.13e-03
#> [18,] 5.83e-04 5.18e-04 4.59e-04 4.06e-04 7.91e-04 7.90e-04 7.68e-04 7.34e-04
#> [19,] 4.25e-04 3.80e-04 3.38e-04 3.01e-04 5.02e-04 5.04e-04 4.95e-04 4.76e-04
#> [20,] 3.10e-04 2.78e-04 2.49e-04 2.23e-04 3.18e-04 3.22e-04 3.19e-04 3.09e-04
#> [21,] 2.26e-04 2.04e-04 1.84e-04 1.65e-04 2.02e-04 2.06e-04 2.05e-04 2.01e-04
#> [22,] 1.64e-04 1.49e-04 1.36e-04 1.22e-04 1.28e-04 1.32e-04 1.32e-04 1.30e-04
#> [23,] 1.20e-04 1.10e-04 9.99e-05 9.08e-05 8.10e-05 8.41e-05 8.51e-05 8.45e-05
#> [24,] 8.72e-05 8.03e-05 7.36e-05 6.73e-05 5.14e-05 5.37e-05 5.48e-05 5.49e-05
#> [25,] 6.35e-05 5.88e-05 5.43e-05 4.99e-05 3.26e-05 3.43e-05 3.53e-05 3.56e-05
#> [26,] 4.63e-05 4.31e-05 4.00e-05 3.70e-05 2.06e-05 2.19e-05 2.27e-05 2.31e-05
#> [27,] 3.37e-05 3.16e-05 2.95e-05 2.74e-05 1.31e-05 1.40e-05 1.46e-05 1.50e-05
#> [28,] 2.46e-05 2.32e-05 2.17e-05 2.03e-05 8.29e-06 8.96e-06 9.43e-06 9.74e-06
#> [29,] 1.79e-05 1.70e-05 1.60e-05 1.51e-05 5.26e-06 5.72e-06 6.07e-06 6.32e-06
#> [30,] 1.30e-05 1.24e-05 1.18e-05 1.12e-05 3.33e-06 3.66e-06 3.91e-06 4.10e-06
#> [31,] 2.52e-01 2.51e-01 2.50e-01 2.48e-01 2.10e-01 2.29e-01 2.45e-01 2.57e-01
#> [32,] 1.84e-01 1.84e-01 1.84e-01 1.84e-01 1.33e-01 1.46e-01 1.57e-01 1.67e-01
#> [33,] 1.34e-01 1.35e-01 1.36e-01 1.36e-01 8.43e-02 9.36e-02 1.01e-01 1.08e-01
#> [34,] 9.76e-02 9.89e-02 1.00e-01 1.01e-01 5.34e-02 5.98e-02 6.53e-02 7.02e-02
#> [35,] 7.11e-02 7.25e-02 7.37e-02 7.48e-02 3.39e-02 3.82e-02 4.21e-02 4.55e-02
#> [36,] 5.18e-02 5.31e-02 5.43e-02 5.55e-02 2.15e-02 2.44e-02 2.71e-02 2.96e-02
#> [37,] 3.77e-02 3.89e-02 4.01e-02 4.11e-02 1.36e-02 1.56e-02 1.74e-02 1.92e-02
#> [38,] 2.75e-02 2.85e-02 2.95e-02 3.05e-02 8.63e-03 9.97e-03 1.12e-02 1.24e-02
#> [39,] 2.00e-02 2.09e-02 2.18e-02 2.26e-02 5.47e-03 6.37e-03 7.24e-03 8.08e-03
#> [40,] 1.46e-02 1.53e-02 1.60e-02 1.68e-02 3.47e-03 4.07e-03 4.66e-03 5.24e-03
#> [41,] 1.06e-02 1.12e-02 1.18e-02 1.24e-02 2.20e-03 2.60e-03 3.00e-03 3.40e-03
#> [42,] 7.75e-03 8.23e-03 8.72e-03 9.21e-03 1.39e-03 1.66e-03 1.93e-03 2.21e-03
#> [43,] 5.64e-03 6.03e-03 6.43e-03 6.83e-03 8.83e-04 1.06e-03 1.24e-03 1.43e-03
#> [44,] 4.11e-03 4.42e-03 4.74e-03 5.06e-03 5.60e-04 6.79e-04 8.02e-04 9.31e-04
#> [45,] 3.00e-03 3.24e-03 3.49e-03 3.75e-03 3.55e-04 4.34e-04 5.16e-04 6.04e-04
#> [46,] 2.18e-03 2.37e-03 2.57e-03 2.78e-03 2.25e-04 2.77e-04 3.33e-04 3.92e-04
#> [47,] 1.59e-03 1.74e-03 1.90e-03 2.06e-03 1.43e-04 1.77e-04 2.14e-04 2.54e-04
#> [48,] 1.16e-03 1.27e-03 1.40e-03 1.53e-03 9.04e-05 1.13e-04 1.38e-04 1.65e-04
#> [49,] 8.44e-04 9.34e-04 1.03e-03 1.13e-03 5.73e-05 7.23e-05 8.88e-05 1.07e-04
#> [50,] 6.15e-04 6.85e-04 7.60e-04 8.40e-04 3.63e-05 4.62e-05 5.72e-05 6.96e-05
#> [51,] 4.48e-04 5.02e-04 5.60e-04 6.23e-04 2.30e-05 2.95e-05 3.68e-05 4.51e-05
#> [52,] 3.26e-04 3.68e-04 4.13e-04 4.62e-04 1.46e-05 1.89e-05 2.37e-05 2.93e-05
#> [53,] 2.38e-04 2.69e-04 3.04e-04 3.42e-04 9.25e-06 1.20e-05 1.53e-05 1.90e-05
#> [54,] 1.73e-04 1.97e-04 2.24e-04 2.54e-04 5.87e-06 7.70e-06 9.84e-06 1.23e-05
#>          [,35]    [,36]    [,37]    [,38]    [,39]    [,40]    [,41]    [,42]
#>  [1,] 4.94e+01 1.02e+01 2.06e+00 4.18e-01 8.47e-02 1.71e-02 3.47e-03 7.03e-04
#>  [2,] 4.94e+01 1.02e+01 2.06e+00 4.18e-01 8.47e-02 1.71e-02 3.47e-03 7.03e-04
#>  [3,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [4,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [5,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [6,] 1.15e-02 8.47e-03 6.21e-03 4.55e-03 3.33e-03 2.44e-03 1.78e-03 1.30e-03
#>  [7,] 7.40e-02 6.36e-02 5.43e-02 4.61e-02 3.89e-02 3.27e-02 2.75e-02 2.30e-02
#>  [8,] 4.84e-02 4.19e-02 3.60e-02 3.08e-02 2.62e-02 2.22e-02 1.88e-02 1.58e-02
#>  [9,] 3.16e-02 2.76e-02 2.39e-02 2.06e-02 1.77e-02 1.51e-02 1.28e-02 1.09e-02
#> [10,] 2.07e-02 1.82e-02 1.59e-02 1.38e-02 1.19e-02 1.02e-02 8.75e-03 7.47e-03
#> [11,] 1.35e-02 1.20e-02 1.05e-02 9.21e-03 8.01e-03 6.93e-03 5.98e-03 5.14e-03
#> [12,] 8.85e-03 7.90e-03 7.00e-03 6.16e-03 5.40e-03 4.70e-03 4.08e-03 3.54e-03
#> [13,] 5.79e-03 5.21e-03 4.65e-03 4.12e-03 3.63e-03 3.19e-03 2.79e-03 2.43e-03
#> [14,] 3.79e-03 3.43e-03 3.08e-03 2.76e-03 2.45e-03 2.16e-03 1.91e-03 1.67e-03
#> [15,] 2.48e-03 2.26e-03 2.05e-03 1.84e-03 1.65e-03 1.47e-03 1.30e-03 1.15e-03
#> [16,] 1.62e-03 1.49e-03 1.36e-03 1.23e-03 1.11e-03 9.96e-04 8.90e-04 7.91e-04
#> [17,] 1.06e-03 9.81e-04 9.02e-04 8.24e-04 7.48e-04 6.76e-04 6.08e-04 5.44e-04
#> [18,] 6.92e-04 6.47e-04 5.99e-04 5.51e-04 5.04e-04 4.58e-04 4.15e-04 3.74e-04
#> [19,] 4.53e-04 4.26e-04 3.98e-04 3.68e-04 3.39e-04 3.11e-04 2.84e-04 2.58e-04
#> [20,] 2.96e-04 2.81e-04 2.64e-04 2.46e-04 2.29e-04 2.11e-04 1.94e-04 1.77e-04
#> [21,] 1.94e-04 1.85e-04 1.75e-04 1.65e-04 1.54e-04 1.43e-04 1.32e-04 1.22e-04
#> [22,] 1.27e-04 1.22e-04 1.16e-04 1.10e-04 1.04e-04 9.71e-05 9.04e-05 8.38e-05
#> [23,] 8.28e-05 8.03e-05 7.72e-05 7.37e-05 6.98e-05 6.58e-05 6.17e-05 5.76e-05
#> [24,] 5.42e-05 5.29e-05 5.13e-05 4.93e-05 4.70e-05 4.47e-05 4.22e-05 3.97e-05
#> [25,] 3.54e-05 3.49e-05 3.40e-05 3.29e-05 3.17e-05 3.03e-05 2.88e-05 2.73e-05
#> [26,] 2.32e-05 2.30e-05 2.26e-05 2.20e-05 2.13e-05 2.06e-05 1.97e-05 1.88e-05
#> [27,] 1.52e-05 1.51e-05 1.50e-05 1.47e-05 1.44e-05 1.39e-05 1.34e-05 1.29e-05
#> [28,] 9.91e-06 9.98e-06 9.96e-06 9.85e-06 9.68e-06 9.46e-06 9.19e-06 8.88e-06
#> [29,] 6.48e-06 6.58e-06 6.61e-06 6.59e-06 6.52e-06 6.42e-06 6.27e-06 6.11e-06
#> [30,] 4.24e-06 4.33e-06 4.39e-06 4.41e-06 4.39e-06 4.35e-06 4.29e-06 4.20e-06
#> [31,] 2.66e-01 2.74e-01 2.79e-01 2.83e-01 2.86e-01 2.88e-01 2.89e-01 2.89e-01
#> [32,] 1.74e-01 1.80e-01 1.85e-01 1.90e-01 1.93e-01 1.95e-01 1.97e-01 1.99e-01
#> [33,] 1.14e-01 1.19e-01 1.23e-01 1.27e-01 1.30e-01 1.33e-01 1.35e-01 1.37e-01
#> [34,] 7.45e-02 7.83e-02 8.17e-02 8.48e-02 8.75e-02 8.99e-02 9.21e-02 9.40e-02
#> [35,] 4.87e-02 5.16e-02 5.42e-02 5.67e-02 5.89e-02 6.10e-02 6.29e-02 6.46e-02
#> [36,] 3.18e-02 3.40e-02 3.60e-02 3.79e-02 3.97e-02 4.14e-02 4.30e-02 4.45e-02
#> [37,] 2.08e-02 2.24e-02 2.39e-02 2.53e-02 2.67e-02 2.81e-02 2.93e-02 3.06e-02
#> [38,] 1.36e-02 1.48e-02 1.59e-02 1.69e-02 1.80e-02 1.90e-02 2.00e-02 2.10e-02
#> [39,] 8.91e-03 9.73e-03 1.05e-02 1.13e-02 1.21e-02 1.29e-02 1.37e-02 1.45e-02
#> [40,] 5.83e-03 6.41e-03 6.99e-03 7.58e-03 8.17e-03 8.76e-03 9.36e-03 9.95e-03
#> [41,] 3.81e-03 4.22e-03 4.64e-03 5.07e-03 5.50e-03 5.94e-03 6.39e-03 6.85e-03
#> [42,] 2.49e-03 2.78e-03 3.08e-03 3.39e-03 3.71e-03 4.03e-03 4.37e-03 4.71e-03
#> [43,] 1.63e-03 1.83e-03 2.05e-03 2.27e-03 2.50e-03 2.73e-03 2.98e-03 3.24e-03
#> [44,] 1.07e-03 1.21e-03 1.36e-03 1.52e-03 1.68e-03 1.86e-03 2.04e-03 2.23e-03
#> [45,] 6.97e-04 7.96e-04 9.02e-04 1.01e-03 1.13e-03 1.26e-03 1.39e-03 1.53e-03
#> [46,] 4.56e-04 5.25e-04 5.98e-04 6.78e-04 7.63e-04 8.54e-04 9.51e-04 1.05e-03
#> [47,] 2.98e-04 3.46e-04 3.97e-04 4.53e-04 5.14e-04 5.79e-04 6.49e-04 7.25e-04
#> [48,] 1.95e-04 2.28e-04 2.64e-04 3.03e-04 3.46e-04 3.93e-04 4.44e-04 4.99e-04
#> [49,] 1.28e-04 1.50e-04 1.75e-04 2.03e-04 2.33e-04 2.66e-04 3.03e-04 3.43e-04
#> [50,] 8.34e-05 9.89e-05 1.16e-04 1.36e-04 1.57e-04 1.81e-04 2.07e-04 2.36e-04
#> [51,] 5.45e-05 6.52e-05 7.72e-05 9.06e-05 1.06e-04 1.23e-04 1.41e-04 1.62e-04
#> [52,] 3.57e-05 4.29e-05 5.12e-05 6.06e-05 7.12e-05 8.32e-05 9.66e-05 1.12e-04
#> [53,] 2.33e-05 2.83e-05 3.40e-05 4.05e-05 4.80e-05 5.64e-05 6.60e-05 7.68e-05
#> [54,] 1.53e-05 1.86e-05 2.26e-05 2.71e-05 3.23e-05 3.83e-05 4.51e-05 5.28e-05
#>          [,43]    [,44]    [,45]    [,46]    [,47]    [,48]    [,49]    [,50]
#>  [1,] 1.42e-04 2.88e-05 5.84e-06 1.18e-06 2.39e-07 4.85e-08 9.81e-09 1.99e-09
#>  [2,] 1.42e-04 2.88e-05 5.84e-06 1.18e-06 2.39e-07 4.85e-08 9.81e-09 1.99e-09
#>  [3,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [4,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [5,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [6,] 9.54e-04 6.97e-04 5.10e-04 3.73e-04 2.72e-04 1.99e-04 1.46e-04 1.06e-04
#>  [7,] 1.92e-02 1.59e-02 1.32e-02 1.10e-02 9.11e-03 7.54e-03 6.23e-03 5.15e-03
#>  [8,] 1.33e-02 1.11e-02 9.30e-03 7.76e-03 6.47e-03 5.39e-03 4.49e-03 3.73e-03
#>  [9,] 9.19e-03 7.75e-03 6.52e-03 5.48e-03 4.60e-03 3.86e-03 3.23e-03 2.70e-03
#> [10,] 6.36e-03 5.40e-03 4.58e-03 3.87e-03 3.27e-03 2.76e-03 2.32e-03 1.96e-03
#> [11,] 4.41e-03 3.77e-03 3.21e-03 2.74e-03 2.33e-03 1.97e-03 1.67e-03 1.42e-03
#> [12,] 3.05e-03 2.63e-03 2.25e-03 1.93e-03 1.65e-03 1.41e-03 1.20e-03 1.03e-03
#> [13,] 2.11e-03 1.83e-03 1.58e-03 1.36e-03 1.18e-03 1.01e-03 8.67e-04 7.43e-04
#> [14,] 1.46e-03 1.28e-03 1.11e-03 9.64e-04 8.35e-04 7.22e-04 6.24e-04 5.38e-04
#> [15,] 1.01e-03 8.90e-04 7.79e-04 6.81e-04 5.94e-04 5.17e-04 4.49e-04 3.90e-04
#> [16,] 7.02e-04 6.20e-04 5.47e-04 4.81e-04 4.22e-04 3.70e-04 3.23e-04 2.82e-04
#> [17,] 4.86e-04 4.32e-04 3.84e-04 3.40e-04 3.00e-04 2.64e-04 2.33e-04 2.04e-04
#> [18,] 3.37e-04 3.01e-04 2.69e-04 2.40e-04 2.13e-04 1.89e-04 1.67e-04 1.48e-04
#> [19,] 2.33e-04 2.10e-04 1.89e-04 1.70e-04 1.52e-04 1.35e-04 1.21e-04 1.07e-04
#> [20,] 1.61e-04 1.47e-04 1.33e-04 1.20e-04 1.08e-04 9.68e-05 8.68e-05 7.76e-05
#> [21,] 1.12e-04 1.02e-04 9.31e-05 8.46e-05 7.66e-05 6.93e-05 6.24e-05 5.62e-05
#> [22,] 7.74e-05 7.12e-05 6.53e-05 5.97e-05 5.45e-05 4.95e-05 4.49e-05 4.07e-05
#> [23,] 5.36e-05 4.97e-05 4.58e-05 4.22e-05 3.87e-05 3.54e-05 3.24e-05 2.95e-05
#> [24,] 3.71e-05 3.46e-05 3.22e-05 2.98e-05 2.75e-05 2.53e-05 2.33e-05 2.13e-05
#> [25,] 2.57e-05 2.41e-05 2.26e-05 2.11e-05 1.96e-05 1.81e-05 1.68e-05 1.55e-05
#> [26,] 1.78e-05 1.68e-05 1.58e-05 1.49e-05 1.39e-05 1.30e-05 1.21e-05 1.12e-05
#> [27,] 1.23e-05 1.17e-05 1.11e-05 1.05e-05 9.89e-06 9.28e-06 8.68e-06 8.10e-06
#> [28,] 8.54e-06 8.18e-06 7.80e-06 7.42e-06 7.03e-06 6.64e-06 6.25e-06 5.87e-06
#> [29,] 5.91e-06 5.70e-06 5.48e-06 5.24e-06 5.00e-06 4.75e-06 4.50e-06 4.25e-06
#> [30,] 4.09e-06 3.98e-06 3.84e-06 3.70e-06 3.55e-06 3.40e-06 3.24e-06 3.08e-06
#> [31,] 2.88e-01 2.87e-01 2.85e-01 2.83e-01 2.80e-01 2.77e-01 2.74e-01 2.71e-01
#> [32,] 1.99e-01 2.00e-01 2.00e-01 2.00e-01 1.99e-01 1.98e-01 1.97e-01 1.96e-01
#> [33,] 1.38e-01 1.39e-01 1.40e-01 1.41e-01 1.41e-01 1.42e-01 1.42e-01 1.42e-01
#> [34,] 9.57e-02 9.71e-02 9.84e-02 9.96e-02 1.01e-01 1.01e-01 1.02e-01 1.03e-01
#> [35,] 6.62e-02 6.77e-02 6.91e-02 7.03e-02 7.15e-02 7.26e-02 7.35e-02 7.44e-02
#> [36,] 4.59e-02 4.72e-02 4.85e-02 4.97e-02 5.08e-02 5.19e-02 5.29e-02 5.39e-02
#> [37,] 3.18e-02 3.29e-02 3.40e-02 3.51e-02 3.61e-02 3.71e-02 3.81e-02 3.90e-02
#> [38,] 2.20e-02 2.29e-02 2.39e-02 2.48e-02 2.57e-02 2.66e-02 2.74e-02 2.83e-02
#> [39,] 1.52e-02 1.60e-02 1.68e-02 1.75e-02 1.83e-02 1.90e-02 1.97e-02 2.05e-02
#> [40,] 1.06e-02 1.12e-02 1.18e-02 1.24e-02 1.30e-02 1.36e-02 1.42e-02 1.48e-02
#> [41,] 7.31e-03 7.78e-03 8.25e-03 8.73e-03 9.22e-03 9.72e-03 1.02e-02 1.07e-02
#> [42,] 5.06e-03 5.42e-03 5.79e-03 6.17e-03 6.56e-03 6.95e-03 7.36e-03 7.78e-03
#> [43,] 3.50e-03 3.78e-03 4.06e-03 4.36e-03 4.66e-03 4.97e-03 5.30e-03 5.63e-03
#> [44,] 2.43e-03 2.64e-03 2.85e-03 3.08e-03 3.31e-03 3.56e-03 3.81e-03 4.08e-03
#> [45,] 1.68e-03 1.84e-03 2.00e-03 2.17e-03 2.36e-03 2.55e-03 2.74e-03 2.95e-03
#> [46,] 1.16e-03 1.28e-03 1.40e-03 1.54e-03 1.67e-03 1.82e-03 1.98e-03 2.14e-03
#> [47,] 8.06e-04 8.93e-04 9.86e-04 1.08e-03 1.19e-03 1.30e-03 1.42e-03 1.55e-03
#> [48,] 5.58e-04 6.23e-04 6.92e-04 7.66e-04 8.46e-04 9.32e-04 1.02e-03 1.12e-03
#> [49,] 3.87e-04 4.34e-04 4.85e-04 5.41e-04 6.02e-04 6.67e-04 7.37e-04 8.12e-04
#> [50,] 2.68e-04 3.03e-04 3.41e-04 3.82e-04 4.28e-04 4.77e-04 5.30e-04 5.88e-04
#> [51,] 1.85e-04 2.11e-04 2.39e-04 2.70e-04 3.04e-04 3.41e-04 3.82e-04 4.26e-04
#> [52,] 1.28e-04 1.47e-04 1.68e-04 1.91e-04 2.16e-04 2.44e-04 2.75e-04 3.08e-04
#> [53,] 8.89e-05 1.03e-04 1.18e-04 1.35e-04 1.54e-04 1.75e-04 1.98e-04 2.23e-04
#> [54,] 6.16e-05 7.15e-05 8.26e-05 9.52e-05 1.09e-04 1.25e-04 1.42e-04 1.62e-04
#>          [,51]    [,52]    [,53]    [,54]
#>  [1,] 4.02e-10 8.15e-11 1.65e-11 3.34e-12
#>  [2,] 4.02e-10 8.15e-11 1.65e-11 3.34e-12
#>  [3,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [4,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [5,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00
#>  [6,] 7.78e-05 5.69e-05 4.16e-05 3.04e-05
#>  [7,] 4.25e-03 3.51e-03 2.89e-03 2.39e-03
#>  [8,] 3.10e-03 2.57e-03 2.13e-03 1.77e-03
#>  [9,] 2.26e-03 1.88e-03 1.57e-03 1.31e-03
#> [10,] 1.64e-03 1.38e-03 1.16e-03 9.72e-04
#> [11,] 1.20e-03 1.01e-03 8.54e-04 7.20e-04
#> [12,] 8.73e-04 7.42e-04 6.30e-04 5.34e-04
#> [13,] 6.36e-04 5.43e-04 4.64e-04 3.96e-04
#> [14,] 4.63e-04 3.98e-04 3.42e-04 2.94e-04
#> [15,] 3.37e-04 2.92e-04 2.52e-04 2.18e-04
#> [16,] 2.46e-04 2.14e-04 1.86e-04 1.61e-04
#> [17,] 1.79e-04 1.57e-04 1.37e-04 1.20e-04
#> [18,] 1.30e-04 1.15e-04 1.01e-04 8.87e-05
#> [19,] 9.51e-05 8.42e-05 7.44e-05 6.57e-05
#> [20,] 6.93e-05 6.17e-05 5.49e-05 4.87e-05
#> [21,] 5.05e-05 4.52e-05 4.04e-05 3.61e-05
#> [22,] 3.68e-05 3.31e-05 2.98e-05 2.68e-05
#> [23,] 2.68e-05 2.43e-05 2.20e-05 1.99e-05
#> [24,] 1.95e-05 1.78e-05 1.62e-05 1.47e-05
#> [25,] 1.42e-05 1.30e-05 1.19e-05 1.09e-05
#> [26,] 1.04e-05 9.56e-06 8.80e-06 8.09e-06
#> [27,] 7.54e-06 7.00e-06 6.49e-06 6.00e-06
#> [28,] 5.50e-06 5.13e-06 4.78e-06 4.45e-06
#> [29,] 4.00e-06 3.76e-06 3.53e-06 3.30e-06
#> [30,] 2.92e-06 2.76e-06 2.60e-06 2.44e-06
#> [31,] 2.67e-01 2.64e-01 2.60e-01 2.56e-01
#> [32,] 1.95e-01 1.93e-01 1.92e-01 1.90e-01
#> [33,] 1.42e-01 1.42e-01 1.41e-01 1.41e-01
#> [34,] 1.03e-01 1.04e-01 1.04e-01 1.04e-01
#> [35,] 7.53e-02 7.60e-02 7.68e-02 7.74e-02
#> [36,] 5.48e-02 5.57e-02 5.66e-02 5.74e-02
#> [37,] 4.00e-02 4.08e-02 4.17e-02 4.25e-02
#> [38,] 2.91e-02 2.99e-02 3.07e-02 3.15e-02
#> [39,] 2.12e-02 2.19e-02 2.27e-02 2.34e-02
#> [40,] 1.54e-02 1.61e-02 1.67e-02 1.73e-02
#> [41,] 1.13e-02 1.18e-02 1.23e-02 1.28e-02
#> [42,] 8.20e-03 8.63e-03 9.07e-03 9.53e-03
#> [43,] 5.97e-03 6.33e-03 6.69e-03 7.06e-03
#> [44,] 4.35e-03 4.64e-03 4.93e-03 5.24e-03
#> [45,] 3.17e-03 3.40e-03 3.63e-03 3.88e-03
#> [46,] 2.31e-03 2.49e-03 2.68e-03 2.88e-03
#> [47,] 1.68e-03 1.82e-03 1.97e-03 2.13e-03
#> [48,] 1.23e-03 1.34e-03 1.46e-03 1.58e-03
#> [49,] 8.93e-04 9.80e-04 1.07e-03 1.17e-03
#> [50,] 6.51e-04 7.18e-04 7.91e-04 8.69e-04
#> [51,] 4.74e-04 5.26e-04 5.83e-04 6.44e-04
#> [52,] 3.45e-04 3.86e-04 4.30e-04 4.78e-04
#> [53,] 2.52e-04 2.83e-04 3.17e-04 3.54e-04
#> [54,] 1.83e-04 2.07e-04 2.33e-04 2.62e-04

Next, let’s estimate the function-based historical MPM.

cypmatrix3fp <- flefko3(stageframe = cypframe_fb, supplement = cypsupp3_fb, 
  modelsuite = cypmodels3p, data = cypfb_env)

summary(cypmatrix3fp)
#> 
#> This historical lefkoMat object contains 15 matrices.
#> 
#> Each matrix is square with 2916 rows and columns, and a total of 8503056 elements.
#> A total of 1765635 survival transitions were estimated, with 117709 per matrix.
#> A total of 35280 fecundity transitions were estimated, with 2352 per matrix.
#> This lefkoMat object covers 1 population, 3 patches, and 5 time steps.
#> 
#> Vital rate modeling quality control:
#> 
#> Survival estimated with 74 individuals and 320 individual transitions.
#> Observation estimated with 70 individuals and 303 individual transitions.
#> Primary size estimated with 70 individuals and 288 individual transitions.
#> Secondary size transition not estimated.
#> Tertiary size transition not estimated.
#> Reproductive status estimated with 70 individuals and 288 individual transitions.
#> Fecundity estimated with 51 individuals and 118 individual transitions.
#> Juvenile survival not estimated.
#> Juvenile observation probability not estimated.
#> Juvenile primary size transition not estimated.
#> Juvenile secondary size transition not estimated.
#> Juvenile tertiary size transition not estimated.
#> Juvenile reproduction probability not estimated.
#> Juvenile maturity transition probability not estimated.
#> 
#> Survival probability sum check (each matrix represented by column in order):
#>          [,1]  [,2]  [,3]  [,4]  [,5]  [,6]  [,7]  [,8]  [,9] [,10] [,11] [,12]
#> Min.    0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
#> 1st Qu. 0.965 0.965 0.965 0.965 0.965 0.964 0.965 0.965 0.965 0.964 0.964 0.965
#> Median  0.999 1.000 1.000 1.000 0.999 0.998 1.000 0.999 0.999 0.998 0.997 0.999
#> Mean    0.819 0.819 0.819 0.819 0.819 0.819 0.819 0.819 0.819 0.819 0.818 0.819
#> 3rd Qu. 1.000 1.000 1.000 1.000 1.000 0.999 1.000 1.000 0.999 0.999 0.998 1.000
#> Max.    1.000 1.000 1.000 1.000 1.000 0.999 1.000 1.000 1.000 1.000 0.999 1.000
#>         [,13] [,14] [,15]
#> Min.    0.000 0.000 0.000
#> 1st Qu. 0.965 0.964 0.964
#> Median  0.999 0.998 0.997
#> Mean    0.819 0.818 0.818
#> 3rd Qu. 0.999 0.999 0.999
#> Max.    1.000 0.999 0.999

Let’s note the contrasts with the other MPMs in the output above. First, we see 15 matrices produced again. However, in the raw hMPM, we only saw 12 matrices, because of the fact that we need three monitoring occasions of data to parameterize each raw transition (six monitoring occasions total means four sets of three monitoring occasions, or four total time steps, in the historical case). Since this is a function-based MPM, and since it resulted from a mixed modeling strategy where year was treated as random, we can actually use our functions to estimate transitions in the first year even without a full set of three years of data. The result is five time steps that we can estimate transitions for.

Second, these matrices are utterly huge. They have \(54^2 = 2916\) rows and columns, yielding \(2916^2 = 8503056\) total elements per matrix. Our raw hMPM had \(11^2 = 121\) rows and columns, yielding 14,641 elements per matrix. Finally, although the raw hMPMs only had an average of 37.83 elements estimated per matrix, here we have 120,061 elements estimated per matrix. This is vastly more than in the raw case and in the ahistorical function-based case. However, it is also just a small fraction of the total number of elements in the matrix. In fact, in an unreduced hMPM estimated in Ehrlén format, the total number of elements that can be estimated is equal to \(\frac{r \times c}{m}\), where \(r\) and \(c\) are the numbers of rows and columns, respectively, and \(m\) is the number of stages in the stageframe. For example, if there are ten stages in the stageframe, then only 1000 of the total 10,000 elements in the hMPM are estimable (10% of the elements).

Now that we have created our MPMs, we might wish to create element-wise arithmetic mean matrices to aid inference and further analysis. For example, we might be interested in developing patch-level means and an overall population mean, but one in which the element means treat each patch and each year as equal in proportional effect. For this purpose, we can use the lmean() function. Let’s take a look at the mean raw ahMPM first.

cyp2rp_mean <- lmean(cypmatrix2rp)
cyp2rp_mean
#> $A
#> $A[[1]]
#>       [,1] [,2] [,3] [,4]       [,5]       [,6]        [,7]         [,8]
#>  [1,] 0.03  0.0  0.0  0.0 0.00000000 0.00000000 62.50000000 422.22222222
#>  [2,] 0.15  0.0  0.0  0.0 0.00000000 0.00000000 62.50000000 422.22222222
#>  [3,] 0.00  0.1  0.0  0.0 0.00000000 0.00000000  0.00000000   0.00000000
#>  [4,] 0.00  0.0  0.1  0.0 0.00000000 0.00000000  0.00000000   0.00000000
#>  [5,] 0.00  0.0  0.0  0.1 0.05000000 0.00000000  0.00000000   0.00000000
#>  [6,] 0.00  0.0  0.0  0.0 0.05833333 0.00000000  0.05833333   0.04444444
#>  [7,] 0.00  0.0  0.0  0.0 0.59949495 0.06666667  0.59949495   0.19555556
#>  [8,] 0.00  0.0  0.0  0.0 0.00000000 0.33333333  0.21010101   0.59555556
#>  [9,] 0.00  0.0  0.0  0.0 0.00000000 0.00000000  0.00000000   0.08444444
#> [10,] 0.00  0.0  0.0  0.0 0.00000000 0.00000000  0.00000000   0.00000000
#> [11,] 0.00  0.0  0.0  0.0 0.00000000 0.00000000  0.00000000   0.00000000
#>               [,9] [,10] [,11]
#>  [1,] 1.583333e+03   0.0     0
#>  [2,] 1.583333e+03   0.0     0
#>  [3,] 0.000000e+00   0.0     0
#>  [4,] 0.000000e+00   0.0     0
#>  [5,] 0.000000e+00   0.0     0
#>  [6,] 0.000000e+00   0.0     0
#>  [7,] 6.666667e-02   0.0     0
#>  [8,] 2.500000e-01   0.2     0
#>  [9,] 4.833333e-01   0.0     0
#> [10,] 2.000000e-01   0.0     0
#> [11,] 0.000000e+00   0.0     0
#> 
#> $A[[2]]
#>       [,1] [,2] [,3] [,4]       [,5]       [,6]        [,7]         [,8]
#>  [1,] 0.03  0.0  0.0  0.0 0.00000000 0.00000000 55.55555556 572.91666667
#>  [2,] 0.15  0.0  0.0  0.0 0.00000000 0.00000000 55.55555556 572.91666667
#>  [3,] 0.00  0.1  0.0  0.0 0.00000000 0.00000000  0.00000000   0.00000000
#>  [4,] 0.00  0.0  0.1  0.0 0.00000000 0.00000000  0.00000000   0.00000000
#>  [5,] 0.00  0.0  0.0  0.1 0.05000000 0.00000000  0.00000000   0.00000000
#>  [6,] 0.00  0.0  0.0  0.0 0.07676768 0.06666667  0.07676768   0.05416667
#>  [7,] 0.00  0.0  0.0  0.0 0.45974026 0.46666667  0.45974026   0.23083333
#>  [8,] 0.00  0.0  0.0  0.0 0.00000000 0.20000000  0.30966811   0.50166667
#>  [9,] 0.00  0.0  0.0  0.0 0.00000000 0.00000000  0.02222222   0.14416667
#> [10,] 0.00  0.0  0.0  0.0 0.00000000 0.06666667  0.02222222   0.01250000
#> [11,] 0.00  0.0  0.0  0.0 0.00000000 0.00000000  0.00000000   0.00000000
#>               [,9]  [,10] [,11]
#>  [1,] 2392.8571429 2875.0 6e+03
#>  [2,] 2392.8571429 2875.0 6e+03
#>  [3,]    0.0000000    0.0 0e+00
#>  [4,]    0.0000000    0.0 0e+00
#>  [5,]    0.0000000    0.0 0e+00
#>  [6,]    0.0000000    0.0 0e+00
#>  [7,]    0.0500000    0.0 0e+00
#>  [8,]    0.4000000    0.1 0e+00
#>  [9,]    0.3428571    0.2 0e+00
#> [10,]    0.2071429    0.6 2e-01
#> [11,]    0.0000000    0.1 4e-01
#> 
#> $A[[3]]
#>       [,1] [,2] [,3] [,4]       [,5] [,6]       [,7]         [,8]         [,9]
#>  [1,] 0.03  0.0  0.0  0.0 0.00000000  0.0 0.00000000 422.61904762 1625.0000000
#>  [2,] 0.15  0.0  0.0  0.0 0.00000000  0.0 0.00000000 422.61904762 1625.0000000
#>  [3,] 0.00  0.1  0.0  0.0 0.00000000  0.0 0.00000000   0.00000000    0.0000000
#>  [4,] 0.00  0.0  0.1  0.0 0.00000000  0.0 0.00000000   0.00000000    0.0000000
#>  [5,] 0.00  0.0  0.0  0.1 0.05000000  0.0 0.00000000   0.00000000    0.0000000
#>  [6,] 0.00  0.0  0.0  0.0 0.06666667  0.0 0.06666667   0.03333333    0.0000000
#>  [7,] 0.00  0.0  0.0  0.0 0.50000000  0.1 0.50000000   0.11666667    0.1333333
#>  [8,] 0.00  0.0  0.0  0.0 0.00000000  0.1 0.26666667   0.54761905    0.3333333
#>  [9,] 0.00  0.0  0.0  0.0 0.00000000  0.0 0.06666667   0.22380952    0.5333333
#> [10,] 0.00  0.0  0.0  0.0 0.00000000  0.0 0.00000000   0.07857143    0.0000000
#> [11,] 0.00  0.0  0.0  0.0 0.00000000  0.0 0.00000000   0.00000000    0.0000000
#>       [,10]  [,11]
#>  [1,] 750.0 2500.0
#>  [2,] 750.0 2500.0
#>  [3,]   0.0    0.0
#>  [4,]   0.0    0.0
#>  [5,]   0.0    0.0
#>  [6,]   0.0    0.0
#>  [7,]   0.0    0.0
#>  [8,]   0.1    0.0
#>  [9,]   0.2    0.0
#> [10,]   0.4    0.2
#> [11,]   0.1    0.4
#> 
#> $A[[4]]
#>       [,1] [,2] [,3] [,4]       [,5]       [,6]         [,7]         [,8]
#>  [1,] 0.03  0.0  0.0  0.0 0.00000000 0.00000000 39.351851852 472.58597884
#>  [2,] 0.15  0.0  0.0  0.0 0.00000000 0.00000000 39.351851852 472.58597884
#>  [3,] 0.00  0.1  0.0  0.0 0.00000000 0.00000000  0.000000000   0.00000000
#>  [4,] 0.00  0.0  0.1  0.0 0.00000000 0.00000000  0.000000000   0.00000000
#>  [5,] 0.00  0.0  0.0  0.1 0.05000000 0.00000000  0.000000000   0.00000000
#>  [6,] 0.00  0.0  0.0  0.0 0.06725589 0.02222222  0.067255892   0.04398148
#>  [7,] 0.00  0.0  0.0  0.0 0.51974507 0.21111111  0.519745070   0.18101852
#>  [8,] 0.00  0.0  0.0  0.0 0.00000000 0.21111111  0.262145262   0.54828042
#>  [9,] 0.00  0.0  0.0  0.0 0.00000000 0.00000000  0.029629630   0.15080688
#> [10,] 0.00  0.0  0.0  0.0 0.00000000 0.02222222  0.007407407   0.03035714
#> [11,] 0.00  0.0  0.0  0.0 0.00000000 0.00000000  0.000000000   0.00000000
#>               [,9]        [,10]        [,11]
#>  [1,] 1.867063e+03 1.208333e+03 2833.3333333
#>  [2,] 1.867063e+03 1.208333e+03 2833.3333333
#>  [3,] 0.000000e+00 0.000000e+00    0.0000000
#>  [4,] 0.000000e+00 0.000000e+00    0.0000000
#>  [5,] 0.000000e+00 0.000000e+00    0.0000000
#>  [6,] 0.000000e+00 0.000000e+00    0.0000000
#>  [7,] 8.333333e-02 0.000000e+00    0.0000000
#>  [8,] 3.277778e-01 1.333333e-01    0.0000000
#>  [9,] 4.531746e-01 1.333333e-01    0.0000000
#> [10,] 1.357143e-01 3.333333e-01    0.1333333
#> [11,] 0.000000e+00 6.666667e-02    0.2666667
#> 
#> 
#> $U
#> $U[[1]]
#>       [,1] [,2] [,3] [,4]       [,5]       [,6]       [,7]       [,8]
#>  [1,] 0.03  0.0  0.0  0.0 0.00000000 0.00000000 0.00000000 0.00000000
#>  [2,] 0.15  0.0  0.0  0.0 0.00000000 0.00000000 0.00000000 0.00000000
#>  [3,] 0.00  0.1  0.0  0.0 0.00000000 0.00000000 0.00000000 0.00000000
#>  [4,] 0.00  0.0  0.1  0.0 0.00000000 0.00000000 0.00000000 0.00000000
#>  [5,] 0.00  0.0  0.0  0.1 0.05000000 0.00000000 0.00000000 0.00000000
#>  [6,] 0.00  0.0  0.0  0.0 0.05833333 0.00000000 0.05833333 0.04444444
#>  [7,] 0.00  0.0  0.0  0.0 0.59949495 0.06666667 0.59949495 0.19555556
#>  [8,] 0.00  0.0  0.0  0.0 0.00000000 0.33333333 0.21010101 0.59555556
#>  [9,] 0.00  0.0  0.0  0.0 0.00000000 0.00000000 0.00000000 0.08444444
#> [10,] 0.00  0.0  0.0  0.0 0.00000000 0.00000000 0.00000000 0.00000000
#> [11,] 0.00  0.0  0.0  0.0 0.00000000 0.00000000 0.00000000 0.00000000
#>             [,9] [,10] [,11]
#>  [1,] 0.00000000   0.0     0
#>  [2,] 0.00000000   0.0     0
#>  [3,] 0.00000000   0.0     0
#>  [4,] 0.00000000   0.0     0
#>  [5,] 0.00000000   0.0     0
#>  [6,] 0.00000000   0.0     0
#>  [7,] 0.06666667   0.0     0
#>  [8,] 0.25000000   0.2     0
#>  [9,] 0.48333333   0.0     0
#> [10,] 0.20000000   0.0     0
#> [11,] 0.00000000   0.0     0
#> 
#> $U[[2]]
#>       [,1] [,2] [,3] [,4]       [,5]       [,6]       [,7]       [,8]      [,9]
#>  [1,] 0.03  0.0  0.0  0.0 0.00000000 0.00000000 0.00000000 0.00000000 0.0000000
#>  [2,] 0.15  0.0  0.0  0.0 0.00000000 0.00000000 0.00000000 0.00000000 0.0000000
#>  [3,] 0.00  0.1  0.0  0.0 0.00000000 0.00000000 0.00000000 0.00000000 0.0000000
#>  [4,] 0.00  0.0  0.1  0.0 0.00000000 0.00000000 0.00000000 0.00000000 0.0000000
#>  [5,] 0.00  0.0  0.0  0.1 0.05000000 0.00000000 0.00000000 0.00000000 0.0000000
#>  [6,] 0.00  0.0  0.0  0.0 0.07676768 0.06666667 0.07676768 0.05416667 0.0000000
#>  [7,] 0.00  0.0  0.0  0.0 0.45974026 0.46666667 0.45974026 0.23083333 0.0500000
#>  [8,] 0.00  0.0  0.0  0.0 0.00000000 0.20000000 0.30966811 0.50166667 0.4000000
#>  [9,] 0.00  0.0  0.0  0.0 0.00000000 0.00000000 0.02222222 0.14416667 0.3428571
#> [10,] 0.00  0.0  0.0  0.0 0.00000000 0.06666667 0.02222222 0.01250000 0.2071429
#> [11,] 0.00  0.0  0.0  0.0 0.00000000 0.00000000 0.00000000 0.00000000 0.0000000
#>       [,10] [,11]
#>  [1,]   0.0   0.0
#>  [2,]   0.0   0.0
#>  [3,]   0.0   0.0
#>  [4,]   0.0   0.0
#>  [5,]   0.0   0.0
#>  [6,]   0.0   0.0
#>  [7,]   0.0   0.0
#>  [8,]   0.1   0.0
#>  [9,]   0.2   0.0
#> [10,]   0.6   0.2
#> [11,]   0.1   0.4
#> 
#> $U[[3]]
#>       [,1] [,2] [,3] [,4]       [,5] [,6]       [,7]       [,8]      [,9] [,10]
#>  [1,] 0.03  0.0  0.0  0.0 0.00000000  0.0 0.00000000 0.00000000 0.0000000   0.0
#>  [2,] 0.15  0.0  0.0  0.0 0.00000000  0.0 0.00000000 0.00000000 0.0000000   0.0
#>  [3,] 0.00  0.1  0.0  0.0 0.00000000  0.0 0.00000000 0.00000000 0.0000000   0.0
#>  [4,] 0.00  0.0  0.1  0.0 0.00000000  0.0 0.00000000 0.00000000 0.0000000   0.0
#>  [5,] 0.00  0.0  0.0  0.1 0.05000000  0.0 0.00000000 0.00000000 0.0000000   0.0
#>  [6,] 0.00  0.0  0.0  0.0 0.06666667  0.0 0.06666667 0.03333333 0.0000000   0.0
#>  [7,] 0.00  0.0  0.0  0.0 0.50000000  0.1 0.50000000 0.11666667 0.1333333   0.0
#>  [8,] 0.00  0.0  0.0  0.0 0.00000000  0.1 0.26666667 0.54761905 0.3333333   0.1
#>  [9,] 0.00  0.0  0.0  0.0 0.00000000  0.0 0.06666667 0.22380952 0.5333333   0.2
#> [10,] 0.00  0.0  0.0  0.0 0.00000000  0.0 0.00000000 0.07857143 0.0000000   0.4
#> [11,] 0.00  0.0  0.0  0.0 0.00000000  0.0 0.00000000 0.00000000 0.0000000   0.1
#>       [,11]
#>  [1,]   0.0
#>  [2,]   0.0
#>  [3,]   0.0
#>  [4,]   0.0
#>  [5,]   0.0
#>  [6,]   0.0
#>  [7,]   0.0
#>  [8,]   0.0
#>  [9,]   0.0
#> [10,]   0.2
#> [11,]   0.4
#> 
#> $U[[4]]
#>       [,1] [,2] [,3] [,4]       [,5]       [,6]        [,7]       [,8]
#>  [1,] 0.03  0.0  0.0  0.0 0.00000000 0.00000000 0.000000000 0.00000000
#>  [2,] 0.15  0.0  0.0  0.0 0.00000000 0.00000000 0.000000000 0.00000000
#>  [3,] 0.00  0.1  0.0  0.0 0.00000000 0.00000000 0.000000000 0.00000000
#>  [4,] 0.00  0.0  0.1  0.0 0.00000000 0.00000000 0.000000000 0.00000000
#>  [5,] 0.00  0.0  0.0  0.1 0.05000000 0.00000000 0.000000000 0.00000000
#>  [6,] 0.00  0.0  0.0  0.0 0.06725589 0.02222222 0.067255892 0.04398148
#>  [7,] 0.00  0.0  0.0  0.0 0.51974507 0.21111111 0.519745070 0.18101852
#>  [8,] 0.00  0.0  0.0  0.0 0.00000000 0.21111111 0.262145262 0.54828042
#>  [9,] 0.00  0.0  0.0  0.0 0.00000000 0.00000000 0.029629630 0.15080688
#> [10,] 0.00  0.0  0.0  0.0 0.00000000 0.02222222 0.007407407 0.03035714
#> [11,] 0.00  0.0  0.0  0.0 0.00000000 0.00000000 0.000000000 0.00000000
#>             [,9]      [,10]     [,11]
#>  [1,] 0.00000000 0.00000000 0.0000000
#>  [2,] 0.00000000 0.00000000 0.0000000
#>  [3,] 0.00000000 0.00000000 0.0000000
#>  [4,] 0.00000000 0.00000000 0.0000000
#>  [5,] 0.00000000 0.00000000 0.0000000
#>  [6,] 0.00000000 0.00000000 0.0000000
#>  [7,] 0.08333333 0.00000000 0.0000000
#>  [8,] 0.32777778 0.13333333 0.0000000
#>  [9,] 0.45317460 0.13333333 0.0000000
#> [10,] 0.13571429 0.33333333 0.1333333
#> [11,] 0.00000000 0.06666667 0.2666667
#> 
#> 
#> $F
#> $F[[1]]
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7]     [,8]     [,9] [,10] [,11]
#>  [1,]    0    0    0    0    0    0 62.5 422.2222 1583.333     0     0
#>  [2,]    0    0    0    0    0    0 62.5 422.2222 1583.333     0     0
#>  [3,]    0    0    0    0    0    0  0.0   0.0000    0.000     0     0
#>  [4,]    0    0    0    0    0    0  0.0   0.0000    0.000     0     0
#>  [5,]    0    0    0    0    0    0  0.0   0.0000    0.000     0     0
#>  [6,]    0    0    0    0    0    0  0.0   0.0000    0.000     0     0
#>  [7,]    0    0    0    0    0    0  0.0   0.0000    0.000     0     0
#>  [8,]    0    0    0    0    0    0  0.0   0.0000    0.000     0     0
#>  [9,]    0    0    0    0    0    0  0.0   0.0000    0.000     0     0
#> [10,]    0    0    0    0    0    0  0.0   0.0000    0.000     0     0
#> [11,]    0    0    0    0    0    0  0.0   0.0000    0.000     0     0
#> 
#> $F[[2]]
#>       [,1] [,2] [,3] [,4] [,5] [,6]     [,7]     [,8]     [,9] [,10] [,11]
#>  [1,]    0    0    0    0    0    0 55.55556 572.9167 2392.857  2875  6000
#>  [2,]    0    0    0    0    0    0 55.55556 572.9167 2392.857  2875  6000
#>  [3,]    0    0    0    0    0    0  0.00000   0.0000    0.000     0     0
#>  [4,]    0    0    0    0    0    0  0.00000   0.0000    0.000     0     0
#>  [5,]    0    0    0    0    0    0  0.00000   0.0000    0.000     0     0
#>  [6,]    0    0    0    0    0    0  0.00000   0.0000    0.000     0     0
#>  [7,]    0    0    0    0    0    0  0.00000   0.0000    0.000     0     0
#>  [8,]    0    0    0    0    0    0  0.00000   0.0000    0.000     0     0
#>  [9,]    0    0    0    0    0    0  0.00000   0.0000    0.000     0     0
#> [10,]    0    0    0    0    0    0  0.00000   0.0000    0.000     0     0
#> [11,]    0    0    0    0    0    0  0.00000   0.0000    0.000     0     0
#> 
#> $F[[3]]
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7]    [,8] [,9] [,10] [,11]
#>  [1,]    0    0    0    0    0    0    0 422.619 1625   750  2500
#>  [2,]    0    0    0    0    0    0    0 422.619 1625   750  2500
#>  [3,]    0    0    0    0    0    0    0   0.000    0     0     0
#>  [4,]    0    0    0    0    0    0    0   0.000    0     0     0
#>  [5,]    0    0    0    0    0    0    0   0.000    0     0     0
#>  [6,]    0    0    0    0    0    0    0   0.000    0     0     0
#>  [7,]    0    0    0    0    0    0    0   0.000    0     0     0
#>  [8,]    0    0    0    0    0    0    0   0.000    0     0     0
#>  [9,]    0    0    0    0    0    0    0   0.000    0     0     0
#> [10,]    0    0    0    0    0    0    0   0.000    0     0     0
#> [11,]    0    0    0    0    0    0    0   0.000    0     0     0
#> 
#> $F[[4]]
#>       [,1] [,2] [,3] [,4] [,5] [,6]     [,7]    [,8]     [,9]    [,10]    [,11]
#>  [1,]    0    0    0    0    0    0 39.35185 472.586 1867.063 1208.333 2833.333
#>  [2,]    0    0    0    0    0    0 39.35185 472.586 1867.063 1208.333 2833.333
#>  [3,]    0    0    0    0    0    0  0.00000   0.000    0.000    0.000    0.000
#>  [4,]    0    0    0    0    0    0  0.00000   0.000    0.000    0.000    0.000
#>  [5,]    0    0    0    0    0    0  0.00000   0.000    0.000    0.000    0.000
#>  [6,]    0    0    0    0    0    0  0.00000   0.000    0.000    0.000    0.000
#>  [7,]    0    0    0    0    0    0  0.00000   0.000    0.000    0.000    0.000
#>  [8,]    0    0    0    0    0    0  0.00000   0.000    0.000    0.000    0.000
#>  [9,]    0    0    0    0    0    0  0.00000   0.000    0.000    0.000    0.000
#> [10,]    0    0    0    0    0    0  0.00000   0.000    0.000    0.000    0.000
#> [11,]    0    0    0    0    0    0  0.00000   0.000    0.000    0.000    0.000
#> 
#> 
#> $hstages
#> [1] NA
#> 
#> $agestages
#>   NA
#> 1 NA
#> 
#> $ahstages
#>    stage_id stage original_size original_size_b original_size_c min_age max_age
#> 1         1    SD           0.0              NA              NA       0      NA
#> 2         2    P1           0.0              NA              NA       0      NA
#> 3         3    P2           0.0              NA              NA       0      NA
#> 4         4    P3           0.0              NA              NA       0      NA
#> 5         5    SL           0.0              NA              NA       0      NA
#> 6         6     D           0.0              NA              NA       0      NA
#> 7         7   XSm           1.0              NA              NA       0      NA
#> 8         8    Sm           3.0              NA              NA       0      NA
#> 9         9    Md           6.0              NA              NA       0      NA
#> 10       10    Lg          11.0              NA              NA       0      NA
#> 11       11   XLg          19.5              NA              NA       0      NA
#>    repstatus obsstatus propstatus immstatus matstatus entrystage indataset
#> 1          0         0          1         0         0          1         0
#> 2          0         0          0         1         0          1         0
#> 3          0         0          0         1         0          0         0
#> 4          0         0          0         1         0          0         0
#> 5          0         0          0         1         0          0         0
#> 6          0         0          0         0         1          0         1
#> 7          1         1          0         0         1          0         1
#> 8          1         1          0         0         1          0         1
#> 9          1         1          0         0         1          0         1
#> 10         1         1          0         0         1          0         1
#> 11         1         1          0         0         1          0         1
#>    binhalfwidth_raw sizebin_min sizebin_max sizebin_center sizebin_width
#> 1               0.0         0.0         0.0            0.0             0
#> 2               0.0         0.0         0.0            0.0             0
#> 3               0.0         0.0         0.0            0.0             0
#> 4               0.0         0.0         0.0            0.0             0
#> 5               0.0         0.0         0.0            0.0             0
#> 6               0.5        -0.5         0.5            0.0             1
#> 7               0.5         0.5         1.5            1.0             1
#> 8               1.5         1.5         4.5            3.0             3
#> 9               1.5         4.5         7.5            6.0             3
#> 10              3.5         7.5        14.5           11.0             7
#> 11              5.0        14.5        24.5           19.5            10
#>    binhalfwidthb_raw sizebinb_min sizebinb_max sizebinb_center sizebinb_width
#> 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
#>    binhalfwidthc_raw sizebinc_min sizebinc_max sizebinc_center sizebinc_width
#> 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
#>    group                       comments alive almostborn
#> 1      0                   Dormant seed     1          0
#> 2      0               1st yr protocorm     1          0
#> 3      0               2nd yr protocorm     1          0
#> 4      0               3rd yr protocorm     1          0
#> 5      0                       Seedling     1          0
#> 6      0                  Dormant adult     1          0
#> 7      0    Extra small adult (1 shoot)     1          0
#> 8      0       Small adult (2-4 shoots)     1          0
#> 9      0      Medium adult (5-7 shoots)     1          0
#> 10     0      Large adult (8-14 shoots)     1          0
#> 11     0 Extra large adult (>14 shoots)     1          0
#> 
#> $labels
#>   pop patch
#> 1   1     A
#> 2   1     B
#> 3   1     C
#> 4   1     0
#> 
#> $matrixqc
#> [1] 114  34   4
#> 
#> $dataqc
#> [1]  74 320
#> 
#> attr(,"class")
#> [1] "lefkoMat"

A quick scan through our output shows that we have four matrices. The labels element shows us the order of these. There is no time term in the labels element, because all matrices are temporal means. Instead, we see that the first three matrices are the patch-level means for patches A, B, and C. This is followed by the overall population mean matrix, listed as patch 0. It also pays to look at the summary.

summary(cyp2rp_mean)
#> 
#> This ahistorical lefkoMat object contains 4 matrices.
#> 
#> Each matrix is square with 11 rows and columns, and a total of 121 elements.
#> A total of 114 survival transitions were estimated, with 28.5 per matrix.
#> A total of 34 fecundity transitions were estimated, with 8.5 per matrix.
#> This lefkoMat object covers 1 population, 4 patches, and 0 time steps.
#> 
#> The dataset contains a total of 74 unique individuals and 320 unique transitions.
#> 
#> Survival probability sum check (each matrix represented by column in order):
#>          [,1]  [,2]  [,3]  [,4]
#> Min.    0.000 0.100 0.100 0.100
#> 1st Qu. 0.100 0.140 0.140 0.140
#> Median  0.200 0.600 0.600 0.467
#> Mean    0.416 0.573 0.509 0.499
#> 3rd Qu. 0.788 0.917 0.850 0.776
#> Max.    1.000 1.000 1.000 1.000

And so we see that we have four matrices, and we see that these matrices have slightly more elements estimated, on average, than in the raw ahistorical MPM. This happened because some of the zeros in the original raw MPM were zeros only because of a sampling issue - no individuals actually transitioned through a particular transition in a particular year, but may have transitioned in other years, yielding higher numbers of non-zero elements in the arithmetic mean matrices than in the original raw matrices. Unfortunately these zeros will nonetheless drag these mean element values down artificially, potentially impacting our analyses. A comparison with the function-based means should be interesting in this regard.

cyp2fp_mean <- lmean(cypmatrix2fp)
summary(cyp2fp_mean)
#> 
#> This ahistorical lefkoMat object contains 4 matrices.
#> 
#> Each matrix is square with 54 rows and columns, and a total of 2916 elements.
#> A total of 9640 survival transitions were estimated, with 2410 per matrix.
#> A total of 192 fecundity transitions were estimated, with 48 per matrix.
#> This lefkoMat object covers 1 population, 4 patches, and 0 time steps.
#> 
#> Vital rate modeling quality control:
#> 
#> Survival estimated with 74 individuals and 320 individual transitions.
#> Observation estimated with 70 individuals and 303 individual transitions.
#> Primary size estimated with 70 individuals and 288 individual transitions.
#> Secondary size transition not estimated.
#> Tertiary size transition not estimated.
#> Reproductive status estimated with 70 individuals and 288 individual transitions.
#> Fecundity estimated with 51 individuals and 118 individual transitions.
#> Juvenile survival not estimated.
#> Juvenile observation probability not estimated.
#> Juvenile primary size transition not estimated.
#> Juvenile secondary size transition not estimated.
#> Juvenile tertiary size transition not estimated.
#> Juvenile reproduction probability not estimated.
#> Juvenile maturity transition probability not estimated.
#> 
#> Survival probability sum check (each matrix represented by column in order):
#>          [,1]  [,2]  [,3]  [,4]
#> Min.    0.100 0.100 0.100 0.100
#> 1st Qu. 0.991 0.991 0.991 0.991
#> Median  1.000 0.999 0.998 0.999
#> Mean    0.919 0.918 0.916 0.918
#> 3rd Qu. 1.000 0.999 0.999 0.999
#> Max.    1.000 1.000 0.999 1.000

The function-based mean matrices have the same number of estimated transitions as their constituent matrices, because all elements that are estimable are actually estimated using the vital rate models supplied.

Now let’s create the final sets of arithmetic mean matrices for the raw and function-based hMPMs.

cyp3rp_mean <- lmean(cypmatrix3rp)
cyp3fp_mean <- lmean(cypmatrix3fp)

summary(cyp3rp_mean)
#> 
#> This historical lefkoMat object contains 4 matrices.
#> 
#> Each matrix is square with 121 rows and columns, and a total of 14641 elements.
#> A total of 242 survival transitions were estimated, with 60.5 per matrix.
#> A total of 74 fecundity transitions were estimated, with 18.5 per matrix.
#> This lefkoMat object covers 1 population, 4 patches, and 0 time steps.
#> 
#> The dataset contains a total of 74 unique individuals and 320 unique transitions.
#> 
#> Survival probability sum check (each matrix represented by column in order):
#>           [,1]  [,2]   [,3]   [,4]
#> Min.    0.0000 0.000 0.0000 0.0000
#> 1st Qu. 0.0000 0.000 0.0000 0.0000
#> Median  0.0000 0.000 0.0000 0.0000
#> Mean    0.0747 0.128 0.0947 0.0991
#> 3rd Qu. 0.0000 0.250 0.0000 0.1000
#> Max.    1.0000 1.000 1.0000 0.9907
summary(cyp3fp_mean)
#> 
#> This historical lefkoMat object contains 4 matrices.
#> 
#> Each matrix is square with 2916 rows and columns, and a total of 8503056 elements.
#> A total of 470836 survival transitions were estimated, with 117709 per matrix.
#> A total of 9408 fecundity transitions were estimated, with 2352 per matrix.
#> This lefkoMat object covers 1 population, 4 patches, and 0 time steps.
#> 
#> Vital rate modeling quality control:
#> 
#> Survival estimated with 74 individuals and 320 individual transitions.
#> Observation estimated with 70 individuals and 303 individual transitions.
#> Primary size estimated with 70 individuals and 288 individual transitions.
#> Secondary size transition not estimated.
#> Tertiary size transition not estimated.
#> Reproductive status estimated with 70 individuals and 288 individual transitions.
#> Fecundity estimated with 51 individuals and 118 individual transitions.
#> Juvenile survival not estimated.
#> Juvenile observation probability not estimated.
#> Juvenile primary size transition not estimated.
#> Juvenile secondary size transition not estimated.
#> Juvenile tertiary size transition not estimated.
#> Juvenile reproduction probability not estimated.
#> Juvenile maturity transition probability not estimated.
#> 
#> Survival probability sum check (each matrix represented by column in order):
#>          [,1]  [,2]  [,3]  [,4]
#> Min.    0.000 0.000 0.000 0.000
#> 1st Qu. 0.965 0.965 0.964 0.965
#> Median  1.000 0.999 0.998 0.999
#> Mean    0.819 0.819 0.818 0.819
#> 3rd Qu. 1.000 0.999 0.999 0.999
#> Max.    1.000 1.000 0.999 1.000

Now let’s create the remaining population-level MPMs that have not been created. These will be MPMs that do not separate matrices by patch.

cypmatrix3r <- rlefko3(data = cypraw_v1, stageframe = cypframe_raw,
  year = "all", stages = c("stage3", "stage2", "stage1"), 
  size = c("size3added", "size2added", "size1added"), supplement = cypsupp3_raw, 
  yearcol = "year2", patchcol = "patchid", indivcol = "individ")

cypmatrix3f <- flefko3(stageframe = cypframe_fb, supplement = cypsupp3_fb, 
  modelsuite = cypmodels3, data = cypfb_env)

cypmatrix2f <- flefko2(stageframe = cypframe_fb, supplement = cypsupp2_fb, 
  modelsuite = cypmodels2, data = cypfb_env)

cyp3r_mean <- lmean(cypmatrix3r)
cyp3f_mean <- lmean(cypmatrix3f)
cyp2r_mean <- lmean(cypmatrix2r)
cyp2f_mean <- lmean(cypmatrix2f)

Before moving further, let’s show how we may use our individual covariate-related vital rate models to create MPMs contingent on some values of those individual covariates. Here, we create one more function-based MPMs in which we use the lefkoMod object created to handle precipitation, along with a specific value of total annual precipitation.

cypmatrix2f_env <- flefko2(stageframe = cypframe_fb, supplement = cypsupp2_fb, 
  modelsuite = cypmodels2p_env, data = cypfb_env, inda = 90)

summary(cypmatrix2f_env)
#> 
#> This ahistorical lefkoMat object contains 5 matrices.
#> 
#> Each matrix is square with 54 rows and columns, and a total of 2916 elements.
#> A total of 12050 survival transitions were estimated, with 2410 per matrix.
#> A total of 240 fecundity transitions were estimated, with 48 per matrix.
#> This lefkoMat object covers 1 population, 1 patch, and 5 time steps.
#> 
#> Vital rate modeling quality control:
#> 
#> Survival estimated with 74 individuals and 320 individual transitions.
#> Observation estimated with 70 individuals and 303 individual transitions.
#> Primary size estimated with 70 individuals and 288 individual transitions.
#> Secondary size transition not estimated.
#> Tertiary size transition not estimated.
#> Reproductive status estimated with 70 individuals and 288 individual transitions.
#> Fecundity estimated with 51 individuals and 118 individual transitions.
#> Juvenile survival not estimated.
#> Juvenile observation probability not estimated.
#> Juvenile primary size transition not estimated.
#> Juvenile secondary size transition not estimated.
#> Juvenile tertiary size transition not estimated.
#> Juvenile reproduction probability not estimated.
#> Juvenile maturity transition probability not estimated.
#> 
#> Survival probability sum check (each matrix represented by column in order):
#>          [,1]     [,2]  [,3]  [,4]  [,5]
#> Min.    0.100 3.92e-08 0.100 0.100 0.100
#> 1st Qu. 0.999 3.92e-08 1.000 1.000 0.999
#> Median  1.000 3.92e-08 1.000 1.000 1.000
#> Mean    0.926 9.81e-03 0.928 0.929 0.926
#> 3rd Qu. 1.000 3.93e-08 1.000 1.000 1.000
#> Max.    1.000 1.80e-01 1.000 1.000 1.000

Here we see some differences in the column sum distributions of the matrices. If we used different values of annual precipitation, we would find more dramatic differences. For example, here we will create one more MPM that uses the actual precipitation values originally loaded.

precip_vector <- c(92.2, 57.6, 96.0, 109.8, 111.9)

cypmatrix2f_env1 <- flefko2(stageframe = cypframe_fb, supplement = cypsupp2_fb, 
  modelsuite = cypmodels2p_env, data = cypfb_env, inda = precip_vector)

summary(cypmatrix2f_env1)
#> 
#> This ahistorical lefkoMat object contains 5 matrices.
#> 
#> Each matrix is square with 54 rows and columns, and a total of 2916 elements.
#> A total of 12050 survival transitions were estimated, with 2410 per matrix.
#> A total of 240 fecundity transitions were estimated, with 48 per matrix.
#> This lefkoMat object covers 1 population, 1 patch, and 5 time steps.
#> 
#> Vital rate modeling quality control:
#> 
#> Survival estimated with 74 individuals and 320 individual transitions.
#> Observation estimated with 70 individuals and 303 individual transitions.
#> Primary size estimated with 70 individuals and 288 individual transitions.
#> Secondary size transition not estimated.
#> Tertiary size transition not estimated.
#> Reproductive status estimated with 70 individuals and 288 individual transitions.
#> Fecundity estimated with 51 individuals and 118 individual transitions.
#> Juvenile survival not estimated.
#> Juvenile observation probability not estimated.
#> Juvenile primary size transition not estimated.
#> Juvenile secondary size transition not estimated.
#> Juvenile tertiary size transition not estimated.
#> Juvenile reproduction probability not estimated.
#> Juvenile maturity transition probability not estimated.
#> 
#> Survival probability sum check (each matrix represented by column in order):
#>          [,1]  [,2]  [,3]  [,4]  [,5]
#> Min.    0.100 0.100 0.100 0.100 0.100
#> 1st Qu. 0.999 1.000 1.000 0.999 0.999
#> Median  1.000 1.000 1.000 1.000 1.000
#> Mean    0.926 0.929 0.927 0.927 0.924
#> 3rd Qu. 1.000 1.000 1.000 1.000 1.000
#> Max.    1.000 1.000 1.000 1.000 1.000

Here we see even further differences from previous MPMs. Please experiment further with this approach. You can find out more about building raw MPMs in Chapter 4, and about building function-based MPMs and IPMs in Chapter 5 and Chapter 7 of lefko3: a gentle introduction.

Step 4b. Issues in modeling MPMs.

In this section, we wish to look at three issues that have arisen in MPM building so far - the importance of proper parameterization of size and fecundity, matrix dimensionality reduction, and Ehrlén format vs. deVries format. We will also consider a fourth issue - vital rate model accuracy.

The first issue is the proper parameterization of size and fecundity in the function-based approach. In this example, we used the sf_distrib() function to assess the distributions to use, since we knew that both size and fecundity are count variables. That assessment led to the choice of the zero-truncated negative binomial distribution to model size, and the zero-inflated Poisson distribution to model fecundity. The impact of the choices we made for these distributions can be quite profound, and can strongly impact the results of analysis. To allow us to make comparisons later, let’s create two more sets of vital rate models and one more function-based ahMPM utilizing the Poisson distribution for both size and fecundity. Note that this choice may have a large effect because the Poisson distribution assumes that the mean and variance are equal (the negative binomial only assumes that they are related), and actually predicts specific numbers of zeros (zero truncation and zero inflation make this far more flexible).

cypmodels2_wrong <- modelsearch(cypfb_v1, historical = FALSE, approach = "mixed", 
  vitalrates = c("surv", "obs", "size", "repst", "fec"),
  sizedist = "poisson", fecdist = "poisson", suite = "full",
  size = c("size3added", "size2added", "size1added"), quiet = TRUE)

cypmodels2p_wrong <- modelsearch(cypfb_v1, historical = FALSE, approach = "mixed", 
  vitalrates = c("surv", "obs", "size", "repst", "fec"), patch = "patchid",
  sizedist = "poisson", fecdist = "poisson", suite = "full",
  size = c("size3added", "size2added", "size1added"), quiet = TRUE)

cypmodels3_wrong <- modelsearch(cypfb_v1, historical = TRUE, approach = "mixed", 
  vitalrates = c("surv", "obs", "size", "repst", "fec"),
  sizedist = "poisson", fecdist = "poisson", suite = "full",
  size = c("size3added", "size2added", "size1added"), quiet = TRUE)

cypmatrix2f_wrong <- flefko2(stageframe = cypframe_fb, supplement = cypsupp2_fb, 
  modelsuite = cypmodels2_wrong, data = cypfb_env)

cypmatrix2fp_wrong <- flefko2(stageframe = cypframe_fb, supplement = cypsupp2_fb, 
  modelsuite = cypmodels2p_wrong, data = cypfb_env)

cypmatrix3f_wrong <- flefko3(stageframe = cypframe_fb, supplement = cypsupp3_fb, 
  modelsuite = cypmodels3_wrong, data = cypfb_env)

summary(cypmatrix2f_wrong)
#> 
#> This ahistorical lefkoMat object contains 5 matrices.
#> 
#> Each matrix is square with 54 rows and columns, and a total of 2916 elements.
#> A total of 12048 survival transitions were estimated, with 2409.6 per matrix.
#> A total of 240 fecundity transitions were estimated, with 48 per matrix.
#> This lefkoMat object covers 1 population, 1 patch, and 5 time steps.
#> 
#> Vital rate modeling quality control:
#> 
#> Survival estimated with 74 individuals and 320 individual transitions.
#> Observation estimated with 70 individuals and 303 individual transitions.
#> Primary size estimated with 70 individuals and 288 individual transitions.
#> Secondary size transition not estimated.
#> Tertiary size transition not estimated.
#> Reproductive status estimated with 70 individuals and 288 individual transitions.
#> Fecundity estimated with 51 individuals and 118 individual transitions.
#> Juvenile survival not estimated.
#> Juvenile observation probability not estimated.
#> Juvenile primary size transition not estimated.
#> Juvenile secondary size transition not estimated.
#> Juvenile tertiary size transition not estimated.
#> Juvenile reproduction probability not estimated.
#> Juvenile maturity transition probability not estimated.
#> 
#> Survival probability sum check (each matrix represented by column in order):
#>          [,1]  [,2]  [,3]  [,4]  [,5]
#> Min.    0.100 0.100 0.100 0.100 0.100
#> 1st Qu. 0.944 0.910 0.923 0.938 0.942
#> Median  0.982 0.963 0.971 0.978 0.981
#> Mean    0.896 0.882 0.888 0.895 0.894
#> 3rd Qu. 0.995 0.988 0.991 0.994 0.995
#> Max.    0.999 0.997 0.998 0.999 0.999
summary(cypmatrix2fp_wrong)
#> 
#> This ahistorical lefkoMat object contains 15 matrices.
#> 
#> Each matrix is square with 54 rows and columns, and a total of 2916 elements.
#> A total of 36114 survival transitions were estimated, with 2407.6 per matrix.
#> A total of 720 fecundity transitions were estimated, with 48 per matrix.
#> This lefkoMat object covers 1 population, 3 patches, and 5 time steps.
#> 
#> Vital rate modeling quality control:
#> 
#> Survival estimated with 74 individuals and 320 individual transitions.
#> Observation estimated with 70 individuals and 303 individual transitions.
#> Primary size estimated with 70 individuals and 288 individual transitions.
#> Secondary size transition not estimated.
#> Tertiary size transition not estimated.
#> Reproductive status estimated with 70 individuals and 288 individual transitions.
#> Fecundity estimated with 51 individuals and 118 individual transitions.
#> Juvenile survival not estimated.
#> Juvenile observation probability not estimated.
#> Juvenile primary size transition not estimated.
#> Juvenile secondary size transition not estimated.
#> Juvenile tertiary size transition not estimated.
#> Juvenile reproduction probability not estimated.
#> Juvenile maturity transition probability not estimated.
#> 
#> Survival probability sum check (each matrix represented by column in order):
#>          [,1]  [,2]  [,3]  [,4]  [,5]  [,6]  [,7]  [,8]  [,9] [,10] [,11] [,12]
#> Min.    0.100 0.100 0.100 0.100 0.100 0.100 0.100 0.100 0.100 0.100 0.100 0.100
#> 1st Qu. 0.927 0.886 0.902 0.920 0.925 0.948 0.915 0.928 0.942 0.946 0.961 0.934
#> Median  0.974 0.949 0.959 0.968 0.973 0.985 0.966 0.974 0.981 0.984 0.990 0.977
#> Mean    0.889 0.870 0.878 0.887 0.886 0.899 0.885 0.891 0.898 0.897 0.903 0.893
#> 3rd Qu. 0.992 0.981 0.986 0.990 0.992 0.996 0.989 0.992 0.995 0.996 0.998 0.994
#> Max.    0.998 0.994 0.996 0.998 0.998 0.999 0.997 0.998 0.999 0.999 1.000 0.999
#>         [,13] [,14] [,15]
#> Min.    0.100 0.100 0.100
#> 1st Qu. 0.945 0.956 0.960
#> Median  0.983 0.988 0.990
#> Mean    0.898 0.903 0.901
#> 3rd Qu. 0.996 0.997 0.998
#> Max.    0.999 1.000 1.000
summary(cypmatrix3f_wrong)
#> 
#> This historical lefkoMat object contains 5 matrices.
#> 
#> Each matrix is square with 2916 rows and columns, and a total of 8503056 elements.
#> A total of 587947 survival transitions were estimated, with 117589.4 per matrix.
#> A total of 11760 fecundity transitions were estimated, with 2352 per matrix.
#> This lefkoMat object covers 1 population, 1 patch, and 5 time steps.
#> 
#> Vital rate modeling quality control:
#> 
#> Survival estimated with 74 individuals and 320 individual transitions.
#> Observation estimated with 70 individuals and 303 individual transitions.
#> Primary size estimated with 70 individuals and 288 individual transitions.
#> Secondary size transition not estimated.
#> Tertiary size transition not estimated.
#> Reproductive status estimated with 70 individuals and 288 individual transitions.
#> Fecundity estimated with 51 individuals and 118 individual transitions.
#> Juvenile survival not estimated.
#> Juvenile observation probability not estimated.
#> Juvenile primary size transition not estimated.
#> Juvenile secondary size transition not estimated.
#> Juvenile tertiary size transition not estimated.
#> Juvenile reproduction probability not estimated.
#> Juvenile maturity transition probability not estimated.
#> 
#> Survival probability sum check (each matrix represented by column in order):
#>          [,1]  [,2]  [,3]  [,4]  [,5]
#> Min.    0.000 0.000 0.000 0.000 0.000
#> 1st Qu. 0.091 0.813 0.579 0.356 0.250
#> Median  0.800 0.990 0.975 0.949 0.929
#> Mean    0.604 0.774 0.738 0.704 0.682
#> 3rd Qu. 0.972 0.999 0.997 0.993 0.990
#> Max.    1.000 1.000 1.000 1.000 1.000

We will come back to this set later in our analyses.

The second issue is matrix dimensionality reduction. Occasionally, historical matrices end up being produced in which stage-pairs exist that are not associated with any transitions. This is particularly the case with raw MPMs. The result is that the rows and columns associated with such a stage pair are completely full of zeros. In this situation, the matrix can be reduced by eliminating the stage-pair altogether. The result is a set of smaller matrices, which is useful considering that historical MPMs are generally large and can take up lots of memory. We can tell R to develop reduced MPMs by using the reduce = TRUE option in the matrix generating function that we are using. Note that this option is available in ALL matrix generating functions, even for those creating ahistorical MPMs, and that rows and columns will be reduced only if ALL matrices within the lefkoMat object have empty rows and columns associated with a particular stage or stage-pair. Here, we create a reduced function-based hMPM, and then compare it to the unreduced function-based hMPM.

cypmatrix3f_red <- flefko3(stageframe = cypframe_fb, supplement = cypsupp3_fb, 
  modelsuite = cypmodels3, data = cypfb_env, reduce = TRUE)

summary(cypmatrix3f_red)
#> 
#> This historical lefkoMat object contains 5 matrices.
#> 
#> Each matrix is square with 2458 rows and columns, and a total of 6041764 elements.
#> A total of 588545 survival transitions were estimated, with 117709 per matrix.
#> A total of 11760 fecundity transitions were estimated, with 2352 per matrix.
#> This lefkoMat object covers 1 population, 1 patch, and 5 time steps.
#> 
#> Vital rate modeling quality control:
#> 
#> Survival estimated with 74 individuals and 320 individual transitions.
#> Observation estimated with 70 individuals and 303 individual transitions.
#> Primary size estimated with 70 individuals and 288 individual transitions.
#> Secondary size transition not estimated.
#> Tertiary size transition not estimated.
#> Reproductive status estimated with 70 individuals and 288 individual transitions.
#> Fecundity estimated with 51 individuals and 118 individual transitions.
#> Juvenile survival not estimated.
#> Juvenile observation probability not estimated.
#> Juvenile primary size transition not estimated.
#> Juvenile secondary size transition not estimated.
#> Juvenile tertiary size transition not estimated.
#> Juvenile reproduction probability not estimated.
#> Juvenile maturity transition probability not estimated.
#> 
#> Survival probability sum check (each matrix represented by column in order):
#>          [,1]  [,2]  [,3]  [,4]  [,5]
#> Min.    0.000 0.000 0.000 0.000 0.000
#> 1st Qu. 0.997 0.997 0.997 0.997 0.997
#> Median  1.000 1.000 1.000 1.000 1.000
#> Mean    0.972 0.972 0.972 0.972 0.972
#> 3rd Qu. 1.000 1.000 1.000 1.000 1.000
#> Max.    1.000 1.000 1.000 1.000 1.000
summary(cypmatrix3f)
#> 
#> This historical lefkoMat object contains 5 matrices.
#> 
#> Each matrix is square with 2916 rows and columns, and a total of 8503056 elements.
#> A total of 588545 survival transitions were estimated, with 117709 per matrix.
#> A total of 11760 fecundity transitions were estimated, with 2352 per matrix.
#> This lefkoMat object covers 1 population, 1 patch, and 5 time steps.
#> 
#> Vital rate modeling quality control:
#> 
#> Survival estimated with 74 individuals and 320 individual transitions.
#> Observation estimated with 70 individuals and 303 individual transitions.
#> Primary size estimated with 70 individuals and 288 individual transitions.
#> Secondary size transition not estimated.
#> Tertiary size transition not estimated.
#> Reproductive status estimated with 70 individuals and 288 individual transitions.
#> Fecundity estimated with 51 individuals and 118 individual transitions.
#> Juvenile survival not estimated.
#> Juvenile observation probability not estimated.
#> Juvenile primary size transition not estimated.
#> Juvenile secondary size transition not estimated.
#> Juvenile tertiary size transition not estimated.
#> Juvenile reproduction probability not estimated.
#> Juvenile maturity transition probability not estimated.
#> 
#> Survival probability sum check (each matrix represented by column in order):
#>          [,1]  [,2]  [,3]  [,4]  [,5]
#> Min.    0.000 0.000 0.000 0.000 0.000
#> 1st Qu. 0.965 0.965 0.965 0.965 0.965
#> Median  1.000 1.000 1.000 1.000 1.000
#> Mean    0.819 0.819 0.819 0.819 0.819
#> 3rd Qu. 1.000 1.000 1.000 1.000 1.000
#> Max.    1.000 1.000 1.000 1.000 1.000

Our new hMPM has matrices with 2458 rows and columns, while the original unreduced hMPM has matrices with 2916 rows and columns. This is a reduction of 458 rows and columns, with an overall reduction in the size of the matrix by \(8503056-6041764 = 2461292\) elements. In memory, the unreduced hMPM takes up 1GB while the reduced hMPM takes up 725MB. So, clearly this reduced set is preferable to the unreduced set.

Third, we should consider the issue of the format of the hMPM. By default, we use Ehrlén format, which we find more intuitive and simpler to use. However, some prefer the format outlined in Vries and Caswell (2018). There is only one real difference between these formats, and that is the treatment of an individual that newly recruits in time t. Vries and Caswell (2018) argued that it is not logical to consider maternal state as the stage in time t-1 for an individual transitioning from newborn in time t to whatever its next stage is in time t+1. They therefore suggested that a prior “not yet born” stage should be added to the matrix to deal with issue. Thus, any individuals that is newly-born in time t is treated as having been in this extra stage in time t-1 (note that this stage is not considered as a part of the fecundity transition, but is instead counted ONLY in survival transitions for individuals new to the population in time t). This extra stage yields more stage-pairs in the hMPM, and causes some transitions to be split that would otherwise not be split in Ehrlén format. In any case, analyses using deVries format are not expected to yield any differences analytically from Ehrlén format, but the different matrix dimensions and small differences in treatment of some transitions will likely yield small differences overall here and there. Functions rlefko3() and flefko3() both produce Ehrlén format matrices by default, but users can also produce deVries format matrices by setting format = "deVries", as below.

cypmatrix3f_dev <- flefko3(stageframe = cypframe_fb, supplement = cypsupp3_fb, 
  modelsuite = cypmodels3, data = cypfb_env, format = "deVries")

summary(cypmatrix3f_dev)
#> 
#> This historical lefkoMat object contains 5 matrices.
#> 
#> Each matrix is square with 2970 rows and columns, and a total of 8820900 elements.
#> A total of 588305 survival transitions were estimated, with 117661 per matrix.
#> A total of 11760 fecundity transitions were estimated, with 2352 per matrix.
#> This lefkoMat object covers 1 population, 1 patch, and 5 time steps.
#> 
#> Vital rate modeling quality control:
#> 
#> Survival estimated with 74 individuals and 320 individual transitions.
#> Observation estimated with 70 individuals and 303 individual transitions.
#> Primary size estimated with 70 individuals and 288 individual transitions.
#> Secondary size transition not estimated.
#> Tertiary size transition not estimated.
#> Reproductive status estimated with 70 individuals and 288 individual transitions.
#> Fecundity estimated with 51 individuals and 118 individual transitions.
#> Juvenile survival not estimated.
#> Juvenile observation probability not estimated.
#> Juvenile primary size transition not estimated.
#> Juvenile secondary size transition not estimated.
#> Juvenile tertiary size transition not estimated.
#> Juvenile reproduction probability not estimated.
#> Juvenile maturity transition probability not estimated.
#> 
#> Survival probability sum check (each matrix represented by column in order):
#>          [,1]  [,2]  [,3]  [,4]  [,5]
#> Min.    0.000 0.000 0.000 0.000 0.000
#> 1st Qu. 0.965 0.965 0.965 0.965 0.965
#> Median  1.000 1.000 1.000 1.000 1.000
#> Mean    0.802 0.802 0.802 0.802 0.802
#> 3rd Qu. 1.000 1.000 1.000 1.000 1.000
#> Max.    1.000 1.000 1.000 1.000 1.000
summary(cypmatrix3f)
#> 
#> This historical lefkoMat object contains 5 matrices.
#> 
#> Each matrix is square with 2916 rows and columns, and a total of 8503056 elements.
#> A total of 588545 survival transitions were estimated, with 117709 per matrix.
#> A total of 11760 fecundity transitions were estimated, with 2352 per matrix.
#> This lefkoMat object covers 1 population, 1 patch, and 5 time steps.
#> 
#> Vital rate modeling quality control:
#> 
#> Survival estimated with 74 individuals and 320 individual transitions.
#> Observation estimated with 70 individuals and 303 individual transitions.
#> Primary size estimated with 70 individuals and 288 individual transitions.
#> Secondary size transition not estimated.
#> Tertiary size transition not estimated.
#> Reproductive status estimated with 70 individuals and 288 individual transitions.
#> Fecundity estimated with 51 individuals and 118 individual transitions.
#> Juvenile survival not estimated.
#> Juvenile observation probability not estimated.
#> Juvenile primary size transition not estimated.
#> Juvenile secondary size transition not estimated.
#> Juvenile tertiary size transition not estimated.
#> Juvenile reproduction probability not estimated.
#> Juvenile maturity transition probability not estimated.
#> 
#> Survival probability sum check (each matrix represented by column in order):
#>          [,1]  [,2]  [,3]  [,4]  [,5]
#> Min.    0.000 0.000 0.000 0.000 0.000
#> 1st Qu. 0.965 0.965 0.965 0.965 0.965
#> Median  1.000 1.000 1.000 1.000 1.000
#> Mean    0.819 0.819 0.819 0.819 0.819
#> 3rd Qu. 1.000 1.000 1.000 1.000 1.000
#> Max.    1.000 1.000 1.000 1.000 1.000

Our new matrices have 54 more rows and columns, and over 300,000 more elements. To see what is different, compare the hstages element in each on your own, and you will see the inclusion of some new stage pairs with the AlmostBorn stage. Some transitions were split, as well, yielding different numbers of transitions that were estimated as non-zero.

Finally, we will address the issue of vital rate model accuracy. This issue is generally ignored in most of the function-based MPM / IPM literature, but the truth of the matter is that function-based MPMs are only as good as the vital rate models that they are parameterized with. If the best-fit models determining vital rates are themselves not particularly good descriptions of the demographic data, then they will yield erroneous predictions and analytical results. Ideally, users interested in parameterizing function-based MPMs will assess the overall quality of each of their vital rate models.The quality of vital rate models utilizing a binomial response can be assessed using accuracy, which refers to the ability of a binomial response model to predict the original dataset. Other models can be assessed with pseudo-R2. To see the quality of a set of models, look at the summary of a lefkoMod object.

summary(cypmodels3)
#> This LefkoMod object includes 5 linear models.
#> Best-fit model criterion used: aicc&k
#> 
#> 
#> 
#> Survival model:
#> Generalized linear mixed model fit by maximum likelihood (Laplace
#>   Approximation) [glmerMod]
#>  Family: binomial  ( logit )
#> Formula: alive3 ~ size2added + (1 | year2) + (1 | individ)
#>    Data: subdata
#>      AIC      BIC   logLik deviance df.resid 
#> 128.1324 143.2057 -60.0662 120.1324      316 
#> Random effects:
#>  Groups  Name        Std.Dev.
#>  individ (Intercept) 1.198361
#>  year2   (Intercept) 0.008826
#> Number of obs: 320, groups:  individ, 74; year2, 5
#> Fixed Effects:
#> (Intercept)   size2added  
#>      2.0352       0.6344  
#> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
#> 
#> 
#> 
#> Observation model:
#> Generalized linear mixed model fit by maximum likelihood (Laplace
#>   Approximation) [glmerMod]
#>  Family: binomial  ( logit )
#> Formula: obsstatus3 ~ size2added + (1 | year2) + (1 | individ)
#>    Data: subdata
#>      AIC      BIC   logLik deviance df.resid 
#> 118.2567 133.1117 -55.1284 110.2567      299 
#> Random effects:
#>  Groups  Name        Std.Dev. 
#>  individ (Intercept) 1.078e-05
#>  year2   (Intercept) 8.776e-01
#> Number of obs: 303, groups:  individ, 70; year2, 5
#> Fixed Effects:
#> (Intercept)   size2added  
#>      2.4904       0.3134  
#> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
#> 
#> 
#> 
#> Size model:
#> Formula:          size3added ~ (1 | year2) + (1 | individ)
#> Data: subdata
#>       AIC       BIC    logLik  df.resid 
#> 1008.2748 1022.9266 -500.1374       284 
#> Random-effects (co)variances:
#> 
#> Conditional model:
#>  Groups  Name        Std.Dev.
#>  year2   (Intercept) 0.1109  
#>  individ (Intercept) 1.0562  
#> 
#> Number of obs: 288 / Conditional model: year2, 5; individ, 70
#> 
#> Dispersion parameter for truncated_nbinom2 family (): 9.81e+08 
#> 
#> Fixed Effects:
#> 
#> Conditional model:
#> (Intercept)  
#>       0.576  
#> 
#> 
#> 
#> Secondary size model:
#> [1] 1
#> 
#> 
#> 
#> Tertiary size model:
#> [1] 1
#> 
#> 
#> 
#> Reproductive status model:
#> Generalized linear mixed model fit by maximum likelihood (Laplace
#>   Approximation) [glmerMod]
#>  Family: binomial  ( logit )
#> Formula: repstatus3 ~ repstatus2 + size2added + (1 | year2) + (1 | individ)
#>    Data: subdata
#>       AIC       BIC    logLik  deviance  df.resid 
#>  333.6176  351.9324 -161.8088  323.6176       283 
#> Random effects:
#>  Groups  Name        Std.Dev.
#>  individ (Intercept) 0.1829  
#>  year2   (Intercept) 0.6250  
#> Number of obs: 288, groups:  individ, 70; year2, 5
#> Fixed Effects:
#> (Intercept)   repstatus2   size2added  
#>     -1.4630       1.6457       0.1715  
#> 
#> 
#> 
#> Fecundity model:
#> Formula:          feca2 ~ size2added + (1 | year2) + (1 | individ)
#> Zero inflation:         ~size2added + (1 | year2) + (1 | individ)
#> Data: subdata
#>       AIC       BIC    logLik  df.resid 
#>  248.8609  271.0264 -116.4305       110 
#> Random-effects (co)variances:
#> 
#> Conditional model:
#>  Groups  Name        Std.Dev.
#>  year2   (Intercept) 0.5760  
#>  individ (Intercept) 0.1639  
#> 
#> Zero-inflation model:
#>  Groups  Name        Std.Dev. 
#>  year2   (Intercept) 1.642e-06
#>  individ (Intercept) 3.089e-04
#> 
#> Number of obs: 118 / Conditional model: year2, 5; individ, 51 / Zero-inflation model: year2, 5; individ, 51
#> 
#> Fixed Effects:
#> 
#> Conditional model:
#> (Intercept)   size2added  
#>    -0.54014      0.06174  
#> 
#> Zero-inflation model:
#> (Intercept)   size2added  
#>       3.865       -1.574  
#> 
#> 
#> Juvenile survival model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile observation model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile size model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile secondary size model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile tertiary size model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile reproduction model:
#> [1] 1
#> 
#> 
#> 
#> Juvenile maturity model:
#> [1] 1
#> 
#> 
#> 
#> 
#> 
#> Number of models in survival table: 16
#> 
#> Number of models in observation table: 16
#> 
#> Number of models in size table: 16
#> 
#> Number of models in secondary size table: 1
#> 
#> Number of models in tertiary size table: 1
#> 
#> Number of models in reproduction status table: 16
#> 
#> Number of models in fecundity table: 239
#> 
#> Number of models in juvenile survival table: 1
#> 
#> Number of models in juvenile observation table: 1
#> 
#> Number of models in juvenile size table: 1
#> 
#> Number of models in juvenile secondary size table: 1
#> 
#> Number of models in juvenile tertiary size table: 1
#> 
#> Number of models in juvenile reproduction table: 1
#> 
#> Number of models in juvenile maturity table: 1
#> 
#> 
#> 
#> 
#> 
#> General model parameter names (column 1), and 
#> specific names used in these models (column 2): 
#>                       parameter_names mainparams
#> 1                              time t      year2
#> 2                          individual    individ
#> 3                               patch      patch
#> 4                   alive in time t+1      surv3
#> 5                observed in time t+1       obs3
#> 6                   sizea in time t+1      size3
#> 7                   sizeb in time t+1     sizeb3
#> 8                   sizec in time t+1     sizec3
#> 9     reproductive status in time t+1     repst3
#> 10              fecundity in time t+1       fec3
#> 11                fecundity in time t       fec2
#> 12                    sizea in time t      size2
#> 13                  sizea in time t-1      size1
#> 14                    sizeb in time t     sizeb2
#> 15                  sizeb in time t-1     sizeb1
#> 16                    sizec in time t     sizec2
#> 17                  sizec in time t-1     sizec1
#> 18      reproductive status in time t     repst2
#> 19    reproductive status in time t-1     repst1
#> 20        maturity status in time t+1     matst3
#> 21          maturity status in time t     matst2
#> 22                      age in time t        age
#> 23                  density in time t    density
#> 24   individual covariate a in time t   indcova2
#> 25 individual covariate a in time t-1   indcova1
#> 26   individual covariate b in time t   indcovb2
#> 27 individual covariate b in time t-1   indcovb1
#> 28   individual covariate c in time t   indcovc2
#> 29 individual covariate c in time t-1   indcovc1
#> 30              stage group in time t     group2
#> 31            stage group in time t-1     group1
#> 
#> 
#> 
#> 
#> 
#> Quality control:
#> 
#> Survival estimated with 74 individuals and 320 individual transitions.
#> Survival accuracy is 0.947.
#> Observation estimated with 70 individuals and 303 individual transitions.
#> Observation accuracy is 0.95.
#> Primary size estimated with 70 individuals and 288 individual transitions.
#> Primary size pseudo R-squared is 0.
#> Secondary size transition not estimated.
#> Tertiary size transition not estimated.
#> Reproductive status estimated with 70 individuals and 288 individual transitions.
#> Reproductive status accuracy is 0.715.
#> Fecundity estimated with 51 individuals and 118 individual transitions.
#> Fecundity pseudo R-squared is 0.32.
#> Juvenile survival not estimated.
#> Juvenile observation probability not estimated.
#> Juvenile primary size transition not estimated.
#> Juvenile secondary size transition not estimated.
#> Juvenile tertiary size transition not estimated.
#> Juvenile reproduction probability not estimated.
#> Juvenile maturity probability not estimated.

Our accuracy results are at the bottom of the summary. They suggest that the survival and observation models are pretty good, but the reproduction model is wrong almost 1/3 of the time. Our primary size model has a very low pseudo-R2, as does fecundity. This may all affect the performance of this model down the line.

Step 5. MPM analysis

Now let’s estimate the asymptotic deterministic population growth rate for each of the four sets of patch-level MPMs. We will start by looking at the annual population growth rate estimated from the raw analyses.

cyp2rp_lam <- lambda3(cypmatrix2rp)
cyp2fp_lam <- lambda3(cypmatrix2fp)
cyp3rp_lam <- lambda3(cypmatrix3rp)
cyp3fp_lam <- lambda3(cypmatrix3fp)

plot(lambda ~ year2, data = subset(cyp2rp_lam, patch == "A"),
  ylim = c(0, 1.25), type = "l", lwd = 2, bty = "n")
lines(lambda ~ year2, data = subset(cyp2rp_lam, patch == "B"), type = "l",
  lwd = 2, lty = 2)
lines(lambda ~ year2, data = subset(cyp2rp_lam, patch == "C"), type = "l",
  lwd = 2, lty = 3)
lines(lambda ~ year2, data = subset(cyp3rp_lam, patch == "A"), type = "l",
  lwd = 2, lty = 1, col = "red")
lines(lambda ~ year2, data = subset(cyp3rp_lam, patch == "B"), type = "l",
  lwd = 2, lty = 2, col = "red")
lines(lambda ~ year2, data = subset(cyp3rp_lam, patch == "C"), type = "l",
  lwd = 2, lty = 3, col = "red")
legend("bottomleft", c("A ahistorical", "B ahistorical", "C ahistorical",
    "A historical", "B historical", "C historical"), lty = c(1, 2, 3, 1, 2, 3),
  col = c("black", "black", "black", "red", "red", "red"), lwd = 2, cex = 0.7,
  bty = "n")
Figure 3L.8. Ahistorical vs. historical, raw lambda

Figure 3L.8. Ahistorical vs. historical, raw lambda

Here we see that \(\lambda\) is different between the ahistorical and historical cases in the raw MPMs. Let’s compare the results above to the asymptotic deterministic population growth rate in the function-based MPMs.

plot(lambda ~ year2, data = subset(cyp2fp_lam, patch == "A"),
  ylim = c(0.75, 1.20), type = "l", lwd = 2, bty = "n")
lines(lambda ~ year2, data = subset(cyp2fp_lam, patch == "B"), type = "l",
  lwd = 2, lty = 2)
lines(lambda ~ year2, data = subset(cyp2fp_lam, patch == "C"), type = "l",
  lwd = 2, lty = 3)
lines(lambda ~ year2, data = subset(cyp3fp_lam, patch == "A"), type = "l",
  lwd = 2, lty = 1, col = "red")
lines(lambda ~ year2, data = subset(cyp3fp_lam, patch == "B"), type = "l",
  lwd = 2, lty = 2, col = "red")
lines(lambda ~ year2, data = subset(cyp3fp_lam, patch == "C"), type = "l",
  lwd = 2, lty = 3, col = "red")
legend("bottomleft", c("A ahistorical", "B ahistorical", "C ahistorical",
    "A historical", "B historical", "C historical"), lty = c(1, 2, 3, 1, 2, 3),
  col = c("black", "black", "black", "red", "red", "red"), lwd = 2, cex = 0.7,
  bty = "n")
Figure 3L.9. Ahistorical vs. historical, function-based lambda

Figure 3L.9. Ahistorical vs. historical, function-based lambda

Note that we see very different predictions from the function-based MPMs than from the raw MPMs here. There are several reasons for this. First, there are strong impacts of the quality and size of the dataset, and of the vital rate models. Raw MPMs are parameterized by the actual transitions that were documented during the study, while the function-based MPMs are parameterized with the vital rate models, which represent process variance and exclude error that cannot be attributed to the modeled factors. In a sufficiently small dataset, many transitions will be lacking in the raw MPMs because there are too few individual to propagate all transition estimates, and in turn these estimates get treated as zeros that artificially drag down some matrix element means and can decrease \(\lambda\). The function-based approach, in contrast, is parameterized by vital rate models that use the dataset as a whole to identify trends, rather than being susceptible to the seemingly random nature in which individuals contribute to transitions. However, smaller datasets will also affect function-based MPMs by yielding vital rate models that are less variable and less influenced by tested factors, as a result of lost statistical power. They are also only as good as their vital rate models, and so there may be an influence of some of the loss of accuracy that we witnessed in the vital rate model for reproductive status, and imperfect prediction of size and fecundity. Remember that poor accuracy in linear modeling affects the predictions of models by making them more “horizontal”.

A second issue that is less obvious is that our MPMs generally involve case-specific assumptions that can have great effects on predicted population dynamics. The biggest assumption that we make in these MPMs is the nature of fecundity - our model assumes that individuals become seedlings at least three years after seed production, and that the numbers of seed produced, the germination rate, the survival probabilities of juvenile stages, and the entry rates into the adult population (i.e. the recruitment rate) are all constant. In truth, the literature suggests that these are all problematic assumptions - the range in seeds produced per pod is likely to range from 500 to over 50,000, and adequate estimates of survival probability of any juvenile stage are essentially lacking in wild orchid populations. The most profound break likely comes from the assumptions about the germination rate, because what little literature exists on this topic suggests that germination rate is strongly variable across years, potentially reflecting the strong influence of variability in weather from year to year, and that germination is actually strongly density dependent. These assumptions should be addressed through more intensive research and exploration.

The literature has steadily given preference to function-based models like IPMs over the years, but which approach is more appropriate is actually likely to be a strong function of how large a dataset is, and whether the factors utilized truly explain variation in vital rates well.

Now let’s compare the overall \(\lambda\) of the patch-level arithmetic mean matrices, and the stochastic log growth rate, \(a = \text{log} \lambda _{S}\). To make sure that our stochastic growth rate estimates equal yours, we will use the set.seed() function prior to each stochastic run. We will also use the defaults, which include estimation via 10,000 time steps and equivalent time weights.

writeLines("Raw ahistorical lambda:")
#> Raw ahistorical lambda:
lambda3(cyp2rp_mean)
#>   pop patch   lambda
#> 1   1     A 1.035653
#> 2   1     B 1.151105
#> 3   1     C 1.112109
#> 4   1     0 1.092164
writeLines("\nRaw historical lambda:")
#> 
#> Raw historical lambda:
lambda3(cyp3rp_mean)
#>   pop patch    lambda
#> 1   1     A 0.8220534
#> 2   1     B 0.8157691
#> 3   1     C 0.9050548
#> 4   1     0 0.7819680
writeLines("\nFunction-based ahistorical lambda:")
#> 
#> Function-based ahistorical lambda:
lambda3(cyp2fp_mean)
#>   pop patch   lambda
#> 1   1     A 1.124856
#> 2   1     B 1.099774
#> 3   1     C 1.116857
#> 4   1     0 1.114978
writeLines("\nFunction-based historical lambda:")
#> 
#> Function-based historical lambda:
lambda3(cyp3fp_mean)
#>   pop patch    lambda
#> 1   1     A 0.9584168
#> 2   1     B 0.9615899
#> 3   1     C 0.9638301
#> 4   1     0 0.9612768

writeLines("Raw ahistorical stochastic log lambda:")
#> Raw ahistorical stochastic log lambda:
set.seed(42)
slambda3(cypmatrix2rp)
#>   pop patch          a       var        sd          se
#> 1   1     A 0.01755652 4.4183458 2.1019862 0.021019862
#> 2   1     B 0.13829938 1.3681927 1.1696977 0.011696977
#> 3   1     C 0.10429814 1.2296795 1.1089092 0.011089092
#> 4   1     0 0.08601101 0.7931451 0.8905869 0.008905869
writeLines("\nRaw historical stochastic log lambda:")
#> 
#> Raw historical stochastic log lambda:
set.seed(42)
slambda3(cypmatrix3rp)
#>   pop patch          a       var        sd          se
#> 1   1     A -0.2238227 6.3215036 2.5142600 0.025142600
#> 2   1     B -0.2352251 2.3058704 1.5185093 0.015185093
#> 3   1     C -0.1237223 3.8913169 1.9726421 0.019726421
#> 4   1     0 -0.2582062 0.9199694 0.9591503 0.009591503
writeLines("\nFunction-based ahistorical stochastic log lambda:")
#> 
#> Function-based ahistorical stochastic log lambda:
set.seed(42)
slambda3(cypmatrix2fp)
#>   pop patch          a        var        sd          se
#> 1   1     A 0.11774998 0.07497810 0.2738213 0.002738213
#> 2   1     B 0.09489865 0.09217605 0.3036051 0.003036051
#> 3   1     C 0.11049388 0.04553841 0.2133973 0.002133973
#> 4   1     0 0.10905382 0.06876260 0.2622262 0.002622262
writeLines("\nFunction-based historical stochastic log lambda:")
#> 
#> Function-based historical stochastic log lambda:
set.seed(42)
slambda3(cypmatrix3fp)
#>   pop patch           a        var        sd          se
#> 1   1     A -0.04244249 0.05620614 0.2370783 0.002370783
#> 2   1     B -0.03915492 0.07577503 0.2752726 0.002752726
#> 3   1     C -0.03678337 0.03119338 0.1766165 0.001766165
#> 4   1     0 -0.03938609 0.05199863 0.2280321 0.002280321

Users will notice at least two trends in the output above. First of all, the most obvious differences are between ahistorical and historical \(\lambda\) and \(\text{log} \lambda _{S}\) values. Generally, ahistorical values of \(\lambda\) are higher than those for historical MPMs. Part of the reason is that our historical MPMs have lost virtually all sensitivity to fecundity rates, and are now basically driven by survival terms (try changing the numbers of seeds per pod at the start of the stage frame input to see the impact of this). However, it is also likely that the difference is driven by long-term trade-offs captured within the historical models, but not within the ahistorical models. Of particular note is the growth trade-off - we have found large individuals that grew to large size in time t from small size in time t-1 have much lower survival probability to time t+1 (Shefferson, Warren II, and Pulliam 2014).

In addition to the difference between historical and ahistorical growth rate estimates, we see that function-based estimates of \(\lambda\) and \(\text{log} \lambda _{S}\) are higher than those of the raw MPMs. This is likely to be an effect of the extra variance in matrix elements caused by the occasional lack of individuals making some transitions in the raw MPM case, and of the elimination of some vital rate variance from vital rate models.

Under the circumstances, users may wonder which approach is better. While we always advocate using the historical approach over the ahistorical when modeling suggests that history is important, the question of raw vs. function-based is more challenging. All else being equal, larger datasets with more years and more individuals will make both approaches more accurate, but should have a greater influence on inference through the function-based approach than the raw approach. In general, astute, parsimonious life history model construction can make the raw MPM approach very valuable in small datasets, where the raw approach will at least preserve temporal trends in population dynamics better. In contrast, large datasets can give users the ability to explain trends in population dynamics more fully via the parameterization of very good vital rate models that can inform patterns in \(\lambda\) and other metrics.

As a comparison, we might wish to see what our growth rate estimates are when we assume the wrong distributions for size and fecundity.

wrong_mean_p <- lmean(cypmatrix2fp_wrong)
lambda3(wrong_mean_p)
#>   pop patch   lambda
#> 1   1     A 1.024659
#> 2   1     B 1.072755
#> 3   1     C 1.061490
#> 4   1     0 1.057500

set.seed(42)
slambda3(cypmatrix2fp_wrong)
#>   pop patch          a       var        sd          se
#> 1   1     A 0.02374251 0.5957806 0.7718683 0.007718683
#> 2   1     B 0.06954216 0.6581211 0.8112466 0.008112466
#> 3   1     C 0.05984725 0.5659489 0.7522957 0.007522957
#> 4   1     0 0.05595075 0.6053999 0.7780745 0.007780745

Notice that our estimates are a little lower than here than for the other function-based MPMs. The fact that they are lower is not necessarily expected - only that they are different.

Now let’s take a look at the stable stage distributions at the population level. We will look at deterministic and stochastic versions of the raw ahistorical and historical MPMs first.

tm2ss_r <- stablestage3(cyp2r_mean)
tm3ss_r <- stablestage3(cyp3r_mean)
tm2ss_rs <- stablestage3(cypmatrix2r, stochastic = TRUE, seed = 42)
tm3ss_rs <- stablestage3(cypmatrix3r, stochastic = TRUE, seed = 42)

ss_put_together <- cbind.data.frame(tm2ss_r$ss_prop, tm3ss_r$ahist$ss_prop,
  tm2ss_rs$ss_prop, tm3ss_rs$ahist$ss_prop)
names(ss_put_together) <- c("det ahist", "det hist", "sto ahist", "sto hist")
rownames(ss_put_together) <- tm2ss_r$stage_id

barplot(t(ss_put_together), beside=T, ylab = "Proportion", xlab = "Stage", 
  ylim = c(0, 0.60), col = c("black", "orangered", "grey", "darkred"), bty = "n")
legend("topright", c("det ahist", "det hist", "sto ahist", "sto hist"),
  col = c("black", "orangered", "grey", "darkred"), pch = 15, cex = 0.9, bty = "n")
Figure 3L.10. Ahistorical vs. historically-corrected stable and long-run mean stage distribution, raw MPMs

Figure 3L.10. Ahistorical vs. historically-corrected stable and long-run mean stage distribution, raw MPMs

Overall, these are generally similar patterns but with some key differences. Whether ahistorical or historical, deterministic or stochastic, our analyses suggest that dormant seeds and 1st year protocorms take up the greatest share of the stable stage structure, with 2nd year protocorms coming next. However, the proportion of second-year protocorms drops dramatically in historical analyses relative to ahistorical analyses, and stochastic analyses show a drop in dormant seeds. Adults contribute little to the stable stage structure.

Let’s now compare to the results from the function-based analyses.

tm2ss_f <- stablestage3(cyp2f_mean)
tm3ss_f <- stablestage3(cyp3f_mean)
tm2ss_fs <- stablestage3(cypmatrix2f, stochastic = TRUE, seed = 42)
tm3ss_fs <- stablestage3(cypmatrix3f, stochastic = TRUE, seed = 42)

ss_put_together <- cbind.data.frame(tm2ss_f$ss_prop, tm3ss_f$ahist$ss_prop,
  tm2ss_fs$ss_prop, tm3ss_fs$ahist$ss_prop)
names(ss_put_together) <- c("det ahist", "det hist", "sto ahist", "sto hist")
rownames(ss_put_together) <- tm2ss_f$stage_id

barplot(t(ss_put_together), beside=T, ylab = "Proportion", xlab = "Stage", 
  ylim = c(0, 0.55), col = c("black", "orangered", "grey", "darkred"), bty = "n")
legend("topright", c("det ahist", "det hist", "sto ahist", "sto hist"),
  col = c("black", "orangered", "grey", "darkred"), pch = 15, bty = "n")
Figure 3L.11. Ahistorical vs. historically-corrected stable and long-run mean stage distribution, function-based MPMs

Figure 3L.11. Ahistorical vs. historically-corrected stable and long-run mean stage distribution, function-based MPMs

If we look over the stageframe used for these MPMs (see the ahstages element of any of the function-based MPMs), we can see that at equilibrium, the population should be composed of the same stages shown to dominate in the raw case - 1st year protocorms and dormant seeds. Second-year protocorms also drop in proportion in historical analyses, as before. So, no dramatic differences from the raw analyses here.

Finally, let’s look over the predicted stable stage distribution if we use the wrong size and fecundity distributions.

tm2w_f <- stablestage3(lmean(cypmatrix2f_wrong))
tm2w_fs <- stablestage3(cypmatrix2f_wrong, stochastic = TRUE, seed = 42)
tm3w_f <- stablestage3(lmean(cypmatrix3f_wrong))
tm3w_fs <- stablestage3(cypmatrix3f_wrong, stochastic = TRUE, seed = 42)

ss_put_together <- cbind.data.frame(tm2w_f$ss_prop, tm3w_f$ahist$ss_prop,
  tm2w_fs$ss_prop, tm3w_fs$ahist$ss_prop)
names(ss_put_together) <- c("det ahist", "det hist", "sto ahist", "sto hist")
rownames(ss_put_together) <- tm2w_f$stage_id

barplot(t(ss_put_together), beside=T, ylab = "Proportion", xlab = "Stage", 
  ylim = c(0, 0.55), col = c("black", "orangered", "grey", "darkred"),
  bty = "n")
legend("topright", c("det ahist", "det hist", "sto ahist", "sto hist"),
  col = c("black", "orangered", "grey", "darkred"), pch = 15, bty = "n")
Figure 3L.12. Ahistorical stable and long-run mean stage distribution, function-based MPMs with wrong size and fecundity distributions

Figure 3L.12. Ahistorical stable and long-run mean stage distribution, function-based MPMs with wrong size and fecundity distributions

A comparison with the previous graphs shows little difference for now.

Next let’s look at the reproductive values associated with both ahistorical and historical approaches, starting with raw MPMs. We will standardize against the maximum value in each case to make these comparable (note that this is NOT standard practice - we only do it here because of the strong difference in scale across the analyses).

tm2rv_r <- repvalue3(cyp2r_mean)
tm3rv_r <- repvalue3(cyp3r_mean)
tm2rv_rs <- repvalue3(cypmatrix2r, stochastic = TRUE, seed = 42)
tm3rv_rs <- repvalue3(cypmatrix3r, stochastic = TRUE, seed = 42)

rv_put_together <- cbind.data.frame((tm2rv_r$rep_value / max(tm2rv_r$rep_value)),
  (tm3rv_r$ahist$rep_value / max(tm3rv_r$ahist$rep_value)),
  (tm2rv_rs$rep_value / max(tm2rv_rs$rep_value)),
  (tm3rv_rs$ahist$rep_value / max(tm3rv_rs$ahist$rep_value)))
names(rv_put_together) <- c("det ahist", "det hist", "sto ahist", "sto hist")
rownames(rv_put_together) <- tm2rv_r$stage_id

barplot(t(rv_put_together), beside=T, ylab = "Relative rep value", xlab = "Stage",
  ylim = c(0, 1.1), col = c("black", "orangered", "grey", "darkred"), bty = "n")
legend("topleft", c("det ahist", "det hist", "sto ahist", "sto hist"),
  col = c("black", "orangered", "grey", "darkred"), pch = 15, bty = "n")
Figure 3L.13. Ahistorical vs. historically-corrected deterministic and stochastic reproductive values, raw MPMs

Figure 3L.13. Ahistorical vs. historically-corrected deterministic and stochastic reproductive values, raw MPMs

There are some big differences here, particularly between ahistorical and historical analyses. Indeed, in the ahistorical case, reproductive value increases with size, reaching its peak in the largest adults. In contrast, in the historical case, the greatest reproductive values by far are associated with small and medium adults. So, history appears to have large effects here. Interesting results in need of further study!

Now let’s compare with the function-based case.

tm2rv_f <- repvalue3(cyp2f_mean)
tm3rv_f <- repvalue3(cyp3f_mean)
tm2rv_fs <- repvalue3(cypmatrix2f, stochastic = TRUE, seed = 42)
tm3rv_fs <- repvalue3(cypmatrix3f, stochastic = TRUE, seed = 42)

rv_put_together <- cbind.data.frame((tm2rv_f$rep_value / max(tm2rv_f$rep_value)),
  (tm3rv_f$ahist$rep_value / max(tm3rv_f$ahist$rep_value)),
  (tm2rv_fs$rep_value / max(tm2rv_fs$rep_value)),
  (tm3rv_fs$ahist$rep_value / max(tm3rv_fs$ahist$rep_value)))
names(rv_put_together) <- c("det ahist", "det hist", "sto ahist", "sto hist")
rownames(rv_put_together) <- tm2rv_f$stage_id

barplot(t(rv_put_together), beside=T, ylab = "Relative rep value", xlab = "Stage",
  ylim = c(0, 1.5), col = c("black", "orangered", "grey", "darkred"), bty = "n")
legend("topleft", c("det ahist", "det hist", "sto ahist", "sto hist"),
  col = c("black", "orangered", "grey", "darkred"), pch = 15, cex = 0.8, bty = "n")
Figure 3L.14. Ahistorical vs. historically-corrected deterministic and stochastic reproductive values, function-based MPMs

Figure 3L.14. Ahistorical vs. historically-corrected deterministic and stochastic reproductive values, function-based MPMs

We see the ahistorical MPMs showing increasing reproductive value with size again, except that the very highest values are associated with one- and two-sprouted flowering adults. In contrast, historical analyses show most adult stages with high reproductive value, and lower values for the absolute smallest stages.

Let’s now do a sensitivity analysis, again using both deterministic and stochastic approaches. First we will look at the raw ahistorical MPM.

tm2sens_r <- sensitivity3(cyp2r_mean)
set.seed(42)
tm2sens_rs <- sensitivity3(cypmatrix2r, stochastic = TRUE)

writeLines("\nThe highest deterministic sensitivity value: ")
#> 
#> The highest deterministic sensitivity value:
max(tm2sens_r$ah_sensmats[[1]][which(cyp2r_mean$A[[1]] > 0)])
#> [1] 0.9109618
writeLines("\nThis value is associated with element: ")
#> 
#> This value is associated with element:
intersect(which(tm2sens_r$ah_sensmats[[1]] == max(tm2sens_r$ah_sensmats[[1]][which(cyp2r_mean$A[[1]] > 0)])), which(cyp2r_mean$A[[1]] > 0))
#> [1] 14

writeLines("\nThe highest stochastic sensitivity value: ")
#> 
#> The highest stochastic sensitivity value:
max(tm2sens_rs$ah_sensmats[[1]][which(cyp2r_mean$A[[1]] > 0)])
#> [1] 0.8025366
writeLines("\nThis value is associated with element: ")
#> 
#> This value is associated with element:
intersect(which(tm2sens_rs$ah_sensmats[[1]] == max(tm2sens_rs$ah_sensmats[[1]][which(cyp2r_mean$A[[1]] > 0)])), which(cyp2r_mean$A[[1]] > 0))
#> [1] 14

The highest sensitivity value appears to be associated with element 14 in both deterministic and stochastic case. Since there are 11 stages in the stageframe, this means that \(\lambda\) and \(log \lambda\) are most sensitive to the transition from the 2nd stage (1st year protocorm) to the 3rd stage (2nd year protocorm). You can check this by typing, for example, ceiling(14/11) to get the correct column number and 14 %% 11 to get the correct row number for element 14.

Let’s compare this to the historical case.

tm3sens_r <- sensitivity3(cyp3r_mean)
set.seed(42)
tm3sens_rs <- sensitivity3(cypmatrix3r, stochastic = TRUE)

writeLines("\nThe highest deterministic sensitivity value: ")
#> 
#> The highest deterministic sensitivity value:
max(tm3sens_r$h_sensmats[[1]][which(cyp3r_mean$A[[1]] > 0)])
#> [1] 0.3033102
writeLines("\nThis value is associated with element: ")
#> 
#> This value is associated with element:
intersect(which(tm3sens_r$h_sensmats[[1]] == max(tm3sens_r$h_sensmats[[1]][which(cyp3r_mean$A[[1]] > 0)])), which(cyp3r_mean$A[[1]] > 0))
#> [1] 10249

writeLines("\nThe highest stochastic sensitivity value: ")
#> 
#> The highest stochastic sensitivity value:
max(tm3sens_rs$h_sensmats[[1]][which(cyp3r_mean$A[[1]] > 0)])
#> [1] 0.3411136
writeLines("\nThis value is associated with element: ")
#> 
#> This value is associated with element:
intersect(which(tm3sens_rs$h_sensmats[[1]] == max(tm3sens_rs$h_sensmats[[1]][which(cyp3r_mean$A[[1]] > 0)])), which(cyp3r_mean$A[[1]] > 0))
#> [1] 10249

Here we find that \(\lambda\) and \(log \lambda\) are both most sensitive to element 10249. Looking over the hstages portion, which outlines the 121 stage-pairs corresponding to the rows and column in these matrices, this corresponds to the the transition from the 85th stage pair (Small adult in times t-1 and t), to the 85th stage pair (Small adult in times t and t+1). So, we find here that stasis as a Small adult is most important.

Here is some simple code to help determine the exact stages for a specific element.

# For element 14 in the ahistorical case
writeLines(paste0("Element 14 in cyp2r_mean is associated with column ",
  ceiling(14 / dim(cyp2r_mean$ahstages)[1]), " and row ",
  (14 %% dim(cyp2r_mean$ahstages)[1])))
#> Element 14 in cyp2r_mean is associated with column 2 and row 3

# For element 10249 in the historical case
writeLines(paste0("Element 10249 in cyp3r_mean is associated with column ",
  ceiling(10249 / dim(cyp3r_mean$hstages)[1]), " and row ",
  (10249 %% dim(cyp3r_mean$hstages)[1])))
#> Element 10249 in cyp3r_mean is associated with column 85 and row 85

Let’s now compare to the function-based case. We will run both ahistorical and historical portions at the same time.

tm2sens_f <- sensitivity3(cyp2f_mean)
set.seed(42)
tm2sens_fs <- sensitivity3(cypmatrix2f, stochastic = TRUE)

tm3sens_f <- sensitivity3(cyp3f_mean)
set.seed(42)
tm3sens_fs <- sensitivity3(cypmatrix3f, stochastic = TRUE, steps = 500)

writeLines("\nThe highest deterministic ahistorical sensitivity value: ")
#> 
#> The highest deterministic ahistorical sensitivity value:
max(tm2sens_f$ah_sensmats[[1]][which(cyp2f_mean$A[[1]] > 0)])
#> [1] 0.8446548
writeLines("\nThis value is associated with element: ")
#> 
#> This value is associated with element:
intersect(which(tm2sens_f$ah_sensmats[[1]] == max(tm2sens_f$ah_sensmats[[1]][which(cyp2f_mean$A[[1]] > 0)])), which(cyp2f_mean$A[[1]] > 0))
#> [1] 167

writeLines("\nThe highest stochastic ahistorical sensitivity value: ")
#> 
#> The highest stochastic ahistorical sensitivity value:
max(tm2sens_fs$ah_sensmats[[1]][which(cyp2f_mean$A[[1]] > 0)])
#> [1] 0.7599012
writeLines("\nThis value is associated with element: ")
#> 
#> This value is associated with element:
intersect(which(tm2sens_fs$ah_sensmats[[1]] == max(tm2sens_fs$ah_sensmats[[1]][which(cyp2f_mean$A[[1]] > 0)])), which(cyp2f_mean$A[[1]] > 0))
#> [1] 57

writeLines("\nThe highest deterministic historical sensitivity value: ")
#> 
#> The highest deterministic historical sensitivity value:
max(tm3sens_f$h_sensmats[[1]][which(cyp3f_mean$A[[1]] > 0)])
#> [1] 0.04982402
writeLines("\nThis value is associated with element: ")
#> 
#> This value is associated with element:
intersect(which(tm3sens_f$h_sensmats[[1]] == max(tm3sens_f$h_sensmats[[1]][which(cyp3f_mean$A[[1]] > 0)])), which(cyp3f_mean$A[[1]] > 0))
#> [1] 962634

writeLines("\nThe highest stochastic historical sensitivity value: ")
#> 
#> The highest stochastic historical sensitivity value:
max(tm3sens_fs$h_sensmats[[1]][which(cyp3f_mean$A[[1]] > 0)])
#> [1] 0.05121876
writeLines("\nThis value is associated with element: ")
#> 
#> This value is associated with element:
intersect(which(tm3sens_fs$h_sensmats[[1]] == max(tm3sens_fs$h_sensmats[[1]][which(cyp3f_mean$A[[1]] > 0)])), which(cyp3f_mean$A[[1]] > 0))
#> [1] 962658

The highest sensitivity value in deterministic and stochastic ahistorical analysis appears to be the transition between different protocorms (ceiling(167 / 54) = 4 and 167 %% 54 = 5, and ceiling(57 / 54) = 2 and 57 %% 54 = 3). Inspecting each sensitivity matrix also shows that transitions near that element in both matrices are also associated with rather high sensitivities. Stochastic historical analyses suggest the strongest sensitivity in response to element 962658. Element 962658 is the transition from 1-sprouted vegetative adult in times t-1 and t to 24-sprouted flowering adult in time t+1 (column 331 and row 378). So, we continue to see that ahistorical analyses are suggesting a strong influence of the earliest stages on life, while historical analyses are suggesting a stronger influence of later adult stages.

Let’s now assess the elasticity of \(\lambda\) to matrix elements, comparing the ahistorical to the historically-corrected case in both deterministic and stochastic analyses.

tm2elas_r <- elasticity3(cyp2r_mean)
tm3elas_r <- elasticity3(cyp3r_mean)

set.seed(42)
tm2elas_rs <- elasticity3(cypmatrix2r, stochastic = TRUE)
set.seed(42)
tm3elas_rs <- elasticity3(cypmatrix3r, stochastic = TRUE)

writeLines("\nThe largest ahistorical deterministic elasticity is associated with element: ")
#> 
#> The largest ahistorical deterministic elasticity is associated with element:
which(tm2elas_r$ah_elasmats[[1]] == max(tm2elas_r$ah_elasmats[[1]]))
#> [1] 85
writeLines("\nThe largest historically-corrected deterministic elasticity is associated with element: ")
#> 
#> The largest historically-corrected deterministic elasticity is associated with element:
which(tm3elas_r$ah_elasmats[[1]] == max(tm3elas_r$ah_elasmats[[1]]))
#> [1] 85
writeLines("\nThe largest historical deterministic elasticity is associated with element: ")
#> 
#> The largest historical deterministic elasticity is associated with element:
which(tm3elas_r$h_elasmats[[1]] == max(tm3elas_r$h_elasmats[[1]]))
#> [1] 10249

writeLines("\nThe largest ahistorical stochastic elasticity is associated with element: ")
#> 
#> The largest ahistorical stochastic elasticity is associated with element:
which(tm2elas_rs$ah_elasmats[[1]] == max(tm2elas_rs$ah_elasmats[[1]]))
#> [1] 85
writeLines("\nThe largest historically-corrected stochastic elasticity is associated with element: ")
#> 
#> The largest historically-corrected stochastic elasticity is associated with element:
which(tm3elas_rs$ah_elasmats[[1]] == max(tm3elas_rs$ah_elasmats[[1]]))
#> [1] 85
writeLines("\nThe largest historical stochastic elasticity is associated with element: ")
#> 
#> The largest historical stochastic elasticity is associated with element:
which(tm3elas_rs$h_elasmats[[1]] == max(tm3elas_rs$h_elasmats[[1]]))
#> [1] 10249

Here we see something interesting - the ahistorical and historical analyses are generally agreeing about which transitions \(\lambda\) is most elastic in response to, as are the deterministic and stochastic. Here we see that \(\lambda\) and \(\text{log} \lambda _{S}\) are most elastic across the board to the ahistorical stasis transition from Small adult in time t to Small adult in time t+1, and the historical stasis transition as Small adult in times t-1, t, and t+1. This is a very different result from sensitivity analysis, and likely relates to differences the nature of the perturbation assessed in each case.

Let’s now look at the function-based case. Note that we have set the number of stochastic steps in the historical case to only 500, to make sure that this does not take too long.

tm2elas_f <- elasticity3(cyp2f_mean)
tm3elas_f <- elasticity3(cyp3f_mean)

set.seed(42)
tm2elas_fs <- elasticity3(cypmatrix2f, stochastic = TRUE)
set.seed(42)
tm3elas_fs <- elasticity3(cypmatrix3f, stochastic = TRUE, steps = 500)

writeLines("\nThe largest ahistorical deterministic elasticity is associated with element: ")
#> 
#> The largest ahistorical deterministic elasticity is associated with element:
which(tm2elas_f$ah_elasmats[[1]] == max(tm2elas_f$ah_elasmats[[1]]))
#> [1] 167
writeLines("\nThe largest historically-corrected deterministic elasticity is associated with element: ")
#> 
#> The largest historically-corrected deterministic elasticity is associated with element:
which(tm3elas_f$ah_elasmats[[1]] == max(tm3elas_f$ah_elasmats[[1]]))
#> [1] 331
writeLines("\nThe largest historical deterministic elasticity is associated with element: ")
#> 
#> The largest historical deterministic elasticity is associated with element:
which(tm3elas_f$h_elasmats[[1]] == max(tm3elas_f$h_elasmats[[1]]))
#> [1] 962611

writeLines("\nThe largest ahistorical stochastic elasticity is associated with element: ")
#> 
#> The largest ahistorical stochastic elasticity is associated with element:
which(tm2elas_fs$ah_elasmats[[1]] == max(tm2elas_fs$ah_elasmats[[1]]))
#> [1] 57
writeLines("\nThe largest historically-corrected stochastic elasticity is associated with element: ")
#> 
#> The largest historically-corrected stochastic elasticity is associated with element:
which(tm3elas_fs$ah_elasmats[[1]] == max(tm3elas_fs$ah_elasmats[[1]]))
#> [1] 331
writeLines("\nThe largest historical stochastic elasticity is associated with element: ")
#> 
#> The largest historical stochastic elasticity is associated with element:
which(tm3elas_fs$h_elasmats[[1]] == max(tm3elas_fs$h_elasmats[[1]]))
#> [1] 962611

Element 57 is the transition from 1st year to 2nd year protocorm, and element 167 is the transition from 2nd year protocorm to 3rd year protocorm. In contrast, element 331 corresponds to the ahistorical stasis transition in one-sprouted vegetative adults, and element 962611 corresponds to the historical stasis transition in this stage. So, here we see that historical analyses generally favor the adult stages, while ahistorical analyses emphasize the early stages.

Now let’s compare the elasticity of population growth rate in relation to the core life history stages, via a barplot comparison.

elas_put_together <- cbind.data.frame(colSums(tm2elas_f$ah_elasmats[[1]]),
  colSums(tm3elas_f$ah_elasmats[[1]]), colSums(tm2elas_fs$ah_elasmats[[1]]),
  colSums(tm3elas_fs$ah_elasmats[[1]]))
names(elas_put_together) <- c("det ahist", "det hist", "sto ahist", "sto hist")
rownames(elas_put_together) <- tm2elas_f$ah_stages$stage_id

barplot(t(elas_put_together), beside=T, ylab = "Elasticity", xlab = "Stage",
  col = c("black", "orangered", "grey", "darkred"), ylim = c(0, 0.20), bty = "n")
legend("topright", c("det ahist", "det hist", "sto ahist", "sto hist"),
  col = c("black", "orangered", "grey", "darkred"), pch = 15, bty = "n")
Figure 3L.15. Ahistorical vs. historically-corrected deterministic and stochastic elasticity to stage, function-based

Figure 3L.15. Ahistorical vs. historically-corrected deterministic and stochastic elasticity to stage, function-based

Elasticity analyses in these plots look quite different. All analyses show that \(\lambda\) and \(\text{log} \lambda _{S}\) are most elastic to small adult stages. However, the ahistorical analyses show that \(\lambda\) and \(\text{log} \lambda _{S}\) should be quite elastic in response to shifts in transitions from the juvenile stages. In contrast, these stages have little elasticity in historical analyses. We tend to side with the historical interpretation, but leave it up to the user to make their own determination.

Finally, let’s take a look at how the importance of different kinds of transitions changes, by looking at elasticity sums.

tm2elas_f_sums <- summary(tm2elas_f)
tm3elas_f_sums <- summary(tm3elas_f)
tm2elas_fs_sums <- summary(tm2elas_fs)
tm3elas_fs_sums <- summary(tm3elas_fs)

elas_sums_together <- cbind.data.frame(tm2elas_f_sums$ahist[,2],
  tm3elas_f_sums$ahist[,2], tm2elas_fs_sums$ahist[,2], tm3elas_fs_sums$ahist[,2])
names(elas_sums_together) <- c("det ahist", "det hist", "sto ahist", "sto hist")
rownames(elas_sums_together) <- tm2elas_f_sums$ahist$category

barplot(t(elas_sums_together), beside=T, ylab = "Elasticity", xlab = "Transition",
  col = c("black", "orangered", "grey", "darkred"), ylim = c(0, 0.50), bty = "n")
legend("topright", c("det ahist", "det hist", "sto ahist", "sto hist"),
  col = c("black", "orangered", "grey", "darkred"), pch = 15, bty = "n")
Figure 3L.16. Ahistorical vs. historically-corrected elasticity of lambda to transitions, function-based

Figure 3L.16. Ahistorical vs. historically-corrected elasticity of lambda to transitions, function-based

Fecundity makes least difference in all cases, although it does influence ahistorical analysis a reasonable amount. Growth, in contrast, appears to be among the most important transition types across the board. Stasis is more important in ahistorical than in historical analyses, and shrinkage shows the reverse pattern.

Next, we will see which historical transitions are most important.

elas_hist2plot <- cbind.data.frame(tm3elas_f_sums$hist[,2],
  tm3elas_fs_sums$hist[,2])
names(elas_hist2plot) <- c("det hist", "sto hist")
rownames(elas_hist2plot) <- tm3elas_f_sums$hist$category

par(mar = c(7, 4, 2, 2) + 0.2)
barplot(t(elas_hist2plot), beside = T, ylab = "Elasticity", xlab = "", xaxt = "n",
  col = c("orangered", "darkred"), bty = "n")
text(cex=0.75, x=seq(from = 0.2, to = 2.9*length(tm3elas_f_sums$hist$category), by = 2.95),
  y=-0.06, tm3elas_f_sums$hist$category, xpd=TRUE, srt=45)
legend("topright", c("det hist", "sto hist"),
  col = c("orangered", "darkred"), pch = 15, bty = "n")
Figure 3L.17. Elasticity of lambda to historical transitions, function-based

Figure 3L.17. Elasticity of lambda to historical transitions, function-based

We can see that growth from occasion t-1 to t followed by shrinkage to occasion t+1 is associated with the greatest summed elasticities, while the inverse, shrinkage from occasion t-1 to t followed by growth to occasion t+1 is the next most important. Transitions associated with fecundity are associated with the lowest summed elasticities.

Step 5a. Advanced analysis - projecting existing MPMs

The most recent versions of lefko3 incorporate two projection functions, projection3() and f_projection3(). We will start with projection3(), which is a generally function used to project an MPM or IPM in which the matrices have already been created. In other words, it uses an existing lefkoMat object and projects it forward, under user-defined conditions Originally, this function was developed to create simple deterministic and stochastic projections of varying lengths and complexity, with output including growth rate, stage structure, and reproductive value per time step, with a number of options designed to streamline analysis. The function now has replication, and beginning with version 5.1.0, it includes the ability to define the order of matrices explicitly.

We will demonstrate this function by conducting a simple quasi-extinction analysis. Let’s use the function-based ahistorical MPM to illustrate this, using this function to create 100 stochastic replicates of a population projection. In the code below, we set the length of time to project using times (defaults to 10,000 time steps), set the number of replicates with nreps, set that we wish to use a stochastic projection with stochastic = TRUE, and force all reproduction to yield integers only (i.e. all decimal individual values rounded down).

set.seed(42)
cypproj_2r <- projection3(cypmatrix2r, nreps = 100, stochastic = TRUE, integeronly = TRUE)

Now let’s take a look at the resulting object, which is a list of class lefkoProj. We will not output the whole object because it is quite long. Instead, let’s first look at the elements that constitute it.

names(cypproj_2r)
#> [1] "projection" "stage_dist" "rep_value"  "pop_size"   "labels"    
#> [6] "ahstages"   "hstages"    "agestages"  "control"

We see a list of nine elements, with five seemingly familiar - ahstages is the stage frame from the input MPM, hstages is a data frame showing the order of historical stage pairs (only provided if an hMPM is used as input), agestages is a data frame showing the order of age-stages (only provided if an age-by-stage MPM is used as input), labels is the order of matrices in the input MPM, and control is a basic vector summarizing the number of time steps and replicates in the projection.

The most important element is projection, which is a list with elements equal to the number of patches / populations in the MPM. Let’s take a look at its length, and compare to the labels object.

length(cypproj_2r$projection)
#> [1] 1
cypproj_2r$labels
#>   pop patch
#> 1   1     1

So we see that there is only one element in this list. This element is also a list with the number of elements equal to the number of replicates. Here, there are 100 replicates, as we can see below.

length(cypproj_2r$projection[[1]])
#> [1] 100

The next level of this object is composed of matrices - each replicate produces a single matrix. Let’s take a look at its dimensions.

dim(cypproj_2r$projection[[1]][[1]])
#> [1]    11 10001

We see that there are 11 rows and 10,001 columns. The columns correspond to the discrete times that we have projected (equals the number of time steps plus one, the latter denoting the start time). The rows correspond to the 11 stages in the stageframe. Lets’s take a look at the first few time steps of replicate 1.

cypproj_2r$projection[[1]][[1]][,1:15]
#>       [,1] [,2] [,3]  [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
#>  [1,]    1 3688 2757 16193  485   14  114    3    0   200   206   119     3
#>  [2,]    1 3688 3200 16524 2428   72  115   17    0   200   230   144    17
#>  [3,]    1    0  368   320 1652  242    7   11    1     0    20    23    14
#>  [4,]    1    0    0    36   32  165   24    0    1     0     0     2     2
#>  [5,]    1    0    0     0    3    3   16    3    0     0     0     0     0
#>  [6,]    1    0    0     0    0    0    0    3    0     1     0     0     0
#>  [7,]    1    1    0     0    0    1    2    6    5     2     1     0     0
#>  [8,]    1    1    1     0    0    0    0    0    1     1     0     0     0
#>  [9,]    1    0    0     0    0    0    0    0    0     0     0     0     0
#> [10,]    1    1    1     0    0    0    0    0    0     0     0     0     0
#> [11,]    1    1    1     0    0    0    0    0    0     0     0     0     0
#>       [,14] [,15]
#>  [1,]     0     0
#>  [2,]     0     0
#>  [3,]     1     0
#>  [4,]     1     0
#>  [5,]     0     0
#>  [6,]     0     0
#>  [7,]     0     0
#>  [8,]     0     0
#>  [9,]     0     0
#> [10,]     0     0
#> [11,]     0     0

We see an interesting pattern in which we start with a single individual of each stage, and then see a growth of juvenile stages, leading to a decline overall in the near-term. Let’s use the summary.lefkoProj() function to get a better handle on this.

summary(cypproj_2r)
#> 
#> The input lefkoProj object covers 1 population-patches.
#> It includes 10000 projected steps per replicate and 100 replicates.
#> The number of replicates with population size above the threshold size of 1 is as in
#> the following matrix, with pop-patches given by column and milepost times given by row:
#>       1 1
#> 1     100
#> 2501    0
#> 5001    0
#> 7501    0
#> 10001   0

This summary gives us some basic information about our projection, and also shows us the number of replicates with more than one individual projected alive at a series of projected times (times 1, 2501, 5001, 7501, and 10001). We can change these milepost times using either proportions or explicit times, as below.

summary(cypproj_2r, milepost = c(1, 3, 5, 8, 9, 10, 15, 25, 50, 100))
#> 
#> The input lefkoProj object covers 1 population-patches.
#> It includes 10000 projected steps per replicate and 100 replicates.
#> The number of replicates with population size above the threshold size of 1 is as in
#> the following matrix, with pop-patches given by column and milepost times given by row:
#>     1 1
#> 1   100
#> 3   100
#> 5   100
#> 8    75
#> 9    75
#> 10   73
#> 15   52
#> 25    2
#> 50    0
#> 100   0

The output above gives us a sense that the population is declining quite quickly - indeed, only 2 replicates still has at least one individual alive in time 25. We can view the actual population sizes via the pop_size element of the lefkoProj object. This element is also list, but with a slightly simpler layering that projection. Here, pop_size is a list with the number of elements equal to the number of patches / populations. Each element in this list is a matrix, with the rows coresponding to replicates and the columns corresponding to the time. Let’s view the first 10 times in the projection.

cypproj_2r$pop_size[[1]][,c(1:10)]
#>        [,1]  [,2]  [,3]  [,4]  [,5]  [,6]  [,7]  [,8]  [,9] [,10]
#>   [1,]   11  7380  6328 33073  4600   497   278    43     8   404
#>   [2,]   11 33656  8443  1033   106    17     9  9897  3854 10158
#>   [3,]   11  7380 30242 19201  7555 15975  6881  2642   972   932
#>   [4,]   11 19770 24475 10837  1408   153    25   637  5558  1955
#>   [5,]   11 39665 17437  3973   479    55    15   409  1935  1069
#>   [6,]   11 39665 13187  3892   486    57    14   634   681  1696
#>   [7,]   11  2068  2727   371    38     2     0     0     0     0
#>   [8,]   11 19770 24475  5838  3209  2926  2067   576  2575  5714
#>   [9,]   11  2068   687    85     7     0     0     0     0     0
#>  [10,]   11 33656 10006 18475  4918   611  1659  4562  6602  1494
#>  [11,]   11  2068  2727   371    38     2     0     0     0     0
#>  [12,]   11 39665  8803  2764   347    45  2513  6620  2095  2766
#>  [13,]   11  2068   913   117    11     0     0     0     0     0
#>  [14,]   11  2068   913   117    11     0     0     0     0     0
#>  [15,]   11 19770 27706  3789   407    43    11   302  9804  2255
#>  [16,]   11 39665 13187  3892   486    56  1830  1060  1391   814
#>  [17,]   11 19770 27706  3789   407    44  1100   161  6206  6401
#>  [18,]   11 19770 18391 24986  3414   370    43    14  1210  4048
#>  [19,]   11 19770  5562 22171 10578  8885  2867   767  1188  1049
#>  [20,]   11  2068   584  2293   317    31     2     0     0     0
#>  [21,]   11 39665  8803  2764   347    45  2623  6993  9161  9007
#>  [22,]   11  2068  1997   268    27     2     0     0     0     0
#>  [23,]   11 33656  8443  1033   106    19    11  6407  1700  2867
#>  [24,]   11 39665  6353  1338   159    26  2402  1592  1415  2863
#>  [25,]   11 39665  8803  2764   347    42    12  1184  1638  9330
#>  [26,]   11  2068   584   365    47     3     0     0     0     0
#>  [27,]   11  7380 18800 17598  4880 23105  3435   386   444   868
#>  [28,]   11 39665 13187  2070   230    29  1317  7707  2252  9605
#>  [29,]   11 19770  5562  3484 15463  4652  3086  3206   837   103
#>  [30,]   11  7380 30242 19200  9775  1285   142    20  2626  8560
#>  [31,]   11 33656  9623  3964   511    62    15   808  3989  1144
#>  [32,]   11 33656  9623  3964   511    59    11   301  7581  6158
#>  [33,]   11 33656  9623 10919  1485   165  1613  4555  4731  1891
#>  [34,]   11 39665  8803  1455   163    26  2737  1587  3462  1067
#>  [35,]   11 19770  3166   354    34     7     5  3646   804  2318
#>  [36,]   11 33656 10006 17735 17440  6658 10635 17158  3246  2151
#>  [37,]   11 33656  8443  1033   106    17  1826  6007  6149  1127
#>  [38,]   11 33656 22151  5329   647    73  1835  1514  2085  8040
#>  [39,]   11 19770  5562 16315  4758 23096  4353  3605   786  9863
#>  [40,]   11  7380 18800 25097  3428   368    40   691   502  5166
#>  [41,]   11 39665 13187  2295   262    31  1750   650   675  5219
#>  [42,]   11 19770  5562 25411  3531   386  1127  1070   775  5856
#>  [43,]   11 39665  6353  1008   406    58  2056  6040  1426  4845
#>  [44,]   11 33656  9623 10179  8881  1206   138  6422  1495  8957
#>  [45,]   11 39665 17437  2665   296    34    11  8195  1949   635
#>  [46,]   11 33656 22151  3351   371    44    14  1257   977  2067
#>  [47,]   11  2068  1997   268    27     2     0     0     0     0
#>  [48,]   11  2068  1997   268    27     2     0     0     0     0
#>  [49,]   11 39665 17437  2889   328    38    11  1256   976  1840
#>  [50,]   11  2068   584  2293   317    31     2     0     0     0
#>  [51,]   11 19770  5562 25411  3531   385    40  2887   809  5417
#>  [52,]   11  2068   913   117    11     0     0     0     0     0
#>  [53,]   11 33656 22151 12396  2036   239    34  1614 10487  4726
#>  [54,]   11  7380  6328 18620  2576   278   245   489  1206   461
#>  [55,]   11 39665  8224  1601   188    26    10  7294  6149  5707
#>  [56,]   11 19770  5562 16315 24757  3396  1506  2590  3209  1241
#>  [57,]   11  2068   913   117    11     0     0     0     0     0
#>  [58,]   11 19770  5562  3484 20463 10352  2497   706  2751   684
#>  [59,]   11 33656 10006 18475  2941   334  1562  3969  6955  8930
#>  [60,]   11  7380  3097   399    41     3     0     0     0     0
#>  [61,]   11  7380 18800  2597   279    28     5     3     1   226
#>  [62,]   11 33656  9623  3964   511    60    11  2850   989  7010
#>  [63,]   11 19770 24475  5003   592    64   921   760   695  6703
#>  [64,]   11 33656  8443  1033   106    16     8  7757  2337   586
#>  [65,]   11  7380 33472  6874   814    84   233    39  7297  8342
#>  [66,]   11 19770  3166   354    34     7     5  3093   831   101
#>  [67,]   11 19770 18391 17487 22366  5201   635  4399  1210 10784
#>  [68,]   11 39665 17437  2560   681    94    20  3135  7961 10862
#>  [69,]   11  2068  2727   371    38     2     0     0     0     0
#>  [70,]   11 33656  8443  1033   106    17  1826  6007  6149  1232
#>  [71,]   11  2068   584   696    93     8     0     0     0     0
#>  [72,]   11  7380 30242  9201  6155  5109  2360   311   330  5401
#>  [73,]   11 19770 18391  2486   265    29     8     4   296   664
#>  [74,]   11 39665  8224  1269   141    24    12  1260  1380  3439
#>  [75,]   11  2068  2727   371    38     2     0     0     0     0
#>  [76,]   11  2068  1997   268    27     2     0     0     0     0
#>  [77,]   11 19770 24475  5838  2374   311  1175   794  4663  6003
#>  [78,]   11 19770  3166   354    34     6   871   122    11     0
#>  [79,]   11  2068  1997   268    27     2     0     0     0     0
#>  [80,]   11 33656 10006  4985   652    74    13  1882  5847  5938
#>  [81,]   11 33656  9623 10179  8881  1206  2094  1094  1397   780
#>  [82,]   11  2068   687    85     7     0     0     0     0     0
#>  [83,]   11  2068   913   117    11     0     0     0     0     0
#>  [84,]   11  7380 18800 22598 10580  3049   601    77   602 10064
#>  [85,]   11  7380  3097   399    41     3   217    29     2     0
#>  [86,]   11  2068  1997   268    27     2     0     0     0     0
#>  [87,]   11 39665  6353  2422   310    42    14  2010 10082  2287
#>  [88,]   11  7380 33472  5277   590    59   231  2311  2203  1500
#>  [89,]   11 19770  3166   354    34     6   684   391  2489   344
#>  [90,]   11 39665  8803  2764   347    42    10  3748  1152  2307
#>  [91,]   11  7380 30242  8486  3196   410    52    12  7295  2899
#>  [92,]   11 33656 21421  7850 16003  6656  2610  4327  1780 10718
#>  [93,]   11 39665 17437  2665   296    38    15  1882  1466   786
#>  [94,]   11 33656 22151  5329   647    73    19   307 14903 12064
#>  [95,]   11 39665 17437  4704   582    68  1322  1370  4568 13625
#>  [96,]   11  2068  1997   268    27     2     0     0     0     0
#>  [97,]   11 39665  8224  1269   141    24    10  4105  5930  4229
#>  [98,]   11  2068   687    85     7     0     0     0     0     0
#>  [99,]   11  2068   584   365    47     3     0     0     0     0
#> [100,]   11 33656  8443  1033   106    16     8   630  5403  1047

We may also plot these trends using the plot() function, as below.

plot(cypproj_2r, xlim = c(0, 30), lwd = 2, bty = "n")
Figure 3L.18. Projected population size across time over 100 replicates and 10,000 time steps for the ahistorical function-based MPM

Figure 3L.18. Projected population size across time over 100 replicates and 10,000 time steps for the ahistorical function-based MPM

In the above plot, we show the results of each population projection for the first 30 projected occasions. All 100 replicates go to extinction, of course. If our MPM had higher population growth rates, then we might have had only some go to extinction. In that case, we could see the number of replicates with surviving individuals at particular points in time, and estimate the time to extinction. For example, if 95% of replicates have died out by 100 occasions, then this analysis would suggest extinction within that time. Quasi-extinction analysis would use this number against another series of replicates set up under a different set of assumptions to assess extinction. For example, we could run another analysis of data from the same population but a different patch that has been subjected to a different management regime, and compare the time to extinction in each. If the management regime is associated with increased population lifespan, then the probability of extinction is considered lower under the management scenario.

As a comparison point, let’s also look at a projection of the function-based ahistorical MPM and compare it. Then, we will plot our results as before.

set.seed(42)
cypproj_2f <- projection3(cypmatrix2f, nreps = 100, stochastic = TRUE,
  integeronly = TRUE)

plot(cypproj_2f, xlim = c(0, 30), lwd = 2, bty = "n")
Figure 3L.19. Projected population size across time over 100 replicates and 10,000 time steps for the historical function-based MPM

Figure 3L.19. Projected population size across time over 100 replicates and 10,000 time steps for the historical function-based MPM

The function-based ahistorical analysis also suggests inevitable extinction, and quite quickly. This leaves us to wonder how to boost the growth rate.

As a final analysis, we might try a comparison of our population using the raw MPM, under the current conditions against a scenario where we somehow double germination to around 30%. To do this analysis, we need to create a new set of MPMs under this new assumption. First, we will set up a new supplement table using this assumption, using the hMPM approach. Then we will take a look at it relative to the original supplement table.

cypsupp2_raw1 <- supplemental(stage3 = c("SD", "P1", "P2", "P3", "SL", "SL", "D", 
    "XSm", "SD", "P1"),
  stage2 = c("SD", "SD", "P1", "P2", "P3", "SL", "SL", "SL", "rep", "rep"),
  eststage3 = c(NA, NA, NA, NA, NA, NA, "D", "XSm", NA, NA),
  eststage2 = c(NA, NA, NA, NA, NA, NA, "XSm", "XSm", NA, NA),
  givenrate = c(0.03, 0.30, 0.1, 0.1, 0.1, 0.05, NA, NA, NA, NA),
  multiplier = c(NA, NA, NA, NA, NA, NA, NA, NA, (0.5 * seeds_per_pod),
    (0.5 * seeds_per_pod)),
  type =c(1, 1, 1, 1, 1, 1, 1, 1, 3, 3),
  stageframe = cypframe_raw, historical = FALSE)

cypsupp2_raw1
#>    stage3 stage2 stage1 eststage3 eststage2 eststage1 givenrate multiplier
#> 1      SD     SD   <NA>      <NA>      <NA>      <NA>      0.03          1
#> 2      P1     SD   <NA>      <NA>      <NA>      <NA>      0.30          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.10          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      SD    rep   <NA>      <NA>      <NA>      <NA>        NA       2500
#> 10     P1    rep   <NA>      <NA>      <NA>      <NA>        NA       2500
#>    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         3            1
#> 10        3            1

Now let’s create the new ahMPMs.

cypmatrix2r_1 <- rlefko2(data = cypraw_v1, stageframe = cypframe_raw,
  year = "all", stages = c("stage3", "stage2", "stage1"), 
  size = c("size3added", "size2added", "size1added"), 
  supplement = cypsupp2_raw1, yearcol = "year2", patchcol = "patchid",
  indivcol = "individ")

summary(cypmatrix2r_1)
#> 
#> This ahistorical lefkoMat object contains 5 matrices.
#> 
#> Each matrix is square with 11 rows and columns, and a total of 121 elements.
#> A total of 115 survival transitions were estimated, with 23 per matrix.
#> A total of 40 fecundity transitions were estimated, with 8 per matrix.
#> This lefkoMat object covers 1 population, 1 patch, and 5 time steps.
#> 
#> The dataset contains a total of 74 unique individuals and 320 unique transitions.
#> 
#> Survival probability sum check (each matrix represented by column in order):
#>          [,1]  [,2]  [,3]  [,4]  [,5]
#> Min.    0.000 0.100 0.100 0.000 0.100
#> 1st Qu. 0.100 0.215 0.215 0.100 0.215
#> Median  0.746 0.870 0.864 0.600 0.882
#> Mean    0.576 0.655 0.640 0.545 0.628
#> 3rd Qu. 1.000 1.000 1.000 0.960 1.000
#> Max.    1.000 1.000 1.000 1.000 1.000

Let’s take a quick look at our \(\lambda\) estimates to see if the population growth rare has increased.

lambda3(cypmatrix2r_1)
#>   pop patch year2    lambda
#> 1   1     1  2004 1.1798304
#> 2   1     1  2005 1.1761380
#> 3   1     1  2006 1.2104526
#> 4   1     1  2007 0.9908389
#> 5   1     1  2008 1.1282830
lambda3(cypmatrix2r)
#>   pop patch year2    lambda
#> 1   1     1  2004 1.1714145
#> 2   1     1  2005 1.1639008
#> 3   1     1  2006 1.2002440
#> 4   1     1  2007 0.9834515
#> 5   1     1  2008 1.1208121

We see small increases, but then again this is an assessment of deterministic growth rate while our projection will be stochastic. In any case, let’s conduct our new projections, and then plot them against the original hMPM projections.

set.seed(42)
cypproj_2r_1 <- projection3(cypmatrix2r_1, nreps = 100, stochastic = TRUE,
  integeronly = TRUE)

par(mfrow = c(1, 2))
plot(cypproj_2r, xlim = c(0, 50), bty = "n")
plot(cypproj_2r_1, xlim = c(0, 50), bty = "n")
Figure 3L.20. Projected population comparison of hMPMs with original fecundity vs 50% fecundity boost

Figure 3L.20. Projected population comparison of hMPMs with original fecundity vs 50% fecundity boost

We see only small improvement in the lifespan of the population with boosted fecundity (shown in red). To get a better sense of this, let’s look at the mileposts again.

summary(cypproj_2r, milepost = c(1, 3, 5, 8, 9, 10, 12, 15, 18, 20, 30, 50, 100))
#> 
#> The input lefkoProj object covers 1 population-patches.
#> It includes 10000 projected steps per replicate and 100 replicates.
#> The number of replicates with population size above the threshold size of 1 is as in
#> the following matrix, with pop-patches given by column and milepost times given by row:
#>     1 1
#> 1   100
#> 3   100
#> 5   100
#> 8    75
#> 9    75
#> 10   73
#> 12   72
#> 15   52
#> 18   25
#> 20    9
#> 30    0
#> 50    0
#> 100   0
summary(cypproj_2r_1, milepost = c(1, 3, 5, 8, 9, 10, 12, 15, 18, 20, 30, 50, 100))
#> 
#> The input lefkoProj object covers 1 population-patches.
#> It includes 10000 projected steps per replicate and 100 replicates.
#> The number of replicates with population size above the threshold size of 1 is as in
#> the following matrix, with pop-patches given by column and milepost times given by row:
#>     1 1
#> 1   100
#> 3   100
#> 5   100
#> 8    76
#> 9    76
#> 10   75
#> 12   73
#> 15   66
#> 18   45
#> 20   27
#> 30    2
#> 50    0
#> 100   0
Users will note a small difference here, with the inference that boosting germination has little real impact on the population dynamics. It is at this point that we consider other strategies, such as boosting adult survival through other means.

Function projection3() has many more features to yield powerful projections. We encourage the reader to explore Chapter 12 of lefko3: a gentle introduction for further details, including how to set up ordered, cyclical, and density dependent projections.

Step 5b. Advanced analysis - projecting function-based MPMs and IPMs

Let’s say that we are interested in projecting an MPM or IPM forward, but changing some of the inputs to values not originally observed during monitoring. The function f_projection3() allows us to do this. Essentially, this function builds a new function-based matrix at each time, assuming whatever conditions are given.

Let’s try one such projection. Let’s assume that we are interested in projecting an MPM forward based on changing values of climate. Perhaps we have predicted climate data that we wish to use in our projection. In the Cypripedium candidum case, for example, what would happen to the population dynamics if precipitation declined by 0.2cm per year for a century, assuming a starting point of 100cm per year? Let’s set up this vector, and then run a stochastic projection. Note that the contruction of a new projection matrix at each time step makes this projection take a bit more time that function projection3() takes.

pred_precip <- seq(from = 100, by = -0.2, length.out = 100)
ind_frame <- cbind.data.frame(inda = pred_precip, indb = 0, indc = 0)

set.seed(42)
cypfproj_2f_env <- f_projection3(cypfb_env, format = 3, stageframe = cypframe_fb,
  supplement = cypsupp2_fb, modelsuite = cypmodels2p_env, ind_terms = ind_frame,
  stochastic = TRUE, integeronly = TRUE, nreps = 100, times = 100)
#> Warning: Option patch not set, so will set to first patch/population.

summary(cypfproj_2f_env)
#> 
#> The input lefkoProj object covers 1 population-patches.
#> It includes 100 projected steps per replicate and 100 replicates.
#> The number of replicates with population size above the threshold size of 1 is as in
#> the following matrix, with pop-patches given by column and milepost times given by row:
#>     1 1
#> 1   100
#> 26    1
#> 51    0
#> 76    0
#> 101   0

Clearly, things did not go very well for our population under the new climate scenario. Let’s take a peek at a plot.

plot(cypfproj_2f_env)
Projected population dynamics under declining precip scenario

Projected population dynamics under declining precip scenario

This look rather similar to the preceding scenario, also leading to extinction very quickly.

Function f_projection3() includes many further options, including the ability to start with different numbers of individuals in different stages, density dependence, cyclical projection, ordered projection, substochasticity checking, differential matrix weighting in stochastic simulation, and more. Please see Chapter 12 of lefko3: a gentle introduction for further details.

Literature cited

Bartoń, Kamil A. 2014. MuMIn: Multi-Model Inference.” https://CRAN.R-project.org/package=MuMIn.
Burnham, Kenneth P., and David R. Anderson. 2002. Model Selection and Multimodel Inference: A Practical Information-Theoretic Approach. New York, New York, USA: Springer-Verlag New York, Inc.
Caswell, Hal. 2001. Matrix Population Models: Construction, Analysis, and Interpretation. Second edition. Sunderland, Massachusetts, USA: Sinauer Associates, Inc.
Ehrlén, Johan. 2000. “The Dynamics of Plant Populations: Does the History of Individuals Matter?” Ecology 81 (6): 1675–84. https://doi.org/10.1890/0012-9658(2000)081[1675:TDOPPD]2.0.CO;2.
Ellner, Stephen P., and Mark Rees. 2006. “Integral Projection Models for Species with Complex Demography.” American Naturalist 167 (3): 410–28. https://doi.org/10.1086/499438.
Jenks, George F. 1967. “The Data Model Concept in Statistical Mapping.” International Yearbook of Cartography 7: 186–90.
Kendall, Bruce E., Masami Fujiwara, Jasmin Diaz-Lopez, Sandra Schneider, Jakob Voigt, and Soren Wiesner. 2019. “Persistent Problems in the Construction of Matrix Population Models.” Ecological Modelling 406 (August): 33–43. https://doi.org/10.1016/j.ecolmodel.2019.03.011.
Shefferson, Richard P., Tiiu Kull, Michael J. Hutchings, Marc-André Selosse, Hans Jacquemyn, Kimberly M. Kellett, Eric S. Menges, et al. 2018. “Drivers of Vegetative Dormancy Across Herbaceous Perennial Plant Species.” Ecology Letters 21 (5): 724–33. https://doi.org/10.1111/ele.12940.
Shefferson, Richard P., Ryo Mizuta, and Michael J. Hutchings. 2017. “Predicting Evolution in Response to Climate Change: The Example of Sprouting Probability in Three Dormancy-Prone Orchid Species.” Royal Society Open Science 4 (1): 160647. https://doi.org/10.1098/rsos.160647.
Shefferson, Richard P., Brett K. Sandercock, Joyce Proper, and Steven R. Beissinger. 2001. “Estimating Dormancy and Survival of a Rare Herbaceous Perennial Using Mark-Recapture Models.” Ecology 82 (1): 145–56. https://doi.org/10.1890/0012-9658(2001)082[0145:EDASOA]2.0.CO;2.
Shefferson, Richard P., Robert J. Warren II, and H. Ronald Pulliam. 2014. “Life History Costs Make Perfect Sprouting Maladaptive in Two Herbaceous Perennials.” Journal of Ecology 102 (5): 1318–28. https://doi.org/10.1111/1365-2745.12281.
Vries, Charlotte de, and Hal Caswell. 2018. “Demography When History Matters: Construction and Analysis of Second-Order Matrix Population Models.” Theoretical Ecology 11 (2): 129–40. https://doi.org/10.1007/s12080-017-0353-0.