personDist: Person parameter distribution

View source: R/personDistribution.r

personDistR Documentation

Person parameter distribution

Description

This function requires a fitted mirt-model of class SingleGroupClass to visualize a person parameter distribution (theta levels in the studied population). The resulting ggplot can be further customized (e.g., with regard to theme, labels, etc.). It works with both uni- and multidimensional models.

Usage

personDist(model, theta_range = c(-4, 4), density = FALSE, bins = 35)

Arguments

model

an object of class SingleGroupClass returned by the function mirt().

density

logical value indicating whether a smoothed density curve or a standard histogram should be plotted.

bins

number of bins to be plotted in the histogram

Value

a ggplot object.

Examples

# Loading packages
library(mirt)
library(ggmirt)

# Getting data
data <- expand.table(LSAT7)

# Fitting a model 
(mod <- mirt(data, 1))

# Simple plot
personDist(mod)
personDist(mod, density = TRUE)

# Customized plot
personDist(mod, theta_range = c(-3, 3), bins = 10) +
  theme_classic()

masurp/ggmirt documentation built on Oct. 14, 2023, 1:16 p.m.