R/fix_model_parameters.R

Defines functions fix_model_parameters

Documented in fix_model_parameters

#' Create a fable model with fixed parameters
#'
#' @description Fix some parameters of a fable model
#' @param model The model to use - typically a **fable** model such as \link[fable]{AR}
#' @param ... The arguments to pass, the RHS of the formula to be passed to the underlying model.
#' @return A New, fable compatible model, with the parameters fixed.
#' @export
fix_model_parameters <- function( model, ... ) {
  new_model <- function( target ) {
    formula <- rlang::new_formula(lhs = NULL, rhs = rlang::expr(...))
    rlang::f_lhs(formula) <- rlang::enexpr( target )
    model(!!formula)
  }
}
JSzitas/soothsayer documentation built on April 18, 2023, 12:59 a.m.