plotDensity function

Plot the density function per group by raw score

Plot the density function per group by raw score

This function plots density curves based on the regression model against the raw scores. It supports both traditional continuous norming models and beta-binomial models. The function allows for customization of the plot range and groups to be displayed.

plotDensity( model, minRaw = NULL, maxRaw = NULL, minNorm = NULL, maxNorm = NULL, group = NULL )

Arguments

  • model: The model from the bestModel function, a cnorm object, or a cnormBetaBinomial or cnormBetaBinomial2 object.
  • minRaw: Lower bound of the raw score. If NULL, it's automatically determined based on the model type.
  • maxRaw: Upper bound of the raw score. If NULL, it's automatically determined based on the model type.
  • minNorm: Lower bound of the norm score. If NULL, it's automatically determined based on the model type.
  • maxNorm: Upper bound of the norm score. If NULL, it's automatically determined based on the model type.
  • group: Numeric vector specifying the age groups to plot. If NULL, groups are automatically selected.

Returns

A ggplot object representing the density functions.

Details

The function generates density curves for specified age groups, allowing for easy comparison of score distributions across different ages.

For beta-binomial models, the density is based on the probability mass function, while for traditional models, it uses a normal distribution based on the norm scores.

Note

Please check for inconsistent curves, especially those showing implausible shapes such as violations of biuniqueness in the cnorm models.

Examples

## Not run: # For traditional continuous norming model result <- cnorm(raw = elfe$raw, group = elfe$group) plotDensity(result, group = c(2, 4, 6)) # For beta-binomial model bb_model <- cnorm.betabinomial(age = ppvt$age, score = ppvt$raw, n = 228) plotDensity(bb_model) ## End(Not run)

See Also

plotNormCurves, plotPercentiles

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