guido-s / netmeta

Official Git repository of R package netmeta
http://cran.r-project.org/web/packages/netmeta/index.html
GNU General Public License v2.0
28 stars 12 forks source link

Netmeta problem with netgraph #14

Closed AlvaroPT2023 closed 1 year ago

AlvaroPT2023 commented 1 year ago

Note: for support questions on R package netmeta, please use the R-sig-meta-analysis mailing list. This repository's issues are reserved for feature requests and bug reports.

Classification of issue

Please indicate whether you want to submit a

Summary

Hello Guido,

I have watched your video tutorial about netmeta and I have a problem. When I run your example with your database I can reproduce your results and your graphics. However, I have problems obtaining the netgraph when I try to use your code for my network meta-analysis. I need to edit the netgraph to represent the size of each node based on the number of treatments (or sample size) or the number of studies for each intervention. I have used the cex.points and labels function, as you did, to do it, but R gives the next error when I write n.trts: "Error in round(n.trts) : non-numeric argument to mathematical function". Where did you specify the "n.trts" code? What is the problem that can be generating this error?

Thank you very much,

Álvaro.

Additional information

I am trying to obtain a network meta-analysis for standard mean difference. Could this be the cause of the problem?

# R code to reproduce the bug

netgraph(net1, seq = "optimal", number.of.studies = TRUE,
         plastic = FALSE, cex.points = n.trts,
         labels = paste0(trts, "\n(n=", round(n.trts), ")"))

# Any relevant output from R

Error in round(n.trts) : non-numeric argument to mathematical function

or an informative screenshot.

### Environment

For bug reports, please mention your

  - operating system: Windows
  - R version: 4.2.2
  - Version of R package: netmeta from GitHub repository: https://github.com/guido-s/netmeta

Alternatively, you could run the following command and in the auto-generated e-mail mention that you opened a bug report on GitHub.

```r
bug.report(package = "netmeta") # not supported in RStudio
AlvaroPT2023 commented 1 year ago

I have found the object n.trts in my NMA object. Now, when I try to execute it I received the next error: "Length of argument 'cex.points' must be equal to the number of treatments". Could it be a problem with incoherence between the number of treatments due to a multiple-arm study?

There is no problem when I use the k.trts object, so I can edit the size of the nodes based on the number of studies.

guido-s commented 1 year ago

Dear Alvaro, I do not have any problems running the following commands:

remotes::install_github("guido-s/netmeta", ref = "develop") # Install development version of netmeta
library("netmeta")
example(netmeta)
netgraph(net1, seq = "optimal", number.of.studies = TRUE,
  plastic = FALSE, cex.points = n.trts,
  labels = paste0(trts, "\n(n=", round(n.trts), ")"),
  offset = c(0.05, 0.025, 0.05, 0.015))

Do you get any errors after running these commands?

Guido

AlvaroPT2023 commented 1 year ago

Dear Guido,

Thank you for your response. When I run this command for my data I obtain the next error: Error in round(n.trts) : non-numeric argument to mathematical function. If I erase the "labels = paste0(trts, "\n(n=", round(n.trts), ")")" argument and then I run the netgraph, there is still another error: Length of argument 'cex.points' must be equal to the number of treatments.

I tried with another variable and I have obtained the same error. There is no error if I replace the "n.trts" object with "k.trts" and the function elaborates a netgraph with the size of the nodes according to the number of studies. We want to do the netgraph based on the number of studies instead of treatments, so I am not worried after all.

However, I think that the problem could be the next: when I run "n.trts" object the response is "NULL". It is possible that, for some reason, the number of treatments is not registered in the netmeta function for my data, although I have included the number of patients in each group.

I don't know what other reasons could be. What do you think?

Thank you very much again.

Álvaro.

El vie, 21 abr 2023 a las 13:34, Guido Schwarzer @.***>) escribió:

Dear Alvaro, I do not have any problems running the following commands:

remotes::install_github("guido-s/netmeta", ref = "develop") # Install development version of netmeta library("netmeta") example(netmeta) netgraph(net1, seq = "optimal", number.of.studies = TRUE, plastic = FALSE, cex.points = n.trts, labels = paste0(trts, "\n(n=", round(n.trts), ")"), offset = c(0.05, 0.025, 0.05, 0.015))

Do you get any errors after running these commands?

Guido

— Reply to this email directly, view it on GitHub https://github.com/guido-s/netmeta/issues/14#issuecomment-1517689289, or unsubscribe https://github.com/notifications/unsubscribe-auth/A7JTQ7RPQBPOI3IQMAWWKQ3XCJWFRANCNFSM6AAAAAAXEI5MVM . You are receiving this because you authored the thread.Message ID: @.***>

guido-s commented 1 year ago

Could you please post the printout of the command packageDescription("netmeta") .

AlvaroPT2023 commented 1 year ago

I downloaded the package from your Github repository:

Package: netmeta Title: Network Meta-Analysis using Frequentist Methods Version: 2.8-1 Date: 2023-03-16 Depends: R (>= 4.0.0), meta (>= 6.2-0) Imports: magic, MASS, ggplot2 (>= 3.0.0), metafor Suggests: colorspace, rgl, hasseDiagram (>= 0.1.3), grid, mvtnorm, gridExtra, igraph (>= 1.0.1), tictoc, writexl @.: c(person("Gerta", "Rücker", role = "aut", comment = c(ORCID = "0000-0002-2192-2560")), person("Ulrike", "Krahn", role = "aut"), person("Jochem", "König", role = "aut", comment = c(ORCID = "0000-0003-4683-0360")), person("Orestis", "Efthimiou", role = "aut", comment = c(ORCID = "0000-0002-0955-7572")), person("Annabel", "Davies", role = "aut", comment = c(ORCID = "0000-0003-2320-7701")), person("Theodoros", "Papakonstantinou", role = "aut", comment = c(ORCID = "0000-0002-6630-6817")), person("Guido", "Schwarzer", role = c("aut", "cre"), email = " @.", comment = c(ORCID = "0000-0001-6214-9087"))) URL: https://github.com/guido-s/netmeta https://link.springer.com/book/10.1007/978-3-319-21416-0 Description: A comprehensive set of functions providing frequentist methods for network meta-analysis (Balduzzi et al., 2023) <doi:10.18637/jss.v106.i02> and supporting Schwarzer et al. (2015) <doi:10.1007/978-3-319-21416-0>, Chapter 8 "Network Meta-Analysis": - frequentist network meta-analysis following Rücker (2012) <doi:10.1002/jrsm.1058>; - additive network meta-analysis for combinations of treatments (Rücker et al., 2020) <doi:10.1002/bimj.201800167>; - network meta-analysis of binary data using the Mantel-Haenszel or non-central hypergeometric distribution method (Efthimiou et al., 2019) <doi:10.1002/sim.8158>; - rankograms and ranking of treatments by the Surface under the cumulative ranking curve (SUCRA) (Salanti et al., 2013) <doi:10.1016/j.jclinepi.2010.03.016>; - ranking of treatments using P-scores (frequentist analogue of SUCRAs without resampling) according to Rücker & Schwarzer (2015) <doi:10.1186/s12874-015-0060-8>; - split direct and indirect evidence to check consistency (Dias et al., 2010) <doi:10.1002/sim.3767>, (Efthimiou et al., 2019) <doi:10.1002/sim.8158>; - league table with network meta-analysis results; - 'comparison-adjusted' funnel plot (Chaimani & Salanti, 2012) <doi:10.1002/jrsm.57>; - net heat plot and design-based decomposition of Cochran's Q according to Krahn et al. (2013) <doi:10.1186/1471-2288-13-35>; - measures characterizing the flow of evidence between two treatments by König et al. (2013) <doi:10.1002/sim.6001>; - automated drawing of network graphs described in Rücker & Schwarzer (2016) <doi:10.1002/jrsm.1143>; - partial order of treatment rankings ('poset') and Hasse diagram for 'poset' (Carlsen & Bruggemann, 2014) <doi:10.1002/cem.2569>; (Rücker & Schwarzer, 2017) <doi:10.1002/jrsm.1270>; - contribution matrix as described in Papakonstantinou et al. (2018) <doi:10.12688/f1000research.14770.3> and Davies et al. (2022) <doi:10.1002/sim.9346>. License: GPL (>= 2) Encoding: UTF-8 RoxygenNote: 7.2.3 RemoteType: github RemoteHost: api.github.com RemoteRepo: netmeta RemoteUsername: guido-s RemoteRef: develop RemoteSha: 0a370875b416d927be056718b256d3fa8ee4b2de GithubRepo: netmeta GithubUsername: guido-s GithubRef: develop GithubSHA1: 0a370875b416d927be056718b256d3fa8ee4b2de NeedsCompilation: no Packaged: 2023-04-19 12:06:10 UTC; Usuario Author: Gerta Rücker [aut] (https://orcid.org/0000-0002-2192-2560), Ulrike Krahn [aut], Jochem König [aut] (https://orcid.org/0000-0003-4683-0360), Orestis Efthimiou [aut] (https://orcid.org/0000-0002-0955-7572), Annabel Davies [aut] (https://orcid.org/0000-0003-2320-7701), Theodoros Papakonstantinou [aut] (https://orcid.org/0000-0002-6630-6817), Guido Schwarzer [aut, cre] (https://orcid.org/0000-0001-6214-9087) Maintainer: Guido Schwarzer @.***> Built: R 4.2.2; ; 2023-04-19 12:06:12 UTC; windows

El lun, 24 abr 2023 a las 14:25, Guido Schwarzer @.***>) escribió:

Could you please post the printout of the command packageDescription("netmeta") .

— Reply to this email directly, view it on GitHub https://github.com/guido-s/netmeta/issues/14#issuecomment-1520061377, or unsubscribe https://github.com/notifications/unsubscribe-auth/A7JTQ7WJIRFTB2JELVIWQHLXCZWMTANCNFSM6AAAAAAXEI5MVM . You are receiving this because you authored the thread.Message ID: @.***>

guido-s commented 1 year ago

This is exact the version of netmeta I am using under R, versions 4.2.3 and 4.3.0 (without any problems).

The following example for an SMD also works for me:

data(Franchini2012)
p <- pairwise(list(Treatment1, Treatment2, Treatment3),
  n = list(n1, n2, n3),
  mean = list(y1, y2, y3), sd = list(sd1, sd2, sd3),
  data = Franchini2012, studlab = Study,
  sm = "SMD")
netgraph(netmeta(p),
  seq = "optimal", number.of.studies = TRUE,
  plastic = FALSE, cex.points = n.trts,
  labels = paste0(trts, "\n(n=", round(n.trts), ")"))

Thus, it must be a problem with your specific dataset. You could send me an email to evaluate this further.

Guido

AlvaroPT2023 commented 1 year ago

My dataset is in the attached document. We have used the "netmeta" package without any other problem for the elaboration of the analysis, the forest plots, and the rank-heat plot with the "viscomp" package.

Thank you very much.

Álvaro.

El mar, 25 abr 2023 a las 13:36, Guido Schwarzer @.***>) escribió:

This is exact the version of netmeta I am using under R, versions 4.2.3 and 4.3.0 (without any problems).

The following example for an SMD also works for me:

data(Franchini2012) p <- pairwise(list(Treatment1, Treatment2, Treatment3), n = list(n1, n2, n3), mean = list(y1, y2, y3), sd = list(sd1, sd2, sd3), data = Franchini2012, studlab = Study, sm = "SMD") netgraph(netmeta(p), seq = "optimal", number.of.studies = TRUE, plastic = FALSE, cex.points = n.trts, labels = paste0(trts, "\n(n=", round(n.trts), ")"))

Thus, it must be a problem with your specific dataset. You could send me an email to evaluate this further.

Guido

— Reply to this email directly, view it on GitHub https://github.com/guido-s/netmeta/issues/14#issuecomment-1521639313, or unsubscribe https://github.com/notifications/unsubscribe-auth/A7JTQ7X5IVWZMHVWWG3W363XC6ZMNANCNFSM6AAAAAAXEI5MVM . You are receiving this because you authored the thread.Message ID: @.***>

guido-s commented 1 year ago

I do not see any attachment on GitHub. Could you please send me the file via email: guido.schwarzer@uniklinik-freiburg.de