amvillegas / StMoMo

Stochastic Mortality Modelling
22 stars 6 forks source link

Check computation of binomial log-likelihoods for non-integer successes #8

Open amvillegas opened 9 years ago

amvillegas commented 9 years ago

The computation of binomial log-likelihood between the StMoMo object and the fitting model do not coincide. This is due to rounding in lchoose. See the following example

Dxt <- EWMaleData$Dxt
Ext <- EWMaleData$Ext + 0.5 * EWMaleData$Dxt
ages <- EWMaleData$ages
years <- EWMaleData$years
CBDfit <- fit(cbd(), Dxt = Dxt, Ext = Ext, ages = ages, years = years)
logLik(CBDfit)
logLik(CBDfit$fittingModel)
juneshuoyang commented 7 years ago

Hi,

I got a warning message for running M7fit for a mortality dataset

Warning message: In eval(expr, envir, enclos) : non-integer #successes in a binomial glm!

But, I did not get this warning for the given EW dataset.

Can you explain? Thank you very much

amvillegas commented 7 years ago

Hi,

This warning might be the result of the number of deaths in your dataset being non-integer - A binomial model requires the successes (deaths) to be integer numbers. Even if you have non-integer deaths the results should be sensible. However if you want to get rid of the warning you may try rounding the deaths before fitting the model

juneshuoyang commented 7 years ago

Thank you very much for your quick responsible. That makes sense, and yes the result is sensible too. Happy New Year to you.