[R-meta] R^2 in nonlinear model
Cesar Terrer Moreno
cesar.terrer at me.com
Thu Mar 1 17:14:58 CET 2018
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
[[alternative HTML version deleted]]
More information about the R-sig-meta-analysis
mailing list