Wpca.plot: Plot the test information or scale curve in either two or...

View source: R/Wpca.plot.R

Wpca.plotR Documentation

Plot the test information or scale curve in either two or three dimensions.

Description

A test or scale analysis produces a space curve that varies with in the space of possible option curves of dimension Wdim. Fortunately, it is usual that most of the shape variation in the curve is within only two or three dimensions, and these can be fixed by using functional principal components analysis.

Usage

  Wpca.plot(arclength, WfdList, Wdim, nharm=2, rotate=TRUE, dodge = 1.003, 
  titlestr = NULL)

Arguments

arclength

The total length of the test information or scale curve as computed by function theta2arclen.

WfdList

A numbered list object produced by a TestGardener analysis of a test. Its length is equal to the number of items in the test or questions in the scale. Each member of WfdList is a named list containing information computed during the analysis. These named lists contain these objects:

Wfd:

A functional data object containing the M surprisal curves for a question.

M:

The number of options.

Pbin:

A matrix containing proportions at each bin.

Wbin:

A matrix containing surprisal values at each bin.

Pmatfine:

A matrix of probabilities over a fine mesh.

Wmatfine:

A matrix of surprisal values over a fine mesh.

DWmatfine:

A matrix of the values of the first derivative of surprisal curves over fine mesh.

D2Wmatfine:

A matrix of the values of the second derivative of surprisal curves over fine mesh.

Wdim

The total number of options in the test or scale.

nharm

The number of principal components of the test information or scale curve to be used to display the curve. Must be either 2 or 3.

rotate

If true, rotate principal components of the test information or scale curve to be used to display the curve to VARIMAX orientation.

dodge

A constant greater than 1 required by ggplot2. Defaults to 1.003.

titlestr

A string for the title of the plot. Defaults to NULL.

Value

A named list with these members:

pcaplot

If two dimensions or harmonics are specified, this is a gg or ggplot object that can be displayed using the print command. If three dimensions are specified, this is NULL.

harmvarmxfd

Functional data objects for the principal components of the curve shape.

varpropvarmx

Proportions of variance accounted for by the principal components

The principal components are VARIMAX rotated by default. The plot is displayed as a side value even if no output object is specified in the call to the function.

Author(s)

Juan Li and James Ramsay

References

Ramsay, J. O., Li J. and Wiberg, M. (2020) Full information optimal scoring. Journal of Educational and Behavioral Statistics, 45, 297-315.

Ramsay, J. O., Li J. and Wiberg, M. (2020) Better rating scale scores with information-based psychometrics. Psych, 2, 347-360.

http://testgardener.azurewebsites.net

Examples

#  Example 1.  Display the test information curve for the 
#  short SweSAT multiple choice test with 24 items and 1000 examinees
#  plot a two-dimension version of manifold curve
WfdList    <- Quantshort_parList$WfdList
theta      <- Quantshort_parList$theta
arclength  <- Quantshort_parList$arclength 
Wpca.plotResults <- Wpca.plot(arclength, WfdList, Quantshort_dataList$Wdim)
varprop <- Wpca.plotResults$varpropvarmx
print("Proportions of variance accounted for and their sum:")
print(round(c(varprop,sum(varprop)),3))
#  plot a three-dimension version of manifold curve
WfdList    <- Quantshort_parList$WfdList
theta      <- Quantshort_parList$theta
arclength  <- Quantshort_parList$arclength 
Wpca.plotResults <- Wpca.plot(arclength, WfdList, Quantshort_dataList$Wdim, nharm=3)
varprop <- Wpca.plotResults$varpropvarmx
print("Proportions of variance accounted for and their sum:")
print(round(c(varprop,sum(varprop)),3))
#  Example 2.  Display the test information curve for the 
# Symptom Distress Scale with 13 items and 473 respondents.
# Proceed as above changing "Quant" to "SDS"

TestGardener documentation built on June 27, 2022, 1:05 a.m.