S3 plot method for objects of class "glow_B_estimate" returned by get_B when return_full = TRUE. Provides visual diagnostics for model fit quality, residuals, and method comparison.

# S3 method for class 'glow_B_estimate'
plot(x, type = "all", which_method = "primary", ...)

Arguments

x

Object of class "glow_B_estimate" from get_B

type

Character string specifying plot type:

  • "all" (default): 2x2 dashboard with multiple diagnostic plots

  • "fit": Model fit plot showing data vs fitted curve

  • "residuals": Residual diagnostic plots (Q-Q, residuals vs fitted)

  • "comparison": Compare beta and pvalue methods (if both available)

  • "models": Compare all 8 candidate model fits

which_method

Character string, which method to plot: "beta", "pvalue", or "primary" (default, uses the primary B estimate)

...

Additional arguments passed to plotting functions

Value

NULL (invisibly). Plots are displayed as a side effect.

Details

The function provides several visualization options:

Dashboard View (type = "all"):

  • Top-left: Fitted model vs training data

  • Top-right: Residual Q-Q plot

  • Bottom-left: MAF vs predicted B

  • Bottom-right: Method comparison (if both methods used) or Cook's distance

Model Fit (type = "fit"): Shows training data points (MAF vs B^2 or h^2) with fitted curve overlaid.

Residuals (type = "residuals"): Standard diagnostic plots including Q-Q plot and residuals vs fitted values.

Comparison (type = "comparison"): Scatterplot comparing beta method vs pvalue method estimates with correlation and agreement statistics.

Computational Complexity: O(n log n) where n is the number of training observations, due to sorting operations in plotting. For type = "models", complexity is O(8n) as it fits all 8 candidate models.

See also

get_B for B estimation plot.glow_B_model for model-level diagnostics get_B_diagnostics for detailed diagnostic reports compare_B_models for comparing candidate models

Examples

if (FALSE) { # \dontrun{
# Load ALS data and run get_B with both methods
data(ALS_snvs_B_training)

result <- get_B(
  training_trait = "binary",
  training_MAF = ALS_snvs_B_training$MAF,
  training_BETA = ALS_snvs_B_training$BETA,
  training_P = ALS_snvs_B_training$P,
  training_N = ALS_snvs_B_training$N,
  target_trait = "binary",
  target_MAF = seq(0.01, 0.4, by = 0.05),
  target_case_prop = 0.001,
  method = "both",
  return_full = TRUE
)

# Dashboard view
plot(result)

# Individual plots
plot(result, type = "fit")
plot(result, type = "residuals")
plot(result, type = "comparison")
} # }