Description Usage Arguments Details Author(s)
Construct a data.frame
and formula
to be passed to the
regression modeling tool to generate a control polygon.
1 | generate_cp_formula_data(f, .data)
|
f |
a formula |
.data |
the data set containing the variables in the formula |
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.
Peter DeWitt dewittpe@gmail.com
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.