Description Usage Arguments Examples
Generates a hypothesis matrix to test whether a group of coefficients in a linear model are jointly zero, selecting the coefficients that match a regular expression.
| 1 | 
| fit | |
| pattern | 
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | ##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.
## The function is currently defined as
function (fit, pattern) 
{
    umatch <- function(pat, x) {
        ret <- rep(0, length(pat))
        for (ii in 1:length(pat)) {
            imatch <- grep(pat[ii], x)
            if (length(imatch) != 1) {
                cat("\nBad match of:\n")
                print(pat)
                cat("in:\n")
                print(x)
                stop("Bad match")
            }
            ret[ii] <- imatch
        }
        ret
    }
    if (is.character(fit)) {
        x <- pattern
        pattern <- fit
        fit <- x
    }
    fe <- getFix(fit)$fixed
    ne <- names(fe)
    if (is.character(pattern)) {
        L.indices <- grep(pattern, names(fe))
        ret <- diag(length(fe))[L.indices, , drop = F]
        rownames(ret) <- names(fe)[L.indices]
        labs(ret) <- "Coefficients"
    }
    else if (is.list(pattern)) {
        ret <- matrix(0, nrow = length(pattern), ncol = length(fe))
        colnames(ret) <- ne
        for (ii in 1:length(pattern)) {
            Lcoefs <- pattern[[ii]]
            pos <- umatch(names(Lcoefs), ne)
            if (any(is.na(pos))) 
                stop("Names of L coefs not matched in fixed effects")
            ret[ii, pos] <- Lcoefs
        }
        rownames(ret) <- names(pattern)
    }
    labs(ret) <- "Coefficients"
    ret
  }
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.