Hello,
Thanks for the more detailed explanation.
Unfortunately for me, you did not provide the data in format I could readily use, so I spent most of the time trying to get it into the correct format. Just for your information, these were the steps I had to perform before I could use the data
library(tidyverse)
library(datapasta)
#Select the tibble in the 'reprex' and copy it to clipboard
datapasta::df_paste()
test = data.frame(
stringsAsFactors = FALSE,
cols = c("1 K et al 112 115 48 27 57 75 39 24",
"2 L et al 273 265 95 82 65 80 48 18",
"3 M et l 39 40 3 6 71 68 NA 20.5",
"4 N et al 275 524 96 251 65 79 26 13",
"5 O et al 18 18 9 6 61 86 42 17",
"6 P et al 130 73 35 23 55 77 44 18")
)
test = test %>%
separate(cols, convert = T,
into = c("Authors", "Ne", "Nc", "Ee", "Ec", "Age", "Male",
"HTN", "DM", "w","x", "y", "z"))
test = test %>% mutate(Authors = paste(Ne, Nc, Ee))
test[2:9] = test[,5:12]
test = test[,1:9]
test[3,"DM"] = 20.5
head(test)
Authors Ne Nc Ee Ec Age Male HTN DM
1 K et al 112 115 48 27 57 75 39 24.0
2 L et al 273 265 95 82 65 80 48 18.0
3 M et l 39 40 3 6 71 68 NA 20.5
4 N et al 275 524 96 251 65 79 26 13.0
5 O et al 18 18 9 6 61 86 42 17.0
6 P et al 130 73 35 23 55 77 44 18.0
So I recommend you read the reprex guide again so that in future you can provide us with a dataset that looks like this:
#Generate a table that can be copy pasted into a reprex
datapasta::tribble_paste(test)
tibble::tribble(
~Authors, ~Ne, ~Nc, ~Ee, ~Ec, ~Age, ~Male, ~HTN, ~DM,
"K et al", 112L, 115L, 48L, 27L, 57L, 75L, 39L, 24,
"L et al", 273L, 265L, 95L, 82L, 65L, 80L, 48L, 18,
"M et l", 39L, 40L, 3L, 6L, 71L, 68L, NA, 20.5,
"N et al", 275L, 524L, 96L, 251L, 65L, 79L, 26L, 13,
"O et al", 18L, 18L, 9L, 6L, 61L, 86L, 42L, 17,
"P et al", 130L, 73L, 35L, 23L, 55L, 77L, 44L, 18
)
Anyway
I get the following when I then run your code:
library(tidyverse)
library(metafor)
library(meta)
test = tibble::tribble(
~Authors, ~Ne, ~Nc, ~Ee, ~Ec, ~Age, ~Male, ~HTN, ~DM,
"K et al", 112L, 115L, 48L, 27L, 57L, 75L, 39L, 24,
"L et al", 273L, 265L, 95L, 82L, 65L, 80L, 48L, 18,
"M et l", 39L, 40L, 3L, 6L, 71L, 68L, NA, 20.5,
"N et al", 275L, 524L, 96L, 251L, 65L, 79L, 26L, 13,
"O et al", 18L, 18L, 9L, 6L, 61L, 86L, 42L, 17,
"P et al", 130L, 73L, 35L, 23L, 55L, 77L, 44L, 18
)
mort<-metabin(Ee, Ne, Ec, Nc, data = test, Authors)
class(mort)
#> [1] "metabin" "meta"
metareg(mort, Age)
#>
#> Mixed-Effects Model (k = 6; tau^2 estimator: DL)
#>
#> tau^2 (estimated amount of residual heterogeneity): 0.1072 (SE = 0.1283)
#> tau (square root of estimated tau^2 value): 0.3274
#> I^2 (residual heterogeneity / unaccounted variability): 76.08%
#> H^2 (unaccounted variability / sampling variability): 4.18
#> R^2 (amount of heterogeneity accounted for): 7.17%
#>
#> Test for Residual Heterogeneity:
#> QE(df = 4) = 16.7211, p-val = 0.0022
#>
#> Test of Moderators (coefficient 2):
#> QM(df = 1) = 1.1886, p-val = 0.2756
#>
#> Model Results:
#>
#> estimate se zval pval ci.lb ci.ub
#> intrcpt 2.4587 2.2202 1.1075 0.2681 -1.8927 6.8102
#> Age -0.0392 0.0360 -1.0902 0.2756 -0.1097 0.0313
#>
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
It seems that I am getting the correct results. Do you still get the error when you'd run my code?
PJ