|
29 | 29 | #' @param shiny logical; launch an interactive shiny applications for real-time scoring |
30 | 30 | #' of supplied total-scores or response vectors? Only requires \code{mod_pre} and (optional) |
31 | 31 | #' \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? |
32 | 34 | #' @param main main label to use when \code{shiny=TRUE} |
33 | 35 | #' |
34 | 36 | #' @param ... additional arguments passed to \code{\link{fscores}} |
|
149 | 151 | RCI <- function(mod_pre, predat, postdat, |
150 | 152 | mod_post = mod_pre, cutoffs = NULL, |
151 | 153 | SEM.pre = NULL, SEM.post = NULL, |
152 | | - Fisher = FALSE, |
| 154 | + Fisher = FALSE, zero_cor = TRUE, |
153 | 155 | shiny = FALSE, main = 'Test Scores', ...){ |
154 | 156 |
|
155 | 157 | if(shiny) |
@@ -203,7 +205,11 @@ RCI <- function(mod_pre, predat, postdat, |
203 | 205 | extract.mirt(mod_pre, 'nfact') == 2) |
204 | 206 | if(!missing(postdat)) |
205 | 207 | 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, ...) |
207 | 213 | diff <- fs[,1] - fs[,2] |
208 | 214 | pse <- sqrt(fs[,3]^2 + fs[,4]^2) |
209 | 215 | z <- diff/pse |
|
0 commit comments