# option for html output
knitr::opts_chunk$set(echo = TRUE)

## A meta-analysis combines the results of several scientic studies addressing the same question. 
## Though, individual study measurements that are reported may have some degree of error. 
## It is simply analysis of analyses that correspond to a shared topic. 
## There are two different approaches in Meta-analysis viz. meta-analysis using aggregate data (AD) 
## or individual participant data (IPD).Using an AD approach, summary data for the same outcome e.g. 
## prevalence rate of a disease,proportions from each study,are pooled for the statistical analysis 
## (Suvarnapathaki,2021). 

Review Systematic and Metanalysys (RSMA) - Analysis Stadistics

I. Descriptive statistics (data structure)

rm(list=ls(all=TRUE)) #Deletes all memory content

# Call of the packages 

library(readxl)
data_neumo1 <- read_excel("C:/Users/USER/Desktop/RSMA/data_neumo1.xlsx")
View(data_neumo1)

#install.packages(c("metafor", "meta"))
#install.packages("tidyverse")
library(metafor)
library(meta)
library(metadat)
library(tidyverse)
head(data_neumo1,114)
## # A tibble: 114 × 20
##    Sequence code  author_1     year_pub author contint   age   prev sample posit
##    <chr>    <chr> <chr>           <dbl> <chr>    <dbl> <dbl>  <dbl>  <dbl> <dbl>
##  1 RSMA01   RS001 Abdullahi        2008 Abdul…       1     4 0.0467    107     5
##  2 RSMA02   RS001 Abdullahi        2008 Abdul…       1     2 0.0564    195    11
##  3 RSMA03   RS001 Abdullahi        2008 Abdul…       1     1 0.0640    406    26
##  4 RSMA04   RS002 Adetifa          2012 Adeti…       1     4 0.0685    482    33
##  5 RSMA05   RS002 Adetifa          2012 Adeti…       1     2 0.108     530    57
##  6 RSMA06   RS002 Adetifa          2012 Adeti…       1     1 0.260     361    94
##  7 RSMA07   RS004 Adler            2019 Adler…       5     1 0.0654    795    52
##  8 RSMA08   RS010 Almeida          2014 Almei…       5     4 0.0229   3361    77
##  9 RSMA09   RS015 Ansaldi          2013 Ansal…       5     4 0.02      283    56
## 10 RSMA10   RS017 Becker-Dreps     2015 Becke…       2     4 0.0190    210     4
## # … with 104 more rows, and 10 more variables: type_prev <dbl>, stage <dbl>,
## #   comorb <dbl>, type_morb <dbl>, meth_iden <dbl>, type_samp <dbl>,
## #   setting <dbl>, type_setting <dbl>, type_study <dbl>, quality <dbl>
glimpse(data_neumo1)
## Rows: 127
## Columns: 20
## $ Sequence     <chr> "RSMA01", "RSMA02", "RSMA03", "RSMA04", "RSMA05", "RSMA06…
## $ code         <chr> "RS001", "RS001", "RS001", "RS002", "RS002", "RS002", "RS…
## $ author_1     <chr> "Abdullahi", "Abdullahi", "Abdullahi", "Adetifa", "Adetif…
## $ year_pub     <dbl> 2008, 2008, 2008, 2012, 2012, 2012, 2019, 2014, 2013, 201…
## $ author       <chr> "Abdullahi_2008", "Abdullahi_2008", "Abdullahi_2008", "Ad…
## $ contint      <dbl> 1, 1, 1, 1, 1, 1, 5, 5, 5, 2, 1, 2, 2, 6, 3, 3, 5, 5, 4, …
## $ age          <dbl> 4, 2, 1, 4, 2, 1, 1, 4, 4, 4, 1, 4, 4, 1, 4, 4, 2, 4, 1, …
## $ prev         <dbl> 0.046728972, 0.056410256, 0.064039409, 0.068464730, 0.107…
## $ sample       <dbl> 107, 195, 406, 482, 530, 361, 795, 3361, 283, 210, 600, 1…
## $ posit        <dbl> 5, 11, 26, 33, 57, 94, 52, 77, 56, 4, 108, 14, 41, 0, 17,…
## $ type_prev    <dbl> 2, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, …
## $ stage        <dbl> 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 1, 2, 2, 2, 2, 2, …
## $ comorb       <dbl> 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, …
## $ type_morb    <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, …
## $ meth_iden    <dbl> 1, 1, 1, 1, 1, 1, 1, 3, 2, 1, 1, 1, 2, 1, 3, 3, 1, 1, 1, …
## $ type_samp    <dbl> 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 2, 3, 3, 1, 1, 1, 1, 1, 4, …
## $ setting      <dbl> 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 1, 2, 2, 4, 1, 1, 1, 1, 2, …
## $ type_setting <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 2, 10, 1, 1, 1, 1, 7,…
## $ type_study   <dbl> 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 4, 2, 2, 4, 4, 3, …
## $ quality      <dbl> 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 4, 4, 4, 4, 4, …
names(data_neumo1) <- c("Sequence", "code", "author", "year_pub", "contint", "age", "prev","sample", 
                        "posit", "type_prev", "stage", "comorb","type_morb","meth_iden","type_samp",
                        "setting","type_setting","type_study","quality")
## Warning: The `value` argument of `names<-` must have the same length as `x` as of tibble
## 3.0.0.
## ℹ `names` must have length 20, not 19.
## Warning: The `value` argument of `names<-` can't be empty as of tibble 3.0.0.
## ℹ Column 20 must be named.
glimpse(data_neumo1)
## Rows: 127
## Columns: 20
## $ Sequence     <chr> "RSMA01", "RSMA02", "RSMA03", "RSMA04", "RSMA05", "RSMA06…
## $ code         <chr> "RS001", "RS001", "RS001", "RS002", "RS002", "RS002", "RS…
## $ author       <chr> "Abdullahi", "Abdullahi", "Abdullahi", "Adetifa", "Adetif…
## $ year_pub     <dbl> 2008, 2008, 2008, 2012, 2012, 2012, 2019, 2014, 2013, 201…
## $ contint      <chr> "Abdullahi_2008", "Abdullahi_2008", "Abdullahi_2008", "Ad…
## $ age          <dbl> 1, 1, 1, 1, 1, 1, 5, 5, 5, 2, 1, 2, 2, 6, 3, 3, 5, 5, 4, …
## $ prev         <dbl> 4, 2, 1, 4, 2, 1, 1, 4, 4, 4, 1, 4, 4, 1, 4, 4, 2, 4, 1, …
## $ sample       <dbl> 0.046728972, 0.056410256, 0.064039409, 0.068464730, 0.107…
## $ posit        <dbl> 107, 195, 406, 482, 530, 361, 795, 3361, 283, 210, 600, 1…
## $ type_prev    <dbl> 5, 11, 26, 33, 57, 94, 52, 77, 56, 4, 108, 14, 41, 0, 17,…
## $ stage        <dbl> 2, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, …
## $ comorb       <dbl> 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 1, 2, 2, 2, 2, 2, …
## $ type_morb    <dbl> 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, …
## $ meth_iden    <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, …
## $ type_samp    <dbl> 1, 1, 1, 1, 1, 1, 1, 3, 2, 1, 1, 1, 2, 1, 3, 3, 1, 1, 1, …
## $ setting      <dbl> 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 2, 3, 3, 1, 1, 1, 1, 1, 4, …
## $ type_setting <dbl> 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 1, 2, 2, 4, 1, 1, 1, 1, 2, …
## $ type_study   <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 2, 10, 1, 1, 1, 1, 7,…
## $ quality      <dbl> 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 4, 2, 2, 4, 4, 3, …
## $ NA           <dbl> 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 4, 4, 4, 4, 4, …
str(data_neumo1)
## tibble [127 × 20] (S3: tbl_df/tbl/data.frame)
##  $ Sequence    : chr [1:127] "RSMA01" "RSMA02" "RSMA03" "RSMA04" ...
##  $ code        : chr [1:127] "RS001" "RS001" "RS001" "RS002" ...
##  $ author      : chr [1:127] "Abdullahi" "Abdullahi" "Abdullahi" "Adetifa" ...
##  $ year_pub    : num [1:127] 2008 2008 2008 2012 2012 ...
##  $ contint     : chr [1:127] "Abdullahi_2008" "Abdullahi_2008" "Abdullahi_2008" "Adetifa_2012" ...
##  $ age         : num [1:127] 1 1 1 1 1 1 5 5 5 2 ...
##  $ prev        : num [1:127] 4 2 1 4 2 1 1 4 4 4 ...
##  $ sample      : num [1:127] 0.0467 0.0564 0.064 0.0685 0.1075 ...
##  $ posit       : num [1:127] 107 195 406 482 530 ...
##  $ type_prev   : num [1:127] 5 11 26 33 57 94 52 77 56 4 ...
##  $ stage       : num [1:127] 2 2 2 1 1 1 1 1 2 1 ...
##  $ comorb      : num [1:127] 1 1 1 2 2 2 2 2 2 2 ...
##  $ type_morb   : num [1:127] 2 2 2 2 2 2 2 2 2 2 ...
##  $ meth_iden   : num [1:127] 1 1 1 1 1 1 1 1 1 1 ...
##  $ type_samp   : num [1:127] 1 1 1 1 1 1 1 3 2 1 ...
##  $ setting     : num [1:127] 1 1 1 1 1 1 2 3 1 1 ...
##  $ type_setting: num [1:127] 2 2 2 2 2 2 1 2 1 2 ...
##  $ type_study  : num [1:127] 1 1 1 1 1 1 1 1 1 2 ...
##  $ quality     : num [1:127] 4 4 4 4 4 4 4 4 4 4 ...
##  $ NA          : num [1:127] 3 3 3 4 4 4 4 4 4 4 ...
summary(data_neumo1)
##    Sequence             code              author             year_pub   
##  Length:127         Length:127         Length:127         Min.   :1997  
##  Class :character   Class :character   Class :character   1st Qu.:2010  
##  Mode  :character   Mode  :character   Mode  :character   Median :2014  
##                                                           Mean   :2014  
##                                                           3rd Qu.:2018  
##                                                           Max.   :2021  
##    contint               age             prev           sample       
##  Length:127         Min.   :1.000   Min.   :1.000   Min.   :0.00000  
##  Class :character   1st Qu.:1.000   1st Qu.:1.000   1st Qu.:0.04644  
##  Mode  :character   Median :2.000   Median :1.000   Median :0.08482  
##                     Mean   :3.047   Mean   :2.031   Mean   :0.11435  
##                     3rd Qu.:5.000   3rd Qu.:4.000   3rd Qu.:0.14096  
##                     Max.   :6.000   Max.   :4.000   Max.   :0.61538  
##      posit          type_prev           stage           comorb    
##  Min.   :   8.0   Min.   :   0.00   Min.   :1.000   Min.   :1.00  
##  1st Qu.: 212.5   1st Qu.:  11.50   1st Qu.:1.000   1st Qu.:2.00  
##  Median : 399.0   Median :  33.00   Median :1.000   Median :2.00  
##  Mean   : 715.7   Mean   :  90.98   Mean   :1.417   Mean   :1.78  
##  3rd Qu.: 667.5   3rd Qu.:  82.50   3rd Qu.:2.000   3rd Qu.:2.00  
##  Max.   :8336.0   Max.   :1868.00   Max.   :3.000   Max.   :3.00  
##    type_morb       meth_iden       type_samp        setting      type_setting  
##  Min.   :1.000   Min.   :1.000   Min.   :1.000   Min.   :1.00   Min.   :1.000  
##  1st Qu.:2.000   1st Qu.:1.000   1st Qu.:1.000   1st Qu.:1.00   1st Qu.:1.000  
##  Median :2.000   Median :1.000   Median :1.000   Median :1.00   Median :2.000  
##  Mean   :1.819   Mean   :1.638   Mean   :1.268   Mean   :1.78   Mean   :1.717  
##  3rd Qu.:2.000   3rd Qu.:1.000   3rd Qu.:1.000   3rd Qu.:3.00   3rd Qu.:2.000  
##  Max.   :2.000   Max.   :7.000   Max.   :3.000   Max.   :5.00   Max.   :4.000  
##    type_study        quality            NA       
##  Min.   : 1.000   Min.   :1.000   Min.   :2.000  
##  1st Qu.: 1.000   1st Qu.:2.000   1st Qu.:3.000  
##  Median : 1.000   Median :4.000   Median :3.000  
##  Mean   : 3.094   Mean   :3.394   Mean   :3.307  
##  3rd Qu.: 6.000   3rd Qu.:4.000   3rd Qu.:4.000  
##  Max.   :10.000   Max.   :4.000   Max.   :4.000
convert <- which(data_neumo1$prev =="age")
data_neumo1$prev[convert] <- "age"
summary(data_neumo1$prev)
##    Length     Class      Mode 
##       127 character character
par(mfrow = c(2,4))
barplot(Age <- table(data_neumo1$prev))
barplot(Age <- table(data_neumo1$sample))
barplot(Age <- table(data_neumo1$type_samp))
barplot(Age <- table(data_neumo1$comorb))
barplot(Age <- table(data_neumo1$type_morb))
barplot(Age <- table(data_neumo1$meth_iden))

par(mfrow = c(2,4))

barplot(prev <- table(data_neumo1$age))
barplot(prev <- table(data_neumo1$sample))
barplot(prev <- table(data_neumo1$type_samp))
barplot(prev <- table(data_neumo1$comorb))
barplot(prev <- table(data_neumo1$type_morb))
barplot(prev <- table(data_neumo1$meth_iden))

par(mfrow = c(1,3))

hist(data_neumo1$age)

Prev_adults <- subset(data_neumo1, prev=="1" & age=="2")
dim(Prev_adults)
## [1] 20 20
print(Prev_adults)
## # A tibble: 20 × 20
##    Sequence code  author  year_…¹ contint   age prev  sample posit type_…² stage
##    <chr>    <chr> <chr>     <dbl> <chr>   <dbl> <chr>  <dbl> <dbl>   <dbl> <dbl>
##  1 RSMA35   RS032 Feola      2016 Feola_…     2 1     0.0376   399      15     1
##  2 RSMA38   RS036 Gounder    2014 Gounde…     2 1     0.142   8336    1183     2
##  3 RSMA41   RS038 Grant      2016 Grant_…     2 1     0.118   2847     336     2
##  4 RSMA44   RS040 Hammitt    2006 Hammit…     2 1     0.01     115      15     2
##  5 RSMA45   RS040 Hammitt    2006 Hammit…     2 1     0.01     115      15     2
##  6 RSMA61   RS062 Millar     2008 Millar…     2 1     0.139   1729     241     3
##  7 RSMA67   RS068 Onwubi…    2008 Onwubi…     2 1     0.0343   175       6     1
##  8 RSMA80   RS078 Rodrig…    1997 Rodrig…     2 1     0.168    321      54     2
##  9 RSMA81   RS078 Rodrig…    1997 Rodrig…     2 1     0.0533   150       8     2
## 10 RSMA82   RS079 Rosen      2007 Rosen …     2 1     0.0462    65       3     1
## 11 RSMA83   RS079 Rosen      2007 Rosen_…     2 1     0.0476    63       3     1
## 12 RSMA84   RS081 Saravo…    2007 Saravo…     2 1     0.015    200       3     1
## 13 RSMA85   RS081 Saravo…    2007 Saravo…     2 1     0.03     200       6     1
## 14 RSMA86   RS081 Saravo…    2007 Saravo…     2 1     0.11     200      22     1
## 15 RSMA87   RS083 Scott      2012 Scott_…     2 1     0.109   2681     291     2
## 16 RSMA95   RS086 Sutcli…    2019 Sutcli…     2 1     0.145    509      74     2
## 17 RSMA96   RS086 Sutcli…    2019 Sutcli…     2 1     0.475    509     242     2
## 18 RSMA125  RS142 Watt       2004 Watt_2…     2 1     0.111   1994     222     1
## 19 RSMA126  RS142 Watt       2004 Watt_2…     2 1     0.0577  1994     115     1
## 20 RSMA127  RS142 Watt       2004 Watt_2…     2 1     0.152   1994     304     1
## # … with 9 more variables: comorb <dbl>, type_morb <dbl>, meth_iden <dbl>,
## #   type_samp <dbl>, setting <dbl>, type_setting <dbl>, type_study <dbl>,
## #   quality <dbl>, `` <dbl>, and abbreviated variable names ¹​year_pub,
## #   ²​type_prev

