Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REVIEW] Custom assertions #40

Closed
9 tasks done
hsloot opened this issue Feb 18, 2020 · 5 comments · Fixed by #42
Closed
9 tasks done

[REVIEW] Custom assertions #40

hsloot opened this issue Feb 18, 2020 · 5 comments · Fixed by #42
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed review Some code is due for review

Comments

@hsloot
Copy link
Owner

hsloot commented Feb 18, 2020

Summary

The custom assertions should be as simple as possible, follow the single responsibility principle, have descriptive names. The error messages should be informative and the corresponding variables should follow a naming convention.

Checklist

Miscellaneous assertions

  • is_positive_number: Tests if a number is scalar and positive; not contained in assertthat-package
  • is_nonnegative_number: Tests if a number is scalar and non-negative; not contained in assertthat-package

Discribution assertions

  • is_dimension: Tests if a number is a natural number larger than 1

Marshall--Olkin assertions

  • is_32bit_complient_dimension: Tests if a dimension for a Marshall--Olkin distribution is 32-bit compliant, i.e. if the number of distribution parameters will not exceed the 32-bit limit.
  • is_mo_parameter: Tests if a parameter vector of shock rates is a valid Marshall--Olkin parameter vector, i.e. if it has the correct length, all elements are non-negative numbers, and if the resulting marginal rates are positive.
  • is_ex_mo_parameter: Tests if a parameter vector of shock rates is a valid Marshall--Olkin parameter vector, i.e. if it has the correct length, all elements are non-negative numbers, and if the resulting marginal rate is positive.
  • is_lfm_cpp_param: Tests if a parameter list is a valid parameterisation of a Levy-frailty Marshall--Olkin model, i.e. if the rate, drift, and killing parameters are non-negative numbers and sum up to a positive number and if jump distribution is correctly parametrised.

Jump distribution assertions

  • is_rjump_name: Tests if the given name is a valid method to simulate jumps; jump distributions are currently limited to exponential and fixed jump distributions.
  • is_rjump_param: Tests if the given parameter list is valid for the given method name by performing a test run (warning: this might change the RNG state).
@hsloot hsloot added help wanted Extra attention is needed good first issue Good for newcomers review Some code is due for review labels Feb 18, 2020
@hsloot hsloot self-assigned this Feb 18, 2020
@hsloot hsloot added this to To do in Code review version 0.2.0 via automation Feb 18, 2020
@hsloot
Copy link
Owner Author

hsloot commented Apr 10, 2020

  • Implement an assertion is_cuadras_auge_param which tests if a parametrisation for the Cuadras-Augé distribution is valid, i.e. if alpha and beta are non-negative numbers and if their sum is positive.

@hsloot
Copy link
Owner Author

hsloot commented Apr 10, 2020

There should be some structural changes to the custom assertions:

  • use always _parameter instead of param
  • remove redundant roxygen2 comments (code should only be explained if it is not self-explanatory).
  • use only one error message template for all parameter error messages.

@hsloot
Copy link
Owner Author

hsloot commented Apr 10, 2020

  • assertions should not use || or && if not necessary.

@hsloot
Copy link
Owner Author

hsloot commented Apr 10, 2020

  • rename is_lfm_cpp_parameter to is_lfm_cpp_mo_parameter

@hsloot
Copy link
Owner Author

hsloot commented Apr 10, 2020

  • modify is_rjump_parameter is rump parameter such that the RNG state is not changed

hsloot added a commit that referenced this issue Apr 10, 2020
close #40
@hsloot hsloot mentioned this issue Apr 10, 2020
5 tasks
Code review version 0.2.0 automation moved this from To do to Done Apr 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed review Some code is due for review
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

1 participant