plot.glmertree

0th

Percentile

Plotting (Generalized) Linear Mixed Model Trees

plot method for (g)lmertree objects.

Keywords
hplot
Usage
# S3 method for lmertree
plot(x, which = "all", ask = TRUE, type = "extended", 
    observed = TRUE, fitted = "combined", tp_args = list(), 
    drop_terminal = TRUE, terminal_panel = NULL, …)
# S3 method for glmertree
plot(x, which = "all", ask = TRUE, type = "extended", 
    observed = TRUE, fitted = "combined", tp_args = list(), 
    drop_terminal = TRUE, terminal_panel = NULL, …)
Arguments
x

an object of class lmertree or glmertree.

which

character; "all" (default), "tree", "random" or "tree.coef". Specifies whether, tree, random effects, or both should be plotted. Alternatively, "tree.coef" yields caterpillar plots of the estimated fixed-effects coefficients in every terminal node of the tree, but omits the tree structure (see Details).

ask

logical. Should user be asked for input, before a new figure is drawn?

type

character; "extended" (default) or "simple". type = "extended" yields a plotted tree with observed data and/or fitted means plotted in the terminal nodes; "simple" yields a plottedtree with the value of fixed and/or random effects coefficients reported in the terminal nodes.

observed

logical. Should observed datapoints be plotted in the tree? Defaults to TRUE, FALSE is only supported for objects of class lmertree, not of classglmertree.

fitted

character. "combined" (default), "marginal" or "none". Specifies whether and how fitted values should be computed and visualized. Only used when predictor variables for the node-specific (G)LMs were specified. If "combined", fitted values will computed, based on the observed values of the remaining (random and fixed-effects) predictor variables, and their estimated effects. If "marginal", fitted values will be calculated, keeping all remaining variables (with random and/or fixed effects) fixed at their (population and sample) means (or majority class).

tp_args

list of arguments to be passed to panel generating function node_glmertree. See arguments node_bivplot in panelfunctions.

drop_terminal

logical. Should all terminal nodes be plotted at the bottom of the plot?

terminal_panel

an optional panel function to be passed to plot.party(). See party-plot documentation for details.

Additional arguments to be passed to plot.party(). See party-plot documentation for details.

Details

The caterpillar plot(s) for the local (node-specific) fixed effects (created when which = "tree.coef") depict the estimated fixed-effects coefficients with 95% confidence intervals, but these CIs do not account for the searching of the tree structure and are therefore likely too narrow. There is currently no way to adjust CIs for searching of the tree structure, but the CIs can be useful to obtain an indication of the variability of the coefficient estimates, not for statistical significance testing.

The caterpillar plot(s) for the random effect (created if which = "ranef" or "all") depict the predicted random effects with 95% confidence intervals. See also ranef.

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.

Aliases
  • plot.lmertree
  • plot.glmertree
Examples
# NOT RUN {
## load artificial example data
data("DepressionDemo", package = "glmertree")

## fit linear regression LMM tree for continuous outcome
lt <- lmertree(depression ~ treatment + age | cluster | anxiety + duration,
  data = DepressionDemo)
plot(lt)
plot(lt, type = "simple")
plot(lt, which = "tree", fitted = "combined")
plot(lt, which = "tree", fitted = "none")
plot(lt, which = "tree", observed = FALSE)
plot(lt, which = "tree.coef")
plot(lt, which = "ranef")

## fit logistic regression GLMM tree for binary outcome
gt <- glmertree(depression_bin ~ treatment + age | cluster | 
  anxiety + duration, data = DepressionDemo)
plot(gt)  
plot(gt, type = "simple")
plot(gt, which = "tree", fitted = "combined")
plot(gt, which = "tree", fitted = "none")
plot(gt, which = "tree.coef")
plot(gt, which = "ranef")
# }
Documentation reproduced from package glmertree, version 0.2-0, License: GPL-2 | GPL-3

Community examples

Looks like there are no examples yet.