R/makeUnpenalized.r

Defines functions makeUnpenalized

##
## Find which columns of the expanded design matrix should be excluded from
## the adaptive LASSO penalty
##
makeUnpenalized <- function(unpenalized, polyTerms)
{
    ## Check that all of the specified terms are actually in the model, and
    ## issue a warning if not
    notInModel <- !(unpenalized %in% rownames(polyTerms))
    if (any(notInModel)) {
        warning("The following elements of 'unpenalized' are not terms in the model: ",
                paste(unpenalized[notInModel], collapse = ", "))
    }

    ans <- rownames(polyTerms) %in% unpenalized
    names(ans) <- rownames(polyTerms)
    ans
}

Try the polywog package in your browser

Any scripts or data that you put into this service are public.

polywog documentation built on May 1, 2019, 9:15 p.m.