irtest

Parameter Estimation of Item Response Theory with Estimation of Latent Distribution

https://github.com/seewooli/irtest

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (18.7%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Parameter Estimation of Item Response Theory with Estimation of Latent Distribution

Basic Info
  • Host: GitHub
  • Owner: SeewooLi
  • License: gpl-3.0
  • Language: R
  • Default Branch: master
  • Size: 1020 KB
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created almost 4 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog License

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%" 
)
library(ggplot2)
library(kableExtra)
library(gridExtra)
```

# Welcome to **IRTest**!

_Please feel free to_ [create an issue](https://github.com/SeewooLi/IRTest/issues) _for bug reports or potential improvements._


[![R-CMD-check](https://github.com/SeewooLi/IRTest/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/SeewooLi/IRTest/actions/workflows/R-CMD-check.yaml)
[![CRAN status](https://www.r-pkg.org/badges/version-last-release/IRTest)](https://CRAN.R-project.org/package=IRTest)
[![downloads](https://cranlogs.r-pkg.org/badges/grand-total/IRTest)](https://cranlogs.r-pkg.org/badges/grand-total/IRTest)
[![codecov](https://codecov.io/gh/SeewooLi/IRTest/branch/master/graph/badge.svg?token=N5RY2MYSM5)](https://app.codecov.io/gh/SeewooLi/IRTest)


+ **IRTest** is a useful tool for $\mathcal{\color{red}{IRT}}$ (item response theory) parameter $\mathcal{\color{red}{est}}\textrm{imation}$, especially when the violation of normality assumption on latent distribution is suspected.

+ **IRTest** deals with uni-dimensional latent variable.

+ For missing values, **IRTest** adopts full information maximum likelihood (FIML) approach.

+ In **IRTest**, including the conventional usage of Gaussian distribution, several methods are available for estimation of latent distribution:
    + empirical histogram method,
    + two-component Gaussian mixture distribution,
    + Davidian curve,
    + kernel density estimation,    
    + log-linear smoothing.

## Installation

The CRAN version of **IRTest** can be installed on R-console with:

```
install.packages("IRTest")
```

For the development version, it can be installed on R-console with:
```
devtools::install_github("SeewooLi/IRTest")
```

## Functions

Followings are the functions of **IRTest**.

  + `IRTest_Dich` is the estimation function when items are *dichotomously* scored.
  
  + `IRTest_Poly` is the estimation function when items are *polytomously* scored.
  
  + `IRTest_Cont` is the estimation function when items are *continuously* scored.
  
  + `IRTest_Mix` is the estimation function for *a mixed-format test*, a test comprising both dichotomous item(s) and polytomous item(s).
  
  + `factor_score` estimates factor scores of examinees.
  
  + `coef_se` returns standard errors of item parameter estimates.
  
  + `best_model` selects the best model using an evaluation criterion.
  
  + `item_fit` tests the statistical fit of all items individually.
  
  + `inform_f_item` calculates the information value(s) of an item.

  + `inform_f_test` calculates the information value(s) of a test.
    
  + `plot_item` draws item response function(s) of an item.
  
  + `reliability` calculates marginal reliability coefficient of IRT.
  
  + `latent_distribution` returns evaluated PDF value(s) of an estimated latent distribution.

  + `DataGeneration` generates several objects that can be useful for computer simulation studies. Among these are simulated item parameters, ability parameters and the corresponding item-response data.
  
  + `dist2` is a probability density function of two-component Gaussian mixture distribution.
  
  + `original_par_2GM` converts re-parameterized parameters of two-component Gaussian mixture distribution into original parameters.  
  
  + `cat_clps` recommends category collapsing based on item parameters (or, equivalently, item response functions).
  
  + `recategorize` implements the category collapsing.
  
  + For S3 methods, `anova`, `coef`, `logLik`, `plot`, `print`, and `summary` are available.

## Example

A simple simulation study for a 2PL model can be done in following manners:

```{r library, message=FALSE}
library(IRTest)
```

* Data generation

An artificial data of 1000 examinees and 20 items.

```{r generation}
Alldata <- DataGeneration(seed = 123456789,
                          model_D = 2,
                          N=1000,
                          nitem_D = 10,
                          latent_dist = "2NM",
                          m=0, # mean of the latent distribution
                          s=1, # s.d. of the latent distribution
                          d = 1.664,
                          sd_ratio = 2,
                          prob = 0.3)

data <- Alldata$data_D
item <- Alldata$item_D
theta <- Alldata$theta
colnames(data) <- paste0("item",1:10)
```

* Analysis 

For an illustrative purpose, the two-component Gaussian mixture distribution (2NM) method is used for the estimation of latent distribution.

```{r analysis, results='hide', message=FALSE}
Mod1 <- 
  IRTest_Dich(
    data = data,
    latent_dist = "2NM"
    )
```

* Summary of the result

```{r summary}
summary(Mod1)
```

* Parameter estimation results

```{r results, message=FALSE, fig.align='center', fig.height=4, fig.width=10, warning=FALSE}
colnames(item) <- c("a", "b", "c")

