This document was built in Markdown in R 4.2.1 and covers package lefko3 version 5.3.0. 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.

For reference, please also see the other vignettes included in package lefko3, as well as our free online e-book called lefko3: a gentle introduction, available on the projects page of the Shefferson lab website.

Datasets and case studies to be used

In this vignette, we will use the cypdata and cypvert, and lathyrus datasets to illustrate the estimation of raw MPMs and function-based MPMs, including IPMs.

Cypripedium candidum

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 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 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 et al. (2017).

Lathyrus vernus

Lathyrus vernus (family Fabaceae) is a long-lived forest herb, native to Europe and large parts of northern Asia. Individuals increase slowly in size and usually flower only after 10-15 years of vegetative growth. Flowering individuals have an average conditional lifespan of 44.3 years Ehrlén (2002a). L. vernus lacks organs for vegetative spread and individuals are well delimited Ehrlén (2002b). One or several erect shoots of up to 40 cm height emerge from a subterranean rhizome in March and April. Flowering occurs about four weeks after shoot emergence. Shoot growth is determinate, and the number of flowers is determined in the previous year Ehrlén et al. (2001). Individuals do not necessarily produce aboveground structures every year, and instead can remain vegetatively dormant in one or more seasons. L. vernus is self-compatible but requires visits from bumble-bees to produce seeds. Individuals produce few, large seeds and establishment from seeds is relatively frequent Ehrlén and Eriksson (1996). The pre-dispersal seed predator Bruchus atomarius often consumes a large fraction of developing seeds, and roe deer (Capreolus capreolus) sometimes consume the shoots Ehrlén and Munzbergova (2009).

Data for this study were collected from six permanent plots in a population of L. vernus located in a deciduous forest in the Tullgarn area, SE Sweden (58.9496 N, 17.6097 E), from 1988 to 1991 (Ehrlén 1995). The six plots were relatively similar with regard to soil type, elevation, slope, and canopy cover. Within each plot, all individuals were marked with numbered tags that remained over the study period, and their locations were carefully mapped. New individuals were included in the study in each year. Individuals were recorded at least three times every growing season. At the time of shoot emergence, we recorded whether individuals were alive and produced above-ground shoots, and if shoots had been grazed. During flowering, we recorded flower number and the height and diameter of all shoots. At fruit maturation, we counted the number of intact and damaged seeds. To derive a measure of aboveground size for each individual, we calculated the volume of each shoot as \(\pi × (\frac{1}{2} diameter)^2 × height\), and summed the volumes of all shoots. This measure is strongly correlated with the dry mass of aboveground tissues (\(R^2 = 0.924\), \(P < 0.001\), \(n = 50\), log-transformed values; Ehrlén 1995). Size of individuals that had been grazed was estimated based on measures of shoot diameter in grazed shoots, and the relationship between shoot diameter and shoot height in non-grazed individuals. Only individuals with an aboveground volume of more than 230 mm3 flowered and produced fruits during this study. Individuals that lacked aboveground structures in one season but reappeared in the following year were considered dormant. Individuals that lacked aboveground structures in two subsequent seasons were considered dead from the year in which they first lacked aboveground structures. Probabilities of seeds surviving to the next year, and of being present as seedlings or seeds in the soil seed bank, were derived from separate yearly sowing experiments in separate plots adjacent to each subplot (Ehrlén and Eriksson 1996).

Overall goals and initial steps

Our goal in this exercise will be to produce ahistorical and historical raw and function-based matrices for full comparison. We will move through tall of the steps of analysis, and take detours here and there where doing so will add to the educational experience.

Initial set-up

Users should have the latest version of R and R Studio installed. R is available at https://cloud.r-project.org/, while R Studio is available at https://www.rstudio.com/products/rstudio/download/#download.

After installing these two items, please install the R packages markdown, rmarkdown, knitr, and lefko3. You may be prompted if you wish to install dependencies, and in this case, please answer in the affirmative. You may also run the following line to do this.

install.packages(c("markdown", "rmarkdown", "knitr", "lefko3"))

After installing these packages, you will need to restart R Studio. Then, check to make sure that you have the following R packages also installed: Rcpp, RcppArmadillo, BH, Matrix, TMB, glmmTMB, lme4, MuMIn, pscl, SparseM, and VGAM. If any are missing, then please install them, or run the following line.

install.packages(c("Rcpp", "RcppArmadillo", "BH", "Matrix", "TMB", "glmmTMB",
  "lme4", "MuMIn", "pscl", "SparseM", "VGAM"))

Loading lefko3 and the datasets

We will need to load three datasets included in lefko3 for this workshop: cypdata, cypvert, and lathyrus. Let’s do that now.

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

data(cypdata)
data(cypvert)
data(lathyrus)

It’s worthwhile exploring these datasets a bit. Let’s take a look at one of the Cypripedium datasets (both cypdata and cypvert contain the same data, but structured differently).

dim(cypdata)
## [1] 77 29
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

The dataset cypdata is organized in horizontal format, meaning that rows correspond to unique individuals and columns correspond to stage in particular years. You will note a repeating pattern in the names of the columns. In this dataset, there are 77 individuals, so there are 77 rows with data (not counting the header). There are 29 columns, which are the variables in the dataset. Note that the first five 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.

dim(cypvert)
## [1] 322  14
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.

Finally, let’s take a peek at our Lathyrus dataset.

dim(lathyrus)
## [1] 1119   38
summary(lathyrus)
##     SUBPLOT          GENET          Volume88         lnVol88     
##  Min.   :1.000   Min.   :  1.0   Min.   :   3.4   Min.   :1.200  
##  1st Qu.:2.000   1st Qu.: 48.0   1st Qu.:  63.0   1st Qu.:4.100  
##  Median :3.000   Median : 97.0   Median : 732.5   Median :6.600  
##  Mean   :3.223   Mean   :110.2   Mean   : 749.4   Mean   :5.538  
##  3rd Qu.:4.000   3rd Qu.:167.5   3rd Qu.:1025.5   3rd Qu.:6.900  
##  Max.   :6.000   Max.   :284.0   Max.   :7032.0   Max.   :8.900  
##                                  NA's   :404      NA's   :404    
##     FCODE88           Flow88       Intactseed88 Dead1988       Dormant1988   
##  Min.   :0.0000   Min.   : 1.00   Min.   : 0    Mode:logical   Mode:logical  
##  1st Qu.:0.0000   1st Qu.: 4.00   1st Qu.: 0    NA's:1119      NA's:1119     
##  Median :0.0000   Median : 8.00   Median : 0                                 
##  Mean   :0.3399   Mean   :11.86   Mean   : 3                                 
##  3rd Qu.:1.0000   3rd Qu.:15.00   3rd Qu.: 4                                 
##  Max.   :1.0000   Max.   :66.00   Max.   :34                                 
##  NA's   :404      NA's   :910     NA's   :875                                
##  Missing1988     Seedling1988      Volume89         lnVol89     
##  Mode:logical   Min.   :1.000   Min.   :   1.8   Min.   :0.600  
##  NA's:1119      1st Qu.:2.000   1st Qu.:  15.6   1st Qu.:2.700  
##                 Median :2.000   Median : 118.8   Median :4.800  
##                 Mean   :2.144   Mean   : 573.3   Mean   :4.855  
##                 3rd Qu.:3.000   3rd Qu.: 968.8   3rd Qu.:6.900  
##                 Max.   :3.000   Max.   :6539.4   Max.   :8.800  
##                 NA's   :1022    NA's   :294      NA's   :294    
##     FCODE89           Flow89       Intactseed89       Dead1989   
##  Min.   :0.0000   Min.   : 1.00   Min.   : 0.000   Min.   :1     
##  1st Qu.:0.0000   1st Qu.: 5.00   1st Qu.: 0.000   1st Qu.:1     
##  Median :0.0000   Median :11.00   Median : 5.000   Median :1     
##  Mean   :0.2667   Mean   :14.88   Mean   : 8.273   Mean   :1     
##  3rd Qu.:1.0000   3rd Qu.:20.00   3rd Qu.:13.000   3rd Qu.:1     
##  Max.   :1.0000   Max.   :97.00   Max.   :66.000   Max.   :1     
##  NA's   :294      NA's   :906     NA's   :899      NA's   :1077  
##   Dormant1989    Missing1989    Seedling1989      Volume90         lnVol90     
##  Min.   :1      Min.   :1      Min.   :1.000   Min.   :   2.1   Min.   :0.700  
##  1st Qu.:1      1st Qu.:1      1st Qu.:2.000   1st Qu.:  12.6   1st Qu.:2.500  
##  Median :1      Median :1      Median :2.000   Median :  61.0   Median :4.100  
##  Mean   :1      Mean   :1      Mean   :2.136   Mean   : 244.1   Mean   :4.207  
##  3rd Qu.:1      3rd Qu.:1      3rd Qu.:2.000   3rd Qu.: 295.2   3rd Qu.:5.700  
##  Max.   :1      Max.   :1      Max.   :3.000   Max.   :4242.8   Max.   :8.400  
##  NA's   :1046   NA's   :1112   NA's   :1001    NA's   :245      NA's   :245    
##     FCODE90           Flow90        Intactseed90       Dead1990   
##  Min.   :0.0000   Min.   : 1.000   Min.   : 0.000   Min.   :1     
##  1st Qu.:0.0000   1st Qu.: 3.000   1st Qu.: 0.000   1st Qu.:1     
##  Median :0.0000   Median : 6.000   Median : 0.000   Median :1     
##  Mean   :0.1581   Mean   : 8.104   Mean   : 2.514   Mean   :1     
##  3rd Qu.:0.0000   3rd Qu.:10.750   3rd Qu.: 1.000   3rd Qu.:1     
##  Max.   :1.0000   Max.   :54.000   Max.   :37.000   Max.   :1     
##  NA's   :246      NA's   :985      NA's   :981      NA's   :1007  
##   Dormant1990    Missing1990    Seedling1990      Volume91         lnVol91     
##  Min.   :1      Min.   :1      Min.   :1.000   Min.   :   4.0   Min.   :1.400  
##  1st Qu.:1      1st Qu.:1      1st Qu.:2.000   1st Qu.:  12.0   1st Qu.:2.500  
##  Median :1      Median :1      Median :2.000   Median : 118.5   Median :4.800  
##  Mean   :1      Mean   :1      Mean   :2.186   Mean   : 418.7   Mean   :4.642  
##  3rd Qu.:1      3rd Qu.:1      3rd Qu.:2.000   3rd Qu.: 689.7   3rd Qu.:6.500  
##  Max.   :1      Max.   :1      Max.   :3.000   Max.   :6645.8   Max.   :8.800  
##  NA's   :1054   NA's   :1105   NA's   :1049    NA's   :305      NA's   :305    
##     FCODE91           Flow91       Intactseed91       Dead1991    Dormant1991  
##  Min.   :0.0000   Min.   : 1.00   Min.   : 0.000   Min.   :1     Min.   :1     
##  1st Qu.:0.0000   1st Qu.: 4.00   1st Qu.: 0.000   1st Qu.:1     1st Qu.:1     
##  Median :0.0000   Median : 8.00   Median : 3.500   Median :1     Median :1     
##  Mean   :0.2525   Mean   :11.12   Mean   : 5.805   Mean   :1     Mean   :1     
##  3rd Qu.:1.0000   3rd Qu.:15.00   3rd Qu.:10.000   3rd Qu.:1     3rd Qu.:1     
##  Max.   :1.0000   Max.   :48.00   Max.   :48.000   Max.   :1     Max.   :1     
##  NA's   :307      NA's   :954     NA's   :919      NA's   :925   NA's   :1034  
##   Missing1991    Seedling1991  
##  Min.   :1      Min.   :1.000  
##  1st Qu.:1      1st Qu.:2.000  
##  Median :1      Median :2.000  
##  Mean   :1      Mean   :1.973  
##  3rd Qu.:1      3rd Qu.:2.000  
##  Max.   :1      Max.   :3.000  
##  NA's   :1095   NA's   :1082

This dataset is horizontally formatted, and includes information on 1,119 individuals arranged horizontally. So, there are 1,119 rows with data. There are 38 columns. The first two columns are variables giving identifying information about each individual. This is followed by four sets of nine columns, each named VolumeXX, lnVolXX, FCODEXX, FlowXX, IntactseedXX, Dead19XX, DormantXX, Missing19XX, and SeedlingXX, where XX corresponds to the year of observation and with years organized consecutively. Thus, columns 3-11 refer to year 1988, columns 12-20 refer to year 1989, etc. This strictly repeated pattern allows us to manipulate the original dataset quickly and efficiently via lefko3. We should note the number of years, which is 4 here (includes all years from and including 1988 to 1991). Ideally, we should also have arranged the columns in the same order for each year, with years in consecutive order with no extra columns between them. This order is not required, provided that we are willing to input all variable names in the correct order when transforming the dataset later.

Let’s now consider the life history models 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 the kind of MPM that we wish to build.

Let’s use the Cypripedium datasets to build raw and function-based versions of ahistorical, historical, and age-by-stage MPMs, as well as Leslie MPMs. Let’s use the Lathyrus dataset to build an IPM.

Let’s explore the range of sizes in our Cypripedium 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
plot(density(c(size.04, size.05, size.06, size.07, size.08, size.09), na.rm = TRUE))
Figure 2. Density of Cypripedium plant sizes across time

Figure 2. Density of Cypripedium plant sizes across time

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. The density plot shows us that individuals bigger than 10 sprouts are rare.Given this, we might utilize the following life history model for our function-based MPMs.

When deciding on the number and definitions of stages, we need to find a way to identify natural breaks in the data to separate stages. There are number of approaches to do this, but one approach that can be taken in R is to use the Jenks Breaks approach, which uses the Jenks natural breaks algorithm to identify where to separate stages. To use this approach, we first need to install the BAMMtools package.

install.packages("BAMMtools", dependencies = TRUE)

Now let’s see where we might fit natural breaks according to specific numbers of assumed breaks.

library(BAMMtools)
## Loading required package: ape
getJenksBreaks(c(size.04, size.05, size.06, size.07, size.08, size.09), k = 4)
## [1]  1  4 12 24
getJenksBreaks(c(size.04, size.05, size.06, size.07, size.08, size.09), k = 5)
## [1]  1  3  7 14 24
getJenksBreaks(c(size.04, size.05, size.06, size.07, size.08, size.09), k = 6)
## [1]  1  2  4  7 14 24
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. The first line shows a three stage model, yielding four breaks including the minimum and maximum. This model has the first stage include 1-3 sprouts, the second stage include 4-11 sprouts, and the 3rd stage include 12-24 sprouts. The fourth line is a six stage model with seven breaks shown. Given what we know about the size distribution, we will try to separate the data into five stages (one sprout, 2-4 sprouts, 5-7 sprouts, 8-14 sprouts, and 15-24 sprouts), which will result in 11 total life history stages in our like history (one dormant seed, three protocorm stages of different age, one seedling stage, one vegetatively dormant stage, and five size-classified adult stages). Here is our new life history model). Note that the hashed blue box here refers to the mature stages that are actually observable in our population.

Figure 3. Life history model of Cypripedium candidum for use in raw MPMs

Let’s now build a stageframe using these breaks. We will build vectors describing the stages, particularly the size, reproductive status, observation status, maturity status, immaturity status, propagule status, and associate minimum and maximum ages of each stage. We will use this stageframe to create ahistorical and historical raw MPMs, as well as a raw age-by-stage MPM.

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)

#Age arguments are only needed if an age-by-stage MPM
minage <- c(1, 1, 2, 3, 4, 5, 5, 6, 6, 6, 6)
maxage <- c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA)

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, minage = minage, maxage = maxage, comments = comments)

cypframe_raw
##    stage size size_b size_c min_age max_age repstatus obsstatus propstatus
## 1     SD  0.0     NA     NA       1      NA         0         0          1
## 2     P1  0.0     NA     NA       1      NA         0         0          0
## 3     P2  0.0     NA     NA       2      NA         0         0          0
## 4     P3  0.0     NA     NA       3      NA         0         0          0
## 5     SL  0.0     NA     NA       4      NA         0         0          0
## 6      D  0.0     NA     NA       5      NA         0         0          0
## 7    XSm  1.0     NA     NA       5      NA         1         1          0
## 8     Sm  3.0     NA     NA       6      NA         1         1          0
## 9     Md  6.0     NA     NA       6      NA         1         1          0
## 10    Lg 11.0     NA     NA       6      NA         1         1          0
## 11   XLg 19.5     NA     NA       6      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)

In contrast to this, let’s take a look at a life history model that we can use for function-based MPMs.

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

This is a much larger life history model, and we can get away with using such a large model because we know that we will estimate values for every biologically possible matrix element. 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.

Let’s now build our stage frame for this model. This will work for our function-based ahistorical, historical, and age-by-stage MPMs.

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")

#The next two arguments are only needed for age-by-stage MPMs
minage <- c(1, 1, 2, 3, 4, 5, 5, rep(6, 47))
maxage <- rep(NA, 54)

cypframe_fb <- sf_create(sizes = sizevector, stagenames = stagevector, 
  repstatus = repvector, obsstatus = obsvector, matstatus = matvector, 
  propstatus = propvector, immstatus = immvector, indataset = indataset,
  minage = minage, maxage = maxage, comments = comments)
cypframe_fb
##    stage size size_b size_c min_age max_age repstatus obsstatus propstatus
## 1     SD    0     NA     NA       1      NA         0         0          1
## 2     P1    0     NA     NA       1      NA         0         0          0
## 3     P2    0     NA     NA       2      NA         0         0          0
## 4     P3    0     NA     NA       3      NA         0         0          0
## 5     SL    0     NA     NA       4      NA         0         0          0
## 6      D    0     NA     NA       5      NA         0         0          0
## 7     V1    1     NA     NA       5      NA         0         1          0
## 8     V2    2     NA     NA       6      NA         0         1          0
## 9     V3    3     NA     NA       6      NA         0         1          0
## 10    V4    4     NA     NA       6      NA         0         1          0
## 11    V5    5     NA     NA       6      NA         0         1          0
## 12    V6    6     NA     NA       6      NA         0         1          0
## 13    V7    7     NA     NA       6      NA         0         1          0
## 14    V8    8     NA     NA       6      NA         0         1          0
## 15    V9    9     NA     NA       6      NA         0         1          0
## 16   V10   10     NA     NA       6      NA         0         1          0
## 17   V11   11     NA     NA       6      NA         0         1          0
## 18   V12   12     NA     NA       6      NA         0         1          0
## 19   V13   13     NA     NA       6      NA         0         1          0
## 20   V14   14     NA     NA       6      NA         0         1          0
## 21   V15   15     NA     NA       6      NA         0         1          0
## 22   V16   16     NA     NA       6      NA         0         1          0
## 23   V17   17     NA     NA       6      NA         0         1          0
## 24   V18   18     NA     NA       6      NA         0         1          0
## 25   V19   19     NA     NA       6      NA         0         1          0
## 26   V20   20     NA     NA       6      NA         0         1          0
## 27   V21   21     NA     NA       6      NA         0         1          0
## 28   V22   22     NA     NA       6      NA         0         1          0
## 29   V23   23     NA     NA       6      NA         0         1          0
## 30   V24   24     NA     NA       6      NA         0         1          0
## 31    F1    1     NA     NA       6      NA         1         1          0
## 32    F2    2     NA     NA       6      NA         1         1          0
## 33    F3    3     NA     NA       6      NA         1         1          0
## 34    F4    4     NA     NA       6      NA         1         1          0
## 35    F5    5     NA     NA       6      NA         1         1          0
## 36    F6    6     NA     NA       6      NA         1         1          0
## 37    F7    7     NA     NA       6      NA         1         1          0
## 38    F8    8     NA     NA       6      NA         1         1          0
## 39    F9    9     NA     NA       6      NA         1         1          0
## 40   F10   10     NA     NA       6      NA         1         1          0
## 41   F11   11     NA     NA       6      NA         1         1          0
## 42   F12   12     NA     NA       6      NA         1         1          0
## 43   F13   13     NA     NA       6      NA         1         1          0
## 44   F14   14     NA     NA       6      NA         1         1          0
## 45   F15   15     NA     NA       6      NA         1         1          0
## 46   F16   16     NA     NA       6      NA         1         1          0
## 47   F17   17     NA     NA       6      NA         1         1          0
## 48   F18   18     NA     NA       6      NA         1         1          0
## 49   F19   19     NA     NA       6      NA         1         1          0
## 50   F20   20     NA     NA       6      NA         1         1          0
## 51   F21   21     NA     NA       6      NA         1         1          0
## 52   F22   22     NA     NA       6      NA         1         1          0
## 53   F23   23     NA     NA       6      NA         1         1          0
## 54   F24   24     NA     NA       6      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

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")

minage <- c(1, 1, 2, 3, 4, 5, 5, 5, 6, 6)
maxage <- rep(NA, 10)

cypframe_ipm <- sf_create(sizes = sizevector, stagenames = stagevector, 
  repstatus = repvector, obsstatus = obsvector, matstatus = matvector, 
  propstatus = propvector, immstatus = immvector, indataset = indataset,
  comments = comments, minage = minage, maxage = maxage, ipmbins = 24)

cypframe_ipm
##           stage size size_b size_c min_age max_age repstatus obsstatus
## 1            SD    0     NA     NA       1      NA         0         0
## 2            P1    0     NA     NA       1      NA         0         0
## 3            P2    0     NA     NA       2      NA         0         0
## 4            P3    0     NA     NA       3      NA         0         0
## 5            SL    0     NA     NA       4      NA         0         0
## 6             D    0     NA     NA       5      NA         0         0
## 7  sza_1.0000_0    1     NA     NA       5      NA         0         1
## 8  sza_2.0000_0    2     NA     NA       5      NA         0         1
## 9  sza_3.0000_0    3     NA     NA       5      NA         0         1
## 10 sza_4.0000_0    4     NA     NA       5      NA         0         1
## 11 sza_5.0000_0    5     NA     NA       5      NA         0         1
## 12 sza_6.0000_0    6     NA     NA       5      NA         0         1
## 13 sza_7.0000_0    7     NA     NA       5      NA         0         1
## 14 sza_8.0000_0    8     NA     NA       5      NA         0         1
## 15 sza_9.0000_0    9     NA     NA       5      NA         0         1
## 16 sza_10.000_0   10     NA     NA       5      NA         0         1
## 17 sza_11.000_0   11     NA     NA       5      NA         0         1
## 18 sza_12.000_0   12     NA     NA       5      NA         0         1
## 19 sza_13.000_0   13     NA     NA       5      NA         0         1
## 20 sza_14.000_0   14     NA     NA       5      NA         0         1
## 21 sza_15.000_0   15     NA     NA       5      NA         0         1
## 22 sza_16.000_0   16     NA     NA       5      NA         0         1
## 23 sza_17.000_0   17     NA     NA       5      NA         0         1
## 24 sza_18.000_0   18     NA     NA       5      NA         0         1
## 25 sza_19.000_0   19     NA     NA       5      NA         0         1
## 26 sza_20.000_0   20     NA     NA       5      NA         0         1
## 27 sza_21.000_0   21     NA     NA       5      NA         0         1
## 28 sza_22.000_0   22     NA     NA       5      NA         0         1
## 29 sza_23.000_0   23     NA     NA       5      NA         0         1
## 30 sza_24.000_0   24     NA     NA       5      NA         0         1
## 31 sza_1.0000_0    1     NA     NA       6      NA         1         1
## 32 sza_2.0000_0    2     NA     NA       6      NA         1         1
## 33 sza_3.0000_0    3     NA     NA       6      NA         1         1
## 34 sza_4.0000_0    4     NA     NA       6      NA         1         1
## 35 sza_5.0000_0    5     NA     NA       6      NA         1         1
## 36 sza_6.0000_0    6     NA     NA       6      NA         1         1
## 37 sza_7.0000_0    7     NA     NA       6      NA         1         1
## 38 sza_8.0000_0    8     NA     NA       6      NA         1         1
## 39 sza_9.0000_0    9     NA     NA       6      NA         1         1
## 40 sza_10.000_0   10     NA     NA       6      NA         1         1
## 41 sza_11.000_0   11     NA     NA       6      NA         1         1
## 42 sza_12.000_0   12     NA     NA       6      NA         1         1
## 43 sza_13.000_0   13     NA     NA       6      NA         1         1
## 44 sza_14.000_0   14     NA     NA       6      NA         1         1
## 45 sza_15.000_0   15     NA     NA       6      NA         1         1
## 46 sza_16.000_0   16     NA     NA       6      NA         1         1
## 47 sza_17.000_0   17     NA     NA       6      NA         1         1
## 48 sza_18.000_0   18     NA     NA       6      NA         1         1
## 49 sza_19.000_0   19     NA     NA       6      NA         1         1
## 50 sza_20.000_0   20     NA     NA       6      NA         1         1
## 51 sza_21.000_0   21     NA     NA       6      NA         1         1
## 52 sza_22.000_0   22     NA     NA       6      NA         1         1
## 53 sza_23.000_0   23     NA     NA       6      NA         1         1
## 54 sza_24.000_0   24     NA     NA       6      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

Now let’s build our Lathyrus life history model. Note that IPMs are function-based by default, so we will not create a raw MPM version. Here is our life history model. We will also not create an age-by-stage version, and so will leave age information out.

Figure 5. Life history model of Lathyrus vernus. Not all adult classes are shown. Survival transitions are indicated with solid arrows, while fecundity transitions are indicated with dashed arrows.

In the stageframe code below, we show that we want an IPM by choosing two stages that serve as the size limits for the IPM’s discretized size bin classification. These two size classes should have exactly the same characteristics in the stageframe other than size. The sizes input into the sizes vector for these two stages should not be midpoints. Instead, the size for the lower limit should be the lower limit of the minimum size bin, while the size input for the upper limit should be the upper limit of the maximum size bin. By choosing these two size limits, we can skip adding and describing the many size classes that will fall between these limits - function sf_create() will create all of these for us. We mark these limits in the vector that we load into the stagenames option using the string "ipm". We then input all other characteristics for these size bins, such as observation status, maturity status, reproductive status, and these characteristics must be the same for both the minimum and maximum size bins. Package lefko3 will then create and name all IPM size classes according to its own conventions. The default number of size classes is 100 bins, and this can be altered using the ipmbins option. Note that this is essentially the same procedure described in section @ref(ipmframe).

sizevector <- c(0, 100, 0, 1, 7100)
stagevector <- c("Sd", "Sdl", "Dorm", "ipm", "ipm")
repvector <- c(0, 0, 0, 1, 1)
obsvector <- c(0, 1, 0, 1, 1)
matvector <- c(0, 0, 1, 1, 1)
immvector <- c(1, 1, 0, 0, 0)
propvector <- c(1, 0, 0, 0, 0)
indataset <- c(0, 1, 1, 1, 1)
binvec <- c(0, 100, 0.5, 1, 1)
comments <- c("Dormant seed", "Seedling", "Dormant", "ipm adult stage",
  "ipm adult stage")

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

dim(lathframe_ipm)
## [1] 103  29

This stageframe has 103 stages - dormant seed, seedling, vegetative dormancy, and 100 size-classified adult stages. Let’s look at this object.

lathframe_ipm
##            stage     size size_b size_c min_age max_age repstatus obsstatus
## 1             Sd    0.000     NA     NA      NA      NA         0         0
## 2            Sdl  100.000     NA     NA      NA      NA         0         1
## 3           Dorm    0.000     NA     NA      NA      NA         0         0
## 4   sza_36.495_0   36.495     NA     NA      NA      NA         1         1
## 5   sza_107.48_0  107.485     NA     NA      NA      NA         1         1
## 6   sza_178.47_0  178.475     NA     NA      NA      NA         1         1
## 7   sza_249.46_0  249.465     NA     NA      NA      NA         1         1
## 8   sza_320.45_0  320.455     NA     NA      NA      NA         1         1
## 9   sza_391.44_0  391.445     NA     NA      NA      NA         1         1
## 10  sza_462.43_0  462.435     NA     NA      NA      NA         1         1
## 11  sza_533.42_0  533.425     NA     NA      NA      NA         1         1
## 12  sza_604.41_0  604.415     NA     NA      NA      NA         1         1
## 13  sza_675.40_0  675.405     NA     NA      NA      NA         1         1
## 14  sza_746.39_0  746.395     NA     NA      NA      NA         1         1
## 15  sza_817.38_0  817.385     NA     NA      NA      NA         1         1
## 16  sza_888.37_0  888.375     NA     NA      NA      NA         1         1
## 17  sza_959.36_0  959.365     NA     NA      NA      NA         1         1
## 18  sza_1030.3_0 1030.355     NA     NA      NA      NA         1         1
## 19  sza_1101.3_0 1101.345     NA     NA      NA      NA         1         1
## 20  sza_1172.3_0 1172.335     NA     NA      NA      NA         1         1
## 21  sza_1243.3_0 1243.325     NA     NA      NA      NA         1         1
## 22  sza_1314.3_0 1314.315     NA     NA      NA      NA         1         1
## 23  sza_1385.3_0 1385.305     NA     NA      NA      NA         1         1
## 24  sza_1456.2_0 1456.295     NA     NA      NA      NA         1         1
## 25  sza_1527.2_0 1527.285     NA     NA      NA      NA         1         1
## 26  sza_1598.2_0 1598.275     NA     NA      NA      NA         1         1
## 27  sza_1669.2_0 1669.265     NA     NA      NA      NA         1         1
## 28  sza_1740.2_0 1740.255     NA     NA      NA      NA         1         1
## 29  sza_1811.2_0 1811.245     NA     NA      NA      NA         1         1
## 30  sza_1882.2_0 1882.235     NA     NA      NA      NA         1         1
## 31  sza_1953.2_0 1953.225     NA     NA      NA      NA         1         1
## 32  sza_2024.2_0 2024.215     NA     NA      NA      NA         1         1
## 33  sza_2095.2_0 2095.205     NA     NA      NA      NA         1         1
## 34  sza_2166.1_0 2166.195     NA     NA      NA      NA         1         1
## 35  sza_2237.1_0 2237.185     NA     NA      NA      NA         1         1
## 36  sza_2308.1_0 2308.175     NA     NA      NA      NA         1         1
## 37  sza_2379.1_0 2379.165     NA     NA      NA      NA         1         1
## 38  sza_2450.1_0 2450.155     NA     NA      NA      NA         1         1
## 39  sza_2521.1_0 2521.145     NA     NA      NA      NA         1         1
## 40  sza_2592.1_0 2592.135     NA     NA      NA      NA         1         1
## 41  sza_2663.1_0 2663.125     NA     NA      NA      NA         1         1
## 42  sza_2734.1_0 2734.115     NA     NA      NA      NA         1         1
## 43  sza_2805.1_0 2805.105     NA     NA      NA      NA         1         1
## 44  sza_2876.0_0 2876.095     NA     NA      NA      NA         1         1
## 45  sza_2947.0_0 2947.085     NA     NA      NA      NA         1         1
## 46  sza_3018.0_0 3018.075     NA     NA      NA      NA         1         1
## 47  sza_3089.0_0 3089.065     NA     NA      NA      NA         1         1
## 48  sza_3160.0_0 3160.055     NA     NA      NA      NA         1         1
## 49  sza_3231.0_0 3231.045     NA     NA      NA      NA         1         1
## 50  sza_3302.0_0 3302.035     NA     NA      NA      NA         1         1
## 51  sza_3373.0_0 3373.025     NA     NA      NA      NA         1         1
## 52  sza_3444.0_0 3444.015     NA     NA      NA      NA         1         1
## 53  sza_3515.0_0 3515.005     NA     NA      NA      NA         1         1
## 54  sza_3585.9_0 3585.995     NA     NA      NA      NA         1         1
## 55  sza_3656.9_0 3656.985     NA     NA      NA      NA         1         1
## 56  sza_3727.9_0 3727.975     NA     NA      NA      NA         1         1
## 57  sza_3798.9_0 3798.965     NA     NA      NA      NA         1         1
## 58  sza_3869.9_0 3869.955     NA     NA      NA      NA         1         1
## 59  sza_3940.9_0 3940.945     NA     NA      NA      NA         1         1
## 60  sza_4011.9_0 4011.935     NA     NA      NA      NA         1         1
## 61  sza_4082.9_0 4082.925     NA     NA      NA      NA         1         1
## 62  sza_4153.9_0 4153.915     NA     NA      NA      NA         1         1
## 63  sza_4224.9_0 4224.905     NA     NA      NA      NA         1         1
## 64  sza_4295.8_0 4295.895     NA     NA      NA      NA         1         1
## 65  sza_4366.8_0 4366.885     NA     NA      NA      NA         1         1
## 66  sza_4437.8_0 4437.875     NA     NA      NA      NA         1         1
## 67  sza_4508.8_0 4508.865     NA     NA      NA      NA         1         1
## 68  sza_4579.8_0 4579.855     NA     NA      NA      NA         1         1
## 69  sza_4650.8_0 4650.845     NA     NA      NA      NA         1         1
## 70  sza_4721.8_0 4721.835     NA     NA      NA      NA         1         1
## 71  sza_4792.8_0 4792.825     NA     NA      NA      NA         1         1
## 72  sza_4863.8_0 4863.815     NA     NA      NA      NA         1         1
## 73  sza_4934.8_0 4934.805     NA     NA      NA      NA         1         1
## 74  sza_5005.7_0 5005.795     NA     NA      NA      NA         1         1
## 75  sza_5076.7_0 5076.785     NA     NA      NA      NA         1         1
## 76  sza_5147.7_0 5147.775     NA     NA      NA      NA         1         1
## 77  sza_5218.7_0 5218.765     NA     NA      NA      NA         1         1
## 78  sza_5289.7_0 5289.755     NA     NA      NA      NA         1         1
## 79  sza_5360.7_0 5360.745     NA     NA      NA      NA         1         1
## 80  sza_5431.7_0 5431.735     NA     NA      NA      NA         1         1
## 81  sza_5502.7_0 5502.725     NA     NA      NA      NA         1         1
## 82  sza_5573.7_0 5573.715     NA     NA      NA      NA         1         1
## 83  sza_5644.7_0 5644.705     NA     NA      NA      NA         1         1
## 84  sza_5715.6_0 5715.695     NA     NA      NA      NA         1         1
## 85  sza_5786.6_0 5786.685     NA     NA      NA      NA         1         1
## 86  sza_5857.6_0 5857.675     NA     NA      NA      NA         1         1
## 87  sza_5928.6_0 5928.665     NA     NA      NA      NA         1         1
## 88  sza_5999.6_0 5999.655     NA     NA      NA      NA         1         1
## 89  sza_6070.6_0 6070.645     NA     NA      NA      NA         1         1
## 90  sza_6141.6_0 6141.635     NA     NA      NA      NA         1         1
## 91  sza_6212.6_0 6212.625     NA     NA      NA      NA         1         1
## 92  sza_6283.6_0 6283.615     NA     NA      NA      NA         1         1
## 93  sza_6354.6_0 6354.605     NA     NA      NA      NA         1         1
## 94  sza_6425.5_0 6425.595     NA     NA      NA      NA         1         1
## 95  sza_6496.5_0 6496.585     NA     NA      NA      NA         1         1
## 96  sza_6567.5_0 6567.575     NA     NA      NA      NA         1         1
## 97  sza_6638.5_0 6638.565     NA     NA      NA      NA         1         1
## 98  sza_6709.5_0 6709.555     NA     NA      NA      NA         1         1
## 99  sza_6780.5_0 6780.545     NA     NA      NA      NA         1         1
## 100 sza_6851.5_0 6851.535     NA     NA      NA      NA         1         1
## 101 sza_6922.5_0 6922.525     NA     NA      NA      NA         1         1
## 102 sza_6993.5_0 6993.515     NA     NA      NA      NA         1         1
## 103 sza_7064.5_0 7064.505     NA     NA      NA      NA         1         1
##     propstatus immstatus matstatus indataset binhalfwidth_raw sizebin_min
## 1            1         1         0         0            0.000        0.00
## 2            0         1         0         1          100.000        0.00
## 3            0         0         1         1            0.500       -0.50
## 4            0         0         1         1           35.495        1.00
## 5            0         0         1         1           35.495       71.99
## 6            0         0         1         1           35.495      142.98
## 7            0         0         1         1           35.495      213.97
## 8            0         0         1         1           35.495      284.96
## 9            0         0         1         1           35.495      355.95
## 10           0         0         1         1           35.495      426.94
## 11           0         0         1         1           35.495      497.93
## 12           0         0         1         1           35.495      568.92
## 13           0         0         1         1           35.495      639.91
## 14           0         0         1         1           35.495      710.90
## 15           0         0         1         1           35.495      781.89
## 16           0         0         1         1           35.495      852.88
## 17           0         0         1         1           35.495      923.87
## 18           0         0         1         1           35.495      994.86
## 19           0         0         1         1           35.495     1065.85
## 20           0         0         1         1           35.495     1136.84
## 21           0         0         1         1           35.495     1207.83
## 22           0         0         1         1           35.495     1278.82
## 23           0         0         1         1           35.495     1349.81
## 24           0         0         1         1           35.495     1420.80
## 25           0         0         1         1           35.495     1491.79
## 26           0         0         1         1           35.495     1562.78
## 27           0         0         1         1           35.495     1633.77
## 28           0         0         1         1           35.495     1704.76
## 29           0         0         1         1           35.495     1775.75
## 30           0         0         1         1           35.495     1846.74
## 31           0         0         1         1           35.495     1917.73
## 32           0         0         1         1           35.495     1988.72
## 33           0         0         1         1           35.495     2059.71
## 34           0         0         1         1           35.495     2130.70
## 35           0         0         1         1           35.495     2201.69
## 36           0         0         1         1           35.495     2272.68
## 37           0         0         1         1           35.495     2343.67
## 38           0         0         1         1           35.495     2414.66
## 39           0         0         1         1           35.495     2485.65
## 40           0         0         1         1           35.495     2556.64
## 41           0         0         1         1           35.495     2627.63
## 42           0         0         1         1           35.495     2698.62
## 43           0         0         1         1           35.495     2769.61
## 44           0         0         1         1           35.495     2840.60
## 45           0         0         1         1           35.495     2911.59
## 46           0         0         1         1           35.495     2982.58
## 47           0         0         1         1           35.495     3053.57
## 48           0         0         1         1           35.495     3124.56
## 49           0         0         1         1           35.495     3195.55
## 50           0         0         1         1           35.495     3266.54
## 51           0         0         1         1           35.495     3337.53
## 52           0         0         1         1           35.495     3408.52
## 53           0         0         1         1           35.495     3479.51
## 54           0         0         1         1           35.495     3550.50
## 55           0         0         1         1           35.495     3621.49
## 56           0         0         1         1           35.495     3692.48
## 57           0         0         1         1           35.495     3763.47
## 58           0         0         1         1           35.495     3834.46
## 59           0         0         1         1           35.495     3905.45
## 60           0         0         1         1           35.495     3976.44
## 61           0         0         1         1           35.495     4047.43
## 62           0         0         1         1           35.495     4118.42
## 63           0         0         1         1           35.495     4189.41
## 64           0         0         1         1           35.495     4260.40
## 65           0         0         1         1           35.495     4331.39
## 66           0         0         1         1           35.495     4402.38
## 67           0         0         1         1           35.495     4473.37
## 68           0         0         1         1           35.495     4544.36
## 69           0         0         1         1           35.495     4615.35
## 70           0         0         1         1           35.495     4686.34
## 71           0         0         1         1           35.495     4757.33
## 72           0         0         1         1           35.495     4828.32
## 73           0         0         1         1           35.495     4899.31
## 74           0         0         1         1           35.495     4970.30
## 75           0         0         1         1           35.495     5041.29
## 76           0         0         1         1           35.495     5112.28
## 77           0         0         1         1           35.495     5183.27
## 78           0         0         1         1           35.495     5254.26
## 79           0         0         1         1           35.495     5325.25
## 80           0         0         1         1           35.495     5396.24
## 81           0         0         1         1           35.495     5467.23
## 82           0         0         1         1           35.495     5538.22
## 83           0         0         1         1           35.495     5609.21
## 84           0         0         1         1           35.495     5680.20
## 85           0         0         1         1           35.495     5751.19
## 86           0         0         1         1           35.495     5822.18
## 87           0         0         1         1           35.495     5893.17
## 88           0         0         1         1           35.495     5964.16
## 89           0         0         1         1           35.495     6035.15
## 90           0         0         1         1           35.495     6106.14
## 91           0         0         1         1           35.495     6177.13
## 92           0         0         1         1           35.495     6248.12
## 93           0         0         1         1           35.495     6319.11
## 94           0         0         1         1           35.495     6390.10
## 95           0         0         1         1           35.495     6461.09
## 96           0         0         1         1           35.495     6532.08
## 97           0         0         1         1           35.495     6603.07
## 98           0         0         1         1           35.495     6674.06
## 99           0         0         1         1           35.495     6745.05
## 100          0         0         1         1           35.495     6816.04
## 101          0         0         1         1           35.495     6887.03
## 102          0         0         1         1           35.495     6958.02
## 103          0         0         1         1           35.495     7029.01
##     sizebin_max sizebin_center sizebin_width binhalfwidthb_raw sizebinb_min
## 1          0.00          0.000          0.00                NA           NA
## 2        200.00        100.000        200.00                NA           NA
## 3          0.50          0.000          1.00                NA           NA
## 4         71.99         36.495         70.99                NA           NA
## 5        142.98        107.485         70.99                NA           NA
## 6        213.97        178.475         70.99                NA           NA
## 7        284.96        249.465         70.99                NA           NA
## 8        355.95        320.455         70.99                NA           NA
## 9        426.94        391.445         70.99                NA           NA
## 10       497.93        462.435         70.99                NA           NA
## 11       568.92        533.425         70.99                NA           NA
## 12       639.91        604.415         70.99                NA           NA
## 13       710.90        675.405         70.99                NA           NA
## 14       781.89        746.395         70.99                NA           NA
## 15       852.88        817.385         70.99                NA           NA
## 16       923.87        888.375         70.99                NA           NA
## 17       994.86        959.365         70.99                NA           NA
## 18      1065.85       1030.355         70.99                NA           NA
## 19      1136.84       1101.345         70.99                NA           NA
## 20      1207.83       1172.335         70.99                NA           NA
## 21      1278.82       1243.325         70.99                NA           NA
## 22      1349.81       1314.315         70.99                NA           NA
## 23      1420.80       1385.305         70.99                NA           NA
## 24      1491.79       1456.295         70.99                NA           NA
## 25      1562.78       1527.285         70.99                NA           NA
## 26      1633.77       1598.275         70.99                NA           NA
## 27      1704.76       1669.265         70.99                NA           NA
## 28      1775.75       1740.255         70.99                NA           NA
## 29      1846.74       1811.245         70.99                NA           NA
## 30      1917.73       1882.235         70.99                NA           NA
## 31      1988.72       1953.225         70.99                NA           NA
## 32      2059.71       2024.215         70.99                NA           NA
## 33      2130.70       2095.205         70.99                NA           NA
## 34      2201.69       2166.195         70.99                NA           NA
## 35      2272.68       2237.185         70.99                NA           NA
## 36      2343.67       2308.175         70.99                NA           NA
## 37      2414.66       2379.165         70.99                NA           NA
## 38      2485.65       2450.155         70.99                NA           NA
## 39      2556.64       2521.145         70.99                NA           NA
## 40      2627.63       2592.135         70.99                NA           NA
## 41      2698.62       2663.125         70.99                NA           NA
## 42      2769.61       2734.115         70.99                NA           NA
## 43      2840.60       2805.105         70.99                NA           NA
## 44      2911.59       2876.095         70.99                NA           NA
## 45      2982.58       2947.085         70.99                NA           NA
## 46      3053.57       3018.075         70.99                NA           NA
## 47      3124.56       3089.065         70.99                NA           NA
## 48      3195.55       3160.055         70.99                NA           NA
## 49      3266.54       3231.045         70.99                NA           NA
## 50      3337.53       3302.035         70.99                NA           NA
## 51      3408.52       3373.025         70.99                NA           NA
## 52      3479.51       3444.015         70.99                NA           NA
## 53      3550.50       3515.005         70.99                NA           NA
## 54      3621.49       3585.995         70.99                NA           NA
## 55      3692.48       3656.985         70.99                NA           NA
## 56      3763.47       3727.975         70.99                NA           NA
## 57      3834.46       3798.965         70.99                NA           NA
## 58      3905.45       3869.955         70.99                NA           NA
## 59      3976.44       3940.945         70.99                NA           NA
## 60      4047.43       4011.935         70.99                NA           NA
## 61      4118.42       4082.925         70.99                NA           NA
## 62      4189.41       4153.915         70.99                NA           NA
## 63      4260.40       4224.905         70.99                NA           NA
## 64      4331.39       4295.895         70.99                NA           NA
## 65      4402.38       4366.885         70.99                NA           NA
## 66      4473.37       4437.875         70.99                NA           NA
## 67      4544.36       4508.865         70.99                NA           NA
## 68      4615.35       4579.855         70.99                NA           NA
## 69      4686.34       4650.845         70.99                NA           NA
## 70      4757.33       4721.835         70.99                NA           NA
## 71      4828.32       4792.825         70.99                NA           NA
## 72      4899.31       4863.815         70.99                NA           NA
## 73      4970.30       4934.805         70.99                NA           NA
## 74      5041.29       5005.795         70.99                NA           NA
## 75      5112.28       5076.785         70.99                NA           NA
## 76      5183.27       5147.775         70.99                NA           NA
## 77      5254.26       5218.765         70.99                NA           NA
## 78      5325.25       5289.755         70.99                NA           NA
## 79      5396.24       5360.745         70.99                NA           NA
## 80      5467.23       5431.735         70.99                NA           NA
## 81      5538.22       5502.725         70.99                NA           NA
## 82      5609.21       5573.715         70.99                NA           NA
## 83      5680.20       5644.705         70.99                NA           NA
## 84      5751.19       5715.695         70.99                NA           NA
## 85      5822.18       5786.685         70.99                NA           NA
## 86      5893.17       5857.675         70.99                NA           NA
## 87      5964.16       5928.665         70.99                NA           NA
## 88      6035.15       5999.655         70.99                NA           NA
## 89      6106.14       6070.645         70.99                NA           NA
## 90      6177.13       6141.635         70.99                NA           NA
## 91      6248.12       6212.625         70.99                NA           NA
## 92      6319.11       6283.615         70.99                NA           NA
## 93      6390.10       6354.605         70.99                NA           NA
## 94      6461.09       6425.595         70.99                NA           NA
## 95      6532.08       6496.585         70.99                NA           NA
## 96      6603.07       6567.575         70.99                NA           NA
## 97      6674.06       6638.565         70.99                NA           NA
## 98      6745.05       6709.555         70.99                NA           NA
## 99      6816.04       6780.545         70.99                NA           NA
## 100     6887.03       6851.535         70.99                NA           NA
## 101     6958.02       6922.525         70.99                NA           NA
## 102     7029.01       6993.515         70.99                NA           NA
## 103     7100.00       7064.505         70.99                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
## 55            NA              NA             NA                NA           NA
## 56            NA              NA             NA                NA           NA
## 57            NA              NA             NA                NA           NA
## 58            NA              NA             NA                NA           NA
## 59            NA              NA             NA                NA           NA
## 60            NA              NA             NA                NA           NA
## 61            NA              NA             NA                NA           NA
## 62            NA              NA             NA                NA           NA
## 63            NA              NA             NA                NA           NA
## 64            NA              NA             NA                NA           NA
## 65            NA              NA             NA                NA           NA
## 66            NA              NA             NA                NA           NA
## 67            NA              NA             NA                NA           NA
## 68            NA              NA             NA                NA           NA
## 69            NA              NA             NA                NA           NA
## 70            NA              NA             NA                NA           NA
## 71            NA              NA             NA                NA           NA
## 72            NA              NA             NA                NA           NA
## 73            NA              NA             NA                NA           NA
## 74            NA              NA             NA                NA           NA
## 75            NA              NA             NA                NA           NA
## 76            NA              NA             NA                NA           NA
## 77            NA              NA             NA                NA           NA
## 78            NA              NA             NA                NA           NA
## 79            NA              NA             NA                NA           NA
## 80            NA              NA             NA                NA           NA
## 81            NA              NA             NA                NA           NA
## 82            NA              NA             NA                NA           NA
## 83            NA              NA             NA                NA           NA
## 84            NA              NA             NA                NA           NA
## 85            NA              NA             NA                NA           NA
## 86            NA              NA             NA                NA           NA
## 87            NA              NA             NA                NA           NA
## 88            NA              NA             NA                NA           NA
## 89            NA              NA             NA                NA           NA
## 90            NA              NA             NA                NA           NA
## 91            NA              NA             NA                NA           NA
## 92            NA              NA             NA                NA           NA
## 93            NA              NA             NA                NA           NA
## 94            NA              NA             NA                NA           NA
## 95            NA              NA             NA                NA           NA
## 96            NA              NA             NA                NA           NA
## 97            NA              NA             NA                NA           NA
## 98            NA              NA             NA                NA           NA
## 99            NA              NA             NA                NA           NA
## 100           NA              NA             NA                NA           NA
## 101           NA              NA             NA                NA           NA
## 102           NA              NA             NA                NA           NA
## 103           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        Seedling
## 3             NA              NA             NA     0         Dormant
## 4             NA              NA             NA     0 ipm adult stage
## 5             NA              NA             NA     0 ipm adult stage
## 6             NA              NA             NA     0 ipm adult stage
## 7             NA              NA             NA     0 ipm adult stage
## 8             NA              NA             NA     0 ipm adult stage
## 9             NA              NA             NA     0 ipm adult stage
## 10            NA              NA             NA     0 ipm adult stage
## 11            NA              NA             NA     0 ipm adult stage
## 12            NA              NA             NA     0 ipm adult stage
## 13            NA              NA             NA     0 ipm adult stage
## 14            NA              NA             NA     0 ipm adult stage
## 15            NA              NA             NA     0 ipm adult stage
## 16            NA              NA             NA     0 ipm adult stage
## 17            NA              NA             NA     0 ipm adult stage
## 18            NA              NA             NA     0 ipm adult stage
## 19            NA              NA             NA     0 ipm adult stage
## 20            NA              NA             NA     0 ipm adult stage
## 21            NA              NA             NA     0 ipm adult stage
## 22            NA              NA             NA     0 ipm adult stage
## 23            NA              NA             NA     0 ipm adult stage
## 24            NA              NA             NA     0 ipm adult stage
## 25            NA              NA             NA     0 ipm adult stage
## 26            NA              NA             NA     0 ipm adult stage
## 27            NA              NA             NA     0 ipm adult stage
## 28            NA              NA             NA     0 ipm adult stage
## 29            NA              NA             NA     0 ipm adult stage
## 30            NA              NA             NA     0 ipm adult stage
## 31            NA              NA             NA     0 ipm adult stage
## 32            NA              NA             NA     0 ipm adult stage
## 33            NA              NA             NA     0 ipm adult stage
## 34            NA              NA             NA     0 ipm adult stage
## 35            NA              NA             NA     0 ipm adult stage
## 36            NA              NA             NA     0 ipm adult stage
## 37            NA              NA             NA     0 ipm adult stage
## 38            NA              NA             NA     0 ipm adult stage
## 39            NA              NA             NA     0 ipm adult stage
## 40            NA              NA             NA     0 ipm adult stage
## 41            NA              NA             NA     0 ipm adult stage
## 42            NA              NA             NA     0 ipm adult stage
## 43            NA              NA             NA     0 ipm adult stage
## 44            NA              NA             NA     0 ipm adult stage
## 45            NA              NA             NA     0 ipm adult stage
## 46            NA              NA             NA     0 ipm adult stage
## 47            NA              NA             NA     0 ipm adult stage
## 48            NA              NA             NA     0 ipm adult stage
## 49            NA              NA             NA     0 ipm adult stage
## 50            NA              NA             NA     0 ipm adult stage
## 51            NA              NA             NA     0 ipm adult stage
## 52            NA              NA             NA     0 ipm adult stage
## 53            NA              NA             NA     0 ipm adult stage
## 54            NA              NA             NA     0 ipm adult stage
## 55            NA              NA             NA     0 ipm adult stage
## 56            NA              NA             NA     0 ipm adult stage
## 57            NA              NA             NA     0 ipm adult stage
## 58            NA              NA             NA     0 ipm adult stage
## 59            NA              NA             NA     0 ipm adult stage
## 60            NA              NA             NA     0 ipm adult stage
## 61            NA              NA             NA     0 ipm adult stage
## 62            NA              NA             NA     0 ipm adult stage
## 63            NA              NA             NA     0 ipm adult stage
## 64            NA              NA             NA     0 ipm adult stage
## 65            NA              NA             NA     0 ipm adult stage
## 66            NA              NA             NA     0 ipm adult stage
## 67            NA              NA             NA     0 ipm adult stage
## 68            NA              NA             NA     0 ipm adult stage
## 69            NA              NA             NA     0 ipm adult stage
## 70            NA              NA             NA     0 ipm adult stage
## 71            NA              NA             NA     0 ipm adult stage
## 72            NA              NA             NA     0 ipm adult stage
## 73            NA              NA             NA     0 ipm adult stage
## 74            NA              NA             NA     0 ipm adult stage
## 75            NA              NA             NA     0 ipm adult stage
## 76            NA              NA             NA     0 ipm adult stage
## 77            NA              NA             NA     0 ipm adult stage
## 78            NA              NA             NA     0 ipm adult stage
## 79            NA              NA             NA     0 ipm adult stage
## 80            NA              NA             NA     0 ipm adult stage
## 81            NA              NA             NA     0 ipm adult stage
## 82            NA              NA             NA     0 ipm adult stage
## 83            NA              NA             NA     0 ipm adult stage
## 84            NA              NA             NA     0 ipm adult stage
## 85            NA              NA             NA     0 ipm adult stage
## 86            NA              NA             NA     0 ipm adult stage
## 87            NA              NA             NA     0 ipm adult stage
## 88            NA              NA             NA     0 ipm adult stage
## 89            NA              NA             NA     0 ipm adult stage
## 90            NA              NA             NA     0 ipm adult stage
## 91            NA              NA             NA     0 ipm adult stage
## 92            NA              NA             NA     0 ipm adult stage
## 93            NA              NA             NA     0 ipm adult stage
## 94            NA              NA             NA     0 ipm adult stage
## 95            NA              NA             NA     0 ipm adult stage
## 96            NA              NA             NA     0 ipm adult stage
## 97            NA              NA             NA     0 ipm adult stage
## 98            NA              NA             NA     0 ipm adult stage
## 99            NA              NA             NA     0 ipm adult stage
## 100           NA              NA             NA     0 ipm adult stage
## 101           NA              NA             NA     0 ipm adult stage
## 102           NA              NA             NA     0 ipm adult stage
## 103           NA              NA             NA     0 ipm adult stage

