Skip to content

Comments

Correction to Nomenclature in Volatility Model#2978

Merged
springcoil merged 1 commit intopymc-devs:masterfrom
aaronjmaxwell:feature/nomenclature-fix-in-notebook
May 18, 2018
Merged

Correction to Nomenclature in Volatility Model#2978
springcoil merged 1 commit intopymc-devs:masterfrom
aaronjmaxwell:feature/nomenclature-fix-in-notebook

Conversation

@aaronjmaxwell
Copy link
Contributor

This small correction is in response to issue Stochastic Volatility Example #2566. It concerns the two different examples of the Volatility Model used in the PyMC3 notebooks to introduce users to the
wonder that is Bayesian modeling. In getting_started.ipynb, under:

Case Study 1: Stochastic volatility

The Model

the model specification uses y_i to represent the daily precentage returns. However, later on in
the with pm.Model() as sp500_model: block the dummy variable r is used to represent the daily
returns as well as the tensor variable name.

The second correction also concerns the useage of s_i to represent the volatility process in daily
returns. In both Volatility Process walkthroughs (there is a stand-alone notebook dedicated to it)
the model specs treat s_i as the standard deviation of the StudentT distribution used to model the
log-returns. In the PyMC3 API docs on the StudentT, the distribution is defined with lambda
representing the precision. This is why the volatility_process variable is mapped from
pm.math.exp(-2 * s) in the pm.Model() block. However, when the returns were defined in the
model block the **kwarg was lambda=1/volatility_process. This has been fixed.

Thanks to @twiecki and the OP for highlighting this error. Alternatively, if there is apprehension to the second change since model specs will not correspond to the trace that was returned, one could simply keep lambda=1/volatility_process and change the model specification to log(r_i) \sim t(\nu, 0, exp(2s_{i}). Then at least the MCMC sampler would not need to be re-run (difficult considering that Google has blocked requests to the historical finance data API).

This small correction is in response to issue Stochastic Volatility Example #2566.  It concerns the
two different examples of the Volatility Model used in the PyMC3 notebooks to introduce users to the
wonder that is Bayesian modeling.  In getting_started.ipynb, under:
--Case Study 1: Stochastic volatility
---The Model
the model specification uses `y_i` to represent the daily precentage returns.  However, later on in
the `with pm.Model() as sp500_model:` block the dummy variable `r` is used to represent the daily
returns as well as the tensor variable name.

The second correction also concerns the useage of `s_i` to represent the volatility process in daily
returns.  In both Volatility Process walkthroughs (there is a stand-alone notebook dedicated to it)
the model specs treat `s_i` as the standard deviation of the StudentT distribution used to model the
log-returns.  In the PyMC3 API docs on the StudentT, the distribution is defined with `lambda`
representing the precision.  This is why the `volatility_process` variable is mapped from
`pm.math.exp(-2 * s)` in the `pm.Model()` block.  However, when the returns were defined in the
model block the **kwarg was `lambda=1/volatility_process`.  This has been fixed.

Thanks to @twiecki and the OP for highlighting this error.
Copy link
Contributor

@springcoil springcoil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM nice commit!!

@springcoil springcoil merged commit cbb3e5b into pymc-devs:master May 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants