Skip to content

Instantly share code, notes, and snippets.

@CamDavidsonPilon
Last active August 29, 2015 14:20
Show Gist options
  • Save CamDavidsonPilon/9fe76773a1895a766ccc to your computer and use it in GitHub Desktop.
Save CamDavidsonPilon/9fe76773a1895a766ccc to your computer and use it in GitHub Desktop.
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
pairid lbwt age lastwt race smoke ptd ht ui race1 race2 race3
1 0 14 135 1 0 0 0 0 1 0 0
1 1 14 101 3 1 1 0 0 0 0 1
2 0 15 98 2 0 0 0 0 0 1 0
2 1 15 115 3 0 0 0 1 0 0 1
3 0 16 95 3 0 0 0 0 0 0 1
3 1 16 130 3 0 0 0 0 0 0 1
4 0 17 103 3 0 0 0 0 0 0 1
4 1 17 130 3 1 1 0 1 0 0 1
5 0 17 122 1 1 0 0 0 1 0 0
5 1 17 110 1 1 0 0 0 1 0 0
6 0 17 113 2 0 0 0 0 0 1 0
6 1 17 120 1 1 0 0 0 1 0 0
7 0 17 113 2 0 0 0 0 0 1 0
7 1 17 120 2 0 0 0 0 0 1 0
8 0 17 119 3 0 0 0 0 0 0 1
8 1 17 142 2 0 0 1 0 0 1 0
9 0 18 100 1 1 0 0 0 1 0 0
9 1 18 148 3 0 0 0 0 0 0 1
10 0 18 90 1 1 0 0 1 1 0 0
10 1 18 110 2 1 1 0 0 0 1 0
from lifelines.estimation import CLogit
cl = CLogit()
df = d.read_csv('https://gist.githubusercontent.com/CamDavidsonPilon/9fe76773a1895a766ccc/raw/779b7ebb4ff61d871d924e588b017b75fbbd8d25/data.tsv', sep="\s+")
cl.fit(df[df.columns-['lbwt', 'age', 'race1', 'race']], df['lbwt'], strata=['pairid'])
print cl.summary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment