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

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 fixed terms ("full" is the only setting with interaction terms). If the population is not stratified by reproductive status, then suite = "size" will eliminate reproductive status terms and use all others in the global model. If size is not important, then suite = "rep" will eliminate size but keep reproductive status and all other terms. Finally, suite = "cons" will result in a global model in which neither reproductive status nor size are considered. Other terms can be specified, including individual covariates and age.

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 to suite = "full", 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: subdata
>      AIC      BIC   logLik deviance df.resid 
> 130.1321 148.9737 -60.0660 120.1321      315 
> Random effects:
>  Groups  Name        Std.Dev. 
>  individ (Intercept) 1.199e+00
>  year2   (Intercept) 5.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: subdata
>      AIC      BIC   logLik deviance df.resid 
> 120.2567 138.8254 -55.1284 110.2567      298 
> Random effects:
>  Groups  Name        Std.Dev.
>  individ (Intercept) 0.0000  
>  year2   (Intercept) 0.8776  
>  patchid (Intercept) 0.0000  
> Number of obs: 303, groups:  individ, 70; year2, 5; patchid, 3
> Fixed Effects:
> (Intercept)   size2added  
>      2.4904       0.3134  
> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
> 
> 
> 
> Size model:
> Formula:          size3added ~ (1 | year2) + (1 | patchid) + (1 | individ)
> Data: subdata
>       AIC       BIC    logLik  df.resid 
> 1009.9749 1028.2897 -499.9875       283 
> Random-effects (co)variances:
> 
> Conditional model:
>  Groups  Name        Std.Dev.
>  year2   (Intercept) 0.1133  
>  patchid (Intercept) 0.2118  
>  individ (Intercept) 1.0320  
> 
> Number of obs: 288 / Conditional model: year2, 5; patchid, 3; individ, 70
> 
> Dispersion parameter for truncated_nbinom2 family (): 6.16e+07 
> 
> Fixed Effects:
> 
> Conditional model:
> (Intercept)  
>       0.587  
> 
> 
> 
> Secondary size model:
> [1] 1
> 
> 
> 
> Tertiary size model:
> [1] 1
> 
> 
> 
> Reproductive status model:
> Generalized linear mixed model fit by maximum likelihood (Laplace
>   Approximation) [glmerMod]
>  Family: binomial  ( logit )
> Formula: repstatus3 ~ repstatus2 + size2added + (1 | year2) + (1 | patchid) +  
>     (1 | individ)
>    Data: subdata
>       AIC       BIC    logLik  deviance  df.resid 
>  333.4037  355.3815 -160.7019  321.4037       282 
> Random effects:
>  Groups  Name        Std.Dev.
>  individ (Intercept) 0.1776  
>  year2   (Intercept) 0.6636  
>  patchid (Intercept) 0.3501  
> Number of obs: 288, groups:  individ, 70; year2, 5; patchid, 3
> Fixed Effects:
> (Intercept)   repstatus2   size2added  
>     -1.3836       1.5543       0.1788  
> 
> 
> 
> Fecundity model:
> Formula:          
> feca2 ~ size2added + (1 | year2) + (1 | patchid) + (1 | individ)
> Zero inflation:         
> ~size1added + size2added + (1 | year2) + (1 | patchid) + (1 |     individ)
> Data: subdata
>       AIC       BIC    logLik  df.resid 
>  251.2212  281.6988 -114.6106       107 
> Random-effects (co)variances:
> 
> Conditional model:
>  Groups  Name        Std.Dev. 
>  year2   (Intercept) 5.618e-01
>  patchid (Intercept) 2.247e-01
>  individ (Intercept) 8.061e-05
> 
> Zero-inflation model:
>  Groups  Name        Std.Dev. 
>  year2   (Intercept) 1.723e-09
>  patchid (Intercept) 2.061e-08
>  individ (Intercept) 6.333e-09
> 
> 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.6019       0.0648  
> 
> Zero-inflation model:
> (Intercept)   size1added   size2added  
>      5.0046      -0.6665      -1.6045  
> 
> 
> 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
> 
> 
> 
> 
> 
> 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.82.
> 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.535.
> 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 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, the criterion used for determination of the best-fit model, and quality control data used in summary() calls.

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 or simple 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 size is not a variable in any best-fit model, and historical reproductive status is included in the fecundity model. This is likely enough to warrant using a historical model, since accuracte fecundity estimation 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: subdata
>      AIC      BIC   logLik deviance df.resid 
> 130.1321 148.9737 -60.0660 120.1321      315 
> Random effects:
>  Groups  Name        Std.Dev. 
>  individ (Intercept) 1.199e+00
>  year2   (Intercept) 5.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: subdata
>      AIC      BIC   logLik deviance df.resid 
> 120.2567 138.8254 -55.1284 110.2567      298 
> Random effects:
>  Groups  Name        Std.Dev.
>  individ (Intercept) 0.0000  
>  year2   (Intercept) 0.8776  
>  patchid (Intercept) 0.0000  
> Number of obs: 303, groups:  individ, 70; year2, 5; patchid, 3
> Fixed Effects:
> (Intercept)   size2added  
>      2.4904       0.3134  
> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
> 
> 
> 
> Size model:
> Formula:          size3added ~ (1 | year2) + (1 | patchid) + (1 | individ)
> Data: subdata
>       AIC       BIC    logLik  df.resid 
> 1009.9749 1028.2897 -499.9875       283 
> Random-effects (co)variances:
> 
> Conditional model:
>  Groups  Name        Std.Dev.
>  year2   (Intercept) 0.1133  
>  patchid (Intercept) 0.2118  
>  individ (Intercept) 1.0320  
> 
> Number of obs: 288 / Conditional model: year2, 5; patchid, 3; individ, 70
> 
> Dispersion parameter for truncated_nbinom2 family (): 6.16e+07 
> 
> Fixed Effects:
> 
> Conditional model:
> (Intercept)  
>       0.587  
> 
> 
> 
> Secondary size model:
> [1] 1
> 
> 
> 
> Tertiary size model:
> [1] 1
> 
> 
> 
> Reproductive status model:
> Generalized linear mixed model fit by maximum likelihood (Laplace
>   Approximation) [glmerMod]
>  Family: binomial  ( logit )
> Formula: repstatus3 ~ repstatus2 + size2added + (1 | year2) + (1 | patchid) +  
>     (1 | individ)
>    Data: subdata
>       AIC       BIC    logLik  deviance  df.resid 
>  333.4037  355.3815 -160.7019  321.4037       282 
> Random effects:
>  Groups  Name        Std.Dev.
>  individ (Intercept) 0.1776  
>  year2   (Intercept) 0.6636  
>  patchid (Intercept) 0.3501  
> Number of obs: 288, groups:  individ, 70; year2, 5; patchid, 3
> Fixed Effects:
> (Intercept)   repstatus2   size2added  
>     -1.3836       1.5543       0.1788  
> 
> 
> 
> Fecundity model:
> Formula:          feca2 ~ (1 | year2) + (1 | patchid) + (1 | individ)
> Zero inflation:         ~(1 | year2) + (1 | patchid) + (1 | individ)
> Data: subdata
>      AIC      BIC   logLik df.resid 
>       NA       NA       NA      110 
> Random-effects (co)variances:
> 
> Conditional model:
>  Groups  Name        Std.Dev.
>  year2   (Intercept) 0.7637  
>  patchid (Intercept) 0.4595  
>  individ (Intercept) 0.4287  
> 
> Zero-inflation model:
>  Groups  Name        Std.Dev.
>  year2   (Intercept) 0.2941  
>  patchid (Intercept) 1.0231  
>  individ (Intercept) 1.5569  
> 
> 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.8155  
> 
> Zero-inflation model:
> (Intercept)  
>      -3.213  
> 
> 
> 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
> 
> 
> 
> 
> 
> 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.82.
> 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.53.
> 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. 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/environmental covariates coded in the hfv dataset may also be included in models, and 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). 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, 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  1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000
> Mean    0.916 0.917 0.917 0.917 0.914 0.916 0.917 0.917 0.917 0.914 0.914 0.916
> 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.050 0.050 0.050
> 1st Qu. 0.991 0.991 0.991
> Median  1.000 1.000 1.000
> Mean    0.916 0.916 0.913
> 3rd Qu. 1.000 1.000 1.000
> Max.    1.000 1.000 1.000

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.1628 2.33e-01 2.38e-01 2.36e-01 2.28e-01 2.17e-01
>  [8,] 0.00  0.0  0.0 0.00 0.1035 1.48e-01 1.52e-01 1.50e-01 1.45e-01 1.38e-01
>  [9,] 0.00  0.0  0.0 0.00 0.0658 9.40e-02 9.64e-02 9.54e-02 9.23e-02 8.77e-02
> [10,] 0.00  0.0  0.0 0.00 0.0000 5.98e-02 6.13e-02 6.07e-02 5.87e-02 5.58e-02
> [11,] 0.00  0.0  0.0 0.00 0.0000 3.80e-02 3.90e-02 3.86e-02 3.73e-02 3.55e-02
> [12,] 0.00  0.0  0.0 0.00 0.0000 2.42e-02 2.48e-02 2.45e-02 2.37e-02 2.25e-02
> [13,] 0.00  0.0  0.0 0.00 0.0000 1.54e-02 1.58e-02 1.56e-02 1.51e-02 1.43e-02
> [14,] 0.00  0.0  0.0 0.00 0.0000 9.78e-03 1.00e-02 9.92e-03 9.59e-03 9.12e-03
> [15,] 0.00  0.0  0.0 0.00 0.0000 6.22e-03 6.38e-03 6.31e-03 6.10e-03 5.80e-03
> [16,] 0.00  0.0  0.0 0.00 0.0000 3.96e-03 4.05e-03 4.01e-03 3.88e-03 3.69e-03
> [17,] 0.00  0.0  0.0 0.00 0.0000 2.52e-03 2.58e-03 2.55e-03 2.47e-03 2.34e-03
> [18,] 0.00  0.0  0.0 0.00 0.0000 1.60e-03 1.64e-03 1.62e-03 1.57e-03 1.49e-03
> [19,] 0.00  0.0  0.0 0.00 0.0000 1.02e-03 1.04e-03 1.03e-03 9.98e-04 9.48e-04
> [20,] 0.00  0.0  0.0 0.00 0.0000 6.47e-04 6.63e-04 6.56e-04 6.35e-04 6.03e-04
> [21,] 0.00  0.0  0.0 0.00 0.0000 4.11e-04 4.22e-04 4.17e-04 4.04e-04 3.83e-04
> [22,] 0.00  0.0  0.0 0.00 0.0000 2.62e-04 2.68e-04 2.65e-04 2.57e-04 2.44e-04
> [23,] 0.00  0.0  0.0 0.00 0.0000 1.66e-04 1.71e-04 1.69e-04 1.63e-04 1.55e-04
> [24,] 0.00  0.0  0.0 0.00 0.0000 1.06e-04 1.08e-04 1.07e-04 1.04e-04 9.86e-05
> [25,] 0.00  0.0  0.0 0.00 0.0000 6.73e-05 6.90e-05 6.83e-05 6.60e-05 6.27e-05
> [26,] 0.00  0.0  0.0 0.00 0.0000 4.28e-05 4.39e-05 4.34e-05 4.20e-05 3.99e-05
> [27,] 0.00  0.0  0.0 0.00 0.0000 2.72e-05 2.79e-05 2.76e-05 2.67e-05 2.54e-05
> [28,] 0.00  0.0  0.0 0.00 0.0000 1.73e-05 1.77e-05 1.76e-05 1.70e-05 1.61e-05
> [29,] 0.00  0.0  0.0 0.00 0.0000 1.10e-05 1.13e-05 1.12e-05 1.08e-05 1.03e-05
> [30,] 0.00  0.0  0.0 0.00 0.0000 7.00e-06 7.17e-06 7.10e-06 6.86e-06 6.52e-06
> [31,] 0.00  0.0  0.0 0.00 0.0000 7.24e-02 8.87e-02 1.05e-01 1.21e-01 1.38e-01
> [32,] 0.00  0.0  0.0 0.00 0.0000 4.60e-02 5.64e-02 6.68e-02 7.72e-02 8.77e-02
> [33,] 0.00  0.0  0.0 0.00 0.0000 2.93e-02 3.59e-02 4.25e-02 4.91e-02 5.58e-02
> [34,] 0.00  0.0  0.0 0.00 0.0000 1.86e-02 2.28e-02 2.70e-02 3.12e-02 3.55e-02
> [35,] 0.00  0.0  0.0 0.00 0.0000 1.18e-02 1.45e-02 1.72e-02 1.98e-02 2.25e-02
> [36,] 0.00  0.0  0.0 0.00 0.0000 7.52e-03 9.22e-03 1.09e-02 1.26e-02 1.43e-02
> [37,] 0.00  0.0  0.0 0.00 0.0000 4.79e-03 5.87e-03 6.94e-03 8.02e-03 9.12e-03
> [38,] 0.00  0.0  0.0 0.00 0.0000 3.04e-03 3.73e-03 4.41e-03 5.10e-03 5.80e-03
> [39,] 0.00  0.0  0.0 0.00 0.0000 1.94e-03 2.37e-03 2.81e-03 3.25e-03 3.69e-03
> [40,] 0.00  0.0  0.0 0.00 0.0000 1.23e-03 1.51e-03 1.79e-03 2.06e-03 2.35e-03
> [41,] 0.00  0.0  0.0 0.00 0.0000 7.83e-04 9.59e-04 1.14e-03 1.31e-03 1.49e-03
> [42,] 0.00  0.0  0.0 0.00 0.0000 4.98e-04 6.10e-04 7.22e-04 8.35e-04 9.48e-04
> [43,] 0.00  0.0  0.0 0.00 0.0000 3.16e-04 3.88e-04 4.59e-04 5.31e-04 6.03e-04
> [44,] 0.00  0.0  0.0 0.00 0.0000 2.01e-04 2.47e-04 2.92e-04 3.38e-04 3.84e-04
> [45,] 0.00  0.0  0.0 0.00 0.0000 1.28e-04 1.57e-04 1.86e-04 2.15e-04 2.44e-04
> [46,] 0.00  0.0  0.0 0.00 0.0000 8.14e-05 9.98e-05 1.18e-04 1.36e-04 1.55e-04
> [47,] 0.00  0.0  0.0 0.00 0.0000 5.18e-05 6.34e-05 7.51e-05 8.68e-05 9.86e-05
> [48,] 0.00  0.0  0.0 0.00 0.0000 3.29e-05 4.03e-05 4.78e-05 5.52e-05 6.27e-05
> [49,] 0.00  0.0  0.0 0.00 0.0000 2.09e-05 2.57e-05 3.04e-05 3.51e-05 3.99e-05
> [50,] 0.00  0.0  0.0 0.00 0.0000 1.33e-05 1.63e-05 1.93e-05 2.23e-05 2.54e-05
> [51,] 0.00  0.0  0.0 0.00 0.0000 8.46e-06 1.04e-05 1.23e-05 1.42e-05 1.61e-05
> [52,] 0.00  0.0  0.0 0.00 0.0000 5.38e-06 6.60e-06 7.81e-06 9.03e-06 1.03e-05
> [53,] 0.00  0.0  0.0 0.00 0.0000 3.42e-06 4.20e-06 4.97e-06 5.74e-06 6.52e-06
> [54,] 0.00  0.0  0.0 0.00 0.0000 2.18e-06 2.67e-06 3.16e-06 3.65e-06 4.15e-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,] 2.03e-01 1.89e-01 1.73e-01 1.57e-01 1.42e-01 1.27e-01 1.13e-01 9.94e-02
>  [8,] 1.29e-01 1.20e-01 1.10e-01 1.00e-01 9.03e-02 8.08e-02 7.17e-02 6.32e-02
>  [9,] 8.22e-02 7.62e-02 7.00e-02 6.37e-02 5.74e-02 5.14e-02 4.56e-02 4.02e-02
> [10,] 5.23e-02 4.85e-02 4.45e-02 4.05e-02 3.65e-02 3.27e-02 2.90e-02 2.56e-02
> [11,] 3.32e-02 3.08e-02 2.83e-02 2.57e-02 2.32e-02 2.08e-02 1.84e-02 1.63e-02
> [12,] 2.11e-02 1.96e-02 1.80e-02 1.64e-02 1.48e-02 1.32e-02 1.17e-02 1.03e-02
> [13,] 1.34e-02 1.25e-02 1.14e-02 1.04e-02 9.39e-03 8.40e-03 7.46e-03 6.57e-03
> [14,] 8.55e-03 7.93e-03 7.28e-03 6.62e-03 5.97e-03 5.34e-03 4.74e-03 4.18e-03
> [15,] 5.44e-03 5.04e-03 4.63e-03 4.21e-03 3.80e-03 3.40e-03 3.02e-03 2.66e-03
> [16,] 3.46e-03 3.21e-03 2.94e-03 2.68e-03 2.41e-03 2.16e-03 1.92e-03 1.69e-03
> [17,] 2.20e-03 2.04e-03 1.87e-03 1.70e-03 1.54e-03 1.37e-03 1.22e-03 1.08e-03
> [18,] 1.40e-03 1.30e-03 1.19e-03 1.08e-03 9.77e-04 8.74e-04 7.76e-04 6.84e-04
> [19,] 8.89e-04 8.25e-04 7.57e-04 6.89e-04 6.21e-04 5.56e-04 4.93e-04 4.35e-04
> [20,] 5.65e-04 5.24e-04 4.81e-04 4.38e-04 3.95e-04 3.53e-04 3.14e-04 2.76e-04
> [21,] 3.60e-04 3.33e-04 3.06e-04 2.78e-04 2.51e-04 2.25e-04 1.99e-04 1.76e-04
> [22,] 2.29e-04 2.12e-04 1.95e-04 1.77e-04 1.60e-04 1.43e-04 1.27e-04 1.12e-04
> [23,] 1.45e-04 1.35e-04 1.24e-04 1.13e-04 1.02e-04 9.08e-05 8.07e-05 7.11e-05
> [24,] 9.25e-05 8.58e-05 7.87e-05 7.16e-05 6.46e-05 5.78e-05 5.13e-05 4.52e-05
> [25,] 5.88e-05 5.45e-05 5.01e-05 4.55e-05 4.11e-05 3.67e-05 3.26e-05 2.88e-05
> [26,] 3.74e-05 3.47e-05 3.18e-05 2.90e-05 2.61e-05 2.34e-05 2.07e-05 1.83e-05
> [27,] 2.38e-05 2.21e-05 2.02e-05 1.84e-05 1.66e-05 1.49e-05 1.32e-05 1.16e-05
> [28,] 1.51e-05 1.40e-05 1.29e-05 1.17e-05 1.06e-05 9.45e-06 8.39e-06 7.39e-06
> [29,] 9.62e-06 8.92e-06 8.19e-06 7.45e-06 6.72e-06 6.01e-06 5.33e-06 4.70e-06
> [30,] 6.12e-06 5.67e-06 5.21e-06 4.74e-06 4.27e-06 3.82e-06 3.39e-06 2.99e-06
> [31,] 1.55e-01 1.71e-01 1.88e-01 2.05e-01 2.21e-01 2.36e-01 2.51e-01 2.64e-01
> [32,] 9.83e-02 1.09e-01 1.20e-01 1.30e-01 1.40e-01 1.50e-01 1.59e-01 1.68e-01
> [33,] 6.25e-02 6.93e-02 7.61e-02 8.28e-02 8.93e-02 9.55e-02 1.01e-01 1.07e-01
> [34,] 3.98e-02 4.41e-02 4.84e-02 5.26e-02 5.68e-02 6.07e-02 6.45e-02 6.79e-02
> [35,] 2.53e-02 2.80e-02 3.08e-02 3.35e-02 3.61e-02 3.86e-02 4.10e-02 4.32e-02
> [36,] 1.61e-02 1.78e-02 1.96e-02 2.13e-02 2.30e-02 2.46e-02 2.61e-02 2.75e-02
> [37,] 1.02e-02 1.13e-02 1.24e-02 1.35e-02 1.46e-02 1.56e-02 1.66e-02 1.75e-02
> [38,] 6.50e-03 7.21e-03 7.91e-03 8.61e-03 9.28e-03 9.93e-03 1.05e-02 1.11e-02
> [39,] 4.14e-03 4.58e-03 5.03e-03 5.47e-03 5.90e-03 6.31e-03 6.70e-03 7.07e-03
> [40,] 2.63e-03 2.92e-03 3.20e-03 3.48e-03 3.75e-03 4.02e-03 4.26e-03 4.49e-03
> [41,] 1.67e-03 1.85e-03 2.04e-03 2.21e-03 2.39e-03 2.55e-03 2.71e-03 2.86e-03
> [42,] 1.06e-03 1.18e-03 1.29e-03 1.41e-03 1.52e-03 1.62e-03 1.72e-03 1.82e-03
> [43,] 6.76e-04 7.50e-04 8.23e-04 8.95e-04 9.65e-04 1.03e-03 1.10e-03 1.16e-03
> [44,] 4.30e-04 4.77e-04 5.23e-04 5.69e-04 6.14e-04 6.57e-04 6.97e-04 7.35e-04
> [45,] 2.73e-04 3.03e-04 3.33e-04 3.62e-04 3.90e-04 4.18e-04 4.43e-04 4.67e-04
> [46,] 1.74e-04 1.93e-04 2.12e-04 2.30e-04 2.48e-04 2.66e-04 2.82e-04 2.97e-04
> [47,] 1.11e-04 1.23e-04 1.35e-04 1.46e-04 1.58e-04 1.69e-04 1.79e-04 1.89e-04
> [48,] 7.03e-05 7.80e-05 8.56e-05 9.31e-05 1.00e-04 1.07e-04 1.14e-04 1.20e-04
> [49,] 4.47e-05 4.96e-05 5.44e-05 5.92e-05 6.39e-05 6.83e-05 7.25e-05 7.64e-05
> [50,] 2.84e-05 3.15e-05 3.46e-05 3.77e-05 4.06e-05 4.34e-05 4.61e-05 4.86e-05
> [51,] 1.81e-05 2.01e-05 2.20e-05 2.39e-05 2.58e-05 2.76e-05 2.93e-05 3.09e-05
> [52,] 1.15e-05 1.28e-05 1.40e-05 1.52e-05 1.64e-05 1.76e-05 1.86e-05 1.97e-05
> [53,] 7.31e-06 8.11e-06 8.90e-06 9.68e-06 1.04e-05 1.12e-05 1.19e-05 1.25e-05
> [54,] 4.65e-06 5.16e-06 5.66e-06 6.16e-06 6.64e-06 7.10e-06 7.54e-06 7.95e-06
>          [,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,] 8.70e-02 7.58e-02 6.56e-02 5.66e-02 4.85e-02 4.15e-02 3.54e-02 3.01e-02
>  [8,] 5.54e-02 4.82e-02 4.17e-02 3.60e-02 3.09e-02 2.64e-02 2.25e-02 1.91e-02
>  [9,] 3.52e-02 3.06e-02 2.65e-02 2.29e-02 1.96e-02 1.68e-02 1.43e-02 1.22e-02
> [10,] 2.24e-02 1.95e-02 1.69e-02 1.45e-02 1.25e-02 1.07e-02 9.10e-03 7.73e-03
> [11,] 1.42e-02 1.24e-02 1.07e-02 9.25e-03 7.94e-03 6.79e-03 5.79e-03 4.92e-03
> [12,] 9.05e-03 7.88e-03 6.83e-03 5.88e-03 5.05e-03 4.32e-03 3.68e-03 3.13e-03
> [13,] 5.76e-03 5.01e-03 4.34e-03 3.74e-03 3.21e-03 2.75e-03 2.34e-03 1.99e-03
> [14,] 3.66e-03 3.19e-03 2.76e-03 2.38e-03 2.04e-03 1.75e-03 1.49e-03 1.26e-03
> [15,] 2.33e-03 2.03e-03 1.76e-03 1.51e-03 1.30e-03 1.11e-03 9.46e-04 8.04e-04
> [16,] 1.48e-03 1.29e-03 1.12e-03 9.62e-04 8.26e-04 7.06e-04 6.02e-04 5.11e-04
> [17,] 9.42e-04 8.20e-04 7.10e-04 6.12e-04 5.25e-04 4.49e-04 3.83e-04 3.25e-04
> [18,] 5.99e-04 5.21e-04 4.51e-04 3.89e-04 3.34e-04 2.86e-04 2.43e-04 2.07e-04
> [19,] 3.81e-04 3.31e-04 2.87e-04 2.47e-04 2.12e-04 1.82e-04 1.55e-04 1.32e-04
> [20,] 2.42e-04 2.11e-04 1.83e-04 1.57e-04 1.35e-04 1.15e-04 9.84e-05 8.36e-05
> [21,] 1.54e-04 1.34e-04 1.16e-04 1.00e-04 8.59e-05 7.34e-05 6.26e-05 5.32e-05
> [22,] 9.79e-05 8.53e-05 7.38e-05 6.36e-05 5.46e-05 4.67e-05 3.98e-05 3.38e-05
> [23,] 6.23e-05 5.42e-05 4.69e-05 4.05e-05 3.47e-05 2.97e-05 2.53e-05 2.15e-05
> [24,] 3.96e-05 3.45e-05 2.99e-05 2.57e-05 2.21e-05 1.89e-05 1.61e-05 1.37e-05
> [25,] 2.52e-05 2.19e-05 1.90e-05 1.64e-05 1.40e-05 1.20e-05 1.02e-05 8.70e-06
> [26,] 1.60e-05 1.39e-05 1.21e-05 1.04e-05 8.93e-06 7.64e-06 6.51e-06 5.53e-06
> [27,] 1.02e-05 8.87e-06 7.68e-06 6.62e-06 5.68e-06 4.86e-06 4.14e-06 3.52e-06
> [28,] 6.48e-06 5.64e-06 4.88e-06 4.21e-06 3.61e-06 3.09e-06 2.63e-06 2.24e-06
> [29,] 4.12e-06 3.59e-06 3.11e-06 2.68e-06 2.30e-06 1.96e-06 1.67e-06 1.42e-06
> [30,] 2.62e-06 2.28e-06 1.97e-06 1.70e-06 1.46e-06 1.25e-06 1.06e-06 9.05e-07
> [31,] 2.77e-01 2.88e-01 2.98e-01 3.07e-01 3.15e-01 3.22e-01 3.29e-01 3.34e-01
> [32,] 1.76e-01 1.83e-01 1.90e-01 1.95e-01 2.01e-01 2.05e-01 2.09e-01 2.12e-01
> [33,] 1.12e-01 1.16e-01 1.21e-01 1.24e-01 1.28e-01 1.30e-01 1.33e-01 1.35e-01
> [34,] 7.12e-02 7.41e-02 7.67e-02 7.90e-02 8.11e-02 8.29e-02 8.45e-02 8.59e-02
> [35,] 4.52e-02 4.71e-02 4.88e-02 5.03e-02 5.16e-02 5.27e-02 5.37e-02 5.46e-02
> [36,] 2.88e-02 3.00e-02 3.10e-02 3.20e-02 3.28e-02 3.35e-02 3.42e-02 3.47e-02
> [37,] 1.83e-02 1.90e-02 1.97e-02 2.03e-02 2.09e-02 2.13e-02 2.17e-02 2.21e-02
> [38,] 1.16e-02 1.21e-02 1.25e-02 1.29e-02 1.33e-02 1.36e-02 1.38e-02 1.40e-02
> [39,] 7.40e-03 7.70e-03 7.98e-03 8.22e-03 8.44e-03 8.63e-03 8.79e-03 8.93e-03
> [40,] 4.71e-03 4.90e-03 5.07e-03 5.23e-03 5.36e-03 5.49e-03 5.59e-03 5.68e-03
> [41,] 2.99e-03 3.12e-03 3.23e-03 3.32e-03 3.41e-03 3.49e-03 3.55e-03 3.61e-03
> [42,] 1.90e-03 1.98e-03 2.05e-03 2.11e-03 2.17e-03 2.22e-03 2.26e-03 2.30e-03
> [43,] 1.21e-03 1.26e-03 1.30e-03 1.34e-03 1.38e-03 1.41e-03 1.44e-03 1.46e-03
> [44,] 7.70e-04 8.01e-04 8.30e-04 8.55e-04 8.77e-04 8.97e-04 9.14e-04 9.29e-04
> [45,] 4.89e-04 5.09e-04 5.28e-04 5.44e-04 5.58e-04 5.70e-04 5.81e-04 5.91e-04
> [46,] 3.11e-04 3.24e-04 3.35e-04 3.46e-04 3.55e-04 3.63e-04 3.70e-04 3.76e-04
> [47,] 1.98e-04 2.06e-04 2.13e-04 2.20e-04 2.26e-04 2.31e-04 2.35e-04 2.39e-04
> [48,] 1.26e-04 1.31e-04 1.36e-04 1.40e-04 1.43e-04 1.47e-04 1.49e-04 1.52e-04
> [49,] 8.00e-05 8.33e-05 8.63e-05 8.89e-05 9.12e-05 9.33e-05 9.51e-05 9.66e-05
> [50,] 5.09e-05 5.30e-05 5.49e-05 5.65e-05 5.80e-05 5.93e-05 6.05e-05 6.14e-05
> [51,] 3.24e-05 3.37e-05 3.49e-05 3.60e-05 3.69e-05 3.77e-05 3.84e-05 3.91e-05
> [52,] 2.06e-05 2.14e-05 2.22e-05 2.29e-05 2.35e-05 2.40e-05 2.44e-05 2.48e-05
> [53,] 1.31e-05 1.36e-05 1.41e-05 1.45e-05 1.49e-05 1.53e-05 1.55e-05 1.58e-05
> [54,] 8.32e-06 8.67e-06 8.97e-06 9.25e-06 9.49e-06 9.70e-06 9.89e-06 1.00e-05
>          [,27]    [,28]    [,29]    [,30]    [,31]    [,32]    [,33]    [,34]
>  [1,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 8.13e+02 8.13e+02 8.13e+02 8.13e+02
>  [2,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 8.13e+02 8.13e+02 8.13e+02 8.13e+02
>  [3,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
>  [4,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
>  [5,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
>  [6,] 7.78e-05 5.69e-05 4.16e-05 3.04e-05 3.69e-02 2.81e-02 2.10e-02 1.56e-02
>  [7,] 2.55e-02 2.16e-02 1.82e-02 1.54e-02 1.18e-01 1.10e-01 9.94e-02 8.85e-02
>  [8,] 1.62e-02 1.37e-02 1.16e-02 9.77e-03 7.54e-02 6.98e-02 6.32e-02 5.63e-02
>  [9,] 1.03e-02 8.72e-03 7.36e-03 6.21e-03 4.79e-02 4.44e-02 4.02e-02 3.58e-02
> [10,] 6.56e-03 5.55e-03 4.68e-03 3.95e-03 3.05e-02 2.82e-02 2.56e-02 2.27e-02
> [11,] 4.17e-03 3.53e-03 2.98e-03 2.51e-03 1.94e-02 1.80e-02 1.63e-02 1.45e-02
> [12,] 2.65e-03 2.24e-03 1.89e-03 1.60e-03 1.23e-02 1.14e-02 1.03e-02 9.20e-03
> [13,] 1.69e-03 1.43e-03 1.20e-03 1.02e-03 7.84e-03 7.26e-03 6.57e-03 5.85e-03
> [14,] 1.07e-03 9.07e-04 7.66e-04 6.46e-04 4.98e-03 4.62e-03 4.18e-03 3.72e-03
> [15,] 6.82e-04 5.77e-04 4.87e-04 4.11e-04 3.17e-03 2.94e-03 2.66e-03 2.37e-03
> [16,] 4.34e-04 3.67e-04 3.10e-04 2.61e-04 2.02e-03 1.87e-03 1.69e-03 1.50e-03
> [17,] 2.76e-04 2.33e-04 1.97e-04 1.66e-04 1.28e-03 1.19e-03 1.07e-03 9.57e-04
> [18,] 1.75e-04 1.48e-04 1.25e-04 1.06e-04 8.15e-04 7.55e-04 6.83e-04 6.08e-04
> [19,] 1.11e-04 9.43e-05 7.97e-05 6.72e-05 5.18e-04 4.80e-04 4.35e-04 3.87e-04
> [20,] 7.09e-05 6.00e-05 5.07e-05 4.27e-05 3.30e-04 3.05e-04 2.76e-04 2.46e-04
> [21,] 4.51e-05 3.81e-05 3.22e-05 2.72e-05 2.10e-04 1.94e-04 1.76e-04 1.56e-04
> [22,] 2.87e-05 2.43e-05 2.05e-05 1.73e-05 1.33e-04 1.24e-04 1.12e-04 9.95e-05
> [23,] 1.82e-05 1.54e-05 1.30e-05 1.10e-05 8.48e-05 7.86e-05 7.11e-05 6.33e-05
> [24,] 1.16e-05 9.81e-06 8.28e-06 6.99e-06 5.39e-05 5.00e-05 4.52e-05 4.02e-05
> [25,] 7.37e-06 6.24e-06 5.27e-06 4.44e-06 3.43e-05 3.18e-05 2.87e-05 2.56e-05
> [26,] 4.69e-06 3.97e-06 3.35e-06 2.82e-06 2.18e-05 2.02e-05 1.83e-05 1.63e-05
> [27,] 2.98e-06 2.52e-06 2.13e-06 1.80e-06 1.39e-05 1.28e-05 1.16e-05 1.03e-05
> [28,] 1.90e-06 1.60e-06 1.35e-06 1.14e-06 8.82e-06 8.17e-06 7.39e-06 6.58e-06
> [29,] 1.21e-06 1.02e-06 8.62e-07 7.26e-07 5.61e-06 5.20e-06 4.70e-06 4.18e-06
> [30,] 7.67e-07 6.49e-07 5.48e-07 4.62e-07 3.56e-06 3.30e-06 2.99e-06 2.66e-06
> [31,] 3.39e-01 3.42e-01 3.46e-01 3.49e-01 2.09e-01 2.31e-01 2.50e-01 2.66e-01
> [32,] 2.15e-01 2.18e-01 2.20e-01 2.22e-01 1.33e-01 1.47e-01 1.59e-01 1.69e-01
> [33,] 1.37e-01 1.39e-01 1.40e-01 1.41e-01 8.43e-02 9.35e-02 1.01e-01 1.08e-01
> [34,] 8.71e-02 8.81e-02 8.89e-02 8.97e-02 5.36e-02 5.94e-02 6.43e-02 6.85e-02
> [35,] 5.54e-02 5.60e-02 5.66e-02 5.70e-02 3.41e-02 3.78e-02 4.09e-02 4.35e-02
> [36,] 3.52e-02 3.56e-02 3.60e-02 3.63e-02 2.17e-02 2.40e-02 2.60e-02 2.77e-02
> [37,] 2.24e-02 2.27e-02 2.29e-02 2.31e-02 1.38e-02 1.53e-02 1.65e-02 1.76e-02
> [38,] 1.42e-02 1.44e-02 1.45e-02 1.47e-02 8.77e-03 9.72e-03 1.05e-02 1.12e-02
> [39,] 9.05e-03 9.16e-03 9.25e-03 9.33e-03 5.58e-03 6.18e-03 6.69e-03 7.12e-03
> [40,] 5.76e-03 5.83e-03 5.88e-03 5.93e-03 3.55e-03 3.93e-03 4.25e-03 4.53e-03
> [41,] 3.66e-03 3.70e-03 3.74e-03 3.77e-03 2.26e-03 2.50e-03 2.70e-03 2.88e-03
> [42,] 2.33e-03 2.36e-03 2.38e-03 2.40e-03 1.43e-03 1.59e-03 1.72e-03 1.83e-03
> [43,] 1.48e-03 1.50e-03 1.51e-03 1.53e-03 9.12e-04 1.01e-03 1.09e-03 1.16e-03
> [44,] 9.42e-04 9.53e-04 9.62e-04 9.70e-04 5.80e-04 6.43e-04 6.96e-04 7.40e-04
> [45,] 5.99e-04 6.06e-04 6.12e-04 6.17e-04 3.69e-04 4.09e-04 4.42e-04 4.71e-04
> [46,] 3.81e-04 3.85e-04 3.89e-04 3.92e-04 2.35e-04 2.60e-04 2.81e-04 2.99e-04
> [47,] 2.42e-04 2.45e-04 2.47e-04 2.49e-04 1.49e-04 1.65e-04 1.79e-04 1.90e-04
> [48,] 1.54e-04 1.56e-04 1.57e-04 1.59e-04 9.49e-05 1.05e-04 1.14e-04 1.21e-04
> [49,] 9.79e-05 9.91e-05 1.00e-04 1.01e-04 6.03e-05 6.69e-05 7.23e-05 7.70e-05
> [50,] 6.23e-05 6.30e-05 6.36e-05 6.41e-05 3.84e-05 4.25e-05 4.60e-05 4.90e-05
> [51,] 3.96e-05 4.01e-05 4.05e-05 4.08e-05 2.44e-05 2.70e-05 2.93e-05 3.11e-05
> [52,] 2.52e-05 2.55e-05 2.57e-05 2.59e-05 1.55e-05 1.72e-05 1.86e-05 1.98e-05
> [53,] 1.60e-05 1.62e-05 1.64e-05 1.65e-05 9.87e-06 1.09e-05 1.18e-05 1.26e-05
> [54,] 1.02e-05 1.03e-05 1.04e-05 1.05e-05 6.28e-06 6.95e-06 7.52e-06 8.01e-06
>          [,35]    [,36]    [,37]    [,38]    [,39]    [,40]    [,41]    [,42]
>  [1,] 8.13e+02 8.13e+02 8.13e+02 8.13e+02 8.13e+02 8.13e+02 8.13e+02 8.13e+02
>  [2,] 8.13e+02 8.13e+02 8.13e+02 8.13e+02 8.13e+02 8.13e+02 8.13e+02 8.13e+02
>  [3,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
>  [4,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
>  [5,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
>  [6,] 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.78e-02 6.79e-02 5.88e-02 5.06e-02 4.34e-02 3.71e-02 3.15e-02 2.68e-02
>  [8,] 4.95e-02 4.32e-02 3.74e-02 3.22e-02 2.76e-02 2.36e-02 2.01e-02 1.70e-02
>  [9,] 3.15e-02 2.74e-02 2.38e-02 2.05e-02 1.76e-02 1.50e-02 1.28e-02 1.08e-02
> [10,] 2.00e-02 1.75e-02 1.51e-02 1.30e-02 1.12e-02 9.53e-03 8.11e-03 6.89e-03
> [11,] 1.27e-02 1.11e-02 9.61e-03 8.28e-03 7.10e-03 6.06e-03 5.16e-03 4.38e-03
> [12,] 8.09e-03 7.06e-03 6.11e-03 5.27e-03 4.51e-03 3.85e-03 3.28e-03 2.79e-03
> [13,] 5.15e-03 4.49e-03 3.89e-03 3.35e-03 2.87e-03 2.45e-03 2.09e-03 1.77e-03
> [14,] 3.27e-03 2.85e-03 2.47e-03 2.13e-03 1.83e-03 1.56e-03 1.33e-03 1.13e-03
> [15,] 2.08e-03 1.82e-03 1.57e-03 1.35e-03 1.16e-03 9.91e-04 8.44e-04 7.16e-04
> [16,] 1.32e-03 1.15e-03 1.00e-03 8.61e-04 7.38e-04 6.30e-04 5.37e-04 4.55e-04
> [17,] 8.42e-04 7.34e-04 6.36e-04 5.48e-04 4.69e-04 4.01e-04 3.41e-04 2.90e-04
> [18,] 5.35e-04 4.67e-04 4.04e-04 3.48e-04 2.99e-04 2.55e-04 2.17e-04 1.84e-04
> [19,] 3.40e-04 2.97e-04 2.57e-04 2.21e-04 1.90e-04 1.62e-04 1.38e-04 1.17e-04
> [20,] 2.16e-04 1.89e-04 1.64e-04 1.41e-04 1.21e-04 1.03e-04 8.78e-05 7.45e-05
> [21,] 1.38e-04 1.20e-04 1.04e-04 8.96e-05 7.68e-05 6.56e-05 5.58e-05 4.74e-05
> [22,] 8.75e-05 7.64e-05 6.61e-05 5.70e-05 4.88e-05 4.17e-05 3.55e-05 3.01e-05
> [23,] 5.57e-05 4.86e-05 4.21e-05 3.62e-05 3.10e-05 2.65e-05 2.26e-05 1.92e-05
> [24,] 3.54e-05 3.09e-05 2.67e-05 2.30e-05 1.97e-05 1.69e-05 1.44e-05 1.22e-05
> [25,] 2.25e-05 1.96e-05 1.70e-05 1.46e-05 1.26e-05 1.07e-05 9.13e-06 7.75e-06
> [26,] 1.43e-05 1.25e-05 1.08e-05 9.31e-06 7.98e-06 6.82e-06 5.80e-06 4.93e-06
> [27,] 9.11e-06 7.94e-06 6.88e-06 5.92e-06 5.08e-06 4.34e-06 3.69e-06 3.13e-06
> [28,] 5.79e-06 5.05e-06 4.37e-06 3.77e-06 3.23e-06 2.76e-06 2.35e-06 1.99e-06
> [29,] 3.68e-06 3.21e-06 2.78e-06 2.40e-06 2.05e-06 1.75e-06 1.49e-06 1.27e-06
> [30,] 2.34e-06 2.04e-06 1.77e-06 1.52e-06 1.31e-06 1.12e-06 9.49e-07 8.06e-07
> [31,] 2.80e-01 2.92e-01 3.02e-01 3.11e-01 3.19e-01 3.26e-01 3.32e-01 3.37e-01
> [32,] 1.78e-01 1.86e-01 1.92e-01 1.98e-01 2.03e-01 2.07e-01 2.11e-01 2.14e-01
> [33,] 1.13e-01 1.18e-01 1.22e-01 1.26e-01 1.29e-01 1.32e-01 1.34e-01 1.36e-01
> [34,] 7.20e-02 7.51e-02 7.78e-02 8.01e-02 8.21e-02 8.38e-02 8.53e-02 8.66e-02
> [35,] 4.58e-02 4.78e-02 4.95e-02 5.09e-02 5.22e-02 5.33e-02 5.43e-02 5.51e-02
> [36,] 2.91e-02 3.04e-02 3.15e-02 3.24e-02 3.32e-02 3.39e-02 3.45e-02 3.50e-02
> [37,] 1.85e-02 1.93e-02 2.00e-02 2.06e-02 2.11e-02 2.16e-02 2.19e-02 2.23e-02
> [38,] 1.18e-02 1.23e-02 1.27e-02 1.31e-02 1.34e-02 1.37e-02 1.40e-02 1.42e-02
> [39,] 7.49e-03 7.81e-03 8.09e-03 8.33e-03 8.54e-03 8.72e-03 8.88e-03 9.01e-03
> [40,] 4.76e-03 4.97e-03 5.14e-03 5.30e-03 5.43e-03 5.55e-03 5.64e-03 5.73e-03
> [41,] 3.03e-03 3.16e-03 3.27e-03 3.37e-03 3.45e-03 3.53e-03 3.59e-03 3.64e-03
> [42,] 1.93e-03 2.01e-03 2.08e-03 2.14e-03 2.20e-03 2.24e-03 2.28e-03 2.32e-03
> [43,] 1.23e-03 1.28e-03 1.32e-03 1.36e-03 1.40e-03 1.43e-03 1.45e-03 1.47e-03
> [44,] 7.79e-04 8.12e-04 8.41e-04 8.66e-04 8.88e-04 9.07e-04 9.23e-04 9.37e-04
> [45,] 4.95e-04 5.17e-04 5.35e-04 5.51e-04 5.65e-04 5.77e-04 5.87e-04 5.96e-04
> [46,] 3.15e-04 3.29e-04 3.40e-04 3.50e-04 3.59e-04 3.67e-04 3.73e-04 3.79e-04
> [47,] 2.00e-04 2.09e-04 2.16e-04 2.23e-04 2.28e-04 2.33e-04 2.37e-04 2.41e-04
> [48,] 1.27e-04 1.33e-04 1.38e-04 1.42e-04 1.45e-04 1.48e-04 1.51e-04 1.53e-04
> [49,] 8.10e-05 8.45e-05 8.75e-05 9.01e-05 9.24e-05 9.43e-05 9.60e-05 9.74e-05
> [50,] 5.15e-05 5.37e-05 5.56e-05 5.73e-05 5.87e-05 6.00e-05 6.10e-05 6.20e-05
> [51,] 3.28e-05 3.42e-05 3.54e-05 3.64e-05 3.74e-05 3.81e-05 3.88e-05 3.94e-05
> [52,] 2.08e-05 2.17e-05 2.25e-05 2.32e-05 2.38e-05 2.43e-05 2.47e-05 2.51e-05
> [53,] 1.32e-05 1.38e-05 1.43e-05 1.47e-05 1.51e-05 1.54e-05 1.57e-05 1.59e-05
> [54,] 8.43e-06 8.79e-06 9.10e-06 9.37e-06 9.61e-06 9.81e-06 9.98e-06 1.01e-05
>          [,43]    [,44]    [,45]    [,46]    [,47]    [,48]    [,49]    [,50]
>  [1,] 8.13e+02 8.13e+02 8.13e+02 8.13e+02 8.13e+02 8.13e+02 8.13e+02 8.13e+02
>  [2,] 8.13e+02 8.13e+02 8.13e+02 8.13e+02 8.13e+02 8.13e+02 8.13e+02 8.13e+02
>  [3,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
>  [4,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
>  [5,] 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00
>  [6,] 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,] 2.27e-02 1.92e-02 1.62e-02 1.36e-02 1.15e-02 9.64e-03 8.10e-03 6.80e-03
>  [8,] 1.44e-02 1.22e-02 1.03e-02 8.66e-03 7.29e-03 6.13e-03 5.15e-03 4.32e-03
>  [9,] 9.17e-03 7.75e-03 6.54e-03 5.51e-03 4.64e-03 3.90e-03 3.27e-03 2.75e-03
> [10,] 5.83e-03 4.93e-03 4.16e-03 3.50e-03 2.95e-03 2.48e-03 2.08e-03 1.75e-03
> [11,] 3.71e-03 3.13e-03 2.64e-03 2.23e-03 1.88e-03 1.58e-03 1.32e-03 1.11e-03
> [12,] 2.36e-03 1.99e-03 1.68e-03 1.42e-03 1.19e-03 1.00e-03 8.42e-04 7.07e-04
> [13,] 1.50e-03 1.27e-03 1.07e-03 9.01e-04 7.58e-04 6.38e-04 5.36e-04 4.50e-04
> [14,] 9.54e-04 8.06e-04 6.80e-04 5.73e-04 4.82e-04 4.05e-04 3.41e-04 2.86e-04
> [15,] 6.07e-04 5.13e-04 4.33e-04 3.64e-04 3.07e-04 2.58e-04 2.17e-04 1.82e-04
> [16,] 3.86e-04 3.26e-04 2.75e-04 2.32e-04 1.95e-04 1.64e-04 1.38e-04 1.16e-04
> [17,] 2.45e-04 2.07e-04 1.75e-04 1.47e-04 1.24e-04 1.04e-04 8.76e-05 7.35e-05
> [18,] 1.56e-04 1.32e-04 1.11e-04 9.37e-05 7.89e-05 6.63e-05 5.57e-05 4.68e-05
> [19,] 9.92e-05 8.38e-05 7.07e-05 5.96e-05 5.02e-05 4.22e-05 3.54e-05 2.97e-05
> [20,] 6.31e-05 5.33e-05 4.50e-05 3.79e-05 3.19e-05 2.68e-05 2.25e-05 1.89e-05
> [21,] 4.01e-05 3.39e-05 2.86e-05 2.41e-05 2.03e-05 1.71e-05 1.43e-05 1.20e-05
> [22,] 2.55e-05 2.16e-05 1.82e-05 1.53e-05 1.29e-05 1.08e-05 9.11e-06 7.65e-06
> [23,] 1.62e-05 1.37e-05 1.16e-05 9.75e-06 8.20e-06 6.90e-06 5.79e-06 4.86e-06
> [24,] 1.03e-05 8.72e-06 7.36e-06 6.20e-06 5.22e-06 4.39e-06 3.68e-06 3.09e-06
> [25,] 6.56e-06 5.54e-06 4.68e-06 3.94e-06 3.32e-06 2.79e-06 2.34e-06 1.97e-06
> [26,] 4.17e-06 3.53e-06 2.97e-06 2.51e-06 2.11e-06 1.77e-06 1.49e-06 1.25e-06
> [27,] 2.65e-06 2.24e-06 1.89e-06 1.59e-06 1.34e-06 1.13e-06 9.47e-07 7.95e-07
> [28,] 1.69e-06 1.43e-06 1.20e-06 1.01e-06 8.53e-07 7.17e-07 6.02e-07 5.06e-07
> [29,] 1.07e-06 9.07e-07 7.65e-07 6.45e-07 5.42e-07 4.56e-07 3.83e-07 3.22e-07
> [30,] 6.82e-07 5.77e-07 4.87e-07 4.10e-07 3.45e-07 2.90e-07 2.44e-07 2.04e-07
> [31,] 3.41e-01 3.45e-01 3.48e-01 3.50e-01 3.53e-01 3.54e-01 3.56e-01 3.57e-01
> [32,] 2.17e-01 2.19e-01 2.21e-01 2.23e-01 2.24e-01 2.25e-01 2.26e-01 2.27e-01
> [33,] 1.38e-01 1.39e-01 1.41e-01 1.42e-01 1.43e-01 1.43e-01 1.44e-01 1.44e-01
> [34,] 8.77e-02 8.86e-02 8.94e-02 9.01e-02 9.07e-02 9.11e-02 9.15e-02 9.19e-02
> [35,] 5.58e-02 5.64e-02 5.69e-02 5.73e-02 5.76e-02 5.80e-02 5.82e-02 5.84e-02
> [36,] 3.55e-02 3.58e-02 3.62e-02 3.64e-02 3.67e-02 3.69e-02 3.70e-02 3.72e-02
> [37,] 2.26e-02 2.28e-02 2.30e-02 2.32e-02 2.33e-02 2.34e-02 2.35e-02 2.36e-02
> [38,] 1.43e-02 1.45e-02 1.46e-02 1.47e-02 1.48e-02 1.49e-02 1.50e-02 1.50e-02
> [39,] 9.12e-03 9.22e-03 9.30e-03 9.37e-03 9.43e-03 9.48e-03 9.52e-03 9.55e-03
> [40,] 5.80e-03 5.86e-03 5.91e-03 5.96e-03 6.00e-03 6.03e-03 6.05e-03 6.08e-03
> [41,] 3.69e-03 3.73e-03 3.76e-03 3.79e-03 3.81e-03 3.83e-03 3.85e-03 3.86e-03
> [42,] 2.35e-03 2.37e-03 2.39e-03 2.41e-03 2.42e-03 2.44e-03 2.45e-03 2.46e-03
> [43,] 1.49e-03 1.51e-03 1.52e-03 1.53e-03 1.54e-03 1.55e-03 1.56e-03 1.56e-03
> [44,] 9.49e-04 9.59e-04 9.67e-04 9.74e-04 9.81e-04 9.86e-04 9.90e-04 9.94e-04
> [45,] 6.03e-04 6.10e-04 6.15e-04 6.20e-04 6.24e-04 6.27e-04 6.30e-04 6.32e-04
> [46,] 3.84e-04 3.88e-04 3.91e-04 3.94e-04 3.97e-04 3.99e-04 4.00e-04 4.02e-04
> [47,] 2.44e-04 2.47e-04 2.49e-04 2.51e-04 2.52e-04 2.53e-04 2.55e-04 2.56e-04
> [48,] 1.55e-04 1.57e-04 1.58e-04 1.59e-04 1.60e-04 1.61e-04 1.62e-04 1.63e-04
> [49,] 9.87e-05 9.97e-05 1.01e-04 1.01e-04 1.02e-04 1.03e-04 1.03e-04 1.03e-04
> [50,] 6.27e-05 6.34e-05 6.40e-05 6.44e-05 6.48e-05 6.52e-05 6.55e-05 6.57e-05
> [51,] 3.99e-05 4.03e-05 4.07e-05 4.10e-05 4.12e-05 4.15e-05 4.16e-05 4.18e-05
> [52,] 2.54e-05 2.56e-05 2.59e-05 2.61e-05 2.62e-05 2.64e-05 2.65e-05 2.66e-05
> [53,] 1.61e-05 1.63e-05 1.65e-05 1.66e-05 1.67e-05 1.68e-05 1.68e-05 1.69e-05
> [54,] 1.03e-05 1.04e-05 1.05e-05 1.05e-05 1.06e-05 1.07e-05 1.07e-05 1.07e-05
>          [,51]    [,52]    [,53]    [,54]
>  [1,] 8.13e+02 8.13e+02 8.13e+02 8.13e+02
>  [2,] 8.13e+02 8.13e+02 8.13e+02 8.13e+02
>  [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,] 5.70e-03 4.78e-03 4.01e-03 3.36e-03
>  [8,] 3.63e-03 3.04e-03 2.55e-03 2.13e-03
>  [9,] 2.31e-03 1.93e-03 1.62e-03 1.36e-03
> [10,] 1.47e-03 1.23e-03 1.03e-03 8.63e-04
> [11,] 9.32e-04 7.82e-04 6.55e-04 5.49e-04
> [12,] 5.93e-04 4.97e-04 4.17e-04 3.49e-04
> [13,] 3.77e-04 3.16e-04 2.65e-04 2.22e-04
> [14,] 2.40e-04 2.01e-04 1.69e-04 1.41e-04
> [15,] 1.53e-04 1.28e-04 1.07e-04 8.98e-05
> [16,] 9.70e-05 8.13e-05 6.82e-05 5.71e-05
> [17,] 6.17e-05 5.17e-05 4.33e-05 3.63e-05
> [18,] 3.92e-05 3.29e-05 2.76e-05 2.31e-05
> [19,] 2.49e-05 2.09e-05 1.75e-05 1.47e-05
> [20,] 1.59e-05 1.33e-05 1.11e-05 9.34e-06
> [21,] 1.01e-05 8.46e-06 7.09e-06 5.94e-06
> [22,] 6.41e-06 5.38e-06 4.51e-06 3.78e-06
> [23,] 4.08e-06 3.42e-06 2.87e-06 2.40e-06
> [24,] 2.59e-06 2.17e-06 1.82e-06 1.53e-06
> [25,] 1.65e-06 1.38e-06 1.16e-06 9.71e-07
> [26,] 1.05e-06 8.79e-07 7.37e-07 6.18e-07
> [27,] 6.67e-07 5.59e-07 4.69e-07 3.93e-07
> [28,] 4.24e-07 3.56e-07 2.98e-07 2.50e-07
> [29,] 2.70e-07 2.26e-07 1.90e-07 1.59e-07
> [30,] 1.72e-07 1.44e-07 1.21e-07 1.01e-07
> [31,] 3.58e-01 3.59e-01 3.60e-01 3.61e-01
> [32,] 2.28e-01 2.28e-01 2.29e-01 2.29e-01
> [33,] 1.45e-01 1.45e-01 1.46e-01 1.46e-01
> [34,] 9.22e-02 9.24e-02 9.26e-02 9.28e-02
> [35,] 5.86e-02 5.88e-02 5.89e-02 5.90e-02
> [36,] 3.73e-02 3.74e-02 3.74e-02 3.75e-02
> [37,] 2.37e-02 2.38e-02 2.38e-02 2.39e-02
> [38,] 1.51e-02 1.51e-02 1.51e-02 1.52e-02
> [39,] 9.58e-03 9.61e-03 9.63e-03 9.65e-03
> [40,] 6.09e-03 6.11e-03 6.12e-03 6.13e-03
> [41,] 3.88e-03 3.89e-03 3.89e-03 3.90e-03
> [42,] 2.46e-03 2.47e-03 2.48e-03 2.48e-03
> [43,] 1.57e-03 1.57e-03 1.57e-03 1.58e-03
> [44,] 9.97e-04 9.99e-04 1.00e-03 1.00e-03
> [45,] 6.34e-04 6.36e-04 6.37e-04 6.38e-04
> [46,] 4.03e-04 4.04e-04 4.05e-04 4.06e-04
> [47,] 2.56e-04 2.57e-04 2.58e-04 2.58e-04
> [48,] 1.63e-04 1.63e-04 1.64e-04 1.64e-04
> [49,] 1.04e-04 1.04e-04 1.04e-04 1.04e-04
> [50,] 6.59e-05 6.61e-05 6.62e-05 6.64e-05
> [51,] 4.19e-05 4.20e-05 4.21e-05 4.22e-05
> [52,] 2.67e-05 2.67e-05 2.68e-05 2.68e-05
> [53,] 1.70e-05 1.70e-05 1.70e-05 1.71e-05
> [54,] 1.08e-05 1.08e-05 1.08e-05 1.09e-05

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  1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000
> Mean    0.820 0.820 0.820 0.820 0.820 0.820 0.820 0.820 0.820 0.820 0.820 0.820
> 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.965 0.964 0.964
> Median  1.000 1.000 1.000
> Mean    0.820 0.820 0.820
> 3rd Qu. 1.000 1.000 1.000
> Max.    1.000 1.000 1.000

Notice the similarities and differences with the ahistorical MPMs. First, we see 15 matrices produced again. However, in the raw hMPM, we only saw 12 matrices because of the fact that we need sets of three consecutive monitoring occasions of data to parameterize each raw transition (six monitoring occasions total means four sets of three consecutive monitoring occasions, or four total time steps, in the historical case). Since this is a function-based MPM, we can use our functions to estimate transitions in the first year even without a full set of three years of data. The result is five time steps that we can estimate transitions for.

Second, these matrices are utterly huge. They have \(54^2 = 2916\) rows and columns, yielding \(2916^2 = 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  1.000 1.000 1.000 1.000 1.000 0.999 1.000 1.000 1.000 0.999 0.999 1.000
> Mean    0.804 0.804 0.804 0.804 0.803 0.803 0.804 0.804 0.804 0.803 0.803 0.804
> 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.965 0.964 0.964
> Median  0.999 0.999 0.999
> Mean    0.804 0.803 0.803
> 3rd Qu. 1.000 1.000 1.000
> Max.    1.000 1.000 1.000

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 1.000 1.000 1.000
> Mean    0.916 0.916 0.915 0.916
> 3rd Qu. 1.000 1.000 1.000 1.000
> Max.    1.000 1.000 1.000 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 1.000 1.000 1.000
> Mean    0.820 0.820 0.820 0.820
> 3rd Qu. 1.000 1.000 1.000 1.000
> Max.    1.000 1.000 1.000 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: subdata
>      AIC      BIC   logLik deviance df.resid 
> 128.1324 143.2057 -60.0662 120.1324      316 
> Random effects:
>  Groups  Name        Std.Dev.
>  individ (Intercept) 1.198378
>  year2   (Intercept) 0.008826
> Number of obs: 320, groups:  individ, 74; year2, 5
> Fixed Effects:
> (Intercept)   size2added  
>      2.0352       0.6344  
> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
> 
> 
> 
> Observation model:
> Generalized linear mixed model fit by maximum likelihood (Laplace
>   Approximation) [glmerMod]
>  Family: binomial  ( logit )
> Formula: obsstatus3 ~ size2added + (1 | year2) + (1 | individ)
>    Data: subdata
>      AIC      BIC   logLik deviance df.resid 
> 118.2567 133.1117 -55.1284 110.2567      299 
> Random effects:
>  Groups  Name        Std.Dev. 
>  individ (Intercept) 1.078e-05
>  year2   (Intercept) 8.776e-01
> Number of obs: 303, groups:  individ, 70; year2, 5
> Fixed Effects:
> (Intercept)   size2added  
>      2.4904       0.3134  
> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
> 
> 
> 
> Size model:
> Formula:          size3added ~ (1 | year2) + (1 | individ)
> Data: subdata
>       AIC       BIC    logLik  df.resid 
> 1008.2763 1022.9281 -500.1381       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 (): 8.74e+07 
> 
> 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: subdata
>       AIC       BIC    logLik  deviance  df.resid 
>  333.6176  351.9324 -161.8088  323.6176       283 
> Random effects:
>  Groups  Name        Std.Dev.
>  individ (Intercept) 0.1829  
>  year2   (Intercept) 0.6250  
> Number of obs: 288, groups:  individ, 70; year2, 5
> Fixed Effects:
> (Intercept)   repstatus2   size2added  
>     -1.4630       1.6457       0.1715  
> 
> 
> 
> Fecundity model:
> Formula:          feca2 ~ size2added + (1 | year2) + (1 | individ)
> Zero inflation:         ~size2added + (1 | year2) + (1 | individ)
> Data: subdata
>       AIC       BIC    logLik  df.resid 
>  248.8609  271.0264 -116.4305       110 
> Random-effects (co)variances:
> 
> Conditional model:
>  Groups  Name        Std.Dev.
>  year2   (Intercept) 0.5760  
>  individ (Intercept) 0.1639  
> 
> Zero-inflation model:
>  Groups  Name        Std.Dev. 
>  year2   (Intercept) 1.642e-06
>  individ (Intercept) 3.089e-04
> 
> Number of obs: 118 / Conditional model: year2, 5; individ, 51 / Zero-inflation model: year2, 5; individ, 51
> 
> Fixed Effects:
> 
> Conditional model:
> (Intercept)   size2added  
>    -0.54014      0.06174  
> 
> Zero-inflation model:
> (Intercept)   size2added  
>       3.865       -1.574  
> 
> 
> Juvenile survival model:
> [1] 1
> 
> 
> 
> Juvenile observation model:
> [1] 1
> 
> 
> 
> Juvenile size model:
> [1] 1
> 
> 
> 
> Juvenile secondary size model:
> [1] 1
> 
> 
> 
> Juvenile tertiary size model:
> [1] 1
> 
> 
> 
> Juvenile reproduction model:
> [1] 1
> 
> 
> 
> Juvenile maturity model:
> [1] 1
> 
> 
> 
> 
> 
> Number of models in survival table: 16
> 
> Number of models in observation table: 16
> 
> Number of models in size table: 16
> 
> Number of models in secondary size table: 1
> 
> Number of models in tertiary size table: 1
> 
> Number of models in reproduction status table: 16
> 
> Number of models in fecundity table: 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
> 
> 
> 
> 
> 
> 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.

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: subdata
>      AIC      BIC   logLik deviance df.resid 
> 128.1324 143.2057 -60.0662 120.1324      316 
> Random effects:
>  Groups  Name        Std.Dev.
>  individ (Intercept) 1.198378
>  year2   (Intercept) 0.008826
> Number of obs: 320, groups:  individ, 74; year2, 5
> Fixed Effects:
> (Intercept)   size2added  
>      2.0352       0.6344  
> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
> 
> 
> 
> Observation model:
> Generalized linear mixed model fit by maximum likelihood (Laplace
>   Approximation) [glmerMod]
>  Family: binomial  ( logit )
> Formula: obsstatus3 ~ size2added + (1 | year2) + (1 | individ)
>    Data: subdata
>      AIC      BIC   logLik deviance df.resid 
> 118.2567 133.1117 -55.1284 110.2567      299 
> Random effects:
>  Groups  Name        Std.Dev. 
>  individ (Intercept) 1.078e-05
>  year2   (Intercept) 8.776e-01
> Number of obs: 303, groups:  individ, 70; year2, 5
> Fixed Effects:
> (Intercept)   size2added  
>      2.4904       0.3134  
> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
> 
> 
> 
> Size model:
> Formula:          size3added ~ (1 | year2) + (1 | individ)
> Data: subdata
>       AIC       BIC    logLik  df.resid 
> 1008.2763 1022.9281 -500.1381       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 (): 8.74e+07 
> 
> 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: subdata
>       AIC       BIC    logLik  deviance  df.resid 
>  333.6176  351.9324 -161.8088  323.6176       283 
> Random effects:
>  Groups  Name        Std.Dev.
>  individ (Intercept) 0.1829  
>  year2   (Intercept) 0.6250  
> Number of obs: 288, groups:  individ, 70; year2, 5
> Fixed Effects:
> (Intercept)   repstatus2   size2added  
>     -1.4630       1.6457       0.1715  
> 
> 
> 
> Fecundity model:
> Formula:          feca2 ~ size2added + (1 | year2) + (1 | individ)
> Zero inflation:         ~size2added + (1 | year2) + (1 | individ)
> Data: subdata
>       AIC       BIC    logLik  df.resid 
>  248.8609  271.0264 -116.4305       110 
> Random-effects (co)variances:
> 
> Conditional model:
>  Groups  Name        Std.Dev.
>  year2   (Intercept) 0.5760  
>  individ (Intercept) 0.1639  
> 
> Zero-inflation model:
>  Groups  Name        Std.Dev. 
>  year2   (Intercept) 1.642e-06
>  individ (Intercept) 3.089e-04
> 
> Number of obs: 118 / Conditional model: year2, 5; individ, 51 / Zero-inflation model: year2, 5; individ, 51
> 
> Fixed Effects:
> 
> Conditional model:
> (Intercept)   size2added  
>    -0.54014      0.06174  
> 
> Zero-inflation model:
> (Intercept)   size2added  
>       3.865       -1.574  
> 
> 
> Juvenile survival model:
> [1] 1
> 
> 
> 
> Juvenile observation model:
> [1] 1
> 
> 
> 
> Juvenile size model:
> [1] 1
> 
> 
> 
> Juvenile secondary size model:
> [1] 1
> 
> 
> 
> Juvenile tertiary size model:
> [1] 1
> 
> 
> 
> Juvenile reproduction model:
> [1] 1
> 
> 
> 
> Juvenile maturity model:
> [1] 1
> 
> 
> 
> 
> 
> Number of models in survival table: 4
> 
> Number of models in observation table: 4
> 
> Number of models in size table: 4
> 
> Number of models in secondary size table: 1
> 
> Number of models in tertiary size table: 1
> 
> Number of models in reproduction status table: 4
> 
> Number of models in fecundity table: 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
> 
> 
> 
> 
> 
> 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 many other changes in the best-fit models. For example, size now includes historical reproductive status as a factor 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  1.000 1.000 1.000 1.000 1.000
> 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.16278281 2.325469e-01 2.383839e-01 2.359756e-01
>  [8,] 0.00  0.0  0.0 0.00 0.10351785 1.478826e-01 1.515945e-01 1.500631e-01
>  [9,] 0.00  0.0  0.0 0.00 0.06582972 9.404245e-02 9.640295e-02 9.542903e-02
> [10,] 0.00  0.0  0.0 0.00 0.00000000 5.980406e-02 6.130516e-02 6.068582e-02
> [11,] 0.00  0.0  0.0 0.00 0.00000000 3.803097e-02 3.898556e-02 3.859171e-02
> [12,] 0.00  0.0  0.0 0.00 0.00000000 2.418489e-02 2.479194e-02 2.454148e-02
> [13,] 0.00  0.0  0.0 0.00 0.00000000 1.537981e-02 1.576584e-02 1.560657e-02
> [14,] 0.00  0.0  0.0 0.00 0.00000000 9.780423e-03 1.002591e-02 9.924627e-03
> [15,] 0.00  0.0  0.0 0.00 0.00000000 6.219627e-03 6.375742e-03 6.311330e-03
> [16,] 0.00  0.0  0.0 0.00 0.00000000 3.955224e-03 4.054501e-03 4.013540e-03
> [17,] 0.00  0.0  0.0 0.00 0.00000000 2.515231e-03 2.578364e-03 2.552316e-03
> [18,] 0.00  0.0  0.0 0.00 0.00000000 1.599501e-03 1.639649e-03 1.623084e-03
> [19,] 0.00  0.0  0.0 0.00 0.00000000 1.017165e-03 1.042696e-03 1.032162e-03
> [20,] 0.00  0.0  0.0 0.00 0.00000000 6.468417e-04 6.630776e-04 6.563789e-04
> [21,] 0.00  0.0  0.0 0.00 0.00000000 4.113436e-04 4.216685e-04 4.174085e-04
> [22,] 0.00  0.0  0.0 0.00 0.00000000 2.615842e-04 2.681500e-04 2.654410e-04
> [23,] 0.00  0.0  0.0 0.00 0.00000000 1.663482e-04 1.705236e-04 1.688009e-04
> [24,] 0.00  0.0  0.0 0.00 0.00000000 1.057852e-04 1.084405e-04 1.073449e-04
> [25,] 0.00  0.0  0.0 0.00 0.00000000 6.727159e-05 6.896013e-05 6.826345e-05
> [26,] 0.00  0.0  0.0 0.00 0.00000000 4.277977e-05 4.385355e-05 4.341052e-05
> [27,] 0.00  0.0  0.0 0.00 0.00000000 2.720478e-05 2.788762e-05 2.760589e-05
> [28,] 0.00  0.0  0.0 0.00 0.00000000 1.730023e-05 1.773447e-05 1.755531e-05
> [29,] 0.00  0.0  0.0 0.00 0.00000000 1.100167e-05 1.127782e-05 1.116388e-05
> [30,] 0.00  0.0  0.0 0.00 0.00000000 6.996251e-06 7.171859e-06 7.099404e-06
> [31,] 0.00  0.0  0.0 0.00 0.00000000 7.235134e-02 8.868460e-02 1.049720e-01
> [32,] 0.00  0.0  0.0 0.00 0.00000000 4.601011e-02 5.639686e-02 6.675448e-02
> [33,] 0.00  0.0  0.0 0.00 0.00000000 2.925904e-02 3.586424e-02 4.245092e-02
> [34,] 0.00  0.0  0.0 0.00 0.00000000 1.860659e-02 2.280701e-02 2.699565e-02
> [35,] 0.00  0.0  0.0 0.00 0.00000000 1.183242e-02 1.450358e-02 1.716724e-02
> [36,] 0.00  0.0  0.0 0.00 0.00000000 7.524545e-03 9.223205e-03 1.091710e-02
> [37,] 0.00  0.0  0.0 0.00 0.00000000 4.785055e-03 5.865278e-03 6.942471e-03
> [38,] 0.00  0.0  0.0 0.00 0.00000000 3.042942e-03 3.729884e-03 4.414899e-03
> [39,] 0.00  0.0  0.0 0.00 0.00000000 1.935087e-03 2.371931e-03 2.807550e-03
> [40,] 0.00  0.0  0.0 0.00 0.00000000 1.230572e-03 1.508373e-03 1.785395e-03
> [41,] 0.00  0.0  0.0 0.00 0.00000000 7.825532e-04 9.592140e-04 1.135379e-03
> [42,] 0.00  0.0  0.0 0.00 0.00000000 4.976461e-04 6.099894e-04 7.220175e-04
> [43,] 0.00  0.0  0.0 0.00 0.00000000 3.164662e-04 3.879082e-04 4.591499e-04
> [44,] 0.00  0.0  0.0 0.00 0.00000000 2.012492e-04 2.466810e-04 2.919854e-04
> [45,] 0.00  0.0  0.0 0.00 0.00000000 1.279796e-04 1.568709e-04 1.856812e-04
> [46,] 0.00  0.0  0.0 0.00 0.00000000 8.138560e-05 9.975834e-05 1.180795e-04
> [47,] 0.00  0.0  0.0 0.00 0.00000000 5.175524e-05 6.343894e-05 7.508988e-05
> [48,] 0.00  0.0  0.0 0.00 0.00000000 3.291251e-05 4.034249e-05 4.775162e-05
> [49,] 0.00  0.0  0.0 0.00 0.00000000 2.092993e-05 2.565484e-05 3.036651e-05
> [50,] 0.00  0.0  0.0 0.00 0.00000000 1.330989e-05 1.631459e-05 1.931086e-05
> [51,] 0.00  0.0  0.0 0.00 0.00000000 8.464109e-06 1.037487e-05 1.228028e-05
> [52,] 0.00  0.0  0.0 0.00 0.00000000 5.382549e-06 6.597655e-06 7.809353e-06
> [53,] 0.00  0.0  0.0 0.00 0.00000000 3.422904e-06 4.195622e-06 4.966172e-06
> [54,] 0.00  0.0  0.0 0.00 0.00000000 2.176714e-06 2.668106e-06 3.158119e-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.281167e-01 2.167853e-01 2.032904e-01 1.885094e-01 1.730647e-01
>  [8,] 1.450654e-01 1.378594e-01 1.292777e-01 1.198780e-01 1.100564e-01
>  [9,] 9.225090e-02 8.766844e-02 8.221106e-02 7.623359e-02 6.998774e-02
> [10,] 5.866476e-02 5.575066e-02 5.228017e-02 4.847894e-02 4.450704e-02
> [11,] 3.730646e-02 3.545331e-02 3.324633e-02 3.082903e-02 2.830319e-02
> [12,] 2.372416e-02 2.254569e-02 2.114221e-02 1.960499e-02 1.799874e-02
> [13,] 1.508681e-02 1.433739e-02 1.344489e-02 1.246733e-02 1.144587e-02
> [14,] 9.594101e-03 9.117524e-03 8.549957e-03 7.928299e-03 7.278730e-03
> [15,] 6.101140e-03 5.798073e-03 5.437142e-03 5.041813e-03 4.628735e-03
> [16,] 3.879875e-03 3.687147e-03 3.457621e-03 3.206221e-03 2.943534e-03
> [17,] 2.467314e-03 2.344753e-03 2.198792e-03 2.038920e-03 1.871871e-03
> [18,] 1.569030e-03 1.491090e-03 1.398269e-03 1.296603e-03 1.190372e-03
> [19,] 9.977872e-04 9.482233e-04 8.891962e-04 8.245437e-04 7.569885e-04
> [20,] 6.345191e-04 6.030000e-04 5.654631e-04 5.243490e-04 4.813888e-04
> [21,] 4.035073e-04 3.834635e-04 3.595928e-04 3.334473e-04 3.061278e-04
> [22,] 2.566009e-04 2.438545e-04 2.286745e-04 2.120479e-04 1.946747e-04
> [23,] 1.631792e-04 1.550735e-04 1.454201e-04 1.348468e-04 1.237987e-04
> [24,] 1.037699e-04 9.861529e-05 9.247647e-05 8.575261e-05 7.872686e-05
> [25,] 6.599003e-05 6.271205e-05 5.880821e-05 5.453234e-05 5.006448e-05
> [26,] 4.196479e-05 3.988024e-05 3.739768e-05 3.467854e-05 3.183731e-05
> [27,] 2.668651e-05 2.536089e-05 2.378217e-05 2.205299e-05 2.024618e-05
> [28,] 1.697065e-05 1.612765e-05 1.512370e-05 1.402408e-05 1.287508e-05
> [29,] 1.079208e-05 1.025600e-05 9.617560e-06 8.918279e-06 8.187600e-06
> [30,] 6.862968e-06 6.522058e-06 6.116059e-06 5.671367e-06 5.206709e-06
> [31,] 1.213386e-01 1.378818e-01 1.546070e-01 1.714275e-01 1.881878e-01
> [32,] 7.716240e-02 8.768265e-02 9.831865e-02 1.090153e-01 1.196735e-01
> [33,] 4.906960e-02 5.575970e-02 6.252341e-02 6.932567e-02 7.610355e-02
> [34,] 3.120464e-02 3.545905e-02 3.976028e-02 4.408601e-02 4.839624e-02
> [35,] 1.984385e-02 2.254934e-02 2.528460e-02 2.803545e-02 3.077644e-02
> [36,] 1.261922e-02 1.433972e-02 1.607914e-02 1.782848e-02 1.957154e-02
> [37,] 8.024896e-03 9.119003e-03 1.022515e-02 1.133760e-02 1.244606e-02
> [38,] 5.103242e-03 5.799013e-03 6.502440e-03 7.209875e-03 7.914775e-03
> [39,] 3.245285e-03 3.687744e-03 4.135072e-03 4.584948e-03 5.033213e-03
> [40,] 2.063762e-03 2.345133e-03 2.629601e-03 2.915689e-03 3.200752e-03
> [41,] 1.312400e-03 1.491332e-03 1.672232e-03 1.854163e-03 2.035442e-03
> [42,] 8.345898e-04 9.483770e-04 1.063416e-03 1.179111e-03 1.294391e-03
> [43,] 5.307375e-04 6.030978e-04 6.762542e-04 7.498275e-04 8.231372e-04
> [44,] 3.375099e-04 3.835257e-04 4.300478e-04 4.768350e-04 5.234545e-04
> [45,] 2.146314e-04 2.438941e-04 2.734787e-04 3.032319e-04 3.328785e-04
> [46,] 1.364897e-04 1.550986e-04 1.739123e-04 1.928331e-04 2.116861e-04
> [47,] 8.679741e-05 9.863128e-05 1.105954e-04 1.226276e-04 1.346168e-04
> [48,] 5.519675e-05 6.272222e-05 7.033049e-05 7.798212e-05 8.560633e-05
> [49,] 3.510106e-05 3.988670e-05 4.472500e-05 4.959088e-05 5.443931e-05
> [50,] 2.232168e-05 2.536500e-05 2.844180e-05 3.153614e-05 3.461939e-05
> [51,] 1.419494e-05 1.613027e-05 1.808689e-05 2.005466e-05 2.201538e-05
> [52,] 9.026937e-06 1.025766e-05 1.150193e-05 1.275328e-05 1.400015e-05
> [53,] 5.740466e-06 6.523116e-06 7.314377e-06 8.110147e-06 8.903066e-06
> [54,] 3.650513e-06 4.148220e-06 4.651404e-06 5.157455e-06 5.661693e-06
>              [,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.574280e-01 1.419734e-01 1.270015e-01 1.127487e-01 9.939112e-02
>  [8,] 1.001126e-01 9.028463e-02 8.076361e-02 7.169984e-02 6.320542e-02
>  [9,] 6.366423e-02 5.741437e-02 5.135969e-02 4.559581e-02 4.019398e-02
> [10,] 4.048575e-02 3.651130e-02 3.266098e-02 2.899557e-02 2.556041e-02
> [11,] 2.574595e-02 2.321849e-02 2.076997e-02 1.843904e-02 1.625453e-02
> [12,] 1.637253e-02 1.476525e-02 1.320817e-02 1.172587e-02 1.033668e-02
> [13,] 1.041172e-02 9.389609e-03 8.399421e-03 7.456789e-03 6.573369e-03
> [14,] 6.621085e-03 5.971099e-03 5.341412e-03 4.741968e-03 4.180178e-03
> [15,] 4.210521e-03 3.797178e-03 3.396744e-03 3.015542e-03 2.658285e-03
> [16,] 2.677581e-03 2.414725e-03 2.160079e-03 1.917662e-03 1.690473e-03
> [17,] 1.702744e-03 1.535587e-03 1.373651e-03 1.219492e-03 1.075016e-03
> [18,] 1.082820e-03 9.765201e-04 8.735405e-04 7.755066e-04 6.836309e-04
> [19,] 6.885933e-04 6.209947e-04 5.555073e-04 4.931650e-04 4.347388e-04
> [20,] 4.378945e-04 3.949068e-04 3.532617e-04 3.136166e-04 2.764618e-04
> [21,] 2.784686e-04 2.511316e-04 2.246483e-04 1.994370e-04 1.758093e-04
> [22,] 1.770855e-04 1.597012e-04 1.428598e-04 1.268272e-04 1.118017e-04
> [23,] 1.126133e-04 1.015582e-04 9.084828e-05 8.065275e-05 7.109766e-05
> [24,] 7.161376e-05 6.458350e-05 5.777280e-05 5.128920e-05 4.521287e-05
> [25,] 4.554107e-05 4.107034e-05 3.673924e-05 3.261615e-05 2.875205e-05
> [26,] 2.896076e-05 2.611771e-05 2.336345e-05 2.074146e-05 1.828418e-05
> [27,] 1.841691e-05 1.660893e-05 1.485743e-05 1.319004e-05 1.162739e-05
> [28,] 1.171179e-05 1.056206e-05 9.448228e-06 8.387892e-06 7.394163e-06
> [29,] 7.447837e-06 6.716689e-06 6.008376e-06 5.334081e-06 4.702142e-06
> [30,] 4.736275e-06 4.271319e-06 3.820884e-06 3.392082e-06 2.990215e-06
> [31,] 2.046917e-01 2.207296e-01 2.361009e-01 2.506314e-01 2.641842e-01
> [32,] 1.301688e-01 1.403677e-01 1.501428e-01 1.593831e-01 1.680017e-01
> [33,] 8.277776e-02 8.926353e-02 9.547973e-02 1.013559e-01 1.068367e-01
> [34,] 5.264055e-02 5.676502e-02 6.071807e-02 6.445486e-02 6.794024e-02
> [35,] 3.347551e-02 3.609837e-02 3.861221e-02 4.098854e-02 4.320498e-02
> [36,] 2.128795e-02 2.295590e-02 2.455452e-02 2.606569e-02 2.747518e-02
> [37,] 1.353757e-02 1.459826e-02 1.561486e-02 1.657585e-02 1.747219e-02
> [38,] 8.608894e-03 9.283414e-03 9.929900e-03 1.054102e-02 1.111102e-02
> [39,] 5.474621e-03 5.903567e-03 6.314684e-03 6.703311e-03 7.065791e-03
> [40,] 3.481455e-03 3.754233e-03 4.015673e-03 4.262811e-03 4.493322e-03
> [41,] 2.213949e-03 2.387415e-03 2.553672e-03 2.710833e-03 2.857421e-03
> [42,] 1.407908e-03 1.518220e-03 1.623947e-03 1.723890e-03 1.817109e-03
> [43,] 8.953257e-04 9.654758e-04 1.032710e-03 1.096267e-03 1.155547e-03
> [44,] 5.693611e-04 6.139714e-04 6.567276e-04 6.971448e-04 7.348428e-04
> [45,] 3.620716e-04 3.904405e-04 4.176303e-04 4.433327e-04 4.673058e-04
> [46,] 2.302508e-04 2.482914e-04 2.655821e-04 2.819269e-04 2.971720e-04
> [47,] 1.464225e-04 1.578950e-04 1.688906e-04 1.792847e-04 1.889795e-04
> [48,] 9.311394e-05 1.004096e-04 1.074020e-04 1.140118e-04 1.201770e-04
> [49,] 5.921360e-05 6.385307e-05 6.829972e-05 7.250312e-05 7.642371e-05
> [50,] 3.765548e-05 4.060584e-05 4.343358e-05 4.610663e-05 4.859984e-05
> [51,] 2.394611e-05 2.582232e-05 2.762055e-05 2.932042e-05 3.090591e-05
> [52,] 1.522796e-05 1.642109e-05 1.756463e-05 1.864562e-05 1.965388e-05
> [53,] 9.683857e-06 1.044260e-05 1.116981e-05 1.185724e-05 1.249842e-05
> [54,] 6.158219e-06 6.640725e-06 7.103176e-06 7.540330e-06 7.948071e-06
>              [,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,] 8.704838e-02 7.578804e-02 6.563244e-02 5.656665e-02 4.854703e-02
>  [8,] 5.535635e-02 4.819560e-02 4.173739e-02 3.597222e-02 3.087233e-02
>  [9,] 3.520255e-02 3.064885e-02 2.654190e-02 2.287568e-02 1.963252e-02
> [10,] 2.238623e-02 1.949041e-02 1.687869e-02 1.454724e-02 1.248484e-02
> [11,] 1.423599e-02 1.239446e-02 1.073360e-02 9.250973e-03 7.939434e-03
> [12,] 9.053038e-03 7.881962e-03 6.825779e-03 5.882936e-03 5.048894e-03
> [13,] 5.757064e-03 5.012346e-03 4.340692e-03 3.741113e-03 3.210724e-03
> [14,] 3.661068e-03 3.187483e-03 2.760360e-03 2.379072e-03 2.041784e-03
> [15,] 2.328169e-03 2.027004e-03 1.755385e-03 1.512914e-03 1.298424e-03
> [16,] 1.480544e-03 1.289025e-03 1.116295e-03 9.621019e-04 8.257018e-04
> [17,] 9.415167e-04 8.197247e-04 7.098815e-04 6.118258e-04 5.250854e-04
> [18,] 5.987352e-04 5.212844e-04 4.514323e-04 3.890761e-04 3.339156e-04
> [19,] 3.807514e-04 3.314984e-04 2.870776e-04 2.474237e-04 2.123457e-04
> [20,] 2.421298e-04 2.108085e-04 1.825602e-04 1.573432e-04 1.350362e-04
> [21,] 1.539767e-04 1.340587e-04 1.160948e-04 1.000587e-04 8.587305e-05
> [22,] 9.791781e-05 8.525143e-05 7.382774e-05 6.362994e-05 5.460892e-05
> [23,] 6.226850e-05 5.421362e-05 4.694899e-05 4.046394e-05 3.472725e-05
> [24,] 3.959817e-05 3.447586e-05 2.985610e-05 2.573208e-05 2.208397e-05
> [25,] 2.518152e-05 2.192411e-05 1.898627e-05 1.636371e-05 1.404377e-05
> [26,] 1.601359e-05 1.394211e-05 1.207387e-05 1.040611e-05 8.930804e-06
> [27,] 1.018346e-05 8.866156e-06 7.678090e-06 6.617518e-06 5.679332e-06
> [28,] 6.475929e-06 5.638221e-06 4.882699e-06 4.208253e-06 3.611636e-06
> [29,] 4.118213e-06 3.585492e-06 3.105036e-06 2.676139e-06 2.296734e-06
> [30,] 2.618880e-06 2.280109e-06 1.974574e-06 1.701827e-06 1.460554e-06
> [31,] 2.766657e-01 2.880252e-01 2.982522e-01 3.073696e-01 3.154266e-01
> [32,] 1.759389e-01 1.831628e-01 1.896664e-01 1.954644e-01 2.005880e-01
> [33,] 1.118842e-01 1.164780e-01 1.206138e-01 1.243009e-01 1.275592e-01
> [34,] 7.115009e-02 7.407143e-02 7.670150e-02 7.904621e-02 8.111823e-02
> [35,] 4.524621e-02 4.710396e-02 4.877650e-02 5.026756e-02 5.158521e-02
> [36,] 2.877325e-02 2.995465e-02 3.101825e-02 3.196646e-02 3.280439e-02
> [37,] 1.829766e-02 1.904894e-02 1.972532e-02 2.032831e-02 2.086117e-02
> [38,] 1.163596e-02 1.211372e-02 1.254385e-02 1.292730e-02 1.326617e-02
> [39,] 7.399615e-03 7.703434e-03 7.976962e-03 8.220812e-03 8.436302e-03
> [40,] 4.705609e-03 4.898816e-03 5.072759e-03 5.227830e-03 5.364866e-03
> [41,] 2.992420e-03 3.115285e-03 3.225901e-03 3.324514e-03 3.411659e-03
> [42,] 1.902959e-03 1.981092e-03 2.051435e-03 2.114146e-03 2.169563e-03
> [43,] 1.210141e-03 1.259828e-03 1.304561e-03 1.344441e-03 1.379682e-03
> [44,] 7.695605e-04 8.011578e-04 8.296047e-04 8.549651e-04 8.773761e-04
> [45,] 4.893837e-04 5.094772e-04 5.275674e-04 5.436947e-04 5.579465e-04
> [46,] 3.112119e-04 3.239899e-04 3.354939e-04 3.457497e-04 3.548128e-04
> [47,] 1.979078e-04 2.060337e-04 2.133494e-04 2.198713e-04 2.256348e-04
> [48,] 1.258548e-04 1.310222e-04 1.356745e-04 1.398219e-04 1.434871e-04
> [49,] 8.003436e-05 8.332047e-05 8.627895e-05 8.891644e-05 9.124718e-05
> [50,] 5.089595e-05 5.298567e-05 5.486705e-05 5.654429e-05 5.802648e-05
> [51,] 3.236607e-05 3.369498e-05 3.489139e-05 3.595800e-05 3.690056e-05
> [52,] 2.058243e-05 2.142752e-05 2.218835e-05 2.286663e-05 2.346603e-05
> [53,] 1.308891e-05 1.362632e-05 1.411016e-05 1.454149e-05 1.492267e-05
> [54,] 8.323579e-06 8.665335e-06 8.973018e-06 9.247316e-06 9.489714e-06
>              [,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,] 4.150946e-02 3.537684e-02 3.006530e-02 2.548908e-02 2.156425e-02
>  [8,] 2.639695e-02 2.249706e-02 1.911931e-02 1.620917e-02 1.371327e-02
>  [9,] 1.678651e-02 1.430647e-02 1.215847e-02 1.030784e-02 8.720629e-03
> [10,] 1.067498e-02 9.097860e-03 7.731890e-03 6.555025e-03 5.545677e-03
> [11,] 6.788503e-03 5.785568e-03 4.916912e-03 4.168513e-03 3.526641e-03
> [12,] 4.316987e-03 3.679194e-03 3.126793e-03 2.650866e-03 2.242684e-03
> [13,] 2.745285e-03 2.339696e-03 1.988410e-03 1.685755e-03 1.426181e-03
> [14,] 1.745799e-03 1.487874e-03 1.264482e-03 1.072016e-03 9.069461e-04
> [15,] 1.110199e-03 9.461782e-04 8.041172e-04 6.817232e-04 5.767508e-04
> [16,] 7.060048e-04 6.016995e-04 5.113592e-04 4.335256e-04 3.667710e-04
> [17,] 4.489670e-04 3.826365e-04 3.251867e-04 2.756903e-04 2.332393e-04
> [18,] 2.855099e-04 2.433286e-04 2.067948e-04 1.753187e-04 1.483230e-04
> [19,] 1.815632e-04 1.547390e-04 1.315062e-04 1.114898e-04 9.432247e-05
> [20,] 1.154608e-04 9.840261e-05 8.362825e-05 7.089926e-05 5.998213e-05
> [21,] 7.342456e-05 6.257680e-05 5.318140e-05 4.508670e-05 3.814421e-05
> [22,] 4.669260e-05 3.979423e-05 3.381944e-05 2.867181e-05 2.425690e-05
> [23,] 2.969305e-05 2.530619e-05 2.150667e-05 1.823316e-05 1.542560e-05
> [24,] 1.888259e-05 1.609287e-05 1.367666e-05 1.159494e-05 9.809544e-06
> [25,] 1.200793e-05 1.023388e-05 8.697344e-06 7.373529e-06 6.238146e-06
> [26,] 7.636160e-06 6.507992e-06 5.530869e-06 4.689020e-06 3.967001e-06
> [27,] 4.856034e-06 4.138603e-06 3.517225e-06 2.981871e-06 2.522720e-06
> [28,] 3.088079e-06 2.631846e-06 2.236696e-06 1.896250e-06 1.604264e-06
> [29,] 1.963791e-06 1.673660e-06 1.422373e-06 1.205875e-06 1.020193e-06
> [30,] 1.248826e-06 1.064324e-06 9.045245e-07 7.668476e-07 6.487677e-07
> [31,] 3.224913e-01 3.286436e-01 3.339696e-01 3.385563e-01 3.424888e-01
> [32,] 2.050807e-01 2.089931e-01 2.123800e-01 2.152968e-01 2.177976e-01
> [33,] 1.304162e-01 1.329042e-01 1.350580e-01 1.369129e-01 1.385032e-01
> [34,] 8.293506e-02 8.451727e-02 8.588694e-02 8.706650e-02 8.807782e-02
> [35,] 5.274058e-02 5.374675e-02 5.461776e-02 5.536787e-02 5.601099e-02
> [36,] 3.353912e-02 3.417897e-02 3.473286e-02 3.520988e-02 3.561886e-02
> [37,] 2.132840e-02 2.173530e-02 2.208754e-02 2.239089e-02 2.265097e-02
> [38,] 1.356329e-02 1.382205e-02 1.404604e-02 1.423895e-02 1.440434e-02
> [39,] 8.625253e-03 8.789802e-03 8.932248e-03 9.054923e-03 9.160100e-03
> [40,] 5.485025e-03 5.589666e-03 5.680251e-03 5.758263e-03 5.825148e-03
> [41,] 3.488071e-03 3.554615e-03 3.612220e-03 3.661830e-03 3.704364e-03
> [42,] 2.218156e-03 2.260473e-03 2.297106e-03 2.328654e-03 2.355702e-03
> [43,] 1.410583e-03 1.437494e-03 1.460790e-03 1.480852e-03 1.498053e-03
> [44,] 8.970270e-04 9.141401e-04 9.289545e-04 9.417127e-04 9.526511e-04
> [45,] 5.704430e-04 5.813257e-04 5.907465e-04 5.988598e-04 6.058158e-04
> [46,] 3.627596e-04 3.696802e-04 3.756712e-04 3.808306e-04 3.852542e-04
> [47,] 2.306884e-04 2.350894e-04 2.388992e-04 2.421802e-04 2.449932e-04
> [48,] 1.467008e-04 1.494995e-04 1.519222e-04 1.540087e-04 1.557976e-04
> [49,] 9.329088e-05 9.507065e-05 9.661134e-05 9.793819e-05 9.907579e-05
> [50,] 5.932611e-05 6.045792e-05 6.143769e-05 6.228147e-05 6.300489e-05
> [51,] 3.772703e-05 3.844677e-05 3.906984e-05 3.960642e-05 4.006646e-05
> [52,] 2.399161e-05 2.444931e-05 2.484553e-05 2.518676e-05 2.547932e-05
> [53,] 1.525689e-05 1.554796e-05 1.579993e-05 1.601692e-05 1.620296e-05
> [54,] 9.702258e-06 9.887355e-06 1.004759e-05 1.018558e-05 1.030389e-05
>              [,29]        [,30]        [,31]        [,32]        [,33]
>  [1,] 0.000000e+00 0.000000e+00 8.130827e+02 8.130827e+02 8.130827e+02
>  [2,] 0.000000e+00 0.000000e+00 8.130827e+02 8.130827e+02 8.130827e+02
>  [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.821115e-02 1.535599e-02 0.000000e+00 0.000000e+00 0.000000e+00
>  [8,] 1.158095e-02 9.765276e-03 0.000000e+00 0.000000e+00 0.000000e+00
>  [9,] 7.364628e-03 6.209995e-03 0.000000e+00 0.000000e+00 0.000000e+00
> [10,] 4.683360e-03 3.949099e-03 0.000000e+00 0.000000e+00 0.000000e+00
> [11,] 2.978272e-03 2.511335e-03 0.000000e+00 0.000000e+00 0.000000e+00
> [12,] 1.893961e-03 1.597024e-03 0.000000e+00 0.000000e+00 0.000000e+00
> [13,] 1.204419e-03 1.015589e-03 0.000000e+00 0.000000e+00 0.000000e+00
> [14,] 7.659219e-04 6.458400e-04 0.000000e+00 0.000000e+00 0.000000e+00
> [15,] 4.870698e-04 4.107066e-04 0.000000e+00 0.000000e+00 0.000000e+00
> [16,] 3.097405e-04 2.611791e-04 0.000000e+00 0.000000e+00 0.000000e+00
> [17,] 1.969721e-04 1.660906e-04 0.000000e+00 0.000000e+00 0.000000e+00
> [18,] 1.252597e-04 1.056214e-04 0.000000e+00 0.000000e+00 0.000000e+00
> [19,] 7.965594e-05 6.716741e-05 0.000000e+00 0.000000e+00 0.000000e+00
> [20,] 5.065530e-05 4.271352e-05 0.000000e+00 0.000000e+00 0.000000e+00
> [21,] 3.221303e-05 2.716264e-05 0.000000e+00 0.000000e+00 0.000000e+00
> [22,] 2.048511e-05 1.727344e-05 0.000000e+00 0.000000e+00 0.000000e+00
> [23,] 1.302702e-05 1.098463e-05 0.000000e+00 0.000000e+00 0.000000e+00
> [24,] 8.284224e-06 6.985416e-06 0.000000e+00 0.000000e+00 0.000000e+00
> [25,] 5.268155e-06 4.442209e-06 0.000000e+00 0.000000e+00 0.000000e+00
> [26,] 3.350158e-06 2.824917e-06 0.000000e+00 0.000000e+00 0.000000e+00
> [27,] 2.130453e-06 1.796439e-06 0.000000e+00 0.000000e+00 0.000000e+00
> [28,] 1.354811e-06 1.142403e-06 0.000000e+00 0.000000e+00 0.000000e+00
> [29,] 8.615599e-07 7.264838e-07 0.000000e+00 0.000000e+00 0.000000e+00
> [30,] 5.478885e-07 4.619901e-07 0.000000e+00 0.000000e+00 0.000000e+00
> [31,] 3.458475e-01 3.487067e-01 2.085764e-01 2.311346e-01 2.500876e-01
> [32,] 2.199335e-01 2.217517e-01 1.326392e-01 1.469846e-01 1.590372e-01
> [33,] 1.398615e-01 1.410177e-01 8.434875e-02 9.347134e-02 1.011360e-01
> [34,] 8.894157e-02 8.967688e-02 5.363958e-02 5.944088e-02 6.431500e-02
> [35,] 5.656028e-02 5.702788e-02 3.411082e-02 3.780001e-02 4.089960e-02
> [36,] 3.596816e-02 3.626553e-02 2.169196e-02 2.403802e-02 2.600913e-02
> [37,] 2.287310e-02 2.306220e-02 1.379449e-02 1.528641e-02 1.653989e-02
> [38,] 1.454560e-02 1.466586e-02 8.772277e-03 9.721027e-03 1.051815e-02
> [39,] 9.249931e-03 9.326403e-03 5.578521e-03 6.181856e-03 6.688765e-03
> [40,] 5.882273e-03 5.930904e-03 3.547528e-03 3.931204e-03 4.253561e-03
> [41,] 3.740692e-03 3.771618e-03 2.255966e-03 2.499956e-03 2.704951e-03
> [42,] 2.378804e-03 2.398470e-03 1.434628e-03 1.589787e-03 1.720149e-03
> [43,] 1.512744e-03 1.525250e-03 9.123175e-04 1.010988e-03 1.093888e-03
> [44,] 9.619935e-04 9.699466e-04 5.801666e-04 6.429135e-04 6.956321e-04
> [45,] 6.117569e-04 6.168145e-04 3.689432e-04 4.088456e-04 4.423707e-04
> [46,] 3.890323e-04 3.922485e-04 2.346206e-04 2.599956e-04 2.813151e-04
> [47,] 2.473958e-04 2.494411e-04 1.492014e-04 1.653380e-04 1.788957e-04
> [48,] 1.573255e-04 1.586261e-04 9.488109e-05 1.051428e-04 1.137644e-04
> [49,] 1.000474e-04 1.008745e-04 6.033737e-05 6.686305e-05 7.234580e-05
> [50,] 6.362276e-05 6.414876e-05 3.837012e-05 4.251997e-05 4.600659e-05
> [51,] 4.045938e-05 4.079388e-05 2.440056e-05 2.703956e-05 2.925680e-05
> [52,] 2.572918e-05 2.594190e-05 1.551696e-05 1.719517e-05 1.860516e-05
> [53,] 1.636186e-05 1.649713e-05 9.867641e-06 1.093486e-05 1.183151e-05
> [54,] 1.040494e-05 1.049096e-05 6.275092e-06 6.953763e-06 7.523968e-06
>              [,34]        [,35]        [,36]        [,37]        [,38]
>  [1,] 8.130827e+02 8.130827e+02 8.130827e+02 8.130827e+02 8.130827e+02
>  [2,] 8.130827e+02 8.130827e+02 8.130827e+02 8.130827e+02 8.130827e+02
>  [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.662085e-01 2.800676e-01 2.920603e-01 3.024647e-01 3.114884e-01
> [32,] 1.692890e-01 1.781023e-01 1.857288e-01 1.923452e-01 1.980837e-01
> [33,] 1.076553e-01 1.132599e-01 1.181098e-01 1.223174e-01 1.259666e-01
> [34,] 6.846082e-02 7.202497e-02 7.510912e-02 7.778483e-02 8.010546e-02
> [35,] 4.353603e-02 4.580256e-02 4.776386e-02 4.946541e-02 5.094116e-02
> [36,] 2.768570e-02 2.912705e-02 3.037429e-02 3.145635e-02 3.239482e-02
> [37,] 1.760606e-02 1.852266e-02 1.931581e-02 2.000392e-02 2.060072e-02
> [38,] 1.119616e-02 1.177904e-02 1.228343e-02 1.272102e-02 1.310054e-02
> [39,] 7.119931e-03 7.490602e-03 7.811355e-03 8.089628e-03 8.330974e-03
> [40,] 4.527751e-03 4.763470e-03 4.967445e-03 5.144407e-03 5.297885e-03
> [41,] 2.879315e-03 3.029216e-03 3.158929e-03 3.271463e-03 3.369064e-03
> [42,] 1.831032e-03 1.926358e-03 2.008846e-03 2.080409e-03 2.142476e-03
> [43,] 1.164401e-03 1.225021e-03 1.277478e-03 1.322987e-03 1.362457e-03
> [44,] 7.404733e-04 7.790232e-04 8.123815e-04 8.413220e-04 8.664219e-04
> [45,] 4.708864e-04 4.954013e-04 5.166147e-04 5.350187e-04 5.509804e-04
> [46,] 2.994490e-04 3.150387e-04 3.285288e-04 3.402324e-04 3.503829e-04
> [47,] 1.904275e-04 2.003413e-04 2.089201e-04 2.163627e-04 2.228177e-04
> [48,] 1.210978e-04 1.274023e-04 1.328578e-04 1.375907e-04 1.416956e-04
> [49,] 7.700929e-05 8.101847e-05 8.448774e-05 8.749755e-05 9.010795e-05
> [50,] 4.897222e-05 5.152177e-05 5.372797e-05 5.564199e-05 5.730201e-05
> [51,] 3.114272e-05 3.276405e-05 3.416703e-05 3.538420e-05 3.643985e-05
> [52,] 1.980447e-05 2.083552e-05 2.172771e-05 2.250174e-05 2.317306e-05
> [53,] 1.259418e-05 1.324985e-05 1.381722e-05 1.430945e-05 1.473635e-05
> [54,] 8.008972e-06 8.425928e-06 8.786732e-06 9.099752e-06 9.371234e-06
>              [,39]        [,40]        [,41]        [,42]        [,43]
>  [1,] 8.130827e+02 8.130827e+02 8.130827e+02 8.130827e+02 8.130827e+02
>  [2,] 8.130827e+02 8.130827e+02 8.130827e+02 8.130827e+02 8.130827e+02
>  [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,] 3.192982e-01 3.260367e-01 3.318309e-01 3.367958e-01 3.410362e-01
> [32,] 2.030501e-01 2.073353e-01 2.110200e-01 2.141773e-01 2.168739e-01
> [33,] 1.291249e-01 1.318499e-01 1.341931e-01 1.362010e-01 1.379158e-01
> [34,] 8.211390e-02 8.384684e-02 8.533693e-02 8.661377e-02 8.770426e-02
> [35,] 5.221838e-02 5.332040e-02 5.426799e-02 5.507996e-02 5.577344e-02
> [36,] 3.320704e-02 3.390784e-02 3.451044e-02 3.502679e-02 3.546779e-02
> [37,] 2.111723e-02 2.156289e-02 2.194609e-02 2.227446e-02 2.255490e-02
> [38,] 1.342900e-02 1.371240e-02 1.395610e-02 1.416491e-02 1.434325e-02
> [39,] 8.539852e-03 8.720078e-03 8.875047e-03 9.007838e-03 9.121250e-03
> [40,] 5.430716e-03 5.545326e-03 5.643875e-03 5.728321e-03 5.800442e-03
> [41,] 3.453535e-03 3.526418e-03 3.589088e-03 3.642789e-03 3.688653e-03
> [42,] 2.196193e-03 2.242542e-03 2.282395e-03 2.316545e-03 2.345711e-03
> [43,] 1.396617e-03 1.426091e-03 1.451435e-03 1.473152e-03 1.491699e-03
> [44,] 8.881453e-04 9.068888e-04 9.230056e-04 9.368159e-04 9.486108e-04
> [45,] 5.647949e-04 5.767144e-04 5.869635e-04 5.957458e-04 6.032465e-04
> [46,] 3.591679e-04 3.667478e-04 3.732655e-04 3.788504e-04 3.836202e-04
> [47,] 2.284043e-04 2.332245e-04 2.373693e-04 2.409209e-04 2.439542e-04
> [48,] 1.452483e-04 1.483136e-04 1.509494e-04 1.532079e-04 1.551369e-04
> [49,] 9.236718e-05 9.431650e-05 9.599266e-05 9.742893e-05 9.865559e-05
> [50,] 5.873871e-05 5.997834e-05 6.104425e-05 6.195761e-05 6.273768e-05
> [51,] 3.735349e-05 3.814180e-05 3.881964e-05 3.940047e-05 3.989653e-05
> [52,] 2.375406e-05 2.425537e-05 2.468643e-05 2.505579e-05 2.537125e-05
> [53,] 1.510583e-05 1.542463e-05 1.569875e-05 1.593363e-05 1.613424e-05
> [54,] 9.606194e-06 9.808924e-06 9.983244e-06 1.013262e-05 1.026019e-05
>              [,44]        [,45]        [,46]        [,47]        [,48]
>  [1,] 8.130827e+02 8.130827e+02 8.130827e+02 8.130827e+02 8.130827e+02
>  [2,] 8.130827e+02 8.130827e+02 8.130827e+02 8.130827e+02 8.130827e+02
>  [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,] 3.446469e-01 3.477131e-01 3.503108e-01 3.525072e-01 3.543609e-01
> [32,] 2.191700e-01 2.211199e-01 2.227718e-01 2.241686e-01 2.253474e-01
> [33,] 1.393759e-01 1.406159e-01 1.416665e-01 1.425547e-01 1.433043e-01
> [34,] 8.863282e-02 8.942136e-02 9.008942e-02 9.065425e-02 9.113097e-02
> [35,] 5.636393e-02 5.686539e-02 5.729022e-02 5.764941e-02 5.795257e-02
> [36,] 3.584330e-02 3.616219e-02 3.643235e-02 3.666077e-02 3.685356e-02
> [37,] 2.279370e-02 2.299648e-02 2.316829e-02 2.331355e-02 2.343615e-02
> [38,] 1.449511e-02 1.462407e-02 1.473332e-02 1.482570e-02 1.490366e-02
> [39,] 9.217820e-03 9.299828e-03 9.369306e-03 9.428049e-03 9.477628e-03
> [40,] 5.861854e-03 5.914005e-03 5.958188e-03 5.995543e-03 6.027072e-03
> [41,] 3.727706e-03 3.760871e-03 3.788968e-03 3.812723e-03 3.832773e-03
> [42,] 2.370546e-03 2.391636e-03 2.409504e-03 2.424611e-03 2.437361e-03
> [43,] 1.507493e-03 1.520904e-03 1.532267e-03 1.541874e-03 1.549982e-03
> [44,] 9.586540e-04 9.671829e-04 9.744086e-04 9.805178e-04 9.856740e-04
> [45,] 6.096332e-04 6.150569e-04 6.196520e-04 6.235370e-04 6.268160e-04
> [46,] 3.876818e-04 3.911308e-04 3.940529e-04 3.965235e-04 3.986087e-04
> [47,] 2.465370e-04 2.487304e-04 2.505886e-04 2.521597e-04 2.534857e-04
> [48,] 1.567793e-04 1.581742e-04 1.593559e-04 1.603550e-04 1.611982e-04
> [49,] 9.970009e-05 1.005871e-04 1.013386e-04 1.019739e-04 1.025102e-04
> [50,] 6.340190e-05 6.396597e-05 6.444385e-05 6.484790e-05 6.518891e-05
> [51,] 4.031893e-05 4.067764e-05 4.098154e-05 4.123848e-05 4.145534e-05
> [52,] 2.563987e-05 2.586798e-05 2.606123e-05 2.622463e-05 2.636254e-05
> [53,] 1.630506e-05 1.645012e-05 1.657302e-05 1.667693e-05 1.676463e-05
> [54,] 1.036882e-05 1.046107e-05 1.053922e-05 1.060530e-05 1.066107e-05
>              [,49]        [,50]        [,51]        [,52]        [,53]
>  [1,] 8.130827e+02 8.130827e+02 8.130827e+02 8.130827e+02 8.130827e+02
>  [2,] 8.130827e+02 8.130827e+02 8.130827e+02 8.130827e+02 8.130827e+02
>  [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,] 3.559231e-01 3.572380e-01 3.583435e-01 3.592722e-01 3.600517e-01
> [32,] 2.263408e-01 2.271770e-01 2.278800e-01 2.284706e-01 2.289663e-01
> [33,] 1.439361e-01 1.444678e-01 1.449149e-01 1.452904e-01 1.456057e-01
> [34,] 9.153272e-02 9.187087e-02 9.215517e-02 9.239400e-02 9.259447e-02
> [35,] 5.820806e-02 5.842309e-02 5.860389e-02 5.875577e-02 5.888325e-02
> [36,] 3.701603e-02 3.715278e-02 3.726775e-02 3.736433e-02 3.744540e-02
> [37,] 2.353946e-02 2.362643e-02 2.369954e-02 2.376096e-02 2.381251e-02
> [38,] 1.496936e-02 1.502466e-02 1.507116e-02 1.511022e-02 1.514300e-02
> [39,] 9.519410e-03 9.554577e-03 9.584145e-03 9.608983e-03 9.629832e-03
> [40,] 6.053642e-03 6.076006e-03 6.094809e-03 6.110604e-03 6.123863e-03
> [41,] 3.849670e-03 3.863892e-03 3.875849e-03 3.885894e-03 3.894325e-03
> [42,] 2.448106e-03 2.457150e-03 2.464754e-03 2.471142e-03 2.476503e-03
> [43,] 1.556815e-03 1.562566e-03 1.567402e-03 1.571464e-03 1.574873e-03
> [44,] 9.900194e-04 9.936768e-04 9.967519e-04 9.993350e-04 1.001503e-03
> [45,] 6.295793e-04 6.319051e-04 6.338606e-04 6.355033e-04 6.368822e-04
> [46,] 4.003660e-04 4.018450e-04 4.030886e-04 4.041332e-04 4.050101e-04
> [47,] 2.546032e-04 2.555438e-04 2.563346e-04 2.569989e-04 2.575565e-04
> [48,] 1.619089e-04 1.625070e-04 1.630099e-04 1.634324e-04 1.637870e-04
> [49,] 1.029621e-04 1.033425e-04 1.036623e-04 1.039309e-04 1.041564e-04
> [50,] 6.547630e-05 6.571818e-05 6.592156e-05 6.609240e-05 6.623580e-05
> [51,] 4.163809e-05 4.179192e-05 4.192125e-05 4.202989e-05 4.212108e-05
> [52,] 2.647876e-05 2.657658e-05 2.665882e-05 2.672791e-05 2.678590e-05
> [53,] 1.683853e-05 1.690074e-05 1.695304e-05 1.699698e-05 1.703386e-05
> [54,] 1.070807e-05 1.074762e-05 1.078088e-05 1.080882e-05 1.083228e-05
>              [,54]
>  [1,] 8.130827e+02
>  [2,] 8.130827e+02
>  [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,] 3.607056e-01
> [32,] 2.293821e-01
> [33,] 1.458701e-01
> [34,] 9.276263e-02
> [35,] 5.899019e-02
> [36,] 3.751341e-02
> [37,] 2.385576e-02
> [38,] 1.517050e-02
> [39,] 9.647321e-03
> [40,] 6.134985e-03
> [41,] 3.901398e-03
> [42,] 2.481001e-03
> [43,] 1.577734e-03
> [44,] 1.003322e-03
> [45,] 6.380389e-04
> [46,] 4.057457e-04
> [47,] 2.580243e-04
> [48,] 1.640844e-04
> [49,] 1.043456e-04
> [50,] 6.635609e-05
> [51,] 4.219758e-05
> [52,] 2.683455e-05
> [53,] 1.706479e-05
> [54,] 1.085195e-05

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.741 0.824 0.900 0.888 0.786
> Median  0.979 0.956 0.965 0.978 0.988 0.971 0.940 0.956 0.969 0.983 0.981 0.964
> Mean    0.865 0.819 0.838 0.858 0.887 0.850 0.796 0.818 0.843 0.877 0.873 0.832
> 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.050 0.050 0.050
> 1st Qu. 0.838 0.885 0.936
> Median  0.971 0.981 0.990
> Mean    0.849 0.865 0.891
> 3rd Qu. 1.000 1.000 1.000
> Max.    1.000 1.000 1.000
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  1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000
> Mean    0.916 0.917 0.917 0.917 0.914 0.916 0.917 0.917 0.917 0.914 0.914 0.916
> 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.050 0.050 0.050
> 1st Qu. 0.991 0.991 0.991
> Median  1.000 1.000 1.000
> Mean    0.916 0.916 0.913
> 3rd Qu. 1.000 1.000 1.000
> Max.    1.000 1.000 1.000

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 Environmental and individual covariates

Users may at times wish to develop MPMs conditioned on an extra variable, including environmental variables such as Spring precipitation, or an individual state variable such as a frailty index. Package lefko3 can handle this easily with the modelsearch() function combined with the various function-based matrix estimators. Let’s see an example.

For our 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. First, we will need to add the proper variables to our original dataset.

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). To prevent this function from taking too long to run, 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.

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: subdata
>      AIC      BIC   logLik deviance df.resid 
>  86.7428 101.8161 -39.3714  78.7428      316 
> Random effects:
>  Groups  Name        Std.Dev.
>  individ (Intercept) 248.0   
>  year2   (Intercept) 172.1   
> Number of obs: 320, groups:  individ, 74; year2, 5
> Fixed Effects:
> (Intercept)     indcova2  
>     365.991       -2.451  
> 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: subdata
>      AIC      BIC   logLik deviance df.resid 
> 118.2567 133.1117 -55.1284 110.2567      299 
> Random effects:
>  Groups  Name        Std.Dev. 
>  individ (Intercept) 1.078e-05
>  year2   (Intercept) 8.776e-01
> Number of obs: 303, groups:  individ, 70; year2, 5
> Fixed Effects:
> (Intercept)   size2added  
>      2.4904       0.3134  
> optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
> 
> 
> 
> Size model:
> Formula:          size3added ~ (1 | year2) + (1 | individ)
> Data: subdata
>       AIC       BIC    logLik  df.resid 
> 1008.2763 1022.9281 -500.1381       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 (): 8.74e+07 
> 
> 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: subdata
>       AIC       BIC    logLik  deviance  df.resid 
>  330.0418  352.0196 -159.0209  318.0418       282 
> Random effects:
>  Groups  Name        Std.Dev. 
>  individ (Intercept) 0.0002695
>  year2   (Intercept) 0.2479120
> Number of obs: 288, groups:  individ, 70; year2, 5
> Fixed Effects:
> (Intercept)     indcova2   repstatus2   size2added  
>    -4.23766      0.02954      1.71091      0.17187  
> 
> 
> 
> Fecundity model:
> Formula:          feca2 ~ size2added + (1 | year2) + (1 | individ)
> Zero inflation:         ~size2added + (1 | year2) + (1 | individ)
> Data: subdata
>       AIC       BIC    logLik  df.resid 
>  248.8609  271.0264 -116.4305       110 
> Random-effects (co)variances:
> 
> Conditional model:
>  Groups  Name        Std.Dev.
>  year2   (Intercept) 0.5760  
>  individ (Intercept) 0.1639  
> 
> Zero-inflation model:
>  Groups  Name        Std.Dev. 
>  year2   (Intercept) 1.642e-06
>  individ (Intercept) 3.089e-04
> 
> Number of obs: 118 / Conditional model: year2, 5; individ, 51 / Zero-inflation model: year2, 5; individ, 51
> 
> Fixed Effects:
> 
> Conditional model:
> (Intercept)   size2added  
>    -0.54014      0.06174  
> 
> Zero-inflation model:
> (Intercept)   size2added  
>       3.865       -1.574  
> 
> 
> Juvenile survival model:
> [1] 1
> 
> 
> 
> Juvenile observation model:
> [1] 1
> 
> 
> 
> Juvenile size model:
> [1] 1
> 
> 
> 
> Juvenile secondary size model:
> [1] 1
> 
> 
> 
> Juvenile tertiary size model:
> [1] 1
> 
> 
> 
> Juvenile reproduction model:
> [1] 1
> 
> 
> 
> Juvenile maturity model:
> [1] 1
> 
> 
> 
> 
> 
> Number of models in survival table: 8
> 
> Number of models in observation table: 8
> 
> Number of models in size table: 8
> 
> Number of models in secondary size table: 1
> 
> Number of models in tertiary size table: 1
> 
> Number of models in reproduction status table: 8
> 
> Number of models in fecundity table: 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
> 
> 
> 
> 
> 
> 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.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.

Our individual covariate, total annual precipitation, is included in the best-fit vital rate models for survival and reproductive status. 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 2.04e-14 0.050 0.050 0.050
> 1st Qu. 1.000 2.04e-14 1.000 1.000 1.000
> Median  1.000 2.04e-14 1.000 1.000 1.000
> Mean    0.924 8.89e-03 0.925 0.925 0.923
> 3rd Qu. 1.000 2.04e-14 1.000 1.000 1.000
> Max.    1.000 1.80e-01 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')
> Warning in finalizeTMB(TMBStruc, obj, fit, h, data.tmb.old): Model convergence
> problem; false convergence (8). See vignette('troubleshooting'),
> help('diagnose')
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, :
> NA/NaN function evaluation

> Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
> NA/NaN function evaluation

> Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
> NA/NaN function evaluation

> Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
> NA/NaN function evaluation
> Warning in finalizeTMB(TMBStruc, obj, fit, h, data.tmb.old): 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) 1.034e-13 3.216e-07
>  year2   (Intercept) 1.616e-15 4.020e-08
> 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 (): 1.86e+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.60540   
> 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) 0.0000   0.0000  
>  year2   (Intercept) 0.5097   0.7139  
> Number of obs: 288, groups:  individ, 70; year2, 5
> 
> Fixed effects:
>             Estimate Std. Error z value Pr(>|z|)    
> (Intercept) -1.60119    0.40839  -3.921 8.83e-05 ***
> size2added   0.12168    0.06222   1.956   0.0505 .  
> size1added   0.07880    0.07391   1.066   0.2863    
> repstatus2   1.55291    0.31202   4.977 6.46e-07 ***
> repstatus1   0.43554    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.26871  -2.959  0.00308 **
> size2added   0.05039    0.03558   1.416  0.15675   
> size1added   0.01121    0.04225   0.265  0.79081   
> 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.34193   10.19   <2e-16 ***
> size2added  -2.10471    0.07894  -26.66   <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

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

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