girth

An Item Response Theory Package for Python

https://github.com/eribean/girth

Science Score: 64.0%

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

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    1 of 5 committers (20.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.3%) to scientific vocabulary

Keywords

irt item-response-theory psychometrics regression
Last synced: 6 months ago · JSON representation ·

Repository

An Item Response Theory Package for Python

Basic Info
Statistics
  • Stars: 116
  • Watchers: 3
  • Forks: 17
  • Open Issues: 14
  • Releases: 16
Topics
irt item-response-theory psychometrics regression
Created almost 6 years ago · Last pushed over 3 years ago
Metadata Files
Readme License Citation

README.md

girth-tests Actions Status codecov CodeFactor PyPI version PyPI - Downloads License: MIT DOI

GIRTH: Item Response Theory

GIRTH

Girth is a python package for estimating item response theory (IRT) parameters. In addition, synthetic IRT data generation is supported. Below is a list of available functions, for more information visit the GIRTH homepage.

Interested in Bayesian Models? Check out girth_mcmc. It provides markov chain and variational inference estimation methods.

Need general statistical support? Download my other project RyStats which implements commonly used statistical functions. These functions are also implemented in an interactive webapp GoFactr.com without the need to download or install software.

Item Response Theory

Unidimensional Models

Dichotomous Models

  1. Rasch Model
    • Joint Maximum Likelihood
    • Conditional Likelihood
    • Marginal Maximum Likelihood
  2. One Parameter Logistic Models
    • Joint Maximum Likelihood
    • Marginal Maximum Likelihood
  3. Two Parameter Logistic Models
    • Joint Maximum Likelihood
    • Marginal Maximum Likelihood
    • Mixed Expected A Prior / Marginal Maximum Likelihood
  4. Three Parameter Logistic Models
    • Marginal Maximum Likelihood (No Optimization and Minimal Support)

Polytomous Models

  1. Graded Response Model
    • Joint Maximum Likelihood
    • Marginal Maximum Likelihood
    • Mixed Expected A Prior / Marginal Maximum Likelihood
  2. Partial Credit Model
    • Joint Maximum Likelihood
    • Marginal Maximum Likelihood
  3. Graded Unfolding Model
    • Marginal Maximum Likelihood

Ablity Estimation

  1. Dichotomous
    • Maximum Likelihood Estimation
    • Maximum a Posteriori Estimation
    • Expected a Posteriori Estimation
  2. Polytomous
    • Expected a Posteriori Estimation

Multidimensional Models

  1. Two Parameter Logistic Models
    • Marginal Maximum Likelihood
  2. Graded Response Model
    • Marginal Maximum Likelihood

Ablity Estimation

  1. Dichotomous
    • Maximum a Posteriori Estimation
    • Expected a Posteriori Estimation
  2. Polytomous
    • Maximum a Posteriori Estimation
    • Expected a Posteriori Estimation

Supported Synthetic Data Generation

Unidimensional

  1. Rasch / 1PL Models Dichotomous Models
  2. 2 PL Dichotomous Models
  3. 3 PL Dichotomous Models
  4. Graded Response Model Polytomous
  5. Partial Credit Model Polytomous
  6. Graded Unfolding Model Polytomous

Multidimensional

  1. Two Parameters Logisitic Models Dichotomous
  2. Graded Response Models Polytomous

Usage

Standard Estimation

To run girth with unidimensional models.

```python import numpy as np

from girth.synthetic import createsyntheticirtdichotomous from girth import twoplmml

Create Synthetic Data

difficulty = np.linspace(-2.5, 2.5, 10) discrimination = np.random.rand(10) + 0.5 theta = np.random.randn(500)

syndata = createsyntheticirtdichotomous(difficulty, discrimination, theta)

Solve for parameters

estimates = twoplmml(syndata)

Unpack estimates

discriminationestimates = estimates['Discrimination'] difficultyestimates = estimates['Difficulty'] ```

Missing Data

Missing data is supported with the tag_missing_data function.

```python from girth import tagmissingdata, twopl_mml

import data (you supply this function)

mydata = importdata(filename)

Assume its dichotomous data with True -> 1 and False -> 0

taggeddata = tagmissingdata(mydata, [0, 1])

Run Estimation

results = twoplmml(taggeddata) ```

Multidimensional Estimation

GIRTH supports multidimensional estimation but these estimation methods suffer from the curse of dimensionality, using more than 3 factors takes a considerable amount of time

```python import numpy as np

from girth.synthetic import createsyntheticirtdichotomous from girth import multidimensionaltwopl_mml

Create Synthetic Data

discrimination = np.random.uniform(-2, 2, (20, 2)) thetas = np.random.randn(2, 1000) difficulty = np.linspace(-1.5, 1, 20)

syndata = createsyntheticirtdichotomous(difficulty, discrimination, thetas)

Solve for parameters

estimates = multidimensionaltwoplmml(syndata, 2, {'quadraturen': 21})

Unpack estimates

discriminationestimates = estimates['Discrimination'] difficultyestimates = estimates['Difficulty'] ```

Standard Errors

GIRTH does not use typical hessian based optimization routines and, therefore, currently has limited support for standard errors. Confidence Intervals based on bootstrapping are supported but take longer to run. Missing Data is supported in the bootstrap function as well.

The bootstrap does not support the 3PL IRT Model or the GGUM.

```python from girth import twoplmml, standarderrors_bootstrap

import data (you supply this function)

mydata = importdata(filename)

results = standarderrorsbootstrap(mydata, twoplmml, nprocessors=4, bootstrapiterations=1000)

print(results['95th CI']['Discrimination'])
```

Factor Analysis

Factor analysis is another common method for latent variable exploration and estimation. These tools are helpful for understanding dimensionality or finding initial estimates of item parameters.

Factor Analysis Extraction Methods

  1. Principal Component Analysis
  2. Principal Axis Factor
  3. Minimum Rank Factor Analysis
  4. Maximum Likelihood Factor Analysis

Example

```python import girth.factoranalysis as gfa

Assume you have converted data into correlation matrix

nfactors = 3 results = gfa.maximumlikelihoodfactoranalysis(corrleation, n_factors)

print(results) ```

Polychoric Correlation Estimation

When collected data is ordinal, Pearson's correlation will provide biased estimates of the correlation. Polychoric correlations estimate the correlation given that the data is ordinal and normally distributed.

```python import girth.synthetic as gsyn import girth.factoranalysis as gfa import girth.common as gcm

discrimination = np.random.uniform(-2, 2, (20, 2)) thetas = np.random.randn(2, 1000) difficulty = np.linspace(-1.5, 1, 20)

syndata = gsyn.createsyntheticirtdichotomous(difficulty, discrimination, thetas)

polychoriccorr = gcm.polychoriccorrelation(syndata, startval=0, stop_val=1)

resultsfa = gfa.maximumlikelihoodfactoranalysis(polychoric_corr, 2) ```

Support

Installation

Via pip

sh pip install girth --upgrade

From Source

sh pip install . -t $PYTHONPATH --upgrade

Dependencies

We recommend the anaconda environment which can be installed here

  • Python ≥ 3.8
  • Numpy
  • Scipy

Unittests

pytest with coverage.py module

sh pytest --cov=girth --cov-report term

Contact

Please contact me with any questions or feature requests. Thank you!

Ryan Sanchez
ryan.sanchez@gofactr.com

License

MIT License

Copyright (c) 2021 Ryan C. Sanchez

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Sanchez"
  given-names: "Ryan"
  orcid: "https://orcid.org/0000-0003-0931-5335"
title: "GIRTH: G. Item Response Theory "
version: 0.8.0
date-released: 2021-11-11
url: "https://github.com/eribean/girth"

GitHub Events

Total
  • Issues event: 1
  • Watch event: 11
  • Issue comment event: 1
  • Fork event: 2
Last Year
  • Issues event: 1
  • Watch event: 11
  • Issue comment event: 1
  • Fork event: 2

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 171
  • Total Committers: 5
  • Avg Commits per committer: 34.2
  • Development Distribution Score (DDS): 0.304
Top Committers
Name Email Commits
eribean e****1@g****m 119
RyanSchool r****4@g****u 33
Ryan C. Sanchez r****z@g****m 14
Ryan r****s@g****m 4
KO k****r@u****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 60
  • Total pull requests: 44
  • Average time to close issues: 3 months
  • Average time to close pull requests: about 2 hours
  • Total issue authors: 13
  • Total pull request authors: 3
  • Average comments per issue: 1.48
  • Average comments per pull request: 0.91
  • Merged pull requests: 40
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 1.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • eribean (48)
  • zhoulei-biubiu (1)
  • Sandy4321 (1)
  • aleksejs-fomins (1)
  • Leader-board (1)
  • ISipi (1)
  • yuri-freitas-arcotech (1)
  • ShivamSrivastavaAkaike (1)
  • shiG3L (1)
  • Goodelang (1)
  • TejaswiniiB (1)
  • sitompul (1)
  • Helma-T (1)
Pull Request Authors
  • eribean (42)
  • yuri-freitas-arcotech (1)
  • karloskar (1)
Top Labels
Issue Labels
enhancement (9) bug (1) maintenance (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 2,029 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 4
  • Total versions: 13
  • Total maintainers: 1
pypi.org: girth

A python package for Item Response Theory.

  • Versions: 13
  • Dependent Packages: 0
  • Dependent Repositories: 4
  • Downloads: 2,029 Last month
Rankings
Downloads: 6.2%
Dependent repos count: 7.5%
Stargazers count: 8.0%
Average: 8.4%
Dependent packages count: 10.1%
Forks count: 10.2%
Maintainers (1)
Last synced: 7 months ago

Dependencies

requirements.txt pypi
  • numpy >=1.20.1
  • scipy >=1.7.1
setup.py pypi
  • numpy *
  • scipy *
.github/workflows/python-package.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • codecov/codecov-action v1 composite
.github/workflows/python-publish.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • pypa/gh-action-pypi-publish 27b31702a0e7fc50959f5ad993c78deac1bdfc29 composite