로그 응답 비율을 수행하려면 R의 'metafor'패키지를 사용하고 있습니다. 내 수단 중 일부는 036이며, 내 escalc
명령 (이후 log(0)
은 -inf 임) 이후 경고의 원인 인 것으로 보입니다. 메타포 패키지는 이것을 피하기 위해 0에 작은 값을 추가하는 방법을 제공한다. 문서의 내용 :'Metafor'가 0 인 로그 응답 비율
"0 인 셀 항목은 특히 상대적 위험과 오즈 비율에 문제가 될 수 있습니다 .2x2 테이블의 셀에 작은 상수를 추가하는 것은이 문제에 대한 일반적인 해결책입니다. .] to = "only0"일 때, add 값은 적어도 하나의 셀이 0 인 테이블에서만 2x2 테이블의 각 셀에 추가됩니다. "
내 데이터가 2x2 테이블이 아니기 때문에 내 오류가 해결되지 않습니다. (this example의 서식과 비슷한 ply 패키지에서 ddply로 요약 된 결과입니다. 수동으로 작은 숫자로 0 값을 대체해야합니까 아니면 더 우아한 방법이 있습니까? (이 예제에서 0이있는 행은 또한 1의 샘플 크기를 가지므로 분산이 없으며 분석에서 제외됩니다.이 함수가 미래에 어떻게 작동하는지 알고 싶습니다.)
재현 예 :
가 인용되는 단락 한 2 × 2 테이블에 기초하여 계산할 수 측정에 적용dat<-dput(Bin_Y_count_summary_wide)
structure(list(Species.ID = c("CAFERANA", "TR11", "TR118", "TR500",
"TR504", "TR9", "TR9_US1"), Y_num_mean.early = c(2, 147.375,
4.5, 0.5, 12.5, 93.4523809523809, 5), N.early = c(1L, 4L, 2L,
4L, 4L, 7L, 2L), sd.early = c(NA, 174.699444284558, 6.36396103067893,
1, 22.4127939653523, 137.506118190001, 7.07106781186548), se.early = c(NA,
87.3497221422789, 4.5, 0.5, 11.2063969826762, 51.9724274972283,
5), Y_num_mean.late = c(0, 3.625, 2.98482142857143, 0.8, 3, 47.2,
0), N.late = c(1L, 4L, 7L, 10L, 10L, 8L, 1L), sd.late = c(NA,
7.25, 5.10407804830748, 1.75119007154183, 8.03118920210451, 40.7351024477486,
NA), se.late = c(NA, 3.625, 1.9291601697265, 0.553774924194538,
2.53968501984006, 14.4020335865659, NA), Y_num_mean.wet = c(NA,
71.5, 0, 12, 27, 0, NA), N.wet = c(NA, 2L, 1L, 2L, 2L, 2L, NA
), sd.wet = c(NA, 17.6776695296637, NA, 9.89949493661167, 38.1837661840736,
0, NA), se.wet = c(NA, 12.5, NA, 7, 27, 0, NA)), row.names = c(NA,
7L), .Names = c("Species.ID", "Y_num_mean.early", "N.early",
"sd.early", "se.early", "Y_num_mean.late", "N.late", "sd.late",
"se.late", "Y_num_mean.wet", "N.wet", "sd.wet", "se.wet"), class = "data.frame", reshapeWide = structure(list(
v.names = c("Y_num_mean", "N", "sd", "se"), timevar = "early_or_late",
idvar = "Species.ID", times = c("early", "late", "wet"),
varying = structure(c("Y_num_mean.early", "N.early", "sd.early",
"se.early", "Y_num_mean.late", "N.late", "sd.late", "se.late",
"Y_num_mean.wet", "N.wet", "sd.wet", "se.wet"), .Dim = c(4L,
3L))), .Names = c("v.names", "timevar", "idvar", "times",
"varying")))
# Warning produced from this command
test <- escalc(measure="ROM", m1i=Y_num_mean.early, sd1i=sd.early, n1i=N.early, m2i=Y_num_mean.late, sd2i=sd.late, n2i=N.late, data=dat, add=1/2, to="only0")
의미가 (거의) 제로가되지 않을 것 같은 좋은 점이있어서 내 질문이 거의 나오지 않습니다. – user2860703