II. Effect size & Heterogeneity Analysis (Viechtbauer, 2010)

rm(list=ls(all=TRUE)) #Deletes all memory content

# Call of the packages 

library(readxl)
data_neumo1 <- read_excel("C:/Users/USER/Desktop/RSMA/data_neumo1.xlsx")
View(data_neumo1)

#install.packages(c("metafor", "meta"))
#install.packages("tidyverse")
library(metafor)
library(meta)
library(metadat)
library(tidyverse)

# Effect size (weighted average of the individual study)

# Calculation of effect size without transformation - raw proportion (xi/ni)

ies=escalc(xi=posit, ni=sample, data=data_neumo1, measure="PR")
pes=rma(yi, vi, data=ies)
print(pes)
## 
## Random-Effects Model (k = 127; tau^2 estimator: REML)
## 
## tau^2 (estimated amount of total heterogeneity): 0.0112 (SE = 0.0015)
## tau (square root of estimated tau^2 value):      0.1058
## I^2 (total heterogeneity / total variability):   99.62%
## H^2 (total variability / sampling variability):  262.19
## 
## Test for Heterogeneity:
## Q(df = 126) = 12371.1556, p-val < .0001
## 
## Model Results:
## 
## estimate      se     zval    pval   ci.lb   ci.ub      
##   0.1160  0.0096  12.1308  <.0001  0.0972  0.1347  *** 
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Calculation of effect size - second option - logit transformed proportion (log xi/(ni-xi))

ies=escalc(xi=posit, ni=sample, data=data_neumo1, measure="PLO")
pes=rma(yi, vi, data=ies)
print(pes)
## 
## Random-Effects Model (k = 127; tau^2 estimator: REML)
## 
## tau^2 (estimated amount of total heterogeneity): 0.9769 (SE = 0.1334)
## tau (square root of estimated tau^2 value):      0.9884
## I^2 (total heterogeneity / total variability):   98.51%
## H^2 (total variability / sampling variability):  67.15
## 
## Test for Heterogeneity:
## Q(df = 126) = 7558.4945, p-val < .0001
## 
## Model Results:
## 
## estimate      se      zval    pval    ci.lb    ci.ub      
##  -2.3238  0.0919  -25.2883  <.0001  -2.5039  -2.1437  *** 
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Calculation of effect size - logit transformed proportion (log xi/(ni-xi))

ies.logit=escalc(xi=posit, ni=sample, data=data_neumo1, measure="PLO")
pes.logit=rma(yi, vi, data=ies.logit)
pes=predict(pes.logit, transf=transf.ilogit)
print(pes)
## 
##    pred  ci.lb  ci.ub  pi.lb  pi.ub 
##  0.0892 0.0756 0.1049 0.0138 0.4065
# Calculation of effect size - arcsine transformed (asin (sqrt(xi/ni))

ies.logit=escalc(xi=posit, ni=sample, data=data_neumo1, measure="PAS")
pes.logit=rma(yi, vi, data=ies.logit)
pes=predict(pes.logit, transf=transf.ilogit)
print(pes)
## 
##    pred  ci.lb  ci.ub  pi.lb  pi.ub 
##  0.5791 0.5722 0.5861 0.5007 0.6537
# Calculation of effect size with transformation logit - third option

pes.logit=rma(yi, vi, data=ies, method="DL")
pes=predict(pes.logit, transf=transf.ilogit)
transf=transf.ilogit
print(pes)
## 
##    pred  ci.lb  ci.ub  pi.lb  pi.ub 
##  0.0898 0.0768 0.1048 0.0155 0.3826
# Calculation of effect size without transformation 
#(adjustments to proportions close to 0)

ies.logit=escalc(xi=posit, ni=sample, measure="PLO", data=data_neumo1)
pes.logit=rma(yi, vi, data=ies.logit, method="DL", level=95)
pes=predict(pes.logit, transf=transf.ilogit)
print(pes, digits=6)
## 
##      pred    ci.lb    ci.ub    pi.lb    pi.ub 
##  0.089825 0.076809 0.104796 0.015473 0.382610
# Heterogeneity calculation (variation between studies)

print(pes.logit, digits=4)
## 
## Random-Effects Model (k = 127; tau^2 estimator: DL)
## 
## tau^2 (estimated amount of total heterogeneity): 0.8712 (SE = 0.2452)
## tau (square root of estimated tau^2 value):      0.9334
## I^2 (total heterogeneity / total variability):   98.33%
## H^2 (total variability / sampling variability):  59.99
## 
## Test for Heterogeneity:
## Q(df = 126) = 7558.4945, p-val < .0001
## 
## Model Results:
## 
## estimate      se      zval    pval    ci.lb    ci.ub      
##  -2.3158  0.0871  -26.5838  <.0001  -2.4865  -2.1450  *** 
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
confint(pes.logit, digits=2)
## 
##        estimate ci.lb  ci.ub 
## tau^2      0.87  0.86   1.58 
## tau        0.93  0.93   1.26 
## I^2(%)    98.33 98.31  99.08 
## H^2       59.99 59.10 108.26

III. Forest Plot (Effect size and grouping of the interest variable)

# II. Forest Plot (pooled estimate of the parameter)

rm(list=ls(all=TRUE)) #Deletes all memory content

# Call of the packages

library(readxl)
data_neumo1 <- read_excel("C:/Users/USER/Desktop/RSMA/data_neumo1.xlsx")
View(data_neumo1)

#install.packages(c("metafor", "meta"))
#install.packages("tidyverse")
library(metafor)
library(meta)
library(metadat)
library(tidyverse)

# Forest PLot without transformation 

pes.summary=metaprop(posit,sample,author,data=data_neumo1, sm="PRAW")
forest(pes.summary)

# Forest PLot with transformation loggit

pes.summary=metaprop(posit,sample,author, data=data_neumo1, sm="PLO")
forest(pes.summary)

# Forest PLot with transformation loggit - subgroup (age, sample, method and type sample)

ms2s <- update(pes.summary, byvar= age, print.byvar=TRUE)
forest(ms2s)

ms2s <- update(pes.summary, byvar= stage, print.byvar=TRUE)
forest(ms2s)

ms2s <- update(pes.summary, byvar= contint, print.byvar=TRUE)
forest(ms2s)

ms2s <- update(pes.summary, byvar= meth_iden, print.byvar=TRUE)
forest(ms2s)

ms2s <- update(pes.summary, byvar= type_samp, print.byvar=TRUE)
forest(ms2s)

ms2s <- update(pes.summary, byvar= type_prev, print.byvar=TRUE)
forest(ms2s) 

ms2s <- update(pes.summary, byvar= comorb, print.byvar=TRUE)
forest(ms2s)

ms2s <- update(pes.summary, byvar= setting, print.byvar=TRUE)
forest(ms2s)

ms2s <- update(pes.summary, byvar= type_study, print.byvar=TRUE)
forest(ms2s)

# Forest Plot d- fit 

pes.summary=metaprop(posit,sample,author, data=data_neumo1, sm="PR",
                     method.tau="DL", method.ci="NAsm")
forest(pes.summary,
       xlim=c(0,4),
       pscale=20,
       rightcols=FALSE,
       leftcols=c("author", "posit", "sample", "prev", "ci"),
       leftlabs=c("author", "posit", "sample", "prev", "95% C.I."),
       xlab="Prevalence of CC", smlab="",
       weight.study="random", squaresize=0.5, col.square="red",
       col.square.lines="green",
       col.diamond="maroon", col.diamond.lines="maroon",
       pooled.totals=FALSE,
       comb.fixed=FALSE,
       fs.hetstat=10,
       print.tau2=TRUE,
       print.Q=TRUE,
       print.pval.Q=TRUE,
       print.I2=TRUE,
       digits=2)

# Forest Plot d- fit 

pes.summary=metaprop(posit,sample,author, data=data_neumo1, sm="PLO",
                     method.tau="DL", method.ci="NAsm")
forest(pes.summary,
       xlim=c(0,4),
       pscale=20,
       rightcols=FALSE,
       leftcols=c("author", "posit", "sample", "prev","ci"),
       leftlabs=c("author", "posit", "sample", "prev", "95% C.I."),
       xlab="Prevalence of CC", smlab="",
       weight.study="random", squaresize=0.2, col.square="green",
       col.square.lines="red",
       col.diamond="maroon", col.diamond.lines="yellow",
       pooled.totals=TRUE,
       comb.fixed=TRUE,
       fs.hetstat=10,
       print.tau2=TRUE,
       print.Q=TRUE,
       print.pval.Q=TRUE,
       print.I2=TRUE,
       digits=2)

IV. Sensitivity Analysis (model adjustments)

# IV. Sensitivity Analysis (variation between studies)

rm(list=ls(all=TRUE)) #Deletes all memory content

# Call of the packages

library(readxl)
data_neumo1 <- read_excel("C:/Users/USER/Desktop/RSMA/data_neumo1.xlsx")
View(data_neumo1)

#install.packages(c("metafor", "meta"))
#install.packages("tidyverse")
library(metafor)
library(meta)
library(metadat)
library(tidyverse)

# transformation data

ies.logit=escalc(xi=posit, ni=sample, data=data_neumo1, measure="PLO")
pes.logit=rma(yi, vi, data=ies.logit)
pes=predict(pes.logit, transf=transf.ilogit)
print(pes)
## 
##    pred  ci.lb  ci.ub  pi.lb  pi.ub 
##  0.0892 0.0756 0.1049 0.0138 0.4065
# Accuracy of studies 

precision=sqrt(ies.logit$vi)
1/sqrt(ies.logit$vi)
##   [1]  2.1831984  3.2217212  4.9330493  5.5444264  7.1323076  8.3380781
##   [7]  6.9712798  8.6738654  6.7021435  1.9808608  9.4106323  3.4698703
##  [13]  4.9183331  0.7058246  4.0776926  3.8229211  2.2259178  2.8031163
##  [19]  6.0777968  8.5127864 11.6055385  5.4784187  2.0000000  0.9701425
##  [25]  3.1495465  4.2426407  2.3299295  2.1612618  0.6871843  3.1901208
##  [31]  0.7068421  6.3228802  6.0801994  4.9901088  3.7994855  5.9803600
##  [37]  8.7302309 31.8608701  9.6303222  4.9790470 17.2146922  2.8618176
##  [43]  3.4292272  3.6115756  3.6115756  7.8408211  7.9983086  4.1699392
##  [49]  5.2669743  2.4354792 13.4239708  9.0404077 10.1768744  6.5206332
##  [55]  6.7631010  3.6030290 17.9881944 10.3692527 11.0705058  9.5767338
##  [61] 14.4016579  7.3476497  5.0584278  7.3048641 11.2570533  5.6655701
##  [67]  2.4071323  2.7610740  2.9195084  5.4195190  5.2541777  6.8668098
##  [73]  4.1623311  9.6778661 33.8658477  0.9984114  0.7065471  3.8094528
##  [79]  4.9646752  6.7019317  2.7519690  1.6916082  1.6903085  1.7190113
##  [85]  2.4124676  4.4249294 16.1063465 14.8776905  5.5646994  2.6261287
##  [91]  8.7316908  8.6075207  6.5553201  6.4462434  7.9524619 11.2668996
##  [97] 20.6392747  6.4738279  7.8121604  3.3792536  7.4311355  4.8068764
## [103]  3.1080322  6.5186266  5.1164296  2.2186934  5.6690816  0.7067566
## [109]  4.5869034  7.7907062  8.0617879  3.3752637  4.5496071  3.4248100
## [115]  3.0410722  4.2209113  8.5127864  6.0777968  7.5213980  4.7076160
## [121]  0.9981114  4.0960174 14.4648114 13.0609876 14.0457770 10.4099761
## [127] 16.0515719
sortvar=precision
pes.summary=metaprop(posit, sample, author, data=data_neumo1, sm="PLO")
forest(pes.summary)

# Outliers 

