[R-meta] R^2 in nonlinear model

Viechtbauer Wolfgang (SP) wolfgang.viechtbauer at maastrichtuniversity.nl
Thu Mar 1 19:39:30 CET 2018


Yes, setting x=0 should do the same as constraining p2=0.

Whether the 99% makes sense or not I cannot tell you. But it means that in 'res', tau^2 is estimated to be almost 0. So, almost all of the heterogeneity has been accounted for based on 'x'.

Note that this R^2-type measure is often not very accurate, unless k is sufficiently large. See:

Lopez-Lopez, J. A., Marin-Martinez, F., Sanchez-Meca, J., Van den Noortgate, W., & Viechtbauer, W. (2014). Estimation of the predictive power of the model in mixed-effects meta-regression: A simulation study. British Journal of Mathematical and Statistical Psychology, 67(1), 30-48.

This only covers simple linear meta-regression models, but the conclusion would be the same.

Best,
Wolfgang

>-----Original Message-----
>From: Cesar Terrer Moreno [mailto:cesar.terrer at me.com]
>Sent: Thursday, 01 March, 2018 19:23
>To: Viechtbauer Wolfgang (SP)
>Cc: r-sig-meta-analysis at r-project.org
>Subject: Re: [R-meta] R^2 in nonlinear model
>
>Hi Wolfgang,
>
>Thanks so much for your response. Please let me know if my code is
>correct:
>
>res <- optim(par=c(8,0.4,log(.01)), llfun, yi=am.df$es, vi=am.df$var,
>x=am.df$CNr, hessian=TRUE)
>res$par[3] <- exp(res$par[3])
>tau2_ME <- res$par[3]
>
>resp0 <- optim(par=c(8,0.4,log(.01)), llfun, yi=am.df$es, vi=am.df$var,
>x=0, hessian=TRUE)
>resp0$par[3] <- exp(resp0$par[3])
>tau2_RE <- resp0$par[3]
>
>> (tau2_RE - tau2_ME) / tau2_RE
>[1] 0.9999999
>
>Does this 99% R^2 make sense?
>Best,
>César
>
>> On 1 Mar 2018, at 18:23, Viechtbauer Wolfgang (SP)
><wolfgang.viechtbauer at maastrichtuniversity.nl> wrote:
>>
>> If you want an R^2-type value, you could use the same approach that is
>typically used in regular meta-regression:
>>
>> Fit the model with p2 constrained to 0; save the estimate of tau^2.
>Call this tau^2_RE.
>> Fit the model with p2 left free to estimate; save the estimate of
>tau^2. Call this tau^2_ME.
>>
>> Then R^2 = (tau^2_RE - tau^2_ME) / tau^2_RE.
>>
>> It's the proportional reduction in the amount of heterogeneity when 'x'
>is added as a predictor. Or in other words, it indicates how much of the
>total amount of heterogeneity is accounted for by 'x'.
>>
>> I wouldn't think of this as indicating 'goodness of fit' though.
>>
>> Best,
>> Wolfgang
>>
>>> -----Original Message-----
>>> From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces at r-
>>> project.org] On Behalf Of Cesar Terrer Moreno
>>> Sent: Thursday, 01 March, 2018 17:15
>>> To: r-sig-meta-analysis at r-project.org
>>> Subject: [R-meta] R^2 in nonlinear model
>>>
>>> Dear all,
>>>
>>> I am using a nonlinear meta-regression of the form y ~ p1 * exp(-
>p2*A):
>>>
>>> nlfun <- function(x, p1, p2)
>>> p1 * exp(-p2*x)
>>>
>>> # optimization function
>>> llfun <- function(par, yi, vi, x, random=TRUE) {
>>> p1 <- par[1]
>>> p2 <- par[2]
>>> if (random) {
>>>   tau2 <- exp(par[3])
>>> } else {
>>>   tau2 <- 0
>>> }
>>> mu <- nlfun(x, p1, p2)
>>> -sum(dnorm(yi, mean=mu, sd=sqrt(vi + tau2), log=TRUE))
>>> }
>>>
>>> # optimize
>>> res <- optim(par=c(8,0.4,log(.01)), llfun, yi=am.df$es, vi=am.df$var,
>>> x=am.df$CNr, hessian=TRUE)
>>>
>>> My question is: how can I compute something equivalent to R^2 that I
>can
>>> report to have an idea of the goodness of the fit?
>>> Thanks


More information about the R-sig-meta-analysis mailing list