Skip to contents

Build legacy-compatible fixed-width text reports

Usage

build_fixed_reports(
  bias_results,
  target_facet = NULL,
  branch = c("facets", "original")
)

Arguments

bias_results

Output from estimate_bias().

target_facet

Optional target facet for pairwise contrast table.

branch

Output branch: "facets" keeps the legacy-compatible fixed-width layout; "original" returns compact sectioned fixed-width text for internal reporting.

Value

A named list with:

  • bias_fixed: fixed-width interaction table text

  • pairwise_fixed: fixed-width pairwise contrast text

  • pairwise_table: underlying pairwise data.frame

Details

This function generates plain-text, fixed-width output intended to be read in console/log environments or exported into text reports.

The pairwise section (Table 14 style) is only generated for 2-way bias runs. For higher-order interactions (interaction_facets length >= 3), the function returns the bias table text and a note explaining why pairwise contrasts were skipped.

Interpreting output

  • bias_fixed: fixed-width table of interaction effects.

  • pairwise_fixed: pairwise contrast text (2-way only).

  • pairwise_table: machine-readable contrast table.

  • interaction_label: facets used for the bias run.

Typical workflow

  1. Run estimate_bias().

  2. Build text bundle with build_fixed_reports(...).

  3. Use summary()/plot() for quick checks, then export text blocks.

Preferred route for new analyses

For new reporting workflows, prefer bias_interaction_report() and build_apa_outputs(). Use build_fixed_reports() when a fixed-width text artifact is specifically required for a compatibility handoff.

Examples

toy <- load_mfrmr_data("example_bias")
fit <- fit_mfrm(toy, "Person", c("Rater", "Criterion"), "Score", method = "JML", maxit = 25)
diag <- diagnose_mfrm(fit, residual_pca = "none")
bias <- estimate_bias(fit, diag, facet_a = "Rater", facet_b = "Criterion", max_iter = 2)
fixed <- build_fixed_reports(bias)
fixed_original <- build_fixed_reports(bias, branch = "original")
summary(fixed)
#> mfrmr Fixed-Report Bundle
#> 
#> Overview
#>  Branch         Style       Interaction PairwiseRows BiasTextLines
#>  facets facets_manual Rater x Criterion           24            26
#>  PairwiseTextLines
#>                 27
#> 
#> Pairwise preview
#>  Target Target N Target Measure Target S.E. Context1 Context1 N Local Measure1
#>     R01        1         -0.866       0.152 Accuracy          1         -0.090
#>     R01        1         -0.866       0.152 Accuracy          1         -0.090
#>     R01        1         -0.866       0.152 Accuracy          1         -0.090
#>     R01        1         -0.866       0.152  Content          2         -1.144
#>     R01        1         -0.866       0.152  Content          2         -1.144
#>     R01        1         -0.866       0.152 Language          3         -1.050
#>     R02        2          0.004       0.147 Accuracy          1          0.250
#>     R02        2          0.004       0.147 Accuracy          1          0.250
#>     R02        2          0.004       0.147 Accuracy          1          0.250
#>     R02        2          0.004       0.147  Content          2         -0.026
#>  SE1 Obs-Exp Avg1 Count1 ObsN1     Context2 Context2 N Local Measure2 SE2
#>   NA           NA     24    24      Content          2         -1.144  NA
#>   NA           NA     24    24     Language          3         -1.050  NA
#>   NA           NA     24    24 Organization          4         -1.229  NA
#>   NA           NA     24    24     Language          3         -1.050  NA
#>   NA           NA     24    24 Organization          4         -1.229  NA
#>   NA           NA     24    24 Organization          4         -1.229  NA
#>   NA           NA     24    24      Content          2         -0.026  NA
#>   NA           NA     24    24     Language          3         -0.205  NA
#>   NA           NA     24    24 Organization          4         -0.019  NA
#>   NA           NA     24    24     Language          3         -0.205  NA
#>  Obs-Exp Avg2 Count2 ObsN2 Contrast SE  t d.f. Prob. InferenceTier
#>            NA     24    24    1.054 NA NA   NA    NA     screening
#>            NA     24    24    0.960 NA NA   NA    NA     screening
#>            NA     24    24    1.139 NA NA   NA    NA     screening
#>            NA     24    24   -0.094 NA NA   NA    NA     screening
#>            NA     24    24    0.085 NA NA   NA    NA     screening
#>            NA     24    24    0.179 NA NA   NA    NA     screening
#>            NA     24    24    0.276 NA NA   NA    NA     screening
#>            NA     24    24    0.454 NA NA   NA    NA     screening
#>            NA     24    24    0.269 NA NA   NA    NA     screening
#>            NA     24    24    0.178 NA NA   NA    NA     screening
#>  SupportsFormalInference FormalInferenceEligible PrimaryReportingEligible
#>                    FALSE                   FALSE                    FALSE
#>                    FALSE                   FALSE                    FALSE
#>                    FALSE                   FALSE                    FALSE
#>                    FALSE                   FALSE                    FALSE
#>                    FALSE                   FALSE                    FALSE
#>                    FALSE                   FALSE                    FALSE
#>                    FALSE                   FALSE                    FALSE
#>                    FALSE                   FALSE                    FALSE
#>                    FALSE                   FALSE                    FALSE
#>                    FALSE                   FALSE                    FALSE
#>    ReportingUse
#>  screening_only
#>  screening_only
#>  screening_only
#>  screening_only
#>  screening_only
#>  screening_only
#>  screening_only
#>  screening_only
#>  screening_only
#>  screening_only
#>                                                                                      ContrastBasis
#>  difference between local target measures across contexts (target term cancels to a bias contrast)
#>  difference between local target measures across contexts (target term cancels to a bias contrast)
#>  difference between local target measures across contexts (target term cancels to a bias contrast)
#>  difference between local target measures across contexts (target term cancels to a bias contrast)
#>  difference between local target measures across contexts (target term cancels to a bias contrast)
#>  difference between local target measures across contexts (target term cancels to a bias contrast)
#>  difference between local target measures across contexts (target term cancels to a bias contrast)
#>  difference between local target measures across contexts (target term cancels to a bias contrast)
#>  difference between local target measures across contexts (target term cancels to a bias contrast)
#>  difference between local target measures across contexts (target term cancels to a bias contrast)
#>                                         SEBasis                  StatisticLabel
#>  combined context-specific bias standard errors Bias-contrast Welch screening t
#>  combined context-specific bias standard errors Bias-contrast Welch screening t
#>  combined context-specific bias standard errors Bias-contrast Welch screening t
#>  combined context-specific bias standard errors Bias-contrast Welch screening t
#>  combined context-specific bias standard errors Bias-contrast Welch screening t
#>  combined context-specific bias standard errors Bias-contrast Welch screening t
#>  combined context-specific bias standard errors Bias-contrast Welch screening t
#>  combined context-specific bias standard errors Bias-contrast Welch screening t
#>  combined context-specific bias standard errors Bias-contrast Welch screening t
#>  combined context-specific bias standard errors Bias-contrast Welch screening t
#>    ProbabilityMetric                           DFBasis
#>  screening tail area Welch-Satterthwaite approximation
#>  screening tail area Welch-Satterthwaite approximation
#>  screening tail area Welch-Satterthwaite approximation
#>  screening tail area Welch-Satterthwaite approximation
#>  screening tail area Welch-Satterthwaite approximation
#>  screening tail area Welch-Satterthwaite approximation
#>  screening tail area Welch-Satterthwaite approximation
#>  screening tail area Welch-Satterthwaite approximation
#>  screening tail area Welch-Satterthwaite approximation
#>  screening tail area Welch-Satterthwaite approximation
#> 
#> Notes
#>  - Legacy-compatible branch: fixed-width text follows the compatibility layout.
p <- plot(fixed, draw = FALSE)
p2 <- plot(fixed, type = "pvalue", draw = FALSE)
if (interactive()) {
  plot(
    fixed,
    type = "contrast",
    draw = TRUE,
    main = "Pairwise Contrasts (Customized)",
    palette = c(pos = "#1b9e77", neg = "#d95f02"),
    label_angle = 45
  )
}