Error(s) in re-building vignettes:
  ...
--- re-building 'irtguide.Rnw' using Sweave
Loading required package: ltm
Loading required package: MASS
Loading required package: msm
Loading required package: polycor
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
kequate
 --- call from context --- 
irtose("CE", dataP, dataQ, 0:15, 0:15, 0:15)
 --- call from argument --- 
if (class(P) %in% c("ConfirmatoryClass", "SingleGroupClass", 
    "ltm")) Plist <- irtinput(P, x, a, robust, model, catsX = catsX, 
    catsA = catsA) else if (is.matrix(P)) {
    if ((length(a) + length(x) - 2) != ncol(P)) 
        return("Unsupported input. Input matrices must have rows denoting individuals and columns denoting items.")
    ltmP <- ltm(P ~ z1, IRT.param = FALSE)
    Plist <- irtinput(ltmP, x, a, robust, model)
}
 --- R stacktrace ---
where 1: irtose("CE", dataP, dataQ, 0:15, 0:15, 0:15)
where 2: eval(expr, .GlobalEnv)
where 3: eval(expr, .GlobalEnv)
where 4: withVisible(eval(expr, .GlobalEnv))
where 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, classes, parentenv, handlers)
where 8: tryCatch(expr, error = function(e) {
    call <- conditionCall(e)
    if (!is.null(call)) {
        if (identical(call[[1L]], quote(doTryCatch))) 
            call <- sys.call(-4L)
        dcall <- deparse(call)[1L]
        prefix <- paste("Error in", dcall, ": ")
        LONG <- 75L
        sm <- strsplit(conditionMessage(e), "\n")[[1L]]
        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")
        if (is.na(w)) 
            w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], 
                type = "b")
        if (w > LONG) 
            prefix <- paste0(prefix, "\n  ")
    }
    else prefix <- "Error : "
    msg <- paste0(prefix, conditionMessage(e), "\n")
    .Internal(seterrmessage(msg[1L]))
    if (!silent && isTRUE(getOption("show.error.messages"))) {
        cat(msg, file = outFile)
        .Internal(printDeferredWarnings())
    }
    invisible(structure(msg, class = "try-error", condition = e))
})
where 9: try(withVisible(eval(expr, .GlobalEnv)), silent = TRUE)
where 10: evalFunc(ce, options)
where 11: tryCatchList(expr, classes, parentenv, handlers)
where 12: tryCatch(evalFunc(ce, options), finally = {
    cat("\n")
    sink()
})
where 13: driver$runcode(drobj, chunk, chunkopts)
where 14: utils::Sweave(...)
where 15: engine$weave(file, quiet = quiet, encoding = enc)
where 16: doTryCatch(return(expr), name, parentenv, handler)
where 17: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 18: tryCatchList(expr, classes, parentenv, handlers)
where 19: tryCatch({
    engine$weave(file, quiet = quiet, encoding = enc)
    setwd(startdir)
    output <- find_vignette_product(name, by = "weave", engine = engine)
    if (!have.makefile && vignette_is_tex(output)) {
        texi2pdf(file = output, clean = FALSE, quiet = quiet)
        output <- find_vignette_product(name, by = "texi2pdf", 
            engine = engine)
    }
}, error = function(e) {
    OK <<- FALSE
    message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s", 
        file, conditionMessage(e)))
})
where 20: tools:::.buildOneVignette("irtguide.Rnw", "/home/hornik/tmp/R.check/r-devel-clang/Work/PKGS/kequate.Rcheck/vign_test/kequate", 
    TRUE, FALSE, "irtguide", "latin-9", "/tmp/RtmpKoRgtt/file17a5522bef22.rds")

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (design = "CE", P, Q, x, y, a = 0, qpoints = seq(-6, 
    6, by = 0.1), model = "2pl", catsX = 0, catsY = 0, catsA = 0, 
    see = "analytical", replications = 199, kernel = "gaussian", 
    h = list(hx = 0, hy = 0, hxP = 0, haP = 0, hyQ = 0, haQ = 0), 
    hlin = list(hxlin = 0, hylin = 0, hxPlin = 0, haPlin = 0, 
        hyQlin = 0, haQlin = 0), KPEN = 0, wpen = 0.5, linear = FALSE, 
    slog = 1, bunif = 1, altopt = FALSE, wS = 0.5, eqcoef = "mean-mean", 
    robust = FALSE, distribution = list("normal", par = data.frame(mu = 0, 
        sigma = 1)), DS = FALSE, CV = FALSE) 
{
    if (design == "CE") {
        if (model == "2pl") {
            if (class(P) %in% c("ConfirmatoryClass", "SingleGroupClass", 
                "ltm")) 
                Plist <- irtinput(P, x, a, robust, model, catsX = catsX, 
                  catsA = catsA)
            else if (is.matrix(P)) {
                if ((length(a) + length(x) - 2) != ncol(P)) 
                  return("Unsupported input. Input matrices must have rows denoting individuals and columns denoting items.")
                ltmP <- ltm(P ~ z1, IRT.param = FALSE)
                Plist <- irtinput(ltmP, x, a, robust, model)
            }
            if (class(Q) %in% c("ConfirmatoryClass", "SingleGroupClass", 
                "ltm")) 
                Qlist <- irtinput(Q, y, a, robust, model, catsX = catsY, 
                  catsA = catsA)
            else if (is.matrix(Q)) {
                if ((length(a) + length(x) - 2) != ncol(Q)) 
                  return("Unsupported input. Input matrices must have rows denoting individuals and columns denoting items.")
                ltmQ <- ltm(Q ~ z1, IRT.param = FALSE)
                Qlist <- irtinput(ltmQ, x, a, robust, model)
            }
            ax <- Plist$ax
            aaP <- Plist$aaP
            bxltm <- Plist$bxltm
            baPltm <- Plist$baPltm
            bx <- Plist$bx
            baP <- Plist$baP
            ltmP <- Plist$ltmP
            P <- Plist$P
            N <- Plist$N
            covalphaP <- Plist$covP
            ay <- Qlist$ax
            aaQ <- Qlist$aaP
            byltm <- Qlist$bxltm
            baQltm <- Qlist$baPltm
            by <- Qlist$bx
            baQ <- Qlist$baP
            ltmQ <- Qlist$ltmP
            Q <- Qlist$P
            M <- Qlist$N
            covalphaQ <- Qlist$covP
        }
        if (model == "3pl") {
            if (class(P) %in% c("ConfirmatoryClass", "SingleGroupClass", 
                "tpm")) 
                Plist <- irtinput(P, x, a, robust, model, catsX = catsX, 
                  catsA = catsA)
            else if (is.matrix(P)) {
                if ((length(a) + length(x) - 2) != ncol(P)) 
                  return("Unsupported input. Input matrices must have rows denoting individuals and columns denoting items.")
                ltmP <- tpm(P, IRT.param = FALSE)
                Plist <- irtinput(ltmP, x, a, robust, model)
            }
            if (class(Q) %in% c("ConfirmatoryClass", "SingleGroupClass", 
                "tpm")) 
                Qlist <- irtinput(Q, y, a, robust, model, catsX = catsY, 
                  catsA = catsA)
            else if (is.matrix(Q)) {
                if ((length(a) + length(x) - 2) != ncol(Q)) 
                  return("Unsupported input. Input matrices must have rows denoting individuals and columns denoting items.")
                ltmQ <- tpm(Q, IRT.param = FALSE)
                Qlist <- irtinput(ltmQ, x, a, robust, model)
            }
            ax <- Plist$ax
            aaP <- Plist$aaP
            bxltm <- Plist$bxltm
            baPltm <- Plist$baPltm
            bx <- Plist$bx
            baP <- Plist$baP
            cx <- Plist$cx
            caP <- Plist$caP
            ltmP <- Plist$ltmP
            if (class(ltmP) %in% c("ConfirmatoryClass", "SingleGroupClass")) {
                cxltm <- cx
                caPltm <- caP
                cx <- exp(cx)/(1 + exp(cx))
                caP <- exp(caP)/(1 + exp(caP))
            }
            P <- Plist$P
            N <- Plist$N
            covalphaP <- Plist$covP
            ay <- Qlist$ax
            aaQ <- Qlist$aaP
            byltm <- Qlist$bxltm
            baQltm <- Qlist$baPltm
            by <- Qlist$bx
            baQ <- Qlist$baP
            cy <- Qlist$cx
            caQ <- Qlist$caP
            ltmQ <- Qlist$ltmP
            if (class(ltmQ) %in% c("ConfirmatoryClass", "SingleGroupClass")) {
                cyltm <- cy
                caQltm <- caQ
                cy <- exp(cy)/(1 + exp(cy))
                caQ <- exp(caQ)/(1 + exp(caQ))
            }
            Q <- Qlist$P
            M <- Qlist$N
            covalphaQ <- Qlist$covP
        }
        if (model == "GPCM") {
            JX <- length(catsX)
            JY <- length(catsY)
            JA <- length(catsA)
            kX <- sum(catsX) - JX
            kY <- sum(catsY) - JY
            kA <- sum(catsA) - JA
            gpcmP <- P
            gpcmQ <- Q
            ax <- numeric(JX)
            ay <- numeric(JY)
            aaP <- numeric(JA)
            aaQ <- numeric(JA)
            bx <- vector("list", JX)
            by <- vector("list", JY)
            baP <- vector("list", JA)
            baQ <- vector("list", JA)
            if (class(gpcmP) == "gpcm" && class(gpcmQ) == "gpcm") {
                if (!P$IRT.param || !Q$IRT.param) 
                  return("Please fit the IRT models using IRT.param = TRUE.")
                if (length(unique(c(catsX, catsA))) == 1) {
                  ax <- coef(gpcmP)[1:JX, catsX[1]]
                  aaP <- coef(gpcmP)[(JX + 1):(JX + JA), catsX[1]]
                  for (i in 1:JX) bx[[i]] <- coef(gpcmP)[i, 1:(catsX[1] - 
                    1)]
                  for (i in (JX + 1):(JX + JA)) baP[[i - JX]] <- coef(gpcmP)[i, 
                    1:(catsX[1] - 1)]
                }
                else {
                  for (i in 1:JX) ax[i] <- coef(gpcmP)[[i]][catsX[i]]
                  for (i in 1:JX) bx[[i]] <- coef(gpcmP)[[i]][1:(catsX[i] - 
                    1)]
                  for (i in (JX + 1):(JX + JA)) aaP[i - JX] <- coef(gpcmP)[[i]][catsA[i - 
                    JX]]
                  for (i in (JX + 1):(JX + JA)) baP[[i - JX]] <- coef(gpcmP)[[i]][1:(catsA[i - 
                    JX] - 1)]
                }
                if (length(unique(c(catsY, catsA))) == 1) {
                  ay <- coef(gpcmQ)[1:JY, catsY[1]]
                  aaQ <- coef(gpcmQ)[(JY + 1):(JY + JA), catsY[1]]
                  for (i in 1:JY) by[[i]] <- coef(gpcmQ)[i, 1:(catsY[1] - 
                    1)]
                  for (i in (JY + 1):(JY + JA)) baQ[[i - JY]] <- coef(gpcmQ)[i, 
                    1:(catsY[1] - 1)]
                }
                else {
                  for (i in 1:JY) ay[i] <- coef(gpcmQ)[[i]][catsY[i]]
                  for (i in 1:JY) by[[i]] <- coef(gpcmQ)[[i]][1:(catsY[i] - 
                    1)]
                  for (i in (JY + 1):(JY + JA)) aaQ[i - JY] <- coef(gpcmQ)[[i]][catsA[i - 
                    JY]]
                  for (i in (JY + 1):(JY + JA)) baQ[[i - JY]] <- coef(gpcmQ)[[i]][1:(catsA[i - 
                    JY] - 1)]
                }
                N <- nrow(gpcmP$X)
                M <- nrow(gpcmQ$X)
                P <- gpcmP$X
                Q <- gpcmQ$X
            }
            if (class(gpcmP) == "SingleGroupClass" && class(gpcmQ) == 
                "SingleGroupClass") {
                parsP <- irtinput(gpcmP, x, a, robust, model, 
                  catsX = catsX, catsA = catsA)
                parsQ <- irtinput(gpcmQ, y, a, robust, model, 
                  catsX = catsY, catsA = catsA)
                ax <- parsP$ax
                bx <- parsP$bx
                aaP <- parsP$aaP
                baP <- parsP$baP
                ay <- parsQ$ax
                by <- parsQ$bx
                aaQ <- parsQ$aaP
                baQ <- parsQ$baP
                N <- parsP$N
                M <- parsQ$N
                P <- parsP$P
                Q <- parsQ$P
            }
            ltmP <- gpcmP
            ltmQ <- gpcmQ
        }
        if (model == "GRM") {
            JX <- length(catsX)
            JY <- length(catsY)
            JA <- length(catsA)
            kX <- sum(catsX) - JX
            kY <- sum(catsY) - JY
            kA <- sum(catsA) - JA
            grmP <- P
            grmQ <- Q
            parsP <- irtinput(grmP, x, a, robust, model, catsX = catsX, 
                catsA = catsA)
            parsQ <- irtinput(grmQ, y, a, robust, model, catsX = catsY, 
                catsA = catsA)
            ax <- parsP$ax
            bx <- parsP$bx
            aaP <- parsP$aaP
            baP <- parsP$baP
            ay <- parsQ$ax
            by <- parsQ$bx
            aaQ <- parsQ$aaP
            baQ <- parsQ$baP
            N <- parsP$N
            M <- parsQ$N
            P <- parsP$P
            Q <- parsQ$P
            ltmP <- grmP
            ltmQ <- grmQ
        }
        if (model == "1pl") {
            irtx <- probpl(qpoints, bx, model)
            irtaP <- probpl(qpoints, baP, model)
            irty <- probpl(qpoints, by, model)
            irtaQ <- probpl(qpoints, baQ, model)
        }
        if (model == "2pl") {
            irtx <- probpl(qpoints, bx, model, a = ax)
            irtaP <- probpl(qpoints, baP, model, a = aaP)
            irty <- probpl(qpoints, by, model, a = ay)
            irtaQ <- probpl(qpoints, baQ, model, a = aaQ)
        }
        if (model == "3pl") {
            irtx <- probpl(qpoints, bx, a = ax, c = cx)
            irtaP <- probpl(qpoints, baP, a = aaP, c = caP)
            irty <- probpl(qpoints, by, a = ay, c = cy)
            irtaQ <- probpl(qpoints, baQ, a = aaQ, c = caQ)
        }
        if (model %in% c("GPCM", "GRM")) {
            irtx <- polyprob(ax, bx, catsX, model, qpoints)
            irty <- polyprob(ay, by, catsY, model, qpoints)
            irtaP <- polyprob(aaP, baP, catsA, model, qpoints)
            irtaQ <- polyprob(aaQ, baQ, catsA, model, qpoints)
        }
        if (model %in% c("1pl", "2pl", "3pl")) {
            rP <- LordWW(irtx, qpoints)
            tP <- LordWW(irtaP, qpoints)
            sQ <- LordWW(irty, qpoints)
            tQ <- LordWW(irtaQ, qpoints)
        }
        if (model %in% c("GRM", "GPCM")) {
            rP <- rowSums(cmnom(catsX, irtx, qpoints))
            tP <- rowSums(cmnom(catsA, irtaP, qpoints))
            sQ <- rowSums(cmnom(catsY, irty, qpoints))
            tQ <- rowSums(cmnom(catsA, irtaQ, qpoints))
        }
        if (kernel == "uniform") {
            ulimit <- (1/(2 * bunif * (1 - 0.61803)))
            KPEN <- 0
        }
        else ulimit <- 4
        meanx <- x %*% rP
        meany <- y %*% sQ
        meanaP <- a %*% tP
        meanaQ <- a %*% tQ
        varx <- (N/(N - 1)) * (x^2 %*% rP - meanx^2)
        vary <- (M/(M - 1)) * (y^2 %*% sQ - meany^2)
        varaP <- (N/(N - 1)) * (a^2 %*% tP - meanaP^2)
        varaQ <- (M/(M - 1)) * (a^2 %*% tQ - meanaQ^2)
        hxPlin <- as.numeric(1000 * sqrt(varx))
        hyQlin <- as.numeric(1000 * sqrt(vary))
        haPlin <- as.numeric(1000 * sqrt(varaP))
        haQlin <- as.numeric(1000 * sqrt(varaQ))
        if (see == "bootstrap") {
            if (model == "2pl") {
                bootsee <- matrix(0, nrow = replications, ncol = length(x))
                for (i in 1:replications) {
                  Pboot <- P[sample(1:N, replace = TRUE), ]
                  Qboot <- Q[sample(1:M, replace = TRUE), ]
                  ltmQboot <- ltm(Pboot ~ z1, IRT.param = FALSE)
                  ltmPboot <- ltm(Qboot ~ z1, IRT.param = FALSE)
                  bootsee[i, ] <- irtoseeq(ltmPboot, ltmQboot, 
                    x, y, a, qpoints, N, M, model, design, kernel, 
                    slog, bunif, KPEN, wpen, linear, altopt, 
                    h = h, hlin = hlin)
                }
            }
            if (model == "3pl") {
                bootsee <- matrix(0, nrow = replications, ncol = length(x))
                for (i in 1:replications) {
                  Pboot <- P[sample(1:N, replace = TRUE), ]
                  Qboot <- Q[sample(1:M, replace = TRUE), ]
                  ltmQboot <- tpm(Pboot, IRT.param = FALSE, control = list(optimizer = "nlminb"))
                  ltmPboot <- tpm(Qboot, IRT.param = FALSE, control = list(optimizer = "nlminb"))
                  bootsee[i, ] <- irtoseeq(ltmPboot, ltmQboot, 
                    x, y, a, qpoints, N, M, model, design, kernel, 
                    slog, bunif, KPEN, wpen, linear, altopt, 
                    h = h, hlin = hlin)
                }
            }
            cdfxP <- cdf(rP, hxP, meanx, varx, kernel, slog, 
                bunif)
            cdfyQ <- cdf(sQ, hyQ, meany, vary, kernel, slog, 
                bunif)
            cdfaP <- cdf(tP, haP, meanaP, varaP, kernel, slog, 
                bunif)
            cdfaQ <- cdf(tQ, haQ, meanaQ, varaQ, kernel, slog, 
                bunif)
            eAx <- eqinvCE(cdfxP, tP, x, a, varaP, meanaP, haP, 
                kernel, slog, bunif)
            cdfeAxQ <- cdfce(tQ, haQ, meanaQ, varaQ, eAx, a, 
                kernel, slog, bunif)
            eYCEeAx <- eqinvCE(cdfeAxQ, sQ, x, y, vary, meany, 
                hyQ, kernel, slog, bunif)
            eYa <- eqinvCE(cdfaQ, sQ, x, y, vary, meany, hyQ, 
                kernel, slog, bunif)
            PREAx <- PREp(eAx, a, rP, tP)
            PREYa <- PREp(eYa, y, tQ, sQ)
            PRE <- data.frame(PREAx, PREYa)
            h <- data.frame(hxP, hyQ, haP, haQ, hxPlin, hyQlin, 
                haPlin, haQlin)
            equating <- data.frame(eqYx = eYCEeAx, SEEYx = apply(bootsee, 
                2, sd))
            out <- new("keout", Pobs = P, Qobs = Q, scores = list(X = data.frame(x, 
                r = rP, cdfx = cdfxP), Y = data.frame(y, s = sQ, 
                cdfy = cdfyQ), A = data.frame(a, tP, cdfaP, tQ, 
                cdfaQ), M = M, N = N), linear = linear, PRE = PRE, 
                h = h, kernel = kernel, type = "IRT-OSE CE", 
                equating = equating, irt = list(ltmP = ltmP, 
                  ltmQ = ltmQ), see = see, replications = replications)
            return(out)
        }
        else {
            if (model == "1pl") {
                pderX <- pderpl(irtx, qpoints, bx, model)
                pderAP <- pderpl(irtaP, qpoints, baP, model)
                pderY <- pderpl(irty, qpoints, by, model)
                pderAQ <- pderpl(irtaQ, qpoints, baQ, model)
            }
            if (model == "2pl") {
                pderX <- pderpl(irtx, qpoints, bx, model, a = ax)
                pderAP <- pderpl(irtaP, qpoints, baP, model, 
                  a = aaP)
                pderY <- pderpl(irty, qpoints, by, model, a = ay)
                pderAQ <- pderpl(irtaQ, qpoints, baQ, model, 
                  a = aaQ)
                adjcovalphaP <- adjltm(covalphaP, pars = list(ax = ax, 
                  aa = aaP, bxltm = bxltm, baltm = baPltm), design, 
                  model = "2pl")
                adjcovalphaQ <- adjltm(covalphaQ, pars = list(ax = ay, 
                  aa = aaQ, bxltm = byltm, baltm = baQltm), design, 
                  model = "2pl")
            }
            if (model == "3pl") {
                pderX <- pderpl(irtx, qpoints, bx, a = ax, c = cx)
                pderAP <- pderpl(irtaP, qpoints, baP, a = aaP, 
                  c = caP)
                pderY <- pderpl(irty, qpoints, by, a = ay, c = cy)
                pderAQ <- pderpl(irtaQ, qpoints, baQ, a = aaQ, 
                  c = caQ)
                adjcovalphaP <- adjltm(covalphaP, pars = list(ax = ax, 
                  aa = aaP, bxltm = bxltm, baltm = baPltm), design, 
                  model = "3pl")
                adjcovalphaQ <- adjltm(covalphaQ, pars = list(ax = ay, 
                  aa = aaQ, bxltm = byltm, baltm = baQltm), design, 
                  model = "3pl")
                if (class(ltmP) %in% c("SingleGroupClass", "ConfirmatoryClass")) {
                  vectadj <- rep(1, 3 * (length(a) + length(x) - 
                    2))
                  vectadj[1:(length(a) + length(x) - 2)] <- exp(c(cxltm, 
                    caPltm))/(1 + exp(c(cxltm, caPltm)))^2
                  adjcovalphaP <- diag(vectadj) %*% adjcovalphaP %*% 
                    t(diag(vectadj))
                  vectadj <- rep(1, 3 * (length(a) + length(y) - 
                    2))
                  vectadj[1:(length(a) + length(y) - 2)] <- exp(c(cyltm, 
                    caQltm))/(1 + exp(c(cyltm, caQltm)))^2
                  adjcovalphaQ <- diag(vectadj) %*% adjcovalphaQ %*% 
                    t(diag(vectadj))
                }
            }
            if (model %in% c("GPCM", "GRM")) {
                pderX <- polypderpl(ax, bx, catsX, irtx, model, 
                  qpoints, qpoints)
                pderAP <- polypderpl(aaP, baP, catsA, irtaP, 
                  model, qpoints, qpoints)
                pderY <- polypderpl(ay, by, catsY, irty, model, 
                  qpoints, qpoints)
                pderAQ <- polypderpl(aaQ, baQ, catsA, irtaQ, 
                  model, qpoints, qpoints)
                pdermatX <- matrix(0, nrow = kX + 1, ncol = sum(catsX))
                pdermatAP <- matrix(0, nrow = kA + 1, ncol = sum(catsA))
                pdermatY <- matrix(0, nrow = kY + 1, ncol = sum(catsY))
                pdermatAQ <- matrix(0, nrow = kA + 1, ncol = sum(catsA))
                for (i in 1:(kX + 1)) {
                  pdermatX[i, 1:catsX[1]] <- pderX[[i]][[1]]
                  for (j in 2:JX) {
                    pdermatX[i, (sum(catsX[1:(j - 1)]) + 1):sum(catsX[1:j])] <- pderX[[i]][[j]]
                  }
                }
                for (i in 1:(kA + 1)) {
                  pdermatAP[i, 1:catsA[1]] <- pderAP[[i]][[1]]
                  if (JA > 1) {
                    for (j in 2:JA) {
                      pdermatAP[i, (sum(catsA[1:(j - 1)]) + 1):sum(catsA[1:j])] <- pderAP[[i]][[j]]
                    }
                  }
                }
                for (i in 1:(kY + 1)) {
                  pdermatY[i, 1:catsY[1]] <- pderY[[i]][[1]]
                  for (j in 2:JY) {
                    pdermatY[i, (sum(catsY[1:(j - 1)]) + 1):sum(catsY[1:j])] <- pderY[[i]][[j]]
                  }
                }
                for (i in 1:(kA + 1)) {
                  pdermatAQ[i, 1:catsA[1]] <- pderAQ[[i]][[1]]
                  if (JA > 1) {
                    for (j in 2:JA) {
                      pdermatAQ[i, (sum(catsA[1:(j - 1)]) + 1):sum(catsA[1:j])] <- pderAQ[[i]][[j]]
                    }
                  }
                }
                if (model == "GPCM") {
                  if (class(ltmP) == "gpcm" && class(ltmQ) == 
                    "gpcm") {
                    covalphaP <- vcov.gpcm(ltmP, robust = robust)
                    covalphaQ <- vcov.gpcm(ltmQ, robust = robust)
                    adjcovalphaP <- covalphaP
                    adjcovalphaQ <- covalphaQ
                  }
                  if (class(ltmP) == "SingleGroupClass" && class(ltmQ) == 
                    "SingleGroupClass") {
                    covalphaP <- extract.mirt(ltmP, "vcov")
                    covalphaQ <- extract.mirt(ltmQ, "vcov")
                    adjderP <- adjgpcmmirt(ltmP)
                    adjderQ <- adjgpcmmirt(ltmQ)
                    adjcovalphaP <- t(adjderP) %*% covalphaP %*% 
                      adjderP
                    adjcovalphaQ <- t(adjderQ) %*% covalphaQ %*% 
                      adjderQ
                  }
                }
                if (model == "GRM") {
                  covalphaP <- extract.mirt(grmP, "vcov")
                  covalphaQ <- extract.mirt(grmQ, "vcov")
                  adjderP <- adjgrmmirt(grmP)
                  adjderQ <- adjgrmmirt(grmQ)
                  adjcovalphaP <- t(adjderP) %*% covalphaP %*% 
                    adjderP
                  adjcovalphaQ <- t(adjderQ) %*% covalphaQ %*% 
                    adjderQ
                }
            }
        }
        adjcovalphaPQ <- cbind(rbind(adjcovalphaP, matrix(0, 
            nrow = nrow(adjcovalphaQ), ncol = ncol(adjcovalphaP))), 
            rbind(matrix(0, nrow = nrow(adjcovalphaP), ncol = ncol(adjcovalphaQ)), 
                adjcovalphaQ))
        kX <- length(x) - 1
        kA <- length(a) - 1
        kY <- length(y) - 1
        kA <- length(a) - 1
        if (model == "2pl") {
            Jalpha <- matrix(0, nrow = 2 * (kY + 2 * kA + kX), 
                ncol = (kX + 2 * kA + kY + 4))
            Jalpha[1:kX, 1:(kX + 1)] <- pderX[1:kX, ]
            Jalpha[(kX + 1):(kX + kA), (kX + 2):(kX + kA + 2)] <- pderAP[1:kA, 
                ]
            Jalpha[(kX + kA + 1):(2 * kX + kA), 1:(kX + 1)] <- pderX[(kX + 
                1):(2 * kX), ]
            Jalpha[(2 * kX + kA + 1):(2 * kX + 2 * kA), (kX + 
                2):(kX + kA + 2)] <- pderAP[(kA + 1):(2 * kA), 
                ]
            Jalpha[(2 * kX + 2 * kA + 1):(2 * kX + 2 * kA + kY), 
                (kX + kA + 3):(kX + kA + kY + 3)] <- pderY[1:kY, 
                ]
            Jalpha[(2 * kX + 2 * kA + kY + 1):(2 * kX + 3 * kA + 
                kY), (kX + kA + kY + 4):(kX + 2 * kA + kY + 4)] <- pderAQ[1:kA, 
                ]
            Jalpha[(2 * kX + 3 * kA + kY + 1):(2 * kX + 3 * kA + 
                2 * kY), (kX + kA + 3):(kX + kA + kY + 3)] <- pderY[(kY + 
                1):(2 * kY), ]
            Jalpha[(2 * kX + 3 * kA + 2 * kY + 1):(2 * kX + 4 * 
                kA + 2 * kY), (kX + kA + kY + 4):(kX + 2 * kA + 
                kY + 4)] <- pderAQ[(kA + 1):(2 * kA), ]
        }
        if (model == "3pl") {
            Jalpha <- matrix(0, nrow = 3 * (kY + 2 * kA + kX), 
                ncol = (kX + 2 * kA + kY + 4))
            Jalpha[1:kX, 1:(kX + 1)] <- pderX[1:kX, ]
            Jalpha[(kX + 1):(kX + kA), (kX + 2):(kX + kA + 2)] <- pderAP[1:kA, 
                ]
            Jalpha[(kX + kA + 1):(2 * kX + kA), 1:(kX + 1)] <- pderX[(kX + 
                1):(2 * kX), ]
            Jalpha[(2 * kX + kA + 1):(2 * kX + 2 * kA), (kX + 
                2):(kX + kA + 2)] <- pderAP[(kA + 1):(2 * kA), 
                ]
            Jalpha[(2 * kX + 2 * kA + 1):(3 * kX + 2 * kA), 1:(kX + 
                1)] <- pderX[(2 * kX + 1):(3 * kX), ]
            Jalpha[(3 * kX + 2 * kA + 1):(3 * kX + 3 * kA), (kX + 
                2):(kX + kA + 2)] <- pderAP[(2 * kA + 1):(3 * 
                kA), ]
            Jalpha[(3 * kX + 3 * kA + 1):(3 * kX + 3 * kA + kY), 
                (kX + kA + 3):(kX + kA + kY + 3)] <- pderY[1:kY, 
                ]
            Jalpha[(3 * kX + 3 * kA + kY + 1):(3 * kX + 4 * kA + 
                kY), (kX + kA + kY + 4):(kX + 2 * kA + kY + 4)] <- pderAQ[1:kA, 
                ]
            Jalpha[(3 * kX + 4 * kA + kY + 1):(3 * kX + 4 * kA + 
                2 * kY), (kX + kA + 3):(kX + kA + kY + 3)] <- pderY[(kY + 
                1):(2 * kY), ]
            Jalpha[(3 * kX + 4 * kA + 2 * kY + 1):(3 * kX + 5 * 
                kA + 2 * kY), (kX + kA + kY + 4):(kX + 2 * kA + 
                kY + 4)] <- pderAQ[(kA + 1):(2 * kA), ]
            Jalpha[(3 * kX + 5 * kA + 2 * kY + 1):(3 * kX + 5 * 
                kA + 3 * kY), (kX + kA + 3):(kX + kA + kY + 3)] <- pderY[(2 * 
                kY + 1):(3 * kY), ]
            Jalpha[(3 * kX + 5 * kA + 3 * kY + 1):(3 * kX + 6 * 
                kA + 3 * kY), (kX + kA + kY + 4):(kX + 2 * kA + 
                kY + 4)] <- pderAQ[(2 * kA + 1):(3 * kA), ]
        }
        if (model %in% c("GPCM", "GRM")) {
            Jalpha <- matrix(0, nrow = (kX + 2 * kA + kY + 4), 
                ncol = sum(catsX) + sum(catsY) + 2 * sum(catsA))
            Jalpha[1:(kX + 1), 1:(sum(catsX))] <- pdermatX
            Jalpha[(kX + 2):(kX + kA + 2), (sum(catsX) + 1):(sum(catsX) + 
                sum(catsA))] <- pdermatAP
            Jalpha[(kX + kA + 3):(kX + kA + kY + 3), (sum(catsX) + 
                sum(catsA) + 1):(sum(catsX) + sum(catsA) + sum(catsY))] <- pdermatY
            Jalpha[(kX + kA + kY + 4):(kX + 2 * kA + kY + 4), 
                (sum(catsX) + sum(catsA) + sum(catsY) + 1):(sum(catsX) + 
                  2 * sum(catsA) + sum(catsY))] <- pdermatAQ
            Jalpha <- t(Jalpha)
        }
        covrtst <- t(Jalpha) %*% adjcovalphaPQ %*% Jalpha
        covrP <- covrtst[1:(kX + 1), 1:(kX + 1)]
        covtP <- covrtst[(kX + 2):(kX + kA + 2), (kX + 2):(kX + 
            kA + 2)]
        covsQ <- covrtst[(kX + kA + 3):(kX + kA + kY + 3), (kX + 
            kA + 3):(kX + kA + kY + 3)]
        covtQ <- covrtst[(kX + kA + kY + 4):(kX + 2 * kA + kY + 
            4), (kX + kA + kY + 4):(kX + 2 * kA + kY + 4)]
        input <- vector("list", 4)
        input[[1]] <- list(rP, x, N, covrP)
        input[[2]] <- list(tP, a, N, covtP)
        input[[3]] <- list(sQ, y, M, covsQ)
        input[[4]] <- list(tQ, a, M, covtQ)
        if (h$hxP == 0 && h$haP == 0 && h$hyQ == 0 && h$haQ == 
            0) {
            if (linear == T) 
                bandwidth <- "linear"
            if (linear == F && DS == F) 
                bandwidth <- "PEN"
            if (linear == F && DS == T) 
                bandwidth <- "DS"
            if (linear == F && CV == T) 
                bandwidth <- "CV"
            if (linear == F && DS == F && CV == T && altopt == 
                T) 
                bandwidth <- "altopt"
            hxhy <- bandwidth.select(input, bandwidth = bandwidth, 
                KPEN = KPEN)
            hxP <- hxhy[1]
            haP <- hxhy[2]
            hyQ <- hxhy[3]
            haQ <- hxhy[4]
        }
        else {
            hxP <- h$hxP
            haP <- h$haP
            hyQ <- h$hyQ
            haQ <- h$haP
        }
        cdfxP <- cdf(rP, hxP, meanx, varx, kernel, slog, bunif)
        cdfyQ <- cdf(sQ, hyQ, meany, vary, kernel, slog, bunif)
        cdfaP <- cdf(tP, haP, meanaP, varaP, kernel, slog, bunif)
        cdfaQ <- cdf(tQ, haQ, meanaQ, varaQ, kernel, slog, bunif)
        eAx <- eqinvCE(cdfxP, tP, x, a, varaP, meanaP, haP, kernel, 
            slog, bunif)
        cdfeAxQ <- cdfce(tQ, haQ, meanaQ, varaQ, eAx, a, kernel, 
            slog, bunif)
        eYCEeAx <- eqinvCE(cdfeAxQ, sQ, x, y, vary, meany, hyQ, 
            kernel, slog, bunif)
        eAy <- eqinvCE(cdfyQ, tQ, x, a, varaQ, meanaQ, haQ, kernel, 
            slog, bunif)
        cdfeAyP <- cdfce(tP, haP, meanaP, varaP, eAy, a, kernel, 
            slog, bunif)
        eXCEeAy <- eqinvCE(cdfeAyP, rP, x, x, varx, meanx, hxP, 
            kernel, slog, bunif)
        FprimeA <- densityeq(rP, hxP, varx, meanx, x, x, kernel, 
            slog, bunif)
        HpprimeA <- densityeq(tP, haP, varaP, meanaP, eAx, a, 
            kernel, slog, bunif)
        HqprimeY <- densityeq(tQ, haQ, varaQ, meanaQ, eAx, a, 
            kernel, slog, bunif)
        GprimeY <- densityeq(sQ, hyQ, vary, meany, eYCEeAx, y, 
            kernel, slog, bunif)
        GprimeA <- densityeq(sQ, hyQ, vary, meany, y, y, kernel, 
            slog, bunif)
        HqprimeA <- densityeq(tQ, haQ, varaQ, meanaQ, eAy, a, 
            kernel, slog, bunif)
        if (altopt) {
            altFprimeA <- altoptdensity(rP, hxP, varx, meanx, 
                x, x)
            altHpprimeA <- altoptdensity(tP, haP, varaP, meanaP, 
                eAx, a)
            altHqprimeY <- altoptdensity(tQ, haQ, varaQ, meanaQ, 
                eAx, a)
            altGprimeY <- altoptdensity(sQ, hyQ, vary, meany, 
                eYCEeAx, y)
            altGprimeA <- altoptdensity(sQ, hyQ, vary, meany, 
                y, y)
            altHqprimeA <- altoptdensity(tQ, haQ, varaQ, meanaQ, 
                eAy, a)
            dFdrPeA <- dFdr(rP, hxP, varx, meanx, FprimeA, x, 
                x, kernel, slog, bunif, altopt = altopt, altfprim = altFprimeA)
            dHpdtPeA <- dFdr(tP, haP, varaP, meanaP, HpprimeA, 
                eAx, a, kernel, slog, bunif, altopt = altopt, 
                altfprim = altHpprimeA)
            dHqdteY <- dFdr(tQ, haQ, varaQ, meanaQ, HqprimeY, 
                eAx, a, kernel, slog, bunif, altopt = altopt, 
                altfprim = altHqprimeY)
            dGdseY <- dFdr(sQ, hyQ, vary, meany, GprimeY, eYCEeAx, 
                y, kernel, slog, bunif, altopt = altopt, altfprim = altGprimeY)
            dGdsQeA <- dFdr(sQ, hyQ, vary, meany, GprimeA, y, 
                y, kernel, slog, bunif, altopt = altopt, altfprim = altGprimeA)
            dHqdtPeA <- dFdr(tQ, haQ, varaQ, meanaQ, HqprimeA, 
                eAy, a, kernel, slog, bunif, altopt = altopt, 
                altfprim = altHqprimeA)
        }
        else {
            dFdrPeA <- dFdr(rP, hxP, varx, meanx, FprimeA, x, 
                x, kernel, slog, bunif)
            dHpdtPeA <- dFdr(tP, haP, varaP, meanaP, HpprimeA, 
                eAx, a, kernel, slog, bunif)
            dHqdteY <- dFdr(tQ, haQ, varaQ, meanaQ, HqprimeY, 
                eAx, a, kernel, slog, bunif)
            dGdseY <- dFdr(sQ, hyQ, vary, meany, GprimeY, eYCEeAx, 
                y, kernel, slog, bunif)
            dGdsQeA <- dFdr(sQ, hyQ, vary, meany, GprimeA, y, 
                y, kernel, slog, bunif)
            dHqdtPeA <- dFdr(tQ, haQ, varaQ, meanaQ, HqprimeA, 
                eAy, a, kernel, slog, bunif)
        }
        JeA <- matrix(0, nrow = length(x), ncol = (length(x) + 
            length(a)))
        JeA[, 1:length(x)] <- dFdrPeA
        JeA[, (length(x) + 1):(length(x) + length(a))] <- (-dHpdtPeA)
        JeA <- (HqprimeY/GprimeY) * (1/HpprimeA) * JeA
        JeY <- matrix(0, nrow = length(x), ncol = (length(y) + 
            length(a)))
        JeY[, 1:(length(y))] <- (-dGdseY)
        JeY[, (length(y) + 1):(length(y) + length(a))] <- dHqdteY
        JeY <- (1/GprimeY) * JeY
        JeYCE <- matrix(0, nrow = length(x), ncol = (length(x) + 
            2 * length(a) + length(y)))
        JeYCE[, 1:(length(x) + length(a))] <- JeA
        JeYCE[, (length(x) + length(a) + 1):(length(x) + 2 * 
            length(a) + length(y))] <- JeY
        eYa <- eqinvCE(cdfaQ, sQ, x, y, vary, meany, hyQ, kernel, 
            slog, bunif)
        PREAx <- PREp(eAx, a, rP, tP)
        PREYa <- PREp(eYa, y, tQ, sQ)
        PRE <- data.frame(PREAx, PREYa)
        h <- data.frame(hxP, hyQ, haP, haQ, hxPlin, hyQlin, haPlin, 
            haQlin)
        adjcovalphaPQ <- cbind(rbind(adjcovalphaP, matrix(0, 
            nrow = nrow(adjcovalphaQ), ncol = ncol(adjcovalphaP))), 
            rbind(matrix(0, nrow = nrow(adjcovalphaP), ncol = ncol(adjcovalphaQ)), 
                adjcovalphaQ))
        kX <- length(x) - 1
        kA <- length(a) - 1
        kY <- length(y) - 1
        kA <- length(a) - 1
        if (model == "2pl") {
            Jalpha <- matrix(0, nrow = 2 * (kY + 2 * kA + kX), 
                ncol = (kX + 2 * kA + kY + 4))
            Jalpha[1:kX, 1:(kX + 1)] <- pderX[1:kX, ]
            Jalpha[(kX + 1):(kX + kA), (kX + 2):(kX + kA + 2)] <- pderAP[1:kA, 
                ]
            Jalpha[(kX + kA + 1):(2 * kX + kA), 1:(kX + 1)] <- pderX[(kX + 
                1):(2 * kX), ]
            Jalpha[(2 * kX + kA + 1):(2 * kX + 2 * kA), (kX + 
                2):(kX + kA + 2)] <- pderAP[(kA + 1):(2 * kA), 
                ]
            Jalpha[(2 * kX + 2 * kA + 1):(2 * kX + 2 * kA + kY), 
                (kX + kA + 3):(kX + kA + kY + 3)] <- pderY[1:kY, 
                ]
            Jalpha[(2 * kX + 2 * kA + kY + 1):(2 * kX + 3 * kA + 
                kY), (kX + kA + kY + 4):(kX + 2 * kA + kY + 4)] <- pderAQ[1:kA, 
                ]
            Jalpha[(2 * kX + 3 * kA + kY + 1):(2 * kX + 3 * kA + 
                2 * kY), (kX + kA + 3):(kX + kA + kY + 3)] <- pderY[(kY + 
                1):(2 * kY), ]
            Jalpha[(2 * kX + 3 * kA + 2 * kY + 1):(2 * kX + 4 * 
                kA + 2 * kY), (kX + kA + kY + 4):(kX + 2 * kA + 
                kY + 4)] <- pderAQ[(kA + 1):(2 * kA), ]
        }
        if (model == "3pl") {
            Jalpha <- matrix(0, nrow = 3 * (kY + 2 * kA + kX), 
                ncol = (kX + 2 * kA + kY + 4))
            Jalpha[1:kX, 1:(kX + 1)] <- pderX[1:kX, ]
            Jalpha[(kX + 1):(kX + kA), (kX + 2):(kX + kA + 2)] <- pderAP[1:kA, 
                ]
            Jalpha[(kX + kA + 1):(2 * kX + kA), 1:(kX + 1)] <- pderX[(kX + 
                1):(2 * kX), ]
            Jalpha[(2 * kX + kA + 1):(2 * kX + 2 * kA), (kX + 
                2):(kX + kA + 2)] <- pderAP[(kA + 1):(2 * kA), 
                ]
            Jalpha[(2 * kX + 2 * kA + 1):(3 * kX + 2 * kA), 1:(kX + 
                1)] <- pderX[(2 * kX + 1):(3 * kX), ]
            Jalpha[(3 * kX + 2 * kA + 1):(3 * kX + 3 * kA), (kX + 
                2):(kX + kA + 2)] <- pderAP[(2 * kA + 1):(3 * 
                kA), ]
            Jalpha[(3 * kX + 3 * kA + 1):(3 * kX + 3 * kA + kY), 
                (kX + kA + 3):(kX + kA + kY + 3)] <- pderY[1:kY, 
                ]
            Jalpha[(3 * kX + 3 * kA + kY + 1):(3 * kX + 4 * kA + 
                kY), (kX + kA + kY + 4):(kX + 2 * kA + kY + 4)] <- pderAQ[1:kA, 
                ]
            Jalpha[(3 * kX + 4 * kA + kY + 1):(3 * kX + 4 * kA + 
                2 * kY), (kX + kA + 3):(kX + kA + kY + 3)] <- pderY[(kY + 
                1):(2 * kY), ]
            Jalpha[(3 * kX + 4 * kA + 2 * kY + 1):(3 * kX + 5 * 
                kA + 2 * kY), (kX + kA + kY + 4):(kX + 2 * kA + 
                kY + 4)] <- pderAQ[(kA + 1):(2 * kA), ]
            Jalpha[(3 * kX + 5 * kA + 2 * kY + 1):(3 * kX + 5 * 
                kA + 3 * kY), (kX + kA + 3):(kX + kA + kY + 3)] <- pderY[(2 * 
                kY + 1):(3 * kY), ]
            Jalpha[(3 * kX + 5 * kA + 3 * kY + 1):(3 * kX + 6 * 
                kA + 3 * kY), (kX + kA + kY + 4):(kX + 2 * kA + 
                kY + 4)] <- pderAQ[(2 * kA + 1):(3 * kA), ]
        }
        if (model %in% c("GPCM", "GRM")) {
            Jalpha <- matrix(0, nrow = (kX + 2 * kA + kY + 4), 
                ncol = sum(catsX) + sum(catsY) + 2 * sum(catsA))
            Jalpha[1:(kX + 1), 1:(sum(catsX))] <- pdermatX
            Jalpha[(kX + 2):(kX + kA + 2), (sum(catsX) + 1):(sum(catsX) + 
                sum(catsA))] <- pdermatAP
            Jalpha[(kX + kA + 3):(kX + kA + kY + 3), (sum(catsX) + 
                sum(catsA) + 1):(sum(catsX) + sum(catsA) + sum(catsY))] <- pdermatY
            Jalpha[(kX + kA + kY + 4):(kX + 2 * kA + kY + 4), 
                (sum(catsX) + sum(catsA) + sum(catsY) + 1):(sum(catsX) + 
                  2 * sum(catsA) + sum(catsY))] <- pdermatAQ
            Jalpha <- t(Jalpha)
        }
        pdereqYx <- JeYCE %*% t(Jalpha)
        coveqYx <- pdereqYx %*% adjcovalphaPQ %*% t(pdereqYx)
        output <- data.frame(eqYx = eYCEeAx, SEEYx = sqrt(diag(coveqYx)))
        out <- new("keout", coveqYx = coveqYx, pdereqYx = pdereqYx, 
            Pobs = P, Qobs = Q, scores = list(X = data.frame(x, 
                r = rP, cdfx = cdfxP), Y = data.frame(y, s = sQ, 
                cdfy = cdfyQ), A = data.frame(a, tP, cdfaP, tQ, 
                cdfaQ), M = M, N = N, covrs = t(Jalpha) %*% adjcovalphaPQ %*% 
                (Jalpha)), linear = linear, PRE = PRE, h = h, 
            kernel = kernel, type = "IRT-OSE CE", equating = output, 
            irt = list(covalphaP = adjcovalphaP, covalphaQ = adjcovalphaQ, 
                ltmP = ltmP, ltmQ = ltmQ), see = see)
        return(out)
    }
    if (design == "EG") {
        if (model == "2pl") {
            nX <- length(x) - 1
            nY <- length(y) - 1
            if ("ltm" %in% class(P)) {
                bx <- as.numeric(coef.ltm(P)[, 1])[1:(length(x) - 
                  1)]
                ax <- as.numeric(coef.ltm(P)[, 2])[1:(length(x) - 
                  1)]
                if (P$IRT.param) {
                  bxltm <- -ax * bx
                }
                else {
                  bxltm <- bx
                  bx <- -bxltm/ax
                }
                N <- dim(P$X)[1]
                ltmP <- P
                P <- ltmP$X
                covalphaP <- vcov.ltm(ltmP, robust = robust)
            }
            else {
                if (class(P) %in% c("SingleGroupClass", "ConfirmatoryClass")) {
                  myspP <- extract.mirt(P, "parvec")
                  bx <- myspP[seq(2, 2 * nX, by = 2)]
                  ax <- myspP[seq(1, 2 * nX, by = 2)]
                  mycovP <- extract.mirt(P, "vcov")
                  upmat <- cbind(mycovP[seq(2, 2 * nX, by = 2), 
                    seq(2, 2 * nX, by = 2)], mycovP[seq(2, 2 * 
                    nX, by = 2), seq(1, 2 * nX, by = 2)])
                  lowmat <- cbind(mycovP[seq(2, 2 * nX, by = 2), 
                    seq(1, 2 * nX, by = 2)], mycovP[seq(1, 2 * 
                    nX, by = 2), seq(1, 2 * nX, by = 2)])
                  covP <- rbind(upmat, lowmat)
                  bxltm <- bx
                  bx <- -bxltm/ax
                  dataP <- extract.mirt(P, "data")
                  N <- nrow(dataP)
                  ltmP <- P
                  P <- dataP
                  covalphaP <- covP
                }
                else {
                  if (is.matrix(P)) {
                    if ((length(x) - 1) != ncol(P)) 
                      return("Unsupported input. Input matrices must have rows denoting individuals and columns denoting items.")
                    ltmP <- ltm(P ~ z1, IRT.param = FALSE)
                    bx <- as.numeric(coef.ltm(ltmP)[, 1])[1:(length(x) - 
                      1)]
                    ax <- as.numeric(coef.ltm(ltmP)[, 2])[1:(length(x) - 
                      1)]
                    bxltm <- bx
                    bx <- -bxltm/ax
                    N <- dim(P)[1]
                    covalphaP <- vcov.ltm(ltmP, robust = robust)
                  }
                  else {
                    return("Unsupported input. P must be either an object created by the package ltm or a matrix of responses.")
                  }
                }
            }
            if ("ltm" %in% class(Q)) {
                by <- as.numeric(coef.ltm(Q)[, 1])[1:(length(y) - 
                  1)]
                ay <- as.numeric(coef.ltm(Q)[, 2])[1:(length(y) - 
                  1)]
                if (Q$IRT.param) {
                  byltm <- -ay * by
                }
                else {
                  byltm <- by
                  by <- -byltm/ay
                }
                M <- dim(Q$X)[1]
                ltmQ <- Q
                Q <- ltmQ$X
            }
            else {
                if (class(Q) %in% c("SingleGroupClass", "ConfirmatoryClass")) {
                  myspQ <- extract.mirt(Q, "parvec")
                  by <- myspQ[seq(2, 2 * nY, by = 2)]
                  ay <- myspQ[seq(1, 2 * nY, by = 2)]
                  mycovQ <- extract.mirt(Q, "vcov")
                  upmat <- cbind(mycovQ[seq(2, 2 * nY, by = 2), 
                    seq(2, 2 * nY, by = 2)], mycovQ[seq(2, 2 * 
                    nY, by = 2), seq(1, 2 * nY, by = 2)])
                  lowmat <- cbind(mycovQ[seq(2, 2 * nY, by = 2), 
                    seq(1, 2 * nY, by = 2)], mycovQ[seq(1, 2 * 
                    nY, by = 2), seq(1, 2 * nY, by = 2)])
                  covQ <- rbind(upmat, lowmat)
                  byltm <- by
                  by <- -byltm/ay
                  dataQ <- extract.mirt(Q, "data")
                  M <- nrow(dataQ)
                  ltmQ <- Q
                  Q <- dataQ
                  covalphaQ <- covQ
                }
                else {
                  return("Unsupported input. P must be either an object created by the package ltm or a matrix of responses.")
                }
            }
            irtx <- probpl(qpoints, bx, model, a = ax)
            irty <- probpl(qpoints, by, model, a = ay)
        }
        if (model == "3pl") {
            nX <- length(x) - 1
            nY <- length(y) - 1
            if ("tpm" %in% class(P)) {
                cx <- as.numeric(coef.tpm(P)[, 1])[1:(length(x) - 
                  1)]
                bx <- as.numeric(coef.tpm(P)[, 2])[1:(length(x) - 
                  1)]
                ax <- as.numeric(coef.tpm(P)[, 3])[1:(length(x) - 
                  1)]
                if (P$IRT.param) {
                  bxltm <- -ax * bx
                }
                else {
                  bxltm <- bx
                  bx <- -bxltm/ax
                }
                N <- dim(P$X)[1]
                ltmP <- P
                P <- ltmP$X
                covalphaP <- vcov.ltm(ltmP, robust = robust)
            }
            else {
                if (class(P) %in% c("SingleGroupClass", "ConfirmatoryClass")) {
                  myspP <- extract.mirt(P, "parvec")
                  ax <- myspP[seq(1, 3 * nX, by = 3)]
                  bx <- myspP[seq(2, 3 * nX, by = 3)]
                  cx <- myspP[seq(3, 3 * nX, by = 3)]
                  mycovP <- extract.mirt(P, "vcov")
                  upmat <- cbind(mycovP[seq(3, 3 * nX, by = 3), 
                    seq(3, 3 * nX, by = 3)], mycovP[seq(3, 3 * 
                    nX, by = 3), seq(2, 3 * nX, by = 3)], mycovP[seq(3, 
                    3 * nX, by = 3), seq(1, 3 * nX, by = 3)])
                  midmat <- cbind(mycovP[seq(2, 3 * nX, by = 3), 
                    seq(3, 3 * nX, by = 3)], mycovP[seq(2, 3 * 
                    nX, by = 3), seq(2, 3 * nX, by = 3)], mycovP[seq(2, 
                    3 * nX, by = 3), seq(1, 3 * nX, by = 3)])
                  lowmat <- cbind(mycovP[seq(1, 3 * nX, by = 3), 
                    seq(3, 3 * nX, by = 3)], mycovP[seq(1, 3 * 
                    nX, by = 3), seq(2, 3 * nX, by = 3)], mycovP[seq(1, 
                    3 * nX, by = 3), seq(1, 3 * nX, by = 3)])
                  covP <- rbind(upmat, midmat, lowmat)
                  bxltm <- bx
                  bx <- -bxltm/ax
                  cxltm <- cx
                  cx <- exp(cx)/(1 + exp(cx))
                  dataP <- extract.mirt(P, "data")
                  N <- nrow(dataP)
                  ltmP <- P
                  P <- dataP
                  covalphaP <- covP
                }
                else {
                  if (is.matrix(P)) {
                    if ((length(x) - 1) != ncol(P)) 
                      return("Unsupported input. Input matrices must have rows denoting individuals and columns denoting items.")
                    ltmP <- ltm(P ~ z1, IRT.param = FALSE)
                    cx <- as.numeric(coef.tpm(ltmP)[, 1])[1:(length(x) - 
                      1)]
                    bx <- as.numeric(coef.tpm(ltmP)[, 2])[1:(length(x) - 
                      1)]
                    ax <- as.numeric(coef.tpm(ltmP)[, 3])[1:(length(x) - 
                      1)]
                    bxltm <- bx
                    bx <- -bxltm/ax
                    N <- dim(P)[1]
                    covalphaP <- vcov.ltm(ltmP, robust = robust)
                  }
                  else {
                    return("Unsupported input. P must be either an object created by the package ltm or a matrix of responses.")
                  }
                }
            }
            if ("tpm" %in% class(Q)) {
                cy <- as.numeric(coef.tpm(Q)[, 1])[1:(length(y) - 
                  1)]
                by <- as.numeric(coef.tpm(Q)[, 2])[1:(length(y) - 
                  1)]
                ay <- as.numeric(coef.tpm(Q)[, 3])[1:(length(y) - 
                  1)]
                if (Q$IRT.param) {
                  byltm <- -ay * by
                }
                else {
                  byltm <- by
                  by <- -byltm/ay
                }
                M <- dim(Q$X)[1]
                ltmP <- Q
                Q <- ltmP$X
                covalphaQ <- vcov.ltm(ltmQ, robust = robust)
            }
            else {
                if (class(Q) %in% c("SingleGroupClass", "ConfirmatoryClass")) {
                  myspQ <- extract.mirt(Q, "parvec")
                  ay <- myspQ[seq(1, 3 * nY, by = 3)]
                  by <- myspQ[seq(2, 3 * nY, by = 3)]
                  cy <- myspQ[seq(3, 3 * nY, by = 3)]
                  mycovQ <- extract.mirt(Q, "vcov")
                  upmat <- cbind(mycovQ[seq(3, 3 * nY, by = 3), 
                    seq(3, 3 * nY, by = 3)], mycovQ[seq(3, 3 * 
                    nY, by = 3), seq(2, 3 * nY, by = 3)], mycovQ[seq(3, 
                    3 * nY, by = 3), seq(1, 3 * nY, by = 3)])
                  midmat <- cbind(mycovQ[seq(2, 3 * nY, by = 3), 
                    seq(3, 3 * nY, by = 3)], mycovQ[seq(2, 3 * 
                    nY, by = 3), seq(2, 3 * nY, by = 3)], mycovQ[seq(2, 
                    3 * nY, by = 3), seq(1, 3 * nY, by = 3)])
                  lowmat <- cbind(mycovQ[seq(1, 3 * nY, by = 3), 
                    seq(3, 3 * nY, by = 3)], mycovQ[seq(1, 3 * 
                    nY, by = 3), seq(2, 3 * nY, by = 3)], mycovQ[seq(1, 
                    3 * nY, by = 3), seq(1, 3 * nY, by = 3)])
                  covQ <- rbind(upmat, midmat, lowmat)
                  byltm <- by
                  by <- -byltm/ay
                  cyltm <- cy
                  cy <- exp(cy)/(1 + exp(cy))
                  dataQ <- extract.mirt(Q, "data")
                  M <- nrow(dataQ)
                  ltmQ <- Q
                  Q <- dataQ
                  covalphaQ <- covQ
                }
                else {
                  if (is.matrix(Q)) {
                    if ((length(y) - 1) != ncol(Q)) 
                      return("Unsupported input. Input matrices must have rows denoting individuals and columns denoting items.")
                    ltmQ <- ltm(Q ~ z1, IRT.param = FALSE)
                    cy <- as.numeric(coef.tpm(ltmQ)[, 1])[1:(length(y) - 
                      1)]
                    by <- as.numeric(coef.tpm(ltmQ)[, 2])[1:(length(y) - 
                      1)]
                    ay <- as.numeric(coef.tpm(ltmQ)[, 3])[1:(length(y) - 
                      1)]
                    byltm <- by
                    by <- -byltm/ay
                    M <- dim(Q)[1]
                    covalphaQ <- vcov.ltm(ltmQ, robust = robust)
                  }
                  else {
                    return("Unsupported input. P must be either an object created by the package ltm or a matrix of responses.")
                  }
                }
            }
            irtx <- probpl(qpoints, bx, model, a = ax)
            irty <- probpl(qpoints, by, model, a = ay)
        }
        if (model == "GPCM") {
            JX <- length(catsX)
            JY <- length(catsY)
            kX <- sum(catsX) - JX
            kY <- sum(catsY) - JY
            gpcmP <- P
            gpcmQ <- Q
            ax <- numeric(JX)
            ay <- numeric(JY)
            bx <- vector("list", JX)
            by <- vector("list", JY)
            if (class(gpcmP) == "gpcm" && class(gpcmQ) == "gpcm") {
                if (!P$IRT.param || !Q$IRT.param) 
                  return("Please fit the IRT models using IRT.param = TRUE.")
                if (length(unique(catsX)) == 1) {
                  ax <- coef(gpcmP)[, catsX[1]]
                  for (i in 1:JX) bx[[i]] <- coef(gpcmP)[i, 1:(catsX[1] - 
                    1)]
                }
                else {
                  for (i in 1:JX) ax[i] <- coef(gpcmP)[[i]][catsX[i]]
                  for (i in 1:JX) bx[[i]] <- coef(gpcmP)[[i]][1:(catsX[i] - 
                    1)]
                }
                if (length(unique(catsY)) == 1) {
                  ay <- coef(gpcmQ)[, catsY[1]]
                  for (i in 1:JY) by[[i]] <- coef(gpcmQ)[i, 1:(catsY[1] - 
                    1)]
                }
                else {
                  for (i in 1:JY) ay[i] <- coef(gpcmQ)[[i]][catsY[i]]
                  for (i in 1:JY) by[[i]] <- coef(gpcmQ)[[i]][1:(catsY[i] - 
                    1)]
                }
                N <- nrow(gpcmP$X)
                M <- nrow(gpcmQ$X)
                P <- gpcmP$X
                Q <- gpcmQ$X
            }
            if (class(gpcmP) == "SingleGroupClass" && class(gpcmQ) == 
                "SingleGroupClass") {
                for (i in 1:JX) {
                  ttpar <- extract.item(gpcmP, i)
                  ax[i] <- ttpar@par[1]
                  bx[[i]] <- -(tail(ttpar@par, catsX[i] - 1) - 
                    c(0, tail(ttpar@par, catsX[i] - 1)[-(catsX[i] - 
                      1)]))/ax[i]
                }
                for (i in 1:JY) {
                  ttpar <- extract.item(gpcmQ, i)
                  ay[i] <- ttpar@par[1]
                  by[[i]] <- -(tail(ttpar@par, catsY[i] - 1) - 
                    c(0, tail(ttpar@par, catsY[i] - 1)[-(catsY[i] - 
                      1)]))/ay[i]
                }
                dataP <- extract.mirt(gpcmP, "data")
                dataQ <- extract.mirt(gpcmQ, "data")
                N <- nrow(dataP)
                M <- nrow(dataQ)
                P <- dataP
                Q <- dataQ
            }
            ltmP <- gpcmP
            ltmQ <- gpcmQ
            irtx <- polyprob(ax, bx, catsX, model, qpoints)
            irty <- polyprob(ay, by, catsY, model, qpoints)
        }
        if (model == "GRM") {
            JX <- length(catsX)
            JY <- length(catsY)
            kX <- sum(catsX) - JX
            kY <- sum(catsY) - JY
            grmP <- P
            grmQ <- Q
            ax <- numeric(JX)
            ay <- numeric(JY)
            bx <- vector("list", JX)
            by <- vector("list", JY)
            for (i in 1:JX) {
                ttpar <- extract.item(grmP, i)
                ax[i] <- ttpar@par[1]
                bx[[i]] <- -ttpar@par[-1]/ax[i]
            }
            for (i in 1:JY) {
                ttpar <- extract.item(grmQ, i)
                ay[i] <- ttpar@par[1]
                by[[i]] <- -ttpar@par[-1]/ay[i]
            }
            dataP <- extract.mirt(grmP, "data")
            dataQ <- extract.mirt(grmQ, "data")
            N <- nrow(dataP)
            M <- nrow(dataQ)
            P <- dataP
            Q <- dataQ
            ltmP <- grmP
            ltmQ <- grmQ
            irtx <- polyprob(ax, bx, catsX, model, qpoints)
            irty <- polyprob(ay, by, catsY, model, qpoints)
        }
        if (see == "bootstrap") {
            if (model == "2pl") {
                bootsee <- matrix(0, nrow = replications, ncol = length(x))
                for (i in 1:replications) {
                  Pboot <- P[sample(1:N, replace = TRUE), ]
                  Qboot <- Q[sample(1:M, replace = TRUE), ]
                  ltmQboot <- ltm(Pboot ~ z1, IRT.param = FALSE)
                  ltmPboot <- ltm(Qboot ~ z1, IRT.param = FALSE)
                  bootsee[i, ] <- irtoseeq(ltmPboot, ltmQboot, 
                    x, y, a, qpoints, N, M, model, design, kernel, 
                    slog, bunif, KPEN, wpen, linear, altopt, 
                    h = h, hlin = hlin)
                }
            }
            if (model == "3pl") {
                bootsee <- matrix(0, nrow = replications, ncol = length(x))
                for (i in 1:replications) {
                  Pboot <- P[sample(1:N, replace = TRUE), ]
                  Qboot <- Q[sample(1:M, replace = TRUE), ]
                  ltmQboot <- tpm(Pboot, IRT.param = FALSE, control = list(optimizer = "nlminb"))
                  ltmPboot <- tpm(Qboot, IRT.param = FALSE, control = list(optimizer = "nlminb"))
                  bootsee[i, ] <- irtoseeq(ltmPboot, ltmQboot, 
                    x, y, a, qpoints, N, M, model, design, kernel, 
                    slog, bunif, KPEN, wpen, linear, altopt, 
                    h = h, hlin = hlin)
                }
            }
            r <- LordWW(irtx, qpoints)
            s <- LordWW(irty, qpoints)
            if (kernel == "uniform") {
                ulimit <- (1/(2 * bunif * (1 - 0.61803)))
                KPEN <- 0
            }
            else ulimit <- 4
            meanx <- x %*% r
            meany <- y %*% s
            varx <- (N/(N - 1)) * (x^2 %*% r - meanx^2)
            vary <- (M/(M - 1)) * (y^2 %*% s - meany^2)
            if (linear) {
                if (hlin$hxlin == 0) 
                  hx <- as.numeric(1000 * sqrt(varx))
                else hx <- hlin$hxlin
                if (hlin$hylin == 0) 
                  hy <- as.numeric(1000 * sqrt(vary))
                else hy <- hlin$hylin
            }
            else {
                if (h$hx == 0) {
                  if (altopt) {
                    hx <- 9/sqrt(100 * N^(2/5) - 81) * sqrt(varx)
                  }
                  else {
                    if (KPEN == 0) {
                      hx <- optimize(PEN, interval = c(0, ulimit), 
                        tol = .Machine$double.eps^0.5, r = r, 
                        x, var = varx, mean = meanx, wpen = wpen, 
                        K = KPEN, kernel = kernel, slog = slog, 
                        bunif = bunif)$minimum
                    }
                    else {
                      hxPEN1min <- optimize(PEN, interval = c(0, 
                        ulimit), tol = .Machine$double.eps^0.5, 
                        r = r, x, var = varx, mean = meanx, wpen = wpen, 
                        K = 0, kernel = kernel, slog = slog, 
                        bunif = bunif)$minimum
                      hx <- optimize(PEN, interval = c(hxPEN1min, 
                        ulimit), tol = .Machine$double.eps^0.5, 
                        r = r, x, var = varx, mean = meanx, wpen = wpen, 
                        K = KPEN, kernel = kernel, slog = slog, 
                        bunif = bunif)$minimum
                    }
                  }
                }
                if (h$hy == 0) {
                  if (altopt) {
                    hy <- 9/sqrt(100 * M^(2/5) - 81) * sqrt(vary)
                  }
                  else {
                    if (KPEN == 0) {
                      hy <- optimize(PEN, interval = c(0, ulimit), 
                        tol = .Machine$double.eps^0.5, r = s, 
                        y, var = vary, mean = meany, wpen = wpen, 
                        K = KPEN, kernel = kernel, slog = slog, 
                        bunif = bunif)$minimum
                    }
                    else {
                      hyPEN1min <- optimize(PEN, interval = c(0, 
                        ulimit), tol = .Machine$double.eps^0.5, 
                        r = s, y, var = vary, mean = meany, wpen = wpen, 
                        K = 0, kernel = kernel, slog = slog, 
                        bunif = bunif)$minimum
                      hy <- optimize(PEN, interval = c(hyPEN1min, 
                        ulimit), tol = .Machine$double.eps^0.5, 
                        r = s, y, var = vary, mean = meany, wpen = wpen, 
                        K = KPEN, kernel = kernel, slog = slog, 
                        bunif = bunif)$minimum
                    }
                  }
                }
            }
            cdfx <- cdf(r, hx, meanx, varx, kernel, slog, bunif)
            cdfy <- cdf(s, hy, meany, vary, kernel, slog, bunif)
            eqYx <- eqinvCE(cdfx, s, x, y, vary, meany, hy, kernel, 
                slog, bunif)
            PREYx <- PREp(eqYx, y, r, s)
            PRE <- data.frame(PREYx)
            h <- data.frame(hx, hy)
            output <- data.frame(eqYx = eqYx, SEEYx = apply(bootsee, 
                2, sd))
            out <- new("keout", Pobs = P, Qobs = Q, scores = list(X = data.frame(x, 
                r = r, cdfx = cdfx), Y = data.frame(y, s = s, 
                cdfy = cdfy), M = M, N = N), linear = linear, 
                PRE = PRE, h = h, kernel = kernel, type = "IRT-OSE EG", 
                equating = output, irt = list(ltmP = ltmP, ltmQ = ltmQ), 
                see = see, replications = replications)
            return(out)
        }
        else {
            if (model == "1pl") {
                pderX <- pderpl(irtx, qpoints, bx, model)
                pderY <- pderpl(irty, qpoints, by, model)
            }
            if (model == "2pl") {
                pderX <- pderpl(irtx, qpoints, bx, model, a = ax)
                pderY <- pderpl(irty, qpoints, by, model, a = ay)
                adjcovalphaP <- adjltm(covalphaP, pars = list(ax = ax, 
                  bxltm = bxltm), design, model = "2pl")
                adjcovalphaQ <- adjltm(covalphaQ, pars = list(ax = ay, 
                  bxltm = byltm), design, model = "2pl")
            }
            if (model == "3pl") {
                pderX <- pderpl(irtx, qpoints, bx, a = ax, c = cx)
                pderY <- pderpl(irty, qpoints, by, a = ay, c = cy)
                adjcovalphaP <- adjltm(covalphaP, pars = list(ax = ax, 
                  bxltm = bxltm), design, model = "3pl")
                adjcovalphaQ <- adjltm(covalphaQ, pars = list(ax = ay, 
                  bxltm = byltm), design, model = "3pl")
                if (class(ltmP) %in% c("SingleGroupClass", "ConfirmatoryClass")) {
                  vectadj <- rep(1, 3 * (length(x) - 1))
                  vectadj[1:(length(x) - 1)] <- exp(c(cxltm))/(1 + 
                    exp(c(cxltm)))^2
                  adjcovalphaP <- diag(vectadj) %*% adjcovalphaP %*% 
                    t(diag(vectadj))
                  vectadj <- rep(1, 3 * (length(y) - 1))
                  vectadj[1:(length(y) - 1)] <- exp(c(cyltm))/(1 + 
                    exp(c(cyltm)))^2
                  adjcovalphaQ <- diag(vectadj) %*% adjcovalphaQ %*% 
                    t(diag(vectadj))
                }
            }
            if (model == "GPCM") {
                pderX <- polypderpl(ax, bx, catsX, irtx, model, 
                  qpoints, qpoints)
                pderY <- polypderpl(ay, by, catsY, irty, model, 
                  qpoints, qpoints)
                pdermatX <- matrix(0, nrow = kX + 1, ncol = sum(catsX))
                pdermatY <- matrix(0, nrow = kY + 1, ncol = sum(catsY))
                for (i in 1:(kX + 1)) {
                  pdermatX[i, 1:catsX[1]] <- pderX[[i]][[1]]
                  for (j in 2:JX) {
                    pdermatX[i, (sum(catsX[1:(j - 1)]) + 1):sum(catsX[1:j])] <- pderX[[i]][[j]]
                  }
                }
                for (i in 1:(kY + 1)) {
                  pdermatY[i, 1:catsY[1]] <- pderY[[i]][[1]]
                  for (j in 2:JY) {
                    pdermatY[i, (sum(catsY[1:(j - 1)]) + 1):sum(catsY[1:j])] <- pderY[[i]][[j]]
                  }
                }
                if (class(ltmP) == "gpcm" && class(ltmQ) == "gpcm") {
                  covalphaP <- vcov.gpcm(ltmP, robust = robust)
                  covalphaQ <- vcov.gpcm(ltmQ, robust = robust)
                  adjcovalphaP <- covalphaP
                  adjcovalphaQ <- covalphaQ
                }
                if (class(ltmP) == "SingleGroupClass" && class(ltmQ) == 
                  "SingleGroupClass") {
                  covalphaP <- extract.mirt(ltmP, "vcov")
                  covalphaQ <- extract.mirt(ltmQ, "vcov")
                  adjderP <- adjgpcmmirt(ltmP)
                  adjderQ <- adjgpcmmirt(ltmQ)
                  adjcovalphaP <- t(adjderP) %*% covalphaP %*% 
                    adjderP
                  adjcovalphaQ <- t(adjderQ) %*% covalphaQ %*% 
                    adjderQ
                }
            }
            if (model == "GRM") {
                pderX <- polypderpl(ax, bx, catsX, irtx, model, 
                  qpoints, qpoints)
                pderY <- polypderpl(ay, by, catsY, irty, model, 
                  qpoints, qpoints)
                pdermatX <- matrix(0, nrow = kX + 1, ncol = sum(catsX))
                pdermatY <- matrix(0, nrow = kY + 1, ncol = sum(catsY))
                for (i in 1:(kX + 1)) {
                  pdermatX[i, 1:catsX[1]] <- pderX[[i]][[1]]
                  for (j in 2:JX) {
                    pdermatX[i, (sum(catsX[1:(j - 1)]) + 1):sum(catsX[1:j])] <- pderX[[i]][[j]]
                  }
                }
                for (i in 1:(kY + 1)) {
                  pdermatY[i, 1:catsY[1]] <- pderY[[i]][[1]]
                  for (j in 2:JY) {
                    pdermatY[i, (sum(catsY[1:(j - 1)]) + 1):sum(catsY[1:j])] <- pderY[[i]][[j]]
                  }
                }
                covalphaP <- extract.mirt(grmP, "vcov")
                covalphaQ <- extract.mirt(grmQ, "vcov")
                adjderP <- adjgrmmirt(grmP)
                adjderQ <- adjgrmmirt(grmQ)
                adjcovalphaP <- t(adjderP) %*% covalphaP %*% 
                  adjderP
                adjcovalphaQ <- t(adjderQ) %*% covalphaQ %*% 
                  adjderQ
            }
            adjcovalphaPQ <- cbind(rbind(adjcovalphaP, matrix(0, 
                nrow = nrow(adjcovalphaQ), ncol = ncol(adjcovalphaP))), 
                rbind(matrix(0, nrow = nrow(adjcovalphaP), ncol = ncol(adjcovalphaQ)), 
                  adjcovalphaQ))
        }
        if (model %in% c("1pl", "2pl", "3pl")) {
            r <- LordWW(irtx, qpoints)
            s <- LordWW(irty, qpoints)
        }
        if (model %in% c("GPCM", "GRM")) {
            r <- rowSums(cmnom(catsX, irtx, qpoints))
            s <- rowSums(cmnom(catsY, irty, qpoints))
        }
        if (kernel == "uniform") {
            ulimit <- (1/(2 * bunif * (1 - 0.61803)))
            KPEN <- 0
        }
        else ulimit <- 4
        meanx <- x %*% r
        meany <- y %*% s
        varx <- (N/(N - 1)) * (x^2 %*% r - meanx^2)
        vary <- (M/(M - 1)) * (y^2 %*% s - meany^2)
        kX <- length(x) - 1
        kY <- length(y) - 1
        if (model == "2pl") {
            Jalpha <- matrix(0, nrow = 2 * (kY + kX), ncol = (kX + 
                kY + 2))
            Jalpha[1:(2 * kX), 1:(kX + 1)] <- pderX
            Jalpha[(2 * kX + 1):(2 * kX + 2 * kY), (kX + 2):(kX + 
                kY + 2)] <- pderY
        }
        if (model == "3pl") {
            Jalpha <- matrix(0, nrow = 3 * (kY + kX), ncol = (kX + 
                kY + 2))
            Jalpha[1:(3 * kX), 1:(kX + 1)] <- pderX
            Jalpha[(3 * kX + 1):(3 * kX + 3 * kY), (kX + 2):(kX + 
                kY + 2)] <- pderY
        }
        if (model %in% c("GPCM", "GRM")) {
            Jalpha <- matrix(0, nrow = (kX + kY + 2), ncol = sum(catsX) + 
                sum(catsY))
            Jalpha[1:(kX + 1), 1:(sum(catsX))] <- pdermatX
            Jalpha[(kX + 2):(kX + kY + 2), (sum(catsX) + 1):(sum(catsX) + 
                sum(catsY))] <- pdermatY
            Jalpha <- t(Jalpha)
        }
        covrs <- t(Jalpha) %*% adjcovalphaPQ %*% Jalpha
        covr <- covrs[1:(kX + 1), 1:(kX + 1)]
        covs <- covrs[(kX + 2):(kX + kY + 2), (kX + 2):(kX + 
            kY + 2)]
        input <- vector("list", 2)
        input[[1]] <- list(r, x, N, covr)
        input[[2]] <- list(s, y, N, covs)
        if (h$hx == 0 && h$hy == 0) {
            if (linear == T) 
                bandwidth <- "linear"
            if (linear == F && DS == F) 
                bandwidth <- "PEN"
            if (linear == F && DS == T) 
                bandwidth <- "DS"
            if (linear == F && CV == T) 
                bandwidth <- "CV"
            if (linear == F && DS == F && CV == T && altopt == 
                T) 
                bandwidth <- "altopt"
            hxhy <- bandwidth.select(input, bandwidth = bandwidth, 
                KPEN = KPEN)
            hx <- hxhy[1]
            hy <- hxhy[2]
        }
        else {
            hx <- h$hx
            hy <- h$hy
        }
        cdfx <- cdf(r, hx, meanx, varx, kernel, slog, bunif)
        cdfy <- cdf(s, hy, meany, vary, kernel, slog, bunif)
        eqYx <- eqinvCE(cdfx, s, x, y, vary, meany, hy, kernel, 
            slog, bunif)
        PREYx <- PREp(eqYx, y, r, s)
        PRE <- data.frame(PREYx)
        h <- data.frame(hx, hy)
        gprimeY <- densityeq(s, hy, vary, meany, eqYx, y, kernel, 
            slog, bunif)
        fprimeY <- densityeq(r, hx, varx, meanx, x, x, kernel, 
            slog, bunif)
        if (altopt) {
            altfprim <- altoptdensity(r, hx, varx, meanx, x, 
                x)
            altgprim <- altoptdensity(s, hy, vary, meanx, eqYx, 
                y)
        }
        if (altopt) {
            dFdreYEG <- dFdr(r, hx, varx, meanx, fprimeY, x, 
                x, kernel, slog, bunif, altopt = altopt, altfprim = altfprim)
            dGdseYEG <- dFdr(s, hy, vary, meany, gprimeY, eqYx, 
                y, kernel, slog, bunif, altopt = altopt, altfprim = altgprim)
        }
        else {
            dFdreYEG <- dFdr(r, hx, varx, meanx, fprimeY, x, 
                x, kernel, slog, bunif)
            dGdseYEG <- dFdr(s, hy, vary, meany, gprimeY, eqYx, 
                y, kernel, slog, bunif)
        }
        JeY <- matrix(0, nrow = length(x), ncol = (length(x) + 
            length(y)))
        JeY[, 1:(length(x))] <- dFdreYEG
        JeY[, (length(x) + 1):(length(x) + length(y))] <- -dGdseYEG
        JeY <- (1/gprimeY) * JeY
        pdereqYx <- JeY %*% t(Jalpha)
        coveqYx <- pdereqYx %*% adjcovalphaPQ %*% t(pdereqYx)
        output <- data.frame(eqYx = eqYx, SEEYx = sqrt(diag(coveqYx)))
        out <- new("keout", coveqYx = coveqYx, pdereqYx = pdereqYx, 
            Pobs = P, Qobs = Q, scores = list(X = data.frame(x, 
                r = r, cdfx = cdfx), Y = data.frame(y, s = s, 
                cdfy = cdfy), M = M, N = N, covrs = t(Jalpha) %*% 
                adjcovalphaPQ %*% (Jalpha)), linear = linear, 
            PRE = PRE, h = h, kernel = kernel, type = "IRT-OSE EG", 
            equating = output, irt = list(covalphaP = adjcovalphaP, 
                covalphaQ = adjcovalphaQ, ltmP = ltmP, ltmQ = ltmQ), 
            see = see)
        return(out)
    }
    if (design == "PSE") {
        if (model == "2pl") {
            if (class(P) %in% c("ConfirmatoryClass", "SingleGroupClass", 
                "ltm")) 
                Plist <- irtinput(P, x, a, robust, model, catsX = catsX, 
                  catsA = catsA)
            else if (is.matrix(P)) {
                if ((length(a) + length(x) - 2) != ncol(P)) 
                  return("Unsupported input. Input matrices must have rows denoting individuals and columns denoting items.")
                ltmP <- ltm(P ~ z1, IRT.param = FALSE)
                Plist <- irtinput(ltmP, x, a, robust, model)
            }
            if (class(Q) %in% c("ConfirmatoryClass", "SingleGroupClass", 
                "ltm")) 
                Qlist <- irtinput(Q, y, a, robust, model, catsX = catsY, 
                  catsA = catsA)
            else if (is.matrix(Q)) {
                if ((length(a) + length(x) - 2) != ncol(Q)) 
                  return("Unsupported input. Input matrices must have rows denoting individuals and columns denoting items.")
                ltmQ <- ltm(Q ~ z1, IRT.param = FALSE)
                Qlist <- irtinput(ltmQ, x, a, robust, model)
            }
            ax <- Plist$ax
            aaP <- Plist$aaP
            bxltm <- Plist$bxltm
            baPltm <- Plist$baPltm
            bx <- Plist$bx
            baP <- Plist$baP
            ltmP <- Plist$ltmP
            P <- Plist$P
            N <- Plist$N
            covalphaP <- Plist$covP
            ay <- Qlist$ax
            aaQ <- Qlist$aaP
            byltm <- Qlist$bxltm
            baQltm <- Qlist$baPltm
            by <- Qlist$bx
            baQ <- Qlist$baP
            ltmQ <- Qlist$ltmP
            Q <- Qlist$P
            M <- Qlist$N
            covalphaQ <- Qlist$covP
        }
        if (model == "3pl") {
            if (class(P) %in% c("ConfirmatoryClass", "SingleGroupClass", 
                "tpm")) 
                Plist <- irtinput(P, x, a, robust, model, catsX = catsX, 
                  catsA = catsA)
            else if (is.matrix(P)) {
                if ((length(a) + length(x) - 2) != ncol(P)) 
                  return("Unsupported input. Input matrices must have rows denoting individuals and columns denoting items.")
                ltmP <- tpm(P, IRT.param = FALSE)
                Plist <- irtinput(ltmP, x, a, robust, model)
            }
            if (class(Q) %in% c("ConfirmatoryClass", "SingleGroupClass", 
                "tpm")) 
                Qlist <- irtinput(Q, y, a, robust, model, catsX = catsY, 
                  catsA = catsA)
            else if (is.matrix(Q)) {
                if ((length(a) + length(x) - 2) != ncol(Q)) 
                  return("Unsupported input. Input matrices must have rows denoting individuals and columns denoting items.")
                ltmQ <- tpm(Q, IRT.param = FALSE)
                Qlist <- irtinput(ltmQ, x, a, robust, model)
            }
            ax <- Plist$ax
            aaP <- Plist$aaP
            bxltm <- Plist$bxltm
            baPltm <- Plist$baPltm
            bx <- Plist$bx
            baP <- Plist$baP
            cx <- Plist$cx
            caP <- Plist$caP
            ltmP <- Plist$ltmP
            if (class(ltmP) %in% c("ConfirmatoryClass", "SingleGroupClass")) {
                cxmirt <- cx
                caPmirt <- caP
                cx <- exp(cx)/(1 + exp(cx))
                caP <- exp(caP)/(1 + exp(caP))
            }
            P <- Plist$P
            N <- Plist$N
            covalphaP <- Plist$covP
            ay <- Qlist$ax
            aaQ <- Qlist$aaP
            byltm <- Qlist$bxltm
            baQltm <- Qlist$baPltm
            by <- Qlist$bx
            baQ <- Qlist$baP
            cy <- Qlist$cx
            caQ <- Qlist$caP
            ltmQ <- Qlist$ltmP
            if (class(ltmP) %in% c("ConfirmatoryClass", "SingleGroupClass")) {
                cymirt <- cy
                caQmirt <- caQ
                cy <- exp(cy)/(1 + exp(cy))
                caQ <- exp(caQ)/(1 + exp(caQ))
            }
            Q <- Qlist$P
            M <- Qlist$N
            covalphaQ <- Qlist$covP
        }
        if (model == "GPCM") {
            JX <- length(catsX)
            JY <- length(catsY)
            JA <- length(catsA)
            kX <- sum(catsX) - JX
            kY <- sum(catsY) - JY
            kA <- sum(catsA) - JA
            gpcmP <- P
            gpcmQ <- Q
            parsP <- irtinput(gpcmP, x, a, robust, model, catsX = catsX, 
                catsA = catsA)
            parsQ <- irtinput(gpcmQ, y, a, robust, model, catsX = catsY, 
                catsA = catsA)
            ax <- parsP$ax
            bx <- parsP$bx
            aaP <- parsP$aaP
            baP <- parsP$baP
            ay <- parsQ$ax
            by <- parsQ$bx
            aaQ <- parsQ$aaP
            baQ <- parsQ$baP
            N <- parsP$N
            M <- parsQ$N
            P <- parsP$P
            Q <- parsQ$P
            ltmP <- gpcmP
            ltmQ <- gpcmQ
        }
        if (model == "GRM") {
            JX <- length(catsX)
            JY <- length(catsY)
            JA <- length(catsA)
            kX <- sum(catsX) - JX
            kY <- sum(catsY) - JY
            kA <- sum(catsA) - JA
            grmP <- P
            grmQ <- Q
            parsP <- irtinput(grmP, x, a, robust, model, catsX = catsX, 
                catsA = catsA)
            parsQ <- irtinput(grmQ, y, a, robust, model, catsX = catsY, 
                catsA = catsA)
            ax <- parsP$ax
            bx <- parsP$bx
            aaP <- parsP$aaP
            baP <- parsP$baP
            ay <- parsQ$ax
            by <- parsQ$bx
            aaQ <- parsQ$aaP
            baQ <- parsQ$baP
            N <- parsP$N
            M <- parsQ$N
            P <- parsP$P
            Q <- parsQ$P
            ltmP <- grmP
            ltmQ <- grmQ
        }
        if (model == "1pl") {
            irtpars <- list(bx = bx, by = by, baP = baP, baQ = baQ)
            irtrP <- probpl(qpoints, bx, model)
            irtrQ <- probpl(betaA * qpoints + betaB, bx, model)
            irtsQ <- probpl(qpoints, by, model)
            irtsP <- probpl(betaA * qpoints + betaB, by, model)
        }
        if (model == "2pl") {
            ltmPcf <- matrix(c(bxltm, baPltm, ax, aaP), nrow = length(c(bxltm, 
                baPltm)))
            ltmQcf <- matrix(c(byltm, baQltm, ay, aaQ), nrow = length(c(byltm, 
                baQltm)))
            dimnames(ltmPcf)[[1]] <- c(sprintf("X%03d", 1:(length(x) - 
                1)), sprintf("A%03d", 1:(length(a) - 1)))
            dimnames(ltmQcf)[[1]] <- c(sprintf("Y%03d", 1:(length(y) - 
                1)), sprintf("A%03d", 1:(length(a) - 1)))
            avoidprint <- capture.output({
                modPQ <- modIRT(coef = list(test1 = ltmPcf, test2 = ltmQcf), 
                  var = list(test1 = covalphaP, test2 = covalphaQ), 
                  names = paste("test", 1:2, sep = ""), ltparam = TRUE)
            })
            eqc <- direc(mods = modPQ, which = c(2, 1), method = eqcoef)
            betaA <- eqc$A
            betaB <- eqc$B
            irtpars <- list(ax = ax, ay = ay, aaP = aaP, aaQ = aaQ, 
                bx = bx, by = by, baP = baP, baQ = baQ)
            irtrP <- probpl(qpoints, bx, model, a = ax)
            irtrQ <- probpl(betaA * qpoints + betaB, bx, model, 
                a = ax)
            irtsQ <- probpl(qpoints, by, model, a = ay)
            irtsP <- probpl((qpoints - betaB)/betaA, by, model, 
                a = ay)
            adjcovalphaP <- adjltm(covalphaP, pars = list(ax = ax, 
                aa = aaP, bxltm = bxltm, baltm = baPltm), "PSE", 
                model = "2pl")
            adjcovalphaQ <- adjltm(covalphaQ, pars = list(ax = ay, 
                aa = aaQ, bxltm = byltm, baltm = baQltm), "PSE", 
                model = "2pl")
        }
        if (model == "3pl") {
            if (class(ltmP) == "tpm") {
                ltmPcf <- matrix(c(cx, caP, bxltm, baPltm, ax, 
                  aaP), nrow = length(c(ax, aaP)))
                ltmQcf <- matrix(c(cy, caQ, byltm, baQltm, ay, 
                  aaQ), nrow = length(c(ay, aaQ)))
                dimnames(ltmPcf)[[1]] <- c(sprintf("X%03d", 1:(length(x) - 
                  1)), sprintf("A%03d", 1:(length(a) - 1)))
                dimnames(ltmQcf)[[1]] <- c(sprintf("Y%03d", 1:(length(y) - 
                  1)), sprintf("A%03d", 1:(length(a) - 1)))
                avoidprint <- capture.output({
                  modPQ <- modIRT(coef = list(test1 = ltmPcf, 
                    test2 = ltmQcf), var = list(test1 = covalphaP, 
                    test2 = covalphaQ), names = paste("test", 
                    1:2, sep = ""), ltparam = TRUE, lparam = FALSE)
                })
            }
            if (class(ltmP) %in% c("ConfirmatoryClass", "SingleGroupClass")) {
                mirtPcf <- matrix(c(cxmirt, caPmirt, bxltm, baPltm, 
                  ax, aaP), nrow = length(c(ax, aaP)))
                mirtQcf <- matrix(c(cymirt, caQmirt, byltm, baQltm, 
                  ay, aaQ), nrow = length(c(ay, aaQ)))
                dimnames(mirtPcf)[[1]] <- c(sprintf("X%03d", 
                  1:(length(x) - 1)), sprintf("A%03d", 1:(length(a) - 
                  1)))
                dimnames(mirtQcf)[[1]] <- c(sprintf("Y%03d", 
                  1:(length(y) - 1)), sprintf("A%03d", 1:(length(a) - 
                  1)))
                avoidprint <- capture.output({
                  modPQ <- modIRT(coef = list(test1 = mirtPcf, 
                    test2 = mirtQcf), var = list(test1 = covalphaP, 
                    test2 = covalphaQ), names = paste("test", 
                    1:2, sep = ""), ltparam = TRUE, lparam = TRUE)
                })
            }
            eqc <- direc(mods = modPQ, which = c(2, 1), method = eqcoef)
            betaA <- eqc$A
            betaB <- eqc$B
            adjcovalphaP <- modPQ$test1$var
            adjcovalphaQ <- modPQ$test2$var
            irtpars <- list(ax = ax, ay = ay, aaP = aaP, aaQ = aaQ, 
                bx = bx, by = by, baP = baP, baQ = baQ, cx = cx, 
                cy = cy, caP = caP, caQ = caQ)
            irtrP <- probpl(qpoints, bx, a = ax, c = cx)
            irtrQ <- probpl(betaA * qpoints + betaB, bx, a = ax, 
                c = cx)
            irtsQ <- probpl(qpoints, by, a = ay, c = cy)
            irtsP <- probpl((qpoints - betaB)/betaA, by, a = ay, 
                c = cy)
        }
        if (model %in% c("1pl", "2pl", "3pl")) {
            rP <- LordWW(irtrP, qpoints)
            rQ <- LordWW(irtrQ, qpoints)
            sQ <- LordWW(irtsQ, qpoints)
            sP <- LordWW(irtsP, qpoints)
        }
        if (model %in% c("GPCM", "GRM")) {
            estAB <- eqcpoly(aaP, baP, aaQ, baQ, catsA, model, 
                eqcoef, qpoints, distribution)
            betaA <- estAB[1]
            betaB <- estAB[2]
            irtrP <- polyprob(ax, bx, catsX, model, qpoints)
            irtrQ <- polyprob(ax, bx, catsX, model, betaA * qpoints + 
                betaB)
            irtsP <- polyprob(ay, by, catsY, model, (qpoints - 
                betaB)/betaA)
            irtsQ <- polyprob(ay, by, catsY, model, qpoints)
            covalphaP <- extract.mirt(ltmP, "vcov")
            covalphaQ <- extract.mirt(ltmQ, "vcov")
            if (model == "GPCM") {
                adjderP <- adjgpcmmirt(ltmP)
                adjderQ <- adjgpcmmirt(ltmQ)
            }
            if (model == "GRM") {
                adjderP <- adjgrmmirt(ltmP)
                adjderQ <- adjgrmmirt(ltmQ)
            }
            adjcovalphaP <- t(adjderP) %*% covalphaP %*% adjderP
            adjcovalphaQ <- t(adjderQ) %*% covalphaQ %*% adjderQ
        }
        if (model %in% c("GPCM", "GRM")) {
            rP <- rowSums(cmnom(catsX, irtrP, qpoints))
            rQ <- rowSums(cmnom(catsX, irtrQ, qpoints))
            sQ <- rowSums(cmnom(catsY, irtsQ, qpoints))
            sP <- rowSums(cmnom(catsY, irtsP, qpoints))
        }
        r <- wS * rP + (1 - wS) * rQ
        s <- wS * sP + (1 - wS) * sQ
        if (model %in% c("GPCM", "GRM")) {
            pdermats <- polypderpse(ax, bx, aaP, baP, ay, by, 
                aaQ, baQ, catsX, catsY, catsA, model, eqcoef, 
                qpoints, distribution, estAB)
        }
        if (model %in% c("1pl", "2pl", "3pl")) {
            pdermats <- pderrspse(irtpars, x, y, a, irtrP, irtrQ, 
                irtsP, irtsQ, qpoints, eqc, wS, model = model)
        }
        if (kernel == "uniform") {
            ulimit <- (1/(2 * bunif * (1 - 0.61803)))
            KPEN <- 0
        }
        else ulimit <- 4
        meanx <- x %*% r
        meany <- y %*% s
        varx <- (N/(N - 1)) * (x^2 %*% r - meanx^2)
        vary <- (M/(M - 1)) * (y^2 %*% s - meany^2)
        adjcovalphaPQ <- cbind(rbind(adjcovalphaP, matrix(0, 
            nrow = nrow(adjcovalphaQ), ncol = ncol(adjcovalphaP))), 
            rbind(matrix(0, nrow = nrow(adjcovalphaP), ncol = ncol(adjcovalphaQ)), 
                adjcovalphaQ))
        Jalpha <- pdermats$prSsS %*% pdermats$prPrQsPsQ %*% pdermats$paXaYbetaAB
        covrs <- Jalpha %*% adjcovalphaPQ %*% t(Jalpha)
        covr <- covrs[1:(length(r)), 1:(length(r))]
        covs <- covrs[(length(r) + 1):(length(r) + length(s)), 
            (length(r) + 1):(length(r) + length(s))]
        input <- vector("list", 2)
        input[[1]] <- list(r, x, N, covr)
        input[[2]] <- list(s, y, N, covs)
        if (h$hx == 0 && h$hy == 0) {
            if (linear == T) 
                bandwidth <- "linear"
            if (linear == F && DS == F) 
                bandwidth <- "PEN"
            if (linear == F && DS == T) 
                bandwidth <- "DS"
            if (linear == F && CV == T) 
                bandwidth <- "CV"
            if (linear == F && DS == F && CV == T && altopt == 
                T) 
                bandwidth <- "altopt"
            hxhy <- bandwidth.select(input, bandwidth = bandwidth, 
                KPEN = KPEN)
            hx <- hxhy[1]
            hy <- hxhy[2]
        }
        else {
            hx <- h$hx
            hy <- h$hy
        }
        cdfx <- cdf(r, hx, meanx, varx, kernel, slog, bunif)
        cdfy <- cdf(s, hy, meany, vary, kernel, slog, bunif)
        eqYx <- eqinvCE(cdfx, s, x, y, vary, meany, hy, kernel, 
            slog, bunif)
        PREYx <- PREp(eqYx, y, r, s)
        PRE <- data.frame(PREYx)
        h <- data.frame(hx, hy)
        gprimeY <- densityeq(s, hy, vary, meany, eqYx, y, kernel, 
            slog, bunif)
        fprimeY <- densityeq(r, hx, varx, meanx, x, x, kernel, 
            slog, bunif)
        if (altopt) {
            altfprim <- altoptdensity(r, hx, varx, meanx, x, 
                x)
            altgprim <- altoptdensity(s, hy, vary, meanx, eqYx, 
                y)
        }
        if (altopt) {
            dFdreYEG <- dFdr(r, hx, varx, meanx, fprimeY, x, 
                x, kernel, slog, bunif, altopt = altopt, altfprim = altfprim)
            dGdseYEG <- dFdr(s, hy, vary, meany, gprimeY, eqYx, 
                y, kernel, slog, bunif, altopt = altopt, altfprim = altgprim)
        }
        else {
            dFdreYEG <- dFdr(r, hx, varx, meanx, fprimeY, x, 
                x, kernel, slog, bunif)
            dGdseYEG <- dFdr(s, hy, vary, meany, gprimeY, eqYx, 
                y, kernel, slog, bunif)
        }
        JeY <- matrix(0, nrow = length(x), ncol = (length(x) + 
            length(y)))
        JeY[, 1:(length(x))] <- dFdreYEG
        JeY[, (length(x) + 1):(length(x) + length(y))] <- -dGdseYEG
        JeY <- (1/gprimeY) * JeY
        pdereqYx <- JeY %*% Jalpha
        coveqYx <- pdereqYx %*% adjcovalphaPQ %*% t(pdereqYx)
        output <- data.frame(eqYx = eqYx, SEEYx = sqrt(diag(coveqYx)))
        out <- new("keout", coveqYx = coveqYx, pdereqYx = pdereqYx, 
            Pobs = P, Qobs = Q, scores = list(X = data.frame(x, 
                r = r, cdfx = cdfx), Y = data.frame(y, s = s, 
                cdfy = cdfy), M = M, N = N, covrs = (Jalpha) %*% 
                adjcovalphaPQ %*% t(Jalpha)), linear = linear, 
            PRE = PRE, h = h, kernel = kernel, type = "IRT-OSE PSE", 
            equating = output, irt = list(covalphaP = adjcovalphaP, 
                covalphaQ = adjcovalphaQ, ltmP = ltmP, ltmQ = ltmQ, 
                AB = c(betaA, betaB)), see = see)
        return(out)
    }
    else return("Currently only CE, PSE and EG have been implemented.")
}
<bytecode: 0xb07b9d8>
<environment: namespace:kequate>
 --- function search by body ---
Function irtose in namespace kequate has this body.
 ----------- END OF FAILURE REPORT -------------- 

Error: processing vignette 'irtguide.Rnw' failed with diagnostics:
 chunk 3 
Error in if (class(P) %in% c("ConfirmatoryClass", "SingleGroupClass",  : 
  the condition has length > 1

--- failed re-building 'irtguide.Rnw'

--- re-building 'kequate.Rnw' using Sweave
Loading required package: ltm
Loading required package: MASS
Loading required package: msm
Loading required package: polycor

Attaching package: 'kequate'

The following object is masked _by_ '.GlobalEnv':

    simeq

--- finished re-building 'kequate.Rnw'

SUMMARY: processing the following file failed:
  'irtguide.Rnw'

Error: Vignette re-building failed.
Execution halted