Coder Social home page Coder Social logo

mathiasharrer / doing-meta-analysis-in-r Goto Github PK

View Code? Open in Web Editor NEW
317.0 317.0 177.0 347.91 MB

[Read-Only] All R code and source files for the online guide "Doing Meta-Analysis with R: A Hands-On Guide"

Home Page: https://www.protectlab.org/meta-analysis-in-r

License: Creative Commons Zero v1.0 Universal

Shell 0.13% TeX 25.74% CSS 0.80% R 71.32% HTML 2.02%
bookdown meta-analysis network-meta-analysis rstudio systematic-review

doing-meta-analysis-in-r's People

Contributors

mathiasharrer avatar mcguinlu avatar pitmonticone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

doing-meta-analysis-in-r's Issues

Typo in 12.1

The very last analysis in 12.1, where the model without level 3 is being compared to the full three-level model using anova(), reads anova(full.model, model.l2.removed) when it should read anova(full.model, model.l3.removed). As written, the code is just repeating the previous anova. [thanks for the great book!]

Build errors

I tried to build in bs4_book format with R 4.2 and encountered two errors:

08-forestplots.Rmd

Quitting from lines 6061-6067 (Doing_Meta_Analysis_in_R.Rmd)
Error in forest.meta(m.gen, sortvar = TE, predict = TRUE, print.tau2 = FALSE, :
argument 3 matches multiple formal arguments
Calls: ... withVisible -> eval_with_user_handlers -> eval -> eval -> forest
In addition: Warning messages:
1: In pack_rows(., "Core Database", 1, 6, latex_align = "c", latex_gap_space = "2em", :
latex_align parameter is not used in HTML Mode,
use label_row_css instead.
2: In pack_rows(., "Citation Database", 7, 9, latex_align = "c", latex_gap_space = "2em", :
latex_align parameter is not used in HTML Mode,
use label_row_css instead.
3: In pack_rows(., "Dissertations", 10, 10, latex_align = "c", latex_gap_space = "2em", :
latex_align parameter is not used in HTML Mode,
use label_row_css instead.
4: In pack_rows(., "Study Registries", 11, 12, latex_align = "c", latex_gap_space = "2em", :
latex_align parameter is not used in HTML Mode,
use label_row_css instead.
5: Use argument 'fixed' instead of 'comb.fixed' (deprecated).
6: Use argument 'random' instead of 'comb.random' (deprecated).
Execution halted

Exited with status 1.

The error message says fores.meta in 08-forestplots.Rmd. However, I was able to fix the following forest function in lines97-101 by replacing predict argument with prediction.

The other error is:

Quitting from lines 11734-11735 (Doing_Meta_Analysis_in_R.Rmd)
Error in namespaceLocalSearch(model, name) :
no slot of name "penalties" for this object of class "MxModel"
Calls: ... imxExtractMethod -> namespaceSearch -> namespaceLocalSearch
In addition: There were 13 warnings (use warnings() to see them)
Execution halted

I have no solution to this error.

Round up values for METABIN

Hi, I realized the metabin function does not round up values like risk ratio 0.905 to 0.91 in the forest plot. The risk ratio value remains 0.90 in the forest plot figure. Any possible solution to this.

Error plotting CFA example with semPaths()

Hi, I've been following the examples in chapter 14.3 Confirmatory Factor Analysis_.
I run into an error while attempting to use the semPaths() function, all other outputs seem ok (note: The function works fine when I try to replicate the example from the mediation chapter 14.4.4).

Console reads:

semPaths(cfa.plot,

  •      whatLabels = "est", 
    
  •      edge.color = "black", 
    
  •      nodeLabels = labels,
    
  •      )
    

Error in if (Layout[x[1], 2] != Layout[x[2], 2]) return(0) else return(sum(Layout[Layout[, :
missing value where TRUE/FALSE needed

My semPlotModel object looks like this:

meta2semPlot(cfa2)
An object of class "semPlotModel"
Slot "Pars":
label lhs edge rhs est std group fixed par
36 Ins_Q f_Insomnia -> Quality 0.5694354 0.5694354 Group 1 FALSE 0
37 Ins_L f_Insomnia -> Latency 0.5906298 0.5906298 Group 1 FALSE 0
38 Ins_E f_Insomnia -> Efficiency 0.7604548 0.7604548 Group 1 FALSE 0
46 Las_D f_Lassitude -> DTDysf 0.6799554 0.6799554 Group 1 FALSE 0
47 Las_H f_Lassitude -> HypSomnia 0.6418422 0.6418422 Group 1 FALSE 0
50 Quality <-> Quality 0.6757433 0.6757433 Group 1 FALSE 0
58 Latency <-> Latency 0.6511564 0.6511564 Group 1 FALSE 0
66 Efficiency <-> Efficiency 0.4217085 0.4217085 Group 1 FALSE 0
74 DTDysf <-> DTDysf 0.5376606 0.5376606 Group 1 FALSE 0
82 HypSomnia <-> HypSomnia 0.5880386 0.5880386 Group 1 FALSE 0
90 f_Insomnia <-> f_Insomnia 1.0000000 1.0000000 Group 1 FALSE 0
91 f_Insomnia <-> f_Lassitude 0.3776908 0.3776908 Group 1 FALSE 0
98 f_Lassitude <-> f_Lassitude 1.0000000 1.0000000 Group 1 FALSE 0

Slot "Vars":
name manifest exogenous
1 A TRUE NA
2 C TRUE NA
3 ES TRUE NA
4 E TRUE NA
5 I TRUE NA
6 f_Insomnia FALSE NA
7 f_Lassitude FALSE NA

Slot "Thresholds":
data frame with 0 columns and 0 rows

Slot "Computed":
[1] TRUE

Slot "ObsCovs":
[[1]]
A C ES E I
A 1.00000000 0.3897191 0.4326588 0.04945629 0.09603706
C 0.38971906 1.0000000 0.4272424 0.11929317 0.19292425
ES 0.43265882 0.4272424 1.0000000 0.22690163 0.18105566
E 0.04945629 0.1192932 0.2269016 1.00000000 0.43614968
I 0.09603706 0.1929243 0.1810557 0.43614968 1.00000000

Slot "ImpCovs":
[[1]]
A C ES E I
A 1.0000000 0.3363255 0.4330299 0.1462384 0.1380413
C 0.3363255 1.0000000 0.4491473 0.1516814 0.1431793
ES 0.4330299 0.4491473 1.0000000 0.1952946 0.1843479
E 0.1462384 0.1516814 0.1952946 1.0000000 0.4364241
I 0.1380413 0.1431793 0.1843479 0.4364241 1.0000000

Slot "Original":
list()

These are my current soft & packages versions:

sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

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

other attached packages:
[1] metaSEM_1.2.5 OpenMx_2.18.1 semPlot_1.1.2

My full script:
metaCFA.txt

mtc.model error meesage

While trying to run this part of the code:

model <- mtc.model(network, 
                   linearModel = "random",
                   n.chain = 4)

The output shown is
Error in mtc.model(network, linearModel = "random", n.chain = 4, likelihood = NULL, : No appropriate likelihood could be inferred. Please specify one.

If I specify normal and identity for the likelihood and link the error changes to

Error in validate.data.normal.identity(list(study = c(1L, 1L, 2L, 2L, : all(data.ab[["std.err"]] > 0) is not TRUE

On a related note, the Willms1999 study has three entries and the placebo arm has an std.err value of 0.4002. Isn't this supposed to be NA?

P.S The data was loaded from the file load("senn2013_reshape.rda")

cannot open Doing_Meta_Analysis_in_R.pdf

Hi. I downloaded the pdf file, but unfortunately, I cannot read it as I get an error saying that the document page tree has an issue. can you please let me know how to solve this? cheers

Error in sink(type = "output") : invalid connection - for Bayesian Meta-Analysis Model (12-bayesian-meta-analysis.Rmd line 132)

For Bayesian Meta-Analysis Model, 12-bayesian-meta-analysis.Rmd, for the chunk on line 132, when I run it in Rstudio on my Mac (R version 3.6.2),

  • it twice prompts me to install developer tools. I say no because I've Xcode loaded
  • then it throws a complicated double-error (below)

Perhaps one needs to have Rstan installed for this to work?

Compiling the C++ model
running command '/Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB file109b0711a3d53.cpp 2> file109b0711a3d53.cpp.err.txt' had status 1Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' [-Wmissing-sysroot]
In file included from <built-in>:1:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Library/Frameworks/R.framework/Versions/3.6/Resources/library/RcppEigen/include/Eigen/Core:82:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:85:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/exception:82:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cs

Error in sink(type = "output") : invalid connection

Btw I love this guide, thanks!

Typos

07-heterogeneity:
LINE 260: "form meta-analysis to meta-analysis" should be FROM.

14-netwma:
LINE 1793: The latex code lacks backslash.

How to assess and correct for publication bias in three-level meta-analysis?

Dear Mathias
I was recently reading your book on meta-analysis"Doing Meta-Analysis in R: A Hands-on Guide",I used the method of three-level meta-analysis inside to complete my graduation design. One problem I encountered was that the results of the three-level meta-analysis were calculated using rma.mv in metafor, while the functions like eggers.test , trimfill in Chapter 9 Publication Bias cannot be applied to the results of rma.mv. I wonder how to correct the results of the three-level meta-analysis for publication bias. That's very important to me and hope you can help me, thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.