hypr-class: S4 class “hypr” and its methods

hypr-classR Documentation

S4 class “hypr” and its methods

Description

A hypr object contains equations, a hypothesis matrix and a contrast matrix, all of which are related to each other. See below for methods.

Usage

## S4 method for signature 'hypr'
show(object)

## S4 method for signature 'hypr'
levels(x)

## S4 method for signature 'hypr'
nlevels(x)

## S4 method for signature 'hypr'
names(x)

## S4 method for signature 'hypr'
as.call(x)

## S4 replacement method for signature 'hypr'
names(x) <- value

## S4 replacement method for signature 'hypr'
levels(x) <- value

## S4 method for signature 'hypr'
formula(x, ...)

## S4 replacement method for signature 'hypr'
formula(x, ...) <- value

Arguments

object, x

a hypr object

value

New value (list of equations for formula, character vector for levels and names)

...

(ignored)

Details

To generate a hypr object, use the hypr function.

Value

A character vector of level names

An integer denoting the number of levels

A character vector of contrast names

A call object that reproduces the hypr object

A list of null hypothesis equations

Methods (by generic)

  • show(hypr): Show summary of hypr object, including contrast equations, the (transposed) hypothesis matrix and the derived contrast matrix.

  • levels(hypr): Retrieve the levels (variable names) used in a hypr object

  • nlevels(hypr): Retrieve the number of levels (variable names) used in a hypr object

  • names(hypr): Retrieve the contrast names used in a hypr object

  • as.call(hypr): Transform hypr object to a reproducible function call

  • names(hypr) <- value: Set the contrast names used in a hypr object

  • levels(hypr) <- value: Set the levels used in a hypr object

  • formula(hypr): Retrieve a hypr object’s null hypothesis equations.

  • formula(hypr) <- value: Modify a hypr object’s null hypothesis equations

Slots

eqs

List of null hypotheses

hmat

Hypothesis matrix

cmat

Contrast matrix

See Also

hypr, cmat, hmat

Examples

# Equations and matrices in a hypr object are always congruent
# Therefore creating a hypr object h and then copying ...
h <- hypr(mu1~0, mu2~mu1)

# ... its equations, ...
h2 <- hypr()
formula(h2) <- formula(h)

# ... its hypothesis matrix, ...
h3 <- hypr()
hmat(h3) <- hmat(h)

# ... or its contast matrix ...
h4 <- hypr()
cmat(h4) <- cmat(h)

# ... over to another hypr object is the same as copying the object:
h5 <- h

# check that hypr objects are equal by comparing hmat() and cmat()
stopifnot(all.equal(hmat(h), hmat(h2)))
stopifnot(all.equal(cmat(h), cmat(h2)))
stopifnot(all.equal(hmat(h), hmat(h3)))
stopifnot(all.equal(cmat(h), cmat(h3)))
stopifnot(all.equal(hmat(h), hmat(h4)))
stopifnot(all.equal(cmat(h), cmat(h4)))
stopifnot(all.equal(hmat(h), hmat(h5)))
stopifnot(all.equal(cmat(h), cmat(h5)))


h <- hypr(mu1~0, mu2~mu1)
formula(h)

h2 <- hypr()
formula(h2) <- formula(h)
h2
formula(h2)

# After updating, matrices should be equal
stopifnot(all.equal(hmat(h), hmat(h2)))
stopifnot(all.equal(cmat(h), cmat(h2)))


hypr documentation built on Nov. 9, 2023, 5:06 p.m.