Learn R Programming

ShinyItemAnalysis (version 1.3.4)

plotDIFLogistic: Function for characteristic curve of 2PL logistic DIF model

Description

Plots characteristic curve of 2PL logistic DIF model

Usage

plotDIFLogistic(x, item = 1, item.name, group.names = c("Reference", "Focal"),
Data, group, match, draw.empirical = TRUE)

Arguments

x

an object of "Logistic" class. See Details.

item

numeric: number of item to be plotted

item.name

character: the name of item to be used as title of plot.

group.names

character: names of reference and focal group.

Data

numeric: the data matrix. See Details.

group

numeric: the vector of group membership. See Details.

match

character or numeric: specifies matching criterion. Can be either "score", or numeric vector of the same length as number of observations in Data. See Details.

draw.empirical

logical: whether empirical probabilities should be calculated and plotted. Default value is TRUE.

Details

This function plots characteristic curves of 2PL logistic DIF model fitted by difLogistic() function from difR package using ggplot2.

Data and group are used to calculate empirical probabilities for reference and focal group. match should be the same as in x$match. In case that matching variable is used instead of total score or standardized score, match needs to be a numeric vector of the same the same length as number of observations in Data.

See Also

difLogistic, ggplot

Examples

Run this code
# NOT RUN {
# loading libraries
library(difR)

# loading data based on GMAT
data(GMAT, package = "difNLR")
Data <- GMAT[, 1:20]
group <- GMAT[, 21]

# DIF detection using difLogistic() function
x <- difLogistic(Data, group, focal.name = 1)
# Characteristic curve by logistic regression model
plotDIFLogistic(x, item = 1, Data = Data, group = group)

# Using name of column as item identifier
plotDIFLogistic(x, item = "Item1", Data = Data, group = group)

# Renaming reference and focal group
plotDIFLogistic(x, item = 1, group.names = c("Group 1", "Group 2"), Data = Data, group = group)

# Not plotting empirical probabilities
plotDIFLogistic(x, item = 1, draw.empirical = FALSE)
# }

Run the code above in your browser using DataLab