generate_cp_formula_data: Generate Control Polygon Formula and Data

Description Usage Arguments Details Author(s)

Description

Construct a data.frame and formula to be passed to the regression modeling tool to generate a control polygon.

Usage

1

Arguments

f

a formula

.data

the data set containing the variables in the formula

Details

This function is expected to be called from within the cpr::cp function and is not expected to be called by the end user directly.

generate_cp_data exists because of the need to build what could be considered a varying means model. y ~ bsplines(x1) + x2 will generate a rank deficient model matrix—the rows of the bspline basis matrix sum to one with is perfectly collinear with the implicit intercept term. Specifying a formula y ~ bsplines(x1) + x2 - 1 would work if x2 is a continuous variable. If, however, x2 is a factor, or coerced to a factor, then the model matrix will again be rank deficient as a column for all levels of the factor will be generated. We need to replace the intercept column of the model matrix with the bspline. This also needs to be done for a variety of possible model calls, lm, lmer, etc.

By returning an explicit formula and data.frame for use in the fit, we hope to reduce memory use and increase the speed of the cpr method.

Author(s)

Peter DeWitt dewittpe@gmail.com


cpr documentation built on May 1, 2019, 10:46 p.m.