コード例 #1
0
ファイル: ex_kaplan_meier.py プロジェクト: zed/statsmodels
def weights(t):
    #must accept one arguement, even though it is not used here
    s = KaplanMeier(dta, 0, censoring=2)
    s.fit()
    s = s.results[0][0]
    s = s * (1 - s)
    return s
コード例 #2
0
def weights(t):
    #must accept one arguement, even though it is not used here
    s = KaplanMeier(dta,0,censoring=2)
    s.fit()
    s = s.results[0][0]
    s = s * (1 - s)
    return s
コード例 #3
0
ファイル: ex_kaplan_meier.py プロジェクト: zed/statsmodels
import scikits.statsmodels.api as sm
import matplotlib.pyplot as plt
import numpy as np
from scikits.statsmodels.sandbox.survival2 import KaplanMeier

#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'
コード例 #4
0
import scikits.statsmodels.api as sm
import matplotlib.pyplot as plt
import numpy as np
from scikits.statsmodels.sandbox.survival2 import KaplanMeier

#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'