pyblp.Integration

class pyblp.Integration(specification, size, seed=None)

Configuration for building integration nodes and weights.

Parameters
  • specification (str) –

    How to build nodes and weights. One of the following:

    • 'monte_carlo' - Draw from a pseudo-random standard multivariate normal distribution. Integration weights are 1 / size.

    • 'product' - Generate nodes and weights according to the level-size Gauss-Hermite product rule.

    • 'nested_product' - Generate nodes and weights according to the level-size nested Gauss-Hermite product rule. Weights can be negative.

    • 'grid' - Generate a sparse grid of nodes and weights according to the level-size Gauss-Hermite quadrature rule. Weights can be negative.

    • 'nested_grid' - Generate a sparse grid of nodes and weights according to the level size nested Gauss-Hermite quadrature rule. Weights can be negative.

    Best practice for low dimensions is probably to use 'product' to a relatively high degree of polynomial accuracy. In higher dimensions, 'grid' appears to scale the best. For more information, see Judd and Skrainka (2011) and Conlon and Gortmaker (2019).

    Sparse grids are constructed in analogously to the Matlab function nwspgr created by Florian Heiss and Viktor Winschel. For more information, see Heiss and Winschel (2008).

  • size (int) – The number of draws if specification is 'monte_carlo', and the level of the quadrature rule otherwise.

  • seed (int, optional) – Passed to numpy.random.RandomState when specification is 'monte_carlo' to seed the random number generator before building nodes. By default, a seed is not passed to the random number generator.

Examples