Exemple #1
0
 def test_coxtv_plotting(self, block):
     df = load_stanford_heart_transplants()
     ctv = CoxTimeVaryingFitter()
     ctv.fit(df, id_col="id", event_col="event")
     ctv.plot(fmt="o")
     self.plt.title("test_coxtv_plotting")
     self.plt.show(block=block)
Exemple #2
0
 def test_coxtv_plotting_with_subset_of_columns(self, block):
     df = load_stanford_heart_transplants()
     ctv = CoxTimeVaryingFitter()
     ctv.fit(df, id_col="id", event_col="event")
     ctv.plot(columns=["age", "year"])
     self.plt.title("test_coxtv_plotting_with_subset_of_columns")
     self.plt.show(block=block)
Exemple #3
0
 def test_coxtv_plotting_with_subset_of_columns_and_standardized(
         self, block):
     df = load_stanford_heart_transplants()
     ctv = CoxTimeVaryingFitter()
     ctv.fit(df, id_col='id', event_col='event')
     ctv.plot(True, columns=['age', 'year'])
     self.plt.title(
         'test_coxtv_plotting_with_subset_of_columns_and_standardized')
     self.plt.show(block=block)
Exemple #4
0
if __name__ == "__main__":
    import time
    import pandas as pd
    from lifelines.estimation import CoxTimeVaryingFitter
    from lifelines.datasets import load_stanford_heart_transplants
    dfcv = load_stanford_heart_transplants()
    dfcv = pd.concat([dfcv] * 50)
    ctv = CoxTimeVaryingFitter()
    start_time = time.time()
    ctv.fit(dfcv,
            id_col="id",
            event_col="event",
            start_col='start',
            stop_col='stop')
    time_took = (time.time() - start_time)
    print("--- %s seconds ---" % time_took)
    ctv.print_summary()