使用 t 理论构造 CI
在之前的课程中,您使用"统计量 ± 若干个标准误"的公式来构造置信区间。使用自助法(bootstrapping)时,我们通常取 2 个标准误;而基于 t 的理论则使用特定的 t 倍数。
请同时使用默认的 tidy() 调用和 mutate() 显式计算置信区间上下界,为斜率参数构造一个 CI。请注意,这两种方法应当得到完全相同的 CI 数值,因为它们基于相同的计算。
alpha 已设为 0.05,twins 数据集的自由度已提供给您。
本练习是课程的一部分
R 中的线性回归推断
交互式实操练习
通过完成这段示例代码来试试这个练习。
alpha <- 0.05
degrees_of_freedom <- nrow(twins) - 2
# Calculate the confidence level
confidence_level <- ___
# Calculate the upper percentile cutoff
p_upper <- ___
# Find the critical value from the t-distribution
critical_value <- ___