The function sf_create() has created our mesh points and associated size bins. This is in addition to the discrete stages covering the dormant seed, seedling, and dormant adult stages. Of course, we could have made this even more complex. For example, we could have created two sets of stages to use as the upper and lower bounds of two sets of continuous size states that differ in some key characteristic, such as reproductive status. We also could have set up the IPM using two or three different size metrics and used the ipm option within each or only some of them. This function provides a great deal of flexibility and power to create exactly the life history model that you may want.

Step 2a. Demographic data standardization

Now that we have our life history models, 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.

Note that in these exercises, we will not only standardize the datasets, but also link them to their appropriate life history models. This is eventually necessary if one wishes to create raw (empirical) MPMs, but is not necessary for function-based MPMs and IPMs, and is also not necessary simply to explore a dataset.

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

Let’s try the same exercise as before, but using the Cypripedium IPM stageframe.

cypipm_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_ipm, stagesize = "sizeadded", age_offset = 4,
  NAas0 = TRUE)
## Warning: Some stages occurring in the dataset do not match any characteristics
## in the input stageframe.

## Warning: Some stages occurring in the dataset do not match any characteristics
## in the input stageframe.

## Warning: Some stages occurring in the dataset do not match any characteristics
## in the input stageframe.

## Warning: Some stages occurring in the dataset do not match any characteristics
## in the input stageframe.

## Warning: Some stages occurring in the dataset do not match any characteristics
## in the input stageframe.

## Warning: Some stages occurring in the dataset do not match any characteristics
## in the input stageframe.

## Warning: Some stages occurring in the dataset do not match any characteristics
## in the input stageframe.

## Warning: Some stages occurring in the dataset do not match any characteristics
## in the input stageframe.

## Warning: Some stages occurring in the dataset do not match any characteristics
## in the input stageframe.

## Warning: Some stages occurring in the dataset do not match any characteristics
## in the input stageframe.

## Warning: Some stages occurring in the dataset do not match any characteristics
## in the input stageframe.

## Warning: Some stages occurring in the dataset do not match any characteristics
## in the input stageframe.

## Warning: Some stages occurring in the dataset do not match any characteristics
## in the input stageframe.

## Warning: Some stages occurring in the dataset do not match any characteristics
## in the input stageframe.

## Warning: Some stages occurring in the dataset do not match any characteristics
## in the input stageframe.
summary_hfv(cypipm_v1)
## 
## This hfv dataset contains 320 rows, 54 variables, 1 population, 
## 3 patches, 74 individuals, and 5 time steps.
##      rowid       popid  patchid   individ              year2     
##  Min.   : 1.00   :320   A: 93   Length:320         Min.   :2004  
##  1st Qu.:21.00          B:154   Class :character   1st Qu.:2005  
##  Median :37.50          C: 73   Mode  :character   Median :2006  
##  Mean   :38.45                                     Mean   :2006  
##  3rd Qu.:56.00                                     3rd Qu.:2007  
##  Max.   :77.00                                     Max.   :2008  
##    firstseen       lastseen        obsage       obslifespan   
##  Min.   :2004   Min.   :2004   Min.   :5.000   Min.   :0.000  
##  1st Qu.:2004   1st Qu.:2009   1st Qu.:6.000   1st Qu.:5.000  
##  Median :2004   Median :2009   Median :7.000   Median :5.000  
##  Mean   :2004   Mean   :2009   Mean   :6.853   Mean   :4.556  
##  3rd Qu.:2004   3rd Qu.:2009   3rd Qu.:8.000   3rd Qu.:5.000  
##  Max.   :2008   Max.   :2009   Max.   :9.000   Max.   :5.000  
##      sizea1             sizeb1            sizec1       size1added    
##  Min.   :0.000000   Min.   : 0.0000   Min.   : 0.0   Min.   : 0.000  
##  1st Qu.:0.000000   1st Qu.: 0.0000   1st Qu.: 0.0   1st Qu.: 0.000  
##  Median :0.000000   Median : 0.0000   Median : 1.0   Median : 2.000  
##  Mean   :0.009375   Mean   : 0.7469   Mean   : 1.9   Mean   : 2.656  
##  3rd Qu.:0.000000   3rd Qu.: 1.0000   3rd Qu.: 3.0   3rd Qu.: 4.000  
##  Max.   :1.000000   Max.   :18.0000   Max.   :13.0   Max.   :21.000  
##     repstra1          repstrb1            feca1          juvgiven1
##  Min.   : 0.0000   Min.   :0.000000   Min.   :0.0000   Min.   :0  
##  1st Qu.: 0.0000   1st Qu.:0.000000   1st Qu.:0.0000   1st Qu.:0  
##  Median : 0.0000   Median :0.000000   Median :0.0000   Median :0  
##  Mean   : 0.7469   Mean   :0.009375   Mean   :0.2656   Mean   :0  
##  3rd Qu.: 1.0000   3rd Qu.:0.000000   3rd Qu.:0.0000   3rd Qu.:0  
##  Max.   :18.0000   Max.   :1.000000   Max.   :7.0000   Max.   :0  
##    obsstatus1       repstatus1       fecstatus1       matstatus1    
##  Min.   :0.0000   Min.   :0.0000   Min.   :0.0000   Min.   :0.0000  
##  1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:0.0000  
##  Median :1.0000   Median :0.0000   Median :0.0000   Median :1.0000  
##  Mean   :0.7469   Mean   :0.2875   Mean   :0.1344   Mean   :0.7469  
##  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.: 0.00   1st Qu.:0.000000  
##  Median :1.0000   Mode  :character   Median : 8.00   Median :0.000000  
##  Mean   :0.7688                      Mean   :14.04   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.   : 0.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   :17.89   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.29  
##  3rd Qu.:1.0000                      3rd Qu.:33.00  
##  Max.   :1.0000                      Max.   :54.00

We will do one further standardization to the Cypripedium 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)

summary_hfv(cypfb_env)
## 
## This hfv dataset contains 320 rows, 57 variables, 1 population, 
## 3 patches, 74 individuals, and 5 time steps.
##      rowid       popid  patchid   individ              year2     
##  Min.   : 1.00   :320   A: 93   Length:320         Min.   :2004  
##  1st Qu.:21.00          B:154   Class :character   1st Qu.:2005  
##  Median :37.50          C: 73   Mode  :character   Median :2006  
##  Mean   :38.45                                     Mean   :2006  
##  3rd Qu.:56.00                                     3rd Qu.:2007  
##  Max.   :77.00                                     Max.   :2008  
##    firstseen       lastseen        obsage       obslifespan   
##  Min.   :2004   Min.   :2004   Min.   :5.000   Min.   :0.000  
##  1st Qu.:2004   1st Qu.:2009   1st Qu.:6.000   1st Qu.:5.000  
##  Median :2004   Median :2009   Median :7.000   Median :5.000  
##  Mean   :2004   Mean   :2009   Mean   :6.853   Mean   :4.556  
##  3rd Qu.:2004   3rd Qu.:2009   3rd Qu.:8.000   3rd Qu.:5.000  
##  Max.   :2008   Max.   :2009   Max.   :9.000   Max.   :5.000  
##      sizea1             sizeb1            sizec1       size1added    
##  Min.   :0.000000   Min.   : 0.0000   Min.   : 0.0   Min.   : 0.000  
##  1st Qu.:0.000000   1st Qu.: 0.0000   1st Qu.: 0.0   1st Qu.: 0.000  
##  Median :0.000000   Median : 0.0000   Median : 1.0   Median : 2.000  
##  Mean   :0.009375   Mean   : 0.7469   Mean   : 1.9   Mean   : 2.656  
##  3rd Qu.:0.000000   3rd Qu.: 1.0000   3rd Qu.: 3.0   3rd Qu.: 4.000  
##  Max.   :1.000000   Max.   :18.0000   Max.   :13.0   Max.   :21.000  
##     repstra1          repstrb1            feca1           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.

Finally, let’s standardize the Lathyrus dataset for use in IPM development. Prior to doing that, we need to make a small adjustment to the dataset, by adding an individual identifier variable. Currently, the GENET variable serves as an individual identifier, but only within the patch, leading to some individual identifiers being reused across patches. To make sure that individuals are treated as unique, we create a new variable that combines the patch name and the individual name into one unique identifier per plant.

lathyrus$indiv_id <- paste(lathyrus$SUBPLOT, lathyrus$GENET)

lathvert_ipm <- verticalize3(lathyrus, noyears = 4, firstyear = 1988, 
  individcol = "indiv_id", blocksize = 9, juvcol = "Seedling1988", 
  sizeacol = "Volume88", repstracol = "FCODE88", fecacol = "Intactseed88", 
  deadacol = "Dead1988", nonobsacol = "Dormant1988", stageassign = lathframe_ipm,
  stagesize = "sizea", censorcol = "Missing1988", censorkeep = NA,
  censorRepeat = TRUE, censor = TRUE, NAas0 = TRUE, NRasRep = TRUE)

summary_hfv(lathvert_ipm, full = FALSE)
## 
## This hfv dataset contains 2527 rows, 42 variables, 1 population, 
## 1 patch, 1053 individuals, and 3 time steps.

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

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

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

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

We can compare the dimensions of these datasets.

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

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 supplemental transitions that we need to properly parameterize our models.

Step 2b. Provide supplemental information for matrix estimation

The next steps involve adding some external data to parameterize the matrices properly. We will accomplish this with the supplemental() function. 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 raw Cypripedium MPMs. Technically, this first supplement table will be for the ahistorical and age-by-stage raw MPMs.

seeds_per_pod <- 5000

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)

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

In the above table, we provide information on more than ten general transitions. The transitions themselves are shown in the stage2 and stage3 vectors. The first transition corresponds to the first element in each vector. Since the first element of stage2 is "SD", and the first element of stage3 is "SD", the first transition is the stasis transition for dormant seeds. All elements in these vectors correspond to stages in the stageframe being used, with the exceptions of some specific keywords, such as "mat", "rep", etc. These keywords refer to groups of stages. For example, "rep" is shorthand for all reproductive stages, while "mat" is shorthand for all mature stages. Other keywords exist, and the help file for function supplemental() defines these. Thus, the transition from "rep" to "SD" is actually shorthand for all transitions from reproductive stages to the dormant seed stage.

The first six transitions of the above table are replaced by specific constants, given as 0.03, 0.15, 0.1, etc. However, the seventh and eighth transitions listed are to be replaced with proxy values, which are transitions values estimated for other transitions. The values to use are provided in the respective places in the eststage2 and eststage3 vectors. Thus, the transitions from SL to D and from SL to XSm should be replaced with the values estimated for the transitions from XSm to D and XSm to XSm, respectively. The final two transitions, which are the fecundity steps corresponding to the production of dormant seeds and first-year protocorms by reproductive individuals, are shown to need to be multiplied by 0.5 * the number of seeds per pod, via fecundity multipliers.

Historical MPMs are composed of transitions across three times, and so supplement tables for historical MPMs need to include stage information for three times in all transitions to be worked with. Here, we show a historical supplement table for the raw Cypripedium MPM case.

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)

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

