mmib_model {mmibain}R Documentation

Fit Statistical Models for MMI Bain Processing

Description

This function provides a unified interface to fit different statistical models supported by the 'bain' package.

Usage

mmib_model(
  formula = NULL,
  column_names = NULL,
  model = NULL,
  data,
  engine = c("lm", "t_test", "lavaan"),
  ...
)

Arguments

formula

A symbolic description of the model to be fit. Used specifically for the lm engine. Default is NULL.

column_names

A character vector of length 2, representing the column names to be used for the t_test engine. Default is NULL.

model

A model specification (usually as a string) for the lavaan engine. Default is NULL.

data

A data frame containing the variables in the model.

engine

A character string representing the statistical method to be used. Currently supported methods are: "lm", "t_test", and "lavaan".

...

Additional arguments to be passed to the underlying statistical function (lm(), t.test(), or lavaan::sem()).

Details

The mmib_model() function provides a simple interface to fit various statistical models, which can be subsequently processed by the bain::bain() function. It ensures that only one of formula, column_names, or model is provided, checks the validity of the provided data, and selects the appropriate statistical method based on the engine parameter.

Value

Returns an object of the type associated with the engine selected (lm, htest, or lavaan object).

See Also

bain for processing the models fit with mmib_model.

Examples

data(mtcars)

# Fit linear model
mod1 <- mmib_model(mpg ~ wt + qsec, data = mtcars, engine = "lm")


[Package mmibain version 0.1.1 Index]