Diagnostic tests

Refer to the Rmd source code to see how to adapt this template to your project.

Pair-wise local dependence test

spec <- list()
spec[1:6] <- rpf.grm(factors=2)
## Warning in `[<-`(`*tmp*`, 1:6, value = new("rpf.mdim.grm", spec = c(2, 2, :
## implicit list embedding of S4 objects is deprecated
gen.param <- sapply(spec, rpf.rparam)
colnames(gen.param) <- paste("i", 1:ncol(gen.param), sep="")
gen.param[2,] <- c(0,0,.5,.5,1,1)

resp <- rpf.sample(1000, spec, gen.param)

# hide latent factor that we don't know about
tspec <- list()
tspec[1:length(spec)] <- rpf.grm(factors=1)
## Warning in `[<-`(`*tmp*`, 1:length(spec), value = new("rpf.mdim.grm", spec
## = c(2, : implicit list embedding of S4 objects is deprecated
grp <- list(spec=tspec, param=gen.param[-2,], mean=c(0), cov=diag(1), data=resp)

ChenThissen1997(grp)
## Chen & Thissen (1997) local dependence test
##   Magnitudes larger than abs(log(.01))=4.6 are significant at the p=.01 level
##   A positive (negative) sign indicates more (less) observed correlation than expected
## 
##       i1    i2    i3   i4   i5
## i2  1.03    NA    NA   NA   NA
## i3  2.00  1.03    NA   NA   NA
## i4 -1.46  1.92  2.34   NA   NA
## i5 -4.82 -1.32 -0.65 1.65   NA
## i6  2.83 -3.40  4.66 3.61 2.86

Sum-score item fit test

(got <- SitemFit(grp))
## Orlando & Thissen (2000) sum-score based item fit test
##   Magnitudes larger than abs(log(.01))=4.6 are significant at the p=.01 level
## 
## i1 : n = 1000, S-X2(  3) =   1.19, log(p) = -0.28
## i2 : n = 1000, S-X2(  1) =   0.77, log(p) = -0.97
## i3 : n = 1000, S-X2(  4) =   2.86, log(p) = -0.54
## i4 : n = 1000, S-X2(  3) =   4.93, log(p) = -1.73
## i5 : n = 1000, S-X2(  3) =  10.51, log(p) = -4.22
## i6 : n = 1000, S-X2(  2) =   5.06, log(p) = -2.53

Who can resist plotting these tables?

plot of chunk unnamed-chunk-4plot of chunk unnamed-chunk-4plot of chunk unnamed-chunk-4plot of chunk unnamed-chunk-4plot of chunk unnamed-chunk-4plot of chunk unnamed-chunk-4

Sum-score EAP table

(got <- sumScoreEAP(grp))
##              p         a1       se1      cov1
## 0 4.302707e-02 -1.5011860 0.7752174 0.6009621
## 1 3.474040e-01 -0.3872554 0.8629654 0.7447092
## 2 5.188261e-01  0.2467117 0.8760481 0.7674604
## 3 8.698930e-02  0.7362619 0.9156579 0.8384294
## 4 3.566925e-03  1.8351793 0.9001255 0.8102259
## 5 1.833569e-04  2.8431657 0.7110323 0.5055669
## 6 3.267440e-06  3.3932731 0.6566571 0.4311985

plot of chunk unnamed-chunk-6

Rasch residual-based infit/outfit

  data(science)
  spec <- list()
  spec[1:25] <- rpf.nrm(outcomes=3, T.c = lower.tri(diag(2),TRUE) * -1)
## Warning in `[<-`(`*tmp*`, 1:25, value = new("rpf.mdim.nrm", spec = c(3, :
## implicit list embedding of S4 objects is deprecated
  param <- rbind(a=1, alf1=1, alf2=0,
        gam1=sfif$MEASURE + sfsf[sfsf$CATEGORY==1,"Rasch.Andrich.threshold.MEASURE"],
        gam2=sfif$MEASURE + sfsf[sfsf$CATEGORY==2,"Rasch.Andrich.threshold.MEASURE"])
  colnames(param) <- sfif$NAME
  iorder <- match(sfif$NAME, colnames(sfpf))
  responses <- sfpf[,iorder]
  rownames(responses) <- sfpf$NAME

  rpf.1dim.fit(spec, param, responses, sfpf$MEASURE, 2, wh.exact=TRUE)
