library("gratia")
library("mgcv")
su_eg3 <- data_sim("eg3", n = 400, seed = 32)
su_m_factor_by <- gam(y ~ fac + s(x2, by = fac) + s(x0),
data = su_eg4,
method = "REML")
confint(su_m_factor_by, parm = "s(x2):fac1", type = "simultaneous")
Error in smooth[["first.para"]] : subscript out of bounds
suggesting that whatever I am doing to identify the smooth works for type = "confidence" but isn't working when I try to identify the smooth and parameter for the simultaneous interval.
Adding partial_match = TRUE to that example works however:
r$> confint(su_m_factor_by, parm = "s(x2)", type = "simultaneous", partial_match = TRUE)
# A tibble: 600 × 9
smooth by_variable x2 est se fac crit lower upper
<chr> <fct> <dbl> <dbl> <dbl> <fct> <dbl> <dbl> <dbl>
1 s(x2):fac1 fac 0.00131 -0.981 0.525 1 2.64 -2.37 0.404
2 s(x2):fac1 fac 0.00633 -0.953 0.509 1 2.64 -2.30 0.390
3 s(x2):fac1 fac 0.0114 -0.925 0.494 1 2.64 -2.23 0.377
4 s(x2):fac1 fac 0.0164 -0.898 0.478 1 2.64 -2.16 0.365
5 s(x2):fac1 fac 0.0214 -0.870 0.464 1 2.64 -2.09 0.354
6 s(x2):fac1 fac 0.0264 -0.842 0.449 1 2.64 -2.03 0.343
7 s(x2):fac1 fac 0.0314 -0.814 0.435 1 2.64 -1.96 0.335
8 s(x2):fac1 fac 0.0364 -0.787 0.422 1 2.64 -1.90 0.327
9 s(x2):fac1 fac 0.0415 -0.759 0.409 1 2.64 -1.84 0.321
10 s(x2):fac1 fac 0.0465 -0.731 0.397 1 2.64 -1.78 0.317
# … with 590 more rows
This throws an error:
suggesting that whatever I am doing to identify the smooth works for
type = "confidence"
but isn't working when I try to identify the smooth and parameter for the simultaneous interval.Adding
partial_match = TRUE
to that example works however: