This function takes exametrika output as input and generates a Field Reference Profile (FRP) plot using ggplot2. For binary data, it displays correct response rates. For polytomous data, it shows expected scores calculated using the specified statistic.
Usage
plotFRP_gg(
data,
stat = "mean",
fields = NULL,
title = TRUE,
colors = NULL,
linetype = "solid",
show_legend = TRUE,
legend_position = "right"
)Arguments
- data
An object from exametrika: Biclustering, nominalBiclustering, ordinalBiclustering, ratedBiclustering, IRM, LDB, or BINET output.
- stat
Character. Statistic to use for polytomous data:
"mean"(default),"median", or"mode". Ignored for binary data.- fields
Integer vector specifying which fields to plot. Default is all fields.
- title
Logical or character. If
TRUE(default), display automatic title. IfFALSE, no title. If a character string, use it as the title.- colors
Character vector. Colors for each field line. If
NULL(default), uses the package default palette.- linetype
Character or numeric. Line type for all lines. Default is
"solid".- show_legend
Logical. If
TRUE(default), display the legend.- legend_position
Character. Position of the legend:
"right"(default),"top","bottom","left","none".
Details
The Field Reference Profile shows how response patterns vary across latent classes/ranks for each field (cluster of items).
For binary data (Biclustering, IRM, LDB, BINET):
Y-axis: Correct Response Rate (0-1)
Each line represents one field
For polytomous data (nominalBiclustering, ordinalBiclustering, ratedBiclustering):
Y-axis: Expected Score (calculated using
statparameter)stat = "mean": Weighted average across categories (default)stat = "median": Median category valuestat = "mode": Most probable category
Examples
library(exametrika)
# Binary biclustering
result_bin <- Biclustering(J35S515, ncls = 4, nfld = 3)
plot <- plotFRP_gg(result_bin)
# \donttest{
# Ordinal biclustering with mean (default)
result_ord <- Biclustering(J35S500, ncls = 4, nfld = 3)
plot_mean <- plotFRP_gg(result_ord, stat = "mean")
# Using mode for polytomous data
plot_mode <- plotFRP_gg(result_ord,
stat = "mode",
title = "Field Reference Profile (Mode)",
colors = c("red", "blue", "green")
)
# }