A question about setting the constrains for the testlet model

213 views
Skip to first unread message

肖佳莹

unread,
Nov 28, 2020, 8:51:31 PM11/28/20
to mirt-package
I have some trouble about setting constraints on the testlet model. I will be very thankful if you can answer my question.

The testlet model equation that I use is the following:

g(\pi_j)= a_{jg}(\theta_g + C_k\theta_k) +d_j

Now I want to simulate a dataset with 12 items. Every four items share the same testlet effects, and their item discriminations on the secondary dimension should be a_jg*Ck. When I use the constrain command to define this relationship, it keeps giving the same error message: "CONSTRAIN = ... indexed a parameter that was not relevant for item 1."

I have pasted my codes below:

set.seed(1234)
a <- matrix(0, 12, 4)
a[,1] <- rlnorm(12, 0.2, 0.3)
ind <- 1
for(i in 1:3){
  a[ind:(ind+3),i+1] <- rep(rlnorm(1,0.2,0.3),4)
  ind <- ind+4
}
print(a) #the first column refers to a_jg, the remaining columns are C_k.
#We need to do some transformations to get the item discrimination matrix.
a[,2:4]<-a[,2:4]*a[,1] #a_jg*C_k
print(a)
d <- rnorm(12, 0, .5)
sigma <- diag(c(1, .5, 1, .5))
dataset <- simdata(a,d,2000,itemtype=rep('2PL', 12),sigma=sigma)
specific <- c(rep(1,4),rep(2,4), rep(3,4))
#constrain Items 1-4 has the same testlet effect. Do the same thing
#for Items 5-8, and Items 9-12.
model <- 'G = 1-12
#I want to define Ck would be the same
CONSTRAIN = (1-4, a2/a1), (5-8,a3/a1),(9-12,a4/a1) 
COV = S1*S1, S2*S2, S3*S3'
tlmirt <- bfactor(dataset, specific, model)

I appreciate your time!

Best,
Jiaying

Phil Chalmers

unread,
Nov 30, 2020, 10:58:22 AM11/30/20
to 肖佳莹, mirt-package
Thanks for the reprex. It looks like your syntax is a bit off, as "..., a2/a1" is not a supported declaration. The following syntax seems more like what you're after:

model <- 'G = 1-12
CONSTRAIN = (1, a2, a1), (2, a2, a1), (3, a2, a1), (4, a2, a1),  
            (5, a3, a1), (6, a3, a1), (7, a3, a1), (8, a3, a1),
            (9, a4, a1), (10, a4, a1), (11, a4, a1), (12, a4, a1)

COV = S1*S1, S2*S2, S3*S3'

I suppose your original syntax could be supported to indicate that a2 and a1 are to be constrained within a given item so as to overload the item selection portions of the syntax, so I'll consider adding this in for convenience. Cheers.

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/932998a5-d7d5-4aee-acfd-31dc5452fd43n%40googlegroups.com.

肖佳莹

unread,
Nov 30, 2020, 3:52:36 PM11/30/20
to mirt-package
Hi Phil,

Thank you so much for your quick response! If I use your codes to constrain the model, I will get the same values on the primary and secondary dimensions for each item. However, here I want a different thing. 

Specifically, items 1-4 have the same testlet effect Ck. According to the equation that I present in my previous email, their secondary item discrimination should be Ck*a_{jg}, where a_{jg} is the primary item discrimination. That is why I write the codes like this: CONSTRAIN = (1-4, a2/a1). I want the values of a2/a1 are the same for these items. Other items follow the same criterion. I am wondering whether it is possible to achieve it?

Best,
Jiaying

Phil Chalmers

unread,
Nov 30, 2020, 4:49:01 PM11/30/20
to 肖佳莹, mirt-package
What you're describing is actually the purpose of the line:

COV = S1*S1, S2*S2, S3*S3

which frees the latent variances for the specific dimensions. Due to the proportionality implied by the testlet model you just need to take the estimates of these latent variables and multiply them through for the slope parameters. Hence, the within-item equality constraints are just used to imply the proportionality, while the variances of the specific factors correct for this systematic proportionality (e.g., for specific factor 2 and some given slope a2, a2* = a2 * COV_22). HTH.

Phil


肖佳莹

unread,
Nov 30, 2020, 6:28:32 PM11/30/20
to mirt-package
Hi Phil,

Thank you for your reply! You mean I use the following codes to estimate the item parameters and my testlet coefficients should be the diagonal values in the covariance matrix. For example, a2 should be: coef(tlmirt, simplify=TRUE)$cov[2,2]*coef(tlmirt, simplify=TRUE)$items[,2].  Is it correct?

model <- 'G = 1-12
CONSTRAIN = (1, a2, a1), (2, a2, a1), (3, a2, a1), (4, a2, a1),  
            (5, a3, a1), (6, a3, a1), (7, a3, a1), (8, a3, a1),
            (9, a4, a1), (10, a4, a1), (11, a4, a1), (12, a4, a1)
COV = S1*S1, S2*S2, S3*S3'

Thanks,
Jiaying

Phil Chalmers

unread,
Nov 30, 2020, 6:30:04 PM11/30/20
to 肖佳莹, mirt-package
Yes, that looks correct to me.

Phil


肖佳莹

unread,
Nov 30, 2020, 6:45:53 PM11/30/20
to Phil Chalmers, mirt-package
Thank you so much!

Phil Chalmers <rphilip....@gmail.com> 于2020年11月30日周一 下午3:30写道:
Reply all
Reply to author
Forward
0 new messages