Skip to content

Commit 5f295ad

Browse files
author
OVVO-Financial
committed
NNS 11.1 Beta
1 parent b2a7692 commit 5f295ad

File tree

6 files changed

+21
-22
lines changed

6 files changed

+21
-22
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Package: NNS
22
Type: Package
33
Title: Nonlinear Nonparametric Statistics
44
Version: 11.1
5-
Date: 2025-02-16
5+
Date: 2025-02-17
66
Authors@R: c(
77
person("Fred", "Viole", role=c("aut","cre"), email="[email protected]"),
88
person("Roberto", "Spadim", role=c("ctb"))

NNS_11.1.tar.gz

5 Bytes
Binary file not shown.

NNS_11.1.zip

95 Bytes
Binary file not shown.

R/Causation.R

+6-7
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ NNS.caus <- function(x, y = NULL,
7474
Causation.x.given.y[is.na(Causation.x.given.y)] <- 0
7575
Causation.y.given.x[is.na(Causation.y.given.x)] <- 0
7676

77-
if(Causation.x.given.y == Causation.y.given.x |
78-
Causation.x.given.y == 0 | Causation.y.given.x == 0){
77+
if(Causation.x.given.y == Causation.y.given.x ||
78+
Causation.x.given.y == 0 || Causation.y.given.x == 0){
7979
Causation.x.given.y <- Uni.caus(x, y, tau = tau, plot = FALSE)
8080
Causation.y.given.x <- Uni.caus(y, x, tau = tau, plot = FALSE)
8181
Causation.x.given.y[is.na(Causation.x.given.y)] <- 0
@@ -90,8 +90,8 @@ NNS.caus <- function(x, y = NULL,
9090
Causation.x.given.y[is.na(Causation.x.given.y)] <- 0
9191
Causation.y.given.x[is.na(Causation.y.given.x)] <- 0
9292

93-
if(Causation.x.given.y == Causation.y.given.x |
94-
Causation.x.given.y == 0 | Causation.y.given.x == 0){
93+
if(Causation.x.given.y == Causation.y.given.x ||
94+
Causation.x.given.y == 0 || Causation.y.given.x == 0){
9595
Causation.x.given.y <- Uni.caus(x, y, tau = 0, plot = FALSE)
9696
Causation.y.given.x <- Uni.caus(y, x, tau = 0, plot = FALSE)
9797

@@ -121,19 +121,18 @@ NNS.caus <- function(x, y = NULL,
121121
}
122122
return(c(Causation.x.given.y = Causation.x.given.y,
123123
Causation.y.given.x = Causation.y.given.x,
124-
"C(x--->y)" = sign(Causation.y.given.x) * (abs(Causation.y.given.x) - abs(Causation.x.given.y))))
124+
"C(x--->y)" = sign(Causation.y.given.x) * (abs(Causation.y.given.x - Causation.x.given.y)/2)))
125125
} else {
126126
if(plot){
127127
# For plotting only
128128
if(tau == "cs") tau <- 0
129-
130129
if(tau == "ts") tau <- 3
131130

132131
Uni.caus(x, y, tau = tau, plot = plot)
133132
}
134133
return(c(Causation.x.given.y = Causation.x.given.y,
135134
Causation.y.given.x = Causation.y.given.x,
136-
"C(y--->x)" = sign(Causation.x.given.y) * (abs(Causation.x.given.y) - abs(Causation.y.given.x))))
135+
"C(y--->x)" = sign(Causation.x.given.y) * (abs(Causation.x.given.y - Causation.y.given.x)/2)))
137136
}
138137

139138

R/Numerical_Differentiation.R

+14-14
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ NNS.diff <- function(f, point, h = 0.1, tol = 1e-10, digits = 12, print.trace =
8080
if(lower.B == upper.B){
8181
original.par=par(no.readonly = TRUE)
8282
par(mfrow = c(1, 2))
83-
plot(f, xlim = c(point - (100 * h), point + (100 * h)), col = 'blue', ylab = 'f(x)')
83+
plot(f, xlim = c(point - (100 * h), point + (100 * h)), col = 'steelblue', ylab = 'f(x)')
8484
points(point, f.x, pch = 19, col = 'red')
85-
plot(f, xlim = c(point - 1, point + 1), col = 'blue', ylab = 'f(x)')
85+
plot(f, xlim = c(point - 1, point + 1), col = 'steelblue', ylab = 'f(x)')
8686
points(point, f.x, pch = 19, col = 'red')
8787
par(original.par)
8888

@@ -120,31 +120,31 @@ NNS.diff <- function(f, point, h = 0.1, tol = 1e-10, digits = 12, print.trace =
120120
plot(f, xlim = c(min(c(point - (100 * h), point + (100 * h)), 0), max(c(point - (100 * h), point + (100 * h)), 0)), col = 'azure4', ylab = 'f(x)', lwd = 2, ylim = c(min(c(min(c(B1, B2)), min(na.omit(f((point - (100 * h)) : (point + (100 * h))))))), max(c(max(na.omit(f((point - (100 * h)) : (point + (100 * h))))), max(c(B1, B2))))), main = 'f(x) and initial y-intercept range')
121121
abline(h = 0, v = 0, col = 'grey')
122122
points(point, f.x, pch = 19, col = 'green')
123-
points(point - h, f.x.h.lower, col = ifelse(B1 == high.B, 'blue', 'red'), pch = 19)
124-
points(point + h, f.x.h.upper, col = ifelse(B1 == high.B, 'red', 'blue'), pch = 19)
125-
points(x = rep(0, 2), y = c(B1, B2), col = c(ifelse(B1 == high.B, 'blue', 'red'), ifelse(B1 == high.B, 'red', 'blue')), pch = 1)
126-
segments(0, B1, point - h, f.x.h.lower, col = ifelse(B1 == high.B, 'blue','red'), lty = 2)
127-
segments(0, B2, point + h, f.x.h.upper, col = ifelse(B1 == high.B, 'red','blue'), lty = 2)
123+
points(point - h, f.x.h.lower, col = ifelse(B1 == high.B, 'steelblue', 'red'), pch = 19)
124+
points(point + h, f.x.h.upper, col = ifelse(B1 == high.B, 'red', 'steelblue'), pch = 19)
125+
points(x = rep(0, 2), y = c(B1, B2), col = c(ifelse(B1 == high.B, 'steelblue', 'red'), ifelse(B1 == high.B, 'red', 'steelblue')), pch = 1)
126+
segments(0, B1, point - h, f.x.h.lower, col = ifelse(B1 == high.B, 'steelblue','red'), lty = 2)
127+
segments(0, B2, point + h, f.x.h.upper, col = ifelse(B1 == high.B, 'red','steelblue'), lty = 2)
128128

129129
## Plot #2
130130
plot(f, col = 'azure4', ylab = 'f(x)', lwd = 3, main = 'f(x) narrowed range and secant lines', xlim = c(min(c(point - h, point + h, 0)), max(c(point + h,point - h, 0))), ylim= c(min(c(B1, B2, f.x.h.lower, f.x.h.upper)), max(c(B1, B2, f.x.h.lower, f.x.h.upper))))
131131

132132
abline(h = 0, v = 0, col = 'grey')
133133
points(point,f.x, pch = 19, col = 'red')
134-
points(point - h, f.x.h.lower, col = ifelse(B1 == high.B, 'blue', 'red'), pch = 19)
135-
points(point + h, f.x.h.upper, col = ifelse(B1 == high.B, 'red', 'blue'), pch = 19)
134+
points(point - h, f.x.h.lower, col = ifelse(B1 == high.B, 'steelblue', 'red'), pch = 19)
135+
points(point + h, f.x.h.upper, col = ifelse(B1 == high.B, 'red', 'steelblue'), pch = 19)
136136
points(point, f.x, pch = 19, col = 'green')
137-
segments(0, B1, point - h, f.x.h.lower, col = ifelse(B1 == high.B, 'blue', 'red'), lty = 2)
138-
segments(0, B2, point + h, f.x.h.upper, col = ifelse(B1 == high.B, 'red', 'blue'), lty = 2)
139-
points(x = rep(0, 2), y = c(B1, B2), col = c(ifelse(B1 == high.B, 'blue', 'red'), ifelse(B1 == high.B, 'red', 'blue')), pch = 1)
137+
segments(0, B1, point - h, f.x.h.lower, col = ifelse(B1 == high.B, 'steelblue', 'red'), lty = 2)
138+
segments(0, B2, point + h, f.x.h.upper, col = ifelse(B1 == high.B, 'red', 'steelblue'), lty = 2)
139+
points(x = rep(0, 2), y = c(B1, B2), col = c(ifelse(B1 == high.B, 'steelblue', 'red'), ifelse(B1 == high.B, 'red', 'steelblue')), pch = 1)
140140

141141

142142
## Plot #3
143143
plot(Bs, ylim = c(min(c(Bl, Bu)), max(c(Bl, Bu))), xlab = "Iterations", ylab = "y-inetercept", col = 'green', pch = 19, main = 'Iterated range of y-intercept')
144144
points(Bl, col = 'red', ylab = '')
145-
points(Bu, col = 'blue', ylab = '')
145+
points(Bu, col = 'steelblue', ylab = '')
146146

147-
legend('topright', c("Upper y-intercept", "Lower y-intercept", "Mean y-intercept"), col = c('blue', 'red', 'green'), pch = c(1, 1, 19), bty = 'n')
147+
legend('topright', c("Upper y-intercept", "Lower y-intercept", "Mean y-intercept"), col = c('steelblue', 'red', 'green'), pch = c(1, 1, 19), bty = 'n')
148148

149149
par(original.par)
150150

src/NNS.dll

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)