HARK.estimation

Functions for estimating structural models, including optimization methods and bootstrapping tools.

HARK.estimation.bootstrapSampleFromData(data, weights=None, seed=0)

Samples rows from the input array of data, generating a new data array with an equal number of rows (records). Rows are drawn with equal probability by default, but probabilities can be specified with weights (must sum to 1).

Parameters:
  • data (np.array) – An array of data, with each row representing a record.
  • weights (np.array) – A weighting array with length equal to data.shape[0].
  • seed (int) – A seed for the random number generator.
Returns:

new_data – A resampled version of input data.

Return type:

np.array

HARK.estimation.minimizeNelderMead(objectiveFunction, parameter_guess, verbose=False, which_vars=None, **kwargs)

Minimizes the objective function using the Nelder-Mead simplex algorithm, starting from an initial parameter guess.

Parameters:
  • objectiveFunction (function) – The function to be minimized. It should take only a single argument, which should be a list representing the parameters to be estimated.
  • parameter_guess ([float]) – A starting point for the Nelder-Mead algorithm, which must be a valid input for objectiveFunction.
  • which_vars (np.array or None) – Array of booleans indicating which parameters should be estimated. When not provided, estimation is performed on all parameters.
  • verbose (boolean) – A flag for the amount of output to print.
Returns:

xopt – The values that minimize objectiveFunction.

Return type:

[float]

HARK.estimation.minimizePowell(objectiveFunction, parameter_guess, verbose=False)

Minimizes the objective function using a derivative-free Powell algorithm, starting from an initial parameter guess.

Parameters:
  • objectiveFunction (function) – The function to be minimized. It should take only a single argument, which should be a list representing the parameters to be estimated.
  • parameter_guess ([float]) – A starting point for the Powell algorithm, which must be a valid input for objectiveFunction.
  • verbose (boolean) – A flag for the amount of output to print.
Returns:

xopt – The values that minimize objectiveFunction.

Return type:

[float]