当前位置: 首页>>代码示例>>Python>>正文


Python estimation.NelsonAalenFitter类代码示例

本文整理汇总了Python中lifelines.estimation.NelsonAalenFitter的典型用法代码示例。如果您正苦于以下问题:Python NelsonAalenFitter类的具体用法?Python NelsonAalenFitter怎么用?Python NelsonAalenFitter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了NelsonAalenFitter类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_smoothing_hazard_with_spike_at_time_0

 def test_smoothing_hazard_with_spike_at_time_0(self):
     T = np.random.binomial(20, 0.7, size=300)
     T[np.random.binomial(1, 0.3, size=300).astype(bool)] = 0
     naf = NelsonAalenFitter()
     naf.fit(T)
     df = naf.smoothed_hazard_(bandwidth=0.1)
     assert df.iloc[0].values[0] > df.iloc[1].values[0]
开发者ID:nerdless,项目名称:lifelines,代码行数:7,代码来源:test_estimation.py

示例2: test_naf_plot_cumulative_hazard_bandwith_1

 def test_naf_plot_cumulative_hazard_bandwith_1(self, block):
     data1 = np.random.exponential(5, size=(2000, 1)) ** 2
     naf = NelsonAalenFitter()
     naf.fit(data1)
     naf.plot_hazard(bandwidth=5., iloc=slice(0, 1700))
     self.plt.title('test_naf_plot_cumulative_hazard_bandwith_1')
     self.plt.show(block=block)
     return
开发者ID:,项目名称:,代码行数:8,代码来源:

示例3: test_naf_plot_cumulative_hazard_bandwidth_2

 def test_naf_plot_cumulative_hazard_bandwidth_2(self):
     data1 = np.random.exponential(5, size=(2000, 1))
     naf = NelsonAalenFitter()
     naf.fit(data1)
     naf.plot_hazard(bandwidth=1., ix=slice(0, 7.))
     self.plt.title('test_naf_plot_cumulative_hazard_bandwidth_2')
     self.plt.show()
     return
开发者ID:nerdless,项目名称:lifelines,代码行数:8,代码来源:test_plotting.py

示例4: test_smoothing_hazard_nontied

 def test_smoothing_hazard_nontied(self):
     T = np.random.exponential(20, size=300) ** 2
     C = np.random.binomial(1, 0.8, size=300)
     naf = NelsonAalenFitter()
     naf.fit(T, C)
     naf.smoothed_hazard_(1.)
     naf.fit(T)
     naf.smoothed_hazard_(1.)
开发者ID:nerdless,项目名称:lifelines,代码行数:8,代码来源:test_estimation.py

示例5: test_naf_plotting_with_custom_colours

 def test_naf_plotting_with_custom_colours(self, block):
     data1 = np.random.exponential(5, size=(200, 1))
     data2 = np.random.exponential(1, size=(500))
     naf = NelsonAalenFitter()
     naf.fit(data1)
     ax = naf.plot(color="r")
     naf.fit(data2)
     naf.plot(ax=ax, c="k")
     self.plt.title('test_naf_plotting_with_custom_coloirs')
     self.plt.show(block=block)
     return
开发者ID:,项目名称:,代码行数:11,代码来源:

示例6: test_naf_plotting_slice

 def test_naf_plotting_slice(self, block):
     data1 = np.random.exponential(5, size=(200, 1))
     data2 = np.random.exponential(1, size=(200, 1))
     naf = NelsonAalenFitter()
     naf.fit(data1)
     ax = naf.plot(ix=slice(0, None))
     naf.fit(data2)
     naf.plot(ax=ax, ci_force_lines=True, iloc=slice(100, 180))
     self.plt.title('test_naf_plotting_slice')
     self.plt.show(block=block)
     return
开发者ID:,项目名称:,代码行数:11,代码来源:

示例7: test_naf_plot_cumulative_hazard

 def test_naf_plot_cumulative_hazard(self, block):
     data1 = np.random.exponential(5, size=(200, 1))
     naf = NelsonAalenFitter()
     naf.fit(data1)
     ax = naf.plot()
     naf.plot_cumulative_hazard(ax=ax, ci_force_lines=True)
     self.plt.title("I should have plotted the same thing, but different styles + color!")
     self.plt.show(block=block)
     return
开发者ID:,项目名称:,代码行数:9,代码来源:

示例8: get_ipython

# In[23]:

get_ipython().magic(u'R p <- plot.ly("https://plot.ly/~rmdk/185/cumulativehazard-vs-time/")')
# pass object to python kernel
get_ipython().magic(u'R -o p')

# Render HTML
HTML(p[0])


# ### Using Python

# In[26]:

from lifelines.estimation import NelsonAalenFitter

naf = NelsonAalenFitter()
naf.fit(T, event_observed=C)

naf.plot(title='Nelson-Aalen Estimate')


# In[27]:

naf.plot(ci_force_lines=True, title='Nelson-Aalen Estimate')
py_p = plt.gcf()

pyplot(py_p, legend=False)

开发者ID:RMDK,项目名称:IPython-plotly,代码行数:28,代码来源:survival_analysis.py

示例9: test_exponential_data_sets_fit

def test_exponential_data_sets_fit():
    N = 20000
    T, C = exponential_survival_data(N, 0.2, scale=10)
    naf = NelsonAalenFitter()
    naf.fit(T, C).plot()
    plt.title("Should be a linear with slope = 0.1")
开发者ID:DGaffney,项目名称:lifelines,代码行数:6,代码来源:test_generate_datasets.py

示例10: test_smoothing_hazard_ties_all_events_observed

 def test_smoothing_hazard_ties_all_events_observed(self):
     T = np.random.binomial(20, 0.7, size=300)
     naf = NelsonAalenFitter()
     naf.fit(T)
     naf.smoothed_hazard_(1.)
开发者ID:nerdless,项目名称:lifelines,代码行数:5,代码来源:test_estimation.py

示例11: test_smoothing_hazard_ties

 def test_smoothing_hazard_ties(self):
     T = np.random.binomial(20, 0.7, size=300)
     C = np.random.binomial(1, 0.8, size=300)
     naf = NelsonAalenFitter()
     naf.fit(T, C)
     naf.smoothed_hazard_(1.)
开发者ID:nerdless,项目名称:lifelines,代码行数:6,代码来源:test_estimation.py

示例12: test_censor_nelson_aalen

 def test_censor_nelson_aalen(self, sample_lifetimes):
     T, C = sample_lifetimes
     naf = NelsonAalenFitter(nelson_aalen_smoothing=False)
     naf.fit(T, C)
     npt.assert_almost_equal(naf.cumulative_hazard_.values, self.nelson_aalen(T, C))
开发者ID:nerdless,项目名称:lifelines,代码行数:5,代码来源:test_estimation.py


注:本文中的lifelines.estimation.NelsonAalenFitter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。