Skip to contents

Create halton normal draws in appropriate format for mixed logit estimation

Usage

get_halton_normals(S, N, K_w)

Arguments

S

Number of draws per draw unit

N

number of draw units: choice situations, or decision makers for a panel fit (person_col in run_mxlogit)

K_w

dimension of random coefficients (number of columns in W matrix)

Value

K_w x S x N array with halton standard normal draws

Details

Draw unit \(i\) receives the \(S\) consecutive points \((i - 1)S + 1, \ldots, iS\) of the \(K_w\)-dimensional Halton sequence of randtoolbox::halton(), mapped to standard normals. The cube takes \(8 K_w S N\) bytes and is filled a block of units at a time, so it never holds a second copy of the sequence. Store mode supports at most \(2^{31} - 1\) points (\(S \times N\)), the largest starting index halton(start = ) accepts; draws = "generate" in run_mxlogit has no such limit and never materializes the cube. predict(), logsum(), consumer_surplus(), elasticities(), diversion_ratios(), blp() and gof() on a store-mode fit with up to 128 random coefficients do not build their cube (one block per choice situation) with this function: they form the same draws on the fly, from the same uniforms mapped by R's qnorm() (bit for bit where randtoolbox and choicer are compiled with the same floating-point contraction, as on CRAN's platforms).

Examples

draws <- get_halton_normals(S = 50, N = 10, K_w = 2)
dim(draws)  # 2 x 50 x 10
#> [1]  2 50 10