macroeco.compare.nll¶
- macroeco.compare.nll(data, model)¶
Negative log likelihood given data and a model
Parameters: data : iterable
Data for analysis
model : obj
Scipy frozen distribution object. When freezing, keyword args loc and scale should only be included if they represent a parameter.
Returns: float :
Negative log likelihood
Examples
>>> import macroeco.models as md >>> import macroeco.compare as comp
>>> # Generate random data >>> rand_samp = md.logser.rvs(p=0.9, size=100)
>>> # Get nll for p = 0.9 >>> comp.nll(rand_samp, md.logser(p=0.9)) 237.6871819262054
>>> # Get the nll for the MLE for p >>> mle_p = md.logser.fit_mle(rand_samp) >>> comp.nll(rand_samp, md.logser(*mle_p)) 235.2841347820297