PlotFittedPoly {NormData}R Documentation

Explore data

Description

The function PlotFittedPoly fits polynomials of a specified order to the data.

Usage

PlotFittedPoly(Dataset, Test.Score, IV, Center.Value.IV=0,
Order.Polynomial=3, Confidence.Band.Poly=FALSE, Alpha=.01,
EMF = TRUE, Confidence.Band.EMF=TRUE,
xlab, ylab, Color = "red", Black.white=FALSE,
Legend.Location="topright", Legend.text.size=1,
Add.Jitter=0, Seed=123, cex.axis=1, cex.main=1, 
cex.lab=1, Loess.Span=0.75, ...)

Arguments

Dataset

The name of the dataset.

Test.Score

The name of the test score.

IV

The name of the independent variable.

Center.Value.IV

The constant that is subtracted from the independent variable.
Default Center.Value.IV=0.

Order.Polynomial

The order of the polynomials to be fitted. By default, Order.Polynomial=3 and thus a cubic polynomial is fitted. If no polynomial has to be plotted, the argument Order.Polynomial="None" can be used.

Confidence.Band.Poly

Logical. Should a confidence band around the prediction function of the polynomial model be added to the plot? Default Confidence.Band.Poly=FALSE.

Alpha

The Alpha-level of the confidence band(s) for the polynomial and/or loess models. Default Alpha=0.01 and thus a 99\% confidence band is fitted.

EMF

Logical. Should the EMF be added to the plot? Default EMF=TRUE.

Confidence.Band.EMF

Logical. Should a confidence band around the prediction function of the loess model be added to the plot? Default Confidence.Band.EMF=TRUE.

xlab

The label that should be added to the X-axis. Default xlab="IV"

ylab

The label that should be added to the Y-axis. Default ylab="Test score".

Color

The color to be used for the fitted EMF. Default Color = "red".

Black.white

Logical. Should the plot be in black and white (rather than in color)? Default Black.white=FALSE.

Legend.Location

The location of the legend. Default Legend.Location="topright". If no legend is needed, the argument Legend.Location="None" can be used.

Legend.text.size

The size of the text of the label for IV2. Default Legend.text.size=1.

Add.Jitter

The amount of jitter (random noise) that should be added to the test score. Adding a bit of jitter is useful to show the data more clearly, i.e., to avoid overlapping data points. The specified value Add.Jitter= in the function call determines the amount of jitter (range of values) that is added. For example, when Add.Jitter=0.1, a random value between -0.1 and 0.1 (sampled from a uniform) is added to the test scores. Default Add.Jitter=0, i.e., no jitter added to the predicted values in the homoscedasticity plot.

Seed

The seed that is used when adding jitter. Default Seed=123.

cex.axis

The magnification to be used for axis annotation.

cex.main

The magnification to be used for the main label.

cex.lab

The magnification to be used for X and Y labels.

Loess.Span

The parameter \alpha that determines the degree of smoothing of the Empirical Variance Function. Default Loess.Span=0.75.

...

Extra graphical parameters to be passed to plot().

Details

For details, see Van der Elst (2023).

Value

No return value, called for side effects.

Author(s)

Wim Van der Elst

References

Van der Elst, W. (2024). Regression-based normative data for psychological assessment: A hands-on approach using R. Springer Nature.

Examples

data(Substitution)

# plot of linear, quadratic and cubic polynomials relating age
# to the LDST test score 
PlotFittedPoly(Dataset = Substitution, Test.Score = LDST, IV = Age, 
Order.Polynomial = 1, Center.Value.IV = 50)

PlotFittedPoly(Dataset = Substitution, Test.Score = LDST, IV = Age, 
Order.Polynomial = 2, Center.Value.IV = 50)

PlotFittedPoly(Dataset = Substitution, Test.Score = LDST, IV = Age, 
Order.Polynomial = 3, Center.Value.IV = 50)

[Package NormData version 1.1 Index]