knitr::kables(
  list(
    ### True item parameters 
    knitr::kable(item, format='simple', caption = "True item parameters", digits = 2)%>%
  kableExtra::kable_styling(font_size = 4),

    ### Estimated item parameters
    knitr::kable(coef(Mod1), format='simple', caption = "Estimated item parameters", digits = 2)%>%
  kableExtra::kable_styling(font_size = 4)
  )
)


### Plotting
fscores <- factor_score(Mod1, ability_method = "WLE")

par(mfrow=c(1,3))
plot(item[,1], Mod1$par_est[,1], xlab = "true", ylab = "estimated", main = "item discrimination parameters")
abline(a=0,b=1)
plot(item[,2], Mod1$par_est[,2], xlab = "true", ylab = "estimated", main = "item difficulty parameters")
abline(a=0,b=1)
plot(theta, fscores$theta, xlab = "true", ylab = "estimated", main = "ability parameters")
abline(a=0,b=1)
```

* The result of latent distribution estimation

```{r plotLD, fig.align='center', fig.height=4, fig.width=8}
plot(Mod1, mapping = aes(colour="Estimated"), linewidth = 1) +
  stat_function(
    fun = dist2,
    args = list(prob = .3, d = 1.664, sd_ratio = 2),
    mapping = aes(colour = "True"),
    linewidth = 1) +
  lims(y = c(0, .75)) + 
  labs(title="The estimated latent density using '2NM'", colour= "Type")+
  theme_bw()
```

* Posterior distributions for the examinees

Each examinee's posterior distribution is calculated in the E-step of EM algorithm.
Posterior distributions can be found in `Mod1$Pk`.

```{r}
set.seed(1)
selected_examinees <- sample(1:1000,6)
post_sample <- 
  data.frame(
    X = rep(seq(-6,6, length.out=121),6), 
    prior = rep(Mod1$Ak/(Mod1$quad[2]-Mod1$quad[1]), 6),
    posterior = 10*c(t(Mod1$Pk[selected_examinees,])), 
    ID = rep(paste("examinee", selected_examinees), each=121)
    )

ggplot(data=post_sample, mapping=aes(x=X))+
  geom_line(mapping=aes(y=posterior, group=ID, color='Posterior'))+
  geom_line(mapping=aes(y=prior, group=ID, color='Prior'))+
  labs(title="Posterior densities for selected examinees", x=expression(theta), y='density')+
  facet_wrap(~ID, ncol=2)+
  theme_bw()
```

* Item fit

```{r, message=FALSE}
item_fit(Mod1)
```

* Item response function

```{r, fig.asp=0.7}
p1 <- plot_item(Mod1,1)
p2 <- plot_item(Mod1,4)
p3 <- plot_item(Mod1,8)
p4 <- plot_item(Mod1,10)
grid.arrange(p1, p2, p3, p4, ncol=2, nrow=2)
```

* Reliability

```{r}
reliability(Mod1)
```

* Test information function

```{r}
ggplot()+
  stat_function(
    fun = inform_f_test,
    args = list(Mod1)
  )+ 
  stat_function(
    fun=inform_f_item,
    args = list(Mod1, 1),
    mapping = aes(color="Item 1")
  )+
  stat_function(
    fun=inform_f_item,
    args = list(Mod1, 2),
    mapping = aes(color="Item 2")
  )+
  stat_function(
    fun=inform_f_item,
    args = list(Mod1, 3),
    mapping = aes(color="Item 3")
  )+
  stat_function(
    fun=inform_f_item,
    args = list(Mod1, 4),
    mapping = aes(color="Item 4")
  )+
  stat_function(
    fun=inform_f_item,
    args = list(Mod1, 5),
    mapping = aes(color="Item 5")
  )+
  lims(x=c(-6,6))+
  labs(title="Test information function", x=expression(theta), y='information')+
  theme_bw()
```

Owner

  • Login: SeewooLi
  • Kind: user

GitHub Events

Total
  • Push event: 7
Last Year
  • Push event: 7

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 31
  • Total pull requests: 7
  • Average time to close issues: 23 days
  • Average time to close pull requests: 11 minutes
  • Total issue authors: 1
  • Total pull request authors: 2
  • Average comments per issue: 0.84
  • Average comments per pull request: 0.0
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • SeewooLi (30)
Pull Request Authors
  • SeewooLi (4)
  • PARKNAGAP (3)
Top Labels
Issue Labels
enhancement (15) bug (5) good first issue (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 299 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 8
  • Total maintainers: 1
cran.r-project.org: IRTest

Parameter Estimation of Item Response Theory with Estimation of Latent Distribution

  • Versions: 8
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 299 Last month
Rankings
Forks count: 28.8%
Dependent packages count: 29.8%
Stargazers count: 35.2%
Dependent repos count: 35.5%
Average: 41.9%
Downloads: 80.4%
Maintainers (1)
Last synced: 10 months ago

Dependencies

DESCRIPTION cran
  • knitr * suggests
  • rmarkdown * suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/Upload coverage reports to Codecov.yaml actions
.github/workflows/test-coverage.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite