I would like to estimate the parameters of a derived distribution fSurvivalGompertzNoiseDist
below.
This distribution represents simulations from a probability distribution that has the same shape as a Gompertz survival function, with noise added. Basically, I am sampling from a population whose population age structure is given by a Gompertz-survival function. (Individual age follows a Gompertz distribution, and assuming a constant rate of birth into the population, this results in a Gompertz-survival function for population age structure.) The gaussian noise represents measurement error.
I want to estimate the parameters of the underlying Gompertz function (which I call α
and β
below) by sampling from the population. As I said, to be clear, this population follows a Gompertz-survival age distribution, not a Gompertz distribution (that is for the individual age). It looks something like:
So first I define my population distribution fSurvivalGompertzNoiseDist
:
fSurvivalGompertzDist[α_, β_] :=
ProbabilityDistribution[
(1/((E^(α/β) Gamma[0, α/β])/β)E^(((1 - E^(t β)) α)/β)),
{t, 0, ∞},
Assumptions -> {α > 0, β > 0}
]
fSurvivalGompertzNoiseDist[α_, β_, σ_] :=
TransformedDistribution[u + v, {u \[Distributed] fSurvivalGompertzDist[α, β], v \[Distributed] NormalDistribution[0, σ]}]
I then use a slightly-differently defined distribution to generate independent samples (I simply omit the assumptions in the above):
fSurvivalGompertzDistRand[α_, β_] :=
ProbabilityDistribution[
(1/((E^(α/β) Gamma[0, α/β])/β) E^(((1 - E^(t β)) α)/β)),
{t, 0, ∞}
]
fSurvivalGompertzNoiseDistRand[α_, β_, σ_] :=
TransformedDistribution[u + v, {u \[Distributed] fSurvivalGompertzDistRand[α, β], v \[Distributed] NormalDistribution[0, σ]}]
data = RandomVariate[fSurvivalGompertzNoiseDistRand[0.016, 0.65, 1], {100}];
I then try to use FindDistributionParameters
on this:
FindDistributionParameters[data, fSurvivalGompertzNoiseDist[α, β, σ]]
Which returns the following error:
The support of the distribution TransformedDistribution...could not be determined.
The validity of the data for TransformedDistribution...could not be determined.
I have tried removing the assumptions above, as well as adding them to the transformed distribution function. I have also tried specifying σ > 0
in the transformed distribution function. None of these seems to make any difference.
Finally, I also tried to manually calculate the LogLikelihood for the fSurvivalGompertzNoiseDist
, but this returns back an unevaluated result. I have also tried to find the PDF (using Mathematica's $PDF$), which again returns back an unevaluated result.
Does anyone have an idea as to how I can make some headway here? As well as finding the answer, speed is of the essence, as I will need to do this calculate thousands of times. I know I have Jim's answer below, but this method is sensitive to parameter initial values. So for example, $\alpha=0.1,\beta=0.0001$, the method takes a long time, and can result in fairly imprecise estimates.
edit: I can calculate the characteristic function of the distribution, but this doesn't seem to yield moments in a simple enough form to think about doing method-of-moments estimation. Specifically the characteristic function is:
$\frac{e^{-\frac{1}{2} \sigma ^2 t^2} \left(\frac{\alpha }{\beta }\right)^{-\frac{i t}{\beta }} \left(\Gamma \left(\frac{i t}{\beta },\frac{\alpha }{\beta }\right)-\Gamma \left(\frac{i t}{\beta }\right)\right)}{\Gamma \left(0,\frac{\alpha }{\beta }\right)}$
I have also tried to estimate the moment generating function, but Mathematica doesn't seem to be able to do this.
edit 2: It does occur to me that, if I can't find the likelihood here, but can generate independent samples from the distribution, I could do a type of approximate Bayesian computation. Essentially I only need point estimates of the parameters, so could do a sort of least squared fitting between the actual data and the simulated. However, this would be expensive; only to be resorted to if there isn't an easier way.
edit 3: I have now managed to determine the mean and variance of the distribution. This is because $Z=X+Y$, where $X\sim fSurvivalGompertzDist[\alpha,\beta]$, and $Y\sim N(0,\sigma)$ are independent. Due to this independence I can calculate the mean, and variance of each separately, and add them to get what I want:
mean = MeijerG[{{}, {1, 1}}, {{0, 0,
0}, {}}, α/β]/(β Gamma[0, α/β])
variance = -((MeijerG[{{}, {1, 1}}, {{0, 0, 0}, {}}, α/β]^2 -
2 Gamma[0, α/β] MeijerG[{{}, {1, 1, 1}}, {{0, 0, 0,
0}, {}}, α/β])/(β^2 Gamma[
0, α/β]^2)) + σ^2
However, current attempts to use these with $NSolve$, $FindRoot$ etc. along with the empirical moments have failed: each function just returns the eqn. I am trying to solve unevaluated.
edit 4: I have tried to use the characteristic function, and its empirical analogue: $ecf=\frac{1}{n} \sum_{i=1}^n exp(t i X_i)$ to do a sort of method of moments as in the paper: http://www.mysmu.edu/faculty/yujun/research/yuer.pdf but I don't seem to get reasonable estimators out unfortunately.
edit 5: Since I am able to generate independent samples from this distribution, I have tried comparing the mean and variance of my distribution with that from the random samples. I do that using this function:
fCompareMeanVar[aMean_, aVar_, α_, β_, σ_, aNumComparisons_] :=
Module[{data =
RandomVariate[fSurvivalGompertzNoiseDistRand[α, β, [Sigma]], \{aNumComparisons}], bMean, bVar}, bMean = Mean@data;
bVar = Variance@data; Total@ {aMean - bMean, aVar - bVar}^2]
Unfortunately, the following doesn't seem to work.
NMinimize[{fCompareMeanVar[Mean@data,
Variance@data, α, β, 1, 1000], 1 > α > 0,
1 > β > 0}, {α, β},
Method -> "SimulatedAnnealing", AccuracyGoal -> 1]
Best,
Ben