Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Columns in tidy.ridgelm are inconsistent and do not pass strict tests #532

Closed
jmuhlenkamp opened this issue Nov 20, 2018 · 2 comments
Closed

Comments

@jmuhlenkamp
Copy link
Contributor

jmuhlenkamp commented Nov 20, 2018

Note, I intend to open a PR for this issue.

For tidy.ridgelm, the columns on the returned tibble are inconsistent depending on the original function call.

Case 1: User DOES NOT specify an argument for lambda (i.e. single lambda is used)

library(broom)
names(longley)[1] <- "y"
fit1 <- MASS::lm.ridge(y ~ ., longley)
colnames(tidy(fit1))
## [1] "lambda"   "term"     "estimate" "scale"    "xm" 

Case 2: User DOES specify an argument for lambda with length > 1 (i.e. > 1 lambda is used)

fit2 <- MASS::lm.ridge(y ~ ., longley, lambda = seq(0.001, .05, .001))
colnames(tidy(fit2))
## [1] "lambda"   "GCV"      "term"     "estimate" "scale" 

Comparison

  • The column xm is included in Case 1, but not Case 2
  • The column GCV is included in Case 2, but not Case 1

Proposed Solution

  • GCV column will be added to Case 1 as this matches documentation and passes strict tests #450 for related strict tests info.
  • xm column will be removed from Case 1 because
    • xm prohibits passing of strict tests
    • xm column is not included in the documentation (?tidy.ridgelm)
    • xm is simply the column means of the training data (?MASS:lm.ridge) and thus does not reflect statistics specific to lm.ridge model fit.
@alexpghayes
Copy link
Collaborator

Nice digging! Apologies that I haven't responded to you over in #450 yet. Will try to take a look at the PR over Thanksgiving!

@github-actions
Copy link

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants