plotNorm: Plot manifest and fitted norm scores

View source: R/plot.R

plotNormR Documentation

Plot manifest and fitted norm scores

Description

This function plots the manifest norm score against the fitted norm score from the inverse regression model per group. This helps to inspect the precision of the modeling process. The scores should not deviate too far from the regression line. Applicable for Taylor polynomial models.

Usage

plotNorm(
  model,
  age = NULL,
  score = NULL,
  width = NULL,
  weights = NULL,
  group = FALSE,
  minNorm = NULL,
  maxNorm = NULL,
  type = 0
)

Arguments

model

The regression model, usually from the 'cnorm' or 'cnorm.betabinomial' function

age

In case of beta binomial model, please provide the age vector

score

In case of beta binomial model, please provide the score vector

width

In case of beta binomial model, please provide the width for the sliding window. If null, the function tries to determine a sensible setting.

weights

Vector or variable name in the dataset with weights for each individual case. If NULL, no weights are used.

group

On optional grouping variable, use empty string for no group, the variable name for Taylor polynomial models or a vector with the groups for beta binomial models

minNorm

lower bound of fitted norm scores

maxNorm

upper bound of fitted norm scores

type

Type of display: 0 = plot manifest against fitted values, 1 = plot manifest against difference values

Value

A ggplot object representing the norm scores plot.

See Also

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

Examples

## Not run: 
# Load example data set, compute model and plot results

# Taylor polynomial model
model <- cnorm(raw = elfe$raw, group = elfe$group)
plot(model, "norm")

# Beta binomial models; maximum number of items in elfe is n = 28
model.bb <- cnorm.betabinomial(elfe$group, elfe$raw, n = 28)
plotNorm(model.bb, age = elfe$group, score = elfe$raw)

## End(Not run)


cNORM documentation built on Nov. 4, 2024, 5:07 p.m.