Title: Draw Nested Extreme Value Random Variables
Version: 1.0.0.0
Description: Draw nested extreme value random variables, which are the variables that appear in the latent variable formulation of the nested logit model.
License: GPL (≥ 3)
Encoding: UTF-8
RoxygenNote: 7.3.2
Imports: fourierin (≥ 0.2.5), pracma (≥ 2.4.4), extraDistr (≥ 1.10.0)
NeedsCompilation: no
Packaged: 2025-09-02 14:43:38 UTC; wtownsend
Author: Wilbur Townsend [aut, cre]
Maintainer: Wilbur Townsend <wilbur.townsend@gmail.com>
Repository: CRAN
Date/Publication: 2025-09-08 19:00:09 UTC

Draw nested extreme value random variables

Description

rnev draws nested extreme value random variables.

Usage

rnev(
  N,
  sigma,
  nests,
  tol = 0.001,
  lower_int = NULL,
  upper_int = NULL,
  lower_eval = -10,
  upper_eval = NULL,
  resolution = 2^15
)

Arguments

N

the number of vectors;

sigma

the parameter that measures within-nest correlation, expressed either as a length-num_nests vector or as a scalar (in which case sigma is assumed constant across nests);

nests

a vector of positive integers, indicating the nest of each alternative;

tol

the tolerance on the requirement that the approximate pdf be real-valued, non-negative, and equal to zero at its boundary;

lower_int

an argument passed to fourierin (default depends on sigma);

upper_int

an argument passed to fourierin (default depends on sigma);

lower_eval

an argument passed to fourierin (default = -10);

upper_eval

an argument passed to fourierin (default depends on sigma);

resolution

an argument passed to fourierin (default = 2^15).

Value

An N-by-length(nests) matrix, with each row being a draw from the nested extreme value distribution.

Examples

rnev(10, 0.5, c(1,1,2,3))