stud.res=rstudent(pes.logit)
abs.z=abs(stud.res$z)
stud.res[order(-abs.z)]
## 
##       resid     se       z 
## 123  2.8129 0.9591  2.9330 
## 31  -4.8883 1.7208 -2.8407 
## 108 -4.6074 1.7218 -2.6758 
## 76  -3.4420 1.4004 -2.4580 
## 77  -4.1363 1.7236 -2.3999 
## 121 -3.2677 1.4017 -2.3313 
## 96   2.2419 0.9765  2.2958 
## 17  -2.3909 1.0729 -2.2285 
## 21   2.0643 0.9803  2.1057 
## 50  -2.1563 1.0602 -2.0339 
## 97   1.9473 0.9800  1.9870 
## 13   1.9744 1.0005  1.9733 
## 14  -3.3030 1.7269 -1.9127 
## 75   1.8743 0.9807  1.9111 
## 56   1.8555 1.0213  1.8168 
## 99   1.7214 0.9919  1.7355 
## 106 -1.8433 1.0817 -1.7041 
## 62  -1.6686 0.9914 -1.6831 
## 101  1.6496 0.9940  1.6596 
## 84  -1.8738 1.1440 -1.6379 
## 18  -1.7000 1.0466 -1.6243 
## 43  -1.5799 1.0272 -1.5380 
## 55   1.5216 0.9980  1.5247 
## 124  1.4927 0.9901  1.5076 
## 10  -1.6297 1.1085 -1.4702 
## 15  -1.4880 1.0160 -1.4646 
## 8   -1.4425 0.9925 -1.4533 
## 116  1.4267 1.0169  1.4031 
## 22   1.3296 1.0065  1.3210 
## 53   1.2897 0.9949  1.2963 
## 16  -1.3233 1.0224 -1.2942 
## 6    1.2905 0.9974  1.2939 
## 52   1.2728 0.9965  1.2773 
## 85  -1.1610 1.0744 -1.0806 
## 78  -1.0773 1.0256 -1.0505 
## 32   1.0442 1.0056  1.0384 
## 119  1.0334 1.0020  1.0314 
## 103 -1.0307 1.0430 -0.9882 
## 67  -1.0218 1.0759 -0.9498 
## 120 -0.9588 1.0150 -0.9446 
## 9    0.9323 1.0052  0.9275 
## 54   0.9316 1.0059  0.9261 
## 72  -0.9238 1.0034 -0.9207 
## 20   0.9128 1.0012  0.9117 
## 117  0.9128 1.0012  0.9117 
## 73  -0.9289 1.0215 -0.9093 
## 98   0.9077 1.0062  0.9021 
## 35  -0.9262 1.0272 -0.9016 
## 23   0.9443 1.1131  0.8484 
## 11   0.8148 1.0007  0.8142 
## 49  -0.7750 1.0122 -0.7657 
## 109 -0.7692 1.0179 -0.7556 
## 94   0.7372 1.0076  0.7316 
## 80   0.7322 1.0068  0.7272 
## 64   0.7178 1.0051  0.7141 
## 68  -0.6893 1.0588 -0.6510 
## 93   0.6522 1.0078  0.6471 
## 1   -0.6963 1.0952 -0.6358 
## 100 -0.6600 1.0382 -0.6357 
## 127  0.6142 0.9984  0.6152 
## 82  -0.7089 1.1571 -0.6126 
## 104  0.5960 1.0082  0.5911 
## 112 -0.6118 1.0386 -0.5891 
## 83  -0.6759 1.1575 -0.5839 
## 79  -0.5837 1.0158 -0.5746 
## 70  -0.5727 1.0127 -0.5655 
## 95   0.5579 1.0046  0.5553 
## 69  -0.5643 1.0530 -0.5359 
## 38   0.5295 0.9974  0.5309 
## 81  -0.5564 1.0599 -0.5249 
## 107 -0.5288 1.0115 -0.5228 
## 61   0.5084 0.9994  0.5087 
## 66  -0.5062 1.0117 -0.5003 
## 12   0.5132 1.0376  0.4946 
## 2   -0.4966 1.0433 -0.4760 
## 126 -0.4733 1.0010 -0.4728 
## 90   0.4955 1.0669  0.4645 
## 111 -0.4657 1.0041 -0.4638 
## 36  -0.4520 1.0104 -0.4474 
## 113 -0.4462 1.0204 -0.4373 
## 44   0.4308 1.0348  0.4163 
## 45   0.4308 1.0348  0.4163 
## 3   -0.3606 1.0173 -0.3545 
## 7   -0.3379 1.0073 -0.3354 
## 58   0.3223 1.0023  0.3215 
## 41   0.3159 0.9994  0.3161 
## 24  -0.4503 1.4325 -0.3144 
## 28  -0.3312 1.0986 -0.3015 
## 29  -0.5106 1.7623 -0.2897 
## 122 -0.2970 1.0265 -0.2893 
## 4   -0.2885 1.0134 -0.2846 
## 37   0.2740 1.0043  0.2728 
## 125  0.2495 1.0004  0.2494 
## 88   0.2467 1.0001  0.2467 
## 59  -0.2408 1.0016 -0.2404 
## 34   0.2427 1.0176  0.2385 
## 60   0.2314 1.0033  0.2307 
## 86   0.2357 1.0229  0.2304 
## 39  -0.2253 1.0029 -0.2246 
## 87   0.2207 0.9998  0.2208 
## 51   0.2141 1.0007  0.2140 
## 5    0.2103 1.0076  0.2087 
## 110  0.2090 1.0061  0.2078 
## 65  -0.1890 1.0016 -0.1887 
## 30  -0.1918 1.0453 -0.1835 
## 115 -0.1866 1.0500 -0.1777 
## 102 -0.1784 1.0190 -0.1751 
## 91   0.1620 1.0045  0.1612 
## 26   0.1284 1.0252  0.1252 
## 71  -0.1217 1.0156 -0.1198 
## 118  0.1175 1.0114  0.1162 
## 19   0.1175 1.0114  0.1162 
## 33   0.1095 1.0113  0.1082 
## 25   0.1081 1.0468  0.1033 
## 114  0.1028 1.0395  0.0989 
## 105  0.0980 1.0168  0.0963 
## 40  -0.0941 1.0177 -0.0925 
## 92   0.0883 1.0047  0.0878 
## 46  -0.0862 1.0059 -0.0857 
## 27   0.0737 1.0856  0.0679 
## 57   0.0549 0.9996  0.0550 
## 48  -0.0545 1.0261 -0.0531 
## 47  -0.0380 1.0057 -0.0377 
## 63  -0.0373 1.0172 -0.0367 
## 74   0.0192 1.0033  0.0192 
## 42   0.0110 1.0569  0.0104 
## 89   0.0016 1.0139  0.0016
# Influence of outliers  

L1O=leave1out(pes.logit, transf=transf.ilogit); print(L1O)
## 
##     estimate     zval   pval  ci.lb  ci.ub         Q     Qp   tau2      I2 
## 1     0.0895 -25.0961 0.0000 0.0758 0.1055 7549.4440 0.0000 0.9812 98.5279 
## 2     0.0894 -25.0709 0.0000 0.0757 0.1054 7544.0468 0.0000 0.9836 98.5305 
## 3     0.0894 -25.0578 0.0000 0.0756 0.1053 7531.8905 0.0000 0.9852 98.5304 
## 4     0.0893 -25.0561 0.0000 0.0756 0.1052 7529.3150 0.0000 0.9858 98.5302 
## 5     0.0890 -25.0862 0.0000 0.0753 0.1048 7546.7988 0.0000 0.9871 98.5284 
## 6     0.0883 -25.3565 0.0000 0.0748 0.1040 7533.7739 0.0000 0.9719 98.5024 
## 7     0.0894 -25.0533 0.0000 0.0756 0.1053 7507.5023 0.0000 0.9855 98.5266 
## 8     0.0903 -25.1991 0.0000 0.0765 0.1061 7219.0514 0.0000 0.9634 98.4885 
## 9     0.0885 -25.2352 0.0000 0.0749 0.1043 7555.9303 0.0000 0.9797 98.5186 
## 10    0.0901 -25.2095 0.0000 0.0764 0.1060 7537.6623 0.0000 0.9655 98.5045 
## 11    0.0886 -25.2026 0.0000 0.0750 0.1043 7557.1724 0.0000 0.9816 98.5136 
## 12    0.0888 -25.1415 0.0000 0.0752 0.1046 7558.1152 0.0000 0.9849 98.5321 
## 13    0.0880 -25.6553 0.0000 0.0747 0.1034 7519.1281 0.0000 0.9514 98.4790 
## 14    0.0900 -25.2704 0.0000 0.0763 0.1058 7550.6071 0.0000 0.9664 98.5066 
## 15    0.0902 -25.2034 0.0000 0.0765 0.1061 7480.7094 0.0000 0.9637 98.4994 
## 16    0.0901 -25.1647 0.0000 0.0764 0.1060 7500.0619 0.0000 0.9685 98.5072 
## 17    0.0908 -25.4256 0.0000 0.0771 0.1065 7512.1630 0.0000 0.9410 98.4660 
## 18    0.0903 -25.2448 0.0000 0.0766 0.1062 7514.2583 0.0000 0.9598 98.4950 
## 19    0.0890 -25.0773 0.0000 0.0753 0.1049 7546.4393 0.0000 0.9872 98.5310 
## 20    0.0885 -25.2299 0.0000 0.0750 0.1043 7554.9956 0.0000 0.9800 98.5141 
## 21    0.0879 -25.7381 0.0000 0.0746 0.1033 7304.4411 0.0000 0.9454 98.4491 
## 22    0.0883 -25.3662 0.0000 0.0748 0.1039 7546.4282 0.0000 0.9713 98.5087 
## 23    0.0886 -25.2323 0.0000 0.0750 0.1044 7558.2411 0.0000 0.9804 98.5268 
## 24    0.0893 -25.1678 0.0000 0.0756 0.1051 7557.2827 0.0000 0.9811 98.5285 
## 25    0.0890 -25.0906 0.0000 0.0754 0.1049 7555.1618 0.0000 0.9865 98.5348 
## 26    0.0890 -25.0841 0.0000 0.0753 0.1049 7552.8524 0.0000 0.9869 98.5340 
## 27    0.0891 -25.1018 0.0000 0.0754 0.1049 7556.4509 0.0000 0.9858 98.5346 
## 28    0.0893 -25.0894 0.0000 0.0756 0.1052 7553.6767 0.0000 0.9843 98.5326 
## 29    0.0893 -25.2068 0.0000 0.0756 0.1051 7557.8198 0.0000 0.9797 98.5265 
## 30    0.0892 -25.0718 0.0000 0.0755 0.1051 7550.6611 0.0000 0.9859 98.5339 
## 31    0.0904 -25.3960 0.0000 0.0768 0.1062 7543.0553 0.0000 0.9515 98.4834 
## 32    0.0885 -25.2688 0.0000 0.0749 0.1042 7553.5921 0.0000 0.9776 98.5163 
## 33    0.0890 -25.0765 0.0000 0.0754 0.1049 7546.0882 0.0000 0.9872 98.5310 
## 34    0.0889 -25.0941 0.0000 0.0753 0.1048 7553.5280 0.0000 0.9868 98.5326 
## 35    0.0898 -25.0990 0.0000 0.0760 0.1057 7521.2617 0.0000 0.9774 98.5206 
## 36    0.0894 -25.0565 0.0000 0.0757 0.1054 7512.2629 0.0000 0.9844 98.5272 
## 37    0.0889 -25.0933 0.0000 0.0753 0.1048 7545.2542 0.0000 0.9869 98.5237 
## 38    0.0887 -25.1350 0.0000 0.0751 0.1046 7528.5917 0.0000 0.9852 98.3577 
## 39    0.0893 -25.0523 0.0000 0.0756 0.1052 7480.8927 0.0000 0.9864 98.5201 
## 40    0.0892 -25.0639 0.0000 0.0755 0.1051 7543.3706 0.0000 0.9868 98.5326 
## 41    0.0889 -25.0976 0.0000 0.0752 0.1048 7515.7530 0.0000 0.9868 98.4847 
## 42    0.0891 -25.0867 0.0000 0.0754 0.1050 7554.7516 0.0000 0.9863 98.5348 
## 43    0.0903 -25.2224 0.0000 0.0766 0.1062 7498.7664 0.0000 0.9618 98.4974 
## 44    0.0888 -25.1269 0.0000 0.0752 0.1047 7557.6169 0.0000 0.9855 98.5329 
## 45    0.0888 -25.1269 0.0000 0.0752 0.1047 7557.6169 0.0000 0.9855 98.5329 
## 46    0.0892 -25.0590 0.0000 0.0755 0.1051 7521.5890 0.0000 0.9870 98.5265 
## 47    0.0891 -25.0618 0.0000 0.0754 0.1050 7524.6928 0.0000 0.9872 98.5263 
## 48    0.0891 -25.0698 0.0000 0.0755 0.1050 7548.9372 0.0000 0.9867 98.5338 
## 49    0.0897 -25.0783 0.0000 0.0759 0.1056 7499.6079 0.0000 0.9799 98.5220 
## 50    0.0906 -25.3639 0.0000 0.0770 0.1064 7511.1540 0.0000 0.9471 98.4756 
## 51    0.0890 -25.0839 0.0000 0.0753 0.1048 7517.1032 0.0000 0.9872 98.5058 
## 52    0.0883 -25.3503 0.0000 0.0748 0.1040 7531.0944 0.0000 0.9723 98.5009 
## 53    0.0883 -25.3575 0.0000 0.0748 0.1040 7521.6324 0.0000 0.9718 98.4962 
## 54    0.0885 -25.2349 0.0000 0.0750 0.1043 7556.0832 0.0000 0.9797 98.5190 
## 55    0.0882 -25.4483 0.0000 0.0748 0.1038 7527.3063 0.0000 0.9657 98.4973 
## 56    0.0881 -25.5697 0.0000 0.0747 0.1036 7541.1186 0.0000 0.9576 98.4908 
## 57    0.0891 -25.0663 0.0000 0.0754 0.1050 7424.2900 0.0000 0.9874 98.4808 
## 58    0.0889 -25.0996 0.0000 0.0752 0.1047 7543.8279 0.0000 0.9867 98.5179 
## 59    0.0893 -25.0514 0.0000 0.0756 0.1052 7452.1056 0.0000 0.9864 98.5147 
## 60    0.0889 -25.0872 0.0000 0.0753 0.1048 7539.1262 0.0000 0.9871 98.5213 
## 61    0.0888 -25.1312 0.0000 0.0751 0.1046 7551.4242 0.0000 0.9854 98.4983 
## 62    0.0904 -25.2647 0.0000 0.0768 0.1063 7261.3633 0.0000 0.9560 98.4808 
## 63    0.0891 -25.0670 0.0000 0.0754 0.1050 7545.0580 0.0000 0.9869 98.5327 
## 64    0.0886 -25.1783 0.0000 0.0750 0.1044 7558.4600 0.0000 0.9830 98.5220 
## 65    0.0892 -25.0526 0.0000 0.0755 0.1052 7460.3006 0.0000 0.9867 98.5145 
## 66    0.0895 -25.0590 0.0000 0.0757 0.1054 7513.0018 0.0000 0.9838 98.5269 
## 67    0.0898 -25.1185 0.0000 0.0761 0.1057 7541.7338 0.0000 0.9765 98.5207 
## 68    0.0896 -25.0851 0.0000 0.0759 0.1055 7544.1688 0.0000 0.9813 98.5276 
## 69    0.0895 -25.0767 0.0000 0.0758 0.1054 7545.2434 0.0000 0.9828 98.5297 
## 70    0.0895 -25.0626 0.0000 0.0758 0.1054 7512.1372 0.0000 0.9830 98.5262 
## 71    0.0892 -25.0617 0.0000 0.0755 0.1051 7540.4457 0.0000 0.9867 98.5320 
## 72    0.0898 -25.0941 0.0000 0.0761 0.1057 7436.8432 0.0000 0.9771 98.5143 
## 73    0.0898 -25.0982 0.0000 0.0761 0.1057 7513.6512 0.0000 0.9773 98.5199 
## 74    0.0891 -25.0649 0.0000 0.0754 0.1050 7516.3106 0.0000 0.9873 98.5213 
## 75    0.0880 -25.6349 0.0000 0.0747 0.1034 5744.4993 0.0000 0.9526 98.2803 
## 76    0.0905 -25.3906 0.0000 0.0769 0.1063 7541.6421 0.0000 0.9495 98.4803 
## 77    0.0902 -25.3287 0.0000 0.0766 0.1060 7546.9471 0.0000 0.9592 98.4954 
## 78    0.0899 -25.1199 0.0000 0.0762 0.1058 7513.7578 0.0000 0.9744 98.5161 
## 79    0.0895 -25.0644 0.0000 0.0758 0.1055 7518.9309 0.0000 0.9828 98.5268 
## 80    0.0886 -25.1819 0.0000 0.0750 0.1044 7558.4235 0.0000 0.9828 98.5232 
## 81    0.0895 -25.0788 0.0000 0.0758 0.1054 7546.8687 0.0000 0.9829 98.5299 
## 82    0.0895 -25.1129 0.0000 0.0758 0.1054 7552.9592 0.0000 0.9810 98.5279 
## 83    0.0895 -25.1119 0.0000 0.0758 0.1054 7553.2253 0.0000 0.9813 98.5284 
## 84    0.0902 -25.2456 0.0000 0.0766 0.1061 7539.3234 0.0000 0.9620 98.4994 
## 85    0.0899 -25.1358 0.0000 0.0762 0.1058 7538.8165 0.0000 0.9739 98.5170 
## 86    0.0890 -25.0952 0.0000 0.0753 0.1048 7554.4709 0.0000 0.9867 98.5334 
## 87    0.0890 -25.0844 0.0000 0.0753 0.1048 7500.0212 0.0000 0.9872 98.4918 
## 88    0.0889 -25.0880 0.0000 0.0753 0.1048 7514.1452 0.0000 0.9871 98.4984 
## 89    0.0891 -25.0683 0.0000 0.0754 0.1050 7543.9120 0.0000 0.9871 98.5320 
## 90    0.0888 -25.1453 0.0000 0.0752 0.1046 7558.2330 0.0000 0.9847 98.5328 
## 91    0.0890 -25.0792 0.0000 0.0753 0.1049 7537.2117 0.0000 0.9872 98.5242 
## 92    0.0890 -25.0716 0.0000 0.0754 0.1049 7531.6748 0.0000 0.9873 98.5247 
## 93    0.0887 -25.1633 0.0000 0.0751 0.1045 7558.4264 0.0000 0.9838 98.5250 
## 94    0.0886 -25.1832 0.0000 0.0750 0.1044 7558.4114 0.0000 0.9827 98.5237 
## 95    0.0887 -25.1424 0.0000 0.0751 0.1046 7557.3617 0.0000 0.9849 98.5230 
## 96    0.0878 -25.8485 0.0000 0.0746 0.1031 7253.2388 0.0000 0.9376 98.4378 
## 97    0.0880 -25.6746 0.0000 0.0747 0.1034 6863.3156 0.0000 0.9498 98.4029 
## 98    0.0885 -25.2280 0.0000 0.0750 0.1043 7556.5682 0.0000 0.9801 98.5197 
## 99    0.0881 -25.5438 0.0000 0.0747 0.1036 7494.2899 0.0000 0.9591 98.4843 
## 100   0.0896 -25.0768 0.0000 0.0758 0.1055 7537.9328 0.0000 0.9817 98.5275 
## 101   0.0881 -25.5082 0.0000 0.0747 0.1037 7508.2598 0.0000 0.9616 98.4892 
## 102   0.0892 -25.0609 0.0000 0.0755 0.1051 7541.2205 0.0000 0.9864 98.5324 
## 103   0.0898 -25.1150 0.0000 0.0761 0.1057 7530.2681 0.0000 0.9757 98.5189 
## 104   0.0887 -25.1511 0.0000 0.0751 0.1045 7558.1051 0.0000 0.9844 98.5260 
## 105   0.0890 -25.0777 0.0000 0.0754 0.1049 7549.3708 0.0000 0.9871 98.5328 
## 106   0.0904 -25.2639 0.0000 0.0767 0.1062 7527.3484 0.0000 0.9585 98.4936 
## 107   0.0895 -25.0599 0.0000 0.0758 0.1054 7511.2122 0.0000 0.9835 98.5265 
## 108   0.0904 -25.3692 0.0000 0.0767 0.1061 7544.5747 0.0000 0.9545 98.4881 
## 109   0.0897 -25.0794 0.0000 0.0759 0.1056 7514.2162 0.0000 0.9801 98.5234 
## 110   0.0890 -25.0855 0.0000 0.0753 0.1048 7544.4498 0.0000 0.9871 98.5268 
## 111   0.0894 -25.0544 0.0000 0.0757 0.1054 7472.1867 0.0000 0.9843 98.5219 
## 112   0.0895 -25.0741 0.0000 0.0758 0.1055 7539.4157 0.0000 0.9823 98.5285 
## 113   0.0894 -25.0605 0.0000 0.0757 0.1053 7532.0508 0.0000 0.9844 98.5298 
## 114   0.0890 -25.0873 0.0000 0.0754 0.1049 7554.4804 0.0000 0.9866 98.5347 
## 115   0.0892 -25.0738 0.0000 0.0755 0.1051 7551.4603 0.0000 0.9858 98.5340 
## 116   0.0883 -25.3964 0.0000 0.0748 0.1039 7548.9901 0.0000 0.9694 98.5080 
## 117   0.0885 -25.2299 0.0000 0.0750 0.1043 7554.9956 0.0000 0.9800 98.5141 
## 118   0.0890 -25.0773 0.0000 0.0753 0.1049 7546.4393 0.0000 0.9872 98.5310 
## 119   0.0885 -25.2661 0.0000 0.0749 0.1042 7551.9657 0.0000 0.9777 98.5136 
## 120   0.0898 -25.1011 0.0000 0.0761 0.1057 7498.9758 0.0000 0.9766 98.5180 
## 121   0.0904 -25.3631 0.0000 0.0768 0.1062 7543.0432 0.0000 0.9526 98.4851 
## 122   0.0893 -25.0618 0.0000 0.0756 0.1052 7542.3150 0.0000 0.9856 98.5322 
## 123   0.0876 -26.2801 0.0000 0.0746 0.1026 6606.4480 0.0000 0.9071 98.3704 
## 124   0.0882 -25.4427 0.0000 0.0748 0.1038 7448.6474 0.0000 0.9660 98.4753 
## 125   0.0889 -25.0885 0.0000 0.0753 0.1048 7519.5656 0.0000 0.9871 98.5026 
## 126   0.0895 -25.0533 0.0000 0.0757 0.1054 7411.9864 0.0000 0.9843 98.5141 
## 127   0.0887 -25.1532 0.0000 0.0751 0.1045 7556.8995 0.0000 0.9843 98.4877 
##          H2 
## 1   67.9315 
## 2   68.0509 
## 3   68.0445 
## 4   68.0352 
## 5   67.9551 
## 6   66.7755 
## 7   67.8697 
## 8   66.1593 
## 9   67.5017 
## 10  66.8683 
## 11  67.2786 
## 12  68.1260 
## 13  65.7482 
## 14  66.9597 
## 15  66.6420 
## 16  66.9876 
## 17  65.1871 
## 18  66.4473 
## 19  68.0755 
## 20  67.2992 
## 21  64.4798 
## 22  67.0548 
## 23  67.8816 
## 24  67.9582 
## 25  68.2503 
## 26  68.2110 
## 27  68.2412 
## 28  68.1470 
## 29  67.8650 
## 30  68.2067 
## 31  65.9368 
## 32  67.4013 
## 33  68.0758 
## 34  68.1472 
## 35  67.5961 
## 36  67.8973 
## 37  67.7382 
## 38  60.8918 
## 39  67.5732 
## 40  68.1485 
## 41  65.9918 
## 42  68.2499 
## 43  66.5533 
## 44  68.1610 
## 45  68.1610 
## 46  67.8671 
## 47  67.8563 
## 48  68.2058 
## 49  67.6598 
## 50  65.5983 
## 51  66.9250 
## 52  66.7051 
## 53  66.4987 
## 54  67.5225 
## 55  66.5483 
## 56  66.2588 
## 57  65.8249 
## 58  67.4725 
## 59  67.3285 
## 60  67.6252 
## 61  66.5904 
## 62  65.8237 
## 63  68.1534 
## 64  67.6575 
## 65  67.3162 
## 66  67.8852 
## 67  67.6017 
## 68  67.9168 
## 69  68.0123 
## 70  67.8514 
## 71  68.1214 
## 72  67.3085 
## 73  67.5633 
## 74  67.6259 
## 75  58.1480 
## 76  65.8031 
## 77  66.4640 
## 78  67.3883 
## 79  67.8790 
## 80  67.7128 
## 81  68.0229 
## 82  67.9310 
## 83  67.9516 
## 84  66.6402 
## 85  67.4291 
## 86  68.1856 
## 87  66.3035 
## 88  66.5943 
## 89  68.1188 
## 90  68.1549 
## 91  67.7611 
## 92  67.7839 
## 93  67.7973 
## 94  67.7355 
## 95  67.7047 
## 96  64.0134 
## 97  62.6122 
## 98  67.5556 
## 99  65.9774 
## 100 67.9136 
## 101 66.1918 
## 102 68.1369 
## 103 67.5192 
## 104 67.8441 
## 105 68.1570 
## 106 66.3838 
## 107 67.8667 
## 108 66.1423 
## 109 67.7230 
## 110 67.8775 
## 111 67.6544 
## 112 67.9559 
## 113 68.0169 
## 114 68.2450 
## 115 68.2107 
## 116 67.0230 
## 117 67.2992 
## 118 68.0755 
## 119 67.2767 
## 120 67.4769 
## 121 66.0099 
## 122 68.1310 
## 123 61.3634 
## 124 65.5856 
## 125 66.7824 
## 126 67.3012 
## 127 66.1258
# Weight of influence of outliers

inf=influence(pes.logit)
print(inf); plot(inf)
## 
##     rstudent  dffits cook.d  cov.r tau2.del    QE.del    hat weight    dfbs inf 
## 1    -0.6358 -0.0505 0.0026 1.0113   0.9812 7549.4440 0.0071 0.7116 -0.0505     
## 2    -0.4760 -0.0372 0.0014 1.0144   0.9836 7544.0468 0.0079 0.7868 -0.0372     
## 3    -0.3545 -0.0260 0.0007 1.0164   0.9852 7531.8905 0.0083 0.8295 -0.0260     
## 4    -0.2846 -0.0193 0.0004 1.0171   0.9858 7529.3150 0.0084 0.8366 -0.0193     
## 5     0.2087  0.0271 0.0007 1.0184   0.9871 7546.7988 0.0085 0.8474  0.0271     
## 6     1.2939  0.1161 0.0134 1.0038   0.9719 7533.7739 0.0085 0.8519  0.1160     
## 7    -0.3354 -0.0243 0.0006 1.0169   0.9855 7507.5023 0.0085 0.8466 -0.0243     
## 8    -1.4533 -0.1455 0.0209 0.9956   0.9634 7219.0514 0.0085 0.8528 -0.1454     
## 9     0.9275  0.0878 0.0077 1.0112   0.9797 7555.9303 0.0085 0.8452  0.0878     
## 10   -1.4702 -0.1309 0.0170 0.9959   0.9655 7537.6623 0.0069 0.6856 -0.1310     
## 11    0.8142  0.0792 0.0063 1.0131   0.9816 7557.1724 0.0085 0.8545  0.0792     
## 12    0.4946  0.0505 0.0026 1.0158   0.9849 7558.1152 0.0080 0.7967  0.0505     
## 13    1.9733  0.1602 0.0250 0.9838   0.9514 7519.1281 0.0083 0.8293  0.1602     
## 14   -1.9127 -0.1094 0.0119 0.9928   0.9664 7550.6071 0.0028 0.2830 -0.1098     
## 15   -1.4646 -0.1431 0.0202 0.9955   0.9637 7480.7094 0.0081 0.8143 -0.1431     
## 16   -1.2942 -0.1234 0.0151 1.0001   0.9685 7500.0619 0.0081 0.8078 -0.1234     
## 17   -2.2285 -0.2175 0.0459 0.9725   0.9410 7512.1630 0.0072 0.7164 -0.2179     
## 18   -1.6243 -0.1560 0.0240 0.9912   0.9598 7514.2583 0.0076 0.7648 -0.1561     
## 19    0.1162  0.0186 0.0003 1.0184   0.9872 7546.4393 0.0084 0.8411  0.0186     
## 20    0.9117  0.0869 0.0076 1.0116   0.9800 7554.9956 0.0085 0.8524  0.0869     
## 21    2.1057  0.1709 0.0283 0.9782   0.9454 7304.4411 0.0086 0.8579  0.1707     
## 22    1.3210  0.1170 0.0136 1.0031   0.9713 7546.4282 0.0084 0.8359  0.1169     
## 23    0.8484  0.0734 0.0054 1.0103   0.9804 7558.2411 0.0069 0.6883  0.0733     
## 24   -0.3144 -0.0170 0.0003 1.0082   0.9811 7557.2827 0.0041 0.4141 -0.0170     
## 25    0.1033  0.0166 0.0003 1.0172   0.9865 7555.1618 0.0078 0.7836  0.0166     
## 26    0.1252  0.0190 0.0004 1.0179   0.9869 7552.8524 0.0082 0.8179  0.0191     
## 27    0.0679  0.0127 0.0002 1.0159   0.9858 7556.4509 0.0073 0.7273  0.0127     
## 28   -0.3015 -0.0198 0.0004 1.0143   0.9843 7553.6767 0.0071 0.7090 -0.0197     
## 29   -0.2897 -0.0130 0.0002 1.0054   0.9797 7557.8198 0.0027 0.2729 -0.0130     
## 30   -0.1835 -0.0094 0.0001 1.0166   0.9859 7550.6611 0.0079 0.7854 -0.0094     
## 31   -2.8407 -0.1692 0.0284 0.9784   0.9515 7543.0553 0.0028 0.2835 -0.1706     
## 32    1.0384  0.0963 0.0093 1.0092   0.9776 7553.5921 0.0084 0.8428  0.0963     
## 33    0.1082  0.0179 0.0003 1.0184   0.9872 7546.0882 0.0084 0.8411  0.0179     
## 34    0.2385  0.0294 0.0009 1.0179   0.9868 7553.5280 0.0083 0.8303  0.0294     
## 35   -0.9016 -0.0809 0.0066 1.0087   0.9774 7521.2617 0.0081 0.8072 -0.0809     
## 36   -0.4474 -0.0354 0.0013 1.0157   0.9844 7512.2629 0.0084 0.8404 -0.0354     
## 37    0.2728  0.0330 0.0011 1.0183   0.9869 7545.2542 0.0085 0.8530  0.0330     
## 38    0.5309  0.0559 0.0032 1.0167   0.9852 7528.5917 0.0086 0.8636  0.0559     
## 39   -0.2246 -0.0135 0.0002 1.0178   0.9864 7480.8927 0.0085 0.8550 -0.0135     
## 40   -0.0925 -0.0009 0.0000 1.0179   0.9868 7543.3706 0.0083 0.8301 -0.0009     
## 41    0.3161  0.0371 0.0014 1.0182   0.9868 7515.7530 0.0086 0.8614  0.0371     
## 42    0.0104  0.0081 0.0001 1.0168   0.9863 7554.7516 0.0077 0.7684  0.0081     
## 43   -1.5380 -0.1496 0.0221 0.9935   0.9618 7498.7664 0.0080 0.7952 -0.1496     
## 44    0.4163  0.0441 0.0020 1.0164   0.9855 7557.6169 0.0080 0.8015  0.0441     
## 45    0.4163  0.0441 0.0020 1.0164   0.9855 7557.6169 0.0080 0.8015  0.0441     
## 46   -0.0857 -0.0001 0.0000 1.0184   0.9870 7521.5890 0.0085 0.8503 -0.0001     
## 47   -0.0377  0.0044 0.0000 1.0185   0.9872 7524.6928 0.0085 0.8508  0.0044     
## 48   -0.0531  0.0027 0.0000 1.0177   0.9867 7548.9372 0.0082 0.8164  0.0028     
## 49   -0.7657 -0.0678 0.0046 1.0114   0.9799 7499.6079 0.0083 0.8337 -0.0678     
## 50   -2.0339 -0.1987 0.0385 0.9787   0.9471 7511.1540 0.0074 0.7372 -0.1989     
## 51    0.2140  0.0278 0.0008 1.0186   0.9872 7517.1032 0.0086 0.8595  0.0278     
## 52    1.2773  0.1149 0.0132 1.0042   0.9723 7531.0944 0.0085 0.8537  0.1149     
## 53    1.2963  0.1165 0.0135 1.0037   0.9718 7521.6324 0.0086 0.8560  0.1165     
## 54    0.9261  0.0876 0.0077 1.0112   0.9797 7556.0832 0.0084 0.8441  0.0876     
## 55    1.5247  0.1321 0.0172 0.9977   0.9657 7527.3063 0.0085 0.8455  0.1320     
## 56    1.8168  0.1480 0.0215 0.9895   0.9576 7541.1186 0.0080 0.8012  0.1480     
## 57    0.0550  0.0132 0.0002 1.0189   0.9874 7424.2900 0.0086 0.8617  0.0132     
## 58    0.3215  0.0374 0.0014 1.0181   0.9867 7543.8279 0.0086 0.8563  0.0374     
## 59   -0.2404 -0.0151 0.0002 1.0178   0.9864 7452.1056 0.0086 0.8573 -0.0151     
## 60    0.2307  0.0292 0.0009 1.0185   0.9871 7539.1262 0.0085 0.8549  0.0293     
## 61    0.5087  0.0539 0.0029 1.0169   0.9854 7551.4242 0.0086 0.8602  0.0539     
## 62   -1.6831 -0.1725 0.0291 0.9884   0.9560 7261.3633 0.0085 0.8483 -0.1724     
## 63   -0.0367  0.0044 0.0000 1.0181   0.9869 7545.0580 0.0083 0.8312  0.0044     
## 64    0.7141  0.0707 0.0050 1.0144   0.9830 7558.4600 0.0085 0.8482  0.0707     
## 65   -0.1887 -0.0100 0.0001 1.0181   0.9867 7460.3006 0.0086 0.8575 -0.0100     
## 66   -0.5003 -0.0407 0.0017 1.0151   0.9838 7513.0018 0.0084 0.8377 -0.0407     
## 67   -0.9498 -0.0820 0.0067 1.0070   0.9765 7541.7338 0.0073 0.7346 -0.0820     
## 68   -0.6510 -0.0536 0.0029 1.0119   0.9813 7544.1688 0.0076 0.7621 -0.0536     
## 69   -0.5359 -0.0427 0.0018 1.0135   0.9828 7545.2434 0.0077 0.7717 -0.0427     
## 70   -0.5655 -0.0472 0.0022 1.0143   0.9830 7512.1372 0.0084 0.8353 -0.0472     
## 71   -0.1198 -0.0034 0.0000 1.0179   0.9867 7540.4457 0.0083 0.8335 -0.0034     
## 72   -0.9207 -0.0849 0.0072 1.0087   0.9771 7436.8432 0.0085 0.8461 -0.0849     
## 73   -0.9093 -0.0822 0.0068 1.0086   0.9773 7513.6512 0.0082 0.8162 -0.0822     
## 74    0.0192  0.0098 0.0001 1.0187   0.9873 7516.3106 0.0086 0.8551  0.0098     
## 75    1.9111  0.1593 0.0247 0.9853   0.9526 5744.4993 0.0086 0.8637  0.1592     
## 76   -2.4580 -0.1806 0.0322 0.9779   0.9495 7541.6421 0.0043 0.4265 -0.1817     
## 77   -2.3999 -0.1405 0.0196 0.9858   0.9592 7546.9471 0.0028 0.2834 -0.1413     
## 78   -1.0505 -0.0967 0.0093 1.0057   0.9744 7513.7578 0.0081 0.8075 -0.0967     
## 79   -0.5746 -0.0480 0.0023 1.0141   0.9828 7518.9309 0.0083 0.8300 -0.0480     
## 80    0.7272  0.0717 0.0052 1.0142   0.9828 7558.4235 0.0085 0.8452  0.0717     
## 81   -0.5249 -0.0414 0.0017 1.0134   0.9829 7546.8687 0.0076 0.7615 -0.0414     
## 82   -0.6126 -0.0459 0.0021 1.0103   0.9810 7552.9592 0.0064 0.6367 -0.0459     
## 83   -0.5839 -0.0434 0.0019 1.0106   0.9813 7553.2253 0.0064 0.6364 -0.0434     
## 84   -1.6379 -0.1430 0.0202 0.9921   0.9620 7539.3234 0.0064 0.6420 -0.1432     
## 85   -1.0806 -0.0953 0.0091 1.0046   0.9739 7538.8165 0.0074 0.7351 -0.0953     
## 86    0.2304  0.0285 0.0008 1.0177   0.9867 7554.4709 0.0082 0.8215  0.0285     
## 87    0.2208  0.0285 0.0008 1.0186   0.9872 7500.0212 0.0086 0.8610  0.0285     
## 88    0.2467  0.0308 0.0010 1.0185   0.9871 7514.1452 0.0086 0.8604  0.0308     
## 89    0.0016  0.0080 0.0001 1.0183   0.9871 7543.9120 0.0084 0.8368  0.0080     
## 90    0.4645  0.0465 0.0022 1.0151   0.9847 7558.2330 0.0075 0.7527  0.0465     
## 91    0.1612  0.0229 0.0005 1.0186   0.9872 7537.2117 0.0085 0.8530  0.0229     
## 92    0.0878  0.0162 0.0003 1.0187   0.9873 7531.6748 0.0085 0.8526  0.0162     
## 93    0.6471  0.0650 0.0043 1.0152   0.9838 7558.4264 0.0084 0.8443  0.0650     
## 94    0.7316  0.0720 0.0052 1.0141   0.9827 7558.4114 0.0084 0.8436  0.0720     
## 95    0.5553  0.0575 0.0033 1.0163   0.9849 7557.3617 0.0085 0.8507  0.0576     
## 96    2.2958  0.1821 0.0318 0.9707   0.9376 7253.2388 0.0086 0.8575  0.1819     
## 97    1.9870  0.1640 0.0261 0.9826   0.9498 6863.3156 0.0086 0.8624  0.1638     
## 98    0.9021  0.0857 0.0074 1.0116   0.9801 7556.5682 0.0084 0.8438  0.0857     
## 99    1.7355  0.1467 0.0211 0.9914   0.9591 7494.2899 0.0085 0.8502  0.1467     
## 100  -0.6357 -0.0531 0.0028 1.0127   0.9817 7537.9328 0.0079 0.7933 -0.0531     
## 101   1.6596  0.1416 0.0197 0.9938   0.9616 7508.2598 0.0085 0.8487  0.1415     
## 102  -0.1751 -0.0087 0.0001 1.0175   0.9864 7541.2205 0.0083 0.8278 -0.0087     
## 103  -0.9882 -0.0886 0.0078 1.0068   0.9757 7530.2681 0.0078 0.7816 -0.0886     
## 104   0.5911  0.0603 0.0037 1.0158   0.9844 7558.1051 0.0084 0.8441  0.0603     
## 105   0.0963  0.0166 0.0003 1.0182   0.9871 7549.3708 0.0083 0.8319  0.0166     
## 106  -1.7041 -0.1589 0.0249 0.9895   0.9585 7527.3484 0.0072 0.7156 -0.1591     
## 107  -0.5228 -0.0429 0.0019 1.0148   0.9835 7511.2122 0.0084 0.8377 -0.0429     
## 108  -2.6758 -0.1584 0.0249 0.9813   0.9545 7544.5747 0.0028 0.2835 -0.1595     
## 109  -0.7556 -0.0664 0.0044 1.0114   0.9801 7514.2162 0.0082 0.8243 -0.0664     
## 110   0.2078  0.0271 0.0007 1.0184   0.9871 7544.4498 0.0085 0.8501  0.0271     
## 111  -0.4638 -0.0372 0.0014 1.0158   0.9843 7472.1867 0.0085 0.8510 -0.0372     
## 112  -0.5891 -0.0485 0.0024 1.0133   0.9823 7539.4157 0.0079 0.7932 -0.0485     
## 113  -0.4373 -0.0341 0.0012 1.0155   0.9844 7532.0508 0.0082 0.8237 -0.0341     
## 114   0.0989  0.0163 0.0003 1.0174   0.9866 7554.4804 0.0080 0.7950  0.0163     
## 115  -0.1777 -0.0089 0.0001 1.0165   0.9858 7551.4603 0.0078 0.7783 -0.0089     
## 116   1.4031  0.1215 0.0147 1.0010   0.9694 7548.9901 0.0082 0.8175  0.1215     
## 117   0.9117  0.0869 0.0076 1.0116   0.9800 7554.9956 0.0085 0.8524  0.0869     
## 118   0.1162  0.0186 0.0003 1.0184   0.9872 7546.4393 0.0084 0.8411  0.0186     
## 119   1.0314  0.0961 0.0092 1.0094   0.9777 7551.9657 0.0085 0.8491  0.0961     
## 120  -0.9446 -0.0865 0.0075 1.0080   0.9766 7498.9758 0.0083 0.8263 -0.0865     
## 121  -2.3313 -0.1701 0.0286 0.9809   0.9526 7543.0432 0.0043 0.4263 -0.1711     
## 122  -0.2893 -0.0195 0.0004 1.0166   0.9856 7542.3150 0.0081 0.8147 -0.0195     
## 123   2.9330  0.2157 0.0432 0.9412   0.9071 6606.4480 0.0086 0.8602  0.2152     
## 124   1.5076  0.1319 0.0172 0.9982   0.9660 7448.6474 0.0086 0.8593  0.1319     
## 125   0.2494  0.0310 0.0010 1.0185   0.9871 7519.5656 0.0086 0.8600  0.0311     
## 126  -0.4728 -0.0382 0.0015 1.0158   0.9843 7411.9864 0.0086 0.8563 -0.0382     
## 127   0.6152  0.0630 0.0040 1.0158   0.9843 7556.8995 0.0086 0.8610  0.0630

# Forest Plot - visualization of outliers

#l1o=leave1out(pes)
#yi=l1o$ estimate; vi=l1o$se^2
#forest(yi, vi,
       #slab=paste(data_neumo1$author, sep=","),
       #refline=pes$b,
       #xlab=c(ies.logit)
#print(pes.logit)

#l1o=leave1out(pes.logit)
#yi=l1o$estimate; vi=l1o$se^2
#forest(yi, vi, transf=transf.ilogit,
       #slab=paste(data_neumo1$author,sep=","),
       #refline=pes$pred,
       #xlab="Summary proportions leaving out each study")

V. Metaregresion

rm(list=ls(all=TRUE)) #Deletes all memory content

library(readxl)
data_neumo1 <- read_excel("C:/Users/USER/Desktop/RSMA/data_neumo1.xlsx")
View(data_neumo1)

# Call of the packages

#install.packages(c("metafor", "meta"))
#install.packages("PerformanceAnalytics")
library(metafor)
library(meta)
library(tidyverse)
library(metadat)
# Metaregression data structure

glimpse(data_neumo1)
## Rows: 127
## Columns: 20
## $ Sequence     <chr> "RSMA01", "RSMA02", "RSMA03", "RSMA04", "RSMA05", "RSMA06…
## $ code         <chr> "RS001", "RS001", "RS001", "RS002", "RS002", "RS002", "RS…
## $ author_1     <chr> "Abdullahi", "Abdullahi", "Abdullahi", "Adetifa", "Adetif…
## $ year_pub     <dbl> 2008, 2008, 2008, 2012, 2012, 2012, 2019, 2014, 2013, 201…
## $ author       <chr> "Abdullahi_2008", "Abdullahi_2008", "Abdullahi_2008", "Ad…
## $ contint      <dbl> 1, 1, 1, 1, 1, 1, 5, 5, 5, 2, 1, 2, 2, 6, 3, 3, 5, 5, 4, …
## $ age          <dbl> 4, 2, 1, 4, 2, 1, 1, 4, 4, 4, 1, 4, 4, 1, 4, 4, 2, 4, 1, …
## $ prev         <dbl> 0.046728972, 0.056410256, 0.064039409, 0.068464730, 0.107…
## $ sample       <dbl> 107, 195, 406, 482, 530, 361, 795, 3361, 283, 210, 600, 1…
## $ posit        <dbl> 5, 11, 26, 33, 57, 94, 52, 77, 56, 4, 108, 14, 41, 0, 17,…
## $ type_prev    <dbl> 2, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, …
## $ stage        <dbl> 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 1, 2, 2, 2, 2, 2, …
## $ comorb       <dbl> 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, …
## $ type_morb    <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, …
## $ meth_iden    <dbl> 1, 1, 1, 1, 1, 1, 1, 3, 2, 1, 1, 1, 2, 1, 3, 3, 1, 1, 1, …
## $ type_samp    <dbl> 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 2, 3, 3, 1, 1, 1, 1, 1, 4, …
## $ setting      <dbl> 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 1, 2, 2, 4, 1, 1, 1, 1, 2, …
## $ type_setting <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 2, 10, 1, 1, 1, 1, 7,…
## $ type_study   <dbl> 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 4, 2, 2, 4, 4, 3, …
## $ quality      <dbl> 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 4, 4, 4, 4, 4, …
# Multicollinearity Analysis

data_neumo1[,c("prev","year_pub","age","sample","stage","type_prev","comorb","type_morb", "meth_iden",
               "type_samp","quality")] %>% cor()
##                   prev    year_pub         age      sample       stage
## prev       1.000000000  0.13868200 -0.17967540  0.07411439  0.02176720
## year_pub   0.138682005  1.00000000  0.22627526  0.03067928  0.39752442
## age       -0.179675397  0.22627526  1.00000000 -0.13093882  0.11567383
## sample     0.074114394  0.03067928 -0.13093882  1.00000000  0.04390912
## stage      0.021767199  0.39752442  0.11567383  0.04390912  1.00000000
## type_prev  0.236530610 -0.18428735 -0.17725722  0.12161419 -0.04104637
## comorb    -0.086607462 -0.10618728  0.07478766  0.15715092  0.04058524
## type_morb  0.081356109  0.16986434 -0.01084178 -0.15431325  0.02179090
## meth_iden -0.018333113  0.03447639  0.24005604 -0.01641210  0.09677704
## type_samp -0.009052112  0.19581058  0.10742613 -0.07424087  0.02474667
## quality   -0.029441628  0.08528716  0.18837118 -0.11182899  0.12662086
##             type_prev      comorb   type_morb   meth_iden    type_samp
## prev       0.23653061 -0.08660746  0.08135611 -0.01833311 -0.009052112
## year_pub  -0.18428735 -0.10618728  0.16986434  0.03447639  0.195810580
## age       -0.17725722  0.07478766 -0.01084178  0.24005604  0.107426133
## sample     0.12161419  0.15715092 -0.15431325 -0.01641210 -0.074240869
## stage     -0.04104637  0.04058524  0.02179090  0.09677704  0.024746673
## type_prev  1.00000000  0.13652971 -0.12022355 -0.02858849 -0.086073483
## comorb     0.13652971  1.00000000 -0.94544037  0.10623960  0.212889711
## type_morb -0.12022355 -0.94544037  1.00000000 -0.08748310 -0.212806023
## meth_iden -0.02858849  0.10623960 -0.08748310  1.00000000  0.401702746
## type_samp -0.08607348  0.21288971 -0.21280602  0.40170275  1.000000000
## quality   -0.19181043 -0.12561763  0.10478573 -0.01195179  0.021202178
##               quality
## prev      -0.02944163
## year_pub   0.08528716
## age        0.18837118
## sample    -0.11182899
## stage      0.12662086
## type_prev -0.19181043
## comorb    -0.12561763
## type_morb  0.10478573
## meth_iden -0.01195179
## type_samp  0.02120218
## quality    1.00000000
# Correlation graph (authors: Peterson y Carl 2020)

library(PerformanceAnalytics)

data_neumo1[,c("prev","year_pub","age","sample","stage","type_prev","comorb","type_morb", "meth_iden",
               "type_samp","quality")] %>% chart.Correlation()

warnings()

data_neumo1[,c("prev","age","comorb","type_morb", "meth_iden","type_samp")] %>% chart.Correlation()

warnings()

# Adjusted multiple metaregression model 

m.qual <- rma(yi = prev,
              sei = age,
              data = data_neumo1,
              method = "ML",
              mods = ~ comorb,
              test = "knha")
m.qual
## 
## Mixed-Effects Model (k = 127; tau^2 estimator: ML)
## 
## tau^2 (estimated amount of residual heterogeneity):     0 (SE = 0.1675)
## tau (square root of estimated tau^2 value):             0
## I^2 (residual heterogeneity / unaccounted variability): 0.00%
## H^2 (unaccounted variability / sampling variability):   1.00
## R^2 (amount of heterogeneity accounted for):            0.00%
## 
## Test for Residual Heterogeneity:
## QE(df = 125) = 0.9331, p-val = 1.0000
## 
## Test of Moderators (coefficient 2):
## F(df1 = 1, df2 = 125) = 0.0867, p-val = 0.7689
## 
## Model Results:
## 
##          estimate      se     tval   df    pval    ci.lb   ci.ub     
## intrcpt    0.1386  0.0456   3.0384  125  0.0029   0.0483  0.2290  ** 
## comorb    -0.0073  0.0247  -0.2945  125  0.7689  -0.0562  0.0416     
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
m.qual <- rma(yi = prev,
              sei = age,
              data = data_neumo1,
              method = "ML",
              mods = ~ comorb,
              test = "knha")
m.qual
## 
## Mixed-Effects Model (k = 127; tau^2 estimator: ML)
## 
## tau^2 (estimated amount of residual heterogeneity):     0 (SE = 0.1675)
## tau (square root of estimated tau^2 value):             0
## I^2 (residual heterogeneity / unaccounted variability): 0.00%
## H^2 (unaccounted variability / sampling variability):   1.00
## R^2 (amount of heterogeneity accounted for):            0.00%
## 
## Test for Residual Heterogeneity:
## QE(df = 125) = 0.9331, p-val = 1.0000
## 
## Test of Moderators (coefficient 2):
## F(df1 = 1, df2 = 125) = 0.0867, p-val = 0.7689
## 
## Model Results:
## 
##          estimate      se     tval   df    pval    ci.lb   ci.ub     
## intrcpt    0.1386  0.0456   3.0384  125  0.0029   0.0483  0.2290  ** 
## comorb    -0.0073  0.0247  -0.2945  125  0.7689  -0.0562  0.0416     
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
m.qual <- rma(yi = prev,
              sei = age,
              data = data_neumo1,
              method = "ML",
              mods = ~ meth_iden,
              test = "knha")
m.qual
## 
## Mixed-Effects Model (k = 127; tau^2 estimator: ML)
## 
## tau^2 (estimated amount of residual heterogeneity):     0 (SE = 0.1675)
## tau (square root of estimated tau^2 value):             0
## I^2 (residual heterogeneity / unaccounted variability): 0.00%
## H^2 (unaccounted variability / sampling variability):   1.00
## R^2 (amount of heterogeneity accounted for):            0.00%
## 
## Test for Residual Heterogeneity:
## QE(df = 125) = 0.9292, p-val = 1.0000
## 
## Test of Moderators (coefficient 2):
## F(df1 = 1, df2 = 125) = 0.6038, p-val = 0.4386
## 
## Model Results:
## 
##            estimate      se    tval   df    pval    ci.lb   ci.ub      
## intrcpt      0.1066  0.0262  4.0635  125  <.0001   0.0547  0.1585  *** 
## meth_iden    0.0163  0.0210  0.7771  125  0.4386  -0.0253  0.0580      
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
m.qual <- rma(yi = prev,
              sei = age,
              data = data_neumo1,
              method = "ML",
              mods = ~ type_samp,
              test = "knha")
m.qual
## 
## Mixed-Effects Model (k = 127; tau^2 estimator: ML)
## 
## tau^2 (estimated amount of residual heterogeneity):     0 (SE = 0.1675)
## tau (square root of estimated tau^2 value):             0
## I^2 (residual heterogeneity / unaccounted variability): 0.00%
## H^2 (unaccounted variability / sampling variability):   1.00
## R^2 (amount of heterogeneity accounted for):            0.00%
## 
## Test for Residual Heterogeneity:
## QE(df = 125) = 0.9204, p-val = 1.0000
## 
## Test of Moderators (coefficient 2):
## F(df1 = 1, df2 = 125) = 1.8065, p-val = 0.1814
## 
## Model Results:
## 
##            estimate      se    tval   df    pval    ci.lb   ci.ub      
## intrcpt      0.1058  0.0176  6.0109  125  <.0001   0.0710  0.1407  *** 
## type_samp    0.0116  0.0087  1.3441  125  0.1814  -0.0055  0.0288      
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
m.qual <- rma(yi = prev,
              sei = age,
              data = data_neumo1,
              method = "ML",
              mods = ~ quality,
              test = "knha")
m.qual
## 
## Mixed-Effects Model (k = 127; tau^2 estimator: ML)
## 
## tau^2 (estimated amount of residual heterogeneity):     0 (SE = 0.1675)
## tau (square root of estimated tau^2 value):             0
## I^2 (residual heterogeneity / unaccounted variability): 0.00%
## H^2 (unaccounted variability / sampling variability):   1.00
## R^2 (amount of heterogeneity accounted for):            0.00%
## 
## Test for Residual Heterogeneity:
## QE(df = 125) = 0.9110, p-val = 1.0000
## 
## Test of Moderators (coefficient 2):
## F(df1 = 1, df2 = 125) = 3.1128, p-val = 0.0801
## 
## Model Results:
## 
##          estimate      se    tval   df    pval    ci.lb   ci.ub    
## intrcpt    0.0029  0.0702  0.0414  125  0.9671  -0.1360  0.1418    
## quality    0.0379  0.0215  1.7643  125  0.0801  -0.0046  0.0805  . 
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# fitted model with several predictors

m.qual.rep <- rma(yi = prev, 
                  sei = age, 
                  data = data_neumo1, 
                  method = "ML", 
                  mods = ~ stage + comorb + meth_iden + type_samp + quality, 
                  test = "knha")
m.qual.rep
## 
## Mixed-Effects Model (k = 127; tau^2 estimator: ML)
## 
## tau^2 (estimated amount of residual heterogeneity):     0 (SE = 0.1675)
## tau (square root of estimated tau^2 value):             0
## I^2 (residual heterogeneity / unaccounted variability): 0.00%
## H^2 (unaccounted variability / sampling variability):   1.00
## R^2 (amount of heterogeneity accounted for):            0.00%
## 
## Test for Residual Heterogeneity:
## QE(df = 121) = 0.8961, p-val = 1.0000
## 
## Test of Moderators (coefficients 2:6):
## F(df1 = 5, df2 = 121) = 1.0156, p-val = 0.4116
## 
## Model Results:
## 
##            estimate      se     tval   df    pval    ci.lb   ci.ub    
## intrcpt     -0.0060  0.1000  -0.0604  121  0.9520  -0.2040  0.1919    
## stage       -0.0106  0.0190  -0.5571  121  0.5785  -0.0482  0.0270    
## comorb      -0.0028  0.0257  -0.1087  121  0.9136  -0.0536  0.0480    
## meth_iden    0.0177  0.0220   0.8045  121  0.4227  -0.0259  0.0613    
## type_samp    0.0078  0.0094   0.8354  121  0.4051  -0.0107  0.0263    
## quality      0.0375  0.0231   1.6250  121  0.1068  -0.0082  0.0832    
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
m.qual.rep <- rma(yi = prev, 
                  sei = type_samp, 
                  data = data_neumo1, 
                  method = "ML", 
                  mods = ~ age + stage + comorb + meth_iden + quality, 
                  test = "knha")
m.qual.rep
## 
## Mixed-Effects Model (k = 127; tau^2 estimator: ML)
## 
## tau^2 (estimated amount of residual heterogeneity):     0 (SE = 0.1520)
## tau (square root of estimated tau^2 value):             0
## I^2 (residual heterogeneity / unaccounted variability): 0.00%
## H^2 (unaccounted variability / sampling variability):   1.00
## R^2 (amount of heterogeneity accounted for):            0.00%
## 
## Test for Residual Heterogeneity:
## QE(df = 121) = 1.0027, p-val = 1.0000
## 
## Test of Moderators (coefficients 2:6):
## F(df1 = 5, df2 = 121) = 0.2883, p-val = 0.9187
## 
## Model Results:
## 
##            estimate      se     tval   df    pval    ci.lb   ci.ub    
## intrcpt      0.1509  0.0884   1.7078  121  0.0902  -0.0240  0.3259  . 
## age         -0.0068  0.0082  -0.8286  121  0.4090  -0.0231  0.0095    
## stage        0.0029  0.0201   0.1421  121  0.8872  -0.0370  0.0427    
## comorb      -0.0124  0.0232  -0.5351  121  0.5936  -0.0582  0.0334    
## meth_iden   -0.0103  0.0203  -0.5061  121  0.6137  -0.0505  0.0299    
## quality      0.0009  0.0213   0.0399  121  0.9682  -0.0414  0.0431    
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
m.qual.rep <- rma(yi = prev, 
                  sei = meth_iden, 
                  data = data_neumo1, 
                  method = "ML", 
                  mods = ~ age +stage + comorb + type_samp + quality, 
                  test = "knha")
m.qual.rep
## 
## Mixed-Effects Model (k = 127; tau^2 estimator: ML)
## 
## tau^2 (estimated amount of residual heterogeneity):     0 (SE = 0.1381)
## tau (square root of estimated tau^2 value):             0
## I^2 (residual heterogeneity / unaccounted variability): 0.00%
## H^2 (unaccounted variability / sampling variability):   1.00
## R^2 (amount of heterogeneity accounted for):            0.00%
## 
## Test for Residual Heterogeneity:
## QE(df = 121) = 1.1589, p-val = 1.0000
## 
## Test of Moderators (coefficients 2:6):
## F(df1 = 5, df2 = 121) = 1.0237, p-val = 0.4068
## 
## Model Results:
## 
##            estimate      se     tval   df    pval    ci.lb    ci.ub    
## intrcpt      0.1024  0.0878   1.1662  121  0.2458  -0.0714   0.2763    
## age         -0.0160  0.0077  -2.0738  121  0.0402  -0.0313  -0.0007  * 
## stage        0.0063  0.0209   0.3027  121  0.7626  -0.0350   0.0477    
## comorb      -0.0099  0.0244  -0.4045  121  0.6866  -0.0583   0.0385    
## type_samp   -0.0023  0.0091  -0.2516  121  0.8018  -0.0204   0.0158    
## quality      0.0156  0.0204   0.7651  121  0.4457  -0.0247   0.0559    
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
m.qual.rep <- rma(yi = prev, 
                  sei = comorb, 
                  data = data_neumo1, 
                  method = "ML", 
                  mods = ~ age +stage + meth_iden + type_samp + quality, 
                  test = "knha")
m.qual.rep
## 
## Mixed-Effects Model (k = 127; tau^2 estimator: ML)
## 
## tau^2 (estimated amount of residual heterogeneity):     0 (SE = 0.2604)
## tau (square root of estimated tau^2 value):             0
## I^2 (residual heterogeneity / unaccounted variability): 0.00%
## H^2 (unaccounted variability / sampling variability):   1.00
## R^2 (amount of heterogeneity accounted for):            0.00%
## 
## Test for Residual Heterogeneity:
## QE(df = 121) = 0.5992, p-val = 1.0000
## 
## Test of Moderators (coefficients 2:6):
## F(df1 = 5, df2 = 121) = 0.7054, p-val = 0.6204
## 
## Model Results:
## 
##            estimate      se     tval   df    pval    ci.lb   ci.ub    
## intrcpt      0.0925  0.0815   1.1347  121  0.2588  -0.0689  0.2538    
## age         -0.0148  0.0085  -1.7548  121  0.0818  -0.0316  0.0019  . 
## stage        0.0150  0.0226   0.6642  121  0.5078  -0.0297  0.0597    
## meth_iden    0.0133  0.0196   0.6773  121  0.4995  -0.0255  0.0520    
## type_samp    0.0029  0.0098   0.2957  121  0.7680  -0.0165  0.0223    
## quality      0.0033  0.0211   0.1543  121  0.8777  -0.0385  0.0450    
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Comparison by ANNOVA of the two adjusted models

rm(list=ls(all=TRUE)) #Deletes all memory content

library(readxl)
data_neumo1 <- read_excel("C:/Users/USER/Desktop/RSMA/data_neumo1.xlsx")
View(data_neumo1)

# Call of the packages

#install.packages(c("metafor", "meta"))
#install.packages("PerformanceAnalytics")
library(metafor)
library(meta)
library(tidyverse)
library(metadat)

data_neumo1[,c("prev","year_pub","age","sample","stage","type_prev","comorb","type_morb", "meth_iden",
               "type_samp","quality")] %>% cor()
##                   prev    year_pub         age      sample       stage
## prev       1.000000000  0.13868200 -0.17967540  0.07411439  0.02176720
## year_pub   0.138682005  1.00000000  0.22627526  0.03067928  0.39752442
## age       -0.179675397  0.22627526  1.00000000 -0.13093882  0.11567383
## sample     0.074114394  0.03067928 -0.13093882  1.00000000  0.04390912
## stage      0.021767199  0.39752442  0.11567383  0.04390912  1.00000000
## type_prev  0.236530610 -0.18428735 -0.17725722  0.12161419 -0.04104637
## comorb    -0.086607462 -0.10618728  0.07478766  0.15715092  0.04058524
## type_morb  0.081356109  0.16986434 -0.01084178 -0.15431325  0.02179090
## meth_iden -0.018333113  0.03447639  0.24005604 -0.01641210  0.09677704
## type_samp -0.009052112  0.19581058  0.10742613 -0.07424087  0.02474667
## quality   -0.029441628  0.08528716  0.18837118 -0.11182899  0.12662086
##             type_prev      comorb   type_morb   meth_iden    type_samp
## prev       0.23653061 -0.08660746  0.08135611 -0.01833311 -0.009052112
## year_pub  -0.18428735 -0.10618728  0.16986434  0.03447639  0.195810580
## age       -0.17725722  0.07478766 -0.01084178  0.24005604  0.107426133
## sample     0.12161419  0.15715092 -0.15431325 -0.01641210 -0.074240869
## stage     -0.04104637  0.04058524  0.02179090  0.09677704  0.024746673
## type_prev  1.00000000  0.13652971 -0.12022355 -0.02858849 -0.086073483
## comorb     0.13652971  1.00000000 -0.94544037  0.10623960  0.212889711
## type_morb -0.12022355 -0.94544037  1.00000000 -0.08748310 -0.212806023
## meth_iden -0.02858849  0.10623960 -0.08748310  1.00000000  0.401702746
## type_samp -0.08607348  0.21288971 -0.21280602  0.40170275  1.000000000
## quality   -0.19181043 -0.12561763  0.10478573 -0.01195179  0.021202178
##               quality
## prev      -0.02944163
## year_pub   0.08528716
## age        0.18837118
## sample    -0.11182899
## stage      0.12662086
## type_prev -0.19181043
## comorb    -0.12561763
## type_morb  0.10478573
## meth_iden -0.01195179
## type_samp  0.02120218
## quality    1.00000000
# Correlation graph (authors: Peterson y Carl 2020)

library(PerformanceAnalytics)

data_neumo1[,c("prev","year_pub","age","sample","stage","type_prev","comorb","type_morb", "meth_iden",
               "type_samp","quality")] %>% chart.Correlation()

warnings()

data_neumo1[,c("prev","age","comorb","type_morb", "meth_iden","type_samp")] %>% chart.Correlation()

warnings()

m.qual <- rma(yi = prev,
              sei = age,
              data = data_neumo1,
              method = "ML",
              mods = ~ comorb,
              test = "knha")
