Generates bootstrap replicates of the estimated parameters in a "lmf" model. Ordinary bootstrap is performed for the projection matrix, while both parametric and ordinary (non-parametric) resampling is available for the remaining parameters in the model. In addition, bootstrapping under any choosen null hypothesis is available for hypothesis testing.

1 2 3 4 5 |

`object` |
a fitted object of of class "lmf". |

`nboot` |
the number og bootstraps desired. |

`what` |
which set of parameters to bootstrap. Options are "projection" to
only resample projection matrix, growth rate |

`asim` |
the type of bootstrap for the parameters other than the projection matrix (which is always ordinary bootstrapped). Options are "parametric" (default) and "ordinary". |

`sig.dj` |
logical, |

`H0exp` |
a list with the first element a vector containing the expected temproal mean coefficients of selection (alpha) and the second element a matrix containing the elements of the expected temporal variance-covariance matrix (M) under the null hypothesis. This argument needs to be specified to perform hypothesis testing. |

`H0con` |
the conditions under which the null hypothesis should be tested. Options are "fs" to assume fluctuating selection, "nfs" to assume no fluctuating selection, "ds" to assume directional selection and "nds" to assume no directional selection. "nds" is not implemented due to increased risk of Type I error if the assumption is not correct, but is included here for completeness. |

`method` |
defines what optimalization algorithm to be used in the
maximization of the loglikelihood. Alternatives are: "Nelder-Mead",
"BFGS" (default), "CG", "L-BFGS-B" and "SANN". Not all are applicable here.
See |

`control` |
a list of control parameters for the maximization of the
likelihood. |

`...` |
additional arguments to be passed to optim for the maximization
of the loglikelihood. See |

The resampling procedures preserve the observed ratios of the different age classes during resampling of the projection matrix.

Ordinary bootstrap will often be subject to bias due to few years of data in most available data sets within biology (generally << 40), thus the parametric bootstrap is recomended for most purposes.

The bootstrap procedure is closely associated with the method deployed in
`lmf`

and further details can be found in Engen et al. 2012.

Different from Engen et al. 2012, the sigma2.dj is defined as independent gamma
distributed variables with *shape* = *\frac{(EX)^2}{Var(X)}* and
*rate* = *\frac{EX}{Var(X)}*. Where *X* = *\hatσ^2_{dj}* and
using the mean and variance from in the paper.

`boot.lmf`

returns a object of class "boot.lmf".

The function `summary`

is used to obtain and
print a summary of the bootstrap replicates and to print results from tests of
hypotheses. For construction of confidene intervals for the parameters the
function `ci.boot.lmf`

is used.

An object of class "boot.lmf" is a list containing at most the following components:

`running.time` |
the total time used for computation. |

`optim.time` |
the time used for maximation of the loglikelihood. |

`call` |
the matched call. |

`asim` |
the value specified of asim. |

`nboot` |
the number of bootstrap replicates generated. |

`uage` |
the unique age classes in the data set. |

`nage` |
the number of unique age classes in the data set. |

`npar` |
the number of parameters in the model. |

`uyear` |
the unique years in the data set. |

`nyear` |
the number of unique years in the data set. |

`l` |
the estimated projection matrix. |

`lboot` |
the bootstrap replicates of the projection matrix. |

`lambda` |
the deterministic multiplicative growth rate of the population. |

`u` |
the stable age distribution. |

`v` |
the vector of reproductive values for each age class. |

`luvboot` |
the bootstrap replicates of |

`sigma2.dj` |
a list containing the demographic variance for each age class. Sorted by age class. |

`djboot` |
the bootstrap replicates of |

`sigma2.d` |
the total demographic variance of the population. |

`dboot` |
the bootstrap replicates of |

`Atboot` |
the bootstrap replicates of the yearly variance-covariance
matrices. The unscaled variance-covariance matrices are kept constant, but
each set of yearly estimates are scaled by the bootstrapped |

`atboot` |
the bootstrap replicates of the yearly coefficients of selection. This can be performed "parametric"(default) or "ordinary". |

`M` |
the estimated temporal covariance matrix (fluctuating selection). |

`aM` |
the estimated temporal mean coefficients of selection. |

`Mboot` |
the bootstrap replicates of |

`aMboot` |
the bootstrap replicates of |

`atCboot` |
the bootstrap replicates of the best linear predictor for the estimated yearly coefficients of selection (i.e. corrected for sampling errors). |

`Anf` |
the estimated temporal covariance matrix assuming no fluctuating selection. |

`anf` |
the estimated temporal mean selection coefficients assuming no fluctuating selection. |

`Anfboot` |
the bootstrap replicates of |

`anfboot` |
the bootstrap replicates of |

`sigma2.e` |
the environmental variance of the population. |

`eboot` |
the bootstrap replicates of |

`eCboot` |
the bootstrap replicates of |

`H0aMboot` |
the bootstrap replicates of |

`H0anfboot` |
the bootstrap replicates of |

`H0atnfboot` |
the bootstrap replicates of |

`H0Mnfboot` |
the bootstrap replicates of |

Thomas Kvalnes

Engen, S., Saether, B.-E., Kvalnes, T. and Jensen, H. 2012. Estimating fluctuating selection in age-structured populations. Journal of Evolutionary Biology, 25, 1487-1499.

`lmf`

, `ci.boot.lmf`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ```
#Data set from Engen et al. 2012
data(sparrowdata)
#Fit model
lmf.1 <- lmf(formula = cbind(recruits, survival) ~ weight + tars,
age = age, year = year, data = sparrowdata)
#Bootstrap parameters
b.1 <- boot.lmf(object = lmf.1, nboot = 10, sig.dj = TRUE,
what = "all", asim = "parametric")
#Print
b.1
#Summary
summary(b.1)
#View density plots
plot(b.1)
#Test of hypoteses
b.2 <- boot.lmf(object = lmf.1, nboot = 10, sig.dj = TRUE,
what = "H0", H0exp = list(rep(0, 3), matrix(0, ncol = 3, nrow = 3)),
asim = "parametric")
#Summary
summary(b.2)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.