Learn R Programming

ggpmisc (version 1.0.0)

fit_models_internal: Apply model fit methods to data

Description

Fit models using different methods translating some arguments to make possible use of consistent arguments across calls to stats.

Usage

fit_models_internal(
  data,
  method,
  method.name,
  method.args,
  n.min,
  formula,
  fit.seed,
  orientation,
  level = 0.95,
  accept.rq = TRUE
)

Value

A list with three named members: fm the fitted model object and method.args, the arguments passed to the model fit function as a nested named list, fit.seed the seed used and method.name, the name of the model fit function passed as arguemnt, which can differ from the class of fm.

Arguments

data

data.frame containing the variables in the model.

method, method.name

function and character, respectively.

method.args

named list with additional arguments. Not data or weights which are always passed through aesthetic mappings.

n.min

integer Minimum number of distinct values in the explanatory variable (on the rhs of formula) for fitting to the attempted.

formula

a formula object. Using aesthetic names x and y instead of original variable names.

fit.seed

RNG seed argument passed to set.seed(). Defaults to NA, indicating that set.seed() should not be called.

orientation

character Either "x" or "y" controlling the default for formula. The letter indicates the aesthetic considered the explanatory variable in the model fit.

level

numeric Value in 0..1 used for SMA and MA fits.

accept.rq

logical Accept quantile regression fits with 'quantreg' or warn when encountered.