Skip to contents

This utility plots fixed-effect term contributions for a fitted gamlss.longitudinal object using coefficient uncertainty from vcov.gamlss.longitudinal().

Usage

plot_fixed_terms(
  object,
  vcov_obj = NULL,
  ci_level = 0.95,
  ncol = NULL,
  include_intercept = FALSE,
  plot_interactions = FALSE,
  ci_col = "red",
  fit_col = "black",
  ci_lty = 2,
  fit_lwd = 2,
  sort_x = TRUE,
  fallback_to_index = TRUE,
  setup_mfrow = TRUE,
  data = NULL,
  factor_pch = 16,
  factor_cex = 1.2,
  show_legend = TRUE
)

Arguments

object

A fitted gamlss.longitudinal object.

vcov_obj

Optional output from vcov(object, ...). If NULL, this is computed internally with the analytical vcov path.

ci_level

Confidence level for pointwise intervals.

ncol

Number of plot columns (defaults to 2 or fewer if needed).

include_intercept

Logical; include intercept columns in plots.

plot_interactions

Logical; include interaction columns in plots.

ci_col

Color for confidence bands.

fit_col

Color for fitted fixed-term line.

ci_lty

Line type for confidence bands.

fit_lwd

Line width for fitted fixed-term line.

sort_x

Logical; sort x-values before drawing lines.

fallback_to_index

Logical; if x has one unique value, use index on x-axis.

setup_mfrow

Logical; if TRUE (default), configure par(mfrow) inside this function. Set FALSE when caller configures layout.

data

Optional data frame used to detect factor columns and show factor levels on x-axis for categorical fixed terms. Factor terms are grouped into one point-and-interval plot per model term and parameter.

factor_pch

Point symbol for factor-level estimates.

factor_cex

Point size for factor-level estimates.

show_legend

Logical; if TRUE, draw a small legend in each panel.

Value

Invisibly returns a nested list with x, fitted values, standard errors, and confidence limits for each fixed term.

Details

For each fixed-effect design-matrix column \(x_j\), it plots \(x_j \hat{\beta}_j\) with pointwise confidence bands \(x_j \hat{\beta}_j \pm z_{\alpha/2}\sqrt{x_j^2 \mathrm{Var}(\hat{\beta}_j)}\).