### Installing multilevelmod Development Version (R) Source: https://github.com/tidymodels/multilevelmod/blob/main/README.md This snippet shows how to install the development version of the `multilevelmod` package directly from its GitHub repository using the `pak::pak()` function. This requires the `pak` package to be installed first and is suitable for users who want the latest features or bug fixes. ```R # install.packages("pak") pak::pak("tidymodels/multilevelmod") ``` -------------------------------- ### Installing multilevelmod from CRAN (R) Source: https://github.com/tidymodels/multilevelmod/blob/main/README.md This snippet demonstrates how to install the stable version of the `multilevelmod` package directly from CRAN using the `install.packages()` function in R. This is the recommended method for most users. ```R install.packages("multilevelmod") ``` -------------------------------- ### Fitting a Frequentist Multilevel Linear Regression (R) Source: https://github.com/tidymodels/multilevelmod/blob/main/README.md This R code demonstrates how to fit a frequentist multilevel linear regression model using `multilevelmod`'s `lmer` engine with `parsnip`. It loads the `sleepstudy` dataset, defines a `linear_reg()` model specification, sets the engine to `lmer`, and fits the model using the `Reaction ~ Days + (Days | Subject)` formula, which includes random intercepts and slopes for `Subject`. ```R library(multilevelmod) set.seed(1234) data(sleepstudy, package = "lme4") mixed_model_spec <- linear_reg() |> set_engine("lmer") mixed_model_fit <- mixed_model_spec |> fit(Reaction ~ Days + (Days | Subject), data = sleepstudy) ``` -------------------------------- ### Fitting a Bayesian Multilevel Linear Regression (R) Source: https://github.com/tidymodels/multilevelmod/blob/main/README.md This R code illustrates how to fit a Bayesian multilevel linear regression model using `multilevelmod`'s `stan_glmer` engine with `parsnip`. It defines a `linear_reg()` model specification, sets the engine to `stan_glmer`, and fits the model using the `Reaction ~ Days + (Days | Subject)` formula, which includes random intercepts and slopes for `Subject`, providing a Bayesian perspective on the `sleepstudy` data. ```R hier_model_spec <- linear_reg() |> set_engine("stan_glmer") hier_model_fit <- hier_model_spec |> fit(Reaction ~ Days + (Days | Subject), data = sleepstudy) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.