Notice that there is a different total number of transitions provided here - there were only 10 transitions detailed in the ahistorical case, but 13 are given here. This is due to the fact that the stage at time t-1 needs to be specified for each transition, and sometimes this requires extra detail to set up properly. For example, a dormant seed in time t that stayed dormant in time t+1 might have also been dormant in time t-1, or might have been produced by a reproductive plant right after the monitoring occasion in time t-1.

Let’s now provide the supplement tables for the function-based ahistorical and historical MPMs. The ahistorical supplement will also be used to create function-based age-by-stage MPMs.

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
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

Finally, let’s provide the supplemental data for the Lathyrus IPM.

lathsupp2 <- supplemental(stage3 = c("Sd", "Sdl", "Sd", "Sdl"), 
  stage2 = c("Sd", "Sd", "rep", "rep"),
  givenrate = c(0.345, 0.054, NA, NA),
  multiplier = c(NA, NA, 0.345, 0.054),
  type = c(1, 1, 3, 3), stageframe = lathframe_ipm, historical = FALSE)

lathsupp2
##   stage3 stage2 stage1 eststage3 eststage2 eststage1 givenrate multiplier
## 1     Sd     Sd   <NA>      <NA>      <NA>      <NA>     0.345      1.000
## 2    Sdl     Sd   <NA>      <NA>      <NA>      <NA>     0.054      1.000
## 3     Sd    rep   <NA>      <NA>      <NA>      <NA>        NA      0.345
## 4    Sdl    rep   <NA>      <NA>      <NA>      <NA>        NA      0.054
##   convtype convtype_t12
## 1        1            1
## 2        1            1
## 3        3            1
## 4        3            1
lathsupp3 <- supplemental(stage3 = c("Sd", "Sd", "Sdl", "Sdl", "npr", "Sd", "Sdl"), 
  stage2 = c("Sd", "Sd", "Sd", "Sd", "Sdl", "rep", "rep"),
  stage1 = c("Sd", "rep", "Sd", "rep", "Sd", "mat", "mat"),
  eststage3 = c(NA, NA, NA, NA, "npr", NA, NA),
  eststage2 = c(NA, NA, NA, NA, "Sdl", NA, NA),
  eststage1 = c(NA, NA, NA, NA, "Sdl", NA, NA),
  givenrate = c(0.345, 0.345, 0.054, 0.054, NA, NA, NA),
  multiplier = c(NA, NA, NA, NA, NA, 0.345, 0.054),
  type = c(1, 1, 1, 1, 1, 3, 3), type_t12 = c(1, 2, 1, 2, 1, 1, 1),
  stageframe = lathframe_ipm, historical = TRUE)

lathsupp3
##   stage3 stage2 stage1 eststage3 eststage2 eststage1 givenrate multiplier
## 1     Sd     Sd     Sd      <NA>      <NA>      <NA>     0.345      1.000
## 2     Sd     Sd    rep      <NA>      <NA>      <NA>     0.345      1.000
## 3    Sdl     Sd     Sd      <NA>      <NA>      <NA>     0.054      1.000
## 4    Sdl     Sd    rep      <NA>      <NA>      <NA>     0.054      1.000
## 5    npr    Sdl     Sd       npr       Sdl       Sdl        NA      1.000
## 6     Sd    rep    mat      <NA>      <NA>      <NA>        NA      0.345
## 7    Sdl    rep    mat      <NA>      <NA>      <NA>        NA      0.054
##   convtype convtype_t12
## 1        1            1
## 2        1            2
## 3        1            1
## 4        1            2
## 5        1            1
## 6        3            1
## 7        3            1

Step 3. Vital rate modeling (for fbMPMs and IPMs only)

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, 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: hfv_qc(). Here, we use it to explore the datasets that we have standardized. Let’s start with the raw Cypripedium dataset, under ahistorical assumptions.

hfv_qc(data = cypraw_v1, vitalrates = c("surv", "obs", "size", "repst", "fec"),
  suite = "full", size = c("size3added", "size2added", "size1added"))
## Survival:
## 
##   Data subset has 55 variables and 320 transitions.
## 
##   Variable alive3 has 0 missing values.
##   Variable alive3 is a binomial variable.
## 
## 
## Observation status:
## 
##   Data subset has 55 variables and 303 transitions.
## 
##   Variable obsstatus3 has 0 missing values.
##   Variable obsstatus3 is a binomial variable.
## 
## 
## Primary size:
## 
##   Data subset has 55 variables and 288 transitions.
## 
##   Variable size3added has 0 missing values.
##   Variable size3added appears to be an integer variable.
## 
##   Variable size3added is fully positive, lacking even 0s.
## 
##   Overdispersion test:
##     Mean size3added is 3.653
##     The variance in size3added is 13.41
##     The probability of this dispersion level by chance assuming that
##     the true mean size3added = variance in size3added,
##     and an alternative hypothesis of overdispersion, is 3.721e-138
##     Variable size3added is significantly overdispersed.
## 
##   Zero-inflation and truncation tests:
##     Mean lambda in size3added is 0.02592
##     The actual number of 0s in size3added is 0
##     The expected number of 0s in size3added under the null hypothesis is 7.465
##     The probability of this deviation in 0s from expectation by chance is 0.9964
##     Variable size3added is not significantly zero-inflated.
## 
##     Variable size3added does not include 0s, suggesting that a zero-truncated distribution may be warranted.
## 
## 
## Reproductive status:
## 
##   Data subset has 55 variables and 288 transitions.
## 
##   Variable repstatus3 has 0 missing values.
##   Variable repstatus3 is a binomial variable.
## 
## 
## Fecundity:
## 
##   Data subset has 55 variables and 118 transitions.
## 
##   Variable feca2 has 0 missing values.
##   Variable feca2 appears to be an integer variable.
## 
##   Variable feca2 is fully non-negative.
## 
##   Overdispersion test:
##     Mean feca2 is 0.7881
##     The variance in feca2 is 1.536
##     The probability of this dispersion level by chance assuming that
##     the true mean feca2 = variance in feca2,
##     and an alternative hypothesis of overdispersion, is 0.1193
##     Dispersion level in feca2 matches expectation.
## 
##   Zero-inflation and truncation tests:
##     Mean lambda in feca2 is 0.4547
##     The actual number of 0s in feca2 is 68
##     The expected number of 0s in feca2 under the null hypothesis is 53.65
##     The probability of this deviation in 0s from expectation by chance is 5.904e-06
##     Variable feca2 is significantly zero-inflated.

We note that size is is composed of positive integers, without any zeroes, and that it is overdispersed. This suggests that we should use the zero-truncated negative binomial distribution. Fecundity is also an integer variable, but it is not overdispersed and it appears to have more zeroes than expected under a Poisson distribution. Thus, we should go with a zero-inflated Poisson distribution.

Let’s compare to the function-based dataset.

hfv_qc(data = cypfb_v1, vitalrates = c("surv", "obs", "size", "repst", "fec"),
  suite = "full", size = c("size3added", "size2added", "size1added"))
## Survival:
## 
##   Data subset has 55 variables and 320 transitions.
## 
##   Variable alive3 has 0 missing values.
##   Variable alive3 is a binomial variable.
## 
## 
## Observation status:
## 
##   Data subset has 55 variables and 303 transitions.
## 
##   Variable obsstatus3 has 0 missing values.
##   Variable obsstatus3 is a binomial variable.
## 
## 
## Primary size:
## 
##   Data subset has 55 variables and 288 transitions.
## 
##   Variable size3added has 0 missing values.
##   Variable size3added appears to be an integer variable.
## 
##   Variable size3added is fully positive, lacking even 0s.
## 
##   Overdispersion test:
##     Mean size3added is 3.653
##     The variance in size3added is 13.41
##     The probability of this dispersion level by chance assuming that
##     the true mean size3added = variance in size3added,
##     and an alternative hypothesis of overdispersion, is 3.721e-138
##     Variable size3added is significantly overdispersed.
## 
##   Zero-inflation and truncation tests:
##     Mean lambda in size3added is 0.02592
##     The actual number of 0s in size3added is 0
##     The expected number of 0s in size3added under the null hypothesis is 7.465
##     The probability of this deviation in 0s from expectation by chance is 0.9964
##     Variable size3added is not significantly zero-inflated.
## 
##     Variable size3added does not include 0s, suggesting that a zero-truncated distribution may be warranted.
## 
## 
## Reproductive status:
## 
##   Data subset has 55 variables and 288 transitions.
## 
##   Variable repstatus3 has 0 missing values.
##   Variable repstatus3 is a binomial variable.
## 
## 
## Fecundity:
## 
##   Data subset has 55 variables and 118 transitions.
## 
##   Variable feca2 has 0 missing values.
##   Variable feca2 appears to be an integer variable.
## 
##   Variable feca2 is fully non-negative.
## 
##   Overdispersion test:
##     Mean feca2 is 0.7881
##     The variance in feca2 is 1.536
##     The probability of this dispersion level by chance assuming that
##     the true mean feca2 = variance in feca2,
##     and an alternative hypothesis of overdispersion, is 0.1193
##     Dispersion level in feca2 matches expectation.
## 
##   Zero-inflation and truncation tests:
##     Mean lambda in feca2 is 0.4547
##     The actual number of 0s in feca2 is 68
##     The expected number of 0s in feca2 under the null hypothesis is 53.65
##     The probability of this deviation in 0s from expectation by chance is 5.904e-06
##     Variable feca2 is significantly zero-inflated.

The same results, of course, since we are really using the same size and fecundity data as before (only the stage assignments are different).

Just to reinforce the similarities, let’s compare to the Cypripedium IPM dataset, which will also be the same.

hfv_qc(data = cypipm_v1, vitalrates = c("surv", "obs", "size", "repst", "fec"),
  suite = "full", size = c("size3added", "size2added", "size1added"))
## Survival:
## 
##   Data subset has 55 variables and 320 transitions.
## 
##   Variable alive3 has 0 missing values.
##   Variable alive3 is a binomial variable.
## 
## 
## Observation status:
## 
##   Data subset has 55 variables and 303 transitions.
## 
##   Variable obsstatus3 has 0 missing values.
##   Variable obsstatus3 is a binomial variable.
## 
## 
## Primary size:
## 
##   Data subset has 55 variables and 288 transitions.
## 
##   Variable size3added has 0 missing values.
##   Variable size3added appears to be an integer variable.
## 
##   Variable size3added is fully positive, lacking even 0s.
## 
##   Overdispersion test:
##     Mean size3added is 3.653
##     The variance in size3added is 13.41
##     The probability of this dispersion level by chance assuming that
##     the true mean size3added = variance in size3added,
##     and an alternative hypothesis of overdispersion, is 3.721e-138
##     Variable size3added is significantly overdispersed.
## 
##   Zero-inflation and truncation tests:
##     Mean lambda in size3added is 0.02592
##     The actual number of 0s in size3added is 0
##     The expected number of 0s in size3added under the null hypothesis is 7.465
##     The probability of this deviation in 0s from expectation by chance is 0.9964
##     Variable size3added is not significantly zero-inflated.
## 
##     Variable size3added does not include 0s, suggesting that a zero-truncated distribution may be warranted.
## 
## 
## Reproductive status:
## 
##   Data subset has 55 variables and 288 transitions.
## 
##   Variable repstatus3 has 0 missing values.
##   Variable repstatus3 is a binomial variable.
## 
## 
## Fecundity:
## 
##   Data subset has 55 variables and 118 transitions.
## 
##   Variable feca2 has 0 missing values.
##   Variable feca2 appears to be an integer variable.
## 
##   Variable feca2 is fully non-negative.
## 
##   Overdispersion test:
##     Mean feca2 is 0.7881
##     The variance in feca2 is 1.536
##     The probability of this dispersion level by chance assuming that
##     the true mean feca2 = variance in feca2,
##     and an alternative hypothesis of overdispersion, is 0.1193
##     Dispersion level in feca2 matches expectation.
## 
##   Zero-inflation and truncation tests:
##     Mean lambda in feca2 is 0.4547
##     The actual number of 0s in feca2 is 68
##     The expected number of 0s in feca2 under the null hypothesis is 53.65
##     The probability of this deviation in 0s from expectation by chance is 5.904e-06
##     Variable feca2 is significantly zero-inflated.

And finally the function-based Cypripedium dataset with environmental data added.

hfv_qc(data = cypfb_env, vitalrates = c("surv", "obs", "size", "repst", "fec"),
  suite = "full", size = c("size3added", "size2added", "size1added"))
## Survival:
## 
##   Data subset has 58 variables and 320 transitions.
## 
##   Variable alive3 has 0 missing values.
##   Variable alive3 is a binomial variable.
## 
## 
## Observation status:
## 
##   Data subset has 58 variables and 303 transitions.
## 
##   Variable obsstatus3 has 0 missing values.
##   Variable obsstatus3 is a binomial variable.
## 
## 
## Primary size:
## 
##   Data subset has 58 variables and 288 transitions.
## 
##   Variable size3added has 0 missing values.
##   Variable size3added appears to be an integer variable.
## 
##   Variable size3added is fully positive, lacking even 0s.
## 
##   Overdispersion test:
##     Mean size3added is 3.653
##     The variance in size3added is 13.41
##     The probability of this dispersion level by chance assuming that
##     the true mean size3added = variance in size3added,
##     and an alternative hypothesis of overdispersion, is 3.721e-138
##     Variable size3added is significantly overdispersed.
## 
##   Zero-inflation and truncation tests:
##     Mean lambda in size3added is 0.02592
##     The actual number of 0s in size3added is 0
##     The expected number of 0s in size3added under the null hypothesis is 7.465
##     The probability of this deviation in 0s from expectation by chance is 0.9964
##     Variable size3added is not significantly zero-inflated.
## 
##     Variable size3added does not include 0s, suggesting that a zero-truncated distribution may be warranted.
## 
## 
## Reproductive status:
## 
##   Data subset has 58 variables and 288 transitions.
## 
##   Variable repstatus3 has 0 missing values.
##   Variable repstatus3 is a binomial variable.
## 
## 
## Fecundity:
## 
##   Data subset has 58 variables and 118 transitions.
## 
##   Variable feca2 has 0 missing values.
##   Variable feca2 appears to be an integer variable.
## 
##   Variable feca2 is fully non-negative.
## 
##   Overdispersion test:
##     Mean feca2 is 0.7881
##     The variance in feca2 is 1.536
##     The probability of this dispersion level by chance assuming that
##     the true mean feca2 = variance in feca2,
##     and an alternative hypothesis of overdispersion, is 0.1193
##     Dispersion level in feca2 matches expectation.
## 
##   Zero-inflation and truncation tests:
##     Mean lambda in feca2 is 0.4547
##     The actual number of 0s in feca2 is 68
##     The expected number of 0s in feca2 under the null hypothesis is 53.65
##     The probability of this deviation in 0s from expectation by chance is 5.904e-06
##     Variable feca2 is significantly zero-inflated.

Finally, let’s move on to the Lathyrus IPM dataset. Let’s include age for the fun of it, as well.

hfv_qc(data = lathvert_ipm, vitalrates = c("surv", "obs", "size", "fec"),
  juvestimate = "Sdl", indiv = "individ", year = "year2", age = "obsage")
## Survival:
## 
##   Data subset has 43 variables and 2246 transitions.
## 
##   Variable alive3 has 0 missing values.
##   Variable alive3 is a binomial variable.
## 
## 
## Observation status:
## 
##   Data subset has 43 variables and 2121 transitions.
## 
##   Variable obsstatus3 has 0 missing values.
##   Variable obsstatus3 is a binomial variable.
## 
## 
## Primary size:
## 
##   Data subset has 43 variables and 1916 transitions.
## 
##   Variable sizea3 has 0 missing values.
##   Variable sizea3 appears to be a floating point variable.
##   1256 elements are not integers.
##   The minimum value of sizea3 is 3.4 and the maximum is 6646.
##   The mean value of sizea3 is 512.8 and the variance is 507200.
##   The value of the Shapiro-Wilk test of normality is 0.7134 with P = 3.014e-49.
##   Variable sizea3 differs significantly from a Gaussian distribution.
## 
##   Variable sizea3 is fully positive, lacking even 0s.
## 
## 
## Reproductive status:
## 
##   Data subset has 43 variables and 1916 transitions.
## 
##   Variable repstatus3 has 0 missing values.
##   Variable repstatus3 is a binomial variable.
## 
## 
## Fecundity:
## 
##   Data subset has 43 variables and 2246 transitions.
## 
##   Variable feca2 has 0 missing values.
##   Variable feca2 appears to be a floating point variable.
##   6 elements are not integers.
##   The minimum value of feca2 is 0 and the maximum is 66.
##   The mean value of feca2 is 1.283 and the variance is 23.22.
##   The value of the Shapiro-Wilk test of normality is 0.2968 with P = 1.676e-68.
##   Variable feca2 differs significantly from a Gaussian distribution.
## 
##   Variable feca2 is fully non-negative.
## 
## 
## Juvenile survival:
## 
##   Data subset has 43 variables and 281 transitions.
## 
##   Variable alive3 has 0 missing values.
##   Variable alive3 is a binomial variable.
## 
## 
## Juvenile observation status:
## 
##   Data subset has 43 variables and 210 transitions.
## 
##   Variable obsstatus3 has 0 missing values.
##   Variable obsstatus3 is a binomial variable.
## 
## 
## Juvenile primary size:
## 
##   Data subset has 43 variables and 193 transitions.
## 
##   Variable sizea3 has 0 missing values.
##   Variable sizea3 appears to be a floating point variable.
##   127 elements are not integers.
##   The minimum value of sizea3 is 2.1 and the maximum is 61.
##   The mean value of sizea3 is 11.23 and the variance is 50.81.
##   The value of the Shapiro-Wilk test of normality is 0.5997 with P = 5.72e-21.
##   Variable sizea3 differs significantly from a Gaussian distribution.
## 
##   Variable sizea3 is fully positive, lacking even 0s.
## 
## 
## Juvenile reproductive status:
## 
##   Data subset has 43 variables and 193 transitions.
## 
##   Variable repstatus3 has 0 missing values.
##   Variable repstatus3 is a binomial variable.
## 
## 
## Juvenile maturity status:
## 
##   Data subset has 43 variables and 210 transitions.
## 
##   Variable matstatus3 has 0 missing values.
##   Variable matstatus3 is a binomial variable.

Let’s start off by taking a look at a density plot of size, since it appears to deviate from a Gaussian distribution.

plot(density(lathvert_ipm$sizea2))

Indeed, it does not appear to be normally distributed. However, for now, we will ignore this issue and simply assume a Gaussian distribution. Note that in reality, we might wish to try a gamma distribution, or use a logarithmic or other size, in order to make a closer match to the Gaussian or other distribution.

Next, let’s try dealing with fecundity. Our results suggest that fecundity is typically an integer, but that a few values are not integers. This has to do with the fact that although fecundity was typically counted as seeds, there were a few instances in the study in which seed count was estimated from a linear regression. Let’s see this issue below.

length(lathvert_ipm$feca3)
## [1] 2527
length(which(lathvert_ipm$feca3 != round(lathvert_ipm$feca3)))
## [1] 0
length(lathvert_ipm$feca2)
## [1] 2527
length(which(lathvert_ipm$feca2 != round(lathvert_ipm$feca2)))
## [1] 6
length(lathvert_ipm$feca1)
## [1] 2527
length(which(lathvert_ipm$feca1 != round(lathvert_ipm$feca1)))
## [1] 6

As we can see, there are really only six out of 2527 values that are not integers. The easiest way to deal with this issue is to round them, as below. Let’s do that, and then re-do the hfv_qc() run.

lathvert_ipm$feca2 <- round(lathvert_ipm$feca2)
lathvert_ipm$feca1 <- round(lathvert_ipm$feca1)

hfv_qc(data = lathvert_ipm, vitalrates = c("surv", "obs", "size", "fec"),
  juvestimate = "Sdl", indiv = "individ", year = "year2", age = "obsage")
## Survival:
## 
##   Data subset has 43 variables and 2246 transitions.
## 
##   Variable alive3 has 0 missing values.
##   Variable alive3 is a binomial variable.
## 
## 
## Observation status:
## 
##   Data subset has 43 variables and 2121 transitions.
## 
##   Variable obsstatus3 has 0 missing values.
##   Variable obsstatus3 is a binomial variable.
## 
## 
## Primary size:
## 
##   Data subset has 43 variables and 1916 transitions.
## 
##   Variable sizea3 has 0 missing values.
##   Variable sizea3 appears to be a floating point variable.
##   1256 elements are not integers.
##   The minimum value of sizea3 is 3.4 and the maximum is 6646.
##   The mean value of sizea3 is 512.8 and the variance is 507200.
##   The value of the Shapiro-Wilk test of normality is 0.7134 with P = 3.014e-49.
##   Variable sizea3 differs significantly from a Gaussian distribution.
## 
##   Variable sizea3 is fully positive, lacking even 0s.
## 
## 
## Reproductive status:
## 
##   Data subset has 43 variables and 1916 transitions.
## 
##   Variable repstatus3 has 0 missing values.
##   Variable repstatus3 is a binomial variable.
## 
## 
## Fecundity:
## 
##   Data subset has 43 variables and 2246 transitions.
## 
##   Variable feca2 has 0 missing values.
##   Variable feca2 appears to be an integer variable.
## 
##   Variable feca2 is fully non-negative.
## 
##   Overdispersion test:
##     Mean feca2 is 1.282
##     The variance in feca2 is 23.21
##     The probability of this dispersion level by chance assuming that
##     the true mean feca2 = variance in feca2,
##     and an alternative hypothesis of overdispersion, is 0
##     Variable feca2 is significantly overdispersed.
## 
##   Zero-inflation and truncation tests:
##     Mean lambda in feca2 is 0.2774
##     The actual number of 0s in feca2 is 1980
##     The expected number of 0s in feca2 under the null hypothesis is 623
##     The probability of this deviation in 0s from expectation by chance is 0
##     Variable feca2 is significantly zero-inflated.
## 
## 
## Juvenile survival:
## 
##   Data subset has 43 variables and 281 transitions.
## 
##   Variable alive3 has 0 missing values.
##   Variable alive3 is a binomial variable.
## 
## 
## Juvenile observation status:
## 
##   Data subset has 43 variables and 210 transitions.
## 
##   Variable obsstatus3 has 0 missing values.
##   Variable obsstatus3 is a binomial variable.
## 
## 
## Juvenile primary size:
## 
##   Data subset has 43 variables and 193 transitions.
## 
##   Variable sizea3 has 0 missing values.
##   Variable sizea3 appears to be a floating point variable.
##   127 elements are not integers.
##   The minimum value of sizea3 is 2.1 and the maximum is 61.
##   The mean value of sizea3 is 11.23 and the variance is 50.81.
##   The value of the Shapiro-Wilk test of normality is 0.5997 with P = 5.72e-21.
##   Variable sizea3 differs significantly from a Gaussian distribution.
## 
##   Variable sizea3 is fully positive, lacking even 0s.
## 
## 
## Juvenile reproductive status:
## 
##   Data subset has 43 variables and 193 transitions.
## 
##   Variable repstatus3 has 0 missing values.
##   Variable repstatus3 is a binomial variable.
## 
## 
## Juvenile maturity status:
## 
##   Data subset has 43 variables and 210 transitions.
## 
##   Variable matstatus3 has 0 missing values.
##   Variable matstatus3 is a binomial variable.

According to this, we should treat fecundity as a zero-inflated negative binomial variable. We will assume the Gaussian distribution for size.

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 generally 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 Barton (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 suite = "main", which runs all main effects without interactions among fixed factors. However, we will not actually run this during our workshop, because this will likely take too long. If you are willing to wait, then you might try including two-way interactions by setting suite = "full". In our case, we will load a pre-run model set called cypmodels3p.

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 = "full", size = c("size3added", "size2added", "size1added"))

save(cypmodels3p, file = "cypmodels3p.Rdata")
load("cypmodels3p.Rdata")
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 ~ size1added + size2added + (1 | year2) + (1 | patchid) +  
##     (1 | individ) + size1added:size2added
## Data: subdata
##       AIC       BIC    logLik  df.resid 
## 1001.2347 1030.5384 -492.6173       280 
## Random-effects (co)variances:
## 
## Conditional model:
##  Groups  Name        Std.Dev.
##  year2   (Intercept) 0.1747  
##  patchid (Intercept) 0.1800  
##  individ (Intercept) 0.7193  
## 
## Number of obs: 288 / Conditional model: year2, 5; patchid, 3; individ, 70
## 
## Dispersion parameter for truncated_nbinom2 family (): 1.4e+07 
## 
## Fixed Effects:
## 
## Conditional model:
##           (Intercept)             size1added             size2added  
##              0.299228               0.082335               0.079648  
## size1added:size2added  
##             -0.006193  
## 
## 
## 
## 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: 113
## 
## Number of models in observation table: 113
## 
## Number of models in size table: 113
## 
## Number of models in secondary size table: 1
## 
## Number of models in tertiary size table: 1
## 
## Number of models in reproduction status table: 113
## 
## Number of models in fecundity table: 12169
## 
## 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. To build ahistorical MPMs, we will repeat the above exercise but with the historical = FALSE setting.

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 = "full", size = c("size3added", "size2added", "size1added"))

save(cypmodels2p, file = "cypmodels2p.Rdata")
load("cypmodels2p.Rdata")
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: 5
## 
## Number of models in observation table: 5
## 
## Number of models in size table: 5
## 
## Number of models in secondary size table: 1
## 
## Number of models in tertiary size table: 1
## 
## Number of models in reproduction status table: 5
## 
## Number of models in fecundity table: 21
## 
## 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.

Let’s also create models that we can use for age and age-by-stage MPM creation.

cypmodels2p_agestage <- 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 = "full", size = c("size3added", "size2added", "size1added"),
  age = "obsage")

save(cypmodels2p_agestage, file = "cypmodels2p_agestage.Rdata")

cypmodels2p_age <- modelsearch(cypfb_env, historical = FALSE, approach = "mixed", 
  vitalrates = c("surv", "fec"), patch = "patchid", fecdist = "poisson",
  fec.zero = TRUE, suite = "cons", age = "obsage")

save(cypmodels2p_age, file = "cypmodels2p_age.Rdata")
load("cypmodels2p_agestage.Rdata")
summary(cypmodels2p_agestage)
## 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 ~ obsage + size2added + (1 | year2) + (1 | patchid) + (1 |  
##     individ) + obsage:size2added
## Zero inflation:         
## ~size2added + (1 | year2) + (1 | patchid) + (1 | individ)
## Data: subdata
##       AIC       BIC    logLik  df.resid 
##  252.2818  285.5300 -114.1409       106 
## Random-effects (co)variances:
## 
## Conditional model:
##  Groups  Name        Std.Dev.
##  year2   (Intercept) 0.450610
##  patchid (Intercept) 0.252398
##  individ (Intercept) 0.000849
## 
## Zero-inflation model:
##  Groups  Name        Std.Dev. 
##  year2   (Intercept) 2.528e-04
##  patchid (Intercept) 7.348e-03
##  individ (Intercept) 7.322e-05
## 
## 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)             obsage         size2added  obsage:size2added  
##           0.09044           -0.08927            0.19053           -0.01891  
## 
## Zero-inflation model:
## (Intercept)   size2added  
##       3.889       -1.589  
## 
## 
## 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: 18
## 
## Number of models in observation table: 18
## 
## Number of models in size table: 18
## 
## Number of models in secondary size table: 1
## 
## Number of models in tertiary size table: 1
## 
## Number of models in reproduction status table: 18
## 
## Number of models in fecundity table: 270
## 
## 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.303.
## 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.
load("cypmodels2p_age.Rdata")
summary(cypmodels2p_age)
## This LefkoMod object includes 2 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 ~ (1 | year2) + (1 | patchid) + (1 | individ)
##    Data: subdata
##      AIC      BIC   logLik deviance df.resid 
## 139.0335 154.1068 -65.5167 131.0335      316 
## Random effects:
##  Groups  Name        Std.Dev.
##  individ (Intercept) 1.746   
##  year2   (Intercept) 0.000   
##  patchid (Intercept) 0.000   
## Number of obs: 320, groups:  individ, 74; year2, 5; patchid, 3
## Fixed Effects:
## (Intercept)  
##       3.724  
## optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
## 
## 
## 
## Observation model:
## [1] 1
## 
## 
## 
## Size model:
## [1] 1
## 
## 
## 
## Secondary size model:
## [1] 1
## 
## 
## 
## Tertiary size model:
## [1] 1
## 
## 
## 
## Reproductive status model:
## [1] 1
## 
## 
## 
## Fecundity model:
## Formula:          feca2 ~ (1 | year2) + (1 | individ)
## Zero inflation:         ~obsage + (1 | year2) + (1 | individ)
## Data: subdata
##       AIC       BIC    logLik  df.resid 
##  378.7659  405.1441 -182.3829       313 
## Random-effects (co)variances:
## 
## Conditional model:
##  Groups  Name        Std.Dev.
##  year2   (Intercept) 0.6859  
##  individ (Intercept) 0.4988  
## 
## Zero-inflation model:
##  Groups  Name        Std.Dev. 
##  year2   (Intercept) 6.778e-05
##  individ (Intercept) 2.737e+00
## 
## Number of obs: 320 / Conditional model: year2, 5; individ, 74 / Zero-inflation model: year2, 5; individ, 74
## 
## Fixed Effects:
## 
## Conditional model:
## (Intercept)  
##     -0.3712  
## 
## Zero-inflation model:
## (Intercept)       obsage  
##     1.95723      0.06176  
## 
## 
## 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: 2
## 
## Number of models in observation table: 1
## 
## Number of models in size table: 1
## 
## Number of models in secondary size table: 1
## 
## Number of models in tertiary size table: 1
## 
## Number of models in reproduction status table: 1
## 
## Number of models in fecundity table: 2
## 
## 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 probability not estimated.
## Primary size transition not estimated.
## Secondary size transition not estimated.
## Tertiary size transition not estimated.
## Reproduction probability not estimated.
## Fecundity estimated with 74 individuals and 320 individual transitions.
## Fecundity pseudo R-squared is 0.416.
## 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.

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 = "full", size = c("size3added", "size2added", "size1added"),
  quiet = TRUE)

save(cypmodels3, file = "cypmodels3.Rdata")

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 = "full", size = c("size3added", "size2added"), quiet = TRUE)

save(cypmodels2, file = "cypmodels2.Rdata")
load("cypmodels3.Rdata")
load("cypmodels2.Rdata")

We can also add individual or environmental covariates, by adding those terms to the call with the indcova, indcovb, and indcovc options. Let’s try both of these, for the historical and ahistorical models. However, note that in the historical set, we set suite = "main" in order to prevent the model selection protocol from giving an error in fecundity estimation. The reason for the error is that we have enough fixed terms that a zero-inflation model, in which two real models (the binomial model predicting zeros and the conditional model predicting all other numbers) are actually produced, will yield too many fixed factor combinations to proceed when interactions are allowed. This would not be the case if we did not include a zero-inflation model.

cypmodels3_env <- 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"),
  indcova = c("indcova3", "indcova2", "indcova1"), quiet = TRUE)

save(cypmodels3_env, file = "cypmodels3_env.Rdata")

cypmodels2_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 = "full", size = c("size3added", "size2added"),
  indcova = c("indcova3", "indcova2"), quiet = TRUE)

save(cypmodels2_env, file = "cypmodels2_env.Rdata")
load("cypmodels3_env.Rdata")
load("cypmodels2_env.Rdata")

