pyfan.gen.rand.randgrid

The pyfan.gen.rand.randgrid generate a grid with randomly spaced grid points.

\[x \sim N\left(\mu, \sigma\right)\]

Includes method ar_draw_random_normal().

Module Contents

Functions

ar_draw_random_normal(fl_mu, fl_sd, it_draws, it_seed=None, it_draw_type=0, fl_lower_sd=-3, fl_higher_sd=None)

Draw a Vector of Possibly Sorted and Bounded Normal Shocks

pyfan.gen.rand.randgrid.ar_draw_random_normal(fl_mu, fl_sd, it_draws, it_seed=None, it_draw_type=0, fl_lower_sd=- 3, fl_higher_sd=None)[source]

Draw a Vector of Possibly Sorted and Bounded Normal Shocks

Parameters
fl_mu, fl_sdfloat

The mean and standard deviation of the normal process

it_draws: `int`

Number of Draws

it_seed: `int`, optional

External random seed externally. Default is 123.

it_draw_type: `int`, optional

Indicates which type of normal draws to make. 0 sorted normal draws cut off at bounds. 1 equi-quantile unequal distance points; 2 normal draws unsorted.

fl_lower_sd, fl_higher_sdfloat

Impose lower and upper bounds (in sd units) on shock draws. The normal distribution does not have lower or upper bounds.

Returns
numpy.array of shape (1, it_draws)

A vector of sorted or unsorted random grid points, or equi-quantile points.

Notes

This method requires a dataset of equal-sized time series

Examples

>>> fl_mu = 0
>>> fl_sd = 1
>>> it_draws = 5
>>> it_seed = 123
>>> fl_lower_sd = -1
>>> fl_higher_sd = 0.8
>>> it_draw_type = 0
>>> ar_draw_random_normal(fl_mu, fl_sd, it_draws,
...                       it_seed, it_draw_type,
...                       fl_lower_sd, fl_higher_sd)
[-1.          0.8         0.2829785 - 1. - 0.57860025]
>>> it_draw_type = 1
>>> ar_draw_random_normal(fl_mu, fl_sd, it_draws,
...                       it_seed, it_draw_type,
...                       fl_lower_sd, fl_higher_sd)
[-1. - 0.47883617 - 0.06672597  0.3338994   0.8]
>>> it_draw_type = 2
>>> ar_draw_random_normal(fl_mu, fl_sd, it_draws,
...                       it_seed, it_draw_type,
...                       fl_lower_sd, fl_higher_sd)
[-1. - 1. - 0.57860025  0.2829785   0.8]