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 |
Graded response models with different estimators
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
Sooyong Lee [email protected]
Plot expected scores by items
ESplot( fit, selected_item, theta = seq(-4, 4, 0.1), base_size = 16, line_size = 1, cal_option = "D" )
ESplot( fit, selected_item, theta = seq(-4, 4, 0.1), base_size = 16, line_size = 1, cal_option = "D" )
fit |
an object from |
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
|
This makes a expected score plot
a ggplot
object.
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)
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
extract_est(fit)
extract_est(fit)
fit |
an object from |
This tidies the results in the CFA framework.
a list of IRT parameter estimates
Extract model fit
extract_fit(fit)
extract_fit(fit)
fit |
an object from |
This extracts model fit.
a list of IRT fit information
Plot Factor score
FSplot( fit, type = "histogram", hist_bins = 20, fill_colour = "grey70", base_size = 16 )
FSplot( fit, type = "histogram", hist_bins = 20, fill_colour = "grey70", base_size = 16 )
fit |
an object from |
type |
a character indicating the type of plots
|
hist_bins |
a numeric indicating the number of bins for the histogram |
fill_colour |
a character indicating the color (default = |
base_size |
a numeric indicating the base font size |
This makes either histogram or density plot for individual factor scores.
a ggplot
object.
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)
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
genData(eta, ipar)
genData(eta, ipar)
eta |
a matrix indicating individual true latent traits |
ipar |
a dataframe containing item parameters |
This generates GRM response data
a data frame containing graded response model data
ipar <- genIRTpar(20, ncat = 3, 2) eta <- genTheta(50, 2) genData(eta, ipar)
ipar <- genIRTpar(20, ncat = 3, 2) eta <- genTheta(50, 2) genData(eta, ipar)
Generate Item parameters
genIRTpar(nitem = 25, ncat = 4, nfac = 3)
genIRTpar(nitem = 25, ncat = 4, nfac = 3)
nitem |
a numeric indicating the number of items |
ncat |
a numeric indicating the number of categories |
nfac |
a numeric indicating the number of factors |
This generates item parameters for graded response models
a data frame containing graded response item parameters
genIRTpar(20, 4, 3)
genIRTpar(20, 4, 3)
Generate lavaan syntax
genLavSyn(dat, nfac = 1)
genLavSyn(dat, nfac = 1)
dat |
a data frame containing graded response data |
nfac |
a numeric indicating the number of factors |
This generates lavaan
syntax
a string indicating lavaan
syntax.
Generate individual true latent traits
genTheta(nsample, nfac, l.cov = NULL)
genTheta(nsample, nfac, l.cov = NULL)
nsample |
a numeric indicating the number of people |
nfac |
a numeric indicating the number of factors |
l.cov |
a matrix containing latent covariances |
This generates individual latent scores
a matrix containing individual latent scores
Plot ICC or OCC
ICCplot( fit, selected_item, theta = seq(-4, 4, 0.1), plot.occ = FALSE, addlabel = FALSE, base_size = 16, line_size = 1, cal_option = "D" )
ICCplot( fit, selected_item, theta = seq(-4, 4, 0.1), plot.occ = FALSE, addlabel = FALSE, base_size = 16, line_size = 1, cal_option = "D" )
fit |
an object from |
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
|
This makes either item characteristic curve plots or operating characteristic curve plots
a ggplot
object.
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)
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
infoPlot( fit, selected_item, type = "icc", theta = seq(-4, 4, 0.1), base_size = 16, line_size = 1, cal_option = "D", facet = FALSE )
infoPlot( fit, selected_item, type = "icc", theta = seq(-4, 4, 0.1), base_size = 16, line_size = 1, cal_option = "D", facet = FALSE )
fit |
an object from |
selected_item |
a numeric indicating for what items the function makes plots |
type |
a character indicating the type of 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 colour specified in
|
facet |
a logical. If TRUE, the plot is faceted by items.
(default = |
This makes either item information plots or total information plot
a ggplot
object.
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)
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
runGRM(dat, lav.syntax, estimator)
runGRM(dat, lav.syntax, estimator)
dat |
a data frame containing graded response model data |
lav.syntax |
a character indicating |
estimator |
a character indicating the type of estimator.
|
This conducts GRM. The second element of the return indicates the graded response parameters converted from the CFA parameters
a list containing GRM results as follows:
fit
an object from either SingleGroupClass
from mirt
or codelavaan from from
lavaan
.
grm.par
a data frame indicating graded response parameters.
An interactive Shiny application for running a GRM analysis.
startGRshiny()
startGRshiny()
startGRshiny
is a caller function to open the Shiny interface of GRM.
This starts the IRT Shiny application on the user's local computer.
It launches the Shiny app for Graded Response Model.
if (interactive()) { startGRshiny() }
if (interactive()) { startGRshiny() }