nss#

swordfish.function.nss()#

Fit yield curve using NSS (Nelson-Siegel-Svensson) model.

Parameters:
  • maturity (Constant) – _description_

  • yield (Constant) – _description_

  • method (Constant, optional) – _description_, by default DFLT

  • maxIter (Constant, optional) – _description_, by default DFLT

  • bounds (Constant, optional) – _description_, by default DFLT

  • initialGuess (Constant, optional) – _description_, by default DFLT

  • seed (Constant, optional) – _description_, by default DFLT

Returns:

A dictionary with the following keys:

  • modelName: The model used.

  • params: The fitted model parameters.

    • NS model: a vector of length 4, containing β0, β1, β2, λ.

    • NSS model: a vector of length 6, containing β0, β1, β2, β3, λ0, λ1.

  • fminResult: The optimization result.

    • ’nm’ : See fmin.

    • ’bfgs’: See fminBFGS.

    • ’lbfgs’: See fminLBFGSB.

    • ’slsqp’: See fminSLSQP.

    • ’de’: See differentialEvolution.

  • predict: The prediction function of the model, which returns the predicted yield with this model. It can be called using model. predict(T) or predict(model, T), where T is the maturity in years.

Return type:

Constant