From 6c6802dc1aaadbe307f8576a41c45e7f3c3026a1 Mon Sep 17 00:00:00 2001 From: David Widmann Date: Sun, 10 May 2020 02:12:20 +0200 Subject: [PATCH 1/2] Use UnPack --- Project.toml | 4 ++-- src/CalibrationTests.jl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 6d3a96b..e9f226a 100644 --- a/Project.toml +++ b/Project.toml @@ -7,18 +7,18 @@ version = "0.4.0" CalibrationErrors = "33913031-fe46-5864-950f-100836f47845" HypothesisTests = "09f84164-cd44-5f33-b23f-e6b0d136a0d5" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" -Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" StatsFuns = "4c63d2b9-4356-54db-8cca-17b64c39e42c" +UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed" [compat] CalibrationErrors = "0.5" HypothesisTests = "0.8, 0.9, 0.10" -Parameters = "0.12" StatsBase = "0.32, 0.33" StatsFuns = "0.8, 0.9" +UnPack = "0.1, 1" julia = "1.1" [extras] diff --git a/src/CalibrationTests.jl b/src/CalibrationTests.jl index 6f16ce6..10c3f15 100644 --- a/src/CalibrationTests.jl +++ b/src/CalibrationTests.jl @@ -2,7 +2,7 @@ module CalibrationTests using CalibrationErrors using HypothesisTests -using Parameters +using UnPack using StatsBase using StatsFuns From 25e4bb98aa2e1156eb7b02579564583ea6b59719 Mon Sep 17 00:00:00 2001 From: David Widmann Date: Sun, 10 May 2020 02:12:46 +0200 Subject: [PATCH 2/2] Use sample covariance matrix --- src/skce/asymptotic_block.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/skce/asymptotic_block.jl b/src/skce/asymptotic_block.jl index d38cd92..c58edc4 100644 --- a/src/skce/asymptotic_block.jl +++ b/src/skce/asymptotic_block.jl @@ -35,6 +35,7 @@ function AsymptoticBlockSKCETest(kernel::Kernel, blocksize::Int, data...) # compute number of blocks nblocks = nsamples ÷ blocksize + nblocks ≥ 2 || error("there must be at least 2 blocks") # evaluate U-statistic of the first block istart = 1 @@ -43,7 +44,7 @@ function AsymptoticBlockSKCETest(kernel::Kernel, blocksize::Int, data...) # initialize the estimate and the sum of squares estimate = x / 1 - S = zero(x) + S = zero(estimate)^2 # for all other blocks for b in 2:nblocks @@ -60,7 +61,7 @@ function AsymptoticBlockSKCETest(kernel::Kernel, blocksize::Int, data...) end # compute standard error and z-statistic - stderr = sqrt(S) / nblocks + stderr = sqrt(S / (nblocks * (nblocks - 1))) z = estimate / stderr return AsymptoticBlockSKCETest(kernel, blocksize, nblocks, estimate, stderr, z)