-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hyndman-suggestions' into develop
* hyndman-suggestions: Updated NEWS.md Refactoring Increment version number to 1.0.0.9001 Added TODOs Updated docs Implemented faster `chackoStatistic()` Improved validation of `x`
- Loading branch information
Showing
7 changed files
with
17 additions
and
17 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
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
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
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 |
---|---|---|
@@ -1,10 +1,8 @@ | ||
chackoStatistic <- function(x_t, n, k) { | ||
x_bar <- x_t[, "x"] | ||
t <- x_t[, "t"] | ||
m <- length(unique(x_bar)) | ||
power_sum <- 0 | ||
for (j in seq_len(m)) { | ||
power_sum <- power_sum + t[[j]] * (x_bar[[j]] - n / k) ^ 2 | ||
} | ||
return(k / n * power_sum) | ||
chackoStatistic <- function(x_t, n, k, uniqueness_method = 1) { | ||
m <- length(unique(x_t[, "x"])) # TODO: check what Chacko really means by m | ||
x_t_unique <- switch(uniqueness_method, | ||
x_t[seq_len(m), , drop = FALSE], # current implementation | ||
x_t[!duplicated(x_t[, "x"]), , drop = FALSE], # new idea (hidden) | ||
) | ||
k / n * sum(x_t_unique[, "t"] * (x_t_unique[, "x"] - n / k) ^ 2) | ||
} |
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 |
---|---|---|
@@ -1,7 +1,4 @@ | ||
#' @keywords internal | ||
#' @aliases permChacko-package | ||
#' @importFrom methods is | ||
"_PACKAGE" | ||
|
||
## usethis namespace: start | ||
## usethis namespace: end | ||
NULL |
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
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