Skip to content

Commit 6224da7

Browse files
author
Ander Gray
committed
updates arithmetic documentation
1 parent 100dfc1 commit 6224da7

File tree

7 files changed

+46
-7
lines changed

7 files changed

+46
-7
lines changed

docs/src/arithmetic.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,34 @@ julia> convOpposite(a, b, op = *)
9797
Binary operations with a specified correlation coefficient may also be performed:
9898

9999
```julia
100-
julia> a = normal(0,1);
101-
julia> b = normal(1,1);
102-
julia> conv(a,b, op = +, corr = 0.5)
103-
Pbox: ~ ( range=[-5.18046,7.18046], mean=1.0, var=[2.57835,3.96457])
100+
julia> conv(a, b, op = *, corr = -0.5)
101+
Pbox: ~ ( range=[6.9098, 26.18], mean=15.0, var=[5.5032, 7.9116])
102+
103+
julia> conv(a, b, op = *, corr = 0.5)
104+
Pbox: ~ ( range=[6.9098, 26.18], mean=15.0, var=[12.985, 16.804])
105+
```
106+
```@raw html
107+
<img src="./plots/prodCor1.png" width="49.5%"/>
108+
<img src="./plots/prodCor2.png" width="49.5%"/>
104109
```
110+
105111
This assumes that a and b follow a Gaussian Copula. You may however perform the operation with any copula by using the function
106112
```julia
107-
julia> convCorr(a, b, C = C, op = +)
113+
julia> C1 = clayton(5)
114+
julia> convCorr(a, b, op = *, C = C1)
115+
Pbox: ~ ( range=[6.9098, 26.18], mean=[15.024, 15.473], var=[15.738, 19.714])
116+
117+
julia> C2 = Frank(-2)
118+
julia> convCorr(a, b, op = *, C = C2)
119+
Pbox: ~ ( range=[6.9098, 26.18], mean=15.0, var=[6.78, 9.5713])
108120
```
109121
where C is a copula (see section on dependence modelling).
110122

123+
```@raw html
124+
<img src="./plots/prodCop1.png" width="49.5%"/>
125+
<img src="./plots/prodCop2.png" width="49.5%"/>
126+
```
127+
111128
Note that:
112129

113130
```julia

docs/src/plots/make_arithmetic_plots.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,23 @@ savefig("sumOpposite.png")
4141
plot(convOpposite(a, b, op = *), fontsize = 22)
4242
PyPlot.xlabel("a * b (opposite)", fontsize = 26)
4343
savefig("prodOpposite.png")
44+
45+
46+
plot(conv(a, b, op = *, corr = -0.5), fontsize = 22)
47+
PyPlot.xlabel("a * b (r = -0.5)", fontsize = 26)
48+
savefig("prodCor1.png")
49+
50+
plot(conv(a, b, op = *, corr = 0.5), fontsize = 22)
51+
PyPlot.xlabel("a * b (r = 0.5)", fontsize = 26)
52+
savefig("prodCor2.png")
53+
54+
C1 = Clayton(5)
55+
C2 = Frank(-2)
56+
57+
plot(convCorr(a, b, op = *, C = C1), fontsize = 22)
58+
PyPlot.xlabel("a * b (C = Clayton(5))", fontsize = 26)
59+
savefig("prodCop1.png")
60+
61+
plot(convCorr(a, b, op = *, C = C2), fontsize = 22)
62+
PyPlot.xlabel("a * b (C = Frank(-2))", fontsize = 26)
63+
savefig("prodCop2.png")

docs/src/plots/prodCop1.png

43.5 KB
Loading

docs/src/plots/prodCop2.png

41.2 KB
Loading

docs/src/plots/prodCor1.png

39.2 KB
Loading

docs/src/plots/prodCor2.png

40.4 KB
Loading

docs/src/sets.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,5 +171,7 @@ julia> plot(a, name = "ab", col = "red", fontsize = 22)
171171
julia> plot(b, name = "ab", col = "blue", fontsize = 22)
172172
julia> plot(c, fontsize = 22)
173173
```
174-
!["envelope of an interval and a gaussian"](./plots/intersection1.png)
175-
!["envelope of an interval and a gaussian"](./plots/intersection2.png)
174+
```@raw html
175+
<img src="./plots/intersection1.png" width="49.5%"/>
176+
<img src="./plots/intersection2.png" width="49.5%"/>
177+
```

0 commit comments

Comments
 (0)