-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a81c92c
commit c66b8f1
Showing
4 changed files
with
29 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,13 @@ | |
#' or exp-transforming, was applied to the response variable (dependent | ||
#' variable) in a regression formula. Currently, following patterns are | ||
#' detected: `log`, `log1p`, `log2`, `log10`, `exp`, `expm1`, `sqrt`, | ||
#' `log(x+<number>)` and `log-log`. | ||
#' `log(x+<number>)`, `log-log` and `power` (to 2nd power, like `I(x^2)`). | ||
#' | ||
#' @param x A regression model. | ||
#' @return A string, with the name of the function of the applied transformation. | ||
#' Returns `"identity"` for no transformation, and e.g. `"log(x+3)"` when | ||
#' a specific values was added to the response variables before | ||
#' log-transforming. | ||
#' log-transforming. For unknown transformations, returns `NULL`. | ||
#' | ||
#' @examples | ||
#' # identity, no transformation | ||
|
@@ -91,5 +91,19 @@ find_transformation <- function(x) { | |
} | ||
} | ||
|
||
|
||
# (unknown) I-transformation | ||
|
||
if (any(grepl("I\\((.*)\\)", rv))) { | ||
transform_fun <- NULL | ||
} | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
strengejacke
Author
Member
|
||
|
||
|
||
# power-transformation | ||
|
||
if (any(grepl("I\\((.*)\\^\\s*2\\)", rv))) { | ||
transform_fun <- "power" | ||
} | ||
|
||
transform_fun | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Can this include some sort of catch all?
What would
foo(y) ~ 1
return?