You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用epikit::unite_ci()修改95%置信区间显示格式

修改epikit::unite_ci()的置信区间显示格式

要把默认的(0.1 -- 0.6)格式改成(0.1 to 0.6)或(0.1, 0.6),直接利用unite_ci()的sep参数自定义分隔符即可:

改为(0.1 to 0.6)格式

library(epikit)

# 示例数据
df <- data.frame(est = 0.35, lower = 0.1, upper = 0.6)

# 生成带"to"的置信区间
df$ci <- unite_ci(df, est, lower, upper, sep = " to ")
df$ci
# 输出:"0.35 (0.1 to 0.6)"

改为(0.1, 0.6)格式

# 生成带逗号分隔的置信区间
df$ci_comma <- unite_ci(df, est, lower, upper, sep = ", ")
df$ci_comma
# 输出:"0.35 (0.1, 0.6)"

仅输出置信区间(不含点估计)

如果不需要显示点估计,设置est_col = NULL即可:

df$ci_only <- unite_ci(df, lower, upper, est_col = NULL, sep = " to ")
df$ci_only
# 输出:"(0.1 to 0.6)"

内容的提问来源于stack exchange,提问作者Martin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.17 20:55:18