Skip to content

Commit

Permalink
news
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Oct 21, 2024
1 parent 46bb1bb commit e4a077d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: insight
Title: Easy Access to Model Information for Various Model Objects
Version: 0.20.5.1
Version: 0.20.5.2
Authors@R:
c(person(given = "Daniel",
family = "Lüdecke",
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## General

* `get_transformation()` can now deal with any power-transformation.

* Updates `get_varcov()` (and related documentation) to support new covariance
matrix estimation methods from the **sandwich** package.

Expand Down
8 changes: 0 additions & 8 deletions R/get_transformation.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ get_transformation <- function(x, verbose = TRUE) {
} else if (transform_fun == "inverse") {
out <- list(transformation = function(x) 1 / x, inverse = function(x) x^-1)
} else if (transform_fun == "power") {
## TODO: detect power - can we turn this into a generic function?
trans_power <- .safe(gsub("\\(|\\)", "", gsub("(.*)(\\^|\\*\\*)\\s*(\\d+|[()])", "\\3", find_terms(x)[["response"]]))) # nolint
if (is.null(trans_power)) {
trans_power <- "2"
Expand All @@ -72,13 +71,6 @@ get_transformation <- function(x, verbose = TRUE) {
transformation = eval(parse(text = paste0("function(x) x^", as.character(as.numeric(trans_power))))), # nolint
inverse = eval(parse(text = paste0("function(x) x^(", as.character(as.numeric(trans_power)), "^-1)")))
)
# out <- switch(trans_power,
# `0.5` = list(transformation = function(x) x^0.5, inverse = function(x) x^2),
# `3` = list(transformation = function(x) x^3, inverse = function(x) x^(1 / 3)),
# `4` = list(transformation = function(x) x^4, inverse = function(x) x^0.25),
# `5` = list(transformation = function(x) x^5, inverse = function(x) x^0.2),
# list(transformation = function(x) x^2, inverse = sqrt)
# )
} else if (transform_fun == "expm1") {
out <- list(transformation = expm1, inverse = log1p)
} else if (transform_fun == "log-log") {
Expand Down

0 comments on commit e4a077d

Please sign in to comment.