Giter Site home page Giter Site logo

juliapsychometrics / raschmodels.jl Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 198 KB

Rasch modeling with all the bells and whistles. Implementations for Rasch model, partial credit model, rating scale model, and its linear extensions (upcoming). Classical and Bayesian estimation.

License: MIT License

Julia 100.00%
julia item-response-theory rasch-model

raschmodels.jl's People

Contributors

github-actions[bot] avatar p-gw avatar t-alfers avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

raschmodels.jl's Issues

Improve TTFX

Since we do not need to support julia LTS we can bump the required julia version to 1.8 and use SnoopPrecompile to precompile model calculations.

This should make the first run for users noticably faster.

Code formatting

We should probably define some sensible defaults for JuliaFormatter.
For now I just used the default settings in VSCode.
Realistically we should use the same style for every package in JuliaPsychometrics.

Do you have any preferences @t-alfers?

Remove duplicated code

Duplicated code should be simplified. This is relevant for:

  • AbstractItemResponseModels.iif

function AbstractItemResponseModels.iif(model::RaschModel{PointEstimate}, theta::Real, i, y::Real)
checkresponsetype(response_type(model), y)
parname = Symbol("beta[$i]")
beta = model.pars.values[parname]
return _iif(theta, beta, y)
end
function AbstractItemResponseModels.iif(model::RaschModel{SamplingEstimate}, theta::Real, i, y::Real)
checkresponsetype(response_type(model), y)
beta = vec(model.pars["beta[$i]"])
return _iif(theta, beta, y)
end

  • AbstractItemResponseModels.irf

function AbstractItemResponseModels.irf(model::RaschModel{PointEstimate}, theta::Real, i, y::Real)
checkresponsetype(response_type(model), y)
parname = Symbol("beta[$i]")
beta = model.pars.values[parname]
return _irf(theta, beta, y)
end
function AbstractItemResponseModels.irf(model::RaschModel{SamplingEstimate}, theta::Real, i, y::Real)
checkresponsetype(response_type(model), y)
beta = vec(model.pars["beta[$i]"])
return _irf(theta, beta, y)
end

These two instances can be fixed by implementing a new function getitempars for fetching item parameters for various data structures. Eventually getitempars could be part of the JuliaPsychometrics/AbstractItemResponseModels.jl interface.

Duplicate _fit_by_alg

Why are both of these methods required? If we leave out the second function definition, then _fit_by_alg will dispatch on the correct method of _fit_by_cml anyways.

RaschModels.jl/src/fit.jl

Lines 161 to 176 in ccca8a0

function _fit_by_alg(modeltype, data, alg::CML, args...; kwargs...)
estimate = _fit_by_cml(modeltype, data, alg, args...; kwargs...)
return estimate, PointEstimate
end
# for CML estimation a separate logic is necessary to follow if missing values in dataset
function _fit_by_alg(
modeltype,
data::MatrixWithMissings{T},
alg::CML,
args...;
kwargs...,
) where {T}
estimate = _fit_by_cml(modeltype, data, alg, args...; kwargs...)
return estimate, PointEstimate
end

Add documentation

We should at minimum add documentation for all user facing functions in the package.

TODO

  • irf
  • iif
  • expected_score
  • information
  • fit

Implement linear model variants

This issue splits #5.

Separately implement linear variants of simple Rasch models:

TODO

  • Linear Logistic Test Model
  • Linear Rating Scale Model
  • Linear Partial Credit Model

Item response function always returns 0

For RaschModel{SamplingEstimate} the irf function always returns 0.
Reason being that scoring_function defaults to identity here:

function irf(model::RaschModel{SamplingEstimate}, theta, i, y = 1)
n_iter = length(getitempars(model, i))
probs = zeros(Float64, n_iter)
add_irf!(model, probs, theta, i, y)
return probs
end

scoring_function is needed in add_irf! for expected_score, but here we can just make it default to x -> one(x) to fix the issue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.