Hello everyone,
Few weeks ago, I created a post and asked for help to build test on survival models I wish to share with the statsmodels community.
Now, my tests are done and I would like to know how properly fork a new branch on Github, thing I never done.
First of all, here are my tests to be sure they are OK.
Abstract :
My model is a Weibull survival distribution with something special : survival can become infinite. It is useful for some analysis like unemployment duration where some people will never find a job : they come in "absorbing state".
The model allows truncated values to be used and is estimated by the maximum likelihood with reparameterization.
Coefficient's VAR matrix is estimated by the delta method. Optimizer used is Powell because it is the only one able to converge, the likelihood is pretty strange.
Here is the test procedure, I use an exponential distribution because it is just a special Weibull case :
def test() :
test_sample = np.random.exponential(scale = 2, size = 25000)
test_sample[20000:] = 10000.0
test_is_complete = np.ones(shape = 25000, dtype = float)
test_is_complete[20000:] = 0.0
test_df = DataFrame({"duration" : test_sample, "is_complete" : test_is_complete})
test_reg = Weibull_AS_Estimator("duration", "is_complete", test_df)
test_reg.fit(tol = 0.0)
print("estimated lamda is "+str(test_reg.estimated_coeff["lambda"]))
print("lambda used for simulation is 2.0")
print("estimated k is "+str(test_reg.estimated_coeff["k"]))
print("k used for simulation is 1")
print("estimated proportion in absorbing state is "+str(test_reg.estimated_coeff["AS prop"]))
print("proportion in absorbing state used for simulation is 0.2")
test_reg.plot_survival()
And here is what tests return :
Does it look like correct for you? If you like this model, please tell me : I am able to implement a lot of survival analysis tools.