Skip to content

Commit 6a7940a

Browse files
committed
DOC: Reorganize documents
Reorganized documents to improve structure since the toolbox now contains more content [skip ci]
1 parent a2af453 commit 6a7940a

File tree

8 files changed

+267
-276
lines changed

8 files changed

+267
-276
lines changed

doc/source/bootstrap/bootstrap.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
Bootstrapping
22
-------------
3+
4+
.. py:module::arch.bootstrap
5+
36
The bootstrap module provides both high- and low-level interfaces for
47
bootstrapping data contained in NumPy arrays or pandas Series or DataFrames.
58

doc/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def __getattr__(cls, name):
217217
#html_additional_pages = {}
218218

219219
# If false, no module index is generated.
220-
#html_domain_indices = True
220+
html_domain_indices = True
221221

222222
# If false, no index is generated.
223223
#html_use_index = True

doc/source/index.rst

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
ARCH
22
----
33
The ARCH toolbox currently contains routines for univariate volatility models
4-
and bootstrapping. Current plans are to continue to expand this toolbox to
5-
include additional routines to analyze financial data.
4+
bootstrapping and unit root tests. Current plans are to continue to expand this
5+
toolbox to include additional routines to analyze financial data.
66

77
Contents
88
========
@@ -15,57 +15,6 @@ Contents
1515
Unit Root Tests <unitroot/unitroot>
1616
Change Log <changes>
1717

18-
Introduction to ARCH Models
19-
===========================
20-
ARCH models are a popular class of volatility models that use observed values
21-
of returns or residuals as volatility shocks. A basic GARCH model is specified
22-
as
23-
24-
.. math::
25-
:nowrap:
26-
27-
\begin{eqnarray}
28-
r_t & = & \mu + \epsilon_t \\
29-
\epsilon_t & = & \sigma_t e_t \\
30-
\sigma^2_t & = & \omega + \alpha \epsilon_t^2 + \beta \sigma^2_{t-1}
31-
\end{eqnarray}
32-
33-
An complete ARCH model is divided into three components:
34-
35-
36-
..
37-
.. Theoretical Background <background>
38-
..
39-
40-
However, the simplest method to construct this model is to use the constructor
41-
function :py:meth:`~arch.arch_model`
42-
43-
::
44-
45-
from arch import arch_model
46-
import datetime as dt
47-
import pandas.io.data as web
48-
start = dt.datetime(2000,1,1)
49-
end = dt.datetime(2014,1,1)
50-
sp500 = web.get_data_yahoo('^GSPC', start=start, end=end)
51-
returns = 100 * sp500['Adj Close'].pct_change().dropna()
52-
am = arch_model(returns)
53-
54-
Alternatively, the same model can be manually assembled from the building
55-
blocks of an ARCH model
56-
57-
::
58-
59-
from arch import ConstantMean, GARCH, Normal
60-
am = ConstantMean(returns)
61-
am.volatility = GARCH(1,0,1)
62-
am.distribution = Normal()
63-
64-
In either case, model parameters are estimated using
65-
66-
::
67-
68-
res = am.fit()
6918

7019
Indices and tables
7120
==================

doc/source/unitroot/introduction.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Introduction
2+
------------
3+
4+
All tests expect a 1-d series as the first input. The input can be any array that can be `squeeze`d to 1-d, a pandas
5+
`Series` or a pandas `DataFrame` that contains a single variable.
6+
7+
All tests share a common structure. The key elements are:
8+
9+
* `stat` - Returns the test statistic
10+
* `pvalue` - Returns the p-value of the test statistic
11+
* `lags` - Sets or gets the number of lags used in the model. In most test, can be `None` to trigger automatic selection.
12+
* `trend` - Sets of gets the trend used in the model. Supported trends vary by model, but include:
13+
- `'nc'`: No constant
14+
- `'c'`: Constant
15+
- `'ct'`: Constant and time trend
16+
- `'ctt'`: Constant, time trend and quadratic time trend
17+
* `summary()` - Returns a summary object that can be printed to get a formatted table
18+
19+
Basic Example
20+
=============
21+
22+
This basic example show the use of the Augmented-Dickey fuller to test whether the default premium, defined as the
23+
difference between the yields of large portfolios of BAA and AAA bonds. This example uses a constant and time trend.
24+
25+
26+
::
27+
28+
import pandas.io.data as web
29+
import datetime as dt
30+
aaa = web.DataReader("AAA", "fred", dt.datetime(1919,1,1), dt.datetime(2014,1,1))
31+
baa = web.DataReader("BAA", "fred", dt.datetime(1919,1,1), dt.datetime(2014,1,1))
32+
baa.columns = aaa.columns = ['default']
33+
default = baa - aaa
34+
from arch.unitroot import ADF
35+
adf = ADF(default)
36+
adf.trend = 'ct'
37+
print('Statistic: ' + str(adf.stat))
38+
print('P-value: ' + str(adf.pvalue))
39+
print('Summary \n')
40+
print(adf.summary())
41+
42+

doc/source/unitroot/unitroot.rst

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Unit Root Testing
22
-----------------
33

4+
.. py:module::arch.unitroot
5+
46
Many time series are highly persistent, and determining whether the data appear
57
to be stationary or contains a unit root is the first step in many analyses.
68
This module contains a number of routines:
@@ -17,50 +19,10 @@ of a stationary process. The final test, KPSS, has a null of a stationary
1719
process with an alternative of a unit root.
1820

1921
.. toctree::
20-
:maxdepth: 2
22+
:maxdepth: 1
2123

24+
Introduction <introduction>
2225
Examples <unitroot_examples>
2326
Unit Root Tests <tests>
2427

2528

26-
Introduction
27-
============
28-
29-
All tests expect a 1-d series as the first input. The input can be any array that can be `squeeze`d to 1-d, a pandas
30-
`Series` or a pandas `DataFrame` that contains a single variable.
31-
32-
All tests share a common structure. The key elements are:
33-
34-
* `stat` - Returns the test statistic
35-
* `pvalue` - Returns the p-value of the test statistic
36-
* `lags` - Sets or gets the number of lags used in the model. In most test, can be `None` to trigger automatic selection.
37-
* `trend` - Sets of gets the trend used in the model. Supported trends vary by model, but include:
38-
- `'nc'`: No constant
39-
- `'c'`: Constant
40-
- `'ct'`: Constant and time trend
41-
- `'ctt'`: Constant, time trend and quadratic time trend
42-
* `summary()` - Returns a summary object that can be printed to get a formatted table
43-
44-
Basic Example
45-
=============
46-
47-
This basic example show the use of the Augmented-Dickey fuller to test whether the default premium, defined as the
48-
difference between the yields of large portfolios of BAA and AAA bonds. This example uses a constant and time trend.
49-
50-
51-
::
52-
53-
import pandas.io.data as web
54-
import datetime as dt
55-
aaa = web.DataReader("AAA", "fred", dt.datetime(1919,1,1), dt.datetime(2014,1,1))
56-
baa = web.DataReader("BAA", "fred", dt.datetime(1919,1,1), dt.datetime(2014,1,1))
57-
baa.columns = aaa.columns = ['default']
58-
default = baa - aaa
59-
from arch.unitroot import ADF
60-
adf = ADF(default)
61-
adf.trend = 'ct'
62-
print('Statistic: ' + str(adf.stat))
63-
print('P-value: ' + str(adf.pvalue))
64-
print('Summary \n')
65-
print(adf.summary())
66-
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
Introduction to ARCH Models
2+
---------------------------
3+
ARCH models are a popular class of volatility models that use observed values
4+
of returns or residuals as volatility shocks. A basic GARCH model is specified
5+
as
6+
7+
.. math::
8+
:nowrap:
9+
10+
\begin{eqnarray}
11+
r_t & = & \mu + \epsilon_t \\
12+
\epsilon_t & = & \sigma_t e_t \\
13+
\sigma^2_t & = & \omega + \alpha \epsilon_t^2 + \beta \sigma^2_{t-1}
14+
\end{eqnarray}
15+
16+
An complete ARCH model is divided into three components:
17+
18+
19+
..
20+
.. Theoretical Background <background>
21+
..
22+
23+
However, the simplest method to construct this model is to use the constructor
24+
function :py:meth:`~arch.arch_model`
25+
26+
::
27+
28+
from arch import arch_model
29+
import datetime as dt
30+
import pandas.io.data as web
31+
start = dt.datetime(2000,1,1)
32+
end = dt.datetime(2014,1,1)
33+
sp500 = web.get_data_yahoo('^GSPC', start=start, end=end)
34+
returns = 100 * sp500['Adj Close'].pct_change().dropna()
35+
am = arch_model(returns)
36+
37+
Alternatively, the same model can be manually assembled from the building
38+
blocks of an ARCH model
39+
40+
::
41+
42+
from arch import ConstantMean, GARCH, Normal
43+
am = ConstantMean(returns)
44+
am.volatility = GARCH(1,0,1)
45+
am.distribution = Normal()
46+
47+
In either case, model parameters are estimated using
48+
49+
::
50+
51+
res = am.fit()
52+
53+
54+
55+
Core Model Constructor
56+
======================
57+
While models can be carefully specified using the individual components, most common specifications can be specified
58+
using a simple model constructor.
59+
60+
.. py:currentmodule:: arch
61+
.. autofunction:: arch_model
62+
63+
Model Results
64+
=============
65+
All model return the same object, a results class (:py:class:`ARCHModelResult`)
66+
67+
.. py:currentmodule:: arch.univariate.base
68+
.. autoclass:: ARCHModelResult
69+
:members: summary, plot, conf_int

doc/source/univariate/univariate.rst

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,14 @@
11
Univariate Volatility Models
22
----------------------------
33

4+
.. py:module::arch.univariate
5+
46
.. toctree::
57
:maxdepth: 1
68

9+
Introduction <introduction>
710
Examples <univariate_volatility_modeling>
811
Mean Models <mean>
912
Volatility Processes <volatility>
1013
Distributions <distribution>
1114
Background and References <background>
12-
13-
14-
Core Model Constructor
15-
======================
16-
While models can be carefully specified using the individual components, most common specifications can be specified
17-
using a simple model constructor.
18-
19-
.. py:currentmodule:: arch
20-
.. autofunction:: arch_model
21-
22-
Model Results
23-
=============
24-
All model return the same object, a results class (:py:class:`ARCHModelResult`)
25-
26-
.. py:currentmodule:: arch.univariate.base
27-
.. autoclass:: ARCHModelResult
28-
:members: summary, plot, conf_int

examples/unitroot_examples.ipynb

Lines changed: 143 additions & 163 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)