コード例 #1
0
ファイル: ex_kaplan_meier.py プロジェクト: zed/statsmodels
#Getting the strike data as an array
dta = sm.datasets.strikes.load()
print 'basic data'
print '\n'
dta = dta.values()[-1]
print dta[range(5), :]
print '\n'

#Create the KaplanMeier object and fit the model

km = KaplanMeier(dta, 0)
km.fit()

#show the results

km.plot()
print 'basic  model'
print '\n'
km.summary()
print '\n'

#Mutiple survival curves

km2 = KaplanMeier(dta, 0, exog=1)
km2.fit()
print 'more than one curve'
print '\n'
km2.summary()
print '\n'
km2.plot()
コード例 #2
0
#Getting the strike data as an array
dta = sm.datasets.strikes.load()
print 'basic data'
print '\n'
dta = dta.values()[-1]
print dta[range(5),:]
print '\n'

#Create the KaplanMeier object and fit the model

km = KaplanMeier(dta,0)
km.fit()

#show the results

km.plot()
print 'basic  model'
print '\n'
km.summary()
print '\n'

#Mutiple survival curves

km2 = KaplanMeier(dta,0,exog=1)
km2.fit()
print 'more than one curve'
print '\n'
km2.summary()
print '\n'
km2.plot()