Skip to content

Commit

Permalink
Updated a few tests using se().
Browse files Browse the repository at this point in the history
  • Loading branch information
wviechtb committed Apr 12, 2024
1 parent f9dc9fb commit 1d9345b
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 60 deletions.
6 changes: 3 additions & 3 deletions tests/testthat/test_analysis_example_berkey1995.r
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test_that("results are correct for the random-effects model.", {

### compare with results on page 408
expect_equivalent(coef(res.RE), -0.5429, tolerance=.tol[["coef"]])
expect_equivalent(res.RE$se, 0.1842, tolerance=.tol[["se"]])
expect_equivalent(se(res.RE), 0.1842, tolerance=.tol[["se"]])
expect_equivalent(res.RE$tau2, 0.2682, tolerance=.tol[["var"]])

})
Expand All @@ -38,7 +38,7 @@ test_that("results are correct for the mixed-effects meta-regression model.", {

### compare with results on page 408
expect_equivalent(coef(res.ME), c(-0.6303, -0.0268), tolerance=.tol[["coef"]]) ### -0.6304 in article
expect_equivalent(res.ME$se, c(0.1591, 0.0110), tolerance=.tol[["se"]])
expect_equivalent(se(res.ME), c(0.1591, 0.0110), tolerance=.tol[["se"]])
expect_equivalent(res.ME$tau2, 0.1572, tolerance=.tol[["var"]])
expect_warning(tmp <- anova(res.RE, res.ME))
expect_equivalent(tmp$R2, 41.3844, tolerance=.tol[["r2"]])
Expand All @@ -58,7 +58,7 @@ test_that("results are correct for the fixed-effects meta-regression model.", {

### compare with results on page 408
expect_equivalent(coef(res.FE), c(-0.5949, -0.0282), tolerance=.tol[["coef"]]) ### -0.5950 in article
expect_equivalent(res.FE$se, c(0.0696, 0.0040), tolerance=.tol[["se"]]) ### 0.0039 in article
expect_equivalent(se(res.FE), c(0.0696, 0.0040), tolerance=.tol[["se"]]) ### 0.0039 in article

### predicted risk ratios based on the fixed-effects model
tmp <- predict(res.FE, newmods=c(33.46,42)-33.46, transf=exp, digits=2)
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test_analysis_example_berkey1998.r
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test_that("results are correct for the multiple outcomes random-effects model.",

### (results for this model not given in paper)
expect_equivalent(coef(res), c(-0.3379, 0.3448), tolerance=.tol[["coef"]])
expect_equivalent(res$se, c(0.0798, 0.0495), tolerance=.tol[["se"]])
expect_equivalent(se(res), c(0.0798, 0.0495), tolerance=.tol[["se"]])
expect_equivalent(res$tau2, c(0.0261, 0.0070), tolerance=.tol[["var"]])
expect_equivalent(res$rho, 0.6992, tolerance=.tol[["cor"]])

Expand All @@ -33,7 +33,7 @@ test_that("results are correct for the multiple outcomes mixed-effects (meta-reg

### compare with results on page 2545 (Table II)
expect_equivalent(coef(res), c(-0.3351, 0.3479, -0.0108, 0.0010), tolerance=.tol[["coef"]])
expect_equivalent(res$se, c(0.0787, 0.0520, 0.0243, 0.0154), tolerance=.tol[["se"]])
expect_equivalent(se(res), c(0.0787, 0.0520, 0.0243, 0.0154), tolerance=.tol[["se"]])
expect_equivalent(res$tau2, c(0.0250, 0.0080), tolerance=.tol[["var"]])
expect_equivalent(res$rho, 0.6587, tolerance=.tol[["cor"]])

Expand All @@ -46,7 +46,7 @@ test_that("results are correct for the multiple outcomes mixed-effects (meta-reg

### (results for this model not given in paper)
expect_equivalent(coef(res), c(-0.3351, 0.3479, -0.0108, 0.0118), tolerance=.tol[["coef"]])
expect_equivalent(res$se, c(0.0787, 0.0520, 0.0243, 0.0199), tolerance=.tol[["se"]])
expect_equivalent(se(res), c(0.0787, 0.0520, 0.0243, 0.0199), tolerance=.tol[["se"]])
expect_equivalent(res$pval, c(0.0000, 0.0000, 0.6563, 0.5534), tolerance=.tol[["pval"]])

})
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_analysis_example_dersimonian2007.r
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ test_that("results are correct for the CLASP example.", {
results <- rbind(
tau = sapply(res.all, function(x) sqrt(x$tau2)),
mu = sapply(res.all, coef),
se = sapply(res.all, function(x) sqrt(vcov(x))))
se = sapply(res.all, se))
colnames(results) <- c("PM", "CA", "DL", "CA2", "DL2", "EB", "ML", "REML", "HS", "SJ", "SJ2", "HSk", "GENQM", "PMM")
tmp <- t(results)

Expand Down
18 changes: 9 additions & 9 deletions tests/testthat/test_analysis_example_konstantopoulos2011.r
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test_that("results are correct for the two-level random-effects model fitted wit

### compare with results on page 70 (Table 4)
expect_equivalent(coef(res), 0.1279, tolerance=.tol[["coef"]])
expect_equivalent(res$se, 0.0439, tolerance=.tol[["se"]])
expect_equivalent(se(res), 0.0439, tolerance=.tol[["se"]])
expect_equivalent(res$tau2, 0.0884, tolerance=.tol[["var"]])
expect_equivalent(res$se.tau2, 0.0202, tolerance=.tol[["sevar"]])

Expand All @@ -32,7 +32,7 @@ test_that("results are correct for the two-level mixed-effects model fitted with

### compare with results on page 70 (Table 4)
expect_equivalent(coef(res), c(0.1258, 0.0052), tolerance=.tol[["coef"]])
expect_equivalent(res$se, c(0.0440, 0.0044), tolerance=.tol[["se"]]) ### 0.043 in paper
expect_equivalent(se(res), c(0.0440, 0.0044), tolerance=.tol[["se"]]) ### 0.043 in paper
expect_equivalent(res$tau2, 0.0889, tolerance=.tol[["var"]]) ### 0.088 in paper
expect_equivalent(res$se.tau2, 0.0205, tolerance=.tol[["sevar"]])

Expand All @@ -49,7 +49,7 @@ test_that("results are correct for the two-level random-effects model fitted wit

### compare with results on page 70 (Table 4)
expect_equivalent(coef(res), 0.1279, tolerance=.tol[["coef"]])
expect_equivalent(res$se, 0.0439, tolerance=.tol[["se"]])
expect_equivalent(se(res), 0.0439, tolerance=.tol[["se"]])
expect_equivalent(res$sigma2, 0.0884, tolerance=.tol[["var"]])

})
Expand All @@ -63,7 +63,7 @@ test_that("results are correct for the three-level random-effects model fitted w

### compare with results on page 71 (Table 5)
expect_equivalent(coef(res.ml), 0.1845, tolerance=.tol[["coef"]])
expect_equivalent(res.ml$se, 0.0805, tolerance=.tol[["se"]])
expect_equivalent(se(res.ml), 0.0805, tolerance=.tol[["se"]])
expect_equivalent(res.ml$sigma2, c(0.0577, 0.0329), tolerance=.tol[["var"]])

sav <- predict(res.ml)
Expand All @@ -79,7 +79,7 @@ test_that("results are correct for the three-level mixed-effects model fitted wi

### compare with results on page 71 (Table 5)
expect_equivalent(coef(res.ml), c(0.1780, 0.0051), tolerance=.tol[["coef"]]) ### intercept is given as 0.183 in paper, but this seems to be a misprint
expect_equivalent(res.ml$se, c(0.0805, 0.0085), tolerance=.tol[["se"]])
expect_equivalent(se(res.ml), c(0.0805, 0.0085), tolerance=.tol[["se"]])
expect_equivalent(res.ml$sigma2, c(0.0565, 0.0329), tolerance=.tol[["var"]])

})
Expand All @@ -92,7 +92,7 @@ test_that("results are correct for the three-level random-effects model fitted w

### (results for this not given in paper)
expect_equivalent(coef(res.ml), 0.1847, tolerance=.tol[["coef"]])
expect_equivalent(res.ml$se, 0.0846, tolerance=.tol[["se"]])
expect_equivalent(se(res.ml), 0.0846, tolerance=.tol[["se"]])
expect_equivalent(res.ml$sigma2, c(0.0651, 0.0327), tolerance=.tol[["var"]])

### ICC
Expand Down Expand Up @@ -150,7 +150,7 @@ test_that("results are correct for the three-level random-effects model when usi

### (results for this not given in paper)
expect_equivalent(coef(res.mv), 0.1847, tolerance=.tol[["coef"]])
expect_equivalent(res.mv$se, 0.0846, tolerance=.tol[["se"]])
expect_equivalent(se(res.mv), 0.0846, tolerance=.tol[["se"]])
expect_equivalent(res.mv$tau2, 0.0978, tolerance=.tol[["var"]])
expect_equivalent(res.mv$rho, 0.6653, tolerance=.tol[["cor"]])

Expand Down Expand Up @@ -215,7 +215,7 @@ test_that("restarting with 'restart=TRUE' works.", {
res <- rma.mv(yi, vi, random = ~ 1 | district/study, data=dat, control=list(maxiter=4), restart=TRUE)

expect_equivalent(coef(res), 0.1847132, tolerance=.tol[["coef"]])
expect_equivalent(res$se, 0.08455592, tolerance=.tol[["se"]])
expect_equivalent(se(res), 0.08455592, tolerance=.tol[["se"]])
expect_equivalent(res$sigma2, c(0.06506194, 0.03273652), tolerance=.tol[["var"]])

})
Expand All @@ -233,7 +233,7 @@ test_that("results are correct when allowing for different tau^2 per district.",
out <- capture.output(print(summary(res, digits=4)))

expect_equivalent(coef(res), 0.1270, tolerance=.tol[["coef"]])
expect_equivalent(res$se, 0.0588, tolerance=.tol[["se"]])
expect_equivalent(se(res), 0.0588, tolerance=.tol[["se"]])
expect_equivalent(res$tau2, c(0.0000, 0.0402, 0.0000, 0.0582, 0.0082, 0.0000, 0.5380, 0.0008, 0.0606, 0.1803, 0.0000), tolerance=.tol[["var"]])

### check that output is also correct
Expand Down
26 changes: 13 additions & 13 deletions tests/testthat/test_analysis_example_stijnen2010.r
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test_that("results for the normal-normal model are correct (measure=='PLO')", {

### compare with results on page 3050 (Table II)
expect_equivalent(coef(res), -3.3018, tolerance=.tol[["coef"]])
expect_equivalent(res$se, 0.2378, tolerance=.tol[["se"]])
expect_equivalent(se(res), 0.2378, tolerance=.tol[["se"]])
expect_equivalent(res$tau2, 0.6629, tolerance=.tol[["var"]])
tmp <- predict(res, transf=transf.ilogit)
expect_equivalent(tmp$pred, 0.0355, tolerance=.tol[["pred"]]) ### 0.035 in paper
Expand All @@ -26,7 +26,7 @@ test_that("results for the normal-normal model are correct (measure=='PLO')", {

### compare with results on page 3050 (Table II)
expect_equivalent(coef(res), -4.2604, tolerance=.tol[["coef"]])
expect_equivalent(res$se, 0.2589, tolerance=.tol[["se"]])
expect_equivalent(se(res), 0.2589, tolerance=.tol[["se"]])
expect_equivalent(res$tau2, 0.3928, tolerance=.tol[["var"]])
tmp <- predict(res, transf=transf.ilogit)
expect_equivalent(tmp$pred, 0.0139, tolerance=.tol[["pred"]])
Expand All @@ -43,7 +43,7 @@ test_that("results for the binomial-normal normal are correct (measure=='PLO')",

### compare with results on page 3050 (Table II)
expect_equivalent(coef(res), -3.4964, tolerance=.tol[["coef"]])
expect_equivalent(res$se, 0.2570, tolerance=.tol[["se"]])
expect_equivalent(se(res), 0.2570, tolerance=.tol[["se"]])
expect_equivalent(res$tau2, 0.8124, tolerance=.tol[["var"]])
tmp <- predict(res, transf=transf.ilogit)
expect_equivalent(tmp$pred, 0.0294, tolerance=.tol[["pred"]])
Expand All @@ -54,7 +54,7 @@ test_that("results for the binomial-normal normal are correct (measure=='PLO')",

### compare with results on page 3050 (Table II)
expect_equivalent(coef(res), -4.8121, tolerance=.tol[["coef"]])
expect_equivalent(res$se, 0.3555, tolerance=.tol[["se"]])
expect_equivalent(se(res), 0.3555, tolerance=.tol[["se"]])
expect_equivalent(res$tau2, 0.8265, tolerance=.tol[["var"]])
tmp <- predict(res, transf=transf.ilogit)
expect_equivalent(tmp$pred, 0.0081, tolerance=.tol[["pred"]])
Expand All @@ -69,7 +69,7 @@ test_that("results for the normal-normal model are correct (measure=='OR')", {

### compare with results on page 3052 (Table III)
expect_equivalent(coef(res), -0.9804, tolerance=.tol[["coef"]])
expect_equivalent(res$se, 0.2435, tolerance=.tol[["se"]]) ### 0.244 in paper
expect_equivalent(se(res), 0.2435, tolerance=.tol[["se"]]) ### 0.244 in paper
expect_equivalent(sqrt(res$tau2), 0.1886, tolerance=.tol[["var"]])
tmp <- predict(res, transf=exp)
expect_equivalent(tmp$pred, 0.3752, tolerance=.tol[["pred"]])
Expand All @@ -87,7 +87,7 @@ test_that("results for the conditional logistic model with exact likelihood are

### compare with results on page 3052 (Table III)
expect_equivalent(coef(res), -1.3532, tolerance=.tol[["coef"]])
expect_equivalent(res$se, 0.3511, tolerance=.tol[["se"]])
expect_equivalent(se(res), 0.3511, tolerance=.tol[["se"]])
expect_equivalent(sqrt(res$tau2), 0.8327, tolerance=.tol[["var"]])
tmp <- predict(res, transf=exp)
expect_equivalent(tmp$pred, 0.2584, tolerance=.tol[["pred"]]) ### 0.25 in paper
Expand All @@ -104,7 +104,7 @@ test_that("results for the conditional logistic model with approximate likelihoo

### compare with results on page 3052 (Table III)
expect_equivalent(coef(res), -1.3027, tolerance=.tol[["coef"]])
expect_equivalent(res$se, 0.3386, tolerance=.tol[["se"]])
expect_equivalent(se(res), 0.3386, tolerance=.tol[["se"]])
expect_equivalent(sqrt(res$tau2), 0.7750, tolerance=.tol[["var"]]) ### 0.77 in paper
tmp <- predict(res, transf=exp)
expect_equivalent(tmp$pred, 0.2718, tolerance=.tol[["pred"]])
Expand All @@ -128,7 +128,7 @@ test_that("results for the normal-normal model are correct (measure=='IRLN')", {

### compare with results on page 3054 (Table VII)
expect_equivalent(coef(res), 1.4676, tolerance=.tol[["coef"]])
expect_equivalent(res$se, 0.2425, tolerance=.tol[["se"]])
expect_equivalent(se(res), 0.2425, tolerance=.tol[["se"]])
expect_equivalent(res$tau2, 0.3699, tolerance=.tol[["var"]])
tmp <- predict(res, transf=exp)
expect_equivalent(tmp$pred, 4.3389, tolerance=.tol[["pred"]])
Expand All @@ -139,7 +139,7 @@ test_that("results for the normal-normal model are correct (measure=='IRLN')", {

### compare with results on page 3054 (Table VII)
expect_equivalent(coef(res), 0.9808, tolerance=.tol[["coef"]])
expect_equivalent(res$se, 0.3259, tolerance=.tol[["se"]])
expect_equivalent(se(res), 0.3259, tolerance=.tol[["se"]])
expect_equivalent(res$tau2, 0.6393, tolerance=.tol[["var"]])
tmp <- predict(res, transf=exp)
expect_equivalent(tmp$pred, 2.6667, tolerance=.tol[["pred"]])
Expand All @@ -156,7 +156,7 @@ test_that("results for the Poisson-normal model are correct (measure=='IRLN')",

### compare with results on page 3054 (Table VII)
expect_equivalent(coef(res), 1.4007, tolerance=.tol[["coef"]])
expect_equivalent(res$se, 0.2310, tolerance=.tol[["se"]])
expect_equivalent(se(res), 0.2310, tolerance=.tol[["se"]])
expect_equivalent(res$tau2, 0.3165, tolerance=.tol[["var"]]) ### 0.316 in paper
tmp <- predict(res, transf=exp)
expect_equivalent(tmp$pred, 4.0580, tolerance=.tol[["pred"]])
Expand All @@ -167,7 +167,7 @@ test_that("results for the Poisson-normal model are correct (measure=='IRLN')",

### compare with results on page 3054 (Table VII)
expect_equivalent(coef(res), 0.8494, tolerance=.tol[["coef"]]) ### 0.850 in paper
expect_equivalent(res$se, 0.3303, tolerance=.tol[["se"]])
expect_equivalent(se(res), 0.3303, tolerance=.tol[["se"]])
expect_equivalent(res$tau2, 0.6543, tolerance=.tol[["var"]])
tmp <- predict(res, transf=exp)
expect_equivalent(tmp$pred, 2.3383, tolerance=.tol[["pred"]])
Expand All @@ -182,7 +182,7 @@ test_that("results for the normal-normal model are correct (measure=='IRR')", {

### compare with results on page 3055 (Table VIII)
expect_equivalent(coef(res), -0.3963, tolerance=.tol[["coef"]])
expect_equivalent(res$se, 0.2268, tolerance=.tol[["se"]]) ### 0.223 in paper
expect_equivalent(se(res), 0.2268, tolerance=.tol[["se"]]) ### 0.223 in paper
expect_equivalent(sqrt(res$tau2), 0.3060, tolerance=.tol[["var"]])
tmp <- predict(res, transf=exp)
expect_equivalent(tmp$pred, 0.6728, tolerance=.tol[["pred"]])
Expand All @@ -199,7 +199,7 @@ test_that("results for the Poisson-normal model are correct (measure=='IRR')", {

### compare with results on page 3055 (Table VIII)
expect_equivalent(coef(res), -0.4762, tolerance=.tol[["coef"]])
expect_equivalent(res$se, 0.2377, tolerance=.tol[["se"]])
expect_equivalent(se(res), 0.2377, tolerance=.tol[["se"]])
expect_equivalent(sqrt(res$tau2), 0.3501, tolerance=.tol[["var"]])
tmp <- predict(res, transf=exp)
expect_equivalent(tmp$pred, 0.6211, tolerance=.tol[["pred"]])
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test_analysis_example_vanhouwelingen1993.r
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ test_that("results of the equal-effects conditional logistic model are correct."

### compare with results on page 2275 (in text)
expect_equivalent(coef(res), 0.1216, tolerance=.tol[["coef"]])
expect_equivalent(res$se, 0.0995, tolerance=.tol[["se"]])
expect_equivalent(se(res), 0.0995, tolerance=.tol[["se"]])
expect_equivalent(res$ci.lb, -0.0734, tolerance=.tol[["ci"]])
expect_equivalent(res$ci.ub, 0.3165, tolerance=.tol[["ci"]]) ### 0.31 in paper (rounded a bit more heavily, so 32-bit and 64-bit versions give same result)
expect_equivalent(c(logLik(res)), -53.6789, tolerance=.tol[["fit"]])
Expand All @@ -51,7 +51,7 @@ test_that("results of the equal-effects conditional logistic model are correct."

### some very minor discrepancies
expect_equivalent(coef(res), 0.1216, tolerance=.tol[["coef"]])
expect_equivalent(res$se, 0.0996, tolerance=.tol[["se"]])
expect_equivalent(se(res), 0.0996, tolerance=.tol[["se"]])
expect_equivalent(res$ci.lb, -0.0735, tolerance=.tol[["ci"]])
expect_equivalent(res$ci.ub, 0.3167, tolerance=.tol[["ci"]])
expect_equivalent(c(logLik(res)), -53.6789, tolerance=.tol[["fit"]])
Expand All @@ -66,7 +66,7 @@ test_that("results of the random-effects conditional logistic model are correct.

### compare with results on page 2277 (in text)
expect_equivalent(coef(res), 0.1744, tolerance=.tol[["coef"]])
expect_equivalent(res$se, 0.1364, tolerance=.tol[["se"]])
expect_equivalent(se(res), 0.1364, tolerance=.tol[["se"]])
expect_equivalent(res$ci.lb, -0.0929, tolerance=.tol[["ci"]])
expect_equivalent(res$ci.ub, 0.4417, tolerance=.tol[["ci"]])
expect_equivalent(c(logLik(res)), -52.99009, tolerance=.tol[["fit"]])
Expand All @@ -77,7 +77,7 @@ test_that("results of the random-effects conditional logistic model are correct.

### no discrepancies
expect_equivalent(coef(res), 0.1744, tolerance=.tol[["coef"]])
expect_equivalent(res$se, 0.1364, tolerance=.tol[["se"]])
expect_equivalent(se(res), 0.1364, tolerance=.tol[["se"]])
expect_equivalent(res$ci.lb, -0.0930, tolerance=.tol[["ci"]])
expect_equivalent(res$ci.ub, 0.4418, tolerance=.tol[["ci"]])
expect_equivalent(c(logLik(res)), -52.99009, tolerance=.tol[["fit"]])
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test_analysis_example_vanhouwelingen2002.r
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ test_that("results for the bivariate model are correct.", {

### compare with results on pages 604-605 (in text)
expect_equivalent(coef(res), c(-4.0960, -0.7378), tolerance=.tol[["coef"]])
expect_equivalent(res$se, c(0.4347, 0.1797), tolerance=.tol[["se"]])
expect_equivalent(se(res), c(0.4347, 0.1797), tolerance=.tol[["se"]])

### estimated odds ratio
tmp <- predict(res, newmods=1, intercept=FALSE, transf=exp, digits=3)
Expand Down Expand Up @@ -212,23 +212,23 @@ test_that("results for the meta-regression analyses are correct.", {

### compare with results on pages 608-609 (in text)
expect_equivalent(coef(res), c(0.3710, -0.0327), tolerance=.tol[["coef"]])
expect_equivalent(res$se, c(0.1061, 0.0034), tolerance=.tol[["se"]])
expect_equivalent(se(res), c(0.1061, 0.0034), tolerance=.tol[["se"]])
expect_equivalent(res$tau2, 0.0040, tolerance=.tol[["var"]])
expect_equivalent(res$R2, 98.6691, tolerance=.tol[["r2"]])

res <- rma.mv(yi, vi, mods = ~ group + group:I(ablat-33) - 1, random = ~ group | trial, struct="UN", data=dat.long, method="ML", sparse=.sparse)

### compare with results on pages 612-613 (in text)
expect_equivalent(coef(res), c(-4.1174, -4.8257, 0.0725, 0.0391), tolerance=.tol[["coef"]])
expect_equivalent(res$se, c(0.3061, 0.3129, 0.0219, 0.0224), tolerance=.tol[["se"]])
expect_equivalent(se(res), c(0.3061, 0.3129, 0.0219, 0.0224), tolerance=.tol[["se"]])
expect_equivalent(res$tau2, c(1.1819, 1.2262), tolerance=.tol[["var"]])
expect_equivalent(res$rho, 1.0000, tolerance=.tol[["cor"]])

res <- rma.mv(yi, vi, mods = ~ group*I(ablat-33), random = ~ group | trial, struct="UN", data=dat.long, method="ML", sparse=.sparse)

### compare with results on pages 612-613 (in text)
expect_equivalent(coef(res), c(-4.1174, -0.7083, 0.0725, -0.0333), tolerance=.tol[["coef"]])
expect_equivalent(res$se, c(0.3061, 0.0481, 0.0219, 0.0028), tolerance=.tol[["se"]])
expect_equivalent(se(res), c(0.3061, 0.0481, 0.0219, 0.0028), tolerance=.tol[["se"]])
expect_equivalent(res$tau2, c(1.1819, 1.2262), tolerance=.tol[["var"]])
expect_equivalent(res$rho, 1.0000, tolerance=.tol[["cor"]])

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_misc_residuals.r
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ test_that("rstudent() yields the same results as a mean shift outlier model for
res <- rma(yi, vi, mods = ~ trial1, data=dat)

expect_equivalent(coef(res)[2], sav$resid[1], tolerance=.tol[["coef"]])
expect_equivalent(res$se[2], sav$se[1], tolerance=.tol[["se"]])
expect_equivalent(se(res)[2], sav$se[1], tolerance=.tol[["se"]])

res <- rma(yi, vi, data=dat, test="knha")
sav <- rstudent(res)
res <- rma(yi, vi, mods = ~ trial1, data=dat, test="knha")

expect_equivalent(coef(res)[2], sav$resid[1], tolerance=.tol[["pred"]])
expect_equivalent(res$se[2], sav$se[1], tolerance=.tol[["se"]])
expect_equivalent(se(res)[2], sav$se[1], tolerance=.tol[["se"]])

})

Expand Down
Loading

0 comments on commit 1d9345b

Please sign in to comment.