Closed leahfeuerstahler closed 2 years ago
Hi Leah,
Thanks for the report; a logical flag was missing in the fscores()
function and was being treating as a multi-group rather than mixture model. I now get the following output instead:
> head(fscores(mod_mix, response.pattern = dataset1[1,], method = "classify"))
CLASS_1 CLASS_2
[1,] 0.04826089 0.9517391
and
> head(fscores(mod_mix, response.pattern = dataset1, method = "classify"))
CLASS_1 CLASS_2
[1,] 0.04826089 0.9517391
[2,] 0.74229805 0.2577019
[3,] 0.02496487 0.9750351
[4,] 0.02929065 0.9707094
[5,] 0.07220029 0.9277997
[6,] 0.42417022 0.5758298
Thanks for the quick response! Much appreciated, as always.
On Mon, Oct 25, 2021 at 1:46 PM Phil Chalmers @.***> wrote:
Hi Leah,
Thanks for the report; a logical flag was missing in the fscores() function and was being treating as a multi-group rather than mixture model. I now get the following output instead:
head(fscores(mod_mix, response.pattern = dataset1[1,], method = "classify")) CLASS_1 CLASS_2 [1,] 0.04826089 0.9517391
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_philchalmers_mirt_issues_213-23issuecomment-2D951158571&d=DwMCaQ&c=aqMfXOEvEJQh2iQMCb7Wy8l0sPnURkcqADc2guUW8IM&r=AnYP3Ir-9Vum_SnRYHgaPka4JKtA2I6csS8SAuhh52g&m=RsmcZLu8GreIPNIUTgwG3s1muSqtLwuGJhGhILw0x4ZIM5QDlki-gFFxj9CYBU-Y&s=Jfr-2vFMEyTrvpLecjrIGk5jlYCDGVnIGSTj3K6C7Pk&e=, or unsubscribe https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AA6UFWN6GXLMD4T7EBP54XLUIWJYZANCNFSM5GVT2RLA&d=DwMCaQ&c=aqMfXOEvEJQh2iQMCb7Wy8l0sPnURkcqADc2guUW8IM&r=AnYP3Ir-9Vum_SnRYHgaPka4JKtA2I6csS8SAuhh52g&m=RsmcZLu8GreIPNIUTgwG3s1muSqtLwuGJhGhILw0x4ZIM5QDlki-gFFxj9CYBU-Y&s=ALUsPrAQsxbq1dYejSgZy5Qgk8Q_l8Nrlm9cB7o0S5w&e= . Triage notifications on the go with GitHub Mobile for iOS https://urldefense.proofpoint.com/v2/url?u=https-3A__apps.apple.com_app_apple-2Dstore_id1477376905-3Fct-3Dnotification-2Demail-26mt-3D8-26pt-3D524675&d=DwMCaQ&c=aqMfXOEvEJQh2iQMCb7Wy8l0sPnURkcqADc2guUW8IM&r=AnYP3Ir-9Vum_SnRYHgaPka4JKtA2I6csS8SAuhh52g&m=RsmcZLu8GreIPNIUTgwG3s1muSqtLwuGJhGhILw0x4ZIM5QDlki-gFFxj9CYBU-Y&s=jtBCh75MhbtlV6lSle3WJd_CJTG4GeSi6Jl2mniu4bc&e= or Android https://urldefense.proofpoint.com/v2/url?u=https-3A__play.google.com_store_apps_details-3Fid-3Dcom.github.android-26referrer-3Dutm-5Fcampaign-253Dnotification-2Demail-2526utm-5Fmedium-253Demail-2526utm-5Fsource-253Dgithub&d=DwMCaQ&c=aqMfXOEvEJQh2iQMCb7Wy8l0sPnURkcqADc2guUW8IM&r=AnYP3Ir-9Vum_SnRYHgaPka4JKtA2I6csS8SAuhh52g&m=RsmcZLu8GreIPNIUTgwG3s1muSqtLwuGJhGhILw0x4ZIM5QDlki-gFFxj9CYBU-Y&s=aVeEyMt-AiS8E-VIAJujWa76fyF2fW0CrB_ykYTQHRY&e=.
-- Leah Feuerstahler, PhD Assistant Professor of Psychology Fordham University 441 E Fordham Road Bronx, NY 10458 (718) 817-3788
There seems to be a bug when trying to predict group membership based on a mixture IRT model with user-provided data. A reproducible example is given below.
library(mirt)
below copied from multipleGroup() documentation
set.seed(12345) nitems <- 20 a1 <- matrix(.75, ncol=1, nrow=nitems) a2 <- matrix(1.25, ncol=1, nrow=nitems) d1 <- matrix(rnorm(nitems,0,1),ncol=1) d2 <- matrix(rnorm(nitems,0,1),ncol=1) itemtype <- rep('2PL', nrow(a1)) N1 <- 500 N2 <- N1*2 # second class twice as large
dataset1 <- simdata(a1, d1, N1, itemtype) dataset2 <- simdata(a2, d2, N2, itemtype) dat <- rbind(dataset1, dataset2)
models <- 'F1 = 1-20 CONSTRAIN = (1-20, a1)' mod_mix <- multipleGroup(dat, models, dentype = 'mixture-2', GenRandomPars = TRUE)
no problem classifying scores for calibration data
head(fscores(mod_mix, method = "classify"))
fails for classifying scores for user-provided data
head(fscores(mod_mix, response.pattern = dataset1, method = "classify"))
Error in object@ParObjects$pars[[extract.mirt(object, "nitems") + 1L]] :
subscript out of bounds