Package 'GRShiny'

Title: Graded Response Model
Description: Simulation and analysis of graded response data with different types of estimators. Also, an interactive shiny application is provided with graphics for characteristic and information curves. Samejima (2018) <doi:10.1007/978-1-4757-2691-6_5>.
Authors: Sooyong Lee [aut, cre], Tiffany Whittaker [aut], Laura Stapleton [aut]
Maintainer: Sooyong Lee <[email protected]>
License: GPL (>= 3)
Version: 1.0.0
Built: 2024-11-24 04:26:45 UTC
Source: https://github.com/sooyongl/grshiny

Help Index


Full information maximum likelihood estimation of IRT models.

Description

Graded response models with different estimators

Details

Analysis of polytomous response data using unidimensional and multidimensional latent trait models under the Structure Equation Modeling paradigm. Confirmatory graded response models can be estimated with ML and WLS estimators. GRM data can be simulated and analyzed. Finally, an interactive Shiny application for running a GRM analysis is supported.l

Author(s)

Sooyong Lee [email protected]


Plot expected scores by items

Description

Plot expected scores by items

Usage

ESplot(
  fit,
  selected_item,
  theta = seq(-4, 4, 0.1),
  base_size = 16,
  line_size = 1,
  cal_option = "D"
)

Arguments

fit

an object from runGRM

selected_item

a numeric indicating for what items the function makes plots

theta

a numeric indicating latent traits

base_size

a numeric indicating the base font size

line_size

a numeric indicating the size of line

cal_option

a character indicating the plot color specified in scale_color_viridis_d (default = D)

Details

This makes a expected score plot

Value

a ggplot object.

Examples

grm_dt <- genData(eta = genTheta(nsample = 500, nfac = 1),
                 ipar = genIRTpar(nitem = 10, ncat = 3, nfac = 1))

fit <- runGRM(dat = grm_dt,
            lav.syntax = genLavSyn(dat = grm_dt, nfac = 1),
            estimator = "WL")
ESplot(fit, 1)

Clean output to look like Mplus

Description

Clean output to look like Mplus

Usage

extract_est(fit)

Arguments

fit

an object from runGRM

Details

This tidies the results in the CFA framework.

Value

a list of IRT parameter estimates


Extract model fit

Description

Extract model fit

Usage

extract_fit(fit)

Arguments

fit

an object from runGRM

Details

This extracts model fit.

Value

a list of IRT fit information


Plot Factor score

Description

Plot Factor score

Usage

FSplot(
  fit,
  type = "histogram",
  hist_bins = 20,
  fill_colour = "grey70",
  base_size = 16
)

Arguments

fit

an object from runGRM

type

a character indicating the type of plots

  • histogram Histogram plot

  • density Density plot

hist_bins

a numeric indicating the number of bins for the histogram

fill_colour

a character indicating the color (default = grey70)

base_size

a numeric indicating the base font size

Details

This makes either histogram or density plot for individual factor scores.

Value

a ggplot object.

Examples

grm_dt <- genData(eta = genTheta(nsample = 500, nfac = 1),
                 ipar = genIRTpar(nitem = 10, ncat = 3, nfac = 1))

fit <- runGRM(dat = grm_dt,
            lav.syntax = genLavSyn(dat = grm_dt, nfac = 1),
            estimator = "WL")
FSplot(fit, type = "histogram", hist_bins = 20, base_size = 16)

Generate IRT data

Description

Generate IRT data

Usage

genData(eta, ipar)

Arguments

eta

a matrix indicating individual true latent traits

ipar

a dataframe containing item parameters

Details

This generates GRM response data

Value

a data frame containing graded response model data

Examples

ipar <- genIRTpar(20, ncat = 3, 2)
eta <- genTheta(50, 2)
genData(eta, ipar)

Generate Item parameters

Description

Generate Item parameters

Usage

genIRTpar(nitem = 25, ncat = 4, nfac = 3)

Arguments

nitem

a numeric indicating the number of items

ncat

a numeric indicating the number of categories

nfac

a numeric indicating the number of factors

Details

This generates item parameters for graded response models

Value

a data frame containing graded response item parameters

Examples

genIRTpar(20, 4, 3)

Generate lavaan syntax

Description

Generate lavaan syntax

Usage

genLavSyn(dat, nfac = 1)

Arguments

dat

a data frame containing graded response data

nfac

a numeric indicating the number of factors

Details

This generates lavaan syntax

Value

a string indicating lavaan syntax.


Generate individual true latent traits

Description

Generate individual true latent traits

Usage

genTheta(nsample, nfac, l.cov = NULL)

Arguments

nsample

a numeric indicating the number of people

nfac

a numeric indicating the number of factors

l.cov

a matrix containing latent covariances

Details

This generates individual latent scores

Value

a matrix containing individual latent scores


Plot ICC or OCC

Description

Plot ICC or OCC

Usage

ICCplot(
  fit,
  selected_item,
  theta = seq(-4, 4, 0.1),
  plot.occ = FALSE,
  addlabel = FALSE,
  base_size = 16,
  line_size = 1,
  cal_option = "D"
)

Arguments

fit

an object from runGRM

selected_item

a numeric indicating for what items the function makes plots

theta

a numeric indicating latent traits

plot.occ

a logical. If TRUE, OCC is made instead of ICC

addlabel

a logical indicating whether to add the b parameter as labels

base_size

a numeric indicating the base font size

line_size

a numeric indicating the size of line

cal_option

a character indicating the plot color specified in scale_color_viridis_d (default = D)

Details

This makes either item characteristic curve plots or operating characteristic curve plots

Value

a ggplot object.

Examples

grm_dt <- genData(eta = genTheta(nsample = 500, nfac = 1),
                 ipar = genIRTpar(nitem = 10, ncat = 3, nfac = 1))

fit <- runGRM(dat = grm_dt,
            lav.syntax = genLavSyn(dat = grm_dt, nfac = 1),
            estimator = "WL")
ICCplot(fit, 1, seq(-3, 3, .1), plot.occ = FALSE, base_size = 16)

Calculate item information

Description

Calculate item information

Usage

infoPlot(
  fit,
  selected_item,
  type = "icc",
  theta = seq(-4, 4, 0.1),
  base_size = 16,
  line_size = 1,
  cal_option = "D",
  facet = FALSE
)

Arguments

fit

an object from runGRM

selected_item

a numeric indicating for what items the function makes plots

type

a character indicating the type of plots

  • icc Test information

  • tcc Total Test information

theta

a numeric indicating latent traits

base_size

a numeric indicating the base font size

line_size

a numeric indicating the size of line

cal_option

a character indicating the plot colour specified in scale_color_viridis_d (default = D)

facet

a logical. If TRUE, the plot is faceted by items. (default = FALSE).

Details

This makes either item information plots or total information plot

Value

a ggplot object.

Examples

grm_dt <- genData(eta = genTheta(nsample = 500, nfac = 1),
                 ipar = genIRTpar(nitem = 10, ncat = 3, nfac = 1))

fit <- runGRM(dat = grm_dt,
            lav.syntax = genLavSyn(dat = grm_dt, nfac = 1),
            estimator = "WL")
infoPlot(fit, selected_item=1:4, type = "icc", base_size = 16)

Run graded response model

Description

Run graded response model

Usage

runGRM(dat, lav.syntax, estimator)

Arguments

dat

a data frame containing graded response model data

lav.syntax

a character indicating lavaan syntax

estimator

a character indicating the type of estimator.

  • ML Maximum likelihood estimation

  • WL Weighted least squares mean and variance

Details

This conducts GRM. The second element of the return indicates the graded response parameters converted from the CFA parameters

Value

a list containing GRM results as follows:


Start GRShiny

Description

An interactive Shiny application for running a GRM analysis.

Usage

startGRshiny()

Details

startGRshiny is a caller function to open the Shiny interface of GRM.

This starts the IRT Shiny application on the user's local computer.

Value

It launches the Shiny app for Graded Response Model.

Examples

if (interactive()) {
  startGRshiny()
}