Learn R Programming

mmrm (version 0.3.16)

h_refit_mmrm: Refit an mmrm Model Using a New Dataset

Description

Extract the call component of fit and evaluate it in a new environment that contains the new data.

Usage

h_refit_mmrm(fit, data)

Value

An mmrm object with the same terms as fit but based on data.

Arguments

fit

(mmrm)
an mmrm object to be refit.

data

(data frame)
a data frame upon which fit is to be refit.

Details

This works as follows:

  1. A new environment is created whose parent is environment(fit$formula_parts$full_formula).

  2. A name is generated using h_generate_new_name(), and data is bound to the new environment using this new name.

  3. The call component of fit is extracted and its data argument is changed to the new name.

  4. The modified call is evaluated in the new environment.