MicEco icon indicating copy to clipboard operation
MicEco copied to clipboard

Suprising gRsqr calculation in neutral.fit

Open bhagavadgitadu22 opened this issue 5 months ago • 1 comments

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,

bhagavadgitadu22 avatar Jan 26 '24 09:01 bhagavadgitadu22