Creation of full model design matrix and incidence matrix
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  | ##---- 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 (formula, data, subset, weights, na.action, offset, 
    ...) 
{
    cl <- match.call()
    mf <- match.call(expand.dots = TRUE)
    m <- match(c("formula", "data", "subset", "weights", "na.action", 
        "offset"), names(mf), 0L)
    mf <- mf[c(1L, m)]
    mf$drop.unused.levels <- TRUE
    mf[[1L]] <- as.name("model.frame")
    mf <- eval(mf, parent.frame())
    atts <- attributes(terms(mf))
    inci <- crossprod(atts$factor) == atts$order
    mods <- array(FALSE, c(nrow(inci), 1))
    rownames(mods) <- rownames(inci)
    mods <- t(mods)
    rownames(mods) <- mods %*% 2^((seq_len(ncol(inci))) - 1)
    res <- list(call = cl, incidence = inci, models = mods, frame = mf, 
        X = model.matrix(terms(mf), mf))
    class(res) <- "hpmods"
    res
  }
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.