In [1]:
import NotebookImport
from Model_Comparison_MF import *
In [2]:
pts = ti(labels.isin(['s1','s3']))
pts = pts.intersection(mc_adj_c.index)
age = age.ix[pts].dropna()
pred_c = mc_adj_c.ix[pts].dropna()
In [3]:
screen_feature(age, pearson_pandas, cell_counts.T, align=False)
Out[3]:
In [4]:
screen_feature(pred_c, pearson_pandas, cell_counts.T, align=False)
Out[4]:
In [5]:
screen_feature((pred_c - age), pearson_pandas, cell_counts.T, align=False)
Out[5]:
In [6]:
residual = (pred_c - age)
residual.name = 'residual'
df = process_factors([residual, cell_counts.NK, cell_counts.CD4T, cell_counts.CD8T,
cell_counts.Bcell, cell_counts.Mono, cell_counts.Gran],
standardize=False)
fmla = robjects.Formula('residual ~ NK + CD4T + CD8T + Bcell + Mono + Gran')
m = robjects.r.lm(fmla, df)
s = robjects.r.summary(m)
print '\n\n'.join(str(s).split('\n\n')[-3:])
In [7]:
age.name = 'age'
pred_c.name = 'pred_age'
df = process_factors([age.ix[ti(in_set==True)], cell_counts.NK, cell_counts.CD4T, cell_counts.CD8T,
cell_counts.Bcell, cell_counts.Mono, cell_counts.Gran,
pred_c], standardize=False)
fmla = robjects.Formula('age ~ pred_age + NK + CD4T + CD8T + Bcell + Mono + Gran')
m = robjects.r.lm(fmla, df)
s = robjects.r.summary(m)
print '\n\n'.join(str(s).split('\n\n')[-3:])
In [8]:
df = process_factors([age.ix[ti(in_set==True)], cell_counts.NK, cell_counts.CD4T, cell_counts.CD8T,
cell_counts.Bcell, cell_counts.Mono, cell_counts.Gran,
pred_c], standardize=False)
fmla = robjects.Formula('pred_age ~ age + NK + CD4T + CD8T + Bcell + Mono + Gran')
m = robjects.r.lm(fmla, df)
s = robjects.r.summary(m)
print '\n\n'.join(str(s).split('\n\n')[-3:])
In [9]:
pred.name = 'pred_age'
In [10]:
df = process_factors([age.ix[ti(in_set==True)], cell_counts.NK, cell_counts.CD4T, cell_counts.CD8T,
cell_counts.Bcell, cell_counts.Mono, cell_counts.Gran,
pred_c], standardize=False)
fmla = robjects.Formula('pred_age ~ age + CD8T')
m = robjects.r.lm(fmla, df)
s = robjects.r.summary(m)
print '\n\n'.join(str(s).split('\n\n')[-3:])