I have implemented a shifted Lognormal
class ShiftedLognormal(pymc3.Lognormal): def __init__(self, mu, sigma, shift, tau=None, sd=None, *args, **kwargs): transform = pymc3.distributions.transforms.lowerbound(shift) super().__init__(mu=mu, sd=sigma, tau=tau, *args, **kwargs, transform=transform) self.shift = shift self.mean += shift self.mode += shift def random(self): return super().random() + self.shift def logp(self, x): return super().logp(x - self.shift)
According to a suggestion found here: https://github.com/pymc-devs/pymc3/issues/864
It seems to work well. However, if I want to sample_posterior_predictive, I get the error:
random() got an unexpected keyword argument ‘point’
I also tried using a non-shifted Lognormal and adding a shift variable to the data. This works, too, but gives another error when sampling the PP.
Are there perhaps other methods I need to override in the ShiftedLognormal shown above? (And how?)
Any help or ideas would be very welcome