r descr_models("linear_reg", "gls")
This model has no tuning parameters.
r uses_extension("linear_reg", "gls", "regression")
library(multilevelmod) linear_reg() %>% set_engine("gls") %>% set_mode("regression") %>% translate()
There are no specific preprocessing needs. However, it is helpful to keep the clustering/subject identifier column as factor or character (instead of making them into dummy variables). See the examples in the next section.
The model can accept case weights.
With parsnip, we suggest using the fixed effects formula method when fitting, but the details of the correlation structure should be passed to set_engine()
since it is an irregular (but required) argument:
library(tidymodels) # load nlme to be able to use the `cor*()` functions library(nlme) data("riesby") linear_reg() %>% set_engine("gls", correlation = corCompSymm(form = ~ 1 | subject)) %>% fit(depr_score ~ week, data = riesby)
When using tidymodels infrastructure, it may be better to use a workflow. In this case, you can add the appropriate columns using add_variables()
then supply the typical formula when adding the model:
library(tidymodels) gls_spec <- linear_reg() %>% set_engine("gls", correlation = corCompSymm(form = ~ 1 | subject)) gls_wflow <- workflow() %>% # The data are included as-is using: add_variables(outcomes = depr_score, predictors = c(week, subject)) %>% add_model(gls_spec, formula = depr_score ~ week) fit(gls_wflow, data = riesby)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.