View source: R/lifetable_bootstrap.R
| lifeTable_boot_test | R Documentation |
Compares the life table parameters of two cohorts with the paired
bootstrap test used by TWOSEX-MSChart: both cohorts are resampled
independently B times, the differences
d = parameter(group 1) - parameter(group 2) are formed
replicate by replicate, and the 95 percent percentile interval of
the differences is inspected. Following the convention of the
life table literature, the difference is considered significant
when the confidence interval of the difference does not include
zero.
lifeTable_boot_test(lt1, lt2, B = 1e+05, seed = NULL, conf.level = 0.95)
lt1, lt2 |
|
B |
Integer; number of bootstrap replicates per group
(default |
seed |
Integer; seed for the random number generator; the session state is restored when the function exits. |
conf.level |
Numeric; confidence level of the intervals of
the differences (default |
The two cohorts are resampled independently, so they do
not need to have the same number of individuals. The parameters
compared are those of lifeTable_bootstrap that
occur in BOTH cohorts; if the stage structures differ, only the
common parameters are compared and a warning is issued. A
bootstrap p-value is reported in addition to the interval test:
2 * min(P(d <= 0), P(d >= 0)) over the valid replicates.
Replicates in which a parameter is undefined in either group
(e.g. no female drawn) are dropped from the comparison.
A data frame with one row per compared parameter:
Parameter |
parameter name (as in
|
Boot_mean_1, Boot_mean_2 |
bootstrap means of the two groups |
Diff |
mean of the bootstrap differences (group 1 minus group 2) |
CI_low, CI_high |
percentile interval of the differences |
Significant |
logical; |
P_bootstrap |
two-sided bootstrap p-value |
The attribute groups contains the file names of the two
cohorts.
Meyer, J. S., Ingersoll, C. G., McDonald, L. L. and Boyce, M. S. (1986) Estimating uncertainty in population growth rates: jackknife vs. bootstrap. Ecological Modelling 29, 251-271.
Chi, H., You, M. S., Atlihan, R., Smith, C. L., Kavousi, A., Ozgokce, M. S., Guncan, A. and Tuan, S. J. (2020) Age-stage, two-sex life table: an introduction to theory, data analysis, and application. Entomologia Generalis 40(2), 103-124.
lifeTable_bootstrap for the standard errors
of a single cohort.
f <- system.file("extdata", "lifetable_example.csv", package = "insectecol")
lt1 <- lifeTable_read(f)
## compare the full cohort with its first half (demo only - a real
## comparison would use two different treatments)
lt2 <- lt1
lt2$data <- lt1$data[1:12, ]
rownames(lt2$data) <- NULL
lt2$file_name <- "Example (first half)"
## B = 100000 is the recommended setting for publications; a smaller
## B is used here so that the example runs fast
lifeTable_boot_test(lt1, lt2, B = 2000, seed = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.