@doc_sub(_data_doc, _model_doc)<EOL>def nll(data, model):
try:<EOL><INDENT>log_lik_vals = model.logpmf(data)<EOL><DEDENT>except:<EOL><INDENT>log_lik_vals = model.logpdf(data)<EOL><DEDENT>return -np.sum(log_lik_vals)<EOL>
Negative log likelihood given data and a model

Parameters
----------
{0}
{1}

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