zackfisher / robumeta

Robust Variance Meta-Regression
9 stars 6 forks source link

Predict function returning errors #13

Closed mprimbs closed 4 years ago

mprimbs commented 4 years ago

Dear Team,

I used your robumeta package for a meta-analysis. Today, I tried to reproduce the results of the meta-analysis, however, I´m unable to do so. The R code I used last year seems to not work anymore. According to your package documentation on CRAN, the name of the predict() command did not change.

I can create my robumeta object with the robu command, but when I try to use:

ES_P1 <- predict (res_2, pred.vector = c(1, 1), level = 0.95) it now returns: Error in stats::qt(1 - (1 - level)/2, df) : Non-numerical argument for mathematical function.

If I try to use robumeta::predict(), it tells me that robumeta did not export this object. Do you know what´s happening here?

Best,

Max

zackfisher commented 4 years ago

Hi Max,

Check if you have the clubSandwich package installed. That is a prerequisite for predict() at the moment. If that is not the issue you'll have to provide a small working example as the predict() function is working fine on my machine for the following example:

library(robumeta)
HierModSm <-  robu(formula = effectsize ~ binge + followup + sreport + age, data = hierdat, studynum = studyid, var.eff.size = var, modelweights = "HIER", small = TRUE)

predict(object =  HierModSm, pred.vector = rnorm(5),level = 0.95)
mprimbs commented 4 years ago

Hi Zack,

thank you for the swift reply. I could reproduce the error with your example.

Next, I loaded clubSandwich via install.packages("clubSandwich") instead of via install_github("jepusto/clubSandwich") as in my original code. This solved the issue.

Thank you very much!

Best,

Max

jepusto commented 4 years ago

Oh that's odd. This sounds like it may be an issue in clubSandwich then.

On Wed, Jul 22, 2020 at 12:14 PM mprimbs notifications@github.com wrote:

Closed #13 https://github.com/zackfisher/robumeta/issues/13.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/zackfisher/robumeta/issues/13#event-3576770089, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCVGIW24NM6KWA2ORDNPCTR44M75ANCNFSM4PER6EEA .

zackfisher commented 4 years ago

James, can you confirm this is an issue with the dependency on clubSandwich?

jepusto commented 4 years ago

Just looked into it. In the development version of clubSandwich, the output of Wald_test() now reports both numerator and denominator degrees of freedom, so what was originally called df is now called df_denom.