m.qual
## 
## Mixed-Effects Model (k = 127; tau^2 estimator: ML)
## 
## tau^2 (estimated amount of residual heterogeneity):     0 (SE = 0.1675)
## tau (square root of estimated tau^2 value):             0
## I^2 (residual heterogeneity / unaccounted variability): 0.00%
## H^2 (unaccounted variability / sampling variability):   1.00
## R^2 (amount of heterogeneity accounted for):            0.00%
## 
## Test for Residual Heterogeneity:
## QE(df = 125) = 0.9331, p-val = 1.0000
## 
## Test of Moderators (coefficient 2):
## F(df1 = 1, df2 = 125) = 0.0867, p-val = 0.7689
## 
## Model Results:
## 
##          estimate      se     tval   df    pval    ci.lb   ci.ub     
## intrcpt    0.1386  0.0456   3.0384  125  0.0029   0.0483  0.2290  ** 
## comorb    -0.0073  0.0247  -0.2945  125  0.7689  -0.0562  0.0416     
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
m.qual.rep <- rma(yi = prev, 
                  sei = age, 
                  data = data_neumo1, 
                  method = "ML", 
                  mods = ~ year_pub + stage + comorb + type_prev + meth_iden + type_samp + quality, 
                  test = "knha")
m.qual.rep
## 
## Mixed-Effects Model (k = 127; tau^2 estimator: ML)
## 
## tau^2 (estimated amount of residual heterogeneity):     0 (SE = 0.1675)
## tau (square root of estimated tau^2 value):             0
## I^2 (residual heterogeneity / unaccounted variability): 0.00%
## H^2 (unaccounted variability / sampling variability):   1.00
## R^2 (amount of heterogeneity accounted for):            0.00%
## 
## Test for Residual Heterogeneity:
## QE(df = 119) = 0.7929, p-val = 1.0000
## 
## Test of Moderators (coefficients 2:8):
## F(df1 = 7, df2 = 119) = 3.0190, p-val = 0.0059
## 
## Model Results:
## 
##            estimate      se     tval   df    pval     ci.lb    ci.ub     
## intrcpt    -12.4049  3.7083  -3.3452  119  0.0011  -19.7477  -5.0621  ** 
## year_pub     0.0061  0.0018   3.3313  119  0.0012    0.0025   0.0098  ** 
## stage       -0.0345  0.0195  -1.7693  119  0.0794   -0.0731   0.0041   . 
## comorb      -0.0026  0.0246  -0.1064  119  0.9155   -0.0514   0.0461     
## type_prev    0.0407  0.0171   2.3795  119  0.0189    0.0068   0.0746   * 
## meth_iden    0.0380  0.0220   1.7259  119  0.0870   -0.0056   0.0815   . 
## type_samp    0.0027  0.0092   0.2904  119  0.7720   -0.0155   0.0208     
## quality      0.0449  0.0220   2.0462  119  0.0429    0.0015   0.0884   * 
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Comparison by ANNOVA of the two adjusted models

anova(m.qual, m.qual.rep)
## 
##         df      AIC      BIC     AICc    logLik    LRT   pval     QE  tau^2 
## Full     9 383.2216 408.8193 384.7601 -182.6108               0.7929 0.0000 
## Reduced  3 371.3618 379.8944 371.5569 -182.6809 0.1402 0.9999 0.9331 0.0000 
##             R^2 
## Full            
## Reduced 0.0000%
##### Analysis of model interactions

# Add factor labels to 'comorbility'# 1 = SI # 2 = NO

levels(data_neumo1$comorb) = c("SI", "NO")

# Fit the meta-regression model

m.qual.rep.int <- rma(yi = prev, 
                      sei = age, 
                      data = data_neumo1, 
                      method = "REML", 
                      mods = ~ age * comorb, 
                      test = "knha")
m.qual.rep.int
## 
## Mixed-Effects Model (k = 127; tau^2 estimator: REML)
## 
## tau^2 (estimated amount of residual heterogeneity):     0 (SE = 0.1700)
## tau (square root of estimated tau^2 value):             0
## I^2 (residual heterogeneity / unaccounted variability): 0.00%
## H^2 (unaccounted variability / sampling variability):   1.00
## R^2 (amount of heterogeneity accounted for):            0.00%
## 
## Test for Residual Heterogeneity:
## QE(df = 123) = 0.9282, p-val = 1.0000
## 
## Test of Moderators (coefficients 2:4):
## F(df1 = 3, df2 = 123) = 0.2450, p-val = 0.8647
## 
## Model Results:
## 
##             estimate      se     tval   df    pval    ci.lb   ci.ub    
## intrcpt       0.0992  0.1147   0.8655  123  0.3885  -0.1277  0.3262    
## age           0.0345  0.0931   0.3707  123  0.7115  -0.1497  0.2187    
## comorb        0.0211  0.0612   0.3441  123  0.7313  -0.1001  0.1423    
## age:comorb   -0.0247  0.0494  -0.4998  123  0.6181  -0.1225  0.0731    
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
### Test de permutación

permutest(m.qual)
## Running 1000 iterations for an approximate permutation test.
## 
## Test of Moderators (coefficient 2):¹
## F(df1 = 1, df2 = 125) = 0.0867, p-val = 0.8080
## 
## Model Results:
## 
##          estimate      se     tval   df    pval¹    ci.lb   ci.ub    
## intrcpt    0.1386  0.0456   3.0384  125  0.3490    0.0483  0.2290    
## comorb    -0.0073  0.0247  -0.2945  125  0.8080   -0.0562  0.0416    
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 1) p-values based on permutation testing
permutest(m.qual.rep)
## Running 1000 iterations for an approximate permutation test.
## 
## Test of Moderators (coefficients 2:8):¹
## F(df1 = 7, df2 = 119) = 3.0190, p-val = 0.0730
## 
## Model Results:
## 
##            estimate      se     tval   df    pval¹     ci.lb    ci.ub     
## intrcpt    -12.4049  3.7083  -3.3452  119  0.0080   -19.7477  -5.0621  ** 
## year_pub     0.0061  0.0018   3.3313  119  0.0080     0.0025   0.0098  ** 
## stage       -0.0345  0.0195  -1.7693  119  0.1550    -0.0731   0.0041     
## comorb      -0.0026  0.0246  -0.1064  119  0.9320    -0.0514   0.0461     
## type_prev    0.0407  0.0171   2.3795  119  0.0550     0.0068   0.0746   . 
## meth_iden    0.0380  0.0220   1.7259  119  0.1610    -0.0056   0.0815     
## type_samp    0.0027  0.0092   0.2904  119  0.8220    -0.0155   0.0208     
## quality      0.0449  0.0220   2.0462  119  0.1170     0.0015   0.0884     
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 1) p-values based on permutation testing
# Add factor labels to 'method_identification'# 1 = Culture, # 2 = PCR, # 3 = Culture & PCR, # 4 = Others

levels(data_neumo1$meth_iden) = c("1", "2", "3","4")

# Fit the meta-regression model

m.qual.rep.int <- rma(yi = prev, 
                      sei = age, 
                      data = data_neumo1, 
                      method = "REML", 
                      mods = ~ age * meth_iden, 
                      test = "knha")
m.qual.rep.int
## 
## Mixed-Effects Model (k = 127; tau^2 estimator: REML)
## 
## tau^2 (estimated amount of residual heterogeneity):     0 (SE = 0.1699)
## tau (square root of estimated tau^2 value):             0
## I^2 (residual heterogeneity / unaccounted variability): 0.00%
## H^2 (unaccounted variability / sampling variability):   1.00
## R^2 (amount of heterogeneity accounted for):            0.00%
## 
## Test for Residual Heterogeneity:
## QE(df = 123) = 0.9218, p-val = 1.0000
## 
## Test of Moderators (coefficients 2:4):
## F(df1 = 3, df2 = 123) = 0.5295, p-val = 0.6629
## 
## Model Results:
## 
##                estimate      se     tval   df    pval    ci.lb   ci.ub    
## intrcpt          0.0898  0.0572   1.5693  123  0.1191  -0.0235  0.2031    
## age              0.0083  0.0400   0.2063  123  0.8369  -0.0710  0.0875    
## meth_iden        0.0417  0.0423   0.9845  123  0.3268  -0.0421  0.1255    
## age:meth_iden   -0.0160  0.0258  -0.6185  123  0.5374  -0.0671  0.0351    
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
### Test de permutación

permutest(m.qual)
## Running 1000 iterations for an approximate permutation test.
## 
## Test of Moderators (coefficient 2):¹
## F(df1 = 1, df2 = 125) = 0.0867, p-val = 0.8390
## 
## Model Results:
## 
##          estimate      se     tval   df    pval¹    ci.lb   ci.ub    
## intrcpt    0.1386  0.0456   3.0384  125  0.3530    0.0483  0.2290    
## comorb    -0.0073  0.0247  -0.2945  125  0.8390   -0.0562  0.0416    
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 1) p-values based on permutation testing
permutest(m.qual.rep)
## Running 1000 iterations for an approximate permutation test.
## 
## Test of Moderators (coefficients 2:8):¹
## F(df1 = 7, df2 = 119) = 3.0190, p-val = 0.0750
## 
## Model Results:
## 
##            estimate      se     tval   df    pval¹     ci.lb    ci.ub     
## intrcpt    -12.4049  3.7083  -3.3452  119  0.0100   -19.7477  -5.0621  ** 
## year_pub     0.0061  0.0018   3.3313  119  0.0110     0.0025   0.0098   * 
## stage       -0.0345  0.0195  -1.7693  119  0.1600    -0.0731   0.0041     
## comorb      -0.0026  0.0246  -0.1064  119  0.9410    -0.0514   0.0461     
## type_prev    0.0407  0.0171   2.3795  119  0.0570     0.0068   0.0746   . 
## meth_iden    0.0380  0.0220   1.7259  119  0.1660    -0.0056   0.0815     
## type_samp    0.0027  0.0092   0.2904  119  0.8020    -0.0155   0.0208     
## quality      0.0449  0.0220   2.0462  119  0.1230     0.0015   0.0884     
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 1) p-values based on permutation testing
# Add factor labels to 'type_samp'# 1 = FNF, # 2 = FOF, # 3 = FNF+FOF, # 4 = FNF + Others, # 5 =FNF + Saliva, # 6 = Saliva, # 7 = FNF + Esputo

levels(data_neumo1$type_samp) = c("1", "2", "3","4","5","6","7")

# Fit the meta-regression model

m.qual.rep.int <- rma(yi = prev, 
                      sei = age, 
                      data = data_neumo1, 
                      method = "REML", 
                      mods = ~ age * type_samp, 
                      test = "knha")
m.qual.rep.int
## 
## Mixed-Effects Model (k = 127; tau^2 estimator: REML)
## 
## tau^2 (estimated amount of residual heterogeneity):     0 (SE = 0.1699)
## tau (square root of estimated tau^2 value):             0
## I^2 (residual heterogeneity / unaccounted variability): 0.00%
## H^2 (unaccounted variability / sampling variability):   1.00
## R^2 (amount of heterogeneity accounted for):            0.00%
## 
## Test for Residual Heterogeneity:
## QE(df = 123) = 0.9097, p-val = 1.0000
## 
## Test of Moderators (coefficients 2:4):
## F(df1 = 3, df2 = 123) = 1.0817, p-val = 0.3595
## 
## Model Results:
## 
##                estimate      se     tval   df    pval    ci.lb   ci.ub    
## intrcpt          0.0897  0.0407   2.2012  123  0.0296   0.0090  0.1703  * 
## age              0.0122  0.0309   0.3929  123  0.6951  -0.0491  0.0734    
## type_samp        0.0281  0.0188   1.4937  123  0.1378  -0.0091  0.0653    
## age:type_samp   -0.0129  0.0134  -0.9673  123  0.3353  -0.0394  0.0135    
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
### Test de permutación

permutest(m.qual)
## Running 1000 iterations for an approximate permutation test.
## 
## Test of Moderators (coefficient 2):¹
## F(df1 = 1, df2 = 125) = 0.0867, p-val = 0.8230
## 
## Model Results:
## 
##          estimate      se     tval   df    pval¹    ci.lb   ci.ub    
## intrcpt    0.1386  0.0456   3.0384  125  0.3540    0.0483  0.2290    
## comorb    -0.0073  0.0247  -0.2945  125  0.8230   -0.0562  0.0416    
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 1) p-values based on permutation testing
permutest(m.qual.rep)
## Running 1000 iterations for an approximate permutation test.
## 
## Test of Moderators (coefficients 2:8):¹
## F(df1 = 7, df2 = 119) = 3.0190, p-val = 0.0820
## 
## Model Results:
## 
##            estimate      se     tval   df    pval¹     ci.lb    ci.ub     
## intrcpt    -12.4049  3.7083  -3.3452  119  0.0080   -19.7477  -5.0621  ** 
## year_pub     0.0061  0.0018   3.3313  119  0.0080     0.0025   0.0098  ** 
## stage       -0.0345  0.0195  -1.7693  119  0.1370    -0.0731   0.0041     
## comorb      -0.0026  0.0246  -0.1064  119  0.9370    -0.0514   0.0461     
## type_prev    0.0407  0.0171   2.3795  119  0.0480     0.0068   0.0746   * 
## meth_iden    0.0380  0.0220   1.7259  119  0.1810    -0.0056   0.0815     
## type_samp    0.0027  0.0092   0.2904  119  0.8150    -0.0155   0.0208     
## quality      0.0449  0.0220   2.0462  119  0.1040     0.0015   0.0884     
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 1) p-values based on permutation testing
# Fit the meta-regression model to 'age' # 1 = All, # 2 = young, # 3 = middle, # 4 = older

levels(data_neumo1$age) = c("1", "2", "3","4")

# Fit the meta-regression model

m.qual.rep.int <- rma(yi = prev, 
                      sei = meth_iden, 
                      data = data_neumo1, 
                      method = "REML", 
                      mods = ~ meth_iden * type_samp, 
                      test = "knha")
m.qual.rep.int
## 
## Mixed-Effects Model (k = 127; tau^2 estimator: REML)
## 
## tau^2 (estimated amount of residual heterogeneity):     0 (SE = 0.1395)
## tau (square root of estimated tau^2 value):             0
## I^2 (residual heterogeneity / unaccounted variability): 0.00%
## H^2 (unaccounted variability / sampling variability):   1.00
## R^2 (amount of heterogeneity accounted for):            0.00%
## 
## Test for Residual Heterogeneity:
## QE(df = 123) = 1.2053, p-val = 1.0000
## 
## Test of Moderators (coefficients 2:4):
## F(df1 = 3, df2 = 123) = 0.0892, p-val = 0.9658
## 
## Model Results:
## 
##                      estimate      se     tval   df    pval    ci.lb   ci.ub    
## intrcpt                0.1096  0.0778   1.4085  123  0.1615  -0.0444  0.2637    
## meth_iden              0.0092  0.0730   0.1255  123  0.9003  -0.1354  0.1537    
## type_samp             -0.0059  0.0268  -0.2187  123  0.8273  -0.0589  0.0472    
## meth_iden:type_samp    0.0018  0.0225   0.0812  123  0.9354  -0.0428  0.0464    
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
### Permutation test

