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

- Use logSafe from utils package #1218

Merged
merged 1 commit into from
Mar 7, 2023
Merged

- Use logSafe from utils package #1218

merged 1 commit into from
Mar 7, 2023

Conversation

PavelBal
Copy link
Member

@PavelBal PavelBal commented Mar 7, 2023

- Calculate residuals using ln instead of log10
@PavelBal
Copy link
Member Author

PavelBal commented Mar 7, 2023

Natural logarithm is what expected by most people when calculating the residuals, so I guess it is safe to make this switch here.

expect_equal(calculateResiduals(myDC, scaling = "log")$residualValues,
c(0, 0.022276400, -0.007178578, 0.00000000, -0.010723855, -20),
expectedResiduals,
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to define expectedResiduals before using? Might have been left undefined.

Copy link
Member Author

Choose a reason for hiding this comment

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

Line 88 is defining the expected residuals, or what do you mean?

Copy link
Contributor

@Felixmil Felixmil Mar 7, 2023

Choose a reason for hiding this comment

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

Do we need to define expectedResiduals before using? Might have been left undefined.

possible but I think it's more clear like this. {testthat} will still give the details of which one is wrong (index and value):

> expected <- c(.001, 1, 4, 1e10^9)
> expect_equal(c(.001, 1, 3, 1e10^9), expected)
Error: c(0.001, 1, 3, 1e+10^9) not equal to `expected`.
1/4 mismatches
[3] 3 - 4 == -1

@PavelBal
Copy link
Member Author

PavelBal commented Mar 7, 2023

@Yuri05 Would like to have your "go" on this before merging.

@PavelBal PavelBal merged commit c560d35 into develop Mar 7, 2023
@PavelBal PavelBal deleted the log-safe-from-utils branch March 7, 2023 16:06
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.

Residual calculation
4 participants