Skip to content

time series simulations #162

Open
Open
@jstac

Description

@jstac

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions