Skip to content

Commit 69c7c14

Browse files
committed
gam weights
1 parent eb81af5 commit 69c7c14

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

R/gen_additive_mod_data.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ set_fit(
4747
mode = "regression",
4848
value = list(
4949
interface = "formula",
50-
protect = c("formula", "data"),
50+
protect = c("formula", "data", "weights"),
5151
func = c(pkg = "mgcv", fun = "gam"),
5252
defaults = list()
5353
)
@@ -127,7 +127,7 @@ set_fit(
127127
mode = "classification",
128128
value = list(
129129
interface = "formula",
130-
protect = c("formula", "data"),
130+
protect = c("formula", "data", "weights"),
131131
func = c(pkg = "mgcv", fun = "gam"),
132132
defaults = list(
133133
family = quote(stats::binomial(link = "logit"))

man/rmd/gen_additive_mod_mgcv.Rmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ The smoothness of the terms will need to be manually specified (e.g., using `s(x
6464
```{r child = "template-makes-dummies.Rmd"}
6565
```
6666

67+
## Case weights
68+
69+
```{r child = "template-uses-case-weights.Rmd"}
70+
```
71+
6772
## References
6873

6974
- Ross, W. 2021. [_Generalized Additive Models in R: A Free, Interactive Course using mgcv_](https://noamross.github.io/gams-in-r-course/)

man/rmd/gen_additive_mod_mgcv.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ The smoothness of the terms will need to be manually specified (e.g., using `s(x
100100

101101
Factor/categorical predictors need to be converted to numeric values (e.g., dummy or indicator variables) for this engine. When using the formula method via \\code{\\link[=fit.model_spec]{fit()}}, parsnip will convert factor columns to indicators.
102102

103+
## Case weights
104+
105+
106+
This model can utilize case weights during model fitting. To use them, see the documentation in [case_weights] and the examples on `tidymodels.org`.
107+
108+
The `fit()` and `fit_xy()` arguments have arguments called `case_weights` that expect vectors of case weights.
109+
103110
## References
104111

105112
- Ross, W. 2021. [_Generalized Additive Models in R: A Free, Interactive Course using mgcv_](https://noamross.github.io/gams-in-r-course/)

0 commit comments

Comments
 (0)