In [1]:
!pip install .


Processing /Users/Cecilia/Desktop/STA 663/project/STA-663-Final-Project/fastfsr
  Requirement already satisfied (use --upgrade to upgrade): fastfsr==0.1 from file:///Users/Cecilia/Desktop/STA%20663/project/STA-663-Final-Project/fastfsr in /Users/Cecilia/anaconda/lib/python3.5/site-packages

In [2]:
import fastfsr

In [3]:
%matplotlib inline
import seaborn as sns
import matplotlib.pyplot as plt

import pandas as pd
import numpy as np

The fsr_fast function performs Fast FSR (no phony var. generation). It returns uses reg_subset to calculate the p-values and feed into fsr_fast_pv to implement the Fast FSR algorithm. The plot from fsr_fast_pv is carried over and will be displayed if `printout = True'.

In addition, the residual degrees of freedom, fitted values


In [4]:
ncaa = pd.read_csv("http://www4.stat.ncsu.edu/~boos/var.select/ncaa.data2.txt", 
                   delim_whitespace = True)
x = ncaa.ix[:,:-1]
y = ncaa.ix[:,-1]
x.head()


Out[4]:
x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19
0 13 17 9 15 28.0 0 -1.14045 3.660 4.490 3409 65.8 18 81 42.2 660000 77 100 59 1
1 28 20 32 18 18.4 18 -0.13719 2.594 3.610 7258 66.3 17 82 40.5 150555 88 94 41 25
2 32 20 20 20 34.8 18 1.55358 2.060 4.930 6405 75.0 19 71 46.5 415400 94 81 25 36
3 32 21 24 21 14.5 20 2.05712 2.887 3.876 18294 66.0 16 84 42.2 211000 93 88 26 13
4 24 20 16 20 21.8 13 -0.77082 2.565 4.960 8259 63.5 16 91 41.2 44000 90 92 32 31

In [6]:
fastfsr.fsr_fast(x, y, plot = True, printout = True)


            pval         pvmax     ghigh          glow
0   1.110223e-16  1.110223e-16 -0.000002  9.992007e-16
1   6.951095e-05  6.951095e-05  0.000625  3.938954e-04
2   1.158459e-02  1.158459e-02  0.065645  2.703071e-02
3   5.299074e-03  1.158459e-02  0.027030  2.703071e-02
4   2.483425e-03  1.158459e-02  0.027030  2.703071e-02
5   4.331519e-02  4.331519e-02  0.101069  8.044250e-02
6   5.273414e-02  5.273414e-02  0.097935  7.910121e-02
7   1.056315e-01  1.056315e-01  0.158447  8.642579e-02
8   8.262706e-02  1.056315e-01  0.086426  8.642579e-02
9   5.363568e-02  1.056315e-01  0.086426  8.642579e-02
10  2.349586e-01  2.349586e-01  0.192239  1.566390e-01
11  2.864403e-01  2.864403e-01  0.190960  1.542371e-01
12  3.163182e-01  3.163182e-01  0.170325  1.054394e-01
13  2.697263e-01  3.163182e-01  0.105439  1.054394e-01
14  4.953258e-01  4.953258e-01  0.165109  1.238314e-01
15  6.326487e-01  6.326487e-01  0.158162  1.116439e-01
16  7.056418e-01  7.056418e-01  0.124525  7.840464e-02
17  8.605404e-01  8.605404e-01  0.095616  4.529160e-02
18  9.031976e-01  9.031976e-01  0.047537  0.000000e+00    m1   m  gam0  size  alphamax  alpha_fast
0  19  19  0.05     5  0.234958    0.021429
Out[6]:
{'df_residual': 88,
 'fitted': array([ 39.97319987,  52.64145288,  51.31626901,  49.45817916,
         52.76003971,  52.09365876,  62.21731499,  83.46777372,
         60.30117759,  68.25962825,  55.49774106,  64.22824537,
         56.80145361,  58.13377833,  95.81098975,  45.10069166,
         48.5023815 ,  61.75018487,  56.63641511,  30.30552519,
         69.63687727,  71.67508299,  47.44581449,  41.38009064,
         82.39555916,  60.89678086,  55.86806477,  60.40105953,
         52.97306638,  52.32248597,  54.58600284,  54.72958362,
         34.98385796,  51.99723444,  36.34890947,  64.92903678,
         36.76333365,  63.70743018,  72.27393023,  76.79752933,
         63.26698036,  58.23771906,  52.97228084,  50.04166835,
         71.06778164,  55.6504356 ,  60.55746898,  56.6493757 ,
         40.73802362,  66.17385709,  96.76532902,  63.74160655,
         60.50068658,  50.71602229,  52.28020596,  46.87603065,
         52.86288238,  72.38682421,  65.26057094,  65.25404745,
         84.40695335,  78.03422549,  44.63575344,  38.97775534,
         28.69637283,  59.63252913,  55.09716218,  95.952859  ,
         73.78844456,  66.64091251,  52.30527841,  59.77698098,
         28.13040121,  59.81486661,  73.55932889,  51.73408815,
         42.12665683,  66.11674205,  62.39400279,  79.87453995,
         66.64400901,  64.23340288,  38.08783758,  38.15882539,
         88.93618701,  78.43695163,  67.89315809,  48.27298631,
         82.76456973,  59.87605898,  62.13871824,  51.17954363,
         66.1725256 ,  49.94174404]),
 'index': array([1, 2, 4, 3, 6]),
 'residual': 4565.3324512695444,
 'size': 5}

In [ ]: