Skip to content

Commit 3c00179

Browse files
committed
update
1 parent dd66e3a commit 3c00179

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

R/ortensor.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ ortensor.default <- function(x, norm = TRUE, w = NULL, shift = NULL) {
9090
} else {
9191
n <- 1
9292
}
93+
xw <- w * x
9394

94-
or <- (1 / n) * (t(x) %*% x)
95+
or <- (1 / n) * (t(xw) %*% xw)
9596
# or <- matrix(nrow = 3, ncol = 3)
9697
# or[1, 1] <- sum(x[, 1]^2)
9798
# or[1, 2] <- sum(x[, 1] * x[, 2])

R/vector_stats.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,12 @@ delta <- function(x, w = NULL, na.rm = TRUE) {
301301
}
302302

303303
#' @rdname stats
304+
#' @param p integer. Number of parameters in the data space (2 for circle, 3 for a sphere)
304305
#' @export
305-
estimate_k <- function(x, w = NULL, na.rm = FALSE) {
306+
estimate_k <- function(x, w = NULL, na.rm = FALSE, p = 3) {
306307
Rbar <- vresultant(Vec3(x), w = w, mean = TRUE, na.rm = na.rm) |>
307308
vlength()
308309

309-
p <- 3
310-
311310
(Rbar * (p - Rbar^2)) / (1 - Rbar^2)
312311
}
313312

man/stats.Rd

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)