glmertree (version 0.2-0)

coef.glmertree: Obtaining Fixed-Effects Coefficient Estimates of (Generalized) Linear Mixed Model Trees

Description

coef and fixef methods for (g)lmertree objects.

Usage

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

Value

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.

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.

References

Fokkema M, Smits N, Zeileis A, Hothorn T, Kelderman H (2018). “Detecting Treatment-Subgroup Interactions in Clustered Data with Generalized Linear Mixed-Effects Model Trees”. Behavior Research Methods, 50(5), 2016-2034. https://doi.org/10.3758/s13428-017-0971-x

See Also

lmertree, glmertree, party-plot.

Examples

Run this code
# \donttest{
## 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")
# }

Run the code above in your browser using DataLab