Skip to content

Commit d9f4404

Browse files
committed
add flag
1 parent 64882e4 commit d9f4404

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

R/RCI.R

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
#' @param shiny logical; launch an interactive shiny applications for real-time scoring
3030
#' of supplied total-scores or response vectors? Only requires \code{mod_pre} and (optional)
3131
#' \code{mod_post} inputs
32+
#' @param zero_cor logical; when the supplied \code{mod_pre} is a two-factor model
33+
#' should the covariance/correlation between the latent traits be forced to be 0?
3234
#' @param main main label to use when \code{shiny=TRUE}
3335
#'
3436
#' @param ... additional arguments passed to \code{\link{fscores}}
@@ -149,7 +151,7 @@
149151
RCI <- function(mod_pre, predat, postdat,
150152
mod_post = mod_pre, cutoffs = NULL,
151153
SEM.pre = NULL, SEM.post = NULL,
152-
Fisher = FALSE,
154+
Fisher = FALSE, zero_cor = TRUE,
153155
shiny = FALSE, main = 'Test Scores', ...){
154156

155157
if(shiny)
@@ -203,7 +205,11 @@ RCI <- function(mod_pre, predat, postdat,
203205
extract.mirt(mod_pre, 'nfact') == 2)
204206
if(!missing(postdat))
205207
stop('Only mod_pre and predat are required for multidimensional model')
206-
fs <- fscores(mod_pre, response.pattern=predat, ...)
208+
cfs <- coef(mod_pre, simplify=TRUE)
209+
sigma <- cfs$cov
210+
if(zero_cor)
211+
sigma[1,2] <- sigma[2,1] <- 0
212+
fs <- fscores(mod_pre, response.pattern=predat, cov=sigma, ...)
207213
diff <- fs[,1] - fs[,2]
208214
pse <- sqrt(fs[,3]^2 + fs[,4]^2)
209215
z <- diff/pse

man/RCI.Rd

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)