{"id":23139134,"url":"https://github.com/horberlan/forest-plot","last_synced_at":"2025-04-04T10:11:53.180Z","repository":{"id":152496093,"uuid":"333878186","full_name":"horberlan/forest-plot","owner":"horberlan","description":"Forest Plot - Meta analysis with the meta package in R :bar_chart:","archived":false,"fork":false,"pushed_at":"2021-02-22T20:35:09.000Z","size":261,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-09T20:34:02.988Z","etag":null,"topics":["forest","meta-analysis","metadata","rstudio","subgroups"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/horberlan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-01-28T19:23:03.000Z","updated_at":"2024-05-15T21:02:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"cfb68c60-0036-46f3-9bcc-d6579a2013a9","html_url":"https://github.com/horberlan/forest-plot","commit_stats":{"total_commits":66,"total_committers":1,"mean_commits":66.0,"dds":0.0,"last_synced_commit":"2d07d24a49b0a7ad2f98abf72ee2574456e55872"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horberlan%2Fforest-plot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horberlan%2Fforest-plot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horberlan%2Fforest-plot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horberlan%2Fforest-plot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/horberlan","download_url":"https://codeload.github.com/horberlan/forest-plot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247157283,"owners_count":20893220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["forest","meta-analysis","metadata","rstudio","subgroups"],"created_at":"2024-12-17T13:13:19.353Z","updated_at":"2025-04-04T10:11:53.151Z","avatar_url":"https://github.com/horberlan.png","language":"R","readme":"# Forest Plot — Meta-Analysis with Subgroups using R\n\n\n[![Meta Rstudio](https://img.shields.io/endpoint?url=https%3A%2F%2Frstudio.github.io%2Frstudio-shields%2Fcategory%2Fmeta.json)](https://community.rstudio.com/c/meta)\n\u003ch2 align=\"center\"\u003e Forest Plot - performing Meta-analysis in subgroups. Using the \u003ca href=\"https://cran.r-project.org/web/packages/meta/index.html\"\u003eMeta\u003c/a\u003e package in the R programming language.\u003c/h2\u003e\n\n# 1. Analysis \n\n## 1.2 Get and load data\n\n```R\n# https://www.rdocumentation.org/packages/grid/versions/3.6.2\n# https://cran.r-project.org/web/packages/readxl/index.html\n# https://cran.r-project.org/web/packages/meta/index.html\n\nlibrary(readxl)\nlibrary(grid)\nlibrary(meta)\n```\n\n\n## 1.2.1 Tables\n\n```R\n# Importe table \ndat \u003c- read_xlsx(\"LP.xlsx\")\ndat\n```\n\n\n```R\n# A tibble: 16 x 8\n#   study    Measure    nd meand   sdd     n  mean    sd\n#   \u003cchr\u003e    \u003cchr\u003e   \u003cdbl\u003e \u003cdbl\u003e \u003cdbl\u003e \u003cdbl\u003e \u003cdbl\u003e \u003cdbl\u003e\n# 1 Study 1  CT          6 129.4  5.14     6 145.  11.2 \n# 2 Study 2  CT          6  98.4  3.28     6 135.   1.96\n# 3 Study 3  CT         10  54.3  2.8     10  56.1  2.6 \n# 4 Study 4  CT          6  90.5  1.87     6 130.   3.02\n# 5 Study 5  CT          8  72.7  7.4      8 103    5.5 \n# 6 Study 6  CT          6  90.3  2.72     6 107.   3.09\n# 7 Study 7  CT          6  92.3  2.71     6 106.   3.05\n# 8 Study 8  TG          6 128.   6.93     6 269.  13.6 \n# 9 Study 9  TG          6 110.   2.48     6  25.7  1.16\n#10 Study 10 TG         10  60.6  7.5     10  85.5 13.3 \n#11 Study 11 TG          6  93.3  1.51     6 153    3.35\n#12 Study 12 TG          6  88.5  3.23     6 105.   2.8 \n#13 Study 13 TG          6  88.5  3.23     6  75.4  3.15\n#14 Study 14 HDL         6  34.6  2.39     6  22.7  2.58\n#15 Study 15 HDL         6  42.5  2.98     6  25.7  1.16\n#16 Study 16 HDL         6  31.4  0.82     6  25.2  0.98\n```\n```R\ndat.frame_2 \u003c- data.frame(dat)\n```\n\u003ccenter\u003e\n\n| study    | Measure | nd | meand  | sdd  | n  | mean   | sd    | \n|:--------:|:-------:|:--:|:------:|:----:|:--:|:------:|:-----:|\n| Study 1  | CT      | 6  | 129,46 | 5,14 | 6  | 144,79 | 11,25 |\n| Study 2  | CT      | 6  | 98,42  | 3,28 | 6  | 134,83 | 1,96  |\n| Study 3  | CT      | 10 | 54,3   | 2,8  | 10 | 56,1   | 2,6   |\n| Study 4  | CT      | 6  | 90,5   | 1,87 | 6  | 130,5  | 3,02  |\n| Study 5  | CT      | 8  | 72,7   | 7,4  | 8  | 103    | 5,5   |\n| Study 6  | CT      | 6  | 90,3   | 2,72 | 6  | 106,8  | 3,09  |\n| Study 7  | CT      | 6  | 92,3   | 2,71 | 6  | 106,5  | 3,05  |\n| Study 8  | TG      | 6  | 127,82 | 6,93 | 6  | 269,3  | 13,59 |\n| Study 9  | TG      | 6  | 110,22 | 2,48 | 6  | 25,67  | 1,16  |\n| Study 10 | TG      | 10 | 60,6   | 7,5  | 10 | 85,5   | 13,3  |\n| Study 11 | TG      | 6  | 93,33  | 1,51 | 6  | 153    | 3,35  |\n| Study 12 | TG      | 6  | 88,5   | 3,23 | 6  | 105,1  | 2,8   |\n| Study 13 | TG      | 6  | 88,5   | 3,23 | 6  | 75,41  | 3,15  |\n| Study 14 | HDL     | 6  | 34,64  | 2,39 | 6  | 22,69  | 2,58  |\n| Study 15 | HDL     | 6  | 42,46  | 2,98 | 6  | 25,67  | 1,16  |\n| Study 16 | HDL     | 6  | 31,37  | 0,82 | 6  | 25,16  | 0,98  |\n\n\n\u003c/center\u003e\n\n\n\n```R\n\nmeta_2 \u003c- metacont(dat$n,\n                    dat$meand,\n                    dat$sdd,\n                    dat$nd,\n                    dat$mean,\n                    dat$sd,\n                    dat$study,\n                    data = dat.frame_2,\n                    byvar = Measure,\n                    comb.fixed = TRUE,\n                    sm=\"SMD\"\n                    )\n```\n```R\n\u003e meta_2                    \n              SMD               95%-CI %W(fixed) %W(random) Measure\nStudy 1   -1.6180 [ -2.9980;  -0.2380]      13.8        7.9      CT\nStudy 2  -12.4393 [-18.6163;  -6.2624]       0.7        4.9      CT\nStudy 3   -0.6381 [ -1.5419;   0.2658]      32.2        8.1      CT\nStudy 4  -14.7004 [-21.9653;  -7.4355]       0.5        4.2      CT\nStudy 5   -4.3940 [ -6.4029;  -2.3852]       6.5        7.7      CT\nStudy 6   -5.2324 [ -8.0260;  -2.4387]       3.4        7.2      CT\nStudy 7   -4.5434 [ -7.0333;  -2.0535]       4.2        7.4      CT\nStudy 8  -12.1070 [-18.1246;  -6.0895]       0.7        5.0      TG\nStudy 9   40.3136 [ 20.6015;  60.0258]       0.1        1.0      TG\nStudy 10  -2.2088 [ -3.3715;  -1.0461]      19.5        8.0      TG\nStudy 11 -21.1983 [-31.6082; -10.7884]       0.2        2.8      TG\nStudy 12  -5.0694 [ -7.7906;  -2.3483]       3.6        7.3      TG\nStudy 13   3.7875 [  1.6198;   5.9552]       5.6        7.6      TG\nStudy 14   4.4357 [  1.9925;   6.8789]       4.4        7.4     HDL\nStudy 15   6.8541 [  3.3220;  10.3862]       2.1        6.7     HDL\nStudy 16   6.3442 [  3.0469;   9.6415]       2.4        6.9     HDL\n\nNumber of studies combined: k = 16\n\n                         SMD             95%-CI     z  p-value\nFixed effect model   -1.2611 [-1.7742; -0.7480] -4.82 \u003c 0.0001\nRandom effects model -2.2628 [-4.3930; -0.1327] -2.08   0.0373\n\nQuantifying heterogeneity:\n tau^2 = 14.3627 [20.6661; 124.3353]; tau = 3.7898 [4.5460; 11.1506]\n I^2 = 92.0% [88.6%; 94.4%]; H = 3.54 [2.96; 4.22]\n\nTest of heterogeneity:\n      Q d.f.  p-value\n 187.76   15 \u003c 0.0001\n\n\n Results for subgroups (fixed effect model):\n       k     SMD             95%-CI     Q   I^2\n CT    7 -2.0276 [-2.6825; -1.3727] 46.33 87.0%\n TG    6 -1.7203 [-2.6622; -0.7783] 73.66 93.2%\n HDL   3  5.5232 [ 3.8074;  7.2391]  1.54  0.0%\n\n\n Results for subgroups (random effects model):\n       k     SMD             95%-CI   tau^2    tau\n CT    7 -4.6427 [-6.9204; -2.3651]  6.8810 2.6232\n TG    6 -3.2292 [-8.3922;  1.9338] 30.5857 5.5304\n HDL   3  5.5232 [ 3.8074;  7.2391]       0      0\n\n\n```\n\n\n# 2. PLots\nPlot forest and read the comments in the code about the functions used.\n\n```R\n#RE.res \u003c- rma(n,meand,sdd,mean,sd, data=dat.frame_2, slab=paste(Measure))\n#RE.res\npng(file = 'LP - Forestplot.png', # Save plot as PNG\n    width=780,\n    height=620)\n\nforest(meta_2,\n      order=order(dat$study), # Where you should initially order the data. \n      leftlabs = c(\"Lipid Profile \n      Author\", \"Total\",\"Mean\",\"SD\",\"Total\",\"Mean\",\"SD\"),\n      comb.random=FALSE, # Do not plot the random effect. \n      xlim = c(-70,70), \n      xlab=\"Standarized Mean Difference (95% CI)\",\n      mlab=\"RE Model for All Studies\",\n      subgroup = TRUE,\n      print.byvar = FALSE, # Don't print meta_2$$Measure.\n      )\ndev.off()\n```\n\u003cp align=\"center\"\u003e\n\u003cimg align=\"center\" src=\"https://raw.githubusercontent.com/horberlan/forest-plot/main/LP%20-%20Forestplot.png\"\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\n# 3. References\n\n  \n1.  R Core Team. (2017). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. Retrieved from https://www.R-project.org/\n\n2.  Veroniki AA, Jackson D, Viechtbauer W, Bender R, Bowden J, Knapp G, et al. (2016): Methods to estimate the between-study variance and its uncertainty in meta-analysis. Research Synthesis Methods, 7, 55–79 \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhorberlan%2Fforest-plot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhorberlan%2Fforest-plot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhorberlan%2Fforest-plot/lists"}