tools

This module hosts useful tools that can be integrated in one’s workflow or are used to write more concise tests.

respyabc.tools.convert_time(seconds)[source]

Takes seconds as input and turns it into minutes or hours, if necessary.

Parameters

seconds (float) – Time in seconds.

Returns

  • time (float) – Magnitude of time.

  • unit (str) – Time unit. Either be seconds, minutes or hours.

respyabc.tools.plot_normal_densities(mu1, var1, mu2, var2, vertical_marker, title='Normal prior densities')[source]

plot two normal densities

Parameters
  • mu1 (float) – Mean of first normal random variable.

  • var1 (float) – Variance of first normal random variable.

  • mu2 (float) – Mean of second normal random variable.

  • var2 (float) – Variance of second normal random variable.

  • verticel_marker (float) – True parameter value..

  • title (str) – Title of the plot.

Returns

Return type

Plot of normal densities.

respyabc.tools.prepare_test_respyabc(parameter_true, prior_low, prior_size, descriptives)[source]

Wrapes all steps to run respyabc for one parameter.

Parameters
  • parameter_true (dict) – A dictionary containing the true parameter

  • prior_low (float) – A float with the lower bound for the uniform prior.

  • prior_size (float) – A float containing the length of the uniform prior.

  • descriptives ({"choice_frequencies", "wage_moments"}) – Determines how the descriptives with which the distance is computed are computed.

Returns

Return type

Runs respyabc for the specified parameter.

respyabc.tools.prepare_test_respyabc_model_selection(parameter_true, prior_low, prior_size, descriptives)[source]

Wrapes all steps to run respyabc for one parameter.

Parameters
  • parameter_true (dict) – A dictionary containing the true parameter

  • prior_low (float) – A float with the lower bound for the uniform prior.

  • prior_size (float) – A float containing the length of the uniform prior.

  • descriptives ({"choice_frequencies", "wage_moments"}) – Determines how the descriptives with which the distance is computed are computed. The default is "choice_frequencies".

Returns

Return type

Runs respyabc for the specified parameter.

respyabc.tools.prepare_test_respyabc_two_params(parameter_true, prior_low, prior_size, descriptives)[source]

Wrapes all steps to run respyabc for two parameter.

Parameters
  • parameter_true (dict) – A dictionary containing the true parameter

  • prior_low (float) – A float with the lower bound for the uniform prior.

  • prior_size (float) – A float containing the length of the uniform prior.

  • descriptives ({"choice_frequencies", "wage_moments"}) – Determines how the descriptives with which the distance is computed are computed.

Returns

Return type

Runs respyabc for the specified parameter.