MFClusHier: MFClusHier

View source: R/MFHier-wrappers.r

MFClusHierR Documentation

MFClusHier

Description

Calculate mitigated fraction directly from hierarchial nested data. Combines MFh and MFnest into a single function.

Usage

MFClusHier(formula, data, compare = c("con", "vac"), which.factor = "All")

Arguments

formula

Formula of the form y ~ x + a/b/c, where y is a continuous response, x is a factor with two levels of treatment, and a/b/c are grouping variables corresponding to the clusters. Nesting is assumed to be in order, left to right, highest to lowest. So a single level of "a" will contain multiple levels of "b" and a single level of "b" will contain multiple levels of "c".

data

a data.frame or tibble with the variables specified in formula. Additional variables will be ignored.

compare

Text vector stating the factor levels - compare[1] is the control or reference group to which compare[2] is compared.

which.factor

one or more variable(s) of interest. This can be any of the core or nest variables from the data set. If none or NULL is specified, MF will be calculated for the whole tree.

Value

A list with the following elements:

  • MFh: as output from MFh.

  • MFnest: as output from MFnest.

Note

Core variable is the variable corresponding to the lowest nodes of the hierarchical tree. Nest variables are those above the core. All refers to a summary of the entire tree.

Author(s)

MF-package

See Also

MFh, MFnest

Examples

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))
set.seed(76153)
a$lung[a$tx == "vac"] <- rnorm(24, 5, 1.3)
a$lung[a$tx == "con"] <- rnorm(24, 7, 1.3)
thismf <- MFClusHier(lung ~ tx + room / pen / litter, a)
thismf$MFnest
aCore <- thismf$MFh
aCore
aCore$data
aCore$formula
aCore$compare

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