plot.gkwfit: Plot Diagnostics for a gkwfit Object

plot.gkwfitR Documentation

Plot Diagnostics for a gkwfit Object

Description

Creates a panel of diagnostic plots for assessing the fit of a model estimated by gkwfit. It displays a histogram of the data overlaid with the fitted density, a Probability-Probability (P-P) plot, a Quantile-Quantile (Q-Q) plot, and profile likelihood plots for each parameter if they were computed during the fit (i.e., if profile = TRUE was used in gkwfit).

Usage

## S3 method for class 'gkwfit'
plot(x, ...)

Arguments

x

An object of class "gkwfit", typically the result of a call to gkwfit.

...

Additional arguments (currently ignored).

Details

This function utilizes ggplot2 for creating the plots and patchwork for arranging them into a single figure. All plots use ggplot2::theme_minimal().

If the plots were already generated during the original gkwfit call (because plot = TRUE), they are retrieved from the fitted object. Otherwise, this function will attempt to generate the plots on the fly, which requires the ggplot2 package and the necessary distribution functions (like dgkw, pgkw, qgkw, etc.) for the specific family to be available.

The arrangement of plots is handled automatically by patchwork::wrap_plots. No user interaction (like menu selection) is required.

Value

Invisibly returns the original input object x. This function is called for its side effect of producing a plot.

Author(s)

Lopes, J. E.

See Also

gkwfit, summary.gkwfit

Examples


# Load required package
library(ggplot2)

# Generate data and fit model
set.seed(2203)
y <- rbeta_(50, gamma = 2, delta = 3)
fit <- gkwfit(data = y, family = "beta", plot = FALSE)

# Generate standard diagnostic plots
plot(fit)

# Generate data and fit model with profile = TRUE
fit <- gkwfit(data = y, family = "gkw", profile = TRUE, npoints = 15)

# Standard diagnostic plots
plot(fit)



gkwreg documentation built on April 16, 2025, 1:10 a.m.