A mirt model with mixed item types

21 views
Skip to first unread message

Rizqy Amelia Zein

unread,
May 30, 2024, 11:07:51 AMMay 30
to mirt-package
Dear Phil and all,

First of all, thank you so much to Phil for developing this awesome package!! I would not have been able to work on my dissertation without it.

I'm currently submitting a registered report to develop a new scale, and to test the discriminant validity of this scale, I plan to correlate the factor scores estimated from my scale data with the factor scores estimated from a criterion data.

However, the reviewer does not like this idea because it does not properly account for measurement error and instead wants us to correlate the two constructs at the latent level by fitting a mirt model in which both constructs are estimated simultaneously.

The problem is that my scale data are unfolding (GGUM) while the criterion is not. Would it be possible to estimate a mirt with mixed item types like this, where some items follow one type (e.g., GGUM) while the others follow another type (e.g., graded)?

Thanks in advance for any tips and hints!

Best,
Amelia

Rizqy Amelia Zein

unread,
May 30, 2024, 1:34:07 PMMay 30
to mirt-package
I tried to specify a vector defining which items are unfolding, while the rests are gpcm but it does not work unfortunately.

```
library(mirt)
#> Warning: package 'mirt' was built under R version 4.3.3
#> Loading required package: stats4
#> Loading required package: lattice
```

```
set.seed(123)

# Simulate data for GGUM items (unfolding construct)
a_ggum <- matrix(rnorm(5, mean=1, sd=0.5), ncol=1)
d_ggum <- matrix(rnorm(5, mean=0, sd=1), ncol=1)
t_ggum <- matrix(rnorm(5, mean=0, sd=1), ncol=1) # threshold parameters for GGUM
theta_ggum <- matrix(rnorm(1000, mean=0, sd=1)) # latent trait for GGUM
data_ggum <- simdata(a=a_ggum, d=d_ggum, t=t_ggum, itemtype='ggum', Theta=theta_ggum)

# Simulate data for GPCM items (dominance construct)
a_gpcm <- matrix(rnorm(4, mean=1, sd=0.5), ncol=1)
d_gpcm <- matrix(rnorm(4 * 3, mean=0, sd=1), ncol=3) # GPCM requires multiple thresholds (3 categories, 2 thresholds per item)
theta_gpcm <- matrix(rnorm(1000, mean=0, sd=1)) # latent trait for GPCM
data_gpcm <- simdata(a=a_gpcm, d=d_gpcm, itemtype='gpcm', Theta=theta_gpcm)

colnames(data_ggum) <- paste0("ggum", 1:5)
colnames(data_gpcm) <- paste0("gpcm", 1:4)

# Combine the simulated datasets
mixed.irt <- cbind(data_ggum, data_gpcm)
print(head(mixed.irt))
#>      ggum1 ggum2 ggum3 ggum4 ggum5 gpcm1 gpcm2 gpcm3 gpcm4
#> [1,]     0     0     1     0     1     1     2     0     1
#> [2,]     0     0     0     1     0     0     0     2     0
#> [3,]     1     0     0     0     0     1     0     1     1
#> [4,]     0     0     1     0     0     2     2     1     0
#> [5,]     0     1     0     0     1     0     0     0     0
#> [6,]     1     0     0     1     0     0     2     1     1
```

```

# Check the range of responses
apply(mixed.irt, 2, table)
#> $ggum1
#>
#>   0   1
#> 527 473
#>
#> $ggum2
#>
#>   0   1
#> 555 445
#>
#> $ggum3
#>
#>   0   1
#> 769 231
#>
#> $ggum4
#>
#>   0   1
#> 644 356
#>
#> $ggum5
#>
#>   0   1
#> 782 218
#>
#> $gpcm1
#>
#>   0   1   2
#> 459 156 385
#>
#> $gpcm2
#>
#>   0   1   2
#> 375  41 584
#>
#> $gpcm3
#>
#>   0   1   2
#> 202 316 482
#>
#> $gpcm4
#>
#>   0   1   2
#> 430 503  67
```

```

# Specify item types vector
itemtypes <- c(rep('ggum', 5), rep('gpcm', 4))

# Define the model structure with two correlated factors
model <- 'F1 = 1-5
          F2 = 6-9
          F1*F2'

# Fit the model
mixed.irt.model <- mirt(mixed.irt, model = model, itemtype = itemtypes, SE = TRUE,
                        SE.type = "Oakes", optimizer = "nlminb")
#> Warning in model.elements(model = model$x, itemtype = itemtype, factorNames =
#> factorNames, : NAs introduced by coercion
#> Error in tmp2[1L]:tmp2[2L]: NA/NaN argument
```

Phil Chalmers

unread,
May 30, 2024, 4:34:38 PMMay 30
to Rizqy Amelia Zein, mirt-package
You were close. Your model just needed the COV argument. 

# Define the model structure with two correlated factors
model <- '
          F1 = 1-5
          F2 = 6-9
          COV = F1*F2'

HTH.

Phil


--
You received this message because you are subscribed to the Google Groups "mirt-package" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mirt-package...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mirt-package/fbdae075-60b6-4447-974c-2672ef96c062n%40googlegroups.com.

Rizqy Amelia Zein

unread,
May 30, 2024, 11:53:42 PMMay 30
to mirt-package
Dear Phil,

Thank you so much fo your prompt response! And thank you for spotting this clumsy error, now it works perfectly.

Best,
Amelia

Reply all
Reply to author
Forward
0 new messages