summary(cypmodels3_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 ~ indcova1 + indcova2 + (1 | year2) + (1 | individ)
##    Data: subdata
##      AIC      BIC   logLik deviance df.resid 
##  82.4190 101.2606 -36.2095  72.4190      315 
## Random effects:
##  Groups  Name        Std.Dev.
##  individ (Intercept) 242.7   
##  year2   (Intercept)   0.0   
## Number of obs: 320, groups:  individ, 74; year2, 5
## Fixed Effects:
## (Intercept)     indcova1     indcova2  
##    274.3492      -0.9868      -1.3391  
## 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 ~ indcova2 + size2added + (1 | year2) + (1 | individ)
## Zero inflation:         ~size1added + size2added + (1 | year2) + (1 | individ)
## Data: subdata
##       AIC       BIC    logLik  df.resid 
##  244.2709  271.9777 -112.1355       108 
## Random-effects (co)variances:
## 
## Conditional model:
##  Groups  Name        Std.Dev.
##  year2   (Intercept) 0.2036  
##  individ (Intercept) 0.2139  
## 
## Zero-inflation model:
##  Groups  Name        Std.Dev. 
##  year2   (Intercept) 1.100e-04
##  individ (Intercept) 7.855e-05
## 
## Number of obs: 118 / Conditional model: year2, 5; individ, 51 / Zero-inflation model: year2, 5; individ, 51
## 
## Fixed Effects:
## 
## Conditional model:
## (Intercept)     indcova2   size2added  
##     1.70298     -0.02431      0.06259  
## 
## Zero-inflation model:
## (Intercept)   size1added   size2added  
##       5.181       -0.710       -1.637  
## 
## 
## 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: 55
## 
## Number of models in observation table: 64
## 
## Number of models in size table: 64
## 
## Number of models in secondary size table: 1
## 
## Number of models in tertiary size table: 1
## 
## Number of models in reproduction status table: 64
## 
## Number of models in fecundity table: 3582
## 
## 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.322.
## 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_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: 17
## 
## Number of models in observation table: 18
## 
## Number of models in size table: 18
## 
## Number of models in secondary size table: 1
## 
## Number of models in tertiary size table: 1
## 
## Number of models in reproduction status table: 18
## 
## Number of models in fecundity table: 309
## 
## 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.

Let’s now take a shot at setting up the Lathyrus models. These models will be used to develop ahistorical and historical IPMs. Although IPMs are typically ahistorical, we can create historical IPMs as well, and need to test historical terms for that purpose.

lathmodels2ipm <- modelsearch(lathvert_ipm, historical = FALSE, 
  approach = "mixed", suite = "size", 
  vitalrates = c("surv", "obs", "size", "fec"), juvestimate = "Sdl", 
  bestfit = "AICc&k", sizedist = "gaussian", fecdist = "negbin", 
  fec.zero = TRUE, indiv = "individ", year = "year2", year.as.random = TRUE, 
  juvsize = TRUE)

save(lathmodels2ipm, file = "lathmodels2ipm.Rdata")

lathmodels3ipm <- modelsearch(lathvert_ipm, historical = TRUE,
  approach = "mixed", suite = "size", 
  vitalrates = c("surv", "obs", "size", "fec"), juvestimate = "Sdl", 
  bestfit = "AICc&k", sizedist = "gaussian", fecdist = "negbin", 
  fec.zero = TRUE, indiv = "individ", year = "year2", year.as.random = TRUE, 
  juvsize = TRUE)

save(lathmodels3ipm, file = "lathmodels3ipm.Rdata")
load("lathmodels2ipm.Rdata")
load("lathmodels3ipm.Rdata")

Let’s now move on to create our first MPMs.

Step 3d. Importing vital rate models for IPMs and fbMPMs

Instead of building vital rate models within lefko3, we can also import vital rate models that have already been estimated via other means. The key caveat, in the current version of lefko3, is that the vital rate models need to be some variant of linear, generalized linear, or generalized linear mixed model. For this purpose, we will work with the Lathyrus dataset.

Let’s start off by building a skeleton vrm_input object. Note that we input only the years capable of being transitioned from in the dataset, which means the three years 1988, 1989, and 1990. We will make this object a bit bigger than before, because we will allow fecundity to be zero-inflated (setting zi = TRUE will add seven new columns governing the zero-inflation binomial model for all parameters capable of being zero-inflated). We will also set use.juv = TRUE to change some defaults to allow the use of juvenile transitions. Here is the code to produce our skeleton object.

lath_vrm <- vrm_import(years = c(1988:1990), zi = TRUE, dist.fec = "negbin",
  use.juv = TRUE)

lath_vrm
## $vrm_frame
##    main_effect_1                     main_1_defined surv obs sizea sizeb sizec
## 1      intercept                        y-intercept    0   0     0     0     0
## 2          size2                    sizea in time t    0   0     0     0     0
## 3          size1                  sizea in time t-1    0   0     0     0     0
## 4         sizeb2                    sizeb in time t    0   0     0     0     0
## 5         sizeb1                  sizeb in time t-1    0   0     0     0     0
## 6         sizec2                    sizec in time t    0   0     0     0     0
## 7         sizec1                  sizec in time t-1    0   0     0     0     0
## 8         repst2      reproductive status in time t    0   0     0     0     0
## 9         repst1    reproductive status in time t-1    0   0     0     0     0
## 10           age                      age in time t    0   0     0     0     0
## 11       density                  density in time t    0   0     0     0     0
## 12      indcova2   individual covariate a in time t    0   0     0     0     0
## 13      indcova1 individual covariate a in time t-1    0   0     0     0     0
## 14      indcovb2   individual covariate b in time t    0   0     0     0     0
## 15      indcovb1 individual covariate b in time t-1    0   0     0     0     0
## 16      indcovc2   individual covariate c in time t    0   0     0     0     0
## 17      indcovc1 individual covariate c in time t-1    0   0     0     0     0
##    repst fec jsurv jobs jsizea jsizeb jsizec jrepst jmatst sizea_zi sizeb_zi
## 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
## 12     0   0     0    0      0      0      0      0      0        0        0
## 13     0   0     0    0      0      0      0      0      0        0        0
## 14     0   0     0    0      0      0      0      0      0        0        0
## 15     0   0     0    0      0      0      0      0      0        0        0
## 16     0   0     0    0      0      0      0      0      0        0        0
## 17     0   0     0    0      0      0      0      0      0        0        0
##    sizec_zi fec_zi jsizea_zi jsizeb_zi jsizec_zi
## 1         0      0         0         0         0
## 2         0      0         0         0         0
## 3         0      0         0         0         0
## 4         0      0         0         0         0
## 5         0      0         0         0         0
## 6         0      0         0         0         0
## 7         0      0         0         0         0
## 8         0      0         0         0         0
## 9         0      0         0         0         0
## 10        0      0         0         0         0
## 11        0      0         0         0         0
## 12        0      0         0         0         0
## 13        0      0         0         0         0
## 14        0      0         0         0         0
## 15        0      0         0         0         0
## 16        0      0         0         0         0
## 17        0      0         0         0         0
## 
## $year_frame
##   years surv obs sizea sizeb sizec repst fec jsurv jobs jsizea jsizeb jsizec
## 1  1988    0   0     0     0     0     0   0     0    0      0      0      0
## 2  1989    0   0     0     0     0     0   0     0    0      0      0      0
## 3  1990    0   0     0     0     0     0   0     0    0      0      0      0
##   jrepst jmatst sizea_zi sizeb_zi sizec_zi fec_zi jsizea_zi jsizeb_zi jsizec_zi
## 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
## 
## $patch_frame
##   patches surv obs sizea sizeb sizec repst fec jsurv jobs jsizea jsizeb jsizec
## 1       1    0   0     0     0     0     0   0     0    0      0      0      0
##   jrepst jmatst sizea_zi sizeb_zi sizec_zi fec_zi jsizea_zi jsizeb_zi jsizec_zi
## 1      0      0        0        0        0      0         0         0         0
## 
## $group2_frame
##   groups surv obs sizea sizeb sizec repst fec jsurv jobs jsizea jsizeb jsizec
## 1      0    0   0     0     0     0     0   0     0    0      0      0      0
##   jrepst jmatst sizea_zi sizeb_zi sizec_zi fec_zi jsizea_zi jsizeb_zi jsizec_zi
## 1      0      0        0        0        0      0         0         0         0
## 
## $group1_frame
##   groups surv obs sizea sizeb sizec repst fec jsurv jobs jsizea jsizeb jsizec
## 1      0    0   0     0     0     0     0   0     0    0      0      0      0
##   jrepst jmatst sizea_zi sizeb_zi sizec_zi fec_zi jsizea_zi jsizeb_zi jsizec_zi
## 1      0      0        0        0        0      0         0         0         0
## 
## $dist_frame
##    response     dist
## 1      surv    binom
## 2       obs constant
## 3     sizea gaussian
## 4     sizeb constant
## 5     sizec constant
## 6     repst constant
## 7       fec   negbin
## 8     jsurv    binom
## 9      jobs constant
## 10   jsizea gaussian
## 11   jsizeb constant
## 12   jsizec constant
## 13   jrepst constant
## 14   jmatst constant
## 
## $st_frame
##   surv    obs  sizea  sizeb  sizec  repst    fec  jsurv   jobs jsizea jsizeb 
##      1      1      1      1      1      1      1      1      1      1      1 
## jsizec jrepst jmatst 
##      1      1      1 
## 
## attr(,"class")
## [1] "vrm_input"

Now that we have our skeleton vrm_input object, let’s take a look at the vital rate models. In a typical publication, the authors might present equations showing the linear relationships among terms. Alternatively, they may present some of the output from modeling, giving us the slope coefficients. Below, we see how the survival and sprouting models might be presented, using the real estimated terms.

\(logit(s(x_i, t)) = 2.32571 + 0.00109 size(t) + year(t) + indiv(i)\)

\(logit(r(x_j, t+1)) = 2.230 + year(t) + indiv(i)\)

In these models, we see that both are binomial models using the logit link. Both have y-intercepts (2.32571 in the case of survival, and 2.230 in the case of sprouting). The survival model involves a relationship with size in time t, and that relationship is linear with a slope of 0.00109. Both equations include categorical values for year in time t and individual, because both survival and sprouting probabilities were estimated as mixed models with year in time t and individual as random terms. Let’s input all of the main terms into our skeleton vrm_input object, particularly getting the y-intercepts and slope coefficients into the appropriate parts of the vrm_frame. Let’s also change the distribution of the sprouting model from constant (the current setting) to binom.

int.elem <- which(lath_vrm$vrm_frame$main_effect_1 == "intercept")
size2.elem <- which(lath_vrm$vrm_frame$main_effect_1 == "size2")

lath_vrm$vrm_frame$surv[int.elem] <- 2.32571
lath_vrm$vrm_frame$surv[size2.elem] <- 0.00109
lath_vrm$vrm_frame$obs[int.elem] <- 2.230
lath_vrm$dist_frame$dist[2] <- "binom"

lath_vrm$vrm_frame
##    main_effect_1                     main_1_defined    surv  obs sizea sizeb
## 1      intercept                        y-intercept 2.32571 2.23     0     0
## 2          size2                    sizea in time t 0.00109 0.00     0     0
## 3          size1                  sizea in time t-1 0.00000 0.00     0     0
## 4         sizeb2                    sizeb in time t 0.00000 0.00     0     0
## 5         sizeb1                  sizeb in time t-1 0.00000 0.00     0     0
## 6         sizec2                    sizec in time t 0.00000 0.00     0     0
## 7         sizec1                  sizec in time t-1 0.00000 0.00     0     0
## 8         repst2      reproductive status in time t 0.00000 0.00     0     0
## 9         repst1    reproductive status in time t-1 0.00000 0.00     0     0
## 10           age                      age in time t 0.00000 0.00     0     0
## 11       density                  density in time t 0.00000 0.00     0     0
## 12      indcova2   individual covariate a in time t 0.00000 0.00     0     0
## 13      indcova1 individual covariate a in time t-1 0.00000 0.00     0     0
## 14      indcovb2   individual covariate b in time t 0.00000 0.00     0     0
## 15      indcovb1 individual covariate b in time t-1 0.00000 0.00     0     0
## 16      indcovc2   individual covariate c in time t 0.00000 0.00     0     0
## 17      indcovc1 individual covariate c in time t-1 0.00000 0.00     0     0
##    sizec repst fec jsurv jobs jsizea jsizeb jsizec jrepst jmatst sizea_zi
## 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
## 12     0     0   0     0    0      0      0      0      0      0        0
## 13     0     0   0     0    0      0      0      0      0      0        0
## 14     0     0   0     0    0      0      0      0      0      0        0
## 15     0     0   0     0    0      0      0      0      0      0        0
## 16     0     0   0     0    0      0      0      0      0      0        0
## 17     0     0   0     0    0      0      0      0      0      0        0
##    sizeb_zi sizec_zi fec_zi jsizea_zi jsizeb_zi jsizec_zi
## 1         0        0      0         0         0         0
## 2         0        0      0         0         0         0
## 3         0        0      0         0         0         0
## 4         0        0      0         0         0         0
## 5         0        0      0         0         0         0
## 6         0        0      0         0         0         0
## 7         0        0      0         0         0         0
## 8         0        0      0         0         0         0
## 9         0        0      0         0         0         0
## 10        0        0      0         0         0         0
## 11        0        0      0         0         0         0
## 12        0        0      0         0         0         0
## 13        0        0      0         0         0         0
## 14        0        0      0         0         0         0
## 15        0        0      0         0         0         0
## 16        0        0      0         0         0         0
## 17        0        0      0         0         0         0
lath_vrm$dist_frame
##    response     dist
## 1      surv    binom
## 2       obs    binom
## 3     sizea gaussian
## 4     sizeb constant
## 5     sizec constant
## 6     repst constant
## 7       fec   negbin
## 8     jsurv    binom
## 9      jobs constant
## 10   jsizea gaussian
## 11   jsizeb constant
## 12   jsizec constant
## 13   jrepst constant
## 14   jmatst constant

We have added the fixed main effects to our survival and sprouting models. Next, we will add the appropriate year terms. Year is a random term in both cases, meaning that the average effect of year has actually already been absorbed by the y-intercept and the mean of the year terms should be approximately zero. So, if we cannot find these terms in the paper, then we can simply assume it is 0, or we can produce random numbers if we have information on the variance of the year term in the model. In our case, we see in the output for the survival and sprouting models in the IPM chapter that the standard deviation of the year term is 0, meaning that these coefficients were inestimable under the mixed structure used. So, we will skip adding these terms here. Because we are not interested in predicting individual survival probabilities, we will also not incorporate any individual terms.

Let’s move on to size. Our size model has a Gaussian response and so uses the identity link. Thus, our predicted size in time t+1 is given by the equation below.

\(E(size(x_j, t+1)) = 164.0695 + 0.6211 size(z_i, t) + year(t) + indiv(i)\)

The probability of becoming size j in time t+1 assuming a Gaussian distribution is the following.

\(g(x_j, x_i) = \frac{1}{\sqrt{2 \pi} \sigma(x_j)} e^{-E(size(x_j, t+1))}\)

Our size model includes year terms, which are 96.3244, -240.8036, and 144.4792 for years 1988, 1989, and 1990. We also see that \(\sigma = 503.6167\), which is shown as the standard deviation of the residual component in the random effects section of the model summary output. We will add these terms below. Note that primary size is set to the Gaussian distribution by default.

lath_vrm$vrm_frame$sizea[int.elem] <- 164.0695
lath_vrm$vrm_frame$sizea[size2.elem] <- 0.6211

lath_vrm$year_frame$sizea <- c(96.3244, -240.8036, 144.4792)
lath_vrm$st_frame[3] <- 503.6167

lath_vrm$vrm_frame
##    main_effect_1                     main_1_defined    surv  obs    sizea sizeb
## 1      intercept                        y-intercept 2.32571 2.23 164.0695     0
## 2          size2                    sizea in time t 0.00109 0.00   0.6211     0
## 3          size1                  sizea in time t-1 0.00000 0.00   0.0000     0
## 4         sizeb2                    sizeb in time t 0.00000 0.00   0.0000     0
## 5         sizeb1                  sizeb in time t-1 0.00000 0.00   0.0000     0
## 6         sizec2                    sizec in time t 0.00000 0.00   0.0000     0
## 7         sizec1                  sizec in time t-1 0.00000 0.00   0.0000     0
## 8         repst2      reproductive status in time t 0.00000 0.00   0.0000     0
## 9         repst1    reproductive status in time t-1 0.00000 0.00   0.0000     0
## 10           age                      age in time t 0.00000 0.00   0.0000     0
## 11       density                  density in time t 0.00000 0.00   0.0000     0
## 12      indcova2   individual covariate a in time t 0.00000 0.00   0.0000     0
## 13      indcova1 individual covariate a in time t-1 0.00000 0.00   0.0000     0
## 14      indcovb2   individual covariate b in time t 0.00000 0.00   0.0000     0
## 15      indcovb1 individual covariate b in time t-1 0.00000 0.00   0.0000     0
## 16      indcovc2   individual covariate c in time t 0.00000 0.00   0.0000     0
## 17      indcovc1 individual covariate c in time t-1 0.00000 0.00   0.0000     0
##    sizec repst fec jsurv jobs jsizea jsizeb jsizec jrepst jmatst sizea_zi
## 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
## 12     0     0   0     0    0      0      0      0      0      0        0
## 13     0     0   0     0    0      0      0      0      0      0        0
## 14     0     0   0     0    0      0      0      0      0      0        0
## 15     0     0   0     0    0      0      0      0      0      0        0
## 16     0     0   0     0    0      0      0      0      0      0        0
## 17     0     0   0     0    0      0      0      0      0      0        0
##    sizeb_zi sizec_zi fec_zi jsizea_zi jsizeb_zi jsizec_zi
## 1         0        0      0         0         0         0
## 2         0        0      0         0         0         0
## 3         0        0      0         0         0         0
## 4         0        0      0         0         0         0
## 5         0        0      0         0         0         0
## 6         0        0      0         0         0         0
## 7         0        0      0         0         0         0
## 8         0        0      0         0         0         0
## 9         0        0      0         0         0         0
## 10        0        0      0         0         0         0
## 11        0        0      0         0         0         0
## 12        0        0      0         0         0         0
## 13        0        0      0         0         0         0
## 14        0        0      0         0         0         0
## 15        0        0      0         0         0         0
## 16        0        0      0         0         0         0
## 17        0        0      0         0         0         0
lath_vrm$year_frame
##   years surv obs     sizea sizeb sizec repst fec jsurv jobs jsizea jsizeb
## 1  1988    0   0   96.3244     0     0     0   0     0    0      0      0
## 2  1989    0   0 -240.8036     0     0     0   0     0    0      0      0
## 3  1990    0   0  144.4792     0     0     0   0     0    0      0      0
##   jsizec jrepst jmatst sizea_zi sizeb_zi sizec_zi fec_zi jsizea_zi jsizeb_zi
## 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
##   jsizec_zi
## 1         0
## 2         0
## 3         0
lath_vrm$st_frame
##     surv      obs    sizea    sizeb    sizec    repst      fec    jsurv 
##   1.0000   1.0000 503.6167   1.0000   1.0000   1.0000   1.0000   1.0000 
##     jobs   jsizea   jsizeb   jsizec   jrepst   jmatst 
##   1.0000   1.0000   1.0000   1.0000   1.0000   1.0000

The next model to add is the fecundity model. This will be a zero-inflated negative binomial mixed model. Zero-inflation models are actually composed of two linear models - a binomial model governing the occurrence of zeros, and a second model with the target distribution covering all non-zeros (in this case, a negative binomial with a log link). So, we will need to parameterize both.

\(logit(f(x_i) = 0) = 6.252765 - 0.007313 size(t) + year(t) + indiv(i)\)

\(log(f(x_i) > 0) = 1.517 + year(t) + indiv(i)\)

The dispersion parameter for the negative binomial is \(\theta\), and we see in the IPM chapter that this is given as 0.2342114. The year terms for the zero-inflation binomial model are \(3.741475 \times 10^{-7}\), \(-7.804715 \times 10^{-8}\), and \(-2.533755 \times 10^{-7}\) for 1988, 1989, and 1990, respectively. The year terms for the conditional model (governing non-zero responses) are -0.41749627, 0.51421684, and -0.07964038, respectively. Let’s incorporate all of these values.

lath_vrm$vrm_frame$fec[int.elem] <- 1.517
lath_vrm$vrm_frame$fec_zi[int.elem] <- 6.252765
lath_vrm$vrm_frame$fec_zi[size2.elem] <- -0.007313

lath_vrm$year_frame$fec <- c(-0.41749627, 0.51421684, -0.07964038)
lath_vrm$year_frame$fec_zi <- c(3.741475e-07, -7.804715e-08, -2.533755e-07)

lath_vrm$st_frame[7] <- 0.2342114

lath_vrm
## $vrm_frame
##    main_effect_1                     main_1_defined    surv  obs    sizea sizeb
## 1      intercept                        y-intercept 2.32571 2.23 164.0695     0
## 2          size2                    sizea in time t 0.00109 0.00   0.6211     0
## 3          size1                  sizea in time t-1 0.00000 0.00   0.0000     0
## 4         sizeb2                    sizeb in time t 0.00000 0.00   0.0000     0
## 5         sizeb1                  sizeb in time t-1 0.00000 0.00   0.0000     0
## 6         sizec2                    sizec in time t 0.00000 0.00   0.0000     0
## 7         sizec1                  sizec in time t-1 0.00000 0.00   0.0000     0
## 8         repst2      reproductive status in time t 0.00000 0.00   0.0000     0
## 9         repst1    reproductive status in time t-1 0.00000 0.00   0.0000     0
## 10           age                      age in time t 0.00000 0.00   0.0000     0
## 11       density                  density in time t 0.00000 0.00   0.0000     0
## 12      indcova2   individual covariate a in time t 0.00000 0.00   0.0000     0
## 13      indcova1 individual covariate a in time t-1 0.00000 0.00   0.0000     0
## 14      indcovb2   individual covariate b in time t 0.00000 0.00   0.0000     0
## 15      indcovb1 individual covariate b in time t-1 0.00000 0.00   0.0000     0
## 16      indcovc2   individual covariate c in time t 0.00000 0.00   0.0000     0
## 17      indcovc1 individual covariate c in time t-1 0.00000 0.00   0.0000     0
##    sizec repst   fec jsurv jobs jsizea jsizeb jsizec jrepst jmatst sizea_zi
## 1      0     0 1.517     0    0      0      0      0      0      0        0
## 2      0     0 0.000     0    0      0      0      0      0      0        0
## 3      0     0 0.000     0    0      0      0      0      0      0        0
## 4      0     0 0.000     0    0      0      0      0      0      0        0
## 5      0     0 0.000     0    0      0      0      0      0      0        0
## 6      0     0 0.000     0    0      0      0      0      0      0        0
## 7      0     0 0.000     0    0      0      0      0      0      0        0
## 8      0     0 0.000     0    0      0      0      0      0      0        0
## 9      0     0 0.000     0    0      0      0      0      0      0        0
## 10     0     0 0.000     0    0      0      0      0      0      0        0
## 11     0     0 0.000     0    0      0      0      0      0      0        0
## 12     0     0 0.000     0    0      0      0      0      0      0        0
## 13     0     0 0.000     0    0      0      0      0      0      0        0
## 14     0     0 0.000     0    0      0      0      0      0      0        0
## 15     0     0 0.000     0    0      0      0      0      0      0        0
## 16     0     0 0.000     0    0      0      0      0      0      0        0
## 17     0     0 0.000     0    0      0      0      0      0      0        0
##    sizeb_zi sizec_zi    fec_zi jsizea_zi jsizeb_zi jsizec_zi
## 1         0        0  6.252765         0         0         0
## 2         0        0 -0.007313         0         0         0
## 3         0        0  0.000000         0         0         0
## 4         0        0  0.000000         0         0         0
## 5         0        0  0.000000         0         0         0
## 6         0        0  0.000000         0         0         0
## 7         0        0  0.000000         0         0         0
## 8         0        0  0.000000         0         0         0
## 9         0        0  0.000000         0         0         0
## 10        0        0  0.000000         0         0         0
## 11        0        0  0.000000         0         0         0
## 12        0        0  0.000000         0         0         0
## 13        0        0  0.000000         0         0         0
## 14        0        0  0.000000         0         0         0
## 15        0        0  0.000000         0         0         0
## 16        0        0  0.000000         0         0         0
## 17        0        0  0.000000         0         0         0
## 
## $year_frame
##   years surv obs     sizea sizeb sizec repst         fec jsurv jobs jsizea
## 1  1988    0   0   96.3244     0     0     0 -0.41749627     0    0      0
## 2  1989    0   0 -240.8036     0     0     0  0.51421684     0    0      0
## 3  1990    0   0  144.4792     0     0     0 -0.07964038     0    0      0
##   jsizeb jsizec jrepst jmatst sizea_zi sizeb_zi sizec_zi        fec_zi
## 1      0      0      0      0        0        0        0  3.741475e-07
## 2      0      0      0      0        0        0        0 -7.804715e-08
## 3      0      0      0      0        0        0        0 -2.533755e-07
##   jsizea_zi jsizeb_zi jsizec_zi
## 1         0         0         0
## 2         0         0         0
## 3         0         0         0
## 
## $patch_frame
##   patches surv obs sizea sizeb sizec repst fec jsurv jobs jsizea jsizeb jsizec
## 1       1    0   0     0     0     0     0   0     0    0      0      0      0
##   jrepst jmatst sizea_zi sizeb_zi sizec_zi fec_zi jsizea_zi jsizeb_zi jsizec_zi
## 1      0      0        0        0        0      0         0         0         0
## 
## $group2_frame
##   groups surv obs sizea sizeb sizec repst fec jsurv jobs jsizea jsizeb jsizec
## 1      0    0   0     0     0     0     0   0     0    0      0      0      0
##   jrepst jmatst sizea_zi sizeb_zi sizec_zi fec_zi jsizea_zi jsizeb_zi jsizec_zi
## 1      0      0        0        0        0      0         0         0         0
## 
## $group1_frame
##   groups surv obs sizea sizeb sizec repst fec jsurv jobs jsizea jsizeb jsizec
## 1      0    0   0     0     0     0     0   0     0    0      0      0      0
##   jrepst jmatst sizea_zi sizeb_zi sizec_zi fec_zi jsizea_zi jsizeb_zi jsizec_zi
## 1      0      0        0        0        0      0         0         0         0
## 
## $dist_frame
##    response     dist
## 1      surv    binom
## 2       obs    binom
## 3     sizea gaussian
## 4     sizeb constant
## 5     sizec constant
## 6     repst constant
## 7       fec   negbin
## 8     jsurv    binom
## 9      jobs constant
## 10   jsizea gaussian
## 11   jsizeb constant
## 12   jsizec constant
## 13   jrepst constant
## 14   jmatst constant
## 
## $st_frame
##        surv         obs       sizea       sizeb       sizec       repst 
##   1.0000000   1.0000000 503.6167000   1.0000000   1.0000000   1.0000000 
##         fec       jsurv        jobs      jsizea      jsizeb      jsizec 
##   0.2342114   1.0000000   1.0000000   1.0000000   1.0000000   1.0000000 
##      jrepst      jmatst 
##   1.0000000   1.0000000 
## 
## attr(,"class")
## [1] "vrm_input"

Next we will need to input the associated parameters for any other model included in the IPM. Particularly, we know that vital rate models were also estimated for seedlings, and that these models were incorporated as juvenile vital rate models. The juvenile vital rates include survival, sprouting, and size transition. The equations for these models are as follows.

\(logit(s_{juv}(x_i, t)) = 1.03 + year(t) + indiv(i)\)

\(logit(r_{juv}(x_j, t+1)) = 10.390 + year(t) + indiv(i)\)

\(E_{juv}(size(x_j, t+1)) = 3.0559 + 0.8482 size(t) + year(t) + indiv(i)\)

Together with the residual \(\sigma\) for the size model and year terms for sprouting and size, let’s add all of these terms to our vrm_input object.

lath_vrm$vrm_frame$jsurv[int.elem] <- 1.03
lath_vrm$vrm_frame$jobs[int.elem] <- 10.390
lath_vrm$vrm_frame$jsizea[int.elem] <- 3.0559
lath_vrm$vrm_frame$jsizea[size2.elem] <- 0.8482

lath_vrm$st_frame[10] <- 5.831

lath_vrm$year_frame$jobs <- c(-0.7459843, 0.6118826, -0.9468618)
lath_vrm$year_frame$jsizea <- c(0.5937962, 1.4551236, -2.0489198)

lath_vrm$dist_frame$dist[9] <- "binom"

lath_vrm
## $vrm_frame
##    main_effect_1                     main_1_defined    surv  obs    sizea sizeb
## 1      intercept                        y-intercept 2.32571 2.23 164.0695     0
## 2          size2                    sizea in time t 0.00109 0.00   0.6211     0
## 3          size1                  sizea in time t-1 0.00000 0.00   0.0000     0
## 4         sizeb2                    sizeb in time t 0.00000 0.00   0.0000     0
## 5         sizeb1                  sizeb in time t-1 0.00000 0.00   0.0000     0
## 6         sizec2                    sizec in time t 0.00000 0.00   0.0000     0
## 7         sizec1                  sizec in time t-1 0.00000 0.00   0.0000     0
## 8         repst2      reproductive status in time t 0.00000 0.00   0.0000     0
## 9         repst1    reproductive status in time t-1 0.00000 0.00   0.0000     0
## 10           age                      age in time t 0.00000 0.00   0.0000     0
## 11       density                  density in time t 0.00000 0.00   0.0000     0
## 12      indcova2   individual covariate a in time t 0.00000 0.00   0.0000     0
## 13      indcova1 individual covariate a in time t-1 0.00000 0.00   0.0000     0
## 14      indcovb2   individual covariate b in time t 0.00000 0.00   0.0000     0
## 15      indcovb1 individual covariate b in time t-1 0.00000 0.00   0.0000     0
## 16      indcovc2   individual covariate c in time t 0.00000 0.00   0.0000     0
## 17      indcovc1 individual covariate c in time t-1 0.00000 0.00   0.0000     0
##    sizec repst   fec jsurv  jobs jsizea jsizeb jsizec jrepst jmatst sizea_zi
## 1      0     0 1.517  1.03 10.39 3.0559      0      0      0      0        0
## 2      0     0 0.000  0.00  0.00 0.8482      0      0      0      0        0
## 3      0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 4      0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 5      0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 6      0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 7      0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 8      0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 9      0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 10     0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 11     0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 12     0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 13     0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 14     0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 15     0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 16     0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 17     0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
##    sizeb_zi sizec_zi    fec_zi jsizea_zi jsizeb_zi jsizec_zi
## 1         0        0  6.252765         0         0         0
## 2         0        0 -0.007313         0         0         0
## 3         0        0  0.000000         0         0         0
## 4         0        0  0.000000         0         0         0
## 5         0        0  0.000000         0         0         0
## 6         0        0  0.000000         0         0         0
## 7         0        0  0.000000         0         0         0
## 8         0        0  0.000000         0         0         0
## 9         0        0  0.000000         0         0         0
## 10        0        0  0.000000         0         0         0
## 11        0        0  0.000000         0         0         0
## 12        0        0  0.000000         0         0         0
## 13        0        0  0.000000         0         0         0
## 14        0        0  0.000000         0         0         0
## 15        0        0  0.000000         0         0         0
## 16        0        0  0.000000         0         0         0
## 17        0        0  0.000000         0         0         0
## 
## $year_frame
##   years surv obs     sizea sizeb sizec repst         fec jsurv       jobs
## 1  1988    0   0   96.3244     0     0     0 -0.41749627     0 -0.7459843
## 2  1989    0   0 -240.8036     0     0     0  0.51421684     0  0.6118826
## 3  1990    0   0  144.4792     0     0     0 -0.07964038     0 -0.9468618
##       jsizea jsizeb jsizec jrepst jmatst sizea_zi sizeb_zi sizec_zi
## 1  0.5937962      0      0      0      0        0        0        0
## 2  1.4551236      0      0      0      0        0        0        0
## 3 -2.0489198      0      0      0      0        0        0        0
##          fec_zi jsizea_zi jsizeb_zi jsizec_zi
## 1  3.741475e-07         0         0         0
## 2 -7.804715e-08         0         0         0
## 3 -2.533755e-07         0         0         0
## 
## $patch_frame
##   patches surv obs sizea sizeb sizec repst fec jsurv jobs jsizea jsizeb jsizec
## 1       1    0   0     0     0     0     0   0     0    0      0      0      0
##   jrepst jmatst sizea_zi sizeb_zi sizec_zi fec_zi jsizea_zi jsizeb_zi jsizec_zi
## 1      0      0        0        0        0      0         0         0         0
## 
## $group2_frame
##   groups surv obs sizea sizeb sizec repst fec jsurv jobs jsizea jsizeb jsizec
## 1      0    0   0     0     0     0     0   0     0    0      0      0      0
##   jrepst jmatst sizea_zi sizeb_zi sizec_zi fec_zi jsizea_zi jsizeb_zi jsizec_zi
## 1      0      0        0        0        0      0         0         0         0
## 
## $group1_frame
##   groups surv obs sizea sizeb sizec repst fec jsurv jobs jsizea jsizeb jsizec
## 1      0    0   0     0     0     0     0   0     0    0      0      0      0
##   jrepst jmatst sizea_zi sizeb_zi sizec_zi fec_zi jsizea_zi jsizeb_zi jsizec_zi
## 1      0      0        0        0        0      0         0         0         0
## 
## $dist_frame
##    response     dist
## 1      surv    binom
## 2       obs    binom
## 3     sizea gaussian
## 4     sizeb constant
## 5     sizec constant
## 6     repst constant
## 7       fec   negbin
## 8     jsurv    binom
## 9      jobs    binom
## 10   jsizea gaussian
## 11   jsizeb constant
## 12   jsizec constant
## 13   jrepst constant
## 14   jmatst constant
## 
## $st_frame
##        surv         obs       sizea       sizeb       sizec       repst 
##   1.0000000   1.0000000 503.6167000   1.0000000   1.0000000   1.0000000 
##         fec       jsurv        jobs      jsizea      jsizeb      jsizec 
##   0.2342114   1.0000000   1.0000000   5.8310000   1.0000000   1.0000000 
##      jrepst      jmatst 
##   1.0000000   1.0000000 
## 
## attr(,"class")
## [1] "vrm_input"

Voilà! Here, we have built a simple vrm_input object for use later in MPM building. We could also have created a more complex one, with interaction terms, individual covariates, etc.

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. Our exploration will include the development of both raw and function-based versions of ahistorical, historical, age-by-stage, and Leslie MPMs. We will also make IPMs.

Step 4a. Modeling the main MPMs

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       1      NA
## 2         2    P1           0.0              NA              NA       1      NA
## 3         3    P2           0.0              NA              NA       2      NA
## 4         4    P3           0.0              NA              NA       3      NA
## 5         5    SL           0.0              NA              NA       4      NA
## 6         6     D           0.0              NA              NA       5      NA
## 7         7   XSm           1.0              NA              NA       5      NA
## 8         8    Sm           3.0              NA              NA       6      NA
## 9         9    Md           6.0              NA              NA       6      NA
## 10       10    Lg          11.0              NA              NA       6      NA
## 11       11   XLg          19.5              NA              NA       6      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 6. 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

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 70 fecundity transitions were estimated, with 5.833 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 38 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

Continuing with the styles of MPM, we might next wish to create a Leslie MPM. Age-based MPMs are inherently ahistorical, and do not require stageframes since only the ages to be modeled and whether life can continue past the final age need to be specified.

cypleslie_r <- rleslie(cypraw_v1, fecage_min = 5, yearcol = "year2",
  indivcol = "individ")

summary(cypleslie_r)
## 
## This ahistorical lefkoMat object contains 4 matrices.
## 
## Each matrix is square with 10 rows and columns, and a total of 100 elements.
## A total of 11 survival transitions were estimated, with 2.75 per matrix.
## A total of 7 fecundity transitions were estimated, with 1.75 per matrix.
## This lefkoMat object covers 1 population, 1 patch, 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]
## Min.    0.000 0.000 0.000 0.000
## 1st Qu. 0.000 0.000 0.000 0.000
## Median  0.000 0.000 0.000 0.000
## Mean    0.170 0.163 0.292 0.346
## 3rd Qu. 0.000 0.000 0.686 0.847
## Max.    0.953 0.967 1.000 1.000

Let’s take a peek at the first matrix.

cypleslie_r$A[[1]]
##       [,1] [,2] [,3] [,4] [,5]     [,6] [,7] [,8] [,9] [,10]
##  [1,]    0    0    0    0 0.00 0.687500    0    0    0     0
##  [2,]    0    0    0    0 0.00 0.000000    0    0    0     0
##  [3,]    0    0    0    0 0.00 0.000000    0    0    0     0
##  [4,]    0    0    0    0 0.00 0.000000    0    0    0     0
##  [5,]    0    0    0    0 0.00 0.000000    0    0    0     0
##  [6,]    0    0    0    0 0.75 0.000000    0    0    0     0
##  [7,]    0    0    0    0 0.00 0.953125    0    0    0     0
##  [8,]    0    0    0    0 0.00 0.000000    0    0    0     0
##  [9,]    0    0    0    0 0.00 0.000000    0    0    0     0
## [10,]    0    0    0    0 0.00 0.000000    0    0    0     0

Here we have a problem because we have not incorporated supplemental information into the matrix construction. So, we do not have the first few years of survival, and we do not have any fecundity multipliers included. There is currently no way to incorporate supplemental info in the main matrix construction calls for Leslie MPMs in lefko3, so we will do so manually. This turns out to be relatively simple, and can be done using for loops.

for (i in c(1:length(cypleslie_r$A))) {
  cypleslie_r$U[[i]][2, 1] <- 0.1
  cypleslie_r$U[[i]][3, 2] <- 0.1
  cypleslie_r$U[[i]][4, 3] <- 0.1
  cypleslie_r$U[[i]][5, 4] <- cypleslie_r$U[[i]][6, 5]
  
  cypleslie_r$F[[i]][1, 6] <- cypleslie_r$F[[i]][1, 6] * seeds_per_pod * 0.15
  cypleslie_r$F[[i]][1, 7] <- cypleslie_r$F[[i]][1, 7] * seeds_per_pod * 0.15
  cypleslie_r$F[[i]][1, 8] <- cypleslie_r$F[[i]][1, 8] * seeds_per_pod * 0.15
  cypleslie_r$F[[i]][1, 9] <- cypleslie_r$F[[i]][1, 9] * seeds_per_pod * 0.15
  cypleslie_r$F[[i]][1, 10] <- cypleslie_r$F[[i]][1, 10] * seeds_per_pod * 0.15
  
  cypleslie_r$A[[i]] <- cypleslie_r$U[[i]] + cypleslie_r$F[[i]]
}

cypleslie_r$A[[1]]
##       [,1] [,2] [,3] [,4] [,5]       [,6] [,7] [,8] [,9] [,10]
##  [1,]  0.0  0.0  0.0 0.00 0.00 515.625000    0    0    0     0
##  [2,]  0.1  0.0  0.0 0.00 0.00   0.000000    0    0    0     0
##  [3,]  0.0  0.1  0.0 0.00 0.00   0.000000    0    0    0     0
##  [4,]  0.0  0.0  0.1 0.00 0.00   0.000000    0    0    0     0
##  [5,]  0.0  0.0  0.0 0.75 0.00   0.000000    0    0    0     0
##  [6,]  0.0  0.0  0.0 0.00 0.75   0.000000    0    0    0     0
##  [7,]  0.0  0.0  0.0 0.00 0.00   0.953125    0    0    0     0
##  [8,]  0.0  0.0  0.0 0.00 0.00   0.000000    0    0    0     0
##  [9,]  0.0  0.0  0.0 0.00 0.00   0.000000    0    0    0     0
## [10,]  0.0  0.0  0.0 0.00 0.00   0.000000    0    0    0     0

Now let’s take a look at a summary.

summary(cypleslie_r)
## 
## This ahistorical lefkoMat object contains 4 matrices.
## 
## Each matrix is square with 10 rows and columns, and a total of 100 elements.
## A total of 11 survival transitions were estimated, with 2.75 per matrix.
## A total of 7 fecundity transitions were estimated, with 1.75 per matrix.
## This lefkoMat object covers 1 population, 1 patch, 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]
## Min.    0.000 0.000 0.000 0.000
## 1st Qu. 0.000 0.000 0.025 0.100
## Median  0.100 0.050 0.100 0.300
## Mean    0.275 0.193 0.422 0.426
## 3rd Qu. 0.588 0.100 0.979 0.847
## Max.    0.953 0.967 1.000 1.000

Finally, before we head to function-based MPMs and IPMs, we might wish to construct an age-by-stage MPM. These are large matrices, and so require more data to parameterize properly, but we will give it a shot anyway. Note that we will use the stages option, using the stageframe in this context, where non-reproductive individuals are still treated as reproductive, may yield errors otherwise.

cypagestage_r <- arlefko2(cypraw_v1, cypframe_raw, indivcol = "individ",
  yearcol = "year2", size = c("size3added", "size2added", "size1added"),
  stages = c("stage3", "stage2", "stage1"), supplement = cypsupp2_raw)

summary(cypagestage_r)
## 
## This ahistorical lefkoMat object contains 5 matrices.
## 
## Each matrix is square with 99 rows and columns, and a total of 9801 elements.
## A total of 313 survival transitions were estimated, with 62.6 per matrix.
## A total of 38 fecundity transitions were estimated, with 7.6 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.0000 0.00 0.000 0.000 0.0000
## 1st Qu. 0.0000 0.00 0.000 0.000 0.0000
## Median  0.0000 0.00 0.000 0.000 0.0000
## Mean    0.0603 0.12 0.119 0.127 0.0908
## 3rd Qu. 0.1000 0.10 0.100 0.100 0.1000
## Max.    0.9565 1.00 1.000 1.050 1.0500
## Warning: Some matrices include stages with survival probability greater than
## 1.0.

As before, we have an issue with some survival probabilities greater than 1.0. This is caused by our supplemental info, and ideally we should fix this prior to using this matrix in an analysis. For now, however, we will push ahead to other MPMs.

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 as in the raw ahistorical MPM, 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 stages 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.936 0.964 0.963 0.959 0.951 0.925 0.962 0.952 0.945 0.935 0.903 0.953
## Median  0.988 0.997 0.996 0.994 0.992 0.979 0.995 0.992 0.990 0.986 0.969 0.993
## Mean    0.809 0.818 0.816 0.815 0.813 0.801 0.816 0.813 0.811 0.807 0.794 0.813
## 3rd Qu. 0.994 0.999 0.999 0.998 0.997 0.988 0.998 0.997 0.995 0.993 0.982 0.997
## Max.    1.000 1.000 1.000 1.000 1.000 1.000 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.938 0.935 0.925
## Median  0.988 0.985 0.979
## Mean    0.810 0.807 0.801
## 3rd Qu. 0.994 0.992 0.989
## Max.    1.000 1.000 1.000

Let’s note the contrasts with the other MPMs in the output above. First, we see 15 matrices produced again. However, we created 3 matrices fewer in the raw historical MPM, because 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 for which we can estimate transitions.

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       1      NA
## 2         2    P1           0.0              NA              NA       1      NA
## 3         3    P2           0.0              NA              NA       2      NA
## 4         4    P3           0.0              NA              NA       3      NA
## 5         5    SL           0.0              NA              NA       4      NA
## 6         6     D           0.0              NA              NA       5      NA
## 7         7   XSm           1.0              NA              NA       5      NA
## 8         8    Sm           3.0              NA              NA       6      NA
## 9         9    Md           6.0              NA              NA       6      NA
## 10       10    Lg          11.0              NA              NA       6      NA
## 11       11   XLg          19.5              NA              NA       6      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.957 0.941 0.933 0.941
## Median  0.993 0.988 0.982 0.988
## Mean    0.814 0.810 0.805 0.810
## 3rd Qu. 0.997 0.994 0.991 0.994
## Max.    1.000 1.000 1.000 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. Note that these matrices will be different than the mean matrices produced earlier, because the latter were created by taking unweighted arithmetic means of matrix elements across patches. The MPMs we will create now will not separate individuals by patch, and so larger patches may have a greater influence on the resulting matrices.

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 = cypmodels2_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 = cypmodels2_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

Now let’s move on to creating function-based Leslie MPMs. Here, we will use the Cypripedium data to do that, and then take a look at the first survival-transition and fecundity matrices.

cypleslie_f <- fleslie(data = cypfb_v1, modelsuite = cypmodels2p_age, start_age = 0,
  fecage_min = 5)

cypleslie_f$U[[1]]
##            [,1]      [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
##  [1,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
##  [2,] 0.9764238 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
##  [3,] 0.0000000 0.9764238 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
##  [4,] 0.0000000 0.0000000 0.9764238 0.0000000 0.0000000 0.0000000 0.0000000
##  [5,] 0.0000000 0.0000000 0.0000000 0.9764238 0.0000000 0.0000000 0.0000000
##  [6,] 0.0000000 0.0000000 0.0000000 0.0000000 0.9764238 0.0000000 0.0000000
##  [7,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.9764238 0.0000000
##  [8,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.9764238
##  [9,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
## [10,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
## [11,] 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
##            [,8]      [,9]     [,10]     [,11]
##  [1,] 0.0000000 0.0000000 0.0000000 0.0000000
##  [2,] 0.0000000 0.0000000 0.0000000 0.0000000
##  [3,] 0.0000000 0.0000000 0.0000000 0.0000000
##  [4,] 0.0000000 0.0000000 0.0000000 0.0000000
##  [5,] 0.0000000 0.0000000 0.0000000 0.0000000
##  [6,] 0.0000000 0.0000000 0.0000000 0.0000000
##  [7,] 0.0000000 0.0000000 0.0000000 0.0000000
##  [8,] 0.0000000 0.0000000 0.0000000 0.0000000
##  [9,] 0.9764238 0.0000000 0.0000000 0.0000000
## [10,] 0.0000000 0.9764238 0.0000000 0.0000000
## [11,] 0.0000000 0.0000000 0.9764238 0.9764238
cypleslie_f$F[[1]]
##       [,1] [,2] [,3] [,4] [,5]      [,6]      [,7]      [,8]      [,9]
##  [1,]    0    0    0    0    0 0.9060239 0.9111521 0.9160264 0.9206566
##  [2,]    0    0    0    0    0 0.0000000 0.0000000 0.0000000 0.0000000
##  [3,]    0    0    0    0    0 0.0000000 0.0000000 0.0000000 0.0000000
##  [4,]    0    0    0    0    0 0.0000000 0.0000000 0.0000000 0.0000000
##  [5,]    0    0    0    0    0 0.0000000 0.0000000 0.0000000 0.0000000
##  [6,]    0    0    0    0    0 0.0000000 0.0000000 0.0000000 0.0000000
##  [7,]    0    0    0    0    0 0.0000000 0.0000000 0.0000000 0.0000000
##  [8,]    0    0    0    0    0 0.0000000 0.0000000 0.0000000 0.0000000
##  [9,]    0    0    0    0    0 0.0000000 0.0000000 0.0000000 0.0000000
## [10,]    0    0    0    0    0 0.0000000 0.0000000 0.0000000 0.0000000
## [11,]    0    0    0    0    0 0.0000000 0.0000000 0.0000000 0.0000000
##           [,10]     [,11]
##  [1,] 0.9250524 0.9292234
##  [2,] 0.0000000 0.0000000
##  [3,] 0.0000000 0.0000000
##  [4,] 0.0000000 0.0000000
##  [5,] 0.0000000 0.0000000
##  [6,] 0.0000000 0.0000000
##  [7,] 0.0000000 0.0000000
##  [8,] 0.0000000 0.0000000
##  [9,] 0.0000000 0.0000000
## [10,] 0.0000000 0.0000000
## [11,] 0.0000000 0.0000000

As before, we do not have a means of incorporating supplemental information into the Leslie MPM estimation process yet, so we do so manually. One easy approach is with a simple loop. Let’s do that, and take a look at the first matrix.

for (i in c(1:length(cypleslie_f$A))) {
  cypleslie_f$U[[i]][2, 1] <- 0.1
  cypleslie_f$U[[i]][3, 2] <- 0.1
  cypleslie_f$U[[i]][4, 3] <- 0.1
  
  cypleslie_f$F[[i]][1, 6] <- cypleslie_f$F[[i]][1, 6] * seeds_per_pod * 0.15
  cypleslie_f$F[[i]][1, 7] <- cypleslie_f$F[[i]][1, 7] * seeds_per_pod * 0.15
  cypleslie_f$F[[i]][1, 8] <- cypleslie_f$F[[i]][1, 8] * seeds_per_pod * 0.15
  cypleslie_f$F[[i]][1, 9] <- cypleslie_f$F[[i]][1, 9] * seeds_per_pod * 0.15
  cypleslie_f$F[[i]][1, 10] <- cypleslie_f$F[[i]][1, 10] * seeds_per_pod * 0.15
  
  cypleslie_f$A[[i]] <- cypleslie_f$U[[i]] + cypleslie_f$F[[i]]
}

cypleslie_f$A[[1]]
##       [,1] [,2] [,3]      [,4]      [,5]        [,6]        [,7]        [,8]
##  [1,]  0.0  0.0  0.0 0.0000000 0.0000000 679.5178919 683.3640702 687.0198170
##  [2,]  0.1  0.0  0.0 0.0000000 0.0000000   0.0000000   0.0000000   0.0000000
##  [3,]  0.0  0.1  0.0 0.0000000 0.0000000   0.0000000   0.0000000   0.0000000
##  [4,]  0.0  0.0  0.1 0.0000000 0.0000000   0.0000000   0.0000000   0.0000000
##  [5,]  0.0  0.0  0.0 0.9764238 0.0000000   0.0000000   0.0000000   0.0000000
##  [6,]  0.0  0.0  0.0 0.0000000 0.9764238   0.0000000   0.0000000   0.0000000
##  [7,]  0.0  0.0  0.0 0.0000000 0.0000000   0.9764238   0.0000000   0.0000000
##  [8,]  0.0  0.0  0.0 0.0000000 0.0000000   0.0000000   0.9764238   0.0000000
##  [9,]  0.0  0.0  0.0 0.0000000 0.0000000   0.0000000   0.0000000   0.9764238
## [10,]  0.0  0.0  0.0 0.0000000 0.0000000   0.0000000   0.0000000   0.0000000
## [11,]  0.0  0.0  0.0 0.0000000 0.0000000   0.0000000   0.0000000   0.0000000
##              [,9]       [,10]     [,11]
##  [1,] 690.4924689 693.7893093 0.9292234
##  [2,]   0.0000000   0.0000000 0.0000000
##  [3,]   0.0000000   0.0000000 0.0000000
##  [4,]   0.0000000   0.0000000 0.0000000
##  [5,]   0.0000000   0.0000000 0.0000000
##  [6,]   0.0000000   0.0000000 0.0000000
##  [7,]   0.0000000   0.0000000 0.0000000
##  [8,]   0.0000000   0.0000000 0.0000000
##  [9,]   0.0000000   0.0000000 0.0000000
## [10,]   0.9764238   0.0000000 0.0000000
## [11,]   0.0000000   0.9764238 0.9764238

We can also take a peek at a summary.

summary(cypleslie_f)
## 
## 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 165 survival transitions were estimated, with 11 per matrix.
## A total of 90 fecundity transitions were estimated, with 6 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 probability not estimated.
## Primary size transition not estimated.
## Secondary size transition not estimated.
## Tertiary size transition not estimated.
## Reproduction probability not estimated.
## Fecundity estimated with 74 individuals and 320 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.538 0.538 0.538 0.538 0.538 0.538 0.538 0.538 0.538 0.538 0.538 0.538
## Median  0.976 0.976 0.976 0.976 0.976 0.976 0.976 0.976 0.976 0.976 0.976 0.976
## Mean    0.737 0.737 0.737 0.737 0.737 0.737 0.737 0.737 0.737 0.737 0.737 0.737
## 3rd Qu. 0.976 0.976 0.976 0.976 0.976 0.976 0.976 0.976 0.976 0.976 0.976 0.976
## Max.    0.976 0.976 0.976 0.976 0.976 0.976 0.976 0.976 0.976 0.976 0.976 0.976
##         [,13] [,14] [,15]
## Min.    0.100 0.100 0.100
## 1st Qu. 0.538 0.538 0.538
## Median  0.976 0.976 0.976
## Mean    0.737 0.737 0.737
## 3rd Qu. 0.976 0.976 0.976
## Max.    0.976 0.976 0.976

Now let’s try a function-based age-by-stage MPM.

cypagestage_f <- aflefko2(stageframe = cypframe_fb, supplement = cypsupp2_fb,
  data = cypfb_v1, modelsuite = cypmodels2p_agestage)

summary(cypagestage_f)
## 
## This ahistorical lefkoMat object contains 15 matrices.
## 
## Each matrix is square with 486 rows and columns, and a total of 236196 elements.
## A total of 146475 survival transitions were estimated, with 9765 per matrix.
## A total of 2880 fecundity transitions were estimated, with 192 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.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
## Median  0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
## Mean    0.417 0.418 0.418 0.418 0.416 0.417 0.418 0.418 0.418 0.416 0.416 0.418
## 3rd Qu. 0.999 1.000 1.000 1.000 0.999 0.998 0.999 0.999 0.999 0.998 0.997 0.999
## 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.000 0.000 0.000
## Median  0.000 0.000 0.000
## Mean    0.417 0.417 0.415
## 3rd Qu. 0.998 0.998 0.997
## Max.    1.000 0.999 0.999

These are very large matrices, and are quite sparse. However, all estimable elements have been estimated.

Now let’s finally turn our attention to IPMs. Let’s build a standard, ahistorical IPM for Lathyrus, as below.

lathmat2_ipm <- flefko2(stageframe = lathframe_ipm, modelsuite = lathmodels2ipm,
  data = lathvert_ipm, supplement = lathsupp2)

summary(lathmat2_ipm)
## 
## This ahistorical lefkoMat object contains 3 matrices.
## 
## Each matrix is square with 103 rows and columns, and a total of 10609 elements.
## A total of 26947 survival transitions were estimated, with 8982.333 per matrix.
## A total of 600 fecundity transitions were estimated, with 200 per matrix.
## This lefkoMat object covers 1 population, 1 patch, and 3 time steps.
## 
## Vital rate modeling quality control:
## 
## Survival estimated with 931 individuals and 2246 individual transitions.
## Observation estimated with 858 individuals and 2121 individual transitions.
## Primary size estimated with 845 individuals and 1916 individual transitions.
## Secondary size transition not estimated.
## Tertiary size transition not estimated.
## Reproduction probability not estimated.
## Fecundity estimated with 931 individuals and 2246 individual transitions.
## Juvenile survival estimated with 281 individuals and 281 individual transitions.
## Juvenile observation estimated with 210 individuals and 210 individual transitions.
## Juvenile primary size estimated with 193 individuals and 193 individual transitions.
## 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]
## Min.    0.000 0.000 0.000
## 1st Qu. 0.994 0.970 0.996
## Median  1.000 1.000 1.000
## Mean    0.961 0.929 0.965
## 3rd Qu. 1.000 1.000 1.000
## Max.    1.000 1.000 1.000

This discretized IPM is composed of rather large, very dense matrices. Indeed, we see the matrices are composed of 10,609 elements each, and on average 8982.3 (84.7%) are estimated as non-zero. If interested, we can build historical IPMs as well, which will be far larger and very sparse, as below.

lathmat3_ipm <- flefko3(stageframe = lathframe_ipm, modelsuite = lathmodels3ipm,
  data = lathvert_ipm, supplement = lathsupp3)

summary(lathmat3_ipm)
## 
## This historical lefkoMat object contains 3 matrices.
## 
## Each matrix is square with 10609 rows and columns, and a total of 112550881 elements.
## A total of 2684709 survival transitions were estimated, with 894903 per matrix.
## A total of 60600 fecundity transitions were estimated, with 20200 per matrix.
## This lefkoMat object covers 1 population, 1 patch, and 3 time steps.
## 
## Vital rate modeling quality control:
## 
## Survival estimated with 931 individuals and 2246 individual transitions.
## Observation estimated with 858 individuals and 2121 individual transitions.
## Primary size estimated with 845 individuals and 1916 individual transitions.
## Secondary size transition not estimated.
## Tertiary size transition not estimated.
## Reproduction probability not estimated.
## Fecundity estimated with 931 individuals and 2246 individual transitions.
## Juvenile survival estimated with 281 individuals and 281 individual transitions.
## Juvenile observation estimated with 210 individuals and 210 individual transitions.
## Juvenile primary size estimated with 193 individuals and 193 individual transitions.
## 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]
## Min.    0.000 0.000 0.000
## 1st Qu. 0.993 0.986 0.992
## Median  0.998 0.998 0.998
## Mean    0.958 0.947 0.957
## 3rd Qu. 0.999 0.999 0.999
## Max.    1.000 1.000 1.000

The resulting set of matrices is utterly huge - 10,609 rows and 10,609 columns, yielding 112,550,881 elements per matrix for three matrices. Although many more elements are estimated than in the ahistorical case, the increase in elements is overwhelmingly in zero elements, with only 0.8% of elements estimated as non-zero. This fact makes these matrices especially sparse, with greater and greater sparseness as the number of stages increases.

Our newest historical IPM in particular takes up a lot of memory. To prevent exhausting the available RAM for further analysis, we will remove this object now.

rm("lathmat3_ipm")

Let’s now go on to look at a few issues in modeling MPMs and IPMs.

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 an extra set 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)

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

Now let’s compare the new MPM to the correct MPM.

summary(cypmatrix2f)
## 
## 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.991 0.991 0.991 0.991 0.991
## Median  1.000 1.000 1.000 1.000 1.000
## Mean    0.917 0.920 0.919 0.919 0.916
## 3rd Qu. 1.000 1.000 1.000 1.000 1.000
## Max.    1.000 1.000 1.000 1.000 1.000
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

We see a number of issues arising from the new choice in distribution. First, the distribution of transition probabilities is lower, leading to lower mean and maximum survival column sums. Second, because of the former issue, a few more elements are estimated as zero. 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.994 0.997 0.997 0.996 0.994
## Median  0.998 1.000 0.999 0.999 0.998
## Mean    0.971 0.972 0.971 0.971 0.971
## 3rd Qu. 0.999 1.000 1.000 0.999 0.999
## 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  0.998 0.999 0.999 0.998 0.998
## Mean    0.818 0.819 0.819 0.819 0.818
## 3rd Qu. 0.999 1.000 1.000 0.999 0.999
## 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 de 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. de 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.964 0.965 0.965 0.965 0.964
## Median  0.997 0.999 0.999 0.998 0.998
## Mean    0.801 0.802 0.802 0.802 0.801
## 3rd Qu. 0.999 1.000 1.000 0.999 0.999
## 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  0.998 0.999 0.999 0.998 0.998
## Mean    0.818 0.819 0.819 0.819 0.818
## 3rd Qu. 0.999 1.000 1.000 0.999 0.999
## 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 in the prior position. 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 ~ repstatus1 + repstatus2 + size1added + size2added +  
##     (1 | year2) + (1 | individ) + repstatus2:size1added
## Data: subdata
##        AIC        BIC     logLik   df.resid 
## -15046.078 -15013.112   7532.039        279 
## Random-effects (co)variances:
## 
## Conditional model:
##  Groups  Name        Std.Dev.
##  year2   (Intercept) 0.1247  
##  individ (Intercept) 0.9368  
## 
## Number of obs: 288 / Conditional model: year2, 5; individ, 70
## 
## Dispersion parameter for truncated_nbinom2 family (): 4.81e+15 
## 
## Fixed Effects:
## 
## Conditional model:
##           (Intercept)             repstatus1             repstatus2  
##               0.46241                0.05328                0.13092  
##            size1added             size2added  repstatus2:size1added  
##               0.01237                0.02458               -0.02016  
## 
## 
## 
## 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: 113
## 
## Number of models in observation table: 113
## 
## Number of models in size table: 113
## 
## Number of models in secondary size table: 1
## 
## Number of models in tertiary size table: 1
## 
## Number of models in reproduction status table: 113
## 
## Number of models in fecundity table: 12437
## 
## 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.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 4c. Importing IPMs and fbMPMs

