Skip to contents

Plot parameter-recovery simulation results

Usage

# S3 method for class 'mfrm_recovery_simulation'
plot(
  x,
  y = NULL,
  type = c("summary", "coverage", "errors", "scatter", "replications"),
  metric = c("rmse", "bias", "mae", "correlation", "coverage", "mcse_bias", "mcse_rmse",
    "raw_rmse", "raw_bias", "mean_se", "se_available"),
  parameter_type = NULL,
  facet = NULL,
  comparison = c("aligned", "unaligned"),
  draw = TRUE,
  ...
)

Arguments

x

Output from evaluate_mfrm_recovery().

y

Reserved for S3 generic compatibility.

type

Plot route: "summary" draws a metric from x$recovery_summary, "coverage" draws 95% coverage by parameter group, "errors" draws row-level recovery-error distributions, "scatter" draws truth against estimated values, and "replications" summarizes run status.

metric

Summary metric used when type = "summary". Supported values are "rmse", "bias", "mae", "correlation", "coverage", "mcse_bias", "mcse_rmse", "raw_rmse", "raw_bias", "mean_se", and "se_available".

parameter_type

Optional parameter type filter, such as "person", "facet", "step", "slope", or "population".

facet

Optional facet filter.

comparison

Error/estimate scale for row-level routes. "aligned" uses EstimateAligned / ErrorAligned; "unaligned" uses Estimate / ErrorRaw on the same comparison scale.

draw

If TRUE, draw with base graphics. If FALSE, return an mfrm_plot_data object with reusable plot tables and metadata.

...

Reserved for generic compatibility.

Value

An mfrm_plot_data object. When draw = TRUE, the object is returned invisibly after drawing.

Details

These plots are intended as simulation-review graphics. They do not replace the row-level x$recovery table or the ADEMP metadata; they make the main recovery estimands easier to inspect during model-development and design checks. Coverage is displayed only for parameter groups with available standard errors.

Examples

# \donttest{
rec <- evaluate_mfrm_recovery(
  n_person = 12,
  n_rater = 2,
  n_criterion = 2,
  reps = 1,
  maxit = 30,
  seed = 123
)
plot(rec, type = "summary", metric = "rmse", draw = FALSE)
#> <mfrm_plot_data>
#>   name     : recovery_simulation
#>   title    : Parameter recovery: RMSE
#>   subtitle : Summary by parameter type, facet, and comparison scale
#>   data     :
#>     $type : character [1]
#>     $metric : character [1]
#>     $metric_label : character [1]
#>     $comparison : character [1]
#>     $parameter_type : NULL
#>     $facet : NULL
#>     $plot_table : data.frame [4 x 22]
#>     $notes : character [2]
#>     $plot_name : character [1]
#>   legend   : 4 entries
#>   ref lines: 0
#> Re-render via ggplot2 / plotly using `x$data`; or pass the
#> originating `draw = FALSE` plot helper its inverse to draw it.
# }