Search code examples
rdata-sciencemodeling

summary.eRm confint: 95% confidence interval or 97.5% when using summary(rasch.model)


I've just dug around R using the package eRm in order to find out, how confint calculates the confidence interval for a Rasch Model. Using

getAnywhere(summary.eRm)

I found that the code actually using confint is this:

function (object, ...) 
{
    cat("\n")
    cat("Results of", object$model, "estimation: \n")
    cat("\n")
    cat("Call: ", deparse(object$call), "\n")
    cat("\n")
    cat("Conditional log-likelihood:", object$loglik, "\n")
    cat("Number of iterations:", object$iter, "\n")
    cat("Number of parameters:", object$npar, "\n")
    cat("\n")
    X <- object$X
    X01 <- object$X01
    mt_vek <- apply(X, 2, max, na.rm = TRUE)
    **ci <- confint(object, "eta")**
    if (object$model %in% c("RM", "RSM", "PCM")) 
        if (is.null(object$call$W)) {
            cat("Item (Category) Difficulty Parameters (eta):")
        }
        else {
            cat("Item (Category) Parameters (eta):\nBased on design matrix W =", 
                deparse(object$call$W))
        }
    else cat("Basic Parameters eta")
    cat(" with 0.95 CI:\n")
    coeftable <- as.data.frame(cbind(round(object$etapar, 3), 
        round(object$se.eta, 3), round(ci, 3)))
    colnames(coeftable) <- c("Estimate", "Std. Error", "lower CI", 
        "upper CI")
    rownames(coeftable) <- names(object$etapar)
    print(coeftable)
    **ci <- confint(object, "beta")**
    cat("\nItem Easiness Parameters (beta) with 0.95 CI:\n")
    coeftable <- cbind(round(object$betapar, 3), round(object$se.beta, 
        3), round(ci, 3))
    colnames(coeftable) <- c("Estimate", "Std. Error", "lower CI", 
        "upper CI")
    rownames(coeftable) <- names(object$betapar)
    print(coeftable)
    cat("\n")
}

Now having looked at the ?confint menu, I found that it defaults to a 97.5% CI if nothing else is specified. Does this mean, that the CI calculated is wrongly named CI 95%?


Solution

  • A 95% confidence interval means that the total area outside the interval is 5%. This is apportioned to 2.5% below the lower confidence limit and 2.5% above the upper confidence limit. The top end of the interval is at the 97.5%-ile, and the bottom end of the interval is at the 2.5%-ile.

    Example: a sample of 15 men generated average brain volume of 1210cc, with a standard deviation of 37cc. For this population we can calculate the 95% confidence interval as follows:

    1210 + c(-1,1) * (37/sqrt(15))*qt(.975,15)
    

    ...and the output.

    > 1210 + c(-1,1) * (37/sqrt(15))*qt(.975,15)
    [1] 1189.637 1230.363
    >
    

    Notice that we use qt(.975,15) to calculate the interval, not qt(.95,15).

    Also, the help for confint() confirms this:

    enter image description here