coef.glmertree function

Obtaining Fixed-Effects Coefficient Estimates of (Generalized) Linear Mixed Model Trees

Obtaining Fixed-Effects Coefficient Estimates of (Generalized) Linear Mixed Model Trees

coef and fixef methods for (g)lmertree objects.

## S3 method for class 'lmertree' coef(object, which = "tree", drop = FALSE, ...) ## S3 method for class 'lmertree' fixef(object, which = "tree", drop = FALSE, ...) ## S3 method for class 'glmertree' coef(object, which = "tree", drop = FALSE, ...) ## S3 method for class 'glmertree' fixef(object, which = "tree", drop = FALSE, ...)

Arguments

  • object: an object of class lmertree or glmertree.
  • which: character; "tree" (default) or "global". Specifies whether local (tree) or global fixed-effects estimates should be returned.
  • drop: logical. Only used when which = "tree"; delete the dimensions of the resulting array if it has only one level?
  • ...: Additional arguments, curretnly not used.

Details

The code is still under development and might change in future versions.

Returns

If type = "local", returns a matrix of estimated local fixed-effects coefficients, with a row for every terminal node and a column for every fixed effect. If type = "global", returns a numeric vector of estimated global fixed-effects coefficients.

References

Fokkema M, Smits N, Zeileis A, Hothorn T, Kelderman H (2018). Detecting Treatment-Subgroup Interactions in Clustered Data withGeneralized Linear Mixed-Effects Model Trees . Behavior Research Methods, 50 (5), 2016--2034. tools:::Rd_expr_doi("10.3758/s13428-017-0971-x")

Fokkema M, Zeileis A (2024). Subgroup Detection in Linear Growth Curve Models with GeneralizedLinear Mixed Model (GLMM) Trees.

Behavior Research Methods, 56 (7), 6759--6780. tools:::Rd_expr_doi("10.3758/s13428-024-02389-1")

Examples

## load artificial example data data("DepressionDemo", package = "glmertree") ## fit LMM tree with local fixed effects only lt <- lmertree(depression ~ treatment + age | cluster | anxiety + duration, data = DepressionDemo) coef(lt) ## fit LMM tree including both local and global fixed effect lt <- lmertree(depression ~ treatment | (age + (1|cluster)) | anxiety + duration, data = DepressionDemo) coef(lt, which = "tree") # default behaviour coef(lt, which = "global") ## fit GLMM tree with local fixed effects only gt <- glmertree(depression_bin ~ treatment | cluster | age + anxiety + duration, data = DepressionDemo) coef(gt) ## fit GLMM tree including both local and global fixed effect gt <- glmertree(depression_bin ~ treatment | (age + (1|cluster)) | anxiety + duration, data = DepressionDemo) coef(gt, which = "tree") # default behaviour coef(gt, which = "global")

See Also

lmertree, glmertree, party-plot.

  • Maintainer: Marjolein Fokkema
  • License: GPL-2 | GPL-3
  • Last published: 2024-11-05

Useful links