MicEco
MicEco copied to clipboard
Suprising gRsqr calculation in neutral.fit
Hello,
I am using the neutral.fit function and I was surprised by the gRsqr results I was getting: they were not sustaining the visual impression I had of the fit. I tried to calculate the generalized R squared using the formula provided in Burns et al. (2015, ISME J 10(3):655-664) and I got very different results that fitted what I expected.
In Burns and al., they calculate R2 with: R2 = 1 - SSerr/SStotal
with SSerr the sum of squares of residuals and SStotal the total sum of squares
In neutral.fit, gRsqr is calculated with: R2 = 1 - exp(-as.numeric(logLik(m.mle))/length(p))
with p the number of observations and logLik(m.mle) the log likelihood of the model predicted by mle2
Do you have an insight on the difference between the two calculations?
Thanks,
R2 = 1 - SSerr/SStotal is the standard way to calculate R2, but that assumes homoscedasticity. Here the response is bounded between 0 and 1 and the residuals will always be heteroscedastic. What I have implemented is a Pseudo-R2, but it might not be correct in all situations