Learn R Programming

cNORM (version 3.6.1)

plot.cnormBetaBinomial: Plot cnormBetaBinomial Model with Data and Percentile Lines

Description

This function creates a visualization of a fitted cnormBetaBinomial model, including the original data points, the manifest percentiles (diamond-shaped dots per age group) and the model-implied percentile lines.

Usage

# S3 method for cnormBetaBinomial
plot(x, ...)

Value

A ggplot object.

Arguments

x

A fitted model object of class "cnormBetaBinomial" or "cnormBetaBinomial2".

...

Additional arguments passed to the plot method.

  • age A vector of the age data.

  • score A vector of the score data.

  • weights An optional numeric vector of weights for each observation.

  • percentiles An optional vector with the percentiles to plot.

  • points Logical indicating whether to plot the data points. Default is TRUE.

  • discrete Logical indicating whether to plot the exact discrete beta-binomial quantiles (TRUE, default) or a smooth continuous approximation via the underlying beta distribution (FALSE).

Details

By default (discrete = TRUE), the percentile lines represent the exact quantiles of the fitted discrete beta-binomial distribution and are therefore step functions. Setting discrete = FALSE draws smooth lines based on the quantiles of the underlying beta (mixing) distribution. Note that this continuous approximation omits the binomial stage of the variance and therefore displays less spread than the fitted model actually implies, particularly in the outer percentiles. Use it only for visual comparability with continuous modelling approaches.

Cases with non-finite values (NA, NaN, Inf) in age, score or weights are removed prior to plotting, mirroring the behavior of the fitting functions.

See Also

Other plot: compare(), plot.cnorm(), plot.cnormBetaBinomial2(), plotDensity(), plotDerivative(), plotNorm(), plotNormCurves(), plotPercentileSeries(), plotPercentiles(), plotRaw(), plotSubset()