Skip to content

Commit 64882e4

Browse files
committed
include templated code (currently undocumented)
1 parent 3330c9a commit 64882e4

File tree

2 files changed

+16
-24
lines changed

2 files changed

+16
-24
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: mirt
2-
Version: 1.44.3
2+
Version: 1.44.4
33
Type: Package
44
Title: Multidimensional Item Response Theory
55
Authors@R: c( person("Phil", family="Chalmers", email =

R/RCI.R

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -198,29 +198,21 @@ RCI <- function(mod_pre, predat, postdat,
198198
SE=pse, z=z,
199199
p=pnorm(abs(z), lower.tail = FALSE)*2)
200200
} else {
201-
stop('multidimensional IRT models not suppported in RCI()', call.=FALSE)
202-
# fs_pre <- fscores(mod_pre, response.pattern=predat, ...)
203-
# fs_post <- fscores(mod_post, response.pattern=postdat, ...)
204-
# fs_acov <- fs_pre_acov <- fscores(mod_pre, response.pattern = predat,
205-
# return.acov=TRUE, ...)
206-
# fs_post_acov <- fscores(mod_post, response.pattern=postdat,
207-
# return.acov=TRUE, ...)
208-
# for(i in 1L:length(fs_acov))
209-
# fs_acov[[i]] <- fs_pre_acov[[i]] + fs_post_acov[[i]]
210-
# diff <- fs_post[,1L:nfact] - fs_pre[,1L:nfact]
211-
# joint <- vector('list', nrow(diff))
212-
# for(i in 1:nrow(diff))
213-
# joint[[i]] <- wald.test(diff[i,], covB = fs_acov[[i]],
214-
# L = diag(ncol(diff)))
215-
# joint <- do.call(rbind, joint)
216-
# SEs <- do.call(rbind, lapply(fs_acov, \(x) sqrt(diag(x))))
217-
# z <- diff/SEs
218-
# converge_pre <- converge_post <- rep(TRUE, length(z))
219-
# converge_pre[attr(fs_pre, 'failed2converge')] <- FALSE
220-
# converge_post[attr(fs_post, 'failed2converge')] <- FALSE
221-
# ret <- data.frame(diff=diff, converged=converge_pre & converge_post,
222-
# joint, z=z,
223-
# p=pnorm(abs(z), lower.tail = FALSE)*2)
201+
# TODO document this later, and include an example
202+
stopifnot("Must have exactly 2 latent traits" =
203+
extract.mirt(mod_pre, 'nfact') == 2)
204+
if(!missing(postdat))
205+
stop('Only mod_pre and predat are required for multidimensional model')
206+
fs <- fscores(mod_pre, response.pattern=predat, ...)
207+
diff <- fs[,1] - fs[,2]
208+
pse <- sqrt(fs[,3]^2 + fs[,4]^2)
209+
z <- diff/pse
210+
converge <- rep(TRUE, length(z))
211+
converge[attr(fs, 'failed2converge')] <- FALSE
212+
ret <- data.frame(pre.score=fs[,1], post.score=fs[,2],
213+
converged=converge, diff,
214+
SE=pse, z=z,
215+
p=pnorm(abs(z), lower.tail = FALSE)*2)
224216
}
225217
}
226218

0 commit comments

Comments
 (0)