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

find_transformation incorrectly detects power transformations #813

Merged
merged 8 commits into from
Sep 26, 2023

Conversation

strengejacke
Copy link
Member

Fixes #812

@codecov
Copy link

codecov bot commented Sep 26, 2023

Codecov Report

Merging #813 (ca31179) into main (6e78a4b) will decrease coverage by 0.04%.
Report is 16 commits behind head on main.
The diff coverage is 50.46%.

❗ Current head ca31179 differs from pull request most recent head f6b6940. Consider uploading reports for the commit f6b6940 to get more accurate results

@@            Coverage Diff             @@
##             main     #813      +/-   ##
==========================================
- Coverage   54.57%   54.53%   -0.04%     
==========================================
  Files         124      124              
  Lines       15249    15291      +42     
==========================================
+ Hits         8322     8339      +17     
- Misses       6927     6952      +25     
Files Coverage Δ
R/all_equal_models.R 96.42% <ø> (ø)
R/check_if_installed.R 73.97% <ø> (ø)
R/clean_names.R 81.39% <ø> (ø)
R/clean_parameters.R 63.68% <ø> (ø)
R/find_interactions.R 88.46% <ø> (ø)
R/find_offset.R 100.00% <ø> (ø)
R/find_parameter_zi.R 28.20% <ø> (ø)
R/find_parameters_gam.R 83.09% <ø> (ø)
R/find_parameters_mfx.R 0.00% <ø> (ø)
R/find_parameters_other.R 22.72% <ø> (ø)
... and 68 more

@bwiernik
Copy link
Contributor

The regex should also accommodate:

  1. Decimal exponents
  2. Using ** instead of ^

@strengejacke
Copy link
Member Author

strengejacke commented Sep 26, 2023

Should work.

@bwiernik @bbolker is it even possible to return the power as function? See:

} else if (transform_fun == "power") {

Currently, get_transformation() for power returns:

list(transformation = function(x) x^2, inverse = sqrt)

@strengejacke strengejacke merged commit 0ef5213 into main Sep 26, 2023
23 of 25 checks passed
@strengejacke strengejacke deleted the strengejacke/issue812 branch September 26, 2023 22:06
@bwiernik
Copy link
Contributor

bwiernik commented Sep 27, 2023

list(
  transformation = function(x, power) x^power, 
  inverse = function(x, power) x^(1/power)
)

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.

find_transformation incorrectly detects power transformations
2 participants