JuliaPsychometrics / ItemResponsePlots.jl

Visualizations for item response models with Makie.jl
https://juliapsychometrics.github.io/ItemResponsePlots.jl/
MIT License
3 stars 0 forks source link

add expected score plots #4

Closed p-gw closed 1 year ago

p-gw commented 1 year ago

closes #2, #1

p-gw commented 1 year ago
using CairoMakie
using ItemResponseRecipes
using RaschModels
using Turing
using Optim

data = rand(0:1, 100, 10)

rasch_mle = fit(RaschModel, data, Turing.MLE())
rasch_mcmc = fit(RaschModel, data, Turing.NUTS())

esp = Figure()

esp_mle = Axis(esp[1, 1], title="MLE")
esp_mcmc = Axis(esp[1, 2], title="MCMC")

expected_score_plot!(esp_mle, rasch_mle)
expected_score_plot!(esp_mcmc, rasch_mcmc)

xlims!(esp_mle, -3, 3)
xlims!(esp_mcmc, -3, 3)
ylims!(esp_mle, 0, 10)
ylims!(esp_mcmc, 0, 10)

expected_score_plot

p-gw commented 1 year ago

with item subsets

esp = Figure()

esp_mle = Axis(esp[1, 1], title="MLE")
esp_mcmc = Axis(esp[1, 2], title="MCMC")

items = [1, 3, 4, 6, 10]
expected_score_plot!(esp_mle, rasch_mle, items)
expected_score_plot!(esp_mcmc, rasch_mcmc, items)

xlims!(esp_mle, -3, 3)
xlims!(esp_mcmc, -3, 3)
ylims!(esp_mle, 0, length(items))
ylims!(esp_mcmc, 0, length(items))

expected_score_plot

p-gw commented 1 year ago

ICCs:

icc = Figure()

icc_mle = Axis(icc[1, 1], title="MLE")
icc_mcmc = Axis(icc[1, 2], title="MCMC")

item_characteristic_curve!(icc_mle, rasch_mle, 1)
item_characteristic_curve!(icc_mcmc, rasch_mcmc, 1)

xlims!(icc_mle, -3, 3)
xlims!(icc_mcmc, -3, 3)
ylims!(icc_mle, 0, 1)
ylims!(icc_mcmc, 0, 1)

icc

p-gw commented 1 year ago

IICs:

iic = Figure()

iic_mle = Axis(iic[1, 1], title="MLE")
iic_mcmc = Axis(iic[1, 2], title="MCMC")

item_information_curve!(iic_mle, rasch_mle, 1)
item_information_curve!(iic_mcmc, rasch_mcmc, 1)

xlims!(iic_mle, -3, 3)
xlims!(iic_mcmc, -3, 3)
ylims!(iic_mle, 0, 0.25)
ylims!(iic_mcmc, 0, 0.25)

iic