MFnestBoot: MFnestBoot

View source: R/MFnestBoot.r

MFnestBootR Documentation

MFnestBoot

Description

MFnest using bootstrapping

Usage

MFnestBoot(x, which.factor = "All", alpha = 0.05)

Arguments

x

output from MFhBoot

which.factor

one or more grouping variable(s) of interest. This can be any of the core or nest variables from the data set. A MF value will be calculated for each level of the variable(s) specified. Default is "All", to sum over entire tree.

alpha

Passed to emp_hpd to calculate eq tailed upper and high lower of mitigated fraction

Value

A list with the following elements:

  • mfnest_details: The MF and summary statistics as calculated for each bootstrap event. Variables as in MFnest output.

  • mfnest_summary: Statistical summary of bootstrapped MF with each unique level of a core or nest variable passed to which.factor as a row. Other variables include:

    • median: Median of MFs from all of the bootstrap events.

    • etlower: Lower value of equal tailed range.

    • etupper: Upper value of equal tailed range.

    • hdlower: Lower value of the highest posterior density range.

    • hdupper: Upper value of the highest posterior density range.

    • mf.obs: MF calculated from data using MFh.

Author(s)

MF-package

See Also

MFClusBootHier, MFhBoot

Examples

set.seed(76153)
a <- data.frame(room = paste("Room", rep(c("W", "Z"), each = 24)),
                pen = paste("Pen", rep(LETTERS[1:6], each = 8)),
                litter = paste("Litter", rep(11:22, each = 4)),
                tx = rep(rep(c("vac", "con"), each = 2), 12))
a[a$tx == "vac", "lung"] <- rnorm(24, 5, 1.3)
a[a$tx == "con", "lung"] <- rnorm(24, 7, 1.3)
a

formula <- lung ~ tx + room / pen / litter
nboot <- 10000
boot.cluster <- TRUE
boot.unit <- TRUE
which.factors <- c("All", "room", "pen", "litter")

#################

test1 <- MFhBoot(formula, a,
                 nboot = 10000,
                 boot.cluster = TRUE, boot.unit = TRUE, seed = 12345)
MFnestBoot(test1, c("All", "litter"))

## Not run: 
system.time(test2 <- MFnestBoot(test1, which.factors))
test2
system.time(test3 <- MFnestBoot(test1, which.factors[1]))
test3
system.time(test4 <- MFnestBoot(test1, which.factors[2]))
test4
system.time(test5 <- MFnestBoot(test1, which.factors[2:3]))
test5
system.time(test6 <- MFnestBoot(test1, which.factors[2:4]))
test6

## End(Not run)

ABS-dev/MF documentation built on Sept. 19, 2024, 10:30 a.m.