Learn R Programming

grmtree (version 0.1.0)

plot.grmtree: Plot Method for GRM Tree Objects

Description

Visualizes a GRM (Graded Response Model) tree with different types of terminal node plots. This function extends plot.modelparty from the partykit package with specialized visualizations for GRM trees.

Usage

# S3 method for grmtree
plot(
  x,
  type = c("regions", "profile", "histogram"),
  what = c("item", "threshold", "discrimination"),
  tnex = 2L,
  drop_terminal = TRUE,
  spacing = 0.1,
  ...
)

Value

Invisibly returns the GRM tree object. Primarily called for its side effect of producing a plot.

Arguments

x

A GRM tree object of class 'grmtree'.

type

Type of terminal node plot to display:

"regions"

Threshold regions plot (default)

"profile"

Item parameter profile plot

"histogram"

Histogram of factor scores with normal curve

what

Type of parameters to plot when type = "profile":

"item"

Both discrimination and threshold parameters (default)

"threshold"

Only threshold parameters

"discrimination"

Only discrimination parameters

tnex

Numeric scaling factor for terminal node extension (default: 2).

drop_terminal

Logical indicating whether to drop terminal node IDs (default: TRUE).

spacing

Numeric value controlling spacing between elements (default: 0.1).

...

Additional arguments passed to the terminal panel functions.

Details

The function provides three visualization types:

  • Regions plot: Shows threshold parameters as colored regions, useful for visualizing the difficulty parameters across items and nodes.

  • Profile plot: Displays either item parameters (discrimination and average thresholds), just thresholds, or just discrimination parameters as line plots across items.

  • Histogram: Shows the distribution of factor scores in each node with an overlaid normal curve.

See Also

plot.modelparty for the underlying plotting infrastructure, grmtree for creating GRM tree objects, plot.varimp creates a bar plot of variable importance scores

Examples

Run this code
# \donttest{

library(grmtree)
library(hlt)
data("asti", package = "hlt")
asti$resp <- data.matrix(asti[, 1:4])

# Fit GRM tree with gender and group as partitioning variables
tree <- grmtree(resp ~ gender + group,
          data = asti,
          control = grmtree.control(minbucket = 30))

# Default regions plot
plot(tree)

# Profile plot showing item parameters
plot(tree, type = "profile")

# Profile plot showing only thresholds
plot(tree, type = "profile", what = "threshold")

# Histograms of factor scores
plot(tree, type = "histogram")
# }

Run the code above in your browser using DataLab