首页 > 解决方案 > summary.eRm confint:95% 置信区间或 97.5% 使用 summary(rasch.model)

问题描述

我刚刚使用包 eRm 对 R 进行了挖掘,以了解 confint 如何计算 Rasch 模型的置信区间。使用

getAnywhere(summary.eRm)

我发现实际使用 confint 的代码是这样的:

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")
}

现在查看?confint菜单,我发现如果没有指定其他内容,它默认为 97.5% CI。这是否意味着计算的 CI 被错误地命名为 CI 95%?

标签: rdata-sciencemodeling

解决方案


95% 置信区间意味着区间外的总面积为 5%。这被分配到低于置信下限的 2.5% 和高于置信上限的 2.5%。区间的顶端位于 97.5%-ile,区间的底端位于 2.5%-ile。

示例:15 名男性的样本产生的平均脑容量为 1210cc,标准差为 37cc。对于这个群体,我们可以计算 95% 置信区间如下:

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

...和输出。

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

请注意,我们使用qt(.975,15)来计算区间,而不是qt(.95,15)

此外,帮助confint()证实了这一点:

在此处输入图像描述


推荐阅读