item.stats: Item Analysis for Dichotomous, Polytomous, and Continuous...

View source: R/item.stats.R

item.statsR Documentation

Item Analysis for Dichotomous, Polytomous, and Continuous Items

Description

This function conducts item analysis for dichotomous, polytomous, and continuous items by computing corrected item-total correlations with confidence intervals and coefficient alphas if the item is deleted. The default setting for computing the item-total correlations is depending on the type of the data, i.e., point-biserial correlation for dichotomous data, polyserial correlation for polytomous data, and product-moment correlation for continuous data.

Usage

item.stats(data, ..., exclude = NULL, correct = TRUE,
           method = c("pearson", "pbiser", "biser", "polyser"),
           adjust = c("none", "joint", "approx"),
           missing = c("listwise", "pairwise", "fiml"),
           alternative = c("two.sided", "less", "greater"),
           conf.level = 0.95, na.omit = FALSE, digits = 2, r.digits = 3,
           as.na = NULL, write = NULL, append = TRUE,
           check = TRUE, output = TRUE)

Arguments

data

a data frame. Note that dichotomous items must be coded with 0 and 1, while polytomous should be coded either as ordered factors or as integer values. However, the function assumes continuous data whenever items have more than two distinct values. Polytomous items can be specified either by providing a data frame with ordered factors or by specifying a data frame with numeric vectors with integer values, along with setting the argument method to polyser.

...

an expression indicating the variable names in data e.g., item.stat(dat, x1, x2, x3). Note that the operators +, -, ~, :, ::, and ! can also be used to select variables, see 'Details' in the df.subset function.

exclude

a character vector indicating items to be excluded from the analysis.

correct

logical: if TRUE (default), the corrected item-total correlation is computed.

method

a character string indicating which correlation coefficient is used for the item-total correlation, i.e., "pearson" for the Pearson product-moment correlation coefficient when data are continuous, "pbiser" for the point-biserial correlation coefficient when data are dichotomous, "biser" for the biserial correlation coefficient when data are dichotomous, and "polyser" for the polyserial correlation coefficient when data are polytomous. By default, the corrected item-total point-biserial correlation ("pbiser") is computed for dichotomous items, corrected item-total polyserial correlation ("polyser") is computed for polytomous items, and the corrected item-total product-moment correlation ("pearson") is computed for continuous items.

adjust

a character string specifying the non-normality adjustment method (see 'Details' in the ci.cor function), i.e., "none" for the Fisher z' confidence interval for the Pearson product-moment correlation coefficient without non-normality adjustment, "joint" for the confidence interval with non-normality adjustment via sample joint moments, and "approx" (default) for the confidence interval with non-normality adjustment via approximate distribution by skewness and kurtosis. Note that this argument only applies to the Pearson product-moment correlation coefficient, i.e., method = "pearson".

missing

a character string indicating how to deal with missing data when computing coefficient alphas if the item is deleted, i.e., "listwise" for listwise deletion, "pairwise" (default) for pairwise deletion, "fiml" for full information maximum likelihood method. Note that the argument na.omit switches to TRUE when specifying missing = "listwise".

alternative

a character string specifying the alternative hypothesis for the confidence intervals for the item-total correlation, i.e., "two.sided" (default), "greater" or "less".

conf.level

a numeric value between 0 and 1 indicating the confidence level of the interval for the item-total correlation.

na.omit

logical: if TRUE, incomplete cases are removed before conducting the analysis (i.e., listwise deletion). By default pairwise deletion is used for computing point biserial and product-moment correlation, while listwise deletion is used for computing biserial and polyserial correlation. Note that the argument missing switches to "listwise" when specifying na.omit = TRUE.

digits

an integer value indicating the number of decimal places to be used to display display item difficulty, mean, median, and standard deviation.

r.digits

an integer value indicating the number of decimal places to be used to display item-total correlation, and coefficient alpha if the item is deleted.

as.na

a numeric vector indicating user-defined missing values, i.e. these values are converted to NA before conducting the analysis.

write

a character string naming a file for writing the output into either a text file with file extension ".txt" (e.g., "Output.txt") or Excel file with file extension ".xlsx" (e.g., "Output.xlsx"). If the file name does not contain any file extension, an Excel file will be written.

append

logical: if TRUE (default), output will be appended to an existing text file with extension .txt specified in write, if FALSE existing text file will be overwritten.

check

logical: if TRUE (default), argument specification is checked.

output

logical: if TRUE (default), output is shown.

Details

Confidence Interval for the Item-Total Correlation

The confidence interval for the point-biserial correlation is based on Bonett (2020), while the confidence interval for the biserial and polyserial correlation is based on the maximum likelihood standard error provided by the function polyserial from the polycor package (Fox, 2025). The confidence interval for the Pearson product-moment correlation uses the ci.cor function from the misty package that computes a confidence interval with non-normality adjustment via approximate distribution by skewness and kurtosis by default.

Value

Returns an object of class misty.object, which is a list with following entries:

call

function call

type

type of analysis

data

data frame including all variables used in the analysis

dtype

type of the data, i.e., "dich" for dichotomous, "poly" for polytomous, and "cont" for continuous data

args

specification of function arguments

result

result table

Note

This function uses a modified copy of the polyserial() function in the polycor package by John Fox (2025) when requesting item-total biserial correlation.

Author(s)

Takuya Yanagida

References

Bonett D. G. (2020). Point-biserial correlation: Interval estimation, hypothesis testing, meta-analysis, and sample size determination. The British Journal of Mathematical and Statistical Psychology, 73 Suppl 1, 113–144. https://doi.org/10.1111/bmsp.12189

Fox, J. (2025). polycor: Polychoric and polyserial correlations. R package version 0.8-2. https://doi.org/10.32614/CRAN.package.polycor

See Also

item.distract, item.alpha, item.omega, item.cfa, item.reverse, item.scores

Examples

## Not run: 

#————————————————————————————————————————————————————————————————————————————
# Dichotomous Data

# Example 1a: Corrected item-total point-biserial correlation
item.stats(data.items, +ditem)

# Example 1b: Corrected item-total biserial correlation
item.stats(data.items, +ditem, method = "biser")

# Example 1c: Uncorrected item-total point-biserial correlation
item.stats(data.items, +ditem, correct = FALSE)

# Example 1d: Display item-total correlation and coefficient alpha with 2 digits
item.stats(data.items, +ditem, r.digits = 2)

#————————————————————————————————————————————————————————————————————————————
# Polytomous Data

# Reverse code inverted item
data.items <- item.reverse(data.items, pitem2, pitem3, min = 0, max = 3)

# Example 2a: Corrected item-total polyserial correlation
item.stats(data.items, pitem1, pitem2.r, pitem3.r, pitem4::pitem6, method = "polyser")

# Example 2b: One-sided confidence intervals
item.stats(data.items, +pitem, method = "polyser", alternative = "greater")

#————————————————————————————————————————————————————————————————————————————
# Continuous Data

# Load data set "HolzingerSwineford1939" in the lavaan package
data("HolzingerSwineford1939", package = "lavaan")

# Example 3a: Corrected item-total product-moment correlation
item.stats(HolzingerSwineford1939, x1::x9)

# Example 3a: Exclude items 'x2' and 'x7'
item.stats(HolzingerSwineford1939, x1::x9, exclude = c("x2", "x7"))

#————————————————————————————————————————————————————————————————————————————
# Write Results

# Example 4a: Write Results into a text file
item.stats(data.items, +ditem, write = "Item-Stats.txt", output = FALSE)

# Example 4b: Write Results into an Excel file
item.stats(data.items, +ditem, write = "Item-Stats.xlsx", output = FALSE)

## End(Not run)

misty documentation built on Aug. 2, 2026, 9:06 a.m.

Related to item.stats in misty...