@@ -7,39 +7,18 @@ This project uses rpy2 to expose most of the functionality of R's Forecast packa
7
7
Some related functions in the stats and base packages are also exposed (e.g. seasonal decompositions).
8
8
A few less-commnonly used functions and arguments are not exposed.
9
9
10
- An example of generating a forecast:
11
-
12
- .. code-block ::
13
-
14
- from rforecast import wrappers
15
- from rforecast import ts_io
16
-
17
- stock = ts_io.read_series('data/livestock.csv')
18
- fc = wrappers.forecast(stock)
19
- print fc
20
-
21
- This example uses the ``livestock `` series in ``data/ `` under the installation directory.
22
-
23
- An example of generating an STL decomposition:
24
-
25
- .. code-block ::
26
-
27
- aus = ts_io.read_series('aus.csv')
28
- dc = wrappers.stl(aus, s_window=5)
29
- print dc
30
-
31
-
32
10
The rforecast.py package uses Pandas Series objects to represent time series.
33
11
For seasonal series, it uses a multindex with the second level of the index
34
12
denoting the season. The ``read_series `` function in ``ts_io `` will return a
35
- series with the index constructed correctly.
13
+ series with the index constructed correctly, given .csv files like those in the
14
+ ``/data `` directory.
36
15
If the data are already in a Python sequence, such as a list or numpy array,
37
16
you can convert it to a series of the right form like this:
38
17
39
18
.. code-block :: python
40
19
41
20
from rforecast import converters
42
- # A slice of the 'oil' data from R package fpp, available in data/
21
+ # A slice of the 'oil' data from R package fpp, also available in data/
43
22
data = [509 , 506 , 340 , 240 , 219 , 172 , 252 , 221 , 276 , 271 , 342 , 428 , 442 , 432 , 437 ]
44
23
ts = converters.sequence_as_series(data, start = 1980 )
45
24
print ts
@@ -50,6 +29,26 @@ you can convert it to a series of the right form like this:
50
29
ts = converters.sequence_as_series(data, start = (1991 , 1 ), freq = 4 )
51
30
print ts
52
31
32
+ Forecasting and decomposition methods are in the wrappers module:
33
+
34
+ .. code-block ::
35
+
36
+ from rforecast import wrappers
37
+
38
+ An example of generating a forecast (using ts above):
39
+
40
+ .. code-block ::
41
+
42
+ fc = wrappers.forecast(ts)
43
+ print fc
44
+
45
+ An example of generating an STL decomposition :
46
+
47
+ .. code-block ::
48
+
49
+ dc = wrappers.stl(ts, s_window=5)
50
+ print dc
51
+
53
52
There is more information in the `.rst ` files under ``doc/ ``.
54
53
The documentation is built with Sphinx.
55
54
If you have Sphinx installed, you can build the documentation using the Makefile
0 commit comments