hypr-class {hypr} | R 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 ( |
... |
(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 ahypr
object -
nlevels(hypr)
: Retrieve the number of levels (variable names) used in ahypr
object -
names(hypr)
: Retrieve the contrast names used in ahypr
object -
as.call(hypr)
: Transformhypr
object to a reproducible function call -
names(hypr) <- value
: Set the contrast names used in ahypr
object -
levels(hypr) <- value
: Set the levels used in ahypr
object -
formula(hypr)
: Retrieve ahypr
object’s null hypothesis equations. -
formula(hypr) <- value
: Modify ahypr
object’s null hypothesis equations
Slots
eqs
List of null hypotheses
hmat
Hypothesis matrix
cmat
Contrast matrix
See Also
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)))