add_intercept | R Documentation |
Non-centered contrasts require an intercept for correct specification of experimental hypotheses. These functions enable the user to check for existance of intercepts and to add or remove intercept columns as needed.
add_intercept(x)
remove_intercept(x)
is_intercept(x)
which_intercept(x)
has_intercept(x)
x |
A hypr object |
There are functions available to check whether a hypr
object contains an intercept (has_intercept
) or which contrast is the intercept (is_intercept
, which_intercept
). Moreover, if needed, the user can add (add_intercept
) or remove (remove_intercept
) an intercept column to/from a hypr object. add_intercept
and remove_intercept
do not throw an error if the user attempts to remove a non-existing intercept or add an intercept if there already is one.
A single logical value (has_intercept
), a logical vector (is_intercept
), an integer index vector (which_intercept
), or a modified hypr object (add_intercept
, remove_intercept
)
add_intercept()
: Add an intercept column if there is none
remove_intercept()
: Remove the intercept column if there is one
which_intercept()
: Return indices, not a logical vector of intercept columns
has_intercept()
: Check whether any of the contrasts is an intercept
h1 <- hypr(mu1~0, mu2~mu1)
h2 <- hypr(mu2~mu1, mu3~mu1)
stopifnot(has_intercept(h1))
stopifnot(!has_intercept(h2))
stopifnot(which_intercept(h1) == 1)
stopifnot(is_intercept(h1) == c(TRUE,FALSE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.