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

draw fails for models with no smoothing #142

Closed
Nelson-Gon opened this issue Mar 7, 2022 · 2 comments
Closed

draw fails for models with no smoothing #142

Nelson-Gon opened this issue Mar 7, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@Nelson-Gon
Copy link

Nelson-Gon commented Mar 7, 2022

Hi,

Awesome package, continuing from my discussion from Twitter. I have tried the following and found that draw fails

library(gratia)
library(mgcv)
dat <- data_sim("eg4", n = 400, seed = 42)
b <- gam(y ~ x0 + x1 + x2 , data = dat, method = "REML")
appraise(b)
draw(b, parametric = TRUE)

It fails with

Unable to draw any of the model terms.

I am using gratia ‘0.6.0’.

EDIT

I have upgraded to 0.7.0 and now have the following error

Error: Problem with mutate() column data.
i data = list(add_confint(.data$data, coverage = ci_level)).
x Column data not found in .data

A traceback

+-<error/dplyr:::mutate_error>
| Problem with `mutate()` column `data`.
| i `data = list(add_confint(.data$data, coverage = ci_level))`.
| x Column `data` not found in `.data`
\-<error/rlang_error_data_pronoun_not_found>
  Column `data` not found in `.data`
Backtrace:
  1. gratia::draw(b, parametric = TRUE)
 14. rlang:::abort_data_pronoun(x)

Thank you,

NelsonGon

@gavinsimpson gavinsimpson added the bug Something isn't working label Mar 8, 2022
@gavinsimpson gavinsimpson self-assigned this Mar 8, 2022
@gavinsimpson
Copy link
Owner

Confirmed; thanks @Nelson-Gon. I'll see where the issue is...

gavinsimpson added a commit that referenced this issue Mar 8, 2022
@gavinsimpson
Copy link
Owner

This was caused by a couple of issues with the ordering of code in draw.gam() and a potential problem in predict.gam() where if one passes exclude = character(0) (which arises when smooths() returns such a thing for a model with no smooths...), predict.gam() doesn't return any columns in the fit or se.fit arrays.

The ordering issues are fixed and the exclude problem is now worked around...

gavinsimpson added a commit that referenced this issue Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants