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

Function update #39

Merged
merged 19 commits into from
Aug 15, 2024
Merged

Function update #39

merged 19 commits into from
Aug 15, 2024

Conversation

Tess-LaCoil
Copy link
Collaborator

@Tess-LaCoil Tess-LaCoil commented Aug 14, 2024

Update to a collection of functions:
assign_data

  • Now takes either dedicated named vectors or a dataset with appropriately named columns
  • Throws errors when the data does not match the required form
  • Throws an error when the requested model does not exist
  • Checks sizes for vectors in the created data list
  • Checks for existence of elements of created data list

run

  • Now checks if the chosen model exists in the package

Selection of new functions:
extract_estimates

  • New function that takes in a model name, matching fit, and returns a list of data frames corresponding to measurement, individual, population (if multi-individual), and error estimated parameters.
  • Error handling to address Issue Error handling and testing for extact_estimates function #34
  • Error structure: provided fit has to exist and must match the requested model parameter names, and the model must exist.

plot_de_pieces and ggplot_de_pieces

  • First is a wrapper for the second that does some data wrangling like find the start and end values of $Y$ for each individual.
  • New function that produces a figure of $Y$ against $dY/dt$ based on the chosen model and individual parameters.
  • Fits a piece to each individual from $Y_i(0)$ to $Y_i(final)$, parameterised by $\theta_i$
  • Has some limited customisability.

model_des

  • Function that returns the differential equation as a function for each of the four included models.
  • Checks if the model is available in the package.

model_names

  • Function that returns a vector containing the names of available models.

model_pars

  • Function that returns a list of character vectors for each available model
  • Character vectors give parameter names for each level in the model
  • Checks if the model is available in the package.

Test coverage
New test scripts for assign_data, extract_estimates, and plot_de_pieces.

…de parameter lists for each available model, extract estimates according to the chosen model. Updated parameter names from species to population in multi-individual models.
… have more error checking. Updated model_des function to have a switch that returns the chosen model function as well as the DEs directly.
…unctions. Updated data assignment testing to evaluate different combinations of user input.
@Tess-LaCoil Tess-LaCoil requested a review from dfalster August 14, 2024 05:21
@Tess-LaCoil
Copy link
Collaborator Author

Tests failed because of the load order of dplyr and stats producing warnings, see lines 70, 71 in the macos checks for an example.

@Tess-LaCoil
Copy link
Collaborator Author

I am testing whether removing stats from the imports and using importFrom for the quantile function in the extract_estimates code works to fix this.

…n extract_estimates so that is specifically imported alone. Hopefully this fixes the load order warnings.
…into function-update

Correcting conflict from other computer.
Copy link
Member

@dfalster dfalster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work here Tess!

I agree with removing stats from imports, much better to just call in specific functions than entire package.

R/hmde_assign_data.R Show resolved Hide resolved
@Tess-LaCoil Tess-LaCoil merged commit 5ed0ae0 into master Aug 15, 2024
4 checks passed
@Tess-LaCoil Tess-LaCoil deleted the function-update branch August 15, 2024 03:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants