shifted_beta_geometric_py icon indicating copy to clipboard operation
shifted_beta_geometric_py copied to clipboard

Different log-likelihood function

Open hannahbav opened this issue 3 years ago • 0 comments

In the paper, the log likelihood is the sum of cancel rates times log probabilities, plus the end survived rate times final survivor likelihood. Should it therefore not be

def log_likelihood(alpha, beta, data, survivors=None):
    if alpha <= 0 or beta <= 0:
        return -1000
    if survivors is None:
        survivors = cancel_rates
    probabilities = generate_probabilities(alpha, beta, len(data))
    final_survivor_likelihood = survivor(probabilities, len(data) - 1)
    
    return sum([s * np.log(probabilities[t]) for t, s in enumerate(data)]) + survivors[-1] * np.log(final_survivor_likelihood)

hannahbav avatar Nov 09 '20 23:11 hannahbav