Exact same data one running, another not running i

2020-07-27 06:02发布

问题:

When I run my function call robu() using dat1 data.frame, the function runs perfectly fine. However, when I extract EXACTLY the same data from a larger data.frame and call it dat2 the same robu() call fails!

Am I missing anything here? (fully reproducible code appears below)

library(robumeta)

dat1 <- data.frame(study.name = c("Guo", "Guo", "Guo"),
                         dint = c(0.8525524, 0.6801170, 0.7709437),
                           SD = c(0.3127318, 0.2994228, 0.3075567))

robu(dint~1, data = dat1, var = SD^2, study = study.name) ## Runs perfectly fine!!!!

d1 <- read.csv("https://raw.githubusercontent.com/rnorouzian/m/master/v7.csv", h = T)

dat2 <- d1[100:102,1:3]  ### Exactly same data as `dat1`

robu(dint~1, data = dat2, var = SD^2, study = study.name) ## NOW FAILS ! `infinite or missing values in 'x'`

回答1:

We can round the numeric columns to specific number of digits as those columns from 'dat1' and 'dat2' are not the same (all.equal(dat1$dint, dat2$dint))

dat2[2:3] <- lapply(dat2[2:3], round, digits = 7)
robu(dint~1, data = dat2, var = SD^2, study = study.name) 
#RVE: Correlated Effects Model with Small-Sample Corrections 

#Model: dint ~ 1 

#Number of studies = 1 
#Number of outcomes = 3 (min = 3 , mean = 3 , median = 3 , max = 3 )
#Rho = 0.8 
#I.sq = 0 
#Tau.sq = 0 

#               Estimate                StdErr           t-value dfs P(|t|>) 95% #CI.L 95% CI.U Sig
#1 X.Intercept.    0.768 0.0000000000000000125 61358530816235696   1       0    #0.768    0.768 ***
#---
#Signif. codes: < .01 *** < .05 ** < .10 *
#---