fit_model {mfp2}R Documentation

Function that fits models supported by mfp2

Description

Fits generalized linear models and Cox proportional hazard models.

Usage

fit_model(
  x,
  y,
  family = "gaussian",
  weights = NULL,
  offset = NULL,
  method = NULL,
  strata = NULL,
  control = NULL,
  rownames = NULL,
  nocenter = NULL,
  fast = TRUE
)

Arguments

x

a matrix of predictors (excluding intercept) with column names. If column names are not provided they are set according to colnames(x, do.NULL = FALSE).

y

a vector for the outcome variable for glms, and a Surv object for Cox models.

family

a character strong specifying glm family to be used, or "cox" for Cox models. The default family is set to 'Gaussian'.

method

a character string specifying the method for tie handling. See survival::coxph().

strata, control, weights, offset, rownames, nocenter

parameters for Cox or glm. See survival::coxph() or stats::glm() for details.

fast

passed to fit_glm() and fit_cox().

@return A list with the following components:

  • logl: the log likelihood of the fitted model.

  • coefficients: regression coefficients.

  • df: number of parameters (degrees of freedom).

  • sse: residual sum of squares.

  • fit: the object returned by the fitting procedure.

Details

Computations rely on fit_glm() and fit_cox().


[Package mfp2 version 1.0.0 Index]