Chapter 5 Matrix Models II: Function-based MPMs

There is a simple rule here, a rule of legislation, a rule of business, a rule of life: beyond a certain point, complexity is fraud.

— P.J. O’Rourke

Matrix projection models, whether historical or ahistorical, can be categorized as either 1) raw, also called empirical, or 2) function-based, also sometimes called complex IPMs (see chapter 7 for details on the differences). The oldest and most common in the literature is the raw MPM, and chapter 4 discusses that approach in detail. In this chapter, we will cover the function-based approach.

Function-based MPMs are created differently than raw MPMs. Although they can look the same to the untrained eye, and although the matrix elements themselves still represent survival-transition probabilities and fecundity rates, matrix elements are calculated differently. Rather than estimating matrix elements as proportions of individuals moving between stages at consecutive occasions or as products of average offspring production and related recruitment terms from the original dataset, matrix elements in function-based MPMs are estimated using mathematical functions that represent the vital rates or demographic processes underlying the dynamics of the population. These functions are linked together via kernels that treat them typically as conditional rates and probabilities.

How are these vital rate functions estimated? Let’s consider a simple function-based size-classified model. In this model, the survival-transition probability is estimated as the product of the probability that an individual in stage \(j\) at occasion t survives to occasion t+1, and the probability that the same individual becomes stage \(k\) in time t+1 assuming survival to that time. The latter probability is conditional on the first. Thus, we have the following product, where \(\sigma _{j}\) is the survival probability of an individual in stage \(j\) at time t to time t+1, and \(\psi _{kj}\) is the probability of transition from stage \(j\) in time t to stage \(k\) in time t+1 assuming survival to time t+1.

\[\begin{equation} a _{kj} = \sigma _{j} \psi _{kj} \tag{5.1} \end{equation}\]

Continuing with this simple case, fecundity elements assuming a pre-breeding model are given as

\[\begin{equation} a _{kj} = f_{kj} \sigma _{k.} \tag{5.2} \end{equation}\]

and assuming a post-breeding model are given as

\[\begin{equation} a _{kj} = \sigma _{.j} f_{kj} \tag{5.3} \end{equation}\]

where \(f_{kj}\) is the production of stage \(k\) offspring by a reproductive individual in stage \(j\) in time t, \(\sigma _{k.}\) is the survival probability of newborns to age 1 at time t+1 when they are first censused (assuming a pre-breeding model), and \(\sigma _{.j}\) is the survival of the parent from the occasion preceding reproduction to the time of reproduction (assuming a post-breeding model). Note that reproductive stages are defined differently in the post-breeding model than in the pre-breeding model to account for the need to incorporate parental survival in the fecundity transition in the former, but juvenile survival in the latter (see Chapter 2 for further details).

Complexity in the life history model generally increases the number of terms to be multiplied to produce each corresponding element. For example, if we are dealing with an herbaceous plant that undergoes vegetative dormancy, then we might change the survival-transition kernel to two different forms, with the equation used dependent on whether the stage we are transitioning to in time t+1 is dormancy or not. A dormant plant has no aboveground size, and so the equation used for dormancy would be the following instead of equation (5.1), where \(\rho _{.}\) is the probability of sprouting in time t+1 assuming survival from time t and stage \(D\) is the dormant stage.

\[\begin{equation} a _{Dj} = \sigma _{j} (1 - \rho _{.}) \tag{5.4} \end{equation}\]

The probability of transitioning to a non-dormant stage \(k\) is given as

\[\begin{equation} a _{kj} = \sigma _{j} \rho _{.} \psi _{kj} \tag{5.5} \end{equation}\]

where \(\psi _{kj}\) is the transition probability from stage \(j\) in time t to stage \(k\) in time t+1 assuming both survival to time t+1 and sprouting in time t+1. This makes \(\psi _{kj}\) here a little different than \(\psi _{kj}\) in equation (5.1), where we assumed a life history that did not involve the possibility of unobservable life stages.

Size in function-based MPMs is handled using size classes, which often have size bins set to standardized widths. Such widths may be set to 1.0, as might be typical of count variables, but they can also be set narrower or wider. The function-based approach is very flexible, and allows stages and their associated size classes to be cut quite finely by using different vital rate functions on a case-by-case basis. For example, we may wish to create two sets of stages that have the same size classes, but differ in reproductive status. In the herbaceous perennial plant case that we have been working with, such a matrix would be composed of survival-transition probabilities determined by three functions. The first would be given by equation (5.4), for the dormant plant case. The second would be the following equation, corresponding to the transition to non-reproductive stage \(k\), where \(\gamma _{k}\) is the probability of becoming reproductive in time t+1 of an individual in size class \(k\) in that time.

\[\begin{equation} a _{kj} = \sigma _{j} \rho _{.} \psi _{kj} (1 - \gamma _{k}) \tag{5.6} \end{equation}\]

Finally, we have the following equation giving the survival-transition probability to reproductive stage \(k\).

\[\begin{equation} a _{kj} = \sigma _{j} \rho _{.} \psi _{kj} \gamma _{k} \tag{5.7} \end{equation}\]

The functions used in these equations can be developed in several ways. In lefko3, we utilize the linear modeling approach. In this approach, we use hfv-formatted datasets to analyze the main vital rates via either generalized linear models or generalized linear mixed models. The best-fit models are then used as inputs into general functions created for the job, with a great deal of flexibility provided for the assumptions inherent in the system being analyzed. Next, we will describe this approach, but also note that linear vital rate models may also be imported (see Chapter 15 for more information).

5.1 Developing vital rate models

Package lefko3 employs two methods to estimate the vital rates used to create function-based MPMs. The main method is automated vital rate modeling. Alternatively, users may create their own vital rate models separately and incorporate them into their MPMs. In lefko3, the function modelsearch() is the main tool provided to estimate vital rate functions via the former method. It also allows users to explore whether history influences component vital rates within a rigorous statistical framework. The results can be used not only to decide whether a historical MPM is justified, but also to develop function-based hMPMs and ahMPMs, including age-by-stage MPMs and even integral projection models (IPMs). Package lefko3 can estimate linear models for up to 14 different vital rates:

  1. Survival probability - This is the probability of surviving from occasion t to occasion t+1, given that the individual is in stage \(j\) in occasion t (and, if historical, in stage \(l\) in occasion t-1). In lefko3, this parameter may be modeled as a function of up to three size metrics, reproductive status, patch, year, age, and individual identity, and density and a number of individual or environmental covariates in occasions t and t-1. This parameter is required in all function-based matrices.
  2. Observation probability - This is the probability of observation in occasion t+1 of an individual in stage \(k\) given survival from occasion t to occasion t+1. This parameter is only used when at least one stage is technically not observable. For example, some plants are capable of vegetative dormancy, in which case they are alive but do not necessarily sprout in all years. In these cases, the probability of sprouting may be estimated as the observation probability. Note that this probability does not refer to observer effort, and so should only be used to differentiate completely unobservable stages where the observation status refers to an important biological phenomenon, such as when individuals may be alive but have a size of zero. In lefko3, this parameter may be modeled as a function of up to three size metrics, reproductive status, patch, year, age, and individual identity, and density and a number of individual or environmental covariates in occasions t and t-1.
  3. Primary size transition probability - This is the probability of becoming size \(k\) in occasion t+1 assuming survival from occasion t to occasion t+1 and observation in that time. If multiple size metrics are used, then this refers only to the first of these, which we may refer to as the primary size variable. In lefko3, this parameter may be modeled as a function of up to three size metrics, reproductive status, patch, year, age, and individual identity, and density and a number of individual or environmental covariates in occasions t and t-1. This parameter is required in all function-based size-classified matrices.
  4. Secondary size transition probability - This is the probability of becoming size \(k\) in occasion t+1 assuming survival from occasion t to occasion t+1 and observation in that time, within a second size metric used for classification in addition to the primary metric. In lefko3, this parameter may be modeled as a function of up to three size metrics, reproductive status, patch, year, age, and individual identity, and density and a number of individual or environmental covariates in occasions t and t-1.
  5. Tertiary size transition probability - This is the probability of becoming size \(k\) in occasion t+1 assuming survival from occasion t to occasion t+1 and observation in that time, within a third size metric used for classification in addition to the primary and secondary metrics. In lefko3, this parameter may be modeled as a function of up to three size metrics, reproductive status, patch, year, age, and individual identity, and density and a number of individual or environmental covariates in occasions t and t-1.
  6. Reproduction probability - This is the probability of becoming reproductive in occasion t+1 given survival from occasion t to occasion t+1, and observation in that time. This vital rate should only be used only if the life history model separates breeding from non-breeding mature stages having the same sizes. If all adult stages are potentially reproductive and no separation of reproducing from non-reproducing adults is required by the life history model, then this parameter should not be estimated. In lefko3, this parameter may be modeled as a function of up to three size metrics, reproductive status, patch, year, age, and individual identity, and density and a number of individual or environmental covariates in occasions t and t-1.
  7. Fecundity rate - This refers to the rate of production of new individuals into juvenile stages in time t+1 as offspring from reproduction events happening in time t. Under the default setting, this is the rate of successful production of offspring in occasion t by individuals alive, observable, and reproductive in that time, and, if assuming a pre-breeding model and sufficient information is provided in the dataset, the survival of those offspring into occasion t+1 in whatever juvenile class is possible. Thus, the fecundity rate of seed-producing plants might be split into seedlings, which are plants that germinated within a year of seed production, and dormant seeds. Alternatively, it may be given only as produced fruits or seeds, with the survival and germination of seeds provided elsewhere in the MPM development process, such as within a supplement table. An additional setting allows fecundity rate to be estimated using data provided for occasion t+1 instead of occasion t. In lefko3, this parameter may be modeled as a function of up to three size metrics, reproductive status, patch, year, age, and individual identity, and density and a number of individual or environmental covariates in occasions t and t-1.
  8. Juvenile survival probability - This is the probability of surviving from juvenile stage \(j\) in occasion t to occasion t+1. It is used only when the user wishes to model vital rates for a single size-unclassified juvenile period separately from adults. In lefko3, this parameter may be modeled as a function of up to three size metrics, patch, year, and individual identity, and density and a number of individual or environmental covariates in occasions t and t-1.
  9. Juvenile observation probability - This is the probability of observation in occasion t+1 of an individual in juvenile or mature stage \(j\) in occasion t given survival from occasion t to occasion t+1. It is used only when the user wishes to model vital rates for a single size-unclassified juvenile period separately from adults. In lefko3, this parameter may be modeled as a function of up to three size metrics, patch, year, and individual identity, and density and a number of individual or environmental covariates in occasions t and t-1.
  10. Juvenile primary size transition probability - This is the probability of becoming stage \(k\) in occasion t+1 assuming survival from juvenile stage \(j\) in occasion t to occasion t+1 and observation in that time. It is used only when the user wishes to model vital rates for a single size-unclassified juvenile period separately from adults. In lefko3, this parameter may be modeled as a function of up to three size metrics, patch, year, and individual identity, and density and a number of individual or environmental covariates in occasions t and t-1.
  11. Juvenile secondary size transition probability - This is the probability of becoming stage \(k\) in occasion t+1 assuming survival from juvenile stage \(j\) in occasion t to occasion t+1 and observation in that time, in a secondary size metric in addition to the primary size metric. It is used only when the user wishes to model vital rates for a single size-unclassified juvenile period separately from adults. In lefko3, this parameter may be modeled as a function of up to three size metrics, patch, year, and individual identity, and density and a number of individual or environmental covariates in occasions t and t-1.
  12. Juvenile tertiary size transition probability - This is the probability of becoming stage \(k\) in occasion t+1 assuming survival from juvenile stage \(j\) in occasion t to occasion t+1 and observation in that time, in a tertiary size metric in addition to the primary and secondary size metrics. It is used only when the user wishes to model vital rates for a single size-unclassified juvenile period separately from adults. In lefko3, this parameter may be modeled as a function of up to three size metrics, patch, year, and individual identity, and density and a number of individual or environmental covariates in occasions t and t-1.
  13. Juvenile reproduction probability - This is the probability of reproducing in mature stage \(k\) in occasion t+1 given survival from juvenile stage \(j\) in occasion t to occasion t+1, and observation in that time. It is used only when the user wishes to model vital rates for a single size-unclassified juvenile period separately from adults. In lefko3, this parameter may be modeled as a function of up to three size metrics, patch, year, and individual identity, and density and a number of individual or environmental covariates in occasions t and t-1.
  14. Juvenile maturity probability - This is the probability of becoming mature in occasion t+1 given survival from juvenile stage \(j\) in occasion t to occasion t+1. It is used only when the user wishes to model vital rates for a single size-unclassified juvenile period separately from adults. In lefko3, this parameter may be modeled as a function of up to three size metrics, patch, year, and individual identity, and density and a number of individual or environmental covariates in occasions t and t-1. Note that this parameter denotes transition to maturity.

Of these fourteen vital rates, most users will estimate at least parameters (1) survival probability, (3) primary size transition probability, and (7) fecundity rate. These three are the default set for function modelsearch(). Parameters (2) observation probability and (6) reproduction probability may be used when some stages are included that are completely unobservable (and so do not have any size), or that are mature but non-reproductive, respectively. Parameters (4) secondary size transition and (5) tertiary size transition should only be used when size classification involves more than one size variable. Parameters (8) through (14) should only be added if the dataset contains juvenile individuals transitioning to maturity, and these juveniles live within a single juvenile stage for a short time before transitioning to maturity, or before transitioning to a stage that is size-classified in the same manner as adult stages are. If juveniles can be classified by size similarly to adults (or at least on the same scale), then only vital rates (1) through (7) should be used and stage groups can be used with supplement tables to disallow transitions back to juvenile stages. If multiple juvenile stages exist on a different size classification system than adults, then stage groups may also be included as categorical variables in linear vital rate modeling in rates (1) through (7) to stratify vital rate models properly.

5.1.1 Options in modeling vital rates with modelsearch()

Function modelsearch() handles the entire modeling process using an exhaustive model building process combined with information theoretical model selection using model AICc and the number of estimated parameters in each model. It first develops global models, and then develops all nested models via exhaustive model building. Finally, it determines and selects the best-fit models. Users may provide this function with information about the following:

  1. Individual history - Are the matrices to be built historical or ahistorical? If the former, then the state of the individual in occasion t-1 will be included in modeling.
  2. Modeling approach - Should the models be estimated as generalized linear models (GLMs) or as generalized linear mixed models (GLMMs, the default)? While most function-based matrix models in the literature are estimated via the former, the latter approach can account for repeated observations of the same individual by including individual identity as a random factor. Mixed models also allow time and patch to be treated as random variables, which allows for broader and more theoretically sound inference.
  3. Suite of factors - Should both size and reproductive status be tested as causal factors? Should two-way interactions be included? Should only the y-intercept be estimated? Should age be tested exclusively?
  4. Suite of vital rates - Which adult demographic parameters should be estimated? The defaults are (1) survival, (3) primary size, and (7) fecundity. Should (2) observation status, (4) secondary size, (5) tertiary size, or (6) reproductive status also be modeled?
  5. Juvenile vital rate estimation - Should juvenile parameters (8) through (14) also be modeled?
  6. Best-fit criterion - If a model with fewer parameters exists with \(\Delta AICc \leq 2.0\), then should this model be used as the best-fit model (the default), or should the model with the minimum \(AICc\) always be chosen?
  7. Size distribution - Should size be modeled as a continuous variable under a Gaussian or a gamma distribution, or as a count variable under either a Poisson or negative binomial distribution? If as a count variable, then should the distribution be zero-inflated to account for excess zeros, zero-truncated to account for a lack of zeros, or left unaltered? Similar setting exist for secondary and tertiary size variables, if used.
  8. Fecundity distribution - Should fecundity be modeled as a continuous variable under a Gaussian or a gamma distribution, or as a count variable under either a Poisson or negative binomial distribution? If a count variable, then should the distribution be zero-inflated to account for excess zeros, zero-truncated to account for a lack of zeros, or left unaltered?
  9. Timing of fecundity - Although fecundity refers to the production of offspring in stages alive in time t+1, fecundity may be measured differently in different studies. Function modelsearch() assumes that linear models of fecundity use a metric counted or measured in occasion t as the response. This applies well with most herbaceous plant datasets, where flowers or seeds produced in one year might be the proper fecundity proxy measured. However, users not wishing to follow this default behavior can use the fectime option to stipulate a fecundity metric measured in occasion t+1.
  10. Age - Is an age-classified (Leslie) or age-by-stage MPM the main goal?
  11. Individual covariates and environmental state variables - Should the effects of any individual or environmental covariates on vital rates also be tested? If so, should they be treated as fixed, quantitative terms or as random, categorical terms? Do they vary by individual, by population / patch, or only by time?
  12. Density - Should spatial density be included as a factor in modeling? Note that this refers to local, spatial density with respect to each individual, rather than to the population size.
  13. Stage groups - If stage groups are noted in the stageframe, then should they also be used as fixed, independent categorical predictors in modeling?
  14. Censoring - Should data points marked as questionable be used in or excluded from modeling?
  15. Variable names - The names of all relevant variables in the dataset need to be specified. Note that the default behavior assumes variable names produced via the historicalize3() or verticalize3() functions, which produce standardized historically-formatted vertical (hfv format) datasets.
  16. Global model only - Should a full exhaustive model building and selection exercise be performed (the default), or should only the global model be built and parameterized?
  17. Accuracy - Should the accuracy of binomial models, and simple R2 or pseudo-R2 of size and fecundity models be evaluated (the default)?
  18. Keep data subsets - Function modelsearch() subsets the data for each vital rate modeling exercise. Should those datasets be kept in the output?

Once all decisions have been made and associated input terms have been provided, modelsearch() goes to work. The result is a lefkoMod object, which is a list in which the first 14 elements are the best-fit models developed for each vital rate. These are followed by an equivalent number of elements showing the full model tables developed and tested, followed by a table of parameter names (object paramnames), an element detailing the best-fit criterion used (object criterion), and ending on quality control data showing the number of individuals and the number of unique transitions used in the estimation of each model, and the accuracy or simple R2 of each model (object qc). The user may also output data subsets used to generate each vital rate model, within a list held as a single element of the top-level list. Depending on user choices, linear modeling is handled through the lm() and glm() functions in the stats package, the lmer() and glmer() functions in lme4, the glmmTMB() function in package glmmTMB, the glm.nb() function in package MASS, the vglm() function in package VGAM, or the zeroinfl() function in package pscl. Exhaustive model building proceeds through the dredge() function in package MuMIn (Bartoń 2014). Model selection is handled through assessment of \(AICc\) and the degrees of freedom (\(k\)) estimated per model by default (see 6. Best-fit criterion above).

If modelsearch() is set for historical analysis (historical = TRUE, the default), then the decision of whether to develop a historical MPM can be made on the basis of whether any best-fit vital rate model includes size or reproductive status in occasion t-1. If at least one vital rate does, then a historical MPM is justified. Otherwise, it is not. Regardless, the output can be used to create a function-based MPM in the next step.

5.2 Assessing vital rates in Cypripedium candidum

Let’s now work on the Cypripedium candidum case study. We introduced the model and code for our stageframe and supplements in Chapter 2. However, as it has likely been a while since we have viewed that chapter, let’s take a look again at the life history model that we will use (note that this is the same as figure 2.3).

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

This is a fairly large life history model with two adult life stages for each number of sprouts - a reproductive stage that flowers and a non-reproductive stage that does not flower. Let’s load the raw dataset first. Then we will set up our stageframe and standardize the data into a historically formatted vertical (hfv) data frame.

data(cypdata)

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")
indataset <- c(0, 0, 0, 0, 0, rep(1, 49))
sizevector <- c(0, 0, 0, 0, 0, seq(from = 0, t = 24), seq(from = 1, to = 24))
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))
comments <- c("Dormant seed", "Yr1 protocorm", "Yr2 protocorm", "Yr3 protocorm",
  "Seedling", "Veg dorm", "Veg adult 1 stem", "Veg adult 2 stems",
  "Veg adult 3 stems", "Veg adult 4 stems", "Veg adult 5 stems",
  "Veg adult 6 stems", "Veg adult 7 stems", "Veg adult 8 stems",
  "Veg adult 9 stems", "Veg adult 10 stems", "Veg adult 11 stems",
  "Veg adult 12 stems", "Veg adult 13 stems", "Veg adult 14 stems",
  "Veg adult 15 stems", "Veg adult 16 stems", "Veg adult 17 stems",
  "Veg adult 18 stems", "Veg adult 19 stems", "Veg adult 20 stems",
  "Veg adult 21 stems", "Veg adult 22 stems", "Veg adult 23 stems",
  "Veg adult 24 stems", "Flo adult 1 stem", "Flo adult 2 stems",
  "Flo adult 3 stems", "Flo adult 4 stems", "Flo adult 5 stems",
  "Flo adult 6 stems", "Flo adult 7 stems", "Flo adult 8 stems",
  "Flo adult 9 stems", "Flo adult 10 stems", "Flo adult 11 stems",
  "Flo adult 12 stems", "Flo adult 13 stems", "Flo adult 14 stems",
  "Flo adult 15 stems", "Flo adult 16 stems", "Flo adult 17 stems",
  "Flo adult 18 stems", "Flo adult 19 stems", "Flo adult 20 stems",
  "Flo adult 21 stems", "Flo adult 22 stems", "Flo adult 23 stems",
  "Flo adult 24 stems")

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

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

Now we will load the supplement tables that we will use for the ahistorical and historical MPMs. Note that these are slightly different from the previous chapter (chapter 4), because of the different life history model that we are using.

seeds_per_fruit <- 5000
sl_mult <- 0.7

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

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

Before we can develop our vital rate models, we need to determine the proper distributions for size and fecundity. As a reminder, size in the Cypripedium dataset is given as a series of numbers of sprouts, and our proxy for size can be either the number of flowers or the number of fruits produced by an individual. So, size and fecundity in this dataset are all non-negative integers, or count variables. Count variables generally break the assumptions of a Gaussian distribution because the mean and variance are strongly related, possible values are discrete, and distributions are often dramatically skewed. Additionally, because we have absorbed individuals with a size of zero into the dormant stage, there are no zeros left for the size model and so we will need a zero-truncated distribution. Fecundity, in contrast, is a count variable that includes zeros and so we should test whether we need a zero-inflated model.

Package lefko3 includes a function that can help in determining which distributions to use, as well as in assessing the quality of the data with respect to the linear models that we wish to develop: hfv_qc(). Let’s try this function out. Note that we need to specify which vital rate models we will be modeling (the vitalrates field below), because the data frame that we will input will be subset according to this decision. We also need to enter the names of the variables we are using, here in particular for size, since we are not using the default variables. In fact, we can load the function with exactly the same input that we are considering using in function modelsearch(), just to simplify life.

hfv_qc(cypfb_v1, vitalrates = c("surv", "obs", "size", "repst", "fec"),
  patch = "patchid", 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.
> 
>   Numbers of categories in data subset in possible random variables:
>   indiv id: 74
>   year2: 5
>   patch: 3
> 
>   A total of 6 individuals have only single transitions.
> 
> 
> Observation status:
> 
>   Data subset has 58 variables and 303 transitions.
> 
>   Variable obsstatus3 has 0 missing values.
>   Variable obsstatus3 is a binomial variable.
> 
>   Numbers of categories in data subset in possible random variables:
>   indiv id: 70
>   year2: 5
>   patch: 3
> 
>   A total of 6 individuals have only single transitions.
> 
> 
> 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.
> 
>   Numbers of categories in data subset in possible random variables:
>   indiv id: 70
>   year2: 5
>   patch: 3
> 
>   A total of 6 individuals have only single transitions.
> 
> 
> Reproductive status:
> 
>   Data subset has 58 variables and 288 transitions.
> 
>   Variable repstatus3 has 0 missing values.
>   Variable repstatus3 is a binomial variable.
> 
>   Numbers of categories in data subset in possible random variables:
>   indiv id: 70
>   year2: 5
>   patch: 3
> 
>   A total of 6 individuals have only single transitions.
> 
> 
> 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.
> 
>   Numbers of categories in data subset in possible random variables:
>   indiv id: 51
>   year2: 5
>   patch: 3
> 
>   A total of 21 individuals have only single transitions.

The results show that size is significantly overdispersed and zero-truncated. This means that we cannot use the Poisson distribution, and should instead use the zero-truncated negative binomial distribution. Fecundity is not significantly overdispersed, but it is significantly zero-inflated, so we will require a zero-inflated Poisson distribution. Looking over the other variables, we see that they match the binomial distribution (required for probabilities), and we also see the changing sample size used for the different data subsets that will be used to conduct the linear modeling. The number of categories associated with possible random terms is also much lower than the number of data points in each subset, so the overall quality of the data looks appropriate for mixed modeling.

5.3 Setting up function modelsearch()

Next, we will create a full suite of vital rate models using function modelsearch(). 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 parameterization for each vital rate, and the strategy to determine 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 assumed to be 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 TRUE by default. Setting year.as.random to FALSE would make time a fixed categorical variable in all cases. The patch.as.random option functions similarly with respect to patches / subpopulations.

The mixed modeling approach is usually preferable to the GLM approach because of its treatment of repeat samples. Indeed, treating each transition as independent of every other leads to pseudoreplication if transitions can come from the same individual. Mixed modeling deals with this problem by treating the individual as a random factor. However, the GLM approach is faster and has greater statistical power. Users of package lefko3 wishing to use a standard generalized linear modeling strategy should set approach = "glm". In this case, individual identity is not used, time is a fixed categorical factor (as is patch, if used), and all observed transitions are treated as independent.

Next, we must determine which vital rates to model. 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. 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 some individuals with no fecundity occur within stages that also include individuals producing offspring. 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") and we will not set juvestimate and juvsize.

Third, we need to set the proper statistical distribution for each parameter. Survival probability, observation probability, reproductive status, and maturity 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 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. Setting suite = "full" will yield global models that also include all two-way interactions among size and reproductive status 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. Other terms can be specified, including individual or annual covariates, density, and age. The interactions argument allows two-way interactions among these other terms, and with the core size and reproductive status terms (interactions = FALSE by default).

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

In the model building exercise below, we will use the suite = "main" option to run all main effects only. Normally we would set suite = "full" and interactions = TRUE, but running all effects including their two-way interactions will likely tie up our computers for a little too long for this tutorial. To keep tabs on what is going on, we will set quiet = "partial", which will yield messages showing where the modeling is currently running as it goes. While this runs, feel free to make yourself a coffee or a cappuccino, or perhaps something stronger (no judgement here…).

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

Once done, we will summarize the output with the summary() function.

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: surv.data
>      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.117e-05
>  patchid (Intercept) 1.172e-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: obs.data
>      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: size.data
>      AIC      BIC   logLik df.resid 
> 1009.318 1031.296 -498.659      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 (): 2.95e+07 
> 
> Fixed Effects:
> 
> Conditional model:
> (Intercept)   size2added  
>      0.5404       0.0219  
> 
> 
> 
> 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: repst.data
>       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 ~ size2added + (1 | year2) + (1 | patchid) + (1 | individ)
> Zero inflation:         
> ~repstatus1 + size1added + size2added + (1 | year2) + (1 | patchid) + 
>     (1 | individ)
> Data: fec.data
>       AIC       BIC    logLik  df.resid 
>  251.2751  284.5233 -113.6376       106 
> Random-effects (co)variances:
> 
> Conditional model:
>  Groups  Name        Std.Dev. 
>  year2   (Intercept) 5.655e-01
>  patchid (Intercept) 2.206e-01
>  individ (Intercept) 9.735e-05
> 
> Zero-inflation model:
>  Groups  Name        Std.Dev. 
>  year2   (Intercept) 7.953e-10
>  patchid (Intercept) 4.954e-07
>  individ (Intercept) 2.361e-07
> 
> 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)   size2added  
>    -0.61722      0.06546  
> 
> Zero-inflation model:
> (Intercept)   repstatus1   size1added   size2added  
>       5.422        2.601       -1.304       -1.802  
> 
> 
> Juvenile survival model:
> [1] 1
> 
> 
> 
> Juvenile observation model:
> [1] 1
> 
> 
> 
> Juvenile size model:
> [1] 1
> 
> 
> 
> Juvenile secondary size model:
> [1] 1
> 
> 
> 
> Juvenile tertiary size model:
> [1] 1
> 
> 
> 
> Juvenile reproduction model:
> [1] 1
> 
> 
> 
> Juvenile maturity model:
> [1] 1
> 
> 
> 
> 
> 
> Number of models in survival table: 16
> 
> Number of models in observation table: 16
> 
> Number of models in size table: 16
> 
> Number of models in secondary size table: 1
> 
> Number of models in tertiary size table: 1
> 
> Number of models in reproduction status table: 16
> 
> Number of models in fecundity table: 256
> 
> 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
> 32       annual covariate a in time t  annucova2
> 33     annual covariate a in time t-1  annucova1
> 34       annual covariate b in time t  annucovb2
> 35     annual covariate b in time t-1  annucovb1
> 36       annual covariate c in time t  annucovc2
> 37     annual covariate c in time t-1  annucovc1
> 
> 
> 
> 
> 
> Quality control:
> 
> Survival model estimated with 74 individuals and 320 individual transitions.
> Survival model accuracy is 0.947.
> Observation status model estimated with 70 individuals and 303 individual transitions.
> Observation status model accuracy is 0.95.
> Primary size model estimated with 70 individuals and 288 individual transitions.
> Primary size model R-squared is 0.803.
> Secondary size model not estimated.
> Tertiary size model not estimated.
> Reproductive status model estimated with 70 individuals and 288 individual transitions.
> Reproductive status model accuracy is 0.74.
> Fecundity model estimated with 51 individuals and 118 individual transitions.
> Fecundity model R-squared is 0.514.
> Juvenile survival model not estimated.
> Juvenile observation status model not estimated.
> Juvenile primary size model not estimated.
> Juvenile secondary size model not estimated.
> Juvenile tertiary size model not estimated.
> Juvenile reproductive status model not estimated.
> Juvenile maturity status model not estimated.

The above code may take some time to run, depending on how powerful a computer it is run on. It is sufficiently complicated that R might crash if it is run while the user does other things in R or R Studio, so please leave your R or R Studio session alone while it runs. As the function runs, it will likely produce some text related to the modeling. Some of the text is meant to provide guideposts to where the modeling stands. Since the vital rates run in order, the user can get a handle on which vital rate best-fit models are finished and which are still waiting to be developed. Other text relates to notes, warnings, and other messages from the modeling functions used, which are found in other CRAN-based packages. We have set quiet = "partial" to prevent this text from getting very long (quiet = TRUE eliminates just about all of it).

The final object is a class lefkoMod object. This is an S3 object, meaning that it is a list, and it is composed of 31 elements. The first 14 elements are the best-fit models, and are in the formats of the functions used to develop them. The next 14 elements are the MuMIn model tables, showing all of the models tested for each vital rate in order of \(\Delta AICc\) (\(\Delta AICc\) is given as the difference between the \(AICc\) values of the current model and the model with the lowest \(AICc\)). The final three elements are a data frame describing the parameters tested (paramnames), the criterion used for determination of the best-fit model (criterion), and quality control data used in summary() calls (qc).

The summary of this lefkoMod object is quite informative. We start off by seeing the best-fit model chosen for each vital rate. In the case of vital rates that are not estimated, they are set to constants, either 1 or 0. Below that, we see how many models were built and compared for each vital rate. The next section is something of a crib sheet, showing us the names of different parameters used in the modeling. Finally, we see a section on quality control. This last section includes information on the numbers of individuals as well as individual transitions used to parameterize each model, and also shows their accuracy, R2, or pseudo-R2 values. We see very high accuracy in survival and observation status, and a high R2 for primary size, but poorer accuracy in reproduction status and low R2 for fecundity.

Looking over the models, we can also see from the summary that historical terms are only included in the fecundity model. This is likely enough to warrant using a historical model, since accurate estimation of fecundity appears to warrant a historical approach (although the R2 is relatively low, at just over 0.50). Regardless, in order to compare MPMs for educational purposes, we will also create a purely ahistorical model set. We will set quiet = "partial" to see less text output as the function works, but you may remove that option to view the guidepost text. Note that a vital rate model set that includes historical terms should never be used to make an ahistorical MPM.

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

Let’s see a summary of this lefkoMod object.

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: surv.data
>      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.117e-05
>  patchid (Intercept) 1.172e-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: obs.data
>      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: size.data
>      AIC      BIC   logLik df.resid 
> 1009.318 1031.296 -498.659      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 (): 2.95e+07 
> 
> Fixed Effects:
> 
> Conditional model:
> (Intercept)   size2added  
>      0.5404       0.0219  
> 
> 
> 
> 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: repst.data
>       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: fec.data
>       AIC       BIC    logLik  df.resid 
>  256.6460  281.5822 -119.3230       109 
> Random-effects (co)variances:
> 
> Conditional model:
>  Groups  Name        Std.Dev.
>  year2   (Intercept) 0.5908  
>  patchid (Intercept) 0.1970  
>  individ (Intercept) 0.3863  
> 
> Zero-inflation model:
>  Groups  Name        Std.Dev. 
>  year2   (Intercept) 2.458e-08
>  patchid (Intercept) 3.189e-07
>  individ (Intercept) 2.445e-04
> 
> Number of obs: 118 / Conditional model: year2, 5; patchid, 3; individ, 51 / Zero-inflation model: year2, 5; patchid, 3; individ, 51
> 
> Fixed Effects:
> 
> Conditional model:
> (Intercept)  
>     -0.2146  
> 
> Zero-inflation model:
> (Intercept)   size2added  
>       4.081       -1.597  
> 
> 
> Juvenile survival model:
> [1] 1
> 
> 
> 
> Juvenile observation model:
> [1] 1
> 
> 
> 
> Juvenile size model:
> [1] 1
> 
> 
> 
> Juvenile secondary size model:
> [1] 1
> 
> 
> 
> Juvenile tertiary size model:
> [1] 1
> 
> 
> 
> Juvenile reproduction model:
> [1] 1
> 
> 
> 
> Juvenile maturity model:
> [1] 1
> 
> 
> 
> 
> 
> Number of models in survival table: 4
> 
> Number of models in observation table: 4
> 
> Number of models in size table: 4
> 
> Number of models in secondary size table: 1
> 
> Number of models in tertiary size table: 1
> 
> Number of models in reproduction status table: 4
> 
> Number of models in fecundity table: 16
> 
> 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
> 32       annual covariate a in time t  annucova2
> 33     annual covariate a in time t-1  annucova1
> 34       annual covariate b in time t  annucovb2
> 35     annual covariate b in time t-1  annucovb1
> 36       annual covariate c in time t  annucovc2
> 37     annual covariate c in time t-1  annucovc1
> 
> 
> 
> 
> 
> Quality control:
> 
> Survival model estimated with 74 individuals and 320 individual transitions.
> Survival model accuracy is 0.947.
> Observation status model estimated with 70 individuals and 303 individual transitions.
> Observation status model accuracy is 0.95.
> Primary size model estimated with 70 individuals and 288 individual transitions.
> Primary size model R-squared is 0.803.
> Secondary size model not estimated.
> Tertiary size model not estimated.
> Reproductive status model estimated with 70 individuals and 288 individual transitions.
> Reproductive status model accuracy is 0.74.
> Fecundity model estimated with 51 individuals and 118 individual transitions.
> Fecundity model R-squared is 0.584.
> Juvenile survival model not estimated.
> Juvenile observation status model not estimated.
> Juvenile primary size model not estimated.
> Juvenile secondary size model not estimated.
> Juvenile tertiary size model not estimated.
> Juvenile reproductive status model not estimated.
> Juvenile maturity status model not estimated.

The ahistorical set of models is similar to the historical case, since historical terms dropped out of most of the historical analysis and left differences only in the best-fit fecundity model. However, similarity is never assured, particularly when history has strong influences on vital rates.

Function modelsearch() has many options that can lead to very complicated global models and searches for vital rate models. For example, up to three size metrics may be used for classification, and these may assume different distributions. Also, up to three individual covariates coded in the hfv dataset may also be included in models, as well as another three annual covariates supplied as vectors in modelsearch()’s arguments. In the case of the former, these covariates may be quantitative (used as fixed factors), or categorical and either fixed or random (options indcova, indcovb, and indcovc, with logical settings random.indcova, random.indcovb, and random.indcovc). In the case of the latter, they must be quantitative. If stage groups are used and were coded into the stageframe, then stage group can be included in models as a categorical fixed factor (logical setting test.group). Age and density may also be included as variables in the modeling. Model tables may be eliminated from the lefkoMod output using show.model.tables = FALSE, and model selection can be eliminated with the global model alone being estimated with the option global.only = TRUE.

5.4 Size and fecundity distributions

Before we create MPMs, let’s discuss response distributions a bit further. The probabilities of survival, observation, and reproductive status are automatically set to the binomial distribution in function modelsearch(), 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 be set to the Gaussian distribution if reasonably symmetric. If there is a strong right skew and the distribution is entirely positive, then a gamma distribution may be warranted. This can be explored by using the plot() function in conjunction with density(). For example, here we look at the primary size distribution used in the Cypripedium candidum case (figure 5.2). Please note that there is no established test to determine whether a Gaussian distribution is better than the gamma, so this decision should be made at the user’s discretion.

plot(density(cypfb_v1$size2added), main = "", xlab = "Sprout number", bty = "n")
Density distribution of size in *Cypripedium candidum*

Figure 5.2: Density distribution of size in Cypripedium candidum

If size or fecundity is a count variable, then it should be set to the Poisson distribution if the mean does not differ significantly from the variance, and this can be tested with the hfv_qc() function. 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 even after including the observation status and reproductive status as vital rates to absorb zeros, then a zero-inflated Poisson or negative binomial distribution may be used. These modeling approaches work by parameterizing two separate models. The first is a binomial model, typically assuming a logit link, to predict excess zero responses. The second model is called a conditional model, and it is the Poisson or negative binomial model that is used to predict non-zero and only some zero responses. In effect, a zero-inflated model is actually two models in which zeros are assumed to result from two different processes, only one of which can result in non-zero counts. Because an extra model is built to cover excess 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 occur 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.

We have assumed that users will only use a single size variable in classification. However, cases may arise in which stages are classified under two or three size variables, and these two or three size variables are also used in vital rate modeling. These size variables can be treated as independent for the purposes of modeling, meaning that they can also have completely different distributions.

Let’s now build some function-based MPMs.

5.5 Using lefkoMod objects to create function-based MPMs

MPM creation from a demographic dataset can be accomplished with nine different functions:

  1. rlefko2() - Creates raw ahistorical MPMs given a dataset, a stageframe, and a supplement table.
  2. rlefko3() - Creates raw historical MPMs given a dataset, a stageframe, and a supplement table.
  3. arlefko2() - Creates raw ahistorical age x stage MPMs given a dataset, a stageframe, and a supplement table.
  4. rleslie() - Creates raw age-based (Leslie) MPMs given a dataset.
  5. flefko2() - Creates function-based ahistorical MPMs given a dataset, a set of models, a stageframe, and a supplement table.
  6. flefko3() - Creates function-based historical MPMs given a dataset, a set of models, a stageframe, and a supplement table.
  7. aflefko2() - Creates function-based ahistorical age x stage MPMs given a dataset, a set of models, a stageframe, and a supplement table.
  8. fleslie() - Creates function-based age-based (Leslie) MPMs given a dataset and a set of models.
  9. mpm_create() - A general, all-purpose MPM creation function. All other MPM creation functions are actually wrappers for this function.

These functions incorporate binary kernels developed to handle the estimation of matrix elements quickly and efficiently. A single run of flefko3(), for example, should be able to yield all annual historical matrices for all patches for the Cypripedium candidum dataset provided with lefko3 in under a minute on most machines (14s or so on the author’s 2019 MacBook Pro with 2.3 GHz 8-Core Intel Core i9), while a single run of flefko2() should typically run in a fraction of a second. Parallel computing should not be necessary even with the slowest of current machines, provided that the machine is current enough to handle at least R 4.3.0.

The output for each of these functions is a lefkoMat object, which is an S3 object and is described in detail in Chapter 4. These lists include elements \(\mathbf{A}\), \(\mathbf{U}\), and \(\mathbf{F}\), which are themselves lists of complete projection matrices, survival-transition matrices, and fecundity matrices, respectively. For example, code such as matobject$A[[1]] would access the first complete projection matrix in a lefkoMat object named matobject. They are followed by elements referred to as ahstages, hstages, and agestages, which provide data frames describing the stages (technically showing the edited stageframe), the historical stage-pairs, and the age-stage pairs shown in the order in which they occur within the matrices, respectively. The labels element is a data frame giving a description of each matrix in the order in which it occurs within the \(\mathbf{A}\), \(\mathbf{U}\), and \(\mathbf{F}\) elements, including the population, patch, and monitoring time (time t) designations. The final elements are quality control outputs that vary in content depending on whether the output matrices are raw or function-based, but nonetheless always include at least the numbers of individuals and individual-transitions used for estimation.

Let’s create function-based MPMs with the lefkoMod objects that we created in this chapter. We will start with the ahistorical function-based MPM. We will also look at a summary of the resulting lefkoMat object, described in section 1.7.1.

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

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 36165 survival transitions were estimated, with 2411 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.
> 
> The dataset contains a total of 74 unique individuals and 320 unique transitions.
> 
> 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.050 0.050 0.050 0.050 0.050 0.050 0.050 0.050 0.050 0.050 0.050 0.050
> 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.916 0.918 0.917 0.917 0.914 0.915 0.917 0.917 0.916 0.914 0.913 0.916
> 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.050 0.050 0.050
> 1st Qu. 0.991 0.991 0.991
> Median  0.999 0.998 0.997
> Mean    0.916 0.915 0.912
> 3rd Qu. 0.999 0.999 0.999
> Max.    1.000 0.999 0.999

Here we have fifteen matrices. Since there are six years of data, there are a total of five pairs of consecutive years with which to estimate transitions. There are also three patches, yielding fifteen total matrices. We also have \(54^{2} = 2916\) elements per matrix, of which 2459 elements are estimated (the rest are zeros). Let’s look at the first function-based matrix.

print(cypmatrix2fp$A[[1]], digits = 3)
>       [,1] [,2] [,3] [,4]   [,5]     [,6]     [,7]     [,8]     [,9]    [,10]
>  [1,] 0.08  0.0  0.0 0.00 0.0000 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
>  [2,] 0.10  0.0  0.0 0.00 0.0000 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
>  [3,] 0.00  0.1  0.0 0.00 0.0000 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
>  [4,] 0.00  0.0  0.1 0.00 0.0000 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
>  [5,] 0.00  0.0  0.0 0.05 0.0500 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
>  [6,] 0.00  0.0  0.0 0.00 0.0329 4.70e-02 3.69e-02 2.81e-02 2.10e-02 1.56e-02
>  [7,] 0.00  0.0  0.0 0.00 0.1660 2.37e-01 2.40e-01 2.34e-01 2.23e-01 2.09e-01
>  [8,] 0.00  0.0  0.0 0.00 0.1044 1.49e-01 1.52e-01 1.50e-01 1.44e-01 1.36e-01
>  [9,] 0.00  0.0  0.0 0.00 0.0656 9.37e-02 9.63e-02 9.55e-02 9.25e-02 8.80e-02
> [10,] 0.00  0.0  0.0 0.00 0.0000 5.90e-02 6.11e-02 6.10e-02 5.96e-02 5.71e-02
> [11,] 0.00  0.0  0.0 0.00 0.0000 3.71e-02 3.87e-02 3.90e-02 3.84e-02 3.71e-02
> [12,] 0.00  0.0  0.0 0.00 0.0000 2.33e-02 2.45e-02 2.49e-02 2.47e-02 2.41e-02
> [13,] 0.00  0.0  0.0 0.00 0.0000 1.47e-02 1.56e-02 1.59e-02 1.59e-02 1.56e-02
> [14,] 0.00  0.0  0.0 0.00 0.0000 9.22e-03 9.86e-03 1.02e-02 1.02e-02 1.01e-02
> [15,] 0.00  0.0  0.0 0.00 0.0000 5.80e-03 6.25e-03 6.50e-03 6.60e-03 6.58e-03
> [16,] 0.00  0.0  0.0 0.00 0.0000 3.64e-03 3.96e-03 4.16e-03 4.25e-03 4.27e-03
> [17,] 0.00  0.0  0.0 0.00 0.0000 2.29e-03 2.51e-03 2.66e-03 2.74e-03 2.77e-03
> [18,] 0.00  0.0  0.0 0.00 0.0000 1.44e-03 1.59e-03 1.70e-03 1.76e-03 1.80e-03
> [19,] 0.00  0.0  0.0 0.00 0.0000 9.06e-04 1.01e-03 1.08e-03 1.14e-03 1.17e-03
> [20,] 0.00  0.0  0.0 0.00 0.0000 5.70e-04 6.40e-04 6.93e-04 7.31e-04 7.58e-04
> [21,] 0.00  0.0  0.0 0.00 0.0000 3.58e-04 4.06e-04 4.43e-04 4.71e-04 4.92e-04
> [22,] 0.00  0.0  0.0 0.00 0.0000 2.25e-04 2.57e-04 2.83e-04 3.03e-04 3.19e-04
> [23,] 0.00  0.0  0.0 0.00 0.0000 1.42e-04 1.63e-04 1.81e-04 1.95e-04 2.07e-04
> [24,] 0.00  0.0  0.0 0.00 0.0000 8.91e-05 1.03e-04 1.15e-04 1.26e-04 1.34e-04
> [25,] 0.00  0.0  0.0 0.00 0.0000 5.60e-05 6.55e-05 7.38e-05 8.10e-05 8.73e-05
> [26,] 0.00  0.0  0.0 0.00 0.0000 3.52e-05 4.15e-05 4.72e-05 5.22e-05 5.66e-05
> [27,] 0.00  0.0  0.0 0.00 0.0000 2.22e-05 2.63e-05 3.01e-05 3.36e-05 3.68e-05
> [28,] 0.00  0.0  0.0 0.00 0.0000 1.39e-05 1.67e-05 1.93e-05 2.16e-05 2.39e-05
> [29,] 0.00  0.0  0.0 0.00 0.0000 8.76e-06 1.06e-05 1.23e-05 1.39e-05 1.55e-05
> [30,] 0.00  0.0  0.0 0.00 0.0000 5.51e-06 6.71e-06 7.86e-06 8.98e-06 1.01e-05
> [31,] 0.00  0.0  0.0 0.00 0.0000 7.38e-02 8.92e-02 1.04e-01 1.19e-01 1.33e-01
> [32,] 0.00  0.0  0.0 0.00 0.0000 4.64e-02 5.65e-02 6.65e-02 7.64e-02 8.63e-02
> [33,] 0.00  0.0  0.0 0.00 0.0000 2.92e-02 3.58e-02 4.25e-02 4.92e-02 5.60e-02
> [34,] 0.00  0.0  0.0 0.00 0.0000 1.83e-02 2.27e-02 2.72e-02 3.17e-02 3.63e-02
> [35,] 0.00  0.0  0.0 0.00 0.0000 1.15e-02 1.44e-02 1.74e-02 2.04e-02 2.36e-02
> [36,] 0.00  0.0  0.0 0.00 0.0000 7.25e-03 9.13e-03 1.11e-02 1.31e-02 1.53e-02
> [37,] 0.00  0.0  0.0 0.00 0.0000 4.56e-03 5.79e-03 7.09e-03 8.47e-03 9.94e-03
> [38,] 0.00  0.0  0.0 0.00 0.0000 2.87e-03 3.67e-03 4.53e-03 5.45e-03 6.45e-03
> [39,] 0.00  0.0  0.0 0.00 0.0000 1.80e-03 2.33e-03 2.89e-03 3.51e-03 4.19e-03
> [40,] 0.00  0.0  0.0 0.00 0.0000 1.13e-03 1.47e-03 1.85e-03 2.26e-03 2.72e-03
> [41,] 0.00  0.0  0.0 0.00 0.0000 7.13e-04 9.35e-04 1.18e-03 1.46e-03 1.76e-03
> [42,] 0.00  0.0  0.0 0.00 0.0000 4.48e-04 5.92e-04 7.55e-04 9.38e-04 1.14e-03
> [43,] 0.00  0.0  0.0 0.00 0.0000 2.82e-04 3.76e-04 4.82e-04 6.04e-04 7.43e-04
> [44,] 0.00  0.0  0.0 0.00 0.0000 1.77e-04 2.38e-04 3.08e-04 3.89e-04 4.82e-04
> [45,] 0.00  0.0  0.0 0.00 0.0000 1.11e-04 1.51e-04 1.97e-04 2.51e-04 3.13e-04
> [46,] 0.00  0.0  0.0 0.00 0.0000 7.01e-05 9.57e-05 1.26e-04 1.61e-04 2.03e-04
> [47,] 0.00  0.0  0.0 0.00 0.0000 4.41e-05 6.06e-05 8.04e-05 1.04e-04 1.32e-04
> [48,] 0.00  0.0  0.0 0.00 0.0000 2.77e-05 3.84e-05 5.14e-05 6.69e-05 8.55e-05
> [49,] 0.00  0.0  0.0 0.00 0.0000 1.74e-05 2.44e-05 3.28e-05 4.31e-05 5.55e-05
> [50,] 0.00  0.0  0.0 0.00 0.0000 1.10e-05 1.54e-05 2.10e-05 2.78e-05 3.60e-05
> [51,] 0.00  0.0  0.0 0.00 0.0000 6.89e-06 9.79e-06 1.34e-05 1.79e-05 2.34e-05
> [52,] 0.00  0.0  0.0 0.00 0.0000 4.33e-06 6.21e-06 8.57e-06 1.15e-05 1.52e-05
> [53,] 0.00  0.0  0.0 0.00 0.0000 2.73e-06 3.94e-06 5.47e-06 7.41e-06 9.85e-06
> [54,] 0.00  0.0  0.0 0.00 0.0000 1.71e-06 2.49e-06 3.50e-06 4.78e-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.02e-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.31e-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.03e-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.32e-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.41e-05 4.58e-05 4.70e-05 4.78e-05 4.80e-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.26e-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.24e-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.90e-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.80e-05 7.23e-05 8.91e-05 1.09e-04 1.31e-04 1.56e-04 1.85e-04
> [51,] 3.01e-05 3.82e-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.29e-05 8.75e-05
> [53,] 1.29e-05 1.66e-05 2.12e-05 2.66e-05 3.32e-05 4.08e-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.40e-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.40e-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.84e-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.97e-03 4.35e-03 3.79e-03 3.28e-03
> [14,] 5.62e-03 5.05e-03 4.51e-03 4.00e-03 3.54e-03 3.11e-03 2.72e-03 2.38e-03
> [15,] 3.89e-03 3.52e-03 3.16e-03 2.83e-03 2.51e-03 2.22e-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.86e-03 1.71e-03 1.56e-03 1.41e-03 1.27e-03 1.14e-03 1.02e-03 9.03e-04
> [18,] 1.29e-03 1.19e-03 1.09e-03 9.96e-04 9.03e-04 8.14e-04 7.31e-04 6.54e-04
> [19,] 8.94e-04 8.31e-04 7.67e-04 7.03e-04 6.42e-04 5.83e-04 5.26e-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.48e-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.16e-04 1.09e-04 1.02e-04 9.43e-05
> [25,] 9.86e-05 9.54e-05 9.16e-05 8.73e-05 8.28e-05 7.80e-05 7.32e-05 6.83e-05
> [26,] 6.83e-05 6.65e-05 6.43e-05 6.17e-05 5.89e-05 5.58e-05 5.27e-05 4.95e-05
> [27,] 4.73e-05 4.64e-05 4.51e-05 4.36e-05 4.18e-05 3.99e-05 3.79e-05 3.58e-05
> [28,] 3.28e-05 3.23e-05 3.17e-05 3.08e-05 2.97e-05 2.86e-05 2.73e-05 2.59e-05
> [29,] 2.27e-05 2.25e-05 2.22e-05 2.17e-05 2.11e-05 2.04e-05 1.96e-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.08e-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.84e-03 9.44e-03 1.00e-02
> [42,] 4.10e-03 4.53e-03 4.97e-03 5.41e-03 5.87e-03 6.33e-03 6.79e-03 7.27e-03
> [43,] 2.84e-03 3.16e-03 3.48e-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.96e-03 3.24e-03 3.52e-03 3.81e-03
> [45,] 1.36e-03 1.53e-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.51e-04 1.06e-03 1.18e-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.13e-04 3.63e-04 4.16e-04 4.75e-04 5.38e-04 6.06e-04 6.80e-04 7.59e-04
> [50,] 2.17e-04 2.53e-04 2.92e-04 3.35e-04 3.82e-04 4.34e-04 4.89e-04 5.49e-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.53e-04 2.88e-04
> [53,] 7.21e-05 8.56e-05 1.01e-04 1.18e-04 1.37e-04 1.59e-04 1.82e-04 2.09e-04
> [54,] 4.99e-05 5.97e-05 7.08e-05 8.34e-05 9.76e-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 1.33e+02 5.03e+02 1.16e+03 1.57e+03
>  [2,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 1.33e+02 5.03e+02 1.16e+03 1.57e+03
>  [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.32e-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.00e-04 7.07e-04 6.22e-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.05e-04 7.92e-04 7.90e-04 7.68e-04 7.34e-04
> [19,] 4.25e-04 3.80e-04 3.38e-04 3.00e-04 5.02e-04 5.05e-04 4.95e-04 4.76e-04
> [20,] 3.09e-04 2.78e-04 2.49e-04 2.23e-04 3.18e-04 3.22e-04 3.19e-04 3.09e-04
> [21,] 2.25e-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.35e-04 1.22e-04 1.28e-04 1.32e-04 1.32e-04 1.30e-04
> [23,] 1.20e-04 1.09e-04 9.98e-05 9.07e-05 8.10e-05 8.41e-05 8.51e-05 8.45e-05
> [24,] 8.72e-05 8.02e-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.42e-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.45e-05 2.31e-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.73e-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.74e-03 8.23e-03 8.71e-03 9.20e-03 1.39e-03 1.66e-03 1.93e-03 2.21e-03
> [43,] 5.64e-03 6.03e-03 6.42e-03 6.82e-03 8.83e-04 1.06e-03 1.24e-03 1.43e-03
> [44,] 4.11e-03 4.42e-03 4.73e-03 5.06e-03 5.60e-04 6.79e-04 8.02e-04 9.31e-04
> [45,] 2.99e-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.43e-04 9.34e-04 1.03e-03 1.13e-03 5.73e-05 7.23e-05 8.88e-05 1.07e-04
> [50,] 6.14e-04 6.84e-04 7.59e-04 8.39e-04 3.63e-05 4.62e-05 5.72e-05 6.96e-05
> [51,] 4.48e-04 5.01e-04 5.60e-04 6.22e-04 2.30e-05 2.95e-05 3.68e-05 4.51e-05
> [52,] 3.26e-04 3.67e-04 4.12e-04 4.61e-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.26e-06 1.21e-05 1.53e-05 1.90e-05
> [54,] 1.73e-04 1.97e-04 2.24e-04 2.53e-04 5.87e-06 7.70e-06 9.84e-06 1.23e-05
>          [,35]    [,36]    [,37]    [,38]    [,39]    [,40]    [,41]    [,42]
>  [1,] 1.69e+03 1.72e+03 1.72e+03 1.72e+03 1.72e+03 1.72e+03 1.72e+03 1.72e+03
>  [2,] 1.69e+03 1.72e+03 1.72e+03 1.72e+03 1.72e+03 1.72e+03 1.72e+03 1.72e+03
>  [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.75e-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.89e-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.83e-04 2.57e-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.70e-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.46e-05 4.22e-05 3.96e-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.05e-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.95e-06 9.85e-06 9.68e-06 9.45e-06 9.18e-06 8.87e-06
> [29,] 6.48e-06 6.58e-06 6.61e-06 6.59e-06 6.52e-06 6.41e-06 6.27e-06 6.10e-06
> [30,] 4.24e-06 4.33e-06 4.39e-06 4.40e-06 4.39e-06 4.35e-06 4.28e-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.72e-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.35e-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.84e-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.85e-03 2.04e-03 2.23e-03
> [45,] 6.97e-04 7.96e-04 9.01e-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.50e-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.67e-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.72e+03 1.72e+03 1.72e+03 1.72e+03 1.72e+03 1.72e+03 1.72e+03 1.72e+03
>  [2,] 1.72e+03 1.72e+03 1.72e+03 1.72e+03 1.72e+03 1.72e+03 1.72e+03 1.72e+03
>  [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.40e-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.17e-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.89e-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.36e-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.69e-04 1.52e-04 1.35e-04 1.20e-04 1.07e-04
> [20,] 1.61e-04 1.46e-04 1.33e-04 1.20e-04 1.08e-04 9.68e-05 8.67e-05 7.76e-05
> [21,] 1.12e-04 1.02e-04 9.31e-05 8.45e-05 7.66e-05 6.92e-05 6.24e-05 5.62e-05
> [22,] 7.74e-05 7.12e-05 6.53e-05 5.97e-05 5.44e-05 4.95e-05 4.49e-05 4.07e-05
> [23,] 5.36e-05 4.96e-05 4.58e-05 4.22e-05 3.87e-05 3.54e-05 3.23e-05 2.94e-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.10e-05 1.96e-05 1.81e-05 1.68e-05 1.54e-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.88e-06 9.27e-06 8.68e-06 8.10e-06
> [28,] 8.53e-06 8.17e-06 7.80e-06 7.41e-06 7.02e-06 6.63e-06 6.25e-06 5.86e-06
> [29,] 5.91e-06 5.70e-06 5.47e-06 5.24e-06 4.99e-06 4.74e-06 4.50e-06 4.25e-06
> [30,] 4.09e-06 3.97e-06 3.84e-06 3.70e-06 3.55e-06 3.39e-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.25e-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.77e-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.77e-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.63e-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.35e-03 2.54e-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.97e-03 2.14e-03
> [47,] 8.06e-04 8.93e-04 9.85e-04 1.08e-03 1.19e-03 1.30e-03 1.42e-03 1.55e-03
> [48,] 5.58e-04 6.22e-04 6.91e-04 7.66e-04 8.46e-04 9.31e-04 1.02e-03 1.12e-03
> [49,] 3.86e-04 4.34e-04 4.85e-04 5.41e-04 6.01e-04 6.66e-04 7.36e-04 8.12e-04
> [50,] 2.68e-04 3.02e-04 3.40e-04 3.82e-04 4.27e-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.81e-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.02e-04 1.18e-04 1.35e-04 1.53e-04 1.74e-04 1.98e-04 2.23e-04
> [54,] 6.15e-05 7.14e-05 8.26e-05 9.51e-05 1.09e-04 1.25e-04 1.42e-04 1.62e-04
>          [,51]    [,52]    [,53]    [,54]
>  [1,] 1.72e+03 1.72e+03 1.72e+03 1.72e+03
>  [2,] 1.72e+03 1.72e+03 1.72e+03 1.72e+03
>  [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.72e-04 7.41e-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.93e-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.86e-05
> [19,] 9.50e-05 8.42e-05 7.44e-05 6.57e-05
> [20,] 6.92e-05 6.17e-05 5.48e-05 4.87e-05
> [21,] 5.04e-05 4.52e-05 4.04e-05 3.61e-05
> [22,] 3.67e-05 3.31e-05 2.98e-05 2.68e-05
> [23,] 2.68e-05 2.43e-05 2.20e-05 1.98e-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.03e-05 9.55e-06 8.80e-06 8.08e-06
> [27,] 7.54e-06 7.00e-06 6.48e-06 5.99e-06
> [28,] 5.49e-06 5.13e-06 4.78e-06 4.44e-06
> [29,] 4.00e-06 3.76e-06 3.52e-06 3.29e-06
> [30,] 2.91e-06 2.75e-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.67e-02 7.74e-02
> [36,] 5.48e-02 5.57e-02 5.66e-02 5.74e-02
> [37,] 3.99e-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.52e-03
> [43,] 5.97e-03 6.32e-03 6.69e-03 7.06e-03
> [44,] 4.35e-03 4.63e-03 4.93e-03 5.23e-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.45e-03 1.58e-03
> [49,] 8.93e-04 9.79e-04 1.07e-03 1.17e-03
> [50,] 6.50e-04 7.18e-04 7.90e-04 8.68e-04
> [51,] 4.74e-04 5.26e-04 5.83e-04 6.44e-04
> [52,] 3.45e-04 3.85e-04 4.29e-04 4.77e-04
> [53,] 2.51e-04 2.82e-04 3.16e-04 3.54e-04
> [54,] 1.83e-04 2.07e-04 2.33e-04 2.62e-04

Notice that this matrix is bigger and more full of non-zero values than the associated raw matrix. This is due to the fact that function-based matrices use kernels to estimate every estimable element, while raw matrices are populated only by proportions of individuals making actual transitions. Thus, if no individuals make a particular transition, then a raw matrix will assign that survival-transition probability a zero, while a function-based matrix will provide a non-zero estimate based on the chosen vital rate linear models.

Let’s now estimate the function-based historical MPM. Because this will have huge dimensions, we will set sparse_output = TRUE to make sure that it does not take up too much memory (standard matrix format should yield a lefkoMat object taking up over three gigabytes, while the sparse matrix format should yield a lefkoMat object taking up only a little over 40 megabytes).

cypmatrix3fp <- flefko3(stageframe = cypframe_fb, supplement = cypsupp3_fb, 
  modelsuite = cypmodels3p, data = cypfb_v1, sparse_output = TRUE)

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 1768620 survival transitions were estimated, with 117908 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.
> 
> The dataset contains a total of 74 unique individuals and 320 unique transitions.
> 
> Vital rate modeling quality control:
> 
> Survival estimated with 74 individuals and 320 individual transitions.
> Observation estimated with 70 individuals and 303 individual transitions.
> Primary size estimated with 70 individuals and 288 individual transitions.
> Secondary size transition not estimated.
> Tertiary size transition not estimated.
> Reproductive status estimated with 70 individuals and 288 individual transitions.
> Fecundity estimated with 51 individuals and 118 individual transitions.
> Juvenile survival not estimated.
> Juvenile observation probability not estimated.
> Juvenile primary size transition not estimated.
> Juvenile secondary size transition not estimated.
> Juvenile tertiary size transition not estimated.
> Juvenile reproduction probability not estimated.
> Juvenile maturity transition probability not estimated.
> 
> Survival probability sum check (each matrix represented by column in order):
>          [,1]  [,2]  [,3]  [,4]  [,5]  [,6]  [,7]  [,8]  [,9] [,10] [,11] [,12]
> Min.    0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
> 1st Qu. 0.965 0.965 0.965 0.965 0.965 0.964 0.965 0.965 0.965 0.964 0.964 0.965
> Median  0.999 1.000 1.000 1.000 0.999 0.998 1.000 0.999 0.999 0.998 0.997 0.999
> Mean    0.820 0.820 0.820 0.820 0.820 0.819 0.820 0.820 0.820 0.819 0.819 0.820
> 3rd Qu. 1.000 1.000 1.000 1.000 1.000 0.999 1.000 1.000 0.999 0.999 0.998 1.000
> Max.    1.000 1.000 1.000 1.000 1.000 0.999 1.000 1.000 1.000 1.000 0.999 1.000
>         [,13] [,14] [,15]
> Min.    0.000 0.000 0.000
> 1st Qu. 0.965 0.964 0.964
> Median  0.999 0.998 0.997
> Mean    0.819 0.819 0.819
> 3rd Qu. 0.999 0.999 0.999
> Max.    1.000 0.999 0.999

Notice the similarities and differences with the ahistorical MPMs. First, we see 15 matrices produced again. Second, these matrices are utterly huge. They have \(54^2 = 2916\) rows and columns, yielding \(2916^2 = 8,503,056\) total elements per matrix. And we have 120,260 elements estimated per matrix. This is vastly more than in the ahistorical 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 10 stages in the stageframe, then only 1000 of the total 10,000 elements in the hMPM are estimable (10% of the elements).

We can also make deVries format hMPMs. Here, we just add a single option regarding format. The resulting summary shows bigger matrices, reflecting the addition of the prior stage for newborns.

cypmatrix3fp_deV <- flefko3(stageframe = cypframe_fb, supplement = cypsupp3_fb, 
  modelsuite = cypmodels3p, data = cypfb_v1, format = "deVries",
  sparse_output = TRUE)

summary(cypmatrix3fp_deV)
> 
> This historical lefkoMat object contains 15 matrices.
> 
> Each matrix is square with 2970 rows and columns, and a total of 8820900 elements.
> A total of 1767900 survival transitions were estimated, with 117860 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.
> 
> The dataset contains a total of 74 unique individuals and 320 unique transitions.
> 
> Vital rate modeling quality control:
> 
> Survival estimated with 74 individuals and 320 individual transitions.
> Observation estimated with 70 individuals and 303 individual transitions.
> Primary size estimated with 70 individuals and 288 individual transitions.
> Secondary size transition not estimated.
> Tertiary size transition not estimated.
> Reproductive status estimated with 70 individuals and 288 individual transitions.
> Fecundity estimated with 51 individuals and 118 individual transitions.
> Juvenile survival not estimated.
> Juvenile observation probability not estimated.
> Juvenile primary size transition not estimated.
> Juvenile secondary size transition not estimated.
> Juvenile tertiary size transition not estimated.
> Juvenile reproduction probability not estimated.
> Juvenile maturity transition probability not estimated.
> 
> Survival probability sum check (each matrix represented by column in order):
>          [,1]  [,2]  [,3]  [,4]  [,5]  [,6]  [,7]  [,8]  [,9] [,10] [,11] [,12]
> Min.    0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
> 1st Qu. 0.965 0.965 0.965 0.965 0.965 0.964 0.965 0.965 0.965 0.964 0.964 0.965
> Median  0.999 1.000 1.000 1.000 0.999 0.998 0.999 0.999 0.999 0.998 0.997 0.999
> Mean    0.803 0.804 0.804 0.804 0.803 0.803 0.804 0.803 0.803 0.803 0.802 0.803
> 3rd Qu. 1.000 1.000 1.000 1.000 1.000 0.999 1.000 1.000 0.999 0.999 0.998 1.000
> Max.    1.000 1.000 1.000 1.000 1.000 0.999 1.000 1.000 1.000 1.000 0.999 1.000
>         [,13] [,14] [,15]
> Min.    0.000 0.000 0.000
> 1st Qu. 0.965 0.964 0.964
> Median  0.998 0.998 0.997
> Mean    0.803 0.803 0.802
> 3rd Qu. 0.999 0.999 0.999
> Max.    1.000 0.999 0.999

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.

cyp2fp_mean <- lmean(cypmatrix2fp)
cyp3fp_mean <- lmean(cypmatrix3fp)

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 9644 survival transitions were estimated, with 2411 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.
> 
> The dataset contains a total of 74 unique individuals and 320 unique transitions.
> 
> 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.050 0.050 0.050 0.050
> 1st Qu. 0.991 0.991 0.991 0.991
> Median  1.000 0.999 0.998 0.999
> Mean    0.916 0.916 0.914 0.916
> 3rd Qu. 1.000 0.999 0.999 0.999
> Max.    1.000 1.000 0.999 1.000
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 471632 survival transitions were estimated, with 117908 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.
> 
> The dataset contains a total of 74 unique individuals and 320 unique transitions.
> 
> Vital rate modeling quality control:
> 
> Survival estimated with 74 individuals and 320 individual transitions.
> Observation estimated with 70 individuals and 303 individual transitions.
> Primary size estimated with 70 individuals and 288 individual transitions.
> Secondary size transition not estimated.
> Tertiary size transition not estimated.
> Reproductive status estimated with 70 individuals and 288 individual transitions.
> Fecundity estimated with 51 individuals and 118 individual transitions.
> Juvenile survival not estimated.
> Juvenile observation probability not estimated.
> Juvenile primary size transition not estimated.
> Juvenile secondary size transition not estimated.
> Juvenile tertiary size transition not estimated.
> Juvenile reproduction probability not estimated.
> Juvenile maturity transition probability not estimated.
> 
> Survival probability sum check (each matrix represented by column in order):
>          [,1]  [,2]  [,3]  [,4]
> Min.    0.000 0.000 0.000 0.000
> 1st Qu. 0.965 0.965 0.964 0.965
> Median  1.000 0.999 0.998 0.999
> Mean    0.820 0.820 0.819 0.820
> 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, meaning that each matrix used per mean has the same number of estimated elements. We have four mean matrices in each case - the first three are patch-level means for each of three patches, and the final matrix in each case is the population mean matrix. The labels element in each lefkoMat object shows this order.

cyp2fp_mean$labels
>   pop patch
> 1   1     A
> 2   1     B
> 3   1     C
> 4   1     0

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

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

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

Let’s see the model suite summaries. First the historical set.

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: surv.data
>      AIC      BIC   logLik deviance df.resid 
> 128.1324 143.2057 -60.0662 120.1324      316 
> Random effects:
>  Groups  Name        Std.Dev.
>  individ (Intercept) 1.198379
>  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: obs.data
>      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)
> Data: size.data
>       AIC       BIC    logLik  df.resid 
>  245.0192  274.3229 -114.5096       280 
> Random-effects (co)variances:
> 
> Conditional model:
>  Groups  Name        Std.Dev.
>  year2   (Intercept) 0.1174  
>  individ (Intercept) 0.9671  
> 
> Number of obs: 288 / Conditional model: year2, 5; individ, 70
> 
> Dispersion parameter for truncated_nbinom2 family (): 2.75e+14 
> 
> Fixed Effects:
> 
> Conditional model:
> (Intercept)   repstatus1   repstatus2   size1added   size2added  
>    0.510798     0.044818     0.060950    -0.005991     0.021952  
> 
> 
> 
> 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: repst.data
>       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.4631       1.6457       0.1715  
> 
> 
> 
> Fecundity model:
> Formula:          feca2 ~ size2added + (1 | year2) + (1 | individ)
> Zero inflation:         ~size2added + (1 | year2) + (1 | individ)
> Data: fec.data
>       AIC       BIC    logLik  df.resid 
>  248.8609  271.0264 -116.4305       110 
> Random-effects (co)variances:
> 
> Conditional model:
>  Groups  Name        Std.Dev.
>  year2   (Intercept) 0.5760  
>  individ (Intercept) 0.1639  
> 
> Zero-inflation model:
>  Groups  Name        Std.Dev. 
>  year2   (Intercept) 1.642e-06
>  individ (Intercept) 3.089e-04
> 
> Number of obs: 118 / Conditional model: year2, 5; individ, 51 / Zero-inflation model: year2, 5; individ, 51
> 
> Fixed Effects:
> 
> Conditional model:
> (Intercept)   size2added  
>    -0.54014      0.06174  
> 
> Zero-inflation model:
> (Intercept)   size2added  
>       3.865       -1.574  
> 
> 
> Juvenile survival model:
> [1] 1
> 
> 
> 
> Juvenile observation model:
> [1] 1
> 
> 
> 
> Juvenile size model:
> [1] 1
> 
> 
> 
> Juvenile secondary size model:
> [1] 1
> 
> 
> 
> Juvenile tertiary size model:
> [1] 1
> 
> 
> 
> Juvenile reproduction model:
> [1] 1
> 
> 
> 
> Juvenile maturity model:
> [1] 1
> 
> 
> 
> 
> 
> Number of models in survival table: 16
> 
> Number of models in observation table: 16
> 
> Number of models in size table: 16
> 
> Number of models in secondary size table: 1
> 
> Number of models in tertiary size table: 1
> 
> Number of models in reproduction status table: 16
> 
> Number of models in fecundity table: 256
> 
> 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
> 32       annual covariate a in time t  annucova2
> 33     annual covariate a in time t-1  annucova1
> 34       annual covariate b in time t  annucovb2
> 35     annual covariate b in time t-1  annucovb1
> 36       annual covariate c in time t  annucovc2
> 37     annual covariate c in time t-1  annucovc1
> 
> 
> 
> 
> 
> Quality control:
> 
> Survival model estimated with 74 individuals and 320 individual transitions.
> Survival model accuracy is 0.947.
> Observation status model estimated with 70 individuals and 303 individual transitions.
> Observation status model accuracy is 0.95.
> Primary size model estimated with 70 individuals and 288 individual transitions.
> Primary size model R-squared is 0.812.
> Secondary size model not estimated.
> Tertiary size model not estimated.
> Reproductive status model estimated with 70 individuals and 288 individual transitions.
> Reproductive status model accuracy is 0.715.
> Fecundity model estimated with 51 individuals and 118 individual transitions.
> Fecundity model R-squared is 0.562.
> Juvenile survival model not estimated.
> Juvenile observation status model not estimated.
> Juvenile primary size model not estimated.
> Juvenile secondary size model not estimated.
> Juvenile tertiary size model not estimated.
> Juvenile reproductive status model not estimated.
> Juvenile maturity status model not estimated.

Now the ahistorical set.

summary(cypmodels2)
> This LefkoMod object includes 5 linear models.
> Best-fit model criterion used: aicc&k
> 
> 
> 
> Survival model:
> Generalized linear mixed model fit by maximum likelihood (Laplace
>   Approximation) [glmerMod]
>  Family: binomial  ( logit )
> Formula: alive3 ~ size2added + (1 | year2) + (1 | individ)
>    Data: surv.data
>      AIC      BIC   logLik deviance df.resid 
> 128.1324 143.2057 -60.0662 120.1324      316 
> Random effects:
>  Groups  Name        Std.Dev.
>  individ (Intercept) 1.198379
>  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: obs.data
>      AIC      BIC   logLik deviance df.resid 
> 118.2567 133.1117 -55.1284 110.2567      299 
> Random effects:
>  Groups  Name        Std.Dev. 
>  individ (Intercept) 1.078e-05
>  year2   (Intercept) 8.776e-01
> Number of obs: 303, groups:  individ, 70; year2, 5
> Fixed Effects:
> (Intercept)   size2added  
>      2.4904       0.3134  
> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
> 
> 
> 
> Size model:
> Formula:          size3added ~ (1 | year2) + (1 | individ)
> Data: size.data
>       AIC       BIC    logLik  df.resid 
> 1008.2666 1022.9184 -500.1333       284 
> Random-effects (co)variances:
> 
> Conditional model:
>  Groups  Name        Std.Dev.
>  year2   (Intercept) 0.1109  
>  individ (Intercept) 1.0561  
> 
> Number of obs: 288 / Conditional model: year2, 5; individ, 70
> 
> Dispersion parameter for truncated_nbinom2 family (): 9.34e+09 
> 
> Fixed Effects:
> 
> Conditional model:
> (Intercept)  
>      0.5761  
> 
> 
> 
> 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: repst.data
>       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.4631       1.6457       0.1715  
> 
> 
> 
> Fecundity model:
> Formula:          feca2 ~ size2added + (1 | year2) + (1 | individ)
> Zero inflation:         ~size2added + (1 | year2) + (1 | individ)
> Data: fec.data
>       AIC       BIC    logLik  df.resid 
>  248.8609  271.0264 -116.4305       110 
> Random-effects (co)variances:
> 
> Conditional model:
>  Groups  Name        Std.Dev.
>  year2   (Intercept) 0.5760  
>  individ (Intercept) 0.1639  
> 
> Zero-inflation model:
>  Groups  Name        Std.Dev. 
>  year2   (Intercept) 1.642e-06
>  individ (Intercept) 3.089e-04
> 
> Number of obs: 118 / Conditional model: year2, 5; individ, 51 / Zero-inflation model: year2, 5; individ, 51
> 
> Fixed Effects:
> 
> Conditional model:
> (Intercept)   size2added  
>    -0.54014      0.06174  
> 
> Zero-inflation model:
> (Intercept)   size2added  
>       3.865       -1.574  
> 
> 
> Juvenile survival model:
> [1] 1
> 
> 
> 
> Juvenile observation model:
> [1] 1
> 
> 
> 
> Juvenile size model:
> [1] 1
> 
> 
> 
> Juvenile secondary size model:
> [1] 1
> 
> 
> 
> Juvenile tertiary size model:
> [1] 1
> 
> 
> 
> Juvenile reproduction model:
> [1] 1
> 
> 
> 
> Juvenile maturity model:
> [1] 1
> 
> 
> 
> 
> 
> Number of models in survival table: 4
> 
> Number of models in observation table: 4
> 
> Number of models in size table: 4
> 
> Number of models in secondary size table: 1
> 
> Number of models in tertiary size table: 1
> 
> Number of models in reproduction status table: 4
> 
> Number of models in fecundity table: 16
> 
> 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
> 32       annual covariate a in time t  annucova2
> 33     annual covariate a in time t-1  annucova1
> 34       annual covariate b in time t  annucovb2
> 35     annual covariate b in time t-1  annucovb1
> 36       annual covariate c in time t  annucovc2
> 37     annual covariate c in time t-1  annucovc1
> 
> 
> 
> 
> 
> Quality control:
> 
> Survival model estimated with 74 individuals and 320 individual transitions.
> Survival model accuracy is 0.947.
> Observation status model estimated with 70 individuals and 303 individual transitions.
> Observation status model accuracy is 0.95.
> Primary size model estimated with 70 individuals and 288 individual transitions.
> Primary size model R-squared is 0.822.
> Secondary size model not estimated.
> Tertiary size model not estimated.
> Reproductive status model estimated with 70 individuals and 288 individual transitions.
> Reproductive status model accuracy is 0.715.
> Fecundity model estimated with 51 individuals and 118 individual transitions.
> Fecundity model R-squared is 0.562.
> Juvenile survival model not estimated.
> Juvenile observation status model not estimated.
> Juvenile primary size model not estimated.
> Juvenile secondary size model not estimated.
> Juvenile tertiary size model not estimated.
> Juvenile reproductive status model not estimated.
> Juvenile maturity status model not estimated.

A close look at the model output shows that the best-fit models have changed in structure. Particularly, patch is no longer included - it had been included previously as a random factor in all models. The lack of patch as a random factor has also led to other changes in the best-fit models. For example, size now includes historical reproductive status and historical size as factors in the historical model set. Let’s use these models to create new MPMs. First the ahistorical MPM.

cypmatrix2f <- flefko2(stageframe = cypframe_fb, supplement = cypsupp2_fb, 
  modelsuite = cypmodels2, data = cypfb_v1)
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 12055 survival transitions were estimated, with 2411 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.
> 
> The dataset contains a total of 74 unique individuals and 320 unique transitions.
> 
> 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.050 0.050 0.050 0.050 0.050
> 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.916 0.917 0.917 0.917 0.914
> 3rd Qu. 1.000 1.000 1.000 1.000 1.000
> Max.    1.000 1.000 1.000 1.000 1.000

Now the historical MPM.

cypmatrix3f <- flefko3(stageframe = cypframe_fb, supplement = cypsupp3_fb, 
  modelsuite = cypmodels3, data = cypfb_v1, sparse_output = TRUE)
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 589540 survival transitions were estimated, with 117908 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.
> 
> The dataset contains a total of 74 unique individuals and 320 unique transitions.
> 
> 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.999 1.000 1.000 0.999 0.999
> Mean    0.820 0.820 0.820 0.820 0.820
> 3rd Qu. 1.000 1.000 1.000 1.000 1.000
> Max.    1.000 1.000 1.000 1.000 1.000

We see that the main difference here is that there are only five matrices in each MPM, since the matrices are now annual matrices representing the whole population rather than each patch. The elements are NOT simple averages of the patch matrices. Since we are not differentiating between individuals in different patches, patches with greater numbers of individuals have a greater impact on the population-level matrices that we now created. So, these matrices are fundamentally different from those of the previous case.

5.6 Using stage groups for complex MPMs

Let’s imagine a more complex life history. For example, imagine that our study organism had a life history in which the juvenile morphology inevitably led to stages that were non-reproductive but otherwise just like the reproductive adult stages, and that once the organism became reproductive it stayed so until death. The resulting life history model might look like this (figure 5.3).

 Imaginary life history model based on Cypripedium candidum, with permanent transitions from non-reproductive to reproductive adult stages
Imaginary life history model based on Cypripedium candidum, with permanent transitions from non-reproductive to reproductive adult stages

We can alter our code to account for this subtle but nonetheless major change with just two steps. First, we will add stage groups to our stage frame. We will assign the dormant seed stage, three protocorm stages, and seedling stage to a juvenile stage group; the dormant and non-reproductive adult stages to an adult stage group; and the reproductive adult stages to a second adult stage group. This only requires adding one further vector coding these groups. Please bear in mind that stage groups must be numbered sequentially, and the first stage group must be group 0.

groupvec <- c(rep(0, 5), rep(1, 25), rep(2, 24))

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

Next, we will add an extra line to the supplement table to set transitions from group 2 to group 1 to a value of 0.0. This effectively disallows transitions back from reproductive to non-reproductive adult stages. We will do this with our ahistorical supplement table and create only ahistorical MPMs, but this may also be done with the historical supplement table to create historical MPMs.

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

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

Finally, let’s create our new ahistorical MPM, and take a look at the first matrix.

cypmatrix2fp_group <- flefko2(stageframe = cypframe_fb_group, data = cypfb_v1,
  supplement = cypsupp2_fb_group, modelsuite = cypmodels2p)

cypmatrix2fp_group$A[[1]]
>       [,1] [,2] [,3] [,4]       [,5]         [,6]         [,7]         [,8]
>  [1,] 0.08  0.0  0.0 0.00 0.00000000 0.000000e+00 0.000000e+00 0.000000e+00
>  [2,] 0.10  0.0  0.0 0.00 0.00000000 0.000000e+00 0.000000e+00 0.000000e+00
>  [3,] 0.00  0.1  0.0 0.00 0.00000000 0.000000e+00 0.000000e+00 0.000000e+00
>  [4,] 0.00  0.0  0.1 0.00 0.00000000 0.000000e+00 0.000000e+00 0.000000e+00
>  [5,] 0.00  0.0  0.0 0.05 0.05000000 0.000000e+00 0.000000e+00 0.000000e+00
>  [6,] 0.00  0.0  0.0 0.00 0.03291481 4.702115e-02 3.686950e-02 2.809355e-02
>  [7,] 0.00  0.0  0.0 0.00 0.16595816 2.370831e-01 2.396968e-01 2.339911e-01
>  [8,] 0.00  0.0  0.0 0.00 0.10435852 1.490836e-01 1.519488e-01 1.495175e-01
>  [9,] 0.00  0.0  0.0 0.00 0.06562317 9.374738e-02 9.632354e-02 9.553985e-02
> [10,] 0.00  0.0  0.0 0.00 0.00000000 5.895063e-02 6.106152e-02 6.104881e-02
> [11,] 0.00  0.0  0.0 0.00 0.00000000 3.706958e-02 3.870818e-02 3.900945e-02
> [12,] 0.00  0.0  0.0 0.00 0.00000000 2.331025e-02 2.453793e-02 2.492657e-02
> [13,] 0.00  0.0  0.0 0.00 0.00000000 1.465805e-02 1.555511e-02 1.592778e-02
> [14,] 0.00  0.0  0.0 0.00 0.00000000 9.217339e-03 9.860708e-03 1.017766e-02
> [15,] 0.00  0.0  0.0 0.00 0.00000000 5.796087e-03 6.250910e-03 6.503400e-03
> [16,] 0.00  0.0  0.0 0.00 0.00000000 3.644720e-03 3.962583e-03 4.155594e-03
> [17,] 0.00  0.0  0.0 0.00 0.00000000 2.291888e-03 2.511965e-03 2.655375e-03
> [18,] 0.00  0.0  0.0 0.00 0.00000000 1.441195e-03 1.592387e-03 1.696752e-03
> [19,] 0.00  0.0  0.0 0.00 0.00000000 9.062583e-04 1.009448e-03 1.084204e-03
> [20,] 0.00  0.0  0.0 0.00 0.00000000 5.698772e-04 6.399100e-04 6.927934e-04
> [21,] 0.00  0.0  0.0 0.00 0.00000000 3.583526e-04 4.056524e-04 4.426866e-04
> [22,] 0.00  0.0  0.0 0.00 0.00000000 2.253408e-04 2.571516e-04 2.828714e-04
> [23,] 0.00  0.0  0.0 0.00 0.00000000 1.416998e-04 1.630138e-04 1.807514e-04
> [24,] 0.00  0.0  0.0 0.00 0.00000000 8.910425e-05 1.033379e-04 1.154980e-04
> [25,] 0.00  0.0  0.0 0.00 0.00000000 5.603092e-05 6.550804e-05 7.380181e-05
> [26,] 0.00  0.0  0.0 0.00 0.00000000 3.523360e-05 4.152692e-05 4.715847e-05
> [27,] 0.00  0.0  0.0 0.00 0.00000000 2.215574e-05 2.632479e-05 3.013369e-05
> [28,] 0.00  0.0  0.0 0.00 0.00000000 1.393207e-05 1.668784e-05 1.925506e-05
> [29,] 0.00  0.0  0.0 0.00 0.00000000 8.760822e-06 1.057877e-05 1.230375e-05
> [30,] 0.00  0.0  0.0 0.00 0.00000000 5.509017e-06 6.706104e-06 7.861950e-06
> [31,] 0.00  0.0  0.0 0.00 0.00000000 7.376274e-02 8.917310e-02 1.040893e-01
> [32,] 0.00  0.0  0.0 0.00 0.00000000 4.638380e-02 5.652870e-02 6.651183e-02
> [33,] 0.00  0.0  0.0 0.00 0.00000000 2.916726e-02 3.583473e-02 4.250025e-02
> [34,] 0.00  0.0  0.0 0.00 0.00000000 1.834108e-02 2.271639e-02 2.715715e-02
> [35,] 0.00  0.0  0.0 0.00 0.00000000 1.153332e-02 1.440040e-02 1.735309e-02
> [36,] 0.00  0.0  0.0 0.00 0.00000000 7.252429e-03 9.128713e-03 1.108842e-02
> [37,] 0.00  0.0  0.0 0.00 0.00000000 4.560503e-03 5.786883e-03 7.085364e-03
> [38,] 0.00  0.0  0.0 0.00 0.00000000 2.867755e-03 3.668427e-03 4.527462e-03
> [39,] 0.00  0.0  0.0 0.00 0.00000000 1.803314e-03 2.325493e-03 2.892993e-03
> [40,] 0.00  0.0  0.0 0.00 0.00000000 1.133968e-03 1.474179e-03 1.848588e-03
> [41,] 0.00  0.0  0.0 0.00 0.00000000 7.130663e-04 9.345128e-04 1.181225e-03
> [42,] 0.00  0.0  0.0 0.00 0.00000000 4.483934e-04 5.924073e-04 7.547887e-04
> [43,] 0.00  0.0  0.0 0.00 0.00000000 2.819606e-04 3.755394e-04 4.823009e-04
> [44,] 0.00  0.0  0.0 0.00 0.00000000 1.773037e-04 2.380623e-04 3.081844e-04
> [45,] 0.00  0.0  0.0 0.00 0.00000000 1.114929e-04 1.509127e-04 1.969261e-04
> [46,] 0.00  0.0  0.0 0.00 0.00000000 7.010941e-05 9.566673e-05 1.258334e-04
> [47,] 0.00  0.0  0.0 0.00 0.00000000 4.408650e-05 6.064515e-05 8.040604e-05
> [48,] 0.00  0.0  0.0 0.00 0.00000000 2.772266e-05 3.844423e-05 5.137849e-05
> [49,] 0.00  0.0  0.0 0.00 0.00000000 1.743268e-05 2.437061e-05 3.283023e-05
> [50,] 0.00  0.0  0.0 0.00 0.00000000 1.096209e-05 1.544904e-05 2.097812e-05
> [51,] 0.00  0.0  0.0 0.00 0.00000000 6.893230e-06 9.793470e-06 1.340477e-05
> [52,] 0.00  0.0  0.0 0.00 0.00000000 4.334630e-06 6.208286e-06 8.565484e-06
> [53,] 0.00  0.0  0.0 0.00 0.00000000 2.725721e-06 3.935563e-06 5.473241e-06
> [54,] 0.00  0.0  0.0 0.00 0.00000000 1.713999e-06 2.494836e-06 3.497335e-06
>               [,9]        [,10]        [,11]        [,12]        [,13]
>  [1,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [2,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [3,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [4,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [5,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [6,] 2.104751e-02 1.561422e-02 1.151723e-02 8.466545e-03 6.211278e-03
>  [7,] 2.230428e-01 2.089835e-01 1.931980e-01 1.765937e-01 1.597941e-01
>  [8,] 1.436449e-01 1.356363e-01 1.263516e-01 1.163645e-01 1.060782e-01
>  [9,] 9.251080e-02 8.803182e-02 8.263402e-02 7.667713e-02 7.041933e-02
> [10,] 5.957919e-02 5.713517e-02 5.404270e-02 5.052556e-02 4.674741e-02
> [11,] 3.837043e-02 3.708236e-02 3.534396e-02 3.329327e-02 3.103296e-02
> [12,] 2.471148e-02 2.406751e-02 2.311497e-02 2.193824e-02 2.060102e-02
> [13,] 1.591479e-02 1.562051e-02 1.511720e-02 1.445596e-02 1.367585e-02
> [14,] 1.024951e-02 1.013816e-02 9.886659e-03 9.525600e-03 9.078625e-03
> [15,] 6.600931e-03 6.579953e-03 6.465881e-03 6.276790e-03 6.026786e-03
> [16,] 4.251159e-03 4.270578e-03 4.228690e-03 4.136023e-03 4.000842e-03
> [17,] 2.737849e-03 2.771727e-03 2.765566e-03 2.725387e-03 2.655932e-03
> [18,] 1.763241e-03 1.798930e-03 1.808682e-03 1.795864e-03 1.763123e-03
> [19,] 1.135569e-03 1.167557e-03 1.182879e-03 1.183365e-03 1.170438e-03
> [20,] 7.313341e-04 7.577781e-04 7.736034e-04 7.797656e-04 7.769873e-04
> [21,] 4.709968e-04 4.918197e-04 5.059371e-04 5.138181e-04 5.157979e-04
> [22,] 3.033333e-04 3.192051e-04 3.308832e-04 3.385748e-04 3.424090e-04
> [23,] 1.953540e-04 2.071732e-04 2.163978e-04 2.231002e-04 2.273060e-04
> [24,] 1.258127e-04 1.344613e-04 1.415243e-04 1.470095e-04 1.508956e-04
> [25,] 8.102639e-05 8.726926e-05 9.255696e-05 9.687028e-05 1.001710e-04
> [26,] 5.218295e-05 5.664025e-05 6.053230e-05 6.383162e-05 6.649788e-05
> [27,] 3.360708e-05 3.676114e-05 3.958816e-05 4.206115e-05 4.414418e-05
> [28,] 2.164377e-05 2.385903e-05 2.589068e-05 2.771574e-05 2.930482e-05
> [29,] 1.393911e-05 1.548520e-05 1.693252e-05 1.826298e-05 1.945381e-05
> [30,] 8.977121e-06 1.005034e-05 1.107388e-05 1.203419e-05 1.291428e-05
> [31,] 1.186398e-01 1.329197e-01 1.469316e-01 1.605917e-01 1.737576e-01
> [32,] 7.640689e-02 8.626871e-02 9.609338e-02 1.058202e-01 1.153478e-01
> [33,] 4.920788e-02 5.599086e-02 6.284512e-02 6.972906e-02 7.657290e-02
> [34,] 3.169106e-02 3.633967e-02 4.110075e-02 4.594721e-02 5.083241e-02
> [35,] 2.040981e-02 2.358549e-02 2.687991e-02 3.027641e-02 3.374476e-02
> [36,] 1.314441e-02 1.530766e-02 1.757948e-02 1.995031e-02 2.240124e-02
> [37,] 8.465316e-03 9.935107e-03 1.149699e-02 1.314604e-02 1.487091e-02
> [38,] 5.451867e-03 6.448169e-03 7.519038e-03 8.662441e-03 9.871958e-03
> [39,] 3.511134e-03 4.185046e-03 4.917455e-03 5.708021e-03 6.553434e-03
> [40,] 2.261255e-03 2.716215e-03 3.216018e-03 3.761238e-03 4.350454e-03
> [41,] 1.456303e-03 1.762901e-03 2.103278e-03 2.478427e-03 2.888020e-03
> [42,] 9.378941e-04 1.144173e-03 1.375545e-03 1.633133e-03 1.917193e-03
> [43,] 6.040264e-04 7.426012e-04 8.996072e-04 1.076135e-03 1.272716e-03
> [44,] 3.890076e-04 4.819694e-04 5.883437e-04 7.091074e-04 8.448841e-04
> [45,] 2.505302e-04 3.128120e-04 3.847771e-04 4.672586e-04 5.608707e-04
> [46,] 1.613475e-04 2.030239e-04 2.516444e-04 3.078950e-04 3.723303e-04
> [47,] 1.039117e-04 1.317683e-04 1.645756e-04 2.028840e-04 2.471690e-04
> [48,] 6.692164e-05 8.552142e-05 1.076325e-04 1.336882e-04 1.640815e-04
> [49,] 4.309915e-05 5.550585e-05 7.039175e-05 8.809241e-05 1.089244e-04
> [50,] 2.775689e-05 3.602489e-05 4.603625e-05 5.804753e-05 7.230877e-05
> [51,] 1.787611e-05 2.338118e-05 3.010773e-05 3.824979e-05 4.800170e-05
> [52,] 1.151264e-05 1.517506e-05 1.969047e-05 2.520428e-05 3.186561e-05
> [53,] 7.414420e-06 9.849046e-06 1.287758e-05 1.660809e-05 2.115378e-05
> [54,] 4.775065e-06 6.392313e-06 8.421946e-06 1.094372e-05 1.404279e-05
>              [,14]        [,15]        [,16]        [,17]        [,18]
>  [1,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [2,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [3,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [4,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [5,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [6,] 4.551060e-03 3.331976e-03 2.438204e-03 1.783578e-03 1.304415e-03
>  [7,] 1.432509e-01 1.273033e-01 1.122052e-01 9.813890e-02 8.522326e-02
>  [8,] 9.579369e-02 8.574462e-02 7.611355e-02 6.703890e-02 5.861857e-02
>  [9,] 6.405845e-02 5.775294e-02 5.163108e-02 4.579442e-02 4.031924e-02
> [10,] 4.283669e-02 3.889926e-02 3.502357e-02 3.128227e-02 2.773253e-02
> [11,] 2.864544e-02 2.620044e-02 2.375798e-02 2.136899e-02 1.907509e-02
> [12,] 1.915557e-02 1.764720e-02 1.611606e-02 1.459720e-02 1.312030e-02
> [13,] 1.280957e-02 1.188620e-02 1.093221e-02 9.971381e-03 9.024449e-03
> [14,] 8.565920e-03 8.005904e-03 7.415785e-03 6.811472e-03 6.207229e-03
> [15,] 5.728139e-03 5.392344e-03 5.030444e-03 4.652931e-03 4.269479e-03
> [16,] 3.830478e-03 3.631992e-03 3.412365e-03 3.178428e-03 2.936649e-03
> [17,] 2.561489e-03 2.446313e-03 2.314753e-03 2.171191e-03 2.019896e-03
> [18,] 1.712900e-03 1.647705e-03 1.570196e-03 1.483145e-03 1.389332e-03
> [19,] 1.145438e-03 1.109805e-03 1.065131e-03 1.013140e-03 9.556157e-04
> [20,] 7.659688e-04 7.475046e-04 7.225239e-04 6.920780e-04 6.572950e-04
> [21,] 5.122130e-04 5.034787e-04 4.901189e-04 4.727600e-04 4.521031e-04
> [22,] 3.425233e-04 3.391161e-04 3.324686e-04 3.229434e-04 3.109672e-04
> [23,] 2.290496e-04 2.284103e-04 2.255277e-04 2.206034e-04 2.138906e-04
> [24,] 1.531684e-04 1.538448e-04 1.529851e-04 1.506946e-04 1.471190e-04
> [25,] 1.024256e-04 1.036216e-04 1.037763e-04 1.029398e-04 1.011919e-04
> [26,] 6.849331e-05 6.979388e-05 7.039590e-05 7.031843e-05 6.960219e-05
> [27,] 4.580234e-05 4.700939e-05 4.775255e-05 4.803467e-05 4.787403e-05
> [28,] 3.062860e-05 3.166298e-05 3.239260e-05 3.281259e-05 3.292889e-05
> [29,] 2.048173e-05 2.132648e-05 2.197328e-05 2.241435e-05 2.264927e-05
> [30,] 1.369639e-05 1.436436e-05 1.490542e-05 1.531129e-05 1.557870e-05
> [31,] 1.862584e-01 1.979216e-01 2.085940e-01 2.181551e-01 2.265257e-01
> [32,] 1.245533e-01 1.333093e-01 1.414982e-01 1.490222e-01 1.558098e-01
> [33,] 8.329038e-02 8.978996e-02 9.598428e-02 1.017974e-01 1.071696e-01
> [34,] 5.569733e-02 6.047767e-02 6.511024e-02 6.953803e-02 7.371380e-02
> [35,] 3.724551e-02 4.073449e-02 4.416706e-02 4.750158e-02 5.070210e-02
> [36,] 2.490654e-02 2.743655e-02 2.996040e-02 3.244844e-02 3.487410e-02
> [37,] 1.665532e-02 1.847978e-02 2.032342e-02 2.216560e-02 2.398723e-02
> [38,] 1.113762e-02 1.244698e-02 1.378625e-02 1.514137e-02 1.649898e-02
> [39,] 7.447867e-03 8.383614e-03 9.351800e-03 1.034310e-02 1.134839e-02
> [40,] 4.980483e-03 5.646750e-03 6.343726e-03 7.065396e-03 7.805692e-03
> [41,] 3.330512e-03 3.803345e-03 4.303220e-03 4.826387e-03 5.368939e-03
> [42,] 2.227155e-03 2.561728e-03 2.919058e-03 3.296916e-03 3.692883e-03
> [43,] 1.489327e-03 1.725442e-03 1.980122e-03 2.252130e-03 2.540052e-03
> [44,] 9.959316e-04 1.162164e-03 1.343201e-03 1.538435e-03 1.747108e-03
> [45,] 6.659920e-04 7.827711e-04 9.111510e-04 1.050909e-03 1.201702e-03
> [46,] 4.453573e-04 5.272323e-04 6.180727e-04 7.178779e-04 8.265592e-04
> [47,] 2.978160e-04 3.551152e-04 4.192651e-04 4.903840e-04 5.685269e-04
> [48,] 1.991533e-04 2.391864e-04 2.844054e-04 3.349824e-04 3.910463e-04
> [49,] 1.331763e-04 1.611030e-04 1.929244e-04 2.288272e-04 2.689709e-04
> [50,] 8.905670e-05 1.085103e-04 1.308688e-04 1.563124e-04 1.850045e-04
> [51,] 5.955334e-05 7.308668e-05 8.877393e-05 1.067773e-04 1.272505e-04
> [52,] 3.982407e-05 4.922724e-05 6.021915e-05 7.293982e-05 8.752588e-05
> [53,] 2.663086e-05 3.315681e-05 4.084923e-05 4.982535e-05 6.020237e-05
> [54,] 1.780839e-05 2.233264e-05 2.770978e-05 3.403581e-05 4.140861e-05
>              [,19]        [,20]        [,21]        [,22]        [,23]
>  [1,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [2,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [3,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [4,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [5,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [6,] 9.538315e-04 6.973975e-04 5.098657e-04 3.727414e-04 2.724849e-04
>  [7,] 7.352031e-02 6.304332e-02 5.376563e-02 4.563004e-02 3.855795e-02
>  [8,] 5.091328e-02 4.395064e-02 3.773021e-02 3.222924e-02 2.740847e-02
>  [9,] 3.525777e-02 3.064018e-02 2.647730e-02 2.276404e-02 1.948299e-02
> [10,] 2.441623e-02 2.136080e-02 1.858053e-02 1.607861e-02 1.384926e-02
> [11,] 1.690840e-02 1.489168e-02 1.303895e-02 1.135659e-02 9.844583e-03
> [12,] 1.170917e-02 1.038173e-02 9.150128e-03 8.021345e-03 6.997907e-03
> [13,] 8.108678e-03 7.237620e-03 6.421133e-03 5.665607e-03 4.974381e-03
> [14,] 5.615311e-03 5.045706e-03 4.506052e-03 4.001711e-03 3.535981e-03
> [15,] 3.888639e-03 3.517613e-03 3.162137e-03 2.826474e-03 2.513511e-03
> [16,] 2.692907e-03 2.452303e-03 2.219040e-03 1.996385e-03 1.786700e-03
> [17,] 1.864855e-03 1.709623e-03 1.557219e-03 1.410079e-03 1.270055e-03
> [18,] 1.291424e-03 1.191863e-03 1.092783e-03 9.959621e-04 9.028035e-04
> [19,] 8.943196e-04 8.309073e-04 7.668645e-04 7.034643e-04 6.417474e-04
> [20,] 6.193220e-04 5.792669e-04 5.381497e-04 4.968684e-04 4.561786e-04
> [21,] 4.288845e-04 4.038358e-04 3.776484e-04 3.509463e-04 3.242693e-04
> [22,] 2.970052e-04 2.815340e-04 2.650160e-04 2.478791e-04 2.305030e-04
> [23,] 2.056780e-04 1.962714e-04 1.859759e-04 1.750811e-04 1.638504e-04
> [24,] 1.424333e-04 1.368306e-04 1.305092e-04 1.236626e-04 1.164711e-04
> [25,] 9.863600e-05 9.539142e-05 9.158526e-05 8.734493e-05 8.279215e-05
> [26,] 6.830606e-05 6.650211e-05 6.427026e-05 6.169315e-05 5.885184e-05
> [27,] 4.730238e-05 4.636193e-05 4.510187e-05 4.357488e-05 4.183414e-05
> [28,] 3.275720e-05 3.232121e-05 3.165039e-05 3.077765e-05 2.973731e-05
> [29,] 2.268457e-05 2.253273e-05 2.221077e-05 2.173876e-05 2.113842e-05
> [30,] 1.570921e-05 1.570869e-05 1.558648e-05 1.535444e-05 1.502600e-05
> [31,] 2.336695e-01 2.395901e-01 2.443261e-01 2.479426e-01 2.505241e-01
> [32,] 1.618176e-01 1.670302e-01 1.714567e-01 1.751259e-01 1.780822e-01
> [33,] 1.120597e-01 1.164451e-01 1.203203e-01 1.236943e-01 1.265876e-01
> [34,] 7.760207e-02 8.117968e-02 8.443516e-02 8.736732e-02 8.998334e-02
> [35,] 5.373993e-02 5.659440e-02 5.925265e-02 6.170897e-02 6.396361e-02
> [36,] 3.721525e-02 3.945478e-02 4.158075e-02 4.358605e-02 4.546778e-02
> [37,] 2.577180e-02 2.750589e-02 2.917943e-02 3.078554e-02 3.232024e-02
> [38,] 1.784713e-02 1.917573e-02 2.047676e-02 2.174433e-02 2.297447e-02
> [39,] 1.235925e-02 1.336835e-02 1.436964e-02 1.535838e-02 1.633113e-02
> [40,] 8.558862e-03 9.319746e-03 1.008394e-02 1.084787e-02 1.160880e-02
> [41,] 5.927067e-03 6.497259e-03 7.076439e-03 7.662031e-03 8.251977e-03
> [42,] 4.104532e-03 4.529563e-03 4.965915e-03 5.411818e-03 5.865822e-03
> [43,] 2.842414e-03 3.157784e-03 3.484847e-03 3.822456e-03 4.169651e-03
> [44,] 1.968390e-03 2.201449e-03 2.445503e-03 2.699863e-03 2.963948e-03
> [45,] 1.363123e-03 1.534740e-03 1.716140e-03 1.906957e-03 2.106888e-03
> [46,] 9.439712e-04 1.069943e-03 1.204307e-03 1.346915e-03 1.497657e-03
> [47,] 6.537061e-04 7.459109e-04 8.451265e-04 9.513483e-04 1.064592e-03
> [48,] 4.526956e-04 5.200116e-04 5.930704e-04 6.719528e-04 7.567526e-04
> [49,] 3.134946e-04 3.625260e-04 4.161891e-04 4.746113e-04 5.379288e-04
> [50,] 2.170970e-04 2.527350e-04 2.920621e-04 3.352257e-04 3.823804e-04
> [51,] 1.503411e-04 1.761941e-04 2.049556e-04 2.367754e-04 2.718107e-04
> [52,] 1.041122e-04 1.228337e-04 1.438282e-04 1.672384e-04 1.932134e-04
> [53,] 7.209833e-05 8.563350e-05 1.009320e-04 1.181232e-04 1.373435e-04
> [54,] 4.992856e-05 5.969938e-05 7.082934e-05 8.343234e-05 9.762904e-05
>              [,24]        [,25]        [,26]        [,27]        [,28]
>  [1,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [2,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [3,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [4,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [5,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [6,] 1.991889e-04 1.456059e-04 1.064355e-04 7.780170e-05 5.687068e-05
>  [7,] 3.245761e-02 2.723105e-02 2.277952e-02 1.900751e-02 1.582547e-02
>  [8,] 2.321754e-02 1.959974e-02 1.649585e-02 1.384709e-02 1.159714e-02
>  [9,] 1.660794e-02 1.410705e-02 1.194552e-02 1.008768e-02 8.498567e-03
> [10,] 1.187997e-02 1.015365e-02 8.650384e-03 7.348936e-03 6.227881e-03
> [11,] 8.497966e-03 7.308162e-03 6.264202e-03 5.353743e-03 4.563887e-03
> [12,] 6.078755e-03 5.260102e-03 4.536240e-03 3.900233e-03 3.344487e-03
> [13,] 4.348247e-03 3.785996e-03 3.284932e-03 2.841343e-03 2.450892e-03
> [14,] 3.110383e-03 2.724997e-03 2.378793e-03 2.069935e-03 1.796051e-03
> [15,] 2.224915e-03 1.961336e-03 1.722610e-03 1.507960e-03 1.316174e-03
> [16,] 1.591524e-03 1.411686e-03 1.247433e-03 1.098558e-03 9.645126e-04
> [17,] 1.138447e-03 1.016071e-03 9.033324e-04 8.003056e-04 7.068097e-04
> [18,] 8.143522e-04 7.313242e-04 6.541508e-04 5.830273e-04 5.179610e-04
> [19,] 5.825214e-04 5.263758e-04 4.737053e-04 4.247388e-04 3.795698e-04
> [20,] 4.166885e-04 3.788627e-04 3.430351e-04 3.094247e-04 2.781546e-04
> [21,] 2.980651e-04 2.726891e-04 2.484099e-04 2.254177e-04 2.038360e-04
> [22,] 2.132116e-04 1.962700e-04 1.798867e-04 1.642181e-04 1.493742e-04
> [23,] 1.525142e-04 1.412667e-04 1.302655e-04 1.196339e-04 1.094637e-04
> [24,] 1.090963e-04 1.016777e-04 9.433216e-05 8.715398e-05 8.021668e-05
> [25,] 7.803862e-05 7.318325e-05 6.831091e-05 6.349219e-05 5.878402e-05
> [26,] 5.582249e-05 5.267417e-05 4.946755e-05 4.625443e-05 4.307784e-05
> [27,] 3.993087e-05 3.791261e-05 3.582207e-05 3.369662e-05 3.156810e-05
> [28,] 2.856330e-05 2.728787e-05 2.594066e-05 2.454819e-05 2.313359e-05
> [29,] 2.043187e-05 1.964064e-05 1.878501e-05 1.788350e-05 1.695265e-05
> [30,] 1.461530e-05 1.413649e-05 1.360322e-05 1.302823e-05 1.242317e-05
> [31,] 2.521665e-01 2.529708e-01 2.530381e-01 2.524654e-01 2.513439e-01
> [32,] 1.803794e-01 1.820775e-01 1.832383e-01 1.839226e-01 1.841887e-01
> [33,] 1.290288e-01 1.310516e-01 1.326925e-01 1.339887e-01 1.349763e-01
> [34,] 9.229672e-02 9.432533e-02 9.608968e-02 9.761152e-02 9.891272e-02
> [35,] 6.602157e-02 6.789133e-02 6.958363e-02 7.111057e-02 7.248476e-02
> [36,] 4.722647e-02 4.886527e-02 5.038919e-02 5.180447e-02 5.311795e-02
> [37,] 3.378198e-02 3.517112e-02 3.648948e-02 3.773986e-02 3.892566e-02
> [38,] 2.416488e-02 2.531467e-02 2.642397e-02 2.749371e-02 2.852532e-02
> [39,] 1.728559e-02 1.822041e-02 1.913499e-02 2.002933e-02 2.090379e-02
> [40,] 1.236471e-02 1.311427e-02 1.385666e-02 1.459148e-02 1.531862e-02
> [41,] 8.844709e-03 9.439089e-03 1.003434e-02 1.062998e-02 1.122572e-02
> [42,] 6.326786e-03 6.793852e-03 7.266399e-03 7.744003e-03 8.226383e-03
> [43,] 4.525669e-03 4.889923e-03 5.261985e-03 5.641552e-03 6.028420e-03
> [44,] 3.237296e-03 3.519557e-03 3.810482e-03 4.109903e-03 4.417719e-03
> [45,] 2.315698e-03 2.533226e-03 2.759372e-03 2.994089e-03 3.237373e-03
> [46,] 1.656463e-03 1.823308e-03 1.998207e-03 2.181211e-03 2.372397e-03
> [47,] 1.184899e-03 1.312339e-03 1.447008e-03 1.589025e-03 1.738529e-03
> [48,] 8.475803e-04 9.445650e-04 1.047855e-03 1.157614e-03 1.274021e-03
> [49,] 6.062901e-04 6.798574e-04 7.588072e-04 8.433287e-04 9.336221e-04
> [50,] 4.336906e-04 4.893322e-04 5.494925e-04 6.143699e-04 6.841727e-04
> [51,] 3.102271e-04 3.522003e-04 3.979166e-04 4.475721e-04 5.013723e-04
> [52,] 2.219112e-04 2.534987e-04 2.881525e-04 3.260589e-04 3.674134e-04
> [53,] 1.587373e-04 1.824575e-04 2.086665e-04 2.375358e-04 2.692462e-04
> [54,] 1.135477e-04 1.313251e-04 1.511064e-04 1.730462e-04 1.973077e-04
>              [,29]        [,30]        [,31]        [,32]        [,33]
>  [1,] 0.000000e+00 0.000000e+00 1.327003e+02 5.028390e+02 1.155397e+03
>  [2,] 0.000000e+00 0.000000e+00 1.327003e+02 5.028390e+02 1.155397e+03
>  [3,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [4,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [5,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [6,] 4.157051e-05 3.038649e-05 0.000000e+00 0.000000e+00 0.000000e+00
>  [7,] 1.315133e-02 1.091139e-02 0.000000e+00 0.000000e+00 0.000000e+00
>  [8,] 9.693598e-03 8.088643e-03 0.000000e+00 0.000000e+00 0.000000e+00
>  [9,] 7.144970e-03 5.996136e-03 0.000000e+00 0.000000e+00 0.000000e+00
> [10,] 5.266423e-03 4.444954e-03 0.000000e+00 0.000000e+00 0.000000e+00
> [11,] 3.881782e-03 3.295058e-03 0.000000e+00 0.000000e+00 0.000000e+00
> [12,] 2.861189e-03 2.442636e-03 0.000000e+00 0.000000e+00 0.000000e+00
> [13,] 2.108929e-03 1.810734e-03 0.000000e+00 0.000000e+00 0.000000e+00
> [14,] 1.554452e-03 1.342302e-03 0.000000e+00 0.000000e+00 0.000000e+00
> [15,] 1.145757e-03 9.950528e-04 0.000000e+00 0.000000e+00 0.000000e+00
> [16,] 8.445162e-04 7.376357e-04 0.000000e+00 0.000000e+00 0.000000e+00
> [17,] 6.224771e-04 5.468116e-04 0.000000e+00 0.000000e+00 0.000000e+00
> [18,] 4.588162e-04 4.053531e-04 0.000000e+00 0.000000e+00 0.000000e+00
> [19,] 3.381848e-04 3.004895e-04 0.000000e+00 0.000000e+00 0.000000e+00
> [20,] 2.492697e-04 2.227537e-04 0.000000e+00 0.000000e+00 0.000000e+00
> [21,] 1.837320e-04 1.651280e-04 0.000000e+00 0.000000e+00 0.000000e+00
> [22,] 1.354254e-04 1.224099e-04 0.000000e+00 0.000000e+00 0.000000e+00
> [23,] 9.981954e-05 9.074284e-05 0.000000e+00 0.000000e+00 0.000000e+00
> [24,] 7.357511e-05 6.726794e-05 0.000000e+00 0.000000e+00 0.000000e+00
> [25,] 5.423084e-05 4.986593e-05 0.000000e+00 0.000000e+00 0.000000e+00
> [26,] 3.997253e-05 3.696576e-05 0.000000e+00 0.000000e+00 0.000000e+00
> [27,] 2.946301e-05 2.740283e-05 0.000000e+00 0.000000e+00 0.000000e+00
> [28,] 2.171663e-05 2.031380e-05 0.000000e+00 0.000000e+00 0.000000e+00
> [29,] 1.600692e-05 1.505868e-05 0.000000e+00 0.000000e+00 0.000000e+00
> [30,] 1.179840e-05 1.116305e-05 0.000000e+00 0.000000e+00 0.000000e+00
> [31,] 2.497565e-01 2.477777e-01 2.097253e-01 2.291910e-01 2.445251e-01
> [32,] 1.840908e-01 1.836784e-01 1.329493e-01 1.464503e-01 1.574801e-01
> [33,] 1.356899e-01 1.361613e-01 8.427934e-02 9.357996e-02 1.014210e-01
> [34,] 1.000145e-01 1.009368e-01 5.342644e-02 5.979646e-02 6.531754e-02
> [35,] 7.371879e-02 7.482476e-02 3.386814e-02 3.820922e-02 4.206607e-02
> [36,] 5.433674e-02 5.546782e-02 2.146973e-02 2.441523e-02 2.709156e-02
> [37,] 4.005059e-02 4.111847e-02 1.361011e-02 1.560104e-02 1.744762e-02
> [38,] 2.952054e-02 3.048124e-02 8.627735e-03 9.968874e-03 1.123669e-02
> [39,] 2.175904e-02 2.259584e-02 5.469302e-03 6.369990e-03 7.236698e-03
> [40,] 1.603818e-02 1.675036e-02 3.467106e-03 4.070347e-03 4.660608e-03
> [41,] 1.182144e-02 1.241710e-02 2.197871e-03 2.600902e-03 3.001544e-03
> [42,] 8.713363e-03 9.204830e-03 1.393277e-03 1.661945e-03 1.933067e-03
> [43,] 6.422457e-03 6.823569e-03 8.832273e-04 1.061963e-03 1.244942e-03
> [44,] 4.733872e-03 5.058332e-03 5.598963e-04 6.785815e-04 8.017724e-04
> [45,] 3.489249e-03 3.749757e-03 3.549300e-04 4.336054e-04 5.163607e-04
> [46,] 2.571860e-03 2.779706e-03 2.249976e-04 2.770686e-04 3.325488e-04
> [47,] 1.895670e-03 2.060605e-03 1.426307e-04 1.770435e-04 2.141694e-04
> [48,] 1.397263e-03 1.527533e-03 9.041659e-05 1.131287e-04 1.379303e-04
> [49,] 1.029896e-03 1.132364e-03 5.731698e-05 7.228784e-05 8.883042e-05
> [50,] 7.591171e-04 8.394252e-04 3.633444e-05 4.619106e-05 5.720893e-05
> [51,] 5.595310e-04 6.222685e-04 2.303316e-05 2.951553e-05 3.684393e-05
> [52,] 4.124198e-04 4.612895e-04 1.460120e-05 1.886007e-05 2.372838e-05
> [53,] 3.039869e-04 3.419553e-04 9.256010e-06 1.205136e-05 1.528165e-05
> [54,] 2.240631e-04 2.534925e-04 5.867579e-06 7.700670e-06 9.841750e-06
>              [,34]        [,35]        [,36]        [,37]        [,38]
>  [1,] 1.567226e+03 1.689138e+03 1.716169e+03 1.721748e+03 1.722883e+03
>  [2,] 1.567226e+03 1.689138e+03 1.716169e+03 1.721748e+03 1.722883e+03
>  [3,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [4,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [5,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [6,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [7,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [8,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [9,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [10,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [11,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [12,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [13,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [14,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [15,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [16,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [17,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [18,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [19,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [20,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [21,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [22,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [23,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [24,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [25,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [26,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [27,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [28,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [29,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [30,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [31,] 2.566282e-01 2.661638e-01 2.735994e-01 2.792718e-01 2.834376e-01
> [32,] 1.665590e-01 1.740713e-01 1.802853e-01 1.853927e-01 1.895383e-01
> [33,] 1.081016e-01 1.138427e-01 1.187971e-01 1.230717e-01 1.267467e-01
> [34,] 7.016102e-02 7.445320e-02 7.828003e-02 8.170035e-02 8.475708e-02
> [35,] 4.553651e-02 4.869243e-02 5.158177e-02 5.423624e-02 5.667813e-02
> [36,] 2.955450e-02 3.184488e-02 3.398925e-02 3.600437e-02 3.790138e-02
> [37,] 1.918172e-02 2.082657e-02 2.239685e-02 2.390126e-02 2.534513e-02
> [38,] 1.244948e-02 1.362059e-02 1.475816e-02 1.586670e-02 1.694861e-02
> [39,] 8.080070e-03 8.907873e-03 9.724727e-03 1.053300e-02 1.133375e-02
> [40,] 5.244197e-03 5.825754e-03 6.408003e-03 6.992264e-03 7.579021e-03
> [41,] 3.403634e-03 3.810047e-03 4.222484e-03 4.641768e-03 5.068187e-03
> [42,] 2.209056e-03 2.491773e-03 2.782360e-03 3.081407e-03 3.389160e-03
> [43,] 1.433740e-03 1.629621e-03 1.833406e-03 2.045572e-03 2.266374e-03
> [44,] 9.305386e-04 1.065773e-03 1.208103e-03 1.357939e-03 1.515553e-03
> [45,] 6.039462e-04 6.970162e-04 7.960662e-04 9.014590e-04 1.013469e-03
> [46,] 3.919784e-04 4.558490e-04 5.245592e-04 5.984276e-04 6.777198e-04
> [47,] 2.544052e-04 2.981255e-04 3.456526e-04 3.972622e-04 4.531998e-04
> [48,] 1.651162e-04 1.949742e-04 2.277640e-04 2.637199e-04 3.030604e-04
> [49,] 1.071652e-04 1.275133e-04 1.500826e-04 1.750687e-04 2.026603e-04
> [50,] 6.955326e-05 8.339375e-05 9.889530e-05 1.162182e-04 1.355215e-04
> [51,] 4.514206e-05 5.453956e-05 6.516598e-05 7.715070e-05 9.062495e-05
> [52,] 2.929849e-05 3.566891e-05 4.294041e-05 5.121598e-05 6.060204e-05
> [53,] 1.901556e-05 2.332749e-05 2.829512e-05 3.399939e-05 4.052535e-05
> [54,] 1.234164e-05 1.525619e-05 1.864476e-05 2.257027e-05 2.709981e-05
>              [,39]        [,40]        [,41]        [,42]        [,43]
>  [1,] 1.723112e+03 1.723159e+03 1.723168e+03 1.723170e+03 1.723171e+03
>  [2,] 1.723112e+03 1.723159e+03 1.723168e+03 1.723170e+03 1.723171e+03
>  [3,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [4,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [5,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [6,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [7,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [8,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [9,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [10,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [11,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [12,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [13,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [14,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [15,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [16,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [17,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [18,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [19,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [20,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [21,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [22,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [23,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [24,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [25,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [26,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [27,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [28,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [29,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [30,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [31,] 2.863051e-01 2.880517e-01 2.888329e-01 2.887868e-01 2.880363e-01
> [32,] 1.928397e-01 1.953978e-01 1.973024e-01 1.986344e-01 1.994670e-01
> [33,] 1.298864e-01 1.325467e-01 1.347777e-01 1.366254e-01 1.381322e-01
> [34,] 8.748445e-02 8.991208e-02 9.206694e-02 9.397420e-02 9.565740e-02
> [35,] 5.892480e-02 6.099121e-02 6.289113e-02 6.463768e-02 6.624336e-02
> [36,] 3.968856e-02 4.137294e-02 4.296107e-02 4.445932e-02 4.587395e-02
> [37,] 2.673207e-02 2.806504e-02 2.934680e-02 3.058017e-02 3.176800e-02
> [38,] 1.800528e-02 1.903771e-02 2.004686e-02 2.103377e-02 2.199955e-02
> [39,] 1.212738e-02 1.291410e-02 1.369406e-02 1.446752e-02 1.523483e-02
> [40,] 8.168351e-03 8.760183e-03 9.354441e-03 9.951103e-03 1.055021e-02
> [41,] 5.501760e-03 5.942406e-03 6.390039e-03 6.844604e-03 7.306091e-03
> [42,] 3.705688e-03 4.030988e-03 4.365050e-03 4.707880e-03 5.059515e-03
> [43,] 2.495951e-03 2.734392e-03 2.981775e-03 3.238191e-03 3.503746e-03
> [44,] 1.681138e-03 1.854855e-03 2.036857e-03 2.227304e-03 2.426367e-03
> [45,] 1.132324e-03 1.258227e-03 1.391382e-03 1.531993e-03 1.680274e-03
> [46,] 7.626721e-04 8.535094e-04 9.504558e-04 1.053741e-03 1.163601e-03
> [47,] 5.136947e-04 5.789719e-04 6.492584e-04 7.247878e-04 8.058009e-04
> [48,] 3.459970e-04 3.927414e-04 4.435099e-04 4.985262e-04 5.580223e-04
> [49,] 2.330449e-04 2.664133e-04 3.029626e-04 3.428981e-04 3.864340e-04
> [50,] 1.569665e-04 1.807195e-04 2.069544e-04 2.358534e-04 2.676080e-04
> [51,] 1.057241e-04 1.225898e-04 1.413710e-04 1.622255e-04 1.853203e-04
> [52,] 7.121006e-05 8.315788e-05 9.657084e-05 1.115826e-04 1.283355e-04
> [53,] 4.796325e-05 5.640955e-05 6.596775e-05 7.674912e-05 8.887313e-05
> [54,] 3.230545e-05 3.826501e-05 4.506272e-05 5.278986e-05 6.154521e-05
>              [,44]        [,45]        [,46]        [,47]        [,48]
>  [1,] 1.723171e+03 1.723171e+03 1.723171e+03 1.723171e+03 1.723171e+03
>  [2,] 1.723171e+03 1.723171e+03 1.723171e+03 1.723171e+03 1.723171e+03
>  [3,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [4,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [5,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [6,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [7,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [8,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [9,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [10,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [11,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [12,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [13,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [14,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [15,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [16,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [17,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [18,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [19,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [20,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [21,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [22,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [23,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [24,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [25,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [26,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [27,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [28,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [29,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [30,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [31,] 2.866902e-01 2.848441e-01 2.825816e-01 2.799750e-01 2.770864e-01
> [32,] 1.998660e-01 1.998903e-01 1.995920e-01 1.990170e-01 1.982051e-01
> [33,] 1.393366e-01 1.402737e-01 1.409751e-01 1.414689e-01 1.417798e-01
> [34,] 9.713845e-02 9.843753e-02 9.957303e-02 1.005615e-01 1.014178e-01
> [35,] 6.772006e-02 6.907887e-02 7.033006e-02 7.148298e-02 7.254604e-02
> [36,] 4.721102e-02 4.847633e-02 4.967527e-02 5.081284e-02 5.189354e-02
> [37,] 3.291316e-02 3.401843e-02 3.508646e-02 3.611972e-02 3.712042e-02
> [38,] 2.294540e-02 2.387254e-02 2.478214e-02 2.567528e-02 2.655293e-02
> [39,] 1.599638e-02 1.675264e-02 1.750403e-02 1.825097e-02 1.899381e-02
> [40,] 1.115188e-02 1.175622e-02 1.236338e-02 1.297349e-02 1.358663e-02
> [41,] 7.774528e-03 8.249966e-03 8.732460e-03 9.222055e-03 9.718771e-03
> [42,] 5.420011e-03 5.789441e-03 6.167880e-03 6.555391e-03 6.952019e-03
> [43,] 3.778560e-03 4.062760e-03 4.356474e-03 4.659823e-03 4.972910e-03
> [44,] 2.634222e-03 2.851055e-03 3.077049e-03 3.312381e-03 3.557216e-03
> [45,] 1.836448e-03 2.000738e-03 2.173370e-03 2.354567e-03 2.544543e-03
> [46,] 1.280279e-03 1.404024e-03 1.535087e-03 1.673717e-03 1.820159e-03
> [47,] 8.925464e-04 9.852788e-04 1.084257e-03 1.189742e-03 1.301994e-03
> [48,] 6.222386e-04 6.914227e-04 7.658285e-04 8.457143e-04 9.313408e-04
> [49,] 4.337935e-04 4.852082e-04 5.409172e-04 6.011661e-04 6.662056e-04
> [50,] 3.024191e-04 3.404965e-04 3.820587e-04 4.273319e-04 4.765493e-04
> [51,] 2.108314e-04 2.389445e-04 2.698543e-04 3.037639e-04 3.408847e-04
> [52,] 1.469811e-04 1.676801e-04 1.906025e-04 2.159270e-04 2.438412e-04
> [53,] 1.024678e-04 1.176701e-04 1.346257e-04 1.534892e-04 1.744242e-04
> [54,] 7.143543e-05 8.257538e-05 9.508831e-05 1.091060e-04 1.247689e-04
>              [,49]        [,50]        [,51]        [,52]        [,53]
>  [1,] 1.723171e+03 1.723171e+03 1.723171e+03 1.723171e+03 1.723171e+03
>  [2,] 1.723171e+03 1.723171e+03 1.723171e+03 1.723171e+03 1.723171e+03
>  [3,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [4,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [5,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [6,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [7,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [8,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
>  [9,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [10,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [11,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [12,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [13,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [14,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [15,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [16,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [17,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [18,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [19,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [20,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [21,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [22,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [23,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [24,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [25,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [26,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [27,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [28,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [29,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [30,] 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
> [31,] 2.739690e-01 2.706678e-01 2.672210e-01 2.636608e-01 2.600142e-01
> [32,] 1.971911e-01 1.960049e-01 1.946721e-01 1.932147e-01 1.916516e-01
> [33,] 1.419297e-01 1.419375e-01 1.418197e-01 1.415907e-01 1.412628e-01
> [34,] 1.021549e-01 1.027845e-01 1.033165e-01 1.037599e-01 1.041221e-01
> [35,] 7.352673e-02 7.443167e-02 7.526668e-02 7.603682e-02 7.674648e-02
> [36,] 5.292138e-02 5.389992e-02 5.483222e-02 5.572096e-02 5.656839e-02
> [37,] 3.809054e-02 3.903178e-02 3.994559e-02 4.083318e-02 4.169550e-02
> [38,] 2.741594e-02 2.826498e-02 2.910060e-02 2.992318e-02 3.073297e-02
> [39,] 1.973282e-02 2.046817e-02 2.119996e-02 2.192817e-02 2.265270e-02
> [40,] 1.420284e-02 1.482209e-02 1.544429e-02 1.606930e-02 1.669688e-02
> [41,] 1.022259e-02 1.073346e-02 1.125126e-02 1.177583e-02 1.230696e-02
> [42,] 7.357783e-03 7.772665e-03 8.196608e-03 8.629511e-03 9.071227e-03
> [43,] 5.295817e-03 5.628599e-03 5.971277e-03 6.323838e-03 6.686232e-03
> [44,] 3.811702e-03 4.075966e-03 4.350110e-03 4.634206e-03 4.928296e-03
> [45,] 2.743500e-03 2.951623e-03 3.169081e-03 3.396018e-03 3.632555e-03
> [46,] 1.974653e-03 2.137427e-03 2.308694e-03 2.488654e-03 2.677488e-03
> [47,] 1.421271e-03 1.547824e-03 1.681897e-03 1.823724e-03 1.973526e-03
> [48,] 1.022970e-03 1.120861e-03 1.225272e-03 1.336453e-03 1.454649e-03
> [49,] 7.362898e-04 8.116750e-04 8.926178e-04 9.793735e-04 1.072195e-03
> [50,] 5.299498e-04 5.877768e-04 6.502773e-04 7.177000e-04 7.902946e-04
> [51,] 3.814351e-04 4.256403e-04 4.737308e-04 5.259417e-04 5.825113e-04
> [52,] 2.745407e-04 3.082287e-04 3.451157e-04 3.854182e-04 4.293582e-04
> [53,] 1.976026e-04 2.232047e-04 2.514188e-04 2.824404e-04 3.164719e-04
> [54,] 1.422259e-04 1.616344e-04 1.831601e-04 2.069767e-04 2.332655e-04
>              [,54]
>  [1,] 1.723171e+03
>  [2,] 1.723171e+03
>  [3,] 0.000000e+00
>  [4,] 0.000000e+00
>  [5,] 0.000000e+00
>  [6,] 0.000000e+00
>  [7,] 0.000000e+00
>  [8,] 0.000000e+00
>  [9,] 0.000000e+00
> [10,] 0.000000e+00
> [11,] 0.000000e+00
> [12,] 0.000000e+00
> [13,] 0.000000e+00
> [14,] 0.000000e+00
> [15,] 0.000000e+00
> [16,] 0.000000e+00
> [17,] 0.000000e+00
> [18,] 0.000000e+00
> [19,] 0.000000e+00
> [20,] 0.000000e+00
> [21,] 0.000000e+00
> [22,] 0.000000e+00
> [23,] 0.000000e+00
> [24,] 0.000000e+00
> [25,] 0.000000e+00
> [26,] 0.000000e+00
> [27,] 0.000000e+00
> [28,] 0.000000e+00
> [29,] 0.000000e+00
> [30,] 0.000000e+00
> [31,] 2.563037e-01
> [32,] 1.899987e-01
> [33,] 1.408466e-01
> [34,] 1.044100e-01
> [35,] 7.739946e-02
> [36,] 5.737645e-02
> [37,] 4.253334e-02
> [38,] 3.153009e-02
> [39,] 2.337335e-02
> [40,] 1.732674e-02
> [41,] 1.284436e-02
> [42,] 9.521566e-03
> [43,] 7.058366e-03
> [44,] 5.232388e-03
> [45,] 3.878785e-03
> [46,] 2.875355e-03
> [47,] 2.131509e-03
> [48,] 1.580094e-03
> [49,] 1.171329e-03
> [50,] 8.683096e-04
> [51,] 6.436805e-04
> [52,] 4.771623e-04
> [53,] 3.537219e-04
> [54,] 2.622151e-04

Notice that a large portion of the entries are now zeros. We can also explore a summary of this MPM to see the reduction in estimated elements (the summary() function only counts elements as estimated if they are non-zero), particularly in comparison to the original ahistorical MPM.

summary(cypmatrix2fp_group)
> 
> 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 27165 survival transitions were estimated, with 1811 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.
> 
> The dataset contains a total of 74 unique individuals and 320 unique transitions.
> 
> 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.050 0.050 0.050 0.050 0.050 0.050 0.050 0.050 0.050 0.050 0.050 0.050
> 1st Qu. 0.879 0.743 0.802 0.867 0.927 0.840 0.670 0.740 0.824 0.900 0.888 0.786
> Median  0.979 0.956 0.965 0.978 0.988 0.970 0.939 0.955 0.968 0.982 0.980 0.963
> Mean    0.865 0.819 0.838 0.858 0.887 0.850 0.796 0.818 0.843 0.877 0.872 0.832
> 3rd Qu. 0.999 1.000 1.000 1.000 0.999 0.998 1.000 0.999 0.999 0.999 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.050 0.050 0.050
> 1st Qu. 0.838 0.885 0.936
> Median  0.970 0.980 0.988
> Mean    0.849 0.865 0.890
> 3rd Qu. 0.999 0.998 0.997
> Max.    1.000 0.999 0.999
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 36165 survival transitions were estimated, with 2411 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.
> 
> The dataset contains a total of 74 unique individuals and 320 unique transitions.
> 
> 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.050 0.050 0.050 0.050 0.050 0.050 0.050 0.050 0.050 0.050 0.050 0.050
> 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.916 0.918 0.917 0.917 0.914 0.915 0.917 0.917 0.916 0.914 0.913 0.916
> 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.050 0.050 0.050
> 1st Qu. 0.991 0.991 0.991
> Median  0.999 0.998 0.997
> Mean    0.916 0.915 0.912
> 3rd Qu. 0.999 0.999 0.999
> Max.    1.000 0.999 0.999

We can see in the output that there are 600 fewer non-zero survival terms per matrix in our new ahistorical MPM. This is because we have eliminated the return transitions from the reproductive to the non-reproductive stages. Let’s take a look at matrix images of the first \(\mathbf{A}\) matrix in the original MPM and the stage-group MPM to get a better sense of where the non-zero elements are. In the second matrix, we should see the top-right quadrant below fecundity zeroed out.

par(mfrow = c(1, 2))

image3(cypmatrix2fp, used = 1)
> [[1]]

image3(cypmatrix2fp_group, used = 1)
> [[1]]

One important note here is that we used stage groups in this instance only to provide a convenient means of setting values later in the MPM itself. If we had wanted to test the impact of stage group on vital rates, then we would have needed to run function modelsearch() with option test.group = TRUE.

Using stage groups provides a great deal of power in structuring your MPMs. Now let’s move on to the use of manually estimated vital rate models in function-based MPMs.

5.7 Annual and individual covariates

Users may at times wish to develop MPMs conditioned on extra variables, including annual environmental variables such as Spring precipitation, or individual state variables such as frailty indices. Package lefko3 can handle this easily with the modelsearch() function combined with the various function-based matrix estimators. In fact, up to three individual covariates and three annual covariates can be used.

For our first example, let’s continue using the Cypripedium dataset with the life history model diagrammed in figure 5.1. We will see how total annual precipitation affects our vital rates, and use the resulting vital rates to create a new function-based MPM. The easiest way to accomplish this is to build a vector of the annual values for the covariates we have in mind, and then load them into modelsearch using the annucov series of arguments. For a single covariate, we would used only annucova combined with test.annucova = TRUE. Additional covariates can be added with annucovb and annucovc. Note that the length of the annual covariate vector must be equal to the number of years in time t in the dataset, meaning that the final year of the dataset should not be included.

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

cypmodels2_anna <- modelsearch(cypfb_v1, historical = FALSE, approach = "mixed", 
  vitalrates = c("surv", "obs", "size", "repst", "fec"),
  sizedist = "negbin", size.trunc = TRUE, fecdist = "poisson", fec.zero = TRUE,
  suite = "main", size = c("size3added", "size2added", "size1added"),
  annucova = precip, test.annucova = TRUE, quiet = "partial")

And now the summary.

summary(cypmodels2_anna)
> 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 ~ annucova2 + (1 | year2) + (1 | individ)
>    Data: surv.data
>      AIC      BIC   logLik deviance df.resid 
> 102.9757 118.0490 -47.4878  94.9757      316 
> Random effects:
>  Groups  Name        Std.Dev.
>  individ (Intercept) 1197.97 
>  year2   (Intercept)   89.74 
> Number of obs: 320, groups:  individ, 74; year2, 5
> Fixed Effects:
> (Intercept)    annucova2  
>      271.32        -2.19  
> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 2 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: obs.data
>      AIC      BIC   logLik deviance df.resid 
> 118.2567 133.1117 -55.1284 110.2567      299 
> Random effects:
>  Groups  Name        Std.Dev. 
>  individ (Intercept) 1.078e-05
>  year2   (Intercept) 8.776e-01
> Number of obs: 303, groups:  individ, 70; year2, 5
> Fixed Effects:
> (Intercept)   size2added  
>      2.4904       0.3134  
> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
> 
> 
> 
> Size model:
> Formula:          size3added ~ (1 | year2) + (1 | individ)
> Data: size.data
>       AIC       BIC    logLik  df.resid 
> 1008.2666 1022.9184 -500.1333       284 
> Random-effects (co)variances:
> 
> Conditional model:
>  Groups  Name        Std.Dev.
>  year2   (Intercept) 0.1109  
>  individ (Intercept) 1.0561  
> 
> Number of obs: 288 / Conditional model: year2, 5; individ, 70
> 
> Dispersion parameter for truncated_nbinom2 family (): 9.34e+09 
> 
> Fixed Effects:
> 
> Conditional model:
> (Intercept)  
>      0.5761  
> 
> 
> 
> 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 ~ annucova2 + repstatus2 + size2added + (1 | year2) +  
>     (1 | individ)
>    Data: repst.data
>       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)    annucova2   repstatus2   size2added  
>    -4.23766      0.02954      1.71091      0.17187  
> 
> 
> 
> Fecundity model:
> Formula:          feca2 ~ annucova2 + size2added + (1 | year2) + (1 | individ)
> Zero inflation:         ~size2added + (1 | year2) + (1 | individ)
> Data: fec.data
>       AIC       BIC    logLik  df.resid 
>  245.4867  270.4229 -113.7434       109 
> Random-effects (co)variances:
> 
> Conditional model:
>  Groups  Name        Std.Dev.
>  year2   (Intercept) 0.2517  
>  individ (Intercept) 0.1927  
> 
> Zero-inflation model:
>  Groups  Name        Std.Dev. 
>  year2   (Intercept) 2.072e-04
>  individ (Intercept) 3.951e-08
> 
> Number of obs: 118 / Conditional model: year2, 5; individ, 51 / Zero-inflation model: year2, 5; individ, 51
> 
> Fixed Effects:
> 
> Conditional model:
> (Intercept)    annucova2   size2added  
>     1.68997     -0.02397      0.06174  
> 
> Zero-inflation model:
> (Intercept)   size2added  
>       3.927       -1.618  
> 
> 
> 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: 7
> 
> Number of models in observation table: 8
> 
> Number of models in size table: 8
> 
> Number of models in secondary size table: 1
> 
> Number of models in tertiary size table: 1
> 
> Number of models in reproduction status table: 8
> 
> Number of models in fecundity table: 64
> 
> 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
> 32       annual covariate a in time t  annucova2
> 33     annual covariate a in time t-1  annucova1
> 34       annual covariate b in time t  annucovb2
> 35     annual covariate b in time t-1  annucovb1
> 36       annual covariate c in time t  annucovc2
> 37     annual covariate c in time t-1  annucovc1
> 
> 
> 
> 
> 
> Quality control:
> 
> Survival model estimated with 74 individuals and 320 individual transitions.
> Survival model accuracy is 1.
> Observation status model estimated with 70 individuals and 303 individual transitions.
> Observation status model accuracy is 0.95.
> Primary size model estimated with 70 individuals and 288 individual transitions.
> Primary size model R-squared is 0.822.
> Secondary size model not estimated.
> Tertiary size model not estimated.
> Reproductive status model estimated with 70 individuals and 288 individual transitions.
> Reproductive status model accuracy is 0.719.
> Fecundity model estimated with 51 individuals and 118 individual transitions.
> Fecundity model R-squared is 0.524.
> Juvenile survival model not estimated.
> Juvenile observation status model not estimated.
> Juvenile primary size model not estimated.
> Juvenile secondary size model not estimated.
> Juvenile tertiary size model not estimated.
> Juvenile reproductive status model not estimated.
> Juvenile maturity status model not estimated.

We see that annual precipitation is a fixed term in the models for survival, reproductive status, and fecundity.

Let’s now consider a more general case - the individual covariate. We might have data on an extra state variable for each individual at each time, contained in the original dataset. Since we do not have such a term in the cypdata dataset, let’s pretend that we actually added annual precipitation into that original dataset, as below.

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

summary(cypdata_env)
>     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         prec.04    
>  Min.   : 0.000   Min.   : 0.000   Min.   :0.000   Min.   :92.2  
>  1st Qu.: 0.000   1st Qu.: 1.000   1st Qu.:0.000   1st Qu.:92.2  
>  Median : 1.000   Median : 1.000   Median :1.000   Median :92.2  
>  Mean   : 1.833   Mean   : 2.233   Mean   :1.133   Mean   :92.2  
>  3rd Qu.: 2.000   3rd Qu.: 3.000   3rd Qu.:1.000   3rd Qu.:92.2  
>  Max.   :11.000   Max.   :10.000   Max.   :8.000   Max.   :92.2  
>  NA's   :17       NA's   :17       NA's   :17                    
>     prec.05        prec.06      prec.07         prec.08         prec.09     
>  Min.   :57.6   Min.   :96   Min.   :109.8   Min.   :111.9   Min.   :106.8  
>  1st Qu.:57.6   1st Qu.:96   1st Qu.:109.8   1st Qu.:111.9   1st Qu.:106.8  
>  Median :57.6   Median :96   Median :109.8   Median :111.9   Median :106.8  
>  Mean   :57.6   Mean   :96   Mean   :109.8   Mean   :111.9   Mean   :106.8  
>  3rd Qu.:57.6   3rd Qu.:96   3rd Qu.:109.8   3rd Qu.:111.9   3rd Qu.:106.8  
>  Max.   :57.6   Max.   :96   Max.   :109.8   Max.   :111.9   Max.   :106.8  
> 

The dataset is still formatted for the most part using blocks of variables for each year, except for the precipitation variables, which are at the very end of the dataset. We will standardize the dataset using verticalize3() with data blocks, but we will input all of the precipitation variables by name (users wishing to use the block feature for precipitation must reorder the columns in the data frame).

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, 60 variables, 1 population, 
> 3 patches, 74 individuals, and 5 time steps.
>      rowid          popid           patchid    individ           year2     
>  Min.   : 1.00   Length:320         A: 93   Min.   : 164.0   Min.   :2004  
>  1st Qu.:21.00   Class :character   B:154   1st Qu.: 391.0   1st Qu.:2005  
>  Median :37.50   Mode  :character   C: 73   Median : 453.0   Median :2006  
>  Mean   :38.45                              Mean   : 651.5   Mean   :2006  
>  3rd Qu.:56.00                              3rd Qu.: 476.0   3rd Qu.:2007  
>  Max.   :77.00                              Max.   :1560.0   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         repstr1added         feca1       
>  Min.   : 0.0000   Min.   :0.000000   Min.   : 0.0000   Min.   :0.0000  
>  1st Qu.: 0.0000   1st Qu.:0.000000   1st Qu.: 0.0000   1st Qu.:0.0000  
>  Median : 0.0000   Median :0.000000   Median : 0.0000   Median :0.0000  
>  Mean   : 0.7469   Mean   :0.009375   Mean   : 0.7562   Mean   :0.2656  
>  3rd Qu.: 1.0000   3rd Qu.:0.000000   3rd Qu.: 1.0000   3rd Qu.:0.0000  
>  Max.   :18.0000   Max.   :1.000000   Max.   :18.0000   Max.   :7.0000  
>    fec1added         indcova1        obsstatus1       repstatus1    
>  Min.   :0.0000   Min.   :  0.00   Min.   :0.0000   Min.   :0.0000  
>  1st Qu.:0.0000   1st Qu.: 57.60   1st Qu.:0.0000   1st Qu.:0.0000  
>  Median :0.0000   Median : 92.20   Median :1.0000   Median :0.0000  
>  Mean   :0.2656   Mean   : 70.64   Mean   :0.7469   Mean   :0.2875  
>  3rd Qu.:0.0000   3rd Qu.: 96.00   3rd Qu.:1.0000   3rd Qu.:1.0000  
>  Max.   :7.0000   Max.   :109.80   Max.   :1.0000   Max.   :1.0000  
>    fecstatus1       matstatus1         alive1          stage1         
>  Min.   :0.0000   Min.   :0.0000   Min.   :0.0000   Length:320        
>  1st Qu.:0.0000   1st Qu.:1.0000   1st Qu.:1.0000   Class :character  
>  Median :0.0000   Median :1.0000   Median :1.0000   Mode  :character  
>  Mean   :0.1344   Mean   :0.7688   Mean   :0.7688                     
>  3rd Qu.:0.0000   3rd Qu.:1.0000   3rd Qu.:1.0000                     
>  Max.   :1.0000   Max.   :1.0000   Max.   :1.0000                     
>   stage1index        sizea2             sizeb2            sizec2      
>  Min.   : 0.00   Min.   :0.000000   Min.   : 0.0000   Min.   : 0.000  
>  1st Qu.: 6.00   1st Qu.:0.000000   1st Qu.: 0.0000   1st Qu.: 1.000  
>  Median : 8.00   Median :0.000000   Median : 0.0000   Median : 2.000  
>  Mean   :14.17   Mean   :0.009375   Mean   : 0.8969   Mean   : 2.416  
>  3rd Qu.:31.00   3rd Qu.:0.000000   3rd Qu.: 1.0000   3rd Qu.: 3.000  
>  Max.   :51.00   Max.   :1.000000   Max.   :18.0000   Max.   :13.000  
>    size2added        repstra2          repstrb2         repstr2added    
>  Min.   : 0.000   Min.   : 0.0000   Min.   :0.000000   Min.   : 0.0000  
>  1st Qu.: 1.000   1st Qu.: 0.0000   1st Qu.:0.000000   1st Qu.: 0.0000  
>  Median : 2.000   Median : 0.0000   Median :0.000000   Median : 0.0000  
>  Mean   : 3.322   Mean   : 0.8969   Mean   :0.009375   Mean   : 0.9062  
>  3rd Qu.: 4.000   3rd Qu.: 1.0000   3rd Qu.:0.000000   3rd Qu.: 1.0000  
>  Max.   :24.000   Max.   :18.0000   Max.   :1.000000   Max.   :18.0000  
>      feca2          fec2added         indcova2        obsstatus2    
>  Min.   :0.0000   Min.   :0.0000   Min.   : 57.60   Min.   :0.0000  
>  1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.: 92.20   1st Qu.:1.0000  
>  Median :0.0000   Median :0.0000   Median : 96.00   Median :1.0000  
>  Mean   :0.2906   Mean   :0.2906   Mean   : 92.77   Mean   :0.9531  
>  3rd Qu.:0.0000   3rd Qu.:0.0000   3rd Qu.:109.80   3rd Qu.:1.0000  
>  Max.   :7.0000   Max.   :7.0000   Max.   :111.90   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         repstr3added   
>  Min.   : 0.000   Min.   : 0.000   Min.   :0.000000   Min.   : 0.000  
>  1st Qu.: 1.000   1st Qu.: 0.000   1st Qu.:0.000000   1st Qu.: 0.000  
>  Median : 2.000   Median : 0.000   Median :0.000000   Median : 0.000  
>  Mean   : 3.288   Mean   : 1.069   Mean   :0.009375   Mean   : 1.078  
>  3rd Qu.: 4.000   3rd Qu.: 1.000   3rd Qu.:0.000000   3rd Qu.: 1.000  
>  Max.   :24.000   Max.   :18.000   Max.   :1.000000   Max.   :18.000  
>      feca3          fec3added         indcova3       obsstatus3    repstatus3 
>  Min.   :0.0000   Min.   :0.0000   Min.   : 57.6   Min.   :0.0   Min.   :0.0  
>  1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.: 96.0   1st Qu.:1.0   1st Qu.:0.0  
>  Median :0.0000   Median :0.0000   Median :106.8   Median :1.0   Median :0.0  
>  Mean   :0.4562   Mean   :0.4562   Mean   : 96.1   Mean   :0.9   Mean   :0.4  
>  3rd Qu.:0.0000   3rd Qu.:0.0000   3rd Qu.:109.8   3rd Qu.:1.0   3rd Qu.:1.0  
>  Max.   :8.0000   Max.   :8.0000   Max.   :111.9   Max.   :1.0   Max.   :1.0  
>    fecstatus3       matstatus3     alive3          stage3         
>  Min.   :0.0000   Min.   :1    Min.   :0.0000   Length:320        
>  1st Qu.:0.0000   1st Qu.:1    1st Qu.:1.0000   Class :character  
>  Median :0.0000   Median :1    Median :1.0000   Mode  :character  
>  Mean   :0.2219   Mean   :1    Mean   :0.9469                     
>  3rd Qu.:0.0000   3rd Qu.:1    3rd Qu.:1.0000                     
>  Max.   :1.0000   Max.   :1    Max.   :1.0000                     
>   stage3index   
>  Min.   : 0.00  
>  1st Qu.: 7.00  
>  Median :10.00  
>  Mean   :18.57  
>  3rd Qu.:33.00  
>  Max.   :54.00

Now we will proceed to run function modelsearch() and find the right parameterizations for our vital rates. We will include the options indcova = c("indcova3", "indcova2", "indcova1") and test.indcova = TRUE so that modelsearch() includes our individual covariates in all vital rate global models. If these covariates were categorical and random, then we would also need to stipulate random.indcova = TRUE (our individual covariate is actually quantitative and numerical, so we will use the default setting instead). As before, we will only do the ahistorical set, we will drop the patch term, and we will set suite = "main" to prevent the inclusion of interaction terms, in order to prevent this function from taking too long to run.

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 = "main", size = c("size3added", "size2added", "size1added"),
  indcova = c("indcova3", "indcova2", "indcova1"), test.indcova = TRUE,
  quiet = "partial")

And now the summary.

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: surv.data
>      AIC      BIC   logLik deviance df.resid 
> 102.9757 118.0490 -47.4878  94.9757      316 
> Random effects:
>  Groups  Name        Std.Dev.
>  individ (Intercept) 1197.97 
>  year2   (Intercept)   89.74 
> Number of obs: 320, groups:  individ, 74; year2, 5
> Fixed Effects:
> (Intercept)     indcova2  
>      271.32        -2.19  
> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 2 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: obs.data
>      AIC      BIC   logLik deviance df.resid 
> 118.2567 133.1117 -55.1284 110.2567      299 
> Random effects:
>  Groups  Name        Std.Dev. 
>  individ (Intercept) 1.078e-05
>  year2   (Intercept) 8.776e-01
> Number of obs: 303, groups:  individ, 70; year2, 5
> Fixed Effects:
> (Intercept)   size2added  
>      2.4904       0.3134  
> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
> 
> 
> 
> Size model:
> Formula:          size3added ~ (1 | year2) + (1 | individ)
> Data: size.data
>       AIC       BIC    logLik  df.resid 
> 1008.2666 1022.9184 -500.1333       284 
> Random-effects (co)variances:
> 
> Conditional model:
>  Groups  Name        Std.Dev.
>  year2   (Intercept) 0.1109  
>  individ (Intercept) 1.0561  
> 
> Number of obs: 288 / Conditional model: year2, 5; individ, 70
> 
> Dispersion parameter for truncated_nbinom2 family (): 9.34e+09 
> 
> Fixed Effects:
> 
> Conditional model:
> (Intercept)  
>      0.5761  
> 
> 
> 
> 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: repst.data
>       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:         ~size2added + (1 | year2) + (1 | individ)
> Data: fec.data
>       AIC       BIC    logLik  df.resid 
>  245.4867  270.4229 -113.7434       109 
> Random-effects (co)variances:
> 
> Conditional model:
>  Groups  Name        Std.Dev.
>  year2   (Intercept) 0.2517  
>  individ (Intercept) 0.1927  
> 
> Zero-inflation model:
>  Groups  Name        Std.Dev. 
>  year2   (Intercept) 2.072e-04
>  individ (Intercept) 3.951e-08
> 
> 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.68997     -0.02397      0.06174  
> 
> Zero-inflation model:
> (Intercept)   size2added  
>       3.927       -1.618  
> 
> 
> 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: 7
> 
> Number of models in observation table: 8
> 
> Number of models in size table: 8
> 
> Number of models in secondary size table: 1
> 
> Number of models in tertiary size table: 1
> 
> Number of models in reproduction status table: 8
> 
> Number of models in fecundity table: 64
> 
> 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
> 32       annual covariate a in time t  annucova2
> 33     annual covariate a in time t-1  annucova1
> 34       annual covariate b in time t  annucovb2
> 35     annual covariate b in time t-1  annucovb1
> 36       annual covariate c in time t  annucovc2
> 37     annual covariate c in time t-1  annucovc1
> 
> 
> 
> 
> 
> Quality control:
> 
> Survival model estimated with 74 individuals and 320 individual transitions.
> Survival model accuracy is 1.
> Observation status model estimated with 70 individuals and 303 individual transitions.
> Observation status model accuracy is 0.95.
> Primary size model estimated with 70 individuals and 288 individual transitions.
> Primary size model R-squared is 0.822.
> Secondary size model not estimated.
> Tertiary size model not estimated.
> Reproductive status model estimated with 70 individuals and 288 individual transitions.
> Reproductive status model accuracy is 0.719.
> Fecundity model estimated with 51 individuals and 118 individual transitions.
> Fecundity model R-squared is 0.524.
> Juvenile survival model not estimated.
> Juvenile observation status model not estimated.
> Juvenile primary size model not estimated.
> Juvenile secondary size model not estimated.
> Juvenile tertiary size model not estimated.
> Juvenile reproductive status model not estimated.
> Juvenile maturity status model not estimated.

Our individual covariate, total annual precipitation, is included in the best-fit vital rate models for survival, reproductive status, and fecundity. Further detailed investigation will show that the best-fit models are exactly the same as those developed using the annucov approach.

Now let’s try building an MPM with a single covariate value, which will be equal to 100cm of annual precipitation.

cypmatrix2f_env1 <- flefko2(stageframe = cypframe_fb, data = cypfb_env,
  supplement = cypsupp2_fb, modelsuite = cypmodels2_env, inda = 100)
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 12055 survival transitions were estimated, with 2411 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.
> 
> The dataset contains a total of 74 unique individuals and 320 unique transitions.
> 
> 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.050 0.050 0.050 0.050 0.050
> 1st Qu. 1.000 0.999 1.000 1.000 1.000
> Median  1.000 0.999 1.000 1.000 1.000
> Mean    0.924 0.923 0.925 0.925 0.923
> 3rd Qu. 1.000 0.999 1.000 1.000 1.000
> Max.    1.000 0.999 1.000 1.000 1.000

Now let’s build a version with a different, set precipitation value for each year (time t only, meaning that there are five values in a six year dataset) based on the actual values.

precip_values <- c(92.2, 57.6, 96, 109.8, 111.9)

cypmatrix2f_env2 <- flefko2(stageframe = cypframe_fb, data = cypfb_env,
  supplement = cypsupp2_fb, modelsuite = cypmodels2_env, inda = precip_values)
summary(cypmatrix2f_env2)
> 
> 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 12055 survival transitions were estimated, with 2411 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.
> 
> The dataset contains a total of 74 unique individuals and 320 unique transitions.
> 
> 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.050 0.050 0.050 0.050 0.050
> 1st Qu. 1.000 1.000 1.000 1.000 1.000
> Median  1.000 1.000 1.000 1.000 1.000
> Mean    0.924 0.926 0.925 0.925 0.923
> 3rd Qu. 1.000 1.000 1.000 1.000 1.000
> Max.    1.000 1.000 1.000 1.000 1.000

Voilà! Notice that the survival sum checks are much less variable than when we set precipitation to the single value of 100cm, likely reflecting the influence of actual variation in precipitation on the vital rates. Now we can move on to analysis, including general projection, LTRE, etc.

5.8 Creating function-based MPMs without modelsearch()

Advanced users of lefko3 may wish to create their own models without the package’s automated model selection function. In that case, lefko3’s function-based MPM creation functions flefko2(), flefko3(), aflefko2(), fleslie() and mpm_create() can accommodate two other approaches. The first is to develop single models developed using a series of function covering generalized linear models and generalized linear mixed models in base R and a series of other packages. The second is to input the intercepts and slopes from these kinds of models into a vrm_input data frame object. We will focus the rest of this chapter on the former. To learn about the latter approach, pleas jump ahead to chapter 15.

Currently, users wanting to work with individual linear modeling separately from function modelsearch() can develop these models using the following functions.

  1. lm() and glm() from the core R package stats, with the latter limited to the following response distribution families: binomial, gaussian, Gamma, and poisson
  2. glm.nb() from the core R package MASS
  3. vglm() from package VGAM (Yee & Wild 1996; Yee 2015), with response distributions limited to pospoisson and posnegbinomial
  4. zeroinfl() from package pscl (Zeileis et al. 2008), with response distributions limited to poisson and negbin
  5. lmer and glmer from package lme4 (Bates et al. 2015), with the latter limited to the following response distribution families: binomial, gaussian, Gamma, and poisson
  6. glmmTMB from package glmmTMB (Brooks et al. 2017), with response distribution families limited to nbinom2, truncated_poisson, and truncated_nbinom2

Generally, survival probability, observation probability, and reproduction probability must be modeled using either function glm() or glmer(), in either case using the binomial distribution for the response term. Size and fecundity may be modeled as Gaussian, gamma, Poisson, or negative binomial, with the Poisson and negative binomial capable of being zero-inflated or zero-truncated. The binomial response is not allowed for size and fecundity.

Developing models manually requires a few key steps. First, the core dataset must be created and serve as the main dataset for modeling. Next, data subsets must be developed for conditional rates and probabilities. Third, the models themselves should be developed. Fourth, a paramnames object must be made that identifies the names of variables from the dataset used in modeling. Finally, we can create our MPM using our manually produced models as inputs.

Let’s try an example of a manual modeling exercise. Let’s create a historical MPM for the Cypripedium candidum dataset, but forcing each model to include size and reproductive status in times t and t-1, and occasion in time t and individual identity. So, these will be mixed models. Let’s start off by looking over our core hfv format dataset.

summary_hfv(cypfb_v1)
> 
> 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   Length:320         A: 93   Min.   : 164.0   Min.   :2004  
>  1st Qu.:21.00   Class :character   B:154   1st Qu.: 391.0   1st Qu.:2005  
>  Median :37.50   Mode  :character   C: 73   Median : 453.0   Median :2006  
>  Mean   :38.45                              Mean   : 651.5   Mean   :2006  
>  3rd Qu.:56.00                              3rd Qu.: 476.0   3rd Qu.:2007  
>  Max.   :77.00                              Max.   :1560.0   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         repstr1added         feca1       
>  Min.   : 0.0000   Min.   :0.000000   Min.   : 0.0000   Min.   :0.0000  
>  1st Qu.: 0.0000   1st Qu.:0.000000   1st Qu.: 0.0000   1st Qu.:0.0000  
>  Median : 0.0000   Median :0.000000   Median : 0.0000   Median :0.0000  
>  Mean   : 0.7469   Mean   :0.009375   Mean   : 0.7562   Mean   :0.2656  
>  3rd Qu.: 1.0000   3rd Qu.:0.000000   3rd Qu.: 1.0000   3rd Qu.:0.0000  
>  Max.   :18.0000   Max.   :1.000000   Max.   :18.0000   Max.   :7.0000  
>    fec1added        obsstatus1       repstatus1       fecstatus1    
>  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 :0.0000   Median :1.0000   Median :0.0000   Median :0.0000  
>  Mean   :0.2656   Mean   :0.7469   Mean   :0.2875   Mean   :0.1344  
>  3rd Qu.:0.0000   3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:0.0000  
>  Max.   :7.0000   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         repstr2added         feca2       
>  Min.   : 0.0000   Min.   :0.000000   Min.   : 0.0000   Min.   :0.0000  
>  1st Qu.: 0.0000   1st Qu.:0.000000   1st Qu.: 0.0000   1st Qu.:0.0000  
>  Median : 0.0000   Median :0.000000   Median : 0.0000   Median :0.0000  
>  Mean   : 0.8969   Mean   :0.009375   Mean   : 0.9062   Mean   :0.2906  
>  3rd Qu.: 1.0000   3rd Qu.:0.000000   3rd Qu.: 1.0000   3rd Qu.:0.0000  
>  Max.   :18.0000   Max.   :1.000000   Max.   :18.0000   Max.   :7.0000  
>    fec2added        obsstatus2       repstatus2       fecstatus2    
>  Min.   :0.0000   Min.   :0.0000   Min.   :0.0000   Min.   :0.0000  
>  1st Qu.:0.0000   1st Qu.:1.0000   1st Qu.:0.0000   1st Qu.:0.0000  
>  Median :0.0000   Median :1.0000   Median :0.0000   Median :0.0000  
>  Mean   :0.2906   Mean   :0.9531   Mean   :0.3688   Mean   :0.1562  
>  3rd Qu.:0.0000   3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:0.0000  
>  Max.   :7.0000   Max.   :1.0000   Max.   :1.0000   Max.   :1.0000  
>    matstatus2     alive2     stage2           stage2index        sizea3        
>  Min.   :1    Min.   :1   Length:320         Min.   : 6.00   Min.   :0.000000  
>  1st Qu.:1    1st Qu.:1   Class :character   1st Qu.: 7.00   1st Qu.:0.000000  
>  Median :1    Median :1   Mode  :character   Median :10.00   Median :0.000000  
>  Mean   :1    Mean   :1                      Mean   :18.17   Mean   :0.009375  
>  3rd Qu.:1    3rd Qu.:1                      3rd Qu.:32.00   3rd Qu.:0.000000  
>  Max.   :1    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         repstr3added        feca3          fec3added     
>  Min.   :0.000000   Min.   : 0.000   Min.   :0.0000   Min.   :0.0000  
>  1st Qu.:0.000000   1st Qu.: 0.000   1st Qu.:0.0000   1st Qu.:0.0000  
>  Median :0.000000   Median : 0.000   Median :0.0000   Median :0.0000  
>  Mean   :0.009375   Mean   : 1.078   Mean   :0.4562   Mean   :0.4562  
>  3rd Qu.:0.000000   3rd Qu.: 1.000   3rd Qu.:0.0000   3rd Qu.:0.0000  
>  Max.   :1.000000   Max.   :18.000   Max.   :8.0000   Max.   :8.0000  
>    obsstatus3    repstatus3    fecstatus3       matstatus3     alive3      
>  Min.   :0.0   Min.   :0.0   Min.   :0.0000   Min.   :1    Min.   :0.0000  
>  1st Qu.:1.0   1st Qu.:0.0   1st Qu.:0.0000   1st Qu.:1    1st Qu.:1.0000  
>  Median :1.0   Median :0.0   Median :0.0000   Median :1    Median :1.0000  
>  Mean   :0.9   Mean   :0.4   Mean   :0.2219   Mean   :1    Mean   :0.9469  
>  3rd Qu.:1.0   3rd Qu.:1.0   3rd Qu.:0.0000   3rd Qu.:1    3rd Qu.:1.0000  
>  Max.   :1.0   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

We will be estimating survival, and for that we need to assess whether individuals alive in time t are still alive in time t+1. Here, variables with a 2 at the end of their names represent variables coding for status in time t, while 1 codes for time t-1 and 3 codes for time t+1. The summary states that alive2 equals 1 in all cases, meaning that all rows in this dataset are for individuals alive in time t (this is the default output from the verticalize3() and historicalize3() functions). So, we can use this dataset to test for survival. Let’s create our survival dataset by copying this dataset over to something named more appropriately.

surv_data <- cypfb_v1

Observation status is assessed in time t+1, and needs to be assessed using individuals that are alive in that time. So, let’s create a new subset of these data to assess observation status.

obs_data <- subset(surv_data, alive3 == 1)

Primary size also needs to be assessed using individuals alive in time t+1. However, size can only be estimated for individuals that are observed. Hence, we need to subset obs_data to only those individuals observable in time t+1, as below.

size_data <- subset(obs_data, obsstatus3 == 1)

Reproduction status also requires that individuals are observed. Since this is the only requirement, we can simply copy size_data to a more appropriately named data frame for that model estimation.

repr_data <- size_data

Finally, there is the issue of fecundity. This rate takes some thought to handle properly, because it may be estimated differently in different situations, and hence its relationships to the variables in the dataset may change. In our case, we have utilized a pre-breeding model and use the number of fruits as a proxy for fecundity (the real fecundity rate needs to be multiplied by the number of seeds, the survival of seeds to the next time, and the germination rate, but this product can be handled through a supplement table). Fruits are produced in time t for germination in time t+1, and reproductive status is determined by the presence of flowers, so we need a subset of individuals alive in time t that also have repstatus2 == 1, as below.

fec_data <- subset(surv_data, repstatus2 == 1)

We have now built all of our data frames, and can proceed to develop our models. Here, each model is listed in a single block of code. We will rely on the glmer() function from package lme4, and the glmmTMB() function from package glmmTMB. Please install these packages if you have not yet done so. The response distributions for survival, observation status, and reproduction status will be the binomial distribution. The response distributions for size and fecundity will be the zero-truncated negative binomial and the zero-inflated poisson, respectively.

surv_mod <- lme4::glmer(alive3 ~ size2added + size1added + repstatus2 +
  repstatus1 + (1 | year2) + (1 | individ), data = surv_data, family = binomial)
> boundary (singular) fit: see help('isSingular')
obs_mod <- lme4::glmer(obsstatus3 ~ size2added + size1added + repstatus2 +
  repstatus1 + (1 | year2) + (1 | individ), data = obs_data, family = binomial)
size_mod <- glmmTMB::glmmTMB(size3added ~ size2added + size1added + repstatus2 +
  repstatus1 + (1 | year2) + (1 | individ), data = size_data,
  family = glmmTMB::truncated_nbinom2)
> Warning in finalizeTMB(TMBStruc, obj, fit, h, data.tmb.old): Model convergence
> problem; non-positive-definite Hessian matrix. See vignette('troubleshooting')
repr_mod <- lme4::glmer(repstatus3 ~ size2added + size1added + repstatus2 +
  repstatus1 + (1 | year2) + (1 | individ), data = repr_data, family = binomial)
> boundary (singular) fit: see help('isSingular')
fec_mod <- glmmTMB::glmmTMB(feca3 ~ size2added + size1added + repstatus1 +
  (1 | year2) + (1 | individ), zi = ~., data = fec_data, family = poisson)
> Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
> NA/NaN function evaluation
> Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
> Model convergence problem; non-positive-definite Hessian matrix. See
> vignette('troubleshooting')
> Warning in finalizeTMB(TMBStruc, obj, fit, h, data.tmb.old): Model convergence
> problem; false convergence (8). See vignette('troubleshooting'),
> help('diagnose')

summary(surv_mod)
> Generalized linear mixed model fit by maximum likelihood (Laplace
>   Approximation) [glmerMod]
>  Family: binomial  ( logit )
> Formula: alive3 ~ size2added + size1added + repstatus2 + repstatus1 +  
>     (1 | year2) + (1 | individ)
>    Data: surv_data
> 
>      AIC      BIC   logLik deviance df.resid 
>    133.2    159.5    -59.6    119.2      313 
> 
> Scaled residuals: 
>     Min      1Q  Median      3Q     Max 
> -8.6555  0.0883  0.1947  0.3066  0.4706 
> 
> Random effects:
>  Groups  Name        Variance  Std.Dev. 
>  individ (Intercept) 6.854e-14 2.618e-07
>  year2   (Intercept) 0.000e+00 0.000e+00
> Number of obs: 320, groups:  individ, 74; year2, 5
> 
> Fixed effects:
>             Estimate Std. Error z value Pr(>|z|)    
> (Intercept)  1.50738    0.45233   3.332 0.000861 ***
> size2added   0.48153    0.24076   2.000 0.045493 *  
> size1added   0.18764    0.20271   0.926 0.354645    
> repstatus2   0.42624    0.68931   0.618 0.536337    
> repstatus1  -0.05451    0.71646  -0.076 0.939349    
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
> 
> Correlation of Fixed Effects:
>            (Intr) sz2ddd sz1ddd rpstt2
> size2added -0.592                     
> size1added -0.358 -0.174              
> repstatus2 -0.080 -0.222  0.042       
> repstatus1 -0.079  0.046 -0.318 -0.211
> optimizer (Nelder_Mead) convergence code: 0 (OK)
> boundary (singular) fit: see help('isSingular')
summary(obs_mod)
> Generalized linear mixed model fit by maximum likelihood (Laplace
>   Approximation) [glmerMod]
>  Family: binomial  ( logit )
> Formula: obsstatus3 ~ size2added + size1added + repstatus2 + repstatus1 +  
>     (1 | year2) + (1 | individ)
>    Data: obs_data
> 
>      AIC      BIC   logLik deviance df.resid 
>    122.3    148.3    -54.2    108.3      296 
> 
> Scaled residuals: 
>     Min      1Q  Median      3Q     Max 
> -6.2622  0.1121  0.1716  0.2435  0.6150 
> 
> Random effects:
>  Groups  Name        Variance  Std.Dev. 
>  individ (Intercept) 4.154e-07 0.0006445
>  year2   (Intercept) 7.302e-01 0.8545190
> Number of obs: 303, groups:  individ, 70; year2, 5
> 
> Fixed effects:
>             Estimate Std. Error z value Pr(>|z|)    
> (Intercept)   2.4945     0.6046   4.126 3.69e-05 ***
> size2added    0.3837     0.1979   1.939   0.0525 .  
> size1added   -0.1712     0.1507  -1.136   0.2559    
> repstatus2    0.4567     0.7075   0.645   0.5186    
> repstatus1    0.4619     0.7343   0.629   0.5293    
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
> 
> Correlation of Fixed Effects:
>            (Intr) sz2ddd sz1ddd rpstt2
> size2added -0.257                     
> size1added -0.149 -0.569              
> repstatus2 -0.090 -0.111 -0.051       
> repstatus1 -0.043  0.026 -0.199 -0.276
summary(size_mod)
>  Family: truncated_nbinom2  ( log )
> Formula:          
> size3added ~ size2added + size1added + repstatus2 + repstatus1 +  
>     (1 | year2) + (1 | individ)
> Data: size_data
> 
>      AIC      BIC   logLik deviance df.resid 
>       NA       NA       NA       NA      280 
> 
> Random effects:
> 
> Conditional model:
>  Groups  Name        Variance Std.Dev.
>  year2   (Intercept) 0.01378  0.1174  
>  individ (Intercept) 0.93532  0.9671  
> Number of obs: 288, groups:  year2, 5; individ, 70
> 
> Dispersion parameter for truncated_nbinom2 family (): 2.71e+07 
> 
> Conditional model:
>             Estimate Std. Error z value Pr(>|z|)   
> (Intercept)  0.51079    0.15819   3.229  0.00124 **
> size2added   0.02195    0.01362   1.611  0.10709   
> size1added  -0.00599    0.01159  -0.517  0.60541   
> repstatus2   0.06095    0.10005   0.609  0.54240   
> repstatus1   0.04482    0.10744   0.417  0.67657   
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(repr_mod)
> Generalized linear mixed model fit by maximum likelihood (Laplace
>   Approximation) [glmerMod]
>  Family: binomial  ( logit )
> Formula: repstatus3 ~ size2added + size1added + repstatus2 + repstatus1 +  
>     (1 | year2) + (1 | individ)
>    Data: repr_data
> 
>      AIC      BIC   logLik deviance df.resid 
>    334.4    360.1   -160.2    320.4      281 
> 
> Scaled residuals: 
>     Min      1Q  Median      3Q     Max 
> -2.1990 -0.6565 -0.3669  0.6895  2.8967 
> 
> Random effects:
>  Groups  Name        Variance  Std.Dev. 
>  individ (Intercept) 1.888e-10 1.374e-05
>  year2   (Intercept) 5.097e-01 7.139e-01
> Number of obs: 288, groups:  individ, 70; year2, 5
> 
> Fixed effects:
>             Estimate Std. Error z value Pr(>|z|)    
> (Intercept) -1.60119    0.40840  -3.921 8.83e-05 ***
> size2added   0.12167    0.06222   1.956   0.0505 .  
> size1added   0.07881    0.07391   1.066   0.2863    
> repstatus2   1.55292    0.31202   4.977 6.46e-07 ***
> repstatus1   0.43553    0.36684   1.187   0.2351    
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
> 
> Correlation of Fixed Effects:
>            (Intr) sz2ddd sz1ddd rpstt2
> size2added -0.200                     
> size1added -0.186 -0.520              
> repstatus2 -0.193 -0.131  0.066       
> repstatus1 -0.110 -0.011 -0.172 -0.272
> optimizer (Nelder_Mead) convergence code: 0 (OK)
> boundary (singular) fit: see help('isSingular')
summary(fec_mod)
> Warning in sqrt(diag(vcovs)): NaNs produced
> Warning in sqrt(diag(vcovs)): NaNs produced
>  Family: poisson  ( log )
> Formula:          feca3 ~ size2added + size1added + repstatus1 + (1 | year2) +  
>     (1 | individ)
> Zero inflation:         ~.
> Data: fec_data
> 
>      AIC      BIC   logLik deviance df.resid 
>       NA       NA       NA       NA      106 
> 
> Random effects:
> 
> Conditional model:
>  Groups  Name        Variance Std.Dev.
>  year2   (Intercept) 0.6514   0.8071  
>  individ (Intercept) 0.7884   0.8879  
> Number of obs: 118, groups:  year2, 5; individ, 51
> 
> Zero-inflation model:
>  Groups  Name        Variance Std.Dev.
>  year2   (Intercept) 0.6388   0.7993  
>  individ (Intercept) 7.3858   2.7177  
> Number of obs: 118, groups:  year2, 5; individ, 51
> 
> Conditional model:
>             Estimate Std. Error z value Pr(>|z|)   
> (Intercept) -0.79519    0.26925  -2.953  0.00314 **
> size2added   0.05039    0.03558   1.416  0.15672   
> size1added   0.01121    0.04225   0.265  0.79078   
> repstatus1  -0.40228        NaN     NaN      NaN   
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
> 
> Zero-inflation model:
>             Estimate Std. Error z value Pr(>|z|)    
> (Intercept)  3.48455    0.34133   10.21   <2e-16 ***
> size2added  -2.10471    0.07877  -26.72   <2e-16 ***
> size1added   0.71915        NaN     NaN      NaN    
> repstatus1  -5.15997        NaN     NaN      NaN    
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

The output suggests that our models are not particularly good, but let’s use them anyway.

The last thing that we need to worry about is to create a paramnames object, which is a data frame that contains all of the information necessary for lefko3 to translate these models into MPMs. This should be composed of three columns: a column describing each parameter, a column giving the name of each parameter from lefko3’s parameter estimating protocols, and a column giving the name of each parameter within the modeling exercise. We can get a skeleton paramnames object this with the create_pm() function, as below.

our_pm <- create_pm(name_terms = TRUE)
our_pm
>                       parameter_names mainparams modelparams
> 1                              time t      year2       year2
> 2                          individual    individ     individ
> 3                               patch      patch     patchid
> 4                   alive in time t+1      surv3      alive3
> 5                observed in time t+1       obs3  obsstatus3
> 6                   sizea in time t+1      size3      sizea3
> 7                   sizeb in time t+1     sizeb3      sizeb3
> 8                   sizec in time t+1     sizec3      sizec3
> 9     reproductive status in time t+1     repst3  repstatus3
> 10              fecundity in time t+1       fec3       feca3
> 11                fecundity in time t       fec2       feca2
> 12                    sizea in time t      size2      sizea2
> 13                  sizea in time t-1      size1      sizea1
> 14                    sizeb in time t     sizeb2      sizeb2
> 15                  sizeb in time t-1     sizeb1      sizeb1
> 16                    sizec in time t     sizec2      sizec2
> 17                  sizec in time t-1     sizec1      sizec1
> 18      reproductive status in time t     repst2  repstatus2
> 19    reproductive status in time t-1     repst1  repstatus1
> 20        maturity status in time t+1     matst3  matstatus3
> 21          maturity status in time t     matst2  matstatus2
> 22                      age in time t        age      obsage
> 23                  density in time t    density     density
> 24   individual covariate a in time t   indcova2    indcova2
> 25 individual covariate a in time t-1   indcova1    indcova1
> 26   individual covariate b in time t   indcovb2    indcovb2
> 27 individual covariate b in time t-1   indcovb1    indcovb1
> 28   individual covariate c in time t   indcovc2    indcovc2
> 29 individual covariate c in time t-1   indcovc1    indcovc1
> 30              stage group in time t     group2      group2
> 31            stage group in time t-1     group1      group1
> 32       annual covariate a in time t  annucova2   annucova2
> 33     annual covariate a in time t-1  annucova1   annucova1
> 34       annual covariate b in time t  annucovb2   annucovb2
> 35     annual covariate b in time t-1  annucovb1   annucovb1
> 36       annual covariate c in time t  annucovc2   annucovc2
> 37     annual covariate c in time t-1  annucovc1   annucovc1

Because we used the name_terms = TRUE argument, create_pm() created a paramnames object that includes the typical model parameter names developed by functions verticalize3() and historicalize3(). We just need to change the names of those model parameter names that do not match with our models. Here, that means changing the primary size terms. So let’s change the necessary terms and take a look at the final object.

our_pm$modelparams[6] <- "size3added"
our_pm$modelparams[12] <- "size2added"
our_pm$modelparams[13] <- "size1added"

our_pm
>                       parameter_names mainparams modelparams
> 1                              time t      year2       year2
> 2                          individual    individ     individ
> 3                               patch      patch     patchid
> 4                   alive in time t+1      surv3      alive3
> 5                observed in time t+1       obs3  obsstatus3
> 6                   sizea in time t+1      size3  size3added
> 7                   sizeb in time t+1     sizeb3      sizeb3
> 8                   sizec in time t+1     sizec3      sizec3
> 9     reproductive status in time t+1     repst3  repstatus3
> 10              fecundity in time t+1       fec3       feca3
> 11                fecundity in time t       fec2       feca2
> 12                    sizea in time t      size2  size2added
> 13                  sizea in time t-1      size1  size1added
> 14                    sizeb in time t     sizeb2      sizeb2
> 15                  sizeb in time t-1     sizeb1      sizeb1
> 16                    sizec in time t     sizec2      sizec2
> 17                  sizec in time t-1     sizec1      sizec1
> 18      reproductive status in time t     repst2  repstatus2
> 19    reproductive status in time t-1     repst1  repstatus1
> 20        maturity status in time t+1     matst3  matstatus3
> 21          maturity status in time t     matst2  matstatus2
> 22                      age in time t        age      obsage
> 23                  density in time t    density     density
> 24   individual covariate a in time t   indcova2    indcova2
> 25 individual covariate a in time t-1   indcova1    indcova1
> 26   individual covariate b in time t   indcovb2    indcovb2
> 27 individual covariate b in time t-1   indcovb1    indcovb1
> 28   individual covariate c in time t   indcovc2    indcovc2
> 29 individual covariate c in time t-1   indcovc1    indcovc1
> 30              stage group in time t     group2      group2
> 31            stage group in time t-1     group1      group1
> 32       annual covariate a in time t  annucova2   annucova2
> 33     annual covariate a in time t-1  annucova1   annucova1
> 34       annual covariate b in time t  annucovb2   annucovb2
> 35     annual covariate b in time t-1  annucovb1   annucovb1
> 36       annual covariate c in time t  annucovc2   annucovc2
> 37     annual covariate c in time t-1  annucovc1   annucovc1

Finally, let’s create our new MPM. Note that we will not set modelsuite this time. Instead, we will use some other model setting options.

cypmatrix3f_manual <- flefko3(stageframe = cypframe_fb, data = cypfb_v1,
  supplement = cypsupp3_fb, surv_model = surv_mod, obs_model = obs_mod,
  size_model = size_mod, repst_model = repr_mod, fec_model = fec_mod,
  paramnames = our_pm, sparse_output = TRUE)
summary(cypmatrix3f_manual)
> 
> 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 1768620 survival transitions were estimated, with 117908 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.
> 
> 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.000 0.000 0.000 0.000 0.000 0.000
> 1st Qu. 0.992 0.992 0.992 0.992 0.992 0.992 0.992 0.992 0.992 0.992 0.992 0.992
> Median  0.999 1.000 1.000 0.999 0.999 0.999 1.000 1.000 0.999 0.999 0.999 1.000
> Mean    0.823 0.824 0.824 0.824 0.823 0.823 0.824 0.824 0.824 0.823 0.823 0.824
> 3rd Qu. 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 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.992 0.992 0.992
> Median  1.000 0.999 0.999
> Mean    0.824 0.824 0.823
> 3rd Qu. 1.000 1.000 1.000
> Max.    1.000 1.000 1.000

Our summary is a little simpler than in previous cases, because we did not take advantage of the extra power provided by modelsearch(). However, we can still see the information of greatest importance. Please note that defining vital rate models manually is a highly sensitive exercise - it is likely that the first attempts will yield fatal errors, often involving odd error messages. If at first you don’t succeed, try exploring the dataset for formatting errors, explore the vital rate models, and make sure that the paramnames object aligns completely with the models.

5.9 Points to remember

  1. Ahistorical MPMs should never be built using models that hold historical terms.
  2. The choices of response distributions for size and fecundity strongly influence the relationships between independent terms and their responses. Response distributions strongly influence the structure of best-fit models, and can strongly alter MPMs and their analyses.
  3. The more complex the global model, the longer it will take to run the modeling exercise. In extreme cases, in which highly complex models are run on slower computers with low memory levels, the function might run for several days. In these circumstances, the user is advised to carefully consider which terms are really needed for testing, and, if the resulting model is large, then setting the function to run on a powerful computer with lots of memory is advised.
  4. All else being equal, mixed models are better than GLMs. This is because they account for the lack of independence among transitions originating from the same individual by treating individual as a random factor. However, the complexity of mixed models may at times make the modeling exercise run very long, or possibly fail. In these cases, switching to GLMs might help yield results on a reasonably time frame.
  5. Up to three annual and three individual covariates can be included using the modelsearch() function, with unique values required in function-based MPM creation functions to population matrices properly.
  6. Always remember to assess the quality of the data and the resulting vital rate models. Function hfv_qc() can help with the former. Object qc in lefkoMod output can help with the latter.
  7. Advanced users can input their own vital rate models individually, or use a data frame approach in which the slopes and intercepts needed for each vital rate are individually specified.

References

Bartoń, K.A. (2014). MuMIn: Multi-model inference.
Bates, D., Maechler, M., Bolker, B. & Walker, S. (2015). Fitting linear mixed-effects models using lme4. Journal of Statistical Software, 67, 1–48.
Brooks, M.E., Kristensen, K., Benthem, K.J. van, Magnusson, A., Berg, C.W., Nielsen, A., et al. (2017). glmmTMB balances speed and flexibility among packages for zero-inflated generalized linear mixed modeling. The R Journal, 9, 378–400.
Burnham, K.P. & Anderson, D.R. (2002). Model selection and multimodel inference: A practical information-theoretic approach. Springer-Verlag New York, Inc., New York, New York, USA.
Shefferson, R.P., Sandercock, B.K., Proper, J. & Beissinger, S.R. (2001). Estimating dormancy and survival of a rare herbaceous perennial using mark-recapture models. Ecology, 82, 145–156.
Yee, T.W. (2015). Vector Generalized Linear and Additive Models: With an Implementation in R.
Yee, T.W. & Wild, C.J. (1996). Vector generalized additive models. Journal of the Royal Statistical Society, Series B, 58, 481–493.
Zeileis, A., Kleiber, C. & Jackman, S. (2008). Regression models for count data in R. Journal of Statistical Software, 27, 1–25.