Skip to content

Commit

Permalink
clean up the presentation of unconditional
Browse files Browse the repository at this point in the history
  • Loading branch information
palday committed Aug 31, 2023
1 parent 29731f4 commit 9806c67
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[deps]
BoxCox = "1248164d-f7a6-4bdb-8e8d-8c4a187b3ce6"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Expand Down
34 changes: 14 additions & 20 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,17 @@ We start with the square root of a normal distribution.
using BoxCox
using CairoMakie
using Random
CairoMakie.activate!(; type="svg")
x = abs2.(randn(MersenneTwister(42), 1000))
let f = Figure(; resolution=(400, 400))
let f = Figure()
ax = Axis(f[1,1]; xlabel="x", ylabel="density")
density!(ax, x)
f
end
```

```@example Unconditional
let f = Figure(; resolution=(400, 400))
ax = Axis(f[1,1]; xlabel="theoretical", ylabel="observed")
ax = Axis(f[1,2]; xlabel="theoretical quantiles", ylabel="observed values")
qqnorm!(ax, x)
colsize!(f.layout, 1, Aspect(1, 1.0))
colsize!(f.layout, 2, Aspect(1, 1.0))
resize_to_layout!(f)
f
end
```
Expand All @@ -44,19 +43,14 @@ Note that the resulting transform isn't exactly a square root, even though our d
Now that we've fit the transform, we use it like a function to transform the original data.

```@example Unconditional
let f = Figure(; resolution=(400, 400))
let f = Figure(), bcx = bc.(x)
ax = Axis(f[1,1]; xlabel="x", ylabel="density")
density!(ax, bc.(x))
f
end
```

There is also a special method for `qqnorm` provided for objects of type `BoxCoxTransformation`, which shows the QQ plot of the transformation applied to the original data.

```@example Unconditional
let f = Figure(; resolution=(400, 400))
ax = Axis(f[1,1]; xlabel="theoretical", ylabel="observed")
qqnorm!(ax, bc)
density!(ax, bcx)
ax = Axis(f[1,2]; xlabel="theoretical quantiles", ylabel="observed values")
qqnorm!(ax, bcx; qqline=:fitrobust)
colsize!(f.layout, 1, Aspect(1, 1.0))
colsize!(f.layout, 2, Aspect(1, 1.0))
resize_to_layout!(f)
f
end
```
Expand Down

0 comments on commit 9806c67

Please sign in to comment.