Hi there,
I am trying to fit some data with a survival function, which is just 1 - cdf (cumulative distribution function). I was able to fit the data assuming a normal distributed random variable:
Due to the nature of the experiment I suspect that a gamma distributed random variable would give a better fit (at the end of the step), since the gamma distribution is "like a normal distribution with a bias on one side".
However, I cannot get this to work. It always looks like a normal distributed random variable, i.e. just as in the figure above.
I use Python. This is how I define my function:
def scaled_sf_gamma(x, c, d, shape_param):
return c*stats.gamma.sf(x, shape_param) + d
Parameters c and d scale the survival function. Then I define an additional shape parameter. I optimize the curve fit as:
p_opt_gamma = sp.optimize.curve_fit(scaled_sf_gamma, new_time, CH4_interpolated)[0]
As I said the result looks like a normal distribution. I think I am missing to optimize another parameter, which "skews" the normal distribution.
Here is some information about the gamma distribution and how it is used scipy.stats.gamma — SciPy v0.9.dev6665 Reference Guide (DRAFT). I do not understand the "lower or upper tail probability" which is given as a non-optional argument here. Maybe there lies the key...
Thanks a lot in advance for any help.
Cheers
Frank