Version: | 1.0.0 |
Type: | Package |
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>. |
Depends: | R (≥ 3.6.0) |
Imports: | shiny, shinyWidgets, bslib, DT, lavaan, mirt, sirt, ggplot2 (≥ 3.4.0), dplyr, readr, tidyr, stringr, magrittr, purrr, data.table, MASS, utils, stats, flextable, gt, officer, openxlsx, sass |
Suggests: | testthat (≥ 3.0.0), knitr, rmarkdown |
License: | GPL (≥ 3) |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
VignetteBuilder: | knitr |
Collate: | 'GRShiny-package.r' '0_shinyapp.r' 'excel_table.r' 'gen_data.r' 'model_grm.r' 'model_out_tidy.r' 'plot.r' 'word_table.r' 'zz_runAPP.r' |
URL: | https://github.com/sooyongl/GRShiny |
Config/testthat/edition: | 3 |
NeedsCompilation: | no |
Packaged: | 2023-05-02 14:49:53 UTC; sooyong |
Author: | Sooyong Lee [aut, cre], Tiffany Whittaker [aut], Laura Stapleton [aut] |
Maintainer: | Sooyong Lee <sooyongl09@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2023-05-03 18:40:06 UTC |
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 sooyongl09@utexas.edu
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 |
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
|
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)
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 |
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 |
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)
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 |
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
|
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)
Clean output to look like Mplus
Description
Clean output to look like Mplus
Usage
extract_est(fit)
Arguments
fit |
an object from |
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 |
Details
This extracts model fit.
Value
a list of IRT fit information
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
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 |
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 = |
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 |
estimator |
a character indicating the type of estimator.
|
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:
fit
an object from eitherSingleGroupClass
frommirt
or codelavaan from fromlavaan
.grm.par
a data frame indicating graded response parameters.
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()
}