forked from jonathan-taylor/ISLP
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ensuring boolean columns get cast to float for statsmodels
- Loading branch information
1 parent
18e95bc
commit 3ebd239
Showing
2 changed files
with
31 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import pandas as pd | ||
import statsmodels.api as sm | ||
import numpy as np | ||
from itertools import combinations | ||
|
||
from ISLP.models import ModelSpec as MS | ||
|
||
rng = np.random.default_rng(0) | ||
|
||
df = pd.DataFrame({'A':rng.standard_normal(10), | ||
'B':np.array([1,2,3,2,1,1,1,3,2,1], int), | ||
'C':np.array([True,False,False,True,True]*2, bool), | ||
'D':rng.standard_normal(10)}) | ||
Y = rng.standard_normal(10) | ||
|
||
def test_all(): | ||
|
||
for i in range(1, 5): | ||
for comb in combinations(['A','B','C','D'], i): | ||
|
||
X = MS(comb).fit_transform(df) | ||
sm.OLS(Y, X).fit() | ||
|