GitHub

@@ -802,7 +802,7 @@ class McCallModelContinuous(NamedTuple):

802802

def create_mccall_continuous(

803803

c=25, β=0.99, σ=0.5, μ=2.5, mc_size=1000, seed=1234

804804

):

805-

key = jax.random.PRNGKey(seed)

805+

key = jax.random.key(seed)

806806

s = jax.random.normal(key, (mc_size,))

807807

w_draws = jnp.exp(μ + σ * s)

808808

return McCallModelContinuous(c, β, σ, μ, w_draws)

@@ -970,7 +970,7 @@ def simulate_lifetime_value(key, model, w_bar, n_periods=100):

970970971971

Parameters:

972972

-----------

973-

key : jax.random.PRNGKey

973+

key : jax.random.key

974974

Random key for JAX

975975

model : McCallModelContinuous

976976

The model containing parameters

@@ -1018,7 +1018,7 @@ def compute_mean_lifetime_value(model, w_bar, num_reps=10000, seed=1234):

10181018

Compute mean lifetime value across many simulations.

1019101910201020

"""

1021-

key = jax.random.PRNGKey(seed)

1021+

key = jax.random.key(seed)

10221022

keys = jax.random.split(key, num_reps)

1023102310241024

# Vectorize the simulation across all replications

@@ -1096,7 +1096,7 @@ def compute_stopping_time_continuous(w_bar, key, model):

10961096

-----------

10971097

w_bar : float

10981098

The reservation wage

1099-

key : jax.random.PRNGKey

1099+

key : jax.random.key

11001100

Random key for JAX

11011101

model : McCallModelContinuous

11021102

The model containing wage draws

@@ -1148,7 +1148,7 @@ def compute_mean_stopping_time_continuous(w_bar, model, num_reps=100000, seed=12

11481148

Average stopping time across all replications

11491149

"""

11501150

# Generate a key for each MC replication

1151-

key = jax.random.PRNGKey(seed)

1151+

key = jax.random.key(seed)

11521152

keys = jax.random.split(key, num_reps)

1153115311541154

# Vectorize compute_stopping_time_continuous and evaluate across keys

Read the original on github.com ↗