Dear R users,
i try to integrate lgamma from 0 to Inf. But here i get the message "roundoff error is detected in the extrapolation table", if i use 1.0e120 instead of Inf the computation works, but this is against the suggestion of integrates help information to use Inf explicitly. Using stirlings approximation doesnt bring the solution too.
## Stirlings approximation
lgammaApprox <- function(x)
{
0.5*log(2*pi)+(x-(1/2))*log(x)-x
}
integrate(lgamma, lower = 0, upper = 1.0e120)
integrate(lgammaApprox, lower = 0, upper = 1.0e120)
Fehler in integrate(lgamma, lower = 0, upper = Inf) :
roundoff error is detected in the extrapolation table
integrate(lgammaApprox, lower = 0, upper = Inf)
Fehler in integrate(lgammaApprox, lower = 0, upper = Inf) :
roundoff error is detected in the extrapolation table
Many thanks if you have any advice for me!
best regards
Andreas
--