R/F_getModelMat.R

Defines functions getModelMat

Documented in getModelMat

#' A function to construct a model matrix of a certain degree
#' @param y the variable
#' @param degree the degree
#'
#' @return A model matrix with degree+1 columns and as many rows as lenght(y)
getModelMat = function(y, degree) {
    model.matrix(formula(paste("~", paste(paste("I(y^", 
        seq_len(degree), ")"), collapse = "+"))))
}

Try the RCM package in your browser

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

RCM documentation built on Nov. 8, 2020, 5:22 p.m.