In step 3c, we imported vital rate models for use in creating a Lathyrus MPM. At this point, we have created all of our main IPM vital rate model inputs. However, there are still a few missing pieces that we need to fit in order to create the IPM properly. Our next step is to include instructions that tell lefko3 how the vital rate models fit together. Let’s see how this works.

By default, elements in survival-transition matrices created by functions flefko2(), flefko3(), aflefko2(), and fleslie() are estimated via the following two kernels, the first for adults and the second for juveniles.

\(e_{j, i} = surv_{kernel} obs_{kernel} sizea_{kernel} sizeb_{kernel} sizec_{kernel} repr_{kernel}\)

\(e_{j, i} = jsurv_{kernel} jobs_{kernel} jsizea_{kernel} jsizeb_{kernel} jsizec_{kernel} jrepr_{kernel} jmatst_{kernel}\)

Here, \(e_{j, i}\) refers to the element at the jth row and the ith column. The terms to the right of the equal sign refer to the values developed by kernels representing different vital rates. So, \(surv_{kernel}\) is the kernel developing the probability of survival, \(obs_{kernel}\) is the kernel developing the probability of observation (or its complement), \(sizea_{kernel}\) is the probability of size transition in the primary size variable, \(sizeb_{kernel}\) is the probability of size transition in the secondary size variable, \(sizec_{kernel}\) is the probability of size transition in the tertiary size variable, and \(repst_{kernel}\) is the probability of becoming reproductive or its complement. The juvenile kernel is composed of similar vital rate kernels, but also includes \(jmatst_{kernel}\), which is the probability of becoming mature or its complement.

Package lefko3 uses the vital rate kernels above to produce values in essentially all cases, and so vital rate kernel values can shift to a constant value of \(1\) if a vital rate is not used. There are also circumstances in which vital rates may be fixed to 0 or even other constants, though these are relatively rare (this may occur is a juvenile size class is not utilized, because then juvenile vital rates should generally equal zero during matrix creation). The key is to fix unused vital rates to constant values of \(1\). We do this by changing the y-intercept of unused vital rate models to exactly 1, and changing the distribution listed for the vital rate in dist_frame as constant. Note that we do not need to bother doing this with zero-inflation components of unused vital rates. In our case, all unused vital rate models are already set to constant, so we will just change the intercepts to 1.

lath_vrm$vrm_frame$sizeb[1] <- 1
lath_vrm$vrm_frame$sizec[1] <- 1
lath_vrm$vrm_frame$repst[1] <- 1

lath_vrm$vrm_frame$jsizeb[1] <- 1
lath_vrm$vrm_frame$jsizec[1] <- 1
lath_vrm$vrm_frame$jrepst[1] <- 1
lath_vrm$vrm_frame$jmatst[1] <- 1

lath_vrm
## $vrm_frame
##    main_effect_1                     main_1_defined    surv  obs    sizea sizeb
## 1      intercept                        y-intercept 2.32571 2.23 164.0695     1
## 2          size2                    sizea in time t 0.00109 0.00   0.6211     0
## 3          size1                  sizea in time t-1 0.00000 0.00   0.0000     0
## 4         sizeb2                    sizeb in time t 0.00000 0.00   0.0000     0
## 5         sizeb1                  sizeb in time t-1 0.00000 0.00   0.0000     0
## 6         sizec2                    sizec in time t 0.00000 0.00   0.0000     0
## 7         sizec1                  sizec in time t-1 0.00000 0.00   0.0000     0
## 8         repst2      reproductive status in time t 0.00000 0.00   0.0000     0
## 9         repst1    reproductive status in time t-1 0.00000 0.00   0.0000     0
## 10           age                      age in time t 0.00000 0.00   0.0000     0
## 11       density                  density in time t 0.00000 0.00   0.0000     0
## 12      indcova2   individual covariate a in time t 0.00000 0.00   0.0000     0
## 13      indcova1 individual covariate a in time t-1 0.00000 0.00   0.0000     0
## 14      indcovb2   individual covariate b in time t 0.00000 0.00   0.0000     0
## 15      indcovb1 individual covariate b in time t-1 0.00000 0.00   0.0000     0
## 16      indcovc2   individual covariate c in time t 0.00000 0.00   0.0000     0
## 17      indcovc1 individual covariate c in time t-1 0.00000 0.00   0.0000     0
##    sizec repst   fec jsurv  jobs jsizea jsizeb jsizec jrepst jmatst sizea_zi
## 1      1     1 1.517  1.03 10.39 3.0559      1      1      1      1        0
## 2      0     0 0.000  0.00  0.00 0.8482      0      0      0      0        0
## 3      0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 4      0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 5      0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 6      0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 7      0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 8      0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 9      0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 10     0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 11     0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 12     0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 13     0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 14     0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 15     0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 16     0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
## 17     0     0 0.000  0.00  0.00 0.0000      0      0      0      0        0
##    sizeb_zi sizec_zi    fec_zi jsizea_zi jsizeb_zi jsizec_zi
## 1         0        0  6.252765         0         0         0
## 2         0        0 -0.007313         0         0         0
## 3         0        0  0.000000         0         0         0
## 4         0        0  0.000000         0         0         0
## 5         0        0  0.000000         0         0         0
## 6         0        0  0.000000         0         0         0
## 7         0        0  0.000000         0         0         0
## 8         0        0  0.000000         0         0         0
## 9         0        0  0.000000         0         0         0
## 10        0        0  0.000000         0         0         0
## 11        0        0  0.000000         0         0         0
## 12        0        0  0.000000         0         0         0
## 13        0        0  0.000000         0         0         0
## 14        0        0  0.000000         0         0         0
## 15        0        0  0.000000         0         0         0
## 16        0        0  0.000000         0         0         0
## 17        0        0  0.000000         0         0         0
## 
## $year_frame
##   years surv obs     sizea sizeb sizec repst         fec jsurv       jobs
## 1  1988    0   0   96.3244     0     0     0 -0.41749627     0 -0.7459843
## 2  1989    0   0 -240.8036     0     0     0  0.51421684     0  0.6118826
## 3  1990    0   0  144.4792     0     0     0 -0.07964038     0 -0.9468618
##       jsizea jsizeb jsizec jrepst jmatst sizea_zi sizeb_zi sizec_zi
## 1  0.5937962      0      0      0      0        0        0        0
## 2  1.4551236      0      0      0      0        0        0        0
## 3 -2.0489198      0      0      0      0        0        0        0
##          fec_zi jsizea_zi jsizeb_zi jsizec_zi
## 1  3.741475e-07         0         0         0
## 2 -7.804715e-08         0         0         0
## 3 -2.533755e-07         0         0         0
## 
## $patch_frame
##   patches surv obs sizea sizeb sizec repst fec jsurv jobs jsizea jsizeb jsizec
## 1       1    0   0     0     0     0     0   0     0    0      0      0      0
##   jrepst jmatst sizea_zi sizeb_zi sizec_zi fec_zi jsizea_zi jsizeb_zi jsizec_zi
## 1      0      0        0        0        0      0         0         0         0
## 
## $group2_frame
##   groups surv obs sizea sizeb sizec repst fec jsurv jobs jsizea jsizeb jsizec
## 1      0    0   0     0     0     0     0   0     0    0      0      0      0
##   jrepst jmatst sizea_zi sizeb_zi sizec_zi fec_zi jsizea_zi jsizeb_zi jsizec_zi
## 1      0      0        0        0        0      0         0         0         0
## 
## $group1_frame
##   groups surv obs sizea sizeb sizec repst fec jsurv jobs jsizea jsizeb jsizec
## 1      0    0   0     0     0     0     0   0     0    0      0      0      0
##   jrepst jmatst sizea_zi sizeb_zi sizec_zi fec_zi jsizea_zi jsizeb_zi jsizec_zi
## 1      0      0        0        0        0      0         0         0         0
## 
## $dist_frame
##    response     dist
## 1      surv    binom
## 2       obs    binom
## 3     sizea gaussian
## 4     sizeb constant
## 5     sizec constant
## 6     repst constant
## 7       fec   negbin
## 8     jsurv    binom
## 9      jobs    binom
## 10   jsizea gaussian
## 11   jsizeb constant
## 12   jsizec constant
## 13   jrepst constant
## 14   jmatst constant
## 
## $st_frame
##        surv         obs       sizea       sizeb       sizec       repst 
##   1.0000000   1.0000000 503.6167000   1.0000000   1.0000000   1.0000000 
##         fec       jsurv        jobs      jsizea      jsizeb      jsizec 
##   0.2342114   1.0000000   1.0000000   5.8310000   1.0000000   1.0000000 
##      jrepst      jmatst 
##   1.0000000   1.0000000 
## 
## attr(,"class")
## [1] "vrm_input"

Now let’s build our IPM using the flefko2() function.

lathmat2_importipm <- flefko2(stageframe = lathframe_ipm, modelsuite = lath_vrm,
  supplement = lathsupp2, reduce = FALSE)

summary(lathmat2_importipm)
## 
## This ahistorical lefkoMat object contains 3 matrices.
## 
## Each matrix is square with 103 rows and columns, and a total of 10609 elements.
## A total of 26926 survival transitions were estimated, with 8975.333 per matrix.
## A total of 600 fecundity transitions were estimated, with 200 per matrix.
## This lefkoMat object covers 1 population, 1 patch, and 3 time steps.
## 
## Survival probability sum check (each matrix represented by column in order):
##          [,1]  [,2]  [,3]
## Min.    0.000 0.000 0.000
## 1st Qu. 0.979 0.956 0.980
## Median  0.998 0.998 0.998
## Mean    0.951 0.922 0.954
## 3rd Qu. 1.000 1.000 1.000
## Max.    1.000 1.000 1.000

Users exploring the output and comparing against the original published IPM will notice that the element values are almost the same, but differ by tiny amounts (often on the order of 10-5 or smaller). These small differences occur because of the rounding that happens when authors publish their models, and are not a cause of concern nor will they cause dramatic differences in inference.

Step 5. MPM analysis

We will now explore analyses that we might conduct with MPMs and IPMs. The code for the analyses is essentially the same regardless of the kind of MPM that we utilize, so we will only focus on the Cypripedium MPMs. We will start off by looking at typical, or “classical”, projection analyses, and then we will introduce complex, custom analyses.

Step 5a. “Classical” analyses

Let’s estimate the asymptotic deterministic population growth rate for each of the four sets of patch-level MPMs. We will first focus on the raw patch-level MPMs.

cyp2rp_lam <- lambda3(cypmatrix2rp)
cyp3rp_lam <- lambda3(cypmatrix3rp)

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")

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.

cyp2fp_lam <- lambda3(cypmatrix2fp)
cyp3fp_lam <- lambda3(cypmatrix3fp)

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")

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, which can include “artificial” zeroes resulting from low sample size, 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 suggested a 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.9601966
## 2   1     B 0.9631450
## 3   1     C 0.9645564
## 4   1     0 0.9627838
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.2582071 0.8835078 0.9399509 0.009399509
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.04054553 0.04812858 0.2193823 0.002193823
## 2   1     B -0.03752284 0.06369572 0.2523801 0.002523801
## 3   1     C -0.03602980 0.02500557 0.1581315 0.001581315
## 4   1     0 -0.03781516 0.04353458 0.2086494 0.002086494

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, 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_f <- lmean(cypmatrix2f_wrong)
lambda3(wrong_mean_f)
##   pop patch   lambda
## 1   1     1 1.049226
lambda3(cyp2f_mean)
##   pop patch   lambda
## 1   1     1 1.110766
set.seed(42)
slambda3(cypmatrix2f_wrong)
##   pop patch          a      var        sd          se
## 1   1     1 0.04742637 0.614831 0.7841116 0.007841116
slambda3(cypmatrix2f)
##   pop patch        a        var        sd          se
## 1   1     1 0.104924 0.06845388 0.2616369 0.002616369

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 - we only expect that they may be 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")

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")

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)

ss_put_together <- cbind.data.frame(tm2w_f$ss_prop, tm2w_fs$ss_prop)
names(ss_put_together) <- c("det ahist", "sto ahist")
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", "grey"), bty = "n")
legend("topright", c("det ahist", "sto ahist"), col = c("black", "grey"),
  pch = 15, bty = "n")

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")

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")

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] 38
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 38 in the deterministic case, and element 14 in the 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 4th stage (3rd year protocorm) to the 5th stage (seedling) in the deterministic case, and from the 2nd stage (1st year protocorm) to the 3rd stage (2nd year protocorm) in the stochastic case. 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. This sort of result suggests the importance of history - incorporating a single extra time step in transitions shows sensitivities shifting from juveniles to adults in this case study.

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.05071351
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] 962658
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.05189656
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 values in deterministic and stochastic ahistorical analysis appear to be the transitions between different protocorm stages (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. Both deterministic and 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")

Elasticity analyses in this plot 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")

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")

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 5b. 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 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 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, allows different forms of density dependence, and 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:
## $milepost_sums
##       1 1
## 1     100
## 2501    0
## 5001    0
## 7501    0
## 10001   0
## 
## $extinction_times
## [1] NA

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. We can also get an estimate of the time to extinction by using the ext_time option.

summary(cypproj_2r, milepost = c(1, 3, 5, 8, 9, 10, 15, 25, 50, 100),
  ext_time = TRUE)
## 
## 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:
## $milepost_sums
##     1 1
## 1   100
## 3   100
## 5   100
## 8    75
## 9    75
## 10   73
## 15   52
## 25    2
## 50    0
## 100   0
## 
## $extinction_times
##   ext_reps ext_time
## 1      100    14.64

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. The average time to extinction across our 100 replicates is 14.64 years. 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")

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")

The function-based ahistorical analysis also suggests inevitable extinction, and quite quickly. Let’s see a summary.

summary(cypproj_2f, ext_time = TRUE)
## 
## 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:
## $milepost_sums
##       1 1
## 1     100
## 2501    0
## 5001    0
## 7501    0
## 10001   0
## 
## $extinction_times
##   ext_reps ext_time
## 1      100    17.96

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. 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")

We see only small improvement in the lifespan of the population with boosted fecundity (shown on the right). 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),
  ext_time = TRUE)
## 
## 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:
## $milepost_sums
##     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
## 
## $extinction_times
##   ext_reps ext_time
## 1      100    14.64
summary(cypproj_2r_1, milepost = c(1, 3, 5, 8, 9, 10, 12, 15, 18, 20, 30, 50, 100),
  ext_time = TRUE)
## 
## 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:
## $milepost_sums
##     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
## 
## $extinction_times
##   ext_reps ext_time
## 1      100    16.18

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.

Step 5c. 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. This can be quite useful if we wish to project an IPM forward under changing conditions, or if we have density dependence in the vital rates themselves rather than in the matrix elements.

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 construction of a new projection matrix at each time step makes this projection take a bit more time that function projection3() takes.

Let’s start by creating the precipitation input table.

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

ind_frame
##      inda indb indc
## 1   100.0    0    0
## 2    99.8    0    0
## 3    99.6    0    0
## 4    99.4    0    0
## 5    99.2    0    0
## 6    99.0    0    0
## 7    98.8    0    0
## 8    98.6    0    0
## 9    98.4    0    0
## 10   98.2    0    0
## 11   98.0    0    0
## 12   97.8    0    0
## 13   97.6    0    0
## 14   97.4    0    0
## 15   97.2    0    0
## 16   97.0    0    0
## 17   96.8    0    0
## 18   96.6    0    0
## 19   96.4    0    0
## 20   96.2    0    0
## 21   96.0    0    0
## 22   95.8    0    0
## 23   95.6    0    0
## 24   95.4    0    0
## 25   95.2    0    0
## 26   95.0    0    0
## 27   94.8    0    0
## 28   94.6    0    0
## 29   94.4    0    0
## 30   94.2    0    0
## 31   94.0    0    0
## 32   93.8    0    0
## 33   93.6    0    0
## 34   93.4    0    0
## 35   93.2    0    0
## 36   93.0    0    0
## 37   92.8    0    0
## 38   92.6    0    0
## 39   92.4    0    0
## 40   92.2    0    0
## 41   92.0    0    0
## 42   91.8    0    0
## 43   91.6    0    0
## 44   91.4    0    0
## 45   91.2    0    0
## 46   91.0    0    0
## 47   90.8    0    0
## 48   90.6    0    0
## 49   90.4    0    0
## 50   90.2    0    0
## 51   90.0    0    0
## 52   89.8    0    0
## 53   89.6    0    0
## 54   89.4    0    0
## 55   89.2    0    0
## 56   89.0    0    0
## 57   88.8    0    0
## 58   88.6    0    0
## 59   88.4    0    0
## 60   88.2    0    0
## 61   88.0    0    0
## 62   87.8    0    0
## 63   87.6    0    0
## 64   87.4    0    0
## 65   87.2    0    0
## 66   87.0    0    0
## 67   86.8    0    0
## 68   86.6    0    0
## 69   86.4    0    0
## 70   86.2    0    0
## 71   86.0    0    0
## 72   85.8    0    0
## 73   85.6    0    0
## 74   85.4    0    0
## 75   85.2    0    0
## 76   85.0    0    0
## 77   84.8    0    0
## 78   84.6    0    0
## 79   84.4    0    0
## 80   84.2    0    0
## 81   84.0    0    0
## 82   83.8    0    0
## 83   83.6    0    0
## 84   83.4    0    0
## 85   83.2    0    0
## 86   83.0    0    0
## 87   82.8    0    0
## 88   82.6    0    0
## 89   82.4    0    0
## 90   82.2    0    0
## 91   82.0    0    0
## 92   81.8    0    0
## 93   81.6    0    0
## 94   81.4    0    0
## 95   81.2    0    0
## 96   81.0    0    0
## 97   80.8    0    0
## 98   80.6    0    0
## 99   80.4    0    0
## 100  80.2    0    0

Now let’s run the projection. We will make it a stochastic projection in which the year terms in the linear models are essentially shuffled, and assess 100 replicates over 100 years each.

set.seed(42)
cypfproj_2f_env <- f_projection3(data = cypfb_env, format = 3, stageframe = cypframe_fb,
  supplement = cypsupp2_fb, modelsuite = cypmodels2_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, ext_time = TRUE)
## 
## 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:
## $milepost_sums
##     1 1
## 1   100
## 26    1
## 51    0
## 76    0
## 101   0
## 
## $extinction_times
##   ext_reps ext_time
## 1      100    13.52

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

plot(cypfproj_2f_env)

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 10 of lefko3: a gentle introduction for further details.