interpretation of residuals (margins)

333 views
Skip to first unread message

Irshad Mujawar

unread,
Sep 3, 2014, 8:35:13 AM9/3/14
to mirt-p...@googlegroups.com
Hello Everyone,

What is the significance of residuals ( below is the output and syntax of the usage)

mod = mirt(Science, 1)
kk
=residuals(mod,type='exp')

## I get output as

> head(kk)
   Comfort Work Future Benefit freq   exp    res
86       1    1      1       1    2 0.124  5.322
54       1    3      2       1    1 0.067  3.605
16       1    4      2       3    1 0.019  7.046
85       1    4      3       1    1 0.006 12.643
90       2    1      1       1    1 0.460  0.795
57       2    1      2       4    1 0.095  2.932



Suppose I also have itemfit output

> itemfit(mod)
Data adjusted so that the lowest category score for every item is 0
     item        
Zh      S_X2 df.S_X2 p.S_X2
1 Comfort 0.8609461  5.400696       6 0.4935
2    Work 1.9936005  9.356583       9 0.4050
3  Future 5.0158486  7.731649       8 0.4601
4 Benefit 1.9387007 10.094663      11 0.5219


Now my question is what extra information does "residuals" giving me about the items when I already have so many item-statistics telling me about goodness of that item?

How one should interpret the residuals ( terminology "margins" was used in "ltm" package for the residuals/ in other words how one should interpret residuals?
Enter code here...





Irshad Mujawar

unread,
Sep 3, 2014, 8:40:36 AM9/3/14
to mirt-p...@googlegroups.com
Additional question:

1) Does "res" or "res^2"  in the residuals output follow chi-square ? if Yes what degrees of freedom?

Phil Chalmers

unread,
Sep 3, 2014, 10:34:13 AM9/3/14
to Irshad Mujawar, mirt-package
Hi Irshad,


On Wed, Sep 3, 2014 at 8:35 AM, Irshad Mujawar <irshadmuj...@gmail.com> wrote:
Hello Everyone,

What is the significance of residuals ( below is the output and syntax of the usage)

mod = mirt(Science, 1)
kk
=residuals(mod,type='exp')

## I get output as

> head(kk)
   Comfort Work Future Benefit freq   exp    res
86       1    1      1       1    2 0.124  5.322
54       1    3      2       1    1 0.067  3.605
16       1    4      2       3    1 0.019  7.046
85       1    4      3       1    1 0.006 12.643
90       2    1      1       1    1 0.460  0.795
57       2    1      2       4    1 0.095  2.932



These are residuals for each response pattern. However, when the data is sparse (i.e., response patterns are missing, or the expected value is well below 1 as in the standard chi^2 assumption) they are pretty unreliable. 
 

Suppose I also have itemfit output

> itemfit(mod)
Data adjusted so that the lowest category score for every item is 0
     item        
Zh      S_X2 df.S_X2 p.S_X2
1 Comfort 0.8609461  5.400696       6 0.4935
2    Work 1.9936005  9.356583       9 0.4050
3  Future 5.0158486  7.731649       8 0.4601
4 Benefit 1.9387007 10.094663      11 0.5219


Now my question is what extra information does "residuals" giving me about the items when I already have so many item-statistics telling me about goodness of that item?

Simple answer, not much, but really they are asking different questions. The S_X2 stat is about whether the 'item' fits a collapsed version of the data, and therefore is much more stable than the pattern level residuals since sparseness essentially disappears due to collapsing (and conditioning on the total score, see the references). The other result asks about pattern residuals, how well the model can predict the number of participants with a given response pattern. 

Just to save another email, the answer to you other question is that the res from residuals() is a z value, so no df. This is because the (O - E)^2 / E is a chi^2 with df=1, and the signed square root of that is a z value.
 

How one should interpret the residuals ( terminology "margins" was used in "ltm" package for the residuals/ in other words how one should interpret residuals?
Enter code here...



Not sure what you mean here.

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.
For more options, visit https://groups.google.com/d/optout.

Irshad Mujawar

unread,
Sep 4, 2014, 12:14:55 AM9/4/14
to mirt-p...@googlegroups.com, irshadmuj...@gmail.com
Hello Phil,

Let me put is this way:

in that residual-method function if you specify restype or type='exp' then you get the output something as below,

mod = mirt(Science, 1)
residls=residuals(mod,type='exp')

head(residls)

   Comfort Work Future Benefit freq   exp    res
86       1    1      1       1    2 0.124  5.322
54       1    3      2       1    1 0.067  3.605
16       1    4      2       3    1 0.019  7.046
85       1    4      3       1    1 0.006 12.643
90       2    1      1       1    1 0.460  0.795
57       2    1      2       4    1 0.095  2.932

(Reference: http://www.jstatsoft.org/v48/i06/paper page number 11)

Now how one should interpreter this output? I hope this one make more sense.

Regards,
Irshad

Phil Chalmers

unread,
Sep 4, 2014, 12:21:03 AM9/4/14
to Irshad Mujawar, mirt-package
On Thu, Sep 4, 2014 at 12:14 AM, Irshad Mujawar <irshadmuj...@gmail.com> wrote:
Hello Phil,

Let me put is this way:

in that residual-method function if you specify restype or type='exp' then you get the output something as below,

mod = mirt(Science, 1)
residls=residuals(mod,type='exp')

head(residls)

   Comfort Work Future Benefit freq   exp    res
86       1    1      1       1    2 0.124  5.322
54       1    3      2       1    1 0.067  3.605
16       1    4      2       3    1 0.019  7.046
85       1    4      3       1    1 0.006 12.643
90       2    1      1       1    1 0.460  0.795
57       2    1      2       4    1 0.095  2.932

(Reference: http://www.jstatsoft.org/v48/i06/paper page number 11)

Now how one should interpreter this output? I hope this one make more sense.

If the model is exactly correct in the population, we would, on average, expect to see 0.124 response patterns equal to (1,1,1,1) if we were to infinitely sample 392 individuals from the population (the number of rows in the Science data). The residuals says that we predicted too low (positive value), and that with a z's test we were pretty far off.....but again, refer to my previous comment about data sparseness. Cheers.

Phil

Phil Chalmers

unread,
Sep 4, 2014, 12:56:33 AM9/4/14
to Irshad Mujawar, mirt-package
Also, I looked into the ltm output from the margins() function. Apparently, it isn't consistent across analyses, so in order to directly compare it will depend on the estimation function used in ltm. For instance, here is with the graded and 2PL models run on separate data returning information about the two-way marginals (i.e., 2-way covariance relationships between all item combinations, as well as their respective residuals).

Phil


````
library(ltm)
library(mirt)

# graded response model
(mod <- mirt(Science, 1))
(lmod <- grm(Science))

# signed two-way marginal residuals (unsigned in ltm)
margins(lmod)
residuals(mod)

# dichotomous data
dat <- expand.table(LSAT7)

(mod <- mirt(dat, 1))
(lmod <- ltm(dat ~ z1))

# signed two-way marginal residuals....apparently some weird truncated output from ltm
residuals(mod)
margins(lmod)

#ltm seems to report only a fraction of the two-way tables. These two give the same numbers when matched
residuals(mod, tables = TRUE)
mm <- margins(lmod)
mm$margins
```

Irshad Mujawar

unread,
Sep 4, 2014, 2:09:41 AM9/4/14
to mirt-p...@googlegroups.com, irshadmuj...@gmail.com
Thanks a ton Phil. These explanations really helped. :)



Irshad
Reply all
Reply to author
Forward
0 new messages