permutest(m.qual)
## Running 1000 iterations for an approximate permutation test.
## 
## Test of Moderators (coefficient 2):¹
## F(df1 = 1, df2 = 125) = 0.0867, p-val = 0.8100
## 
## Model Results:
## 
##          estimate      se     tval   df    pval¹    ci.lb   ci.ub    
## intrcpt    0.1386  0.0456   3.0384  125  0.3380    0.0483  0.2290    
## comorb    -0.0073  0.0247  -0.2945  125  0.8100   -0.0562  0.0416    
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 1) p-values based on permutation testing
permutest(m.qual.rep)
## Running 1000 iterations for an approximate permutation test.
## 
## Test of Moderators (coefficients 2:8):¹
## F(df1 = 7, df2 = 119) = 3.0190, p-val = 0.0700
## 
## Model Results:
## 
##            estimate      se     tval   df    pval¹     ci.lb    ci.ub    
## intrcpt    -12.4049  3.7083  -3.3452  119  0.0130   -19.7477  -5.0621  * 
## year_pub     0.0061  0.0018   3.3313  119  0.0120     0.0025   0.0098  * 
## stage       -0.0345  0.0195  -1.7693  119  0.1660    -0.0731   0.0041    
## comorb      -0.0026  0.0246  -0.1064  119  0.9270    -0.0514   0.0461    
## type_prev    0.0407  0.0171   2.3795  119  0.0640     0.0068   0.0746  . 
## meth_iden    0.0380  0.0220   1.7259  119  0.1520    -0.0056   0.0815    
## type_samp    0.0027  0.0092   0.2904  119  0.8000    -0.0155   0.0208    
## quality      0.0449  0.0220   2.0462  119  0.1000     0.0015   0.0884  . 
## 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 1) p-values based on permutation testing
## Multiple model inference

if (!require("devtools")) {
  install.packages("devtools")
}
devtools::install_github("MathiasHarrer/dmetar")

#install.packages("metafor")
#install.packages("ggplot2")
#install.packages("MuMIn")
library(metafor)
library(ggplot2)
library(MuMIn)
library(dmetar)

multimodel.inference(TE = "prev", 
                     seTE = "age",
                     data = data_neumo1,
                     predictors = c("year_pub", "stage", "comorb","type_prev", "meth_iden", 
                     "type_samp","quality"),
                     interaction = FALSE)
## 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |=                                                                     |   1%
  |                                                                            
  |=                                                                     |   2%
  |                                                                            
  |==                                                                    |   2%
  |                                                                            
  |==                                                                    |   3%
  |                                                                            
  |===                                                                   |   4%
  |                                                                            
  |===                                                                   |   5%
  |                                                                            
  |====                                                                  |   5%
  |                                                                            
  |====                                                                  |   6%
  |                                                                            
  |=====                                                                 |   7%
  |                                                                            
  |=====                                                                 |   8%
  |                                                                            
  |======                                                                |   9%
  |                                                                            
  |=======                                                               |   9%
  |                                                                            
  |=======                                                               |  10%
  |                                                                            
  |========                                                              |  11%
  |                                                                            
  |========                                                              |  12%
  |                                                                            
  |=========                                                             |  12%
  |                                                                            
  |=========                                                             |  13%
  |                                                                            
  |==========                                                            |  14%
  |                                                                            
  |==========                                                            |  15%
  |                                                                            
  |===========                                                           |  16%
  |                                                                            
  |============                                                          |  17%
  |                                                                            
  |=============                                                         |  18%
  |                                                                            
  |=============                                                         |  19%
  |                                                                            
  |==============                                                        |  20%
  |                                                                            
  |===============                                                       |  21%
  |                                                                            
  |===============                                                       |  22%
  |                                                                            
  |================                                                      |  23%
  |                                                                            
  |=================                                                     |  24%
  |                                                                            
  |==================                                                    |  25%
  |                                                                            
  |==================                                                    |  26%
  |                                                                            
  |===================                                                   |  27%
  |                                                                            
  |====================                                                  |  28%
  |                                                                            
  |====================                                                  |  29%
  |                                                                            
  |=====================                                                 |  30%
  |                                                                            
  |======================                                                |  31%
  |                                                                            
  |======================                                                |  32%
  |                                                                            
  |=======================                                               |  33%
  |                                                                            
  |========================                                              |  34%
  |                                                                            
  |=========================                                             |  35%
  |                                                                            
  |=========================                                             |  36%
  |                                                                            
  |==========================                                            |  37%
  |                                                                            
  |==========================                                            |  38%
  |                                                                            
  |===========================                                           |  38%
  |                                                                            
  |===========================                                           |  39%
  |                                                                            
  |============================                                          |  40%
  |                                                                            
  |============================                                          |  41%
  |                                                                            
  |=============================                                         |  41%
  |                                                                            
  |==============================                                        |  42%
  |                                                                            
  |==============================                                        |  43%
  |                                                                            
  |===============================                                       |  44%
  |                                                                            
  |===============================                                       |  45%
  |                                                                            
  |================================                                      |  45%
  |                                                                            
  |================================                                      |  46%
  |                                                                            
  |=================================                                     |  47%
  |                                                                            
  |=================================                                     |  48%
  |                                                                            
  |==================================                                    |  48%
  |                                                                            
  |==================================                                    |  49%
  |                                                                            
  |===================================                                   |  50%
  |                                                                            
  |====================================                                  |  51%
  |                                                                            
  |====================================                                  |  52%
  |                                                                            
  |=====================================                                 |  52%
  |                                                                            
  |=====================================                                 |  53%
  |                                                                            
  |======================================                                |  54%
  |                                                                            
  |======================================                                |  55%
  |                                                                            
  |=======================================                               |  55%
  |                                                                            
  |=======================================                               |  56%
  |                                                                            
  |========================================                              |  57%
  |                                                                            
  |========================================                              |  58%
  |                                                                            
  |=========================================                             |  59%
  |                                                                            
  |==========================================                            |  59%
  |                                                                            
  |==========================================                            |  60%
  |                                                                            
  |===========================================                           |  61%
  |                                                                            
  |===========================================                           |  62%
  |                                                                            
  |============================================                          |  62%
  |                                                                            
  |============================================                          |  63%
  |                                                                            
  |=============================================                         |  64%
  |                                                                            
  |=============================================                         |  65%
  |                                                                            
  |==============================================                        |  66%
  |                                                                            
  |===============================================                       |  67%
  |                                                                            
  |================================================                      |  68%
  |                                                                            
  |================================================                      |  69%
  |                                                                            
  |=================================================                     |  70%
  |                                                                            
  |==================================================                    |  71%
  |                                                                            
  |==================================================                    |  72%
  |                                                                            
  |===================================================                   |  73%
  |                                                                            
  |====================================================                  |  74%
  |                                                                            
  |====================================================                  |  75%
  |                                                                            
  |=====================================================                 |  76%
  |                                                                            
  |======================================================                |  77%
  |                                                                            
  |=======================================================               |  78%
  |                                                                            
  |=======================================================               |  79%
  |                                                                            
  |========================================================              |  80%
  |                                                                            
  |=========================================================             |  81%
  |                                                                            
  |=========================================================             |  82%
  |                                                                            
  |==========================================================            |  83%
  |                                                                            
  |===========================================================           |  84%
  |                                                                            
  |============================================================          |  85%
  |                                                                            
  |============================================================          |  86%
  |                                                                            
  |=============================================================         |  87%
  |                                                                            
  |=============================================================         |  88%
  |                                                                            
  |==============================================================        |  88%
  |                                                                            
  |==============================================================        |  89%
  |                                                                            
  |===============================================================       |  90%
  |                                                                            
  |===============================================================       |  91%
  |                                                                            
  |================================================================      |  91%
  |                                                                            
  |=================================================================     |  92%
  |                                                                            
  |=================================================================     |  93%
  |                                                                            
  |==================================================================    |  94%
  |                                                                            
  |==================================================================    |  95%
  |                                                                            
  |===================================================================   |  95%
  |                                                                            
  |===================================================================   |  96%
  |                                                                            
  |====================================================================  |  97%
  |                                                                            
  |====================================================================  |  98%
  |                                                                            
  |===================================================================== |  98%
  |                                                                            
  |===================================================================== |  99%
## 
## 
## Multimodel Inference: Final Results
## --------------------------
## 
##  - Number of fitted models: 128
##  - Full formula: ~ year_pub + stage + comorb + type_prev + meth_iden + type_samp + quality
##  - Coefficient significance test: knha
##  - Interactions modeled: no
##  - Evaluation criterion: AICc 
## 
## 
## Best 5 Models
## --------------------------
## 
## 
## Global model call: metafor::rma(yi = TE, sei = seTE, mods = form, data = glm.data, 
##     method = method, test = test)
## ---
## Model selection table 
##     (Int)       cmr mth_idn     qlt typ_prv  typ_smp  yer_pub df   logLik  AICc
## 56      + -0.010880 0.01446 0.03836 0.03590 0.009527           7 -175.325 365.6
## 55      +           0.01502 0.04026 0.03497 0.008681           6 -176.461 365.6
## 40      + -0.004548 0.01697 0.03608         0.007582           6 -176.464 365.6
## 119     +           0.03178 0.04155 0.03952 0.002746 0.004910  7 -175.369 365.7
## 104     + -0.002050 0.03282 0.03732         0.001740 0.004537  7 -175.378 365.7
##     delta weight
## 56   0.00  0.205
## 55   0.03  0.202
## 40   0.04  0.202
## 119  0.09  0.196
## 104  0.11  0.195
## Models ranked by AICc(x) 
## 
## 
## Multimodel Inference Coefficients
## --------------------------
## 
## 
##               Estimate  Std. Error   z value  Pr(>|z|)
## intrcpt   -4.940273378 5.704076350 0.8660952 0.3864379
## comorb    -0.003835789 0.018520967 0.2071052 0.8359277
## meth_iden  0.014046477 0.021543958 0.6519915 0.5144067
## quality    0.021115887 0.025468889 0.8290855 0.4070560
## type_prev  0.018496291 0.022107752 0.8366428 0.4027934
## type_samp  0.004414151 0.008140967 0.5422146 0.5876707
## year_pub   0.002468829 0.002834876 0.8708773 0.3838211
## stage     -0.009085084 0.018109939 0.5016629 0.6159047
## 
## 
## Predictor Importance
## --------------------------
## 
## 
##       model importance
## 1 meth_iden  0.5801311
## 2   quality  0.5359219
## 3 type_samp  0.5344075
## 4 type_prev  0.5094191
## 5    comorb  0.5065850
## 6  year_pub  0.4909211
## 7     stage  0.4867771

VI. Analysis of publication bias

rm(list=ls(all=TRUE)) #Deletes all memory content

library(readxl)
data_neumo1 <- read_excel("C:/Users/USER/Desktop/RSMA/data_neumo1.xlsx")
View(data_neumo1)

# Call of the packages

#install.packages("metafor")
#install.packages("meta")
library(metafor)
library(meta)
library(ggplot2)
library(MuMIn)
library(dmetar)

# Effect size with transformation logit 

ies.logit=escalc(xi=posit, ni=sample, data=data_neumo1, measure="PLO")
pes.logit=rma(yi, vi, data=ies.logit)
pes=predict(pes.logit, transf=transf.ilogit)
print(pes) 
## 
##    pred  ci.lb  ci.ub  pi.lb  pi.ub 
##  0.0892 0.0756 0.1049 0.0138 0.4065
# Publication bias analysis

# funnel.meta(pes.logit) # revisar código

funnel(pes.logit, yaxis="sei")

# rank (pes.logit) #revisar el codigo

regtest(pes.logit, model="rma", predictor="sei") ## Bias estimator - Egger test.
## 
## Regression Test for Funnel Plot Asymmetry
## 
## Model:     mixed-effects meta-regression model
## Predictor: standard error
## 
## Test for Funnel Plot Asymmetry: z = -8.6257, p < .0001
## Limit Estimate (as sei -> 0):   b = -1.5369 (CI: -1.7639, -1.3100)

R session information

In the reproducible research framework, an important step is to save all the versions of the packages used to perform analysis. They must be provided when submitting a paper.

sessionInfo()

R version 4.2.2 (2022-10-31 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale: [1] LC_COLLATE=English_United Kingdom.utf8 [2] LC_CTYPE=English_United Kingdom.utf8
[3] LC_MONETARY=English_United Kingdom.utf8 [4] LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.utf8

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] dmetar_0.0.9000 MuMIn_1.47.1
[3] devtools_2.4.5 usethis_2.1.6
[5] PerformanceAnalytics_2.0.4 xts_0.12.2
[7] zoo_1.8-11 forcats_0.5.2
[9] stringr_1.4.1 dplyr_1.0.10
[11] purrr_0.3.5 readr_2.1.3
[13] tidyr_1.2.1 tibble_3.1.8
[15] ggplot2_3.4.0 tidyverse_1.3.2
[17] meta_6.0-0 metafor_3.8-1
[19] metadat_1.2-0 Matrix_1.5-1
[21] readxl_1.4.1

loaded via a namespace (and not attached): [1] googledrive_2.0.0 minqa_1.2.5 colorspace_2.0-3
[4] class_7.3-20 modeltools_0.2-23 ellipsis_0.3.2
[7] mclust_6.0.0 fs_1.5.2 rstudioapi_0.14
[10] farver_2.1.1 remotes_2.4.2 flexmix_2.3-18
[13] ggrepel_0.9.2 fansi_1.0.3 lubridate_1.9.0
[16] mathjaxr_1.6-0 xml2_1.3.3 splines_4.2.2
[19] robustbase_0.95-0 cachem_1.0.6 knitr_1.41
[22] pkgload_1.3.2 jsonlite_1.8.3 nloptr_2.0.3
[25] broom_1.0.1 kernlab_0.9-31 cluster_2.1.4
[28] dbplyr_2.2.1 shiny_1.7.3 compiler_4.2.2
[31] httr_1.4.4 backports_1.4.1 assertthat_0.2.1
[34] fastmap_1.1.0 gargle_1.2.1 cli_3.4.1
[37] later_1.3.0 htmltools_0.5.3 prettyunits_1.1.1
[40] tools_4.2.2 gtable_0.3.1 glue_1.6.2
[43] Rcpp_1.0.9 cellranger_1.1.0 jquerylib_0.1.4
[46] vctrs_0.5.1 nlme_3.1-160 fpc_2.2-9
[49] xfun_0.35 ps_1.7.2 lme4_1.1-31
[52] rvest_1.0.3 timechange_0.1.1 mime_0.12
[55] miniUI_0.1.1.1 CompQuadForm_1.4.3 lifecycle_1.0.3
[58] googlesheets4_1.0.1 DEoptimR_1.0-11 MASS_7.3-58.1
[61] scales_1.2.1 hms_1.1.2 promises_1.2.0.1
[64] parallel_4.2.2 curl_4.3.3 yaml_2.3.6
[67] gridExtra_2.3 memoise_2.0.1 pbapply_1.6-0
[70] sass_0.4.4 stringi_1.7.8 highr_0.9
[73] poibin_1.5 boot_1.3-28 pkgbuild_1.4.0
[76] prabclus_2.3-2 rlang_1.0.6 pkgconfig_2.0.3
[79] evaluate_0.18 lattice_0.20-45 labeling_0.4.2
[82] htmlwidgets_1.5.4 tidyselect_1.2.0 processx_3.8.0
[85] magrittr_2.0.3 R6_2.5.1 generics_0.1.3
[88] profvis_0.3.7 DBI_1.1.3 pillar_1.8.1
[91] haven_2.5.1 withr_2.5.0 nnet_7.3-18
[94] abind_1.4-5 modelr_0.1.10 crayon_1.5.2
[97] utf8_1.2.2 tzdb_0.3.0 rmarkdown_2.18
[100] urlchecker_1.0.1 grid_4.2.2 netmeta_2.6-0
[103] callr_3.7.3 diptest_0.76-0 reprex_2.0.2
[106] digest_0.6.30 xtable_1.8-4 httpuv_1.6.6
[109] stats4_4.2.2 munsell_0.5.0 bslib_0.4.1
[112] magic_1.6-1 sessioninfo_1.2.2 quadprog_1.5-8