Skip to contents

Extracts the beta coefficients from a ftmglm or ftmlm model. Allows coefficients to be estimated using a given set of variables.

Usage

# S4 method for class 'ftmglm'
coef(object, select = NULL)

# S4 method for class 'ftmlm'
coef(object, select = NULL, s = NULL)

Arguments

object

Object of class inheriting from ftmglm or ftmlm.

select

(optional) A character string of variables or indices to use. If omitted, coefficients for all variables are returned.

s

(optional) Ridge penalty to apply during reweighting. Default is 0, indicating no penalty.

Value

A named numeric vector of coefficients.

Details

When select is specified, only the coefficients for the selected variables are calculated.

The ridge penalty parameter s is only applicable to ftmlm models.

Note

The use of a ridge penalty is not applicable to ftmglm models and will be ignored if specified.

See also

predict,ftmglm-method and predict,ftmlm-method for methods to make predictions using model objects.

Examples

if (FALSE) { # \dontrun{
# Assuming ftmglmModel and ftmlmModel are pre-fitted model objects
# Extract all coefficients from a ftmglm model
coeffs_glm <- coef(ftmglmModel)

# Extract coefficients for specific variables from a ftmglm model
coeffs_glm_select <- coef(ftmglmModel, select = c("var1", "var2"))

# Extract all coefficients from a ftmlm model with a ridge penalty
coeffs_lm <- coef(ftmlmModel, s = 0.1)

# Extract coefficients for specific variables from a ftmlm model with no penalty
coeffs_lm_select <- coef(ftmlmModel, select = c("var1", "var2"))
} # }