## Warning in rpf.1dim.fit(spec, param, responses, sfpf$MEASURE, 2, wh.exact =
## TRUE): Excluding item GO TO MUSEUM because outcomes != 3
## Warning in rpf.1dim.fit(spec, param, responses, sfpf$MEASURE, 2, wh.exact
## = TRUE): Excluding response ROSSNER, LAWRENCE F. because it is a minimum or
## maximum
##     n     infit     infit.z    outfit    outfit.z
## 1  74 0.7334760 -1.93854363 0.6662677 -1.84016154
## 2  74 0.7557765 -1.49109930 0.5601381 -1.43788307
## 3  74 0.6562136 -2.62314065 0.6235471 -2.50977057
## 4  74 0.9885977 -0.02982227 0.9833379 -0.05803811
## 5  74 2.2854600  5.28398081 3.9687036  6.98045705
## 6  74 0.8806001 -0.79728007 0.8212982 -1.02012688
## 7  74 0.9694889 -0.16907311 1.0049137  0.08462788
## 8  74 1.1684407  1.13263699 1.2320360  1.40767658
## 9  74 1.1125813  0.82684751 1.1337003  0.75931289
## 10 74 0.7756357 -1.09399342 0.5617036 -1.14659113
## 11 74 0.7286889 -1.83371616 0.5881417 -1.68055554
## 12 74 0.8493121 -0.62542291 0.7008119 -0.43349100
## 13 74 0.8730059 -0.86823601 0.8058509 -1.13628429
## 14 74 0.7502023 -1.67364559 0.6057915 -1.69066099
## 15 74 1.0934249  0.65700883 1.0512049  0.36542993
## 16 74 0.6632654 -2.59174746 0.6005216 -2.35711937
## 17 74 1.2325992  0.58992208 1.1912748  0.50748517
## 18 74 0.9690502  0.02438538 1.0925458  0.35481861
## 19 74 1.3529043  2.12137594 1.7997411  3.71876933
## 20 74 0.7334508 -1.59075191 0.5470207 -1.51023199
## 21 74 0.8040046 -1.40104331 0.7127619 -1.48373014
## 22 74 2.3647156  5.80477994 4.6517042  8.53849619
## 23 74 0.7907684 -1.42062168 0.6910078 -1.22075027
## 24 74 0.7830659 -1.61643142 0.7215023 -1.66985954
##                               name
## 1                      WATCH BIRDS
## 2            READ BOOKS ON ANIMALS
## 3             READ BOOKS ON PLANTS
## 4               WATCH GRASS CHANGE
## 5            FIND BOTTLES AND CANS
## 6  LOOK UP STRANGE ANIMAL OR PLANT
## 7                WATCH ANIMAL MOVE
## 8          LOOK IN SIDEWALK CRACKS
## 9                 LEARN WEED NAMES
## 10             LISTEN TO BIRD SING
## 11         FIND WHERE ANIMAL LIVES
## 12                     GROW GARDEN
## 13      LOOK AT PICTURES OF PLANTS
## 14             READ ANIMAL STORIES
## 15                      MAKE A MAP
## 16          WATCH WHAT ANIMALS EAT
## 17                    GO ON PICNIC
## 18                       GO TO ZOO
## 19                      WATCH BUGS
## 20            WATCH BIRD MAKE NEST
## 21       FIND OUT WHAT ANIMALS EAT
## 22                     WATCH A RAT
## 23   FIND OUT WHAT FLOWERS LIVE ON
## 24     TALK W FRIENDS ABOUT PLANTS
  head(rpf.1dim.fit(spec, param, responses, sfpf$MEASURE, 1, wh.exact=TRUE))
## Warning in rpf.1dim.fit(spec, param, responses, sfpf$MEASURE, 1, wh.exact =
## TRUE): Excluding item GO TO MUSEUM because outcomes != 3
## Warning in rpf.1dim.fit(spec, param, responses, sfpf$MEASURE, 1, wh.exact
## = TRUE): Excluding response ROSSNER, LAWRENCE F. because it is a minimum or
## maximum
##    n     infit     infit.z    outfit   outfit.z                 name
## 1 24 0.9693598 -0.01898239 0.8675200 -0.2174955 ROSSNER, MARC DANIEL
## 2 24 0.4687608 -2.24283176 0.4341095 -1.3589919     ROSSNER, TOBY G.
## 3 24 0.7377522 -0.97658469 0.6784338 -0.8996851  ROSSNER, MICHAEL T.
## 4 24 0.7940946 -0.75849430 1.3987520  1.1557079  ROSSNER, REBECCA A.
## 5 24 1.6391409  2.12339795 2.5979105  3.4653767      ROSSNER, TR CAT
## 6 24 1.8561200  1.94796584 1.2288375  0.5464035     WRIGHT, BENJAMIN