-
Notifications
You must be signed in to change notification settings - Fork 91
Namespacing issue with MARS models #251
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
Comments
I investigated why we are getting this issue. https://github.com/cran/earth/blob/213f668f255d3b80cdb82821cd04fe53b379828f/R/earth.R#L101-L105 which temporary sets the https://github.com/cran/earth/blob/213f668f255d3b80cdb82821cd04fe53b379828f/R/expand.arg.R#L60-L62 which is a unexported function https://github.com/cran/earth/blob/213f668f255d3b80cdb82821cd04fe53b379828f/R/expand.arg.R#L97-L111 So the issues is actually, that you can't use earth::earth(formula = Species ~ ., data = iris)
#> Error in get(ctr, mode = "function", envir = parent.frame()): object 'contr.earth.response' of mode 'function' was not found
library(earth)
#> Loading required package: Formula
#> Loading required package: plotmo
#> Loading required package: plotrix
#> Loading required package: TeachingDemos
earth::earth(formula = Species ~ ., data = iris)
#> Selected 9 of 15 terms, and 4 of 4 predictors
#> Termination condition: Reached nk 21
#> Importance: Petal.Length, Petal.Width, Sepal.Width, Sepal.Length
#> Number of terms at each degree of interaction: 1 8 (additive model)
#>
#> GCV RSS GRSq RSq
#> setosa 0.00089390 0.1054146 0.9960309 0.9968376
#> versicolor 0.02859205 3.3717648 0.8730456 0.8988471
#> virginica 0.02743849 3.2357302 0.8781676 0.9029281
#> All 0.05692444 6.7129096 0.9157480 0.9328709 Created on 2022-01-05 by the reprex package (v2.0.1) Another note. Since the way contr.earth.response <- function(x, base, contrasts) {
contr <- array(0, c(length(x), length(x)), list(x, x))
diag(contr) <- 1
contr
}
earth::earth(formula = Species ~ ., data = iris)
#> Selected 9 of 15 terms, and 4 of 4 predictors
#> Termination condition: Reached nk 21
#> Importance: Petal.Length, Petal.Width, Sepal.Width, Sepal.Length
#> Number of terms at each degree of interaction: 1 8 (additive model)
#>
#> GCV RSS GRSq RSq
#> setosa 0.00089390 0.1054146 0.9960309 0.9968376
#> versicolor 0.02859205 3.3717648 0.8730456 0.8988471
#> virginica 0.02743849 3.2357302 0.8781676 0.9029281
#> All 0.05692444 6.7129096 0.9157480 0.9328709 Created on 2022-01-05 by the reprex package (v2.0.1) |
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. |
I shouldn't need to explicitly load
earth
but I do.Created on 2020-01-05 by the reprex package (v0.3.0)
The text was updated successfully, but these errors were encountered: