guido-s / meta

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

Error in runGLMM using the metaprop function #57

Closed bleclere closed 7 months ago

bleclere commented 8 months ago

Note: for support questions on R package meta, 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

Hi, I’m trying to run a meta-analysis on single proportions, but I encounter an error with the metaprop function.

Additional information

Code that produces the bug:

metaprop(4:1, 10 * 1:4) # metaprop documentation example

Output:

Error in runGLMM(list.prop, method.tau = method.tau, method.random.ci = method.random.ci,  : 
  Error in (function (ai, bi, ci, di, n1i, n2i, x1i, x2i, t1i, t2i, xi,  : 
  Cannot fit ML model (set 'verbose=TRUE' to obtain further details).

Environment

badgettrg commented 8 months ago

Having similar problem with metaprop on both current meta and last version. No missing data. This same data and function have run in the past for me. Windows R version 4.3.3, metafor 4.4:

meta1 <- metaprop(Outcome, Denom, studlab=Study, method="GLMM", data = data.temp)

Error in runGLMM(list.prop, method.tau = method.tau, method.random.ci = method.random.ci, : Error in (function (ai, bi, ci, di, n1i, n2i, x1i, x2i, t1i, t2i, xi, : Cannot fit ML model (set 'verbose=TRUE' to obtain further details).

Someone else with similar problem at https://stackoverflow.com/questions/78016615/trouble-fitting-glmm-model-in-r-error-in-runglmm-function

thanks

bleclere commented 8 months ago

Thank you for your comment @badgettrg. I have edited the the title for a more accurate description of the issue.

guido-s commented 7 months ago

I cannot reproduce the error in metaprop(4:1, 10 * 1:4). However, I could create the error with the following command: metaprop(rep(1, 5), rep(100, 5)), i.e., in a meta-analysis without any between-study heterogeneity.

I changed the behaviour of runGLMM() such that results of the common effect model are used as a fallback if the random effects model does not converge.

BTW, the following command can be used to get more information on the estimation process and the error: metaprop(rep(1, 5), rep(100, 5), control = list(verbose = TRUE))

badgettrg commented 7 months ago

Thanks! I do not know how you do all of this.

bob


From: Guido Schwarzer @.> Sent: Tuesday, April 2, 2024 9:38 AM To: guido-s/meta @.> Cc: Robert Badgett @.>; Mention @.> Subject: Re: [guido-s/meta] Error in runGLMM using the metaprop function (Issue #57)

I cannot reproduce the error in metaprop(4:1, 10 * 1:4). However, I could create the error with the following command: metaprop(rep(1, 5), rep(100, 5)), i.e., in a meta-analysis without any between-study heterogeneity.

I changed the behaviour of runGLMM() such that results of the common effect model are used as a fallback if the random effects model does not converge.

BTW, the following command can be used to get more information on the estimation process and the error: metaprop(rep(1, 5), rep(100, 5), control = list(verbose = TRUE))

— Reply to this email directly, view it on GitHubhttps://github.com/guido-s/meta/issues/57#issuecomment-2032222120, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABHXP442HWUMQ5FJOLPD2CTY3K7HVAVCNFSM6AAAAABE5YT5T6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZSGIZDEMJSGA. You are receiving this because you were mentioned.Message ID: @.***>

bleclere commented 7 months ago

Thanks a lot! It fixed the problem that occurred with my data.

For info, I still get a warning with metaprop(4:1, 10 * 1:4), and verbose = TRUE for runGLMM indicates :

Error in initializePtr() : 
  function 'chm_factor_ldetL2' not provided by package 'Matrix'

But it gives back a result.

Thanks again Brice

guido-s commented 7 months ago

Good to hear.

I do not get that error (see below). I am running R under macOS (current R version with up-to-date R packages).

Best, Guido

> meta::metaprop(4:1, 10 * 1:4, control = list(verbose = TRUE))
Iteration 0     tau^2 = 1.3207
Iteration 1     tau^2 = 0.7621
Iteration 2     tau^2 = 0.7226
Iteration 3     tau^2 = 0.7185
Iteration 4     tau^2 = 0.7180
Iteration 5     tau^2 = 0.7180
Iteration 6     tau^2 = 0.7180
Fisher scoring algorithm converged after 6 iterations.

Fitting FE model ...
Deviance = 11.51912 Iterations - 1
Deviance = 10.6096 Iterations - 2
Deviance = 10.59965 Iterations - 3
Deviance = 10.59965 Iterations - 4
Deviance = 10.59965 Iterations - 5
Fitting saturated model ...
Deviance = 0.004684332 Iterations - 1
Deviance = 3.567321e-06 Iterations - 2
Deviance = 2.879965e-12 Iterations - 3
Deviance = -4.440892e-15 Iterations - 4

Fitting FE model ...
Deviance = 11.51912 Iterations - 1
Deviance = 10.6096 Iterations - 2
Deviance = 10.59965 Iterations - 3
Deviance = 10.59965 Iterations - 4
Deviance = 10.59965 Iterations - 5
Fitting saturated model ...
Deviance = 0.004684332 Iterations - 1
Deviance = 3.567321e-06 Iterations - 2
Deviance = 2.879965e-12 Iterations - 3
Deviance = -4.440892e-15 Iterations - 4
Fitting ML model ...
start par. =  1 fn =  18.2879
At return
eval:  15 fn:      18.271925 par: 0.928227
(NM) 20: f = 8.06915 at 0.948227 -2.15163
(NM) 40: f = 8.06907 at 0.952002 -2.14855
(NM) 60: f = 8.06907 at 0.952207 -2.14864
...
bleclere commented 7 months ago

After a little digging, it seems to be a problem with a specific version of the Matrix package. It all works fine now, thank you!