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
Request for broom to work with scam package #186
Comments
Me too. This would be a great addition. The structure of the scam model is similar to gam. |
@simonpcouch This is currently not supported in library(scam)
#> Loading required package: mgcv
#> Loading required package: nlme
#> This is mgcv 1.8-31. For overview type 'help("mgcv-package")'.
#> This is scam 1.2-5.
set.seed(0)
n <- 200
x1 <- runif(n) * 6 - 3
f1 <- 3 * exp(-x1^2) # unconstrained term
f1 <- (f1 - min(f1)) / (max(f1) - min(f1)) # function scaled to have range [0,1]
x2 <- runif(n) * 4 - 1
f2 <- exp(4 * x2) / (1 + exp(4 * x2)) # monotone increasing smooth
f2 <- (f2 - min(f2)) / (max(f2) - min(f2)) # function scaled to have range [0,1]
f <- f1 + f2
y <- f + rnorm(n) * 0.1
dat <- data.frame(x1 = x1, x2 = x2, y = y)
## fit model, results, and plot...
b <- scam(y ~ s(x1, k = 15, bs = "cr", m = 2) + s(x2, k = 25, bs = "mpi", m = 2),
family = gaussian(link = "identity"), data = dat, not.exp = FALSE
)
class(b)
#> [1] "scam" "glm" "lm"
broom::tidy(b)
#> Error: Join columns must be present in data.
#> x Problem with `term` and `estimate`. Created on 2020-06-09 by the reprex package (v0.3.0) |
Thanks for noting this, @IndrajeetPatil! I'm currently assigning the We’ve decided that, in general, we won’t be adding new tidier methods to broom after the upcoming 0.7.0 release in favor of asking the model-owning package (in this case, scam) to write and export the tidiers. We’ve written some documentation on how to make this happen and have also provided a much lighter-weight dependency than broom, |
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. |
The scam package is an extension of the mgcv package, which adds the ability to constrain the shape of the splines (for example, they can be forced to be monotonously increasing).
The text was updated successfully, but these errors were encountered: