R问题:epiR和epi.2by2函数:无法加载依赖项,zexact

问题描述 投票:0回答:1

我在 Windows 11 上使用 R 版本 4.2.3 (2023-03-15 ucrt) 和 R Studio 版本 2023.12.0。

我在使用epiR和epi.2by2函数时无法加载Zexact函数。当我运行命令时,我收到以下错误消息,如示例所示:

#------------------------------------------------ -------------------------------------------------# 数据 <- c(24,14,137,222) # a,b,c,d

epi.2by2(dat = dat,方法=“横截面”,conf.level = 0.95,单位= 1, 解释= FALSE,结果=“as.columns”) #------------------------------------------------- ------------------------------------------------# zexact(as.matrix(cbind(a, N1)), conf.level = conf.level) 中的错误: 找不到函数“zexact”

我安装了带有所有依赖项的 epiR,但这并没有解决问题。更一般地说,我正在寻找用于多个分层 2x2 表分析的良好 R 包,并且如果有任何其他建议,我将不胜感激。

谢谢你,

加斯·劳舍尔 UIC公共卫生学院 伊利诺伊州芝加哥

r rstudio
1个回答
0
投票

我能够重现此内容并安装

epiR
包,并且代码有效。如果您没有最新版本的软件包,可以尝试使用
remove.packages("epiR")
卸载 epiR 软件包,然后再次尝试重新安装。

> library(epiR)
Loading required package: survival
Package epiR 2.0.66 is loaded
Type help(epi.about) for summary information
Type browseVignettes(package = 'epiR') to learn how to use epiR for applied epidemiological analyses


> 
> 
> # Your data
> dat <- c(24, 14, 137, 222)
> 
> # Run epi.2by2
> epi.2by2(dat = dat, method = "cross.sectional", conf.level = 0.95, units = 1,
+          interpret = FALSE, outcome = "as.columns")
             Outcome +    Outcome -      Total               Prev risk *
Exposed +           24           14         38       0.63 (0.46 to 0.78)
Exposed -          137          222        359       0.38 (0.33 to 0.43)
Total              161          236        397       0.41 (0.36 to 0.46)

Point estimates and 95% CIs:
-------------------------------------------------------------------
Prev risk ratio                                1.66 (1.26, 2.18)
Prev odds ratio                                2.78 (1.39, 5.55)
Attrib prev in the exposed *                   0.25 (0.09, 0.41)
Attrib fraction in the exposed (%)            39.58 (20.35, 54.16)
Attrib prev in the population *                0.02 (-0.05, 0.09)
Attrib fraction in the population (%)         5.90 (1.58, 10.03)
-------------------------------------------------------------------
Uncorrected chi2 test that OR = 1: chi2(1) = 8.906 Pr>chi2 = 0.003
Fisher exact test that OR = 1: Pr>chi2 = 0.005
 Wald confidence limits
 CI: confidence interval
 * Outcomes per population unit 
> 
© www.soinside.com 2019 - 2024. All rights reserved.