Package: statsmodels / 0.12.2-1

use-cached-datasets Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
Description: Use cached datasets in tests and examples

Also remove a download that isn't actually used in that example.

This allows the tests to pass, and at least some of the examples to
be built, in an offline environment such as a Debian buildd.

The cached data is extracted from R packages by debian/datasets/*.

Author: Diane Trout <[email protected]>, Rebecca N. Palmer <[email protected]>
Forwarded: not-needed

--- a/docs/source/contingency_tables.rst
    b/docs/source/contingency_tables.rst
@@ -49,7  49,7 @@ contingency table cell counts:
     import pandas as pd
     import statsmodels.api as sm
 
-    df = sm.datasets.get_rdataset("Arthritis", "vcd").data
     df = sm.datasets.get_rdataset("Arthritis", "vcd", cache=True).data
 
     tab = pd.crosstab(df['Treatment'], df['Improved'])
     tab = tab.loc[:, ["None", "Some", "Marked"]]
@@ -184,7  184,7 @@ contingency table.
 
 .. ipython:: python
 
-    df = sm.datasets.get_rdataset("VisualAcuity", "vcd").data
     df = sm.datasets.get_rdataset("VisualAcuity", "vcd", cache=True).data
     df = df.loc[df.gender == "female", :]
     tab = df.set_index(['left', 'right'])
     del tab["gender"]
--- a/docs/source/duration.rst
    b/docs/source/duration.rst
@@ -41,7  41,7 @@ We fit the survival distribution only fo
 
    import statsmodels.api as sm
 
-   data = sm.datasets.get_rdataset("flchain", "survival").data
    data = sm.datasets.get_rdataset("flchain", "survival", cache=True).data
    df = data.loc[data.sex == "F", :]
    sf = sm.SurvfuncRight(df["futime"], df["death"])
 
@@ -152,7  152,7 @@ depending on the value of the covariates
    import statsmodels.api as sm
    import statsmodels.formula.api as smf
 
-   data = sm.datasets.get_rdataset("flchain", "survival").data
    data = sm.datasets.get_rdataset("flchain", "survival", cache=True).data
    del data["chapter"]
    data = data.dropna()
    data["lam"] = data["lambda"]
--- a/docs/source/example_formulas.rst
    b/docs/source/example_formulas.rst
@@ -47,7  47,7 @@ and list-wise delete to remove missing o
 
 .. ipython:: python
 
-    df = sm.datasets.get_rdataset("Guerry", "HistData").data
     df = sm.datasets.get_rdataset("Guerry", "HistData", cache=True).data
     df = df[['Lottery', 'Literacy', 'Wealth', 'Region']].dropna()
     df.head()
 
--- a/docs/source/gee.rst
    b/docs/source/gee.rst
@@ -24,7  24,7 @@ within clusters using data on epilepsy s
     import statsmodels.api as sm
     import statsmodels.formula.api as smf
 
-    data = sm.datasets.get_rdataset('epil', package='MASS').data
     data = sm.datasets.get_rdataset('epil', package='MASS', cache=True).data
 
     fam = sm.families.Poisson()
     ind = sm.cov_struct.Exchangeable()
--- a/docs/source/gettingstarted.rst
    b/docs/source/gettingstarted.rst
@@ -50,7  50,7 @@ We could download the file locally and t
 
 .. ipython:: python
 
-    df = sm.datasets.get_rdataset("Guerry", "HistData").data
     df = sm.datasets.get_rdataset("Guerry", "HistData", cache=True).data
 
 The `Input/Output doc page <iolib.html>`_ shows how to import from various
 other formats.
--- a/docs/source/index.rst
    b/docs/source/index.rst
@@ -23,7  23,7 @@ Here is a simple example using ordinary
     import statsmodels.formula.api as smf
 
     # Load data
-    dat = sm.datasets.get_rdataset("Guerry", "HistData").data
     dat = sm.datasets.get_rdataset("Guerry", "HistData", cache=True).data
 
     # Fit regression model (using the natural log of one of the regressors)
     results = smf.ols('Lottery ~ Literacy   np.log(Pop1831)', data=dat).fit()
--- a/docs/source/mixed_linear.rst
    b/docs/source/mixed_linear.rst
@@ -83,7  83,7 @@ Examples
   import statsmodels.api as sm
   import statsmodels.formula.api as smf
 
-  data = sm.datasets.get_rdataset("dietox", "geepack").data
   data = sm.datasets.get_rdataset("dietox", "geepack", cache=True).data
 
   md = smf.mixedlm("Weight ~ Time", data, groups=data["Pig"])
   mdf = md.fit()
--- a/docs/source/release/version0.6.rst
    b/docs/source/release/version0.6.rst
@@ -41,7  41,7 @@ covariates.
    import statsmodels.api as sm
    import statsmodels.formula.api as smf
 
-   data = sm.datasets.get_rdataset("epil", "MASS").data
    data = sm.datasets.get_rdataset("epil", "MASS", cache=True).data
 
    md = smf.gee("y ~ age   trt   base", "subject", data,
                 cov_struct=sm.cov_struct.Independence(), 
--- a/docs/source/datasets/index.rst
    b/docs/source/datasets/index.rst
@@ -30,7  30,7 @@ The `Rdatasets project <https://vincenta
 .. ipython:: python
 
    import statsmodels.api as sm
-   duncan_prestige = sm.datasets.get_rdataset("Duncan", "carData")
    duncan_prestige = sm.datasets.get_rdataset("Duncan", "carData", cache=True)
    print(duncan_prestige.__doc__)
    duncan_prestige.data.head(5)
 
--- a/examples/notebooks/markov_regression.ipynb
    b/examples/notebooks/markov_regression.ipynb
@@ -28,11  28,7 @@
     "import pandas as pd\n",
     "import statsmodels.api as sm\n",
     "import matplotlib.pyplot as plt\n",
-    "\n",
-    "# NBER recessions\n",
-    "from pandas_datareader.data import DataReader\n",
-    "from datetime import datetime\n",
-    "usrec = DataReader('USREC', 'fred', start=datetime(1947, 1, 1), end=datetime(2013, 4, 1))"
     "from datetime import datetime\n"
    ]
   },
   {
--- a/examples/notebooks/mixed_lm_example.ipynb
    b/examples/notebooks/mixed_lm_example.ipynb
@@ -86,7  86,7 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "data = sm.datasets.get_rdataset('dietox', 'geepack').data\n",
     "data = sm.datasets.get_rdataset('dietox', 'geepack', cache=True).data\n",
     "md = smf.mixedlm(\"Weight ~ Time\", data, groups=data[\"Pig\"])\n",
     "mdf = md.fit(method=[\"lbfgs\"])\n",
     "print(mdf.summary())"
@@ -318,7  318,7 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "data = sm.datasets.get_rdataset(\"Sitka\", \"MASS\").data\n",
     "data = sm.datasets.get_rdataset(\"Sitka\", \"MASS\", cache=True).data\n",
     "endog = data[\"size\"]\n",
     "data[\"Intercept\"] = 1\n",
     "exog = data[[\"Intercept\", \"Time\"]]"
--- a/examples/notebooks/regression_diagnostics.ipynb
    b/examples/notebooks/regression_diagnostics.ipynb
@@ -47,8  47,8 @@
     "import matplotlib.pyplot as plt\n",
     "\n",
     "# Load data\n",
-    "url = 'https://raw.githubusercontent.com/vincentarelbundock/Rdatasets/master/csv/HistData/Guerry.csv'\n",
-    "dat = pd.read_csv(url)\n",
     "import statsmodels.datasets\n",
     "dat = statsmodels.datasets.get_rdataset(\"Guerry\", \"HistData\", cache=True).data\n",
     "\n",
     "# Fit regression model (using the natural log of one of the regressors)\n",
     "results = smf.ols('Lottery ~ Literacy   np.log(Pop1831)', data=dat).fit()\n",
--- a/statsmodels/stats/tests/test_dist_dependant_measures.py
    b/statsmodels/stats/tests/test_dist_dependant_measures.py
@@ -137,7  137,7 @@ class TestDistDependenceMeasures(object)
         0.1025087
         """
         try:
-            iris = get_rdataset("iris").data.values[:, :4]
             iris = get_rdataset("iris", cache=True).data.values[:, :4]
         except IGNORED_EXCEPTIONS:
             pytest.skip('Failed with HTTPError or URLError, these are random')
 
@@ -177,7  177,7 @@ class TestDistDependenceMeasures(object)
         30.01526
         """
         try:
-            quakes = get_rdataset("quakes").data.values[:, :3]
             quakes = get_rdataset("quakes", cache=True).data.values[:, :3]
         except IGNORED_EXCEPTIONS:
             pytest.skip('Failed with HTTPError or URLError, these are random')