QuantEcon / QuantEcon/QuantEcon.py

time series simulations

Open
#162 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
2.4k
Forks
2.3k
Avg merge
3d 3h
Merged PRs (30d)
3

Description

It would be nice to have a numba-fied function for simulating scalar AR(1) processes of the form

x_{t+1} = a x_t + b + c w_{t+1}

where the {w_t} shocks are N(0, 1). I do this all the time.

The obvious place to put it is lss.py. The call could be

simulate_ar1(a, b, c, x0, ts_length)

Obviously this is redundant --- which is why I'm putting it up to see if there are comments. The same series could be generated with the vector system code in lss.py, or in the code in ARMA, but neither of the interfaces are very convenient for scalar systems, and we would squeeze a bit more speed out by coding the scalar system independently.

Since this is for convenience, I don't really want to supply the shock sequence w as an argument, such as is required in simulate_linear_model.

Also, do we want to be able to pass this AR(1) function a frozen scipy stats object such as

In [6]: d = scipy.stats.beta(2, 2)

In [7]: d
Out[7]: <scipy.stats._distn_infrastructure.rv_frozen at 0x7fd9fddd2210>

In [8]: d.rvs(size=2)
Out[8]: array([ 0.65161537,  0.73846493])

so we can simulate with non-Gaussian shocks?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lss.py, especially simulate_linear_model, to understand the existing simulation interface. Decide the scope of the scalar AR(1) entry point and shock handling from the issue discussion, then verify that the requested call generates the specified series and supports the agreed distribution behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.