Closed carlganz closed 7 years ago
The problem is different from what you think, center = TRUE
doesn't work for bols
(anymore). However, bols
can take multiple variables and computes the least squares (or penalized least squares) solution for these variables:
bols(x1, x2)
is essentially equivalent to a base-learner of the form lm(u ~ x1 + x2)
, where u
is the negative gradient.
bols(x1, x2, intercept = FALSE)
is essentially equivalent to a base-learner of the form lm(u ~ x1 + x2 - 1)
, where u
is the negative gradient.
What you do is that you specify another variable by accident. In the first model it seems that it is treated as an intercept (as as.numeric(TRUE)
is equal to 1), while in the second case you add a constant variable equal to zero which makes no sense at all.
As you are the second person running into this problem, we need to make sure that an error is thrown in that case.
@carlganz You stated that the example was taken from the docs. Does this include the (wrong) usage of center
in bols
or only the general model? I could not find any occurrence.
It wasn't taken from docs. Sorry if I made it seem that way. Thanks for the clarification.
I'm guessing that the levels of
waistcirc
change when centered so the levels in newdata don't match the model even though the data is the same as the data used to build the model.