coef.beezdemand_nlme: Extract Coefficients from a beezdemand_nlme Model

View source: R/mixed-methods.R

coef.beezdemand_nlmeR Documentation

Extract Coefficients from a beezdemand_nlme Model

Description

Provides methods to extract fixed effects, random effects, or subject-specific (combined fixed + random) coefficients from a beezdemand_nlme object. This is an S3 method for the generic coef function.

Usage

## S3 method for class 'beezdemand_nlme'
coef(
  object,
  type = "combined",
  report_space = c("internal", "natural", "log10"),
  ...
)

Arguments

object

A beezdemand_nlme object.

type

Character, type of coefficients to extract. One of:

  • "fixed": Returns only fixed effects (equivalent to fixef(object)).

  • "random": Returns only random effects (equivalent to ranef(object)).

  • "combined" (default): Returns subject-specific coefficients, where each subject's coefficient is the sum of the corresponding fixed effect and that subject's random effect deviation. This is equivalent to what stats::coef() on an nlme object returns.

report_space

Character. One of "internal" (default), "natural", or "log10".

...

Additional arguments passed to the underlying nlme coefficient extraction functions (nlme::fixef(), nlme::ranef(), or stats::coef.nlme()).

Value

Depending on type:

  • type="fixed": A named numeric vector of fixed-effect coefficients.

  • type="random": A data frame (or list of data frames if multiple levels of grouping) of random effects, as returned by ranef.nlme().

  • type="combined": A data frame where rows are subjects (from id_var) and columns are the Q0 and alpha parameters, representing subject-specific estimates (on the log10 scale).

See Also

fixef.beezdemand_nlme, ranef.beezdemand_nlme

Examples


data(ko)
fit <- fit_demand_mixed(ko, y_var = "y_ll4", x_var = "x",
                        id_var = "monkey", equation_form = "zben")
coef(fit, type = "fixed")
coef(fit, type = "random")
coef(fit, type = "combined")


beezdemand documentation built on March 3, 2026, 9:07 a.m.