Skip to content

Commit 7f8b0a7

Browse files
fix: closes #212
1 parent 0e37a28 commit 7f8b0a7

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

NEWS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# olsrr 0.6.1.9000
22

3+
## Bug Fixes
4+
5+
- `ols_step_best_subset()` unable to force more than one variable in selection process ([#210](https://github.com/rsquaredacademy/olsrr/issues/210))
6+
- `plot()` with `ols_step_both_aic()` doesn't show anything when AIC values are negative ([#212](https://github.com/rsquaredacademy/olsrr/issues/212))
7+
38
# olsrr 0.6.1
49

510
This is a patch release for urgent bug fixes.

R/ols-stepwise-utils.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,13 @@ ols_stepwise_plot_data <- function(x, pred, metric = "r2") {
346346
aic <- x$metrics[[metric]]
347347
xmin <- 0
348348
xmax <- max(step) + 1
349-
ymin <- min(aic) - (min(aic) * 0.05)
350-
ymax <- max(aic) + (max(aic) * 0.05)
349+
if (min(aic) < 0) {
350+
ymin <- min(aic) + (min(aic) * 0.05)
351+
ymax <- max(aic) - (max(aic) * 0.05)
352+
} else {
353+
ymin <- min(aic) - (min(aic) * 0.05)
354+
ymax <- max(aic) + (max(aic) * 0.05)
355+
}
351356
d2 <- data.frame(x = step, y = aic, tx = pred)
352357
d <- data.frame(a = step, b = aic)
353358

0 commit comments

Comments
 (0)