deviance(setβ!(com05fe, β₀))
2491.1514390537254
+2491.151439053725
diff --git a/.nojekyll b/.nojekyll index a024cc2..e0e37b5 100644 --- a/.nojekyll +++ b/.nojekyll @@ -1 +1 @@ -2cf701c9 \ No newline at end of file +66a04540 \ No newline at end of file diff --git a/aGHQ.html b/aGHQ.html index 14f1e15..f9b9733 100644 --- a/aGHQ.html +++ b/aGHQ.html @@ -2,7 +2,7 @@
- + @@ -507,12 +507,12 @@βm05 = copy(com05.β)
6-element Vector{Float64}:
- -0.3414913998306781
- 0.3936080536502067
- 0.6064861079468472
- -0.012911714642169572
- 0.03321662487439253
- -0.005625046845040066
+ -0.3414675499274024
+ 0.3936022945891755
+ 0.6064521635960723
+ -0.01291017393458232
+ 0.03321086562324279
+ -0.00562465124007457
As stated above, the meanunitdev
function can be applied to the vectors, \({\mathbf{y}}\) and \({{\boldsymbol{\eta}}}\), via dot-vectorization to produce a Vector{NamedTuple}
, which is the typical form of a row-table.
sum(r.dev for r in rowtbl)
2411.194470806229
+2411.1933707496587
deviance(setβ!(com05fe, βm05))
2411.194470806229
+2411.1933707496587
For fairness in later comparisons we restore the initial values β₀
to the model. These are rough starting estimates with a deviance that is considerably greater than that at βm05
.
deviance(setβ!(com05fe, β₀))
2491.1514390537254
+2491.151439053725
fit!(com05fe);
[ Info: (code = :ROUNDOFF_LIMITED, nevals = 558, minf = 2409.377428160017)
+[ Info: (code = :ROUNDOFF_LIMITED, nevals = 535, minf = 2409.377428160018)
The optimizer has determined a coefficient vector that reduces the deviance to 2409.38, at which point convergence was declared because changes in the objective are limited by round-off. This required about 500 evaluations of the deviance at candidate values of \({\boldsymbol{\beta}}\).
@@ -680,13 +680,13 @@BenchmarkTools.Trial: 10000 samples with 1 evaluation.
- Range (min … max): 33.798 μs … 113.439 μs ┊ GC (min … max): 0.00% … 0.00%
- Time (median): 36.778 μs ┊ GC (median): 0.00%
- Time (mean ± σ): 36.707 μs ± 1.706 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
+ Range (min … max): 34.239 μs … 79.352 μs ┊ GC (min … max): 0.00% … 0.00%
+ Time (median): 35.081 μs ┊ GC (median): 0.00%
+ Time (mean ± σ): 35.674 μs ± 3.225 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
- ▂ ▁ ▁▃▆▂ ▄▇█▂ ▁▁ ▂
- ▆█▇▁▁▁▁▁▆▇█▅▄▁▃▄▃████▄▁▁▃▃▅████▇▅▄▆▅▄▆▆███▇▅▆▅▅▅▃▁▄▄▃▃▃▄▅▅▆▆ █
- 33.8 μs Histogram: log(frequency) by time 40 μs <
+ ▅▁█▅▂ ▁
+ █████▇▇▇███▇▇███▇▇▆▇▆▆▆▆▆▆▅▆▆▅▅▅▅▄▃▄▅▄▅▃▃▁▁▃▄▄▅▇▆▆▆▃▄▁▃▃▄▅▅ █
+ 34.2 μs Histogram: log(frequency) by time 53.1 μs <
Memory estimate: 16 bytes, allocs estimate: 1.
fit!(com05fe, β₀);
[ Info: (0, 2491.1514390537254)
-[ Info: (1, 2411.165742459929)
+[ Info: (1, 2411.1657424599293)
[ Info: (2, 2409.382451337132)
-[ Info: (3, 2409.3774282835857)
+[ Info: (3, 2409.377428283585)
[ Info: (4, 2409.3774281600413)
@benchmark deviance(updateβ!(m)) seconds = 1 setup = (m = com05fe)
BenchmarkTools.Trial: 10000 samples with 1 evaluation.
- Range (min … max): 67.528 μs … 161.118 μs ┊ GC (min … max): 0.00% … 0.00%
- Time (median): 76.638 μs ┊ GC (median): 0.00%
- Time (mean ± σ): 76.986 μs ± 2.640 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
+BenchmarkTools.Trial: 7372 samples with 1 evaluation.
+ Range (min … max): 126.577 μs … 294.077 μs ┊ GC (min … max): 0.00% … 0.00%
+ Time (median): 130.825 μs ┊ GC (median): 0.00%
+ Time (mean ± σ): 133.084 μs ± 12.228 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
- ▂▂▂▄▅▅▄▇██▆▅▄▄▅▅▄▃▂▂▂▂▂▁▁▁ ▂
- ▅▅▆▆▇▇▇▆▆▆▆▆▆▆▅▆▇▇▇██▇██████████████████████████████▇▇▇▇▇▇▇▇ █
- 67.5 μs Histogram: log(frequency) by time 84.5 μs <
+ ▇▇▇▆█▇▄▄▃▂▂▁ ▂
+ ██████████████▇█▇▇▇▇▇▇▆▆▅▅▆▆▆▆▂▅▄▅▄▅▆▅▆▆▅▅▆▅▇▅▅▆▆▅▅▅▆▆▆▄▅▄▄▅▄ █
+ 127 μs Histogram: log(frequency) by time 189 μs <
Memory estimate: 16.12 KiB, allocs estimate: 6.
m = BernoulliPIRLS(com05.X, com05.y, only(com05.reterms).refs)
pdeviance(m)
2409.377428160041
+2409.3774281600413
As with IRLS, the first iteration of PIRLS reduces the objective, which is the penalized deviance in this case, substantially.
pdeviance(updateu!(m))
2233.1209476357844
+2233.1209476357853
Create a pirls!
method for this struct.
pirls!(m; verbose=true);
[ Info: (0, 2409.377428160041)
-[ Info: (1, 2233.1209476357844)
-[ Info: (2, 2231.605935279706)
+[ Info: (0, 2409.3774281600413)
+[ Info: (1, 2233.1209476357853)
+[ Info: (2, 2231.6059352797065)
[ Info: (3, 2231.6002198321576)
[ Info: (4, 2231.600219406561)
@benchmark pirls!(mm) seconds = 1 setup = (mm = m)
BenchmarkTools.Trial: 4402 samples with 1 evaluation.
- Range (min … max): 199.693 μs … 331.599 μs ┊ GC (min … max): 0.00% … 0.00%
- Time (median): 227.186 μs ┊ GC (median): 0.00%
- Time (mean ± σ): 226.091 μs ± 5.569 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
+BenchmarkTools.Trial: 3848 samples with 1 evaluation.
+ Range (min … max): 237.623 μs … 461.619 μs ┊ GC (min … max): 0.00% … 0.00%
+ Time (median): 243.844 μs ┊ GC (median): 0.00%
+ Time (mean ± σ): 257.466 μs ± 31.167 μs ┊ GC (mean ± σ): 0.00% ± 0.00%
- ▁ ▇█
- ▂▂▂▂▁▂▂▂▂▂▂▂▂▂▂▁▁▂▂▂▁▂▁▂▂▁▁▂▂▂▂▁▂▁▁▁▁▄█▄▄▃▂▃▃▃▃▃██▇▆▃▃▅▄▃▂▂▂▂ ▃
- 200 μs Histogram: frequency by time 234 μs <
+ ▅▁█▆▃ ▁ ▁▁ ▁ ▁
+ ██████▇██▇████████████▇▇▆▇▆▆▅▆▆▅▅▅▅▆▅▆▅▅▆▅▅█▇▇█▆▅▂▄▃▅▅▄▄▄▃▅▄▄ █
+ 238 μs Histogram: log(frequency) by time 383 μs <
Memory estimate: 112 bytes, allocs estimate: 1.
fit!(m);
[ Info: (ret = :ROUNDOFF_LIMITED, fevals = 550, minf = 2354.4744815688055)
+[ Info: (ret = :ROUNDOFF_LIMITED, fevals = 539, minf = 2354.4744815688023)
Converged to θ = 0.5683043594028967 and β =[-0.3409777149845993, 0.3933796201906975, 0.6064857599227369, -0.012926172564277872, 0.03323478854784157, -0.005626184982660486]
+Converged to θ = 0.5683043828108765 and β =[-0.34097751800164144, 0.3933797121269934, 0.6064857490620532, -0.012926173063985653, 0.03323479562652116, -0.005626186061473733]
These estimates differ somewhat from those for model com05
.
Estimates for com05: θ = 0.5761507901895634, fmin = 2353.8241980539815, and β =[-0.3414913998306781, 0.3936080536502067, 0.6064861079468472, -0.012911714642169572, 0.03321662487439253, -0.005625046845040066]
+Estimates for com05: θ = 0.5761308007138215, fmin = 2353.8241975622855, and β =[-0.3414675499274024, 0.3936022945891755, 0.6064521635960723, -0.01291017393458232, 0.03321086562324279, -0.00562465124007457]
The discrepancy in the results is because the com05
results are based on a more accurate approximation to the integral called adaptive Gauss-Hermite Quadrature, which is discussed in Section C.6.