ddfm: Containment denominator degrees of freedom for a fitted lme...

Description Usage Arguments Details Value Examples

View source: R/ddfm.R

Description

Containment denominator degrees of freedom for a fitted lme model with crossed random effects

Usage

1
ddfm(lme.object, design)

Arguments

lme.object

A fitted lme object.

design

A one-sided formula specifying the design structure. The design structure must be fully specified: see details for info.

Details

Nelder (1965) notes that crossing two factors is equivalent to nesting them at the same level (https://doi.org/10.1098/rspa.1965.0012). Dalgaard (2006), among others, have demonstrated how this can be leveraged to fit models with crossed random effects in the nlme::lme() function despite the positional notation which the package uses in specifying random effects which are assumed to be nested (https://staff.pubhealth.ku.dk/~pd/mixed-jan.2006/lme.pdf).

This enables the fitting of models with any arbitrary random effects structure, with patterned variance-covariance structures, unequal variances, and correlated residuals, which is not possible in other widely-used mixed modeling R packages (i.e. lme4). The available techniques for doing so, however, "trick" the algorithm the packages uses for calculating denominator degrees of freedom, (almost always) leading to inflated p-values. This function allows the calculation of the correct degrees of freedom based on the specified design structure.

The formula specifying the design structure must be fully specified, including a replication factor nested within treatment(s) for designs lacking a blocking structure.

The relevant operators are: "/" to indicate nesting, "*" to indicate crossing, and ":" to indicate an interaction (useful for factorial experiments where the experimental unit is at the level of an interaction among several factors).

Thus, for a 2-factor factorial experiment with replication number given by R:

CRD design: ~ A:B/R (experimental units are nested at the level of A:B interaction)

RCB design: ~ R/A:B (experimental units at the level of A:B interaction are nested in blocks)

Split-Plot RCB: ~ R/A/B

Split-Block RCB: ~R/(A*B)

Value

A suitably ordered vector of denominator degrees of freedom corresponding to each fixed effect term in the lme.model, calculated using the containment method.

Examples

1
2
3
4
# Adapted from page 425 of Steel, Torrie & Dickey (1997), an "Analysis of Variance for a Split-
# Plot in Space and Time":
data = expand.grid(R = factor(1:4), A = factor(1:5), B = factor(1:3), Y = factor(1:3))
keyout(trt.formula = ~ A*B*Y, des.formula = ~ R/(A/B*Y), data)

SimonShamusRiley/lmehelp documentation built on Sept. 30, 2020, 12:02 a.m.