Skip to content

Commit 5588d90

Browse files
author
OVVO-Financial
committed
NNS 10.9.6 Beta
1 parent 1bf222b commit 5588d90

14 files changed

+251
-244
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: NNS
22
Type: Package
33
Title: Nonlinear Nonparametric Statistics
4-
Version: 10.9.5
4+
Version: 10.9.6
55
Date: 2024-12-16
66
Authors@R: c(
77
person("Fred", "Viole", role=c("aut","cre"), email="[email protected]"),

NNS_10.9.5.tar.gz

-1.24 MB
Binary file not shown.

NNS_10.9.5.zip

-845 KB
Binary file not shown.

NNS_10.9.6.tar.gz

1.17 MB
Binary file not shown.

NNS_10.9.6.zip

845 KB
Binary file not shown.

R/NNS_MC.R

+15-12
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#' @examples
2828
#' \dontrun{
2929
#' # To generate a set of MC sampled time-series to AirPassengers
30-
#' MC_samples <- NNS.MC(AirPassengers, xmin = 0)
30+
#' MC_samples <- NNS.MC(AirPassengers, reps = 10, lower_rho = -1, upper_rho = 1, by = .5, xmin = 0)
3131
#' }
3232
#' @export
3333

@@ -49,22 +49,25 @@ NNS.MC <- function(x,
4949
rhos <- seq(lower_rho, upper_rho, by)
5050
l <- length(rhos)
5151

52-
neg_rhos <- abs(rhos[rhos<0])
52+
neg_rhos <- abs(rhos[rhos<=0])
5353
pos_rhos <- rhos[rhos>0]
5454

5555
exp_rhos <- rev(c((neg_rhos^exp)*-1, pos_rhos^(1/exp)))
56-
56+
5757
if(is.null(target_drift)){
58-
n <- length(x)
59-
orig_coef <- fast_lm(1:n, x)$coef
60-
orig_intercept <- orig_coef[1]
61-
orig_drift <- orig_coef[2]
62-
target_drift <- orig_drift
58+
if(!is.null(target_drift_scale)){
59+
replicates <- NNS.meboot(x = x, reps = reps, rho = exp_rhos, type = type, drift = TRUE,
60+
target_drift_scale = target_drift_scale,
61+
xmin = xmin, xmax = xmax, ...)["replicates",]
62+
} else {
63+
replicates <- NNS.meboot(x = x, reps = reps, rho = exp_rhos, type = type, drift = drift,
64+
xmin = xmin, xmax = xmax, ...)["replicates",]
65+
}
66+
} else {
67+
replicates <- NNS.meboot(x = x, reps = reps, rho = exp_rhos, type = type, drift = TRUE,
68+
target_drift = target_drift,
69+
xmin = xmin, xmax = xmax, ...)["replicates",]
6370
}
64-
65-
66-
replicates <- suppressWarnings(NNS.meboot(x = x, reps = reps, rho = exp_rhos, type = type, drift = drift,
67-
target_drift = target_drift, target_drift_scale = target_drift_scale, xmin = xmin, xmax = xmax, ...))["replicates",]
6871

6972

7073
ensemble <- Rfast::rowmeans(do.call(cbind, replicates))

0 commit comments

Comments
 (0)