In [10]:
! 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 [14]:
import fastfsr

In [11]:
%matplotlib inline
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

In [12]:
pv_orig = np.array([0,.0001,.0116,.0053,.0025,.0433,.0527,.1056,.0826,.0536,.2350])
m = 19
gam0 = 0.05
digits = 4

In [18]:
fsr = fastfsr.fsr_fast_pv(pv_orig, m, plot = True, printout = True)


      pval   pvmax     ghigh      glow
0   0.0000  0.0000 -0.000002  0.000000
1   0.0001  0.0001  0.000899  0.000567
2   0.0116  0.0116  0.065733  0.027067
3   0.0053  0.0116  0.027066  0.027067
4   0.0025  0.0116  0.027066  0.027067
5   0.0433  0.0433  0.101033  0.080414
6   0.0527  0.0527  0.097871  0.079050
7   0.1056  0.1056  0.158400  0.086400
8   0.0826  0.1056  0.086400  0.086400
9   0.0536  0.1056  0.086400  0.086400
10  0.2350  0.2350  0.192273  0.156667    m1   m  gam0  size  alphamax  alpha_fast
0  11  19  0.05     5     0.235    0.021429

The table contains a column of `Mono $\tilde{p}$', which represents the monotonized p-values. When the true p-to-enter is not monotonically increasing, we monotonize the original sequence by carrying the largest p forward. Under this situation, at least two of the monotonized p-values must be equal, and there will be a gap in the model size.

For example in step 3, the true p-to-enter is 0.0053, which is smaller than the p-to-enter in the step 3. Hence we carry the p-to-enter from step 2 in step 3 and the same case also happens in step 4. Therefore the model size jumps to 5 after step 2 and it is impossible to have model of size 3 or 4.

The graph illustrates the relationship between $\hat{\gamma_F}$ and $\hat{\alpha_F}$. It illustrates: $\gamma_0 = 0.05$ chooses $\hat{\alpha_F} = 0.002$, which gives a model size of 5.


In [ ]: