From 2d3bf0073ebb6b063cb4a6a3e524473d15bc720d Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Thu, 4 Jul 2024 12:20:09 -0500 Subject: [PATCH] Built site for gh-pages --- .nojekyll | 2 +- aGHQ.html | 204 +++++++++--------- datatables.html | 62 +++--- glmmbernoulli.html | 166 +++++++------- index.html | 10 +- intro.html | 28 +-- largescaledesigned.html | 26 +-- largescaleobserved.html | 24 ++- linalg.html | 32 +-- longitudinal.html | 140 ++++++------ .../figure-html/fig-eglayout-output-1.png | Bin 45744 -> 39201 bytes .../figure-html/figeglayout-output-1.png | Bin 0 -> 39201 bytes multiple.html | 14 +- .../figure-html/fig-pastesdot-output-1.png | Bin 44218 -> 32857 bytes .../figure-html/figpastesdot-output-1.png | Bin 0 -> 32859 bytes references.html | 6 +- search.json | 48 ++--- site_libs/bootstrap/bootstrap.min.css | 2 +- 18 files changed, 382 insertions(+), 382 deletions(-) create mode 100644 longitudinal_files/figure-html/figeglayout-output-1.png create mode 100644 multiple_files/figure-html/figpastesdot-output-1.png diff --git a/.nojekyll b/.nojekyll index 0f69e35..a024cc2 100644 --- a/.nojekyll +++ b/.nojekyll @@ -1 +1 @@ -66235ba6 \ No newline at end of file +2cf701c9 \ No newline at end of file diff --git a/aGHQ.html b/aGHQ.html index 15bb886..14f1e15 100644 --- a/aGHQ.html +++ b/aGHQ.html @@ -2,7 +2,7 @@ - + @@ -507,12 +507,12 @@

βm05 = copy(com05.β)
6-element Vector{Float64}:
- -0.3414688923098128
-  0.3935941398175495
-  0.6064453377878877
- -0.012909611190401555
-  0.03321034920788019
- -0.0056245886330953615
+ -0.3414913998306781 + 0.3936080536502067 + 0.6064861079468472 + -0.012911714642169572 + 0.03321662487439253 + -0.005625046845040066

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.

@@ -530,23 +530,23 @@

sum(r.dev for r in rowtbl)
-
2411.1932567854824
+
2411.194470806229
@@ -624,12 +624,12 @@

β₀ = copy(com05fe.β) # keep a copy of the initial values
6-element Vector{Float64}:
- -0.10753340611835656
-  0.17596632075206547
-  0.21944824496978485
- -0.0028547435517881433
-  0.010139921834784377
- -0.002161831532409491
+ -0.10753340611835722 + 0.17596632075206525 + 0.21944824496978524 + -0.0028547435517881996 + 0.010139921834784385 + -0.002161831532409504

These initial values of \({\boldsymbol{\beta}}\) are from a least squares fit of \({\mathbf{y}}\), converted from {0,1} coding to {-1,1} coding, on the model matrix, \({\mathbf{X}}\).

@@ -637,14 +637,14 @@

deviance(setβ!(com05fe, βm05))
-
2411.1932567854824
+
2411.194470806229

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.151439053724
+
2491.1514390537254
@@ -669,7 +669,7 @@

fit!(com05fe);
-
[ Info: (code = :ROUNDOFF_LIMITED, nevals = 545, minf = 2409.377428160019)
+
[ Info: (code = :ROUNDOFF_LIMITED, nevals = 558, minf = 2409.377428160017)

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 @@

(m = com05fe; β = βopt)
BenchmarkTools.Trial: 10000 samples with 1 evaluation.
- Range (min … max):  25.750 μs …  47.625 μs  ┊ GC (min … max): 0.00% … 0.00%
- Time  (median):     25.875 μs               ┊ GC (median):    0.00%
- Time  (mean ± σ):   25.907 μs ± 542.557 ns  ┊ GC (mean ± σ):  0.00% ± 0.00%
+ 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%
 
-   ▆█                                                           
-  ▆██▇▃▂▂▂▂▂▂▂▂▂▂▁▂▁▁▂▁▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▂▁▁▁▁▁▁▂▁▁▁▁▁▁▁▂▁▂ ▂
-  25.8 μs         Histogram: frequency by time         28.5 μs <
+   ▂        ▁      ▁▃▆▂      ▄▇█▂        ▁▁                    ▂
+  ▆█▇▁▁▁▁▁▆▇█▅▄▁▃▄▃████▄▁▁▃▃▅████▇▅▄▆▅▄▆▆███▇▅▆▅▅▅▃▁▄▄▃▃▃▄▅▅▆▆ █
+  33.8 μs       Histogram: log(frequency) by time        40 μs <
 
  Memory estimate: 16 bytes, allocs estimate: 1.
@@ -817,14 +817,14 @@

com05fe = BernoulliIRLS(com05.X, com05.y)
 deviance(com05fe)
-
2491.151439053725
+
2491.1514390537254

The first IRLS iteration

deviance(updateβ!(com05fe))
-
2411.165742459925
+
2411.165742459929

reduces the deviance substantially.

@@ -856,10 +856,10 @@

fit!(com05fe, β₀);
-
[ Info: (0, 2491.151439053724)
-[ Info: (1, 2411.1657424599252)
-[ Info: (2, 2409.3824513371324)
-[ Info: (3, 2409.3774282835834)
+
[ Info: (0, 2491.1514390537254)
+[ Info: (1, 2411.165742459929)
+[ Info: (2, 2409.382451337132)
+[ Info: (3, 2409.3774282835857)
 [ Info: (4, 2409.3774281600413)
@@ -867,16 +867,16 @@

@benchmark deviance(updateβ!(m)) seconds = 1 setup = (m = com05fe)
-
BenchmarkTools.Trial: 8774 samples with 1 evaluation.
- Range (min … max):  108.750 μs … 186.792 μs  ┊ GC (min … max): 0.00% … 0.00%
- Time  (median):     112.125 μs               ┊ GC (median):    0.00%
- Time  (mean ± σ):   112.831 μs ±   4.958 μs  ┊ GC (mean ± σ):  0.00% ± 0.00%
+
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%
 
-    ▁▇▂  █▄                                                      
-  ▃▃███▅▇██▅▃▂▃▃▂▂▁▂▂▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ▂
-  109 μs           Histogram: frequency by time          139 μs <
+                         ▂▂▂▄▅▅▄▇██▆▅▄▄▅▅▄▃▂▂▂▂▂▁▁▁            ▂
+  ▅▅▆▆▇▇▇▆▆▆▆▆▆▆▅▆▇▇▇██▇██████████████████████████████▇▇▇▇▇▇▇▇ █
+  67.5 μs       Histogram: log(frequency) by time      84.5 μs <
 
- Memory estimate: 16.25 KiB, allocs estimate: 6.
+ Memory estimate: 16.12 KiB, allocs estimate: 6.
@@ -1052,14 +1052,14 @@

m = BernoulliPIRLS(com05.X, com05.y, only(com05.reterms).refs)
 pdeviance(m)
-
2409.3774281600413
+
2409.377428160041

As with IRLS, the first iteration of PIRLS reduces the objective, which is the penalized deviance in this case, substantially.

pdeviance(updateu!(m))
-
2233.120947635784
+
2233.1209476357844

Create a pirls! method for this struct.

@@ -1094,25 +1094,25 @@

pirls!(m; verbose=true);
-
[ Info: (0, 2409.3774281600413)
-[ Info: (1, 2233.120947635784)
-[ Info: (2, 2231.6059352797056)
-[ Info: (3, 2231.600219832158)
-[ Info: (4, 2231.6002194065604)
+
[ Info: (0, 2409.377428160041)
+[ Info: (1, 2233.1209476357844)
+[ Info: (2, 2231.605935279706)
+[ Info: (3, 2231.6002198321576)
+[ Info: (4, 2231.600219406561)

As with IRLS, PIRLS is a fast and stable algorithm for determining the mode of the conditional distribution \(({\mathcal{U}}|{\mathcal{Y}}={\mathbf{y}})\) with \({\boldsymbol{\theta}}\) and \({\boldsymbol{\beta}}\) held fixed.

@benchmark pirls!(mm) seconds = 1 setup = (mm = m)
-
BenchmarkTools.Trial: 4847 samples with 1 evaluation.
- Range (min … max):  197.708 μs … 325.792 μs  ┊ GC (min … max): 0.00% … 0.00%
- Time  (median):     202.834 μs               ┊ GC (median):    0.00%
- Time  (mean ± σ):   204.467 μs ±  10.549 μs  ┊ GC (mean ± σ):  0.00% ± 0.00%
+
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%
 
-  ▆▃  ▄ ▃█                                                       
-  ██▄▆█▄██▃▆▃▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▁▂▂▂▂▂▂▂▂▁▁▂▁▂▂▂▂▁▂▂▂▂▂▂▂▂▂▁▂▂ ▃
-  198 μs           Histogram: frequency by time          261 μs <
+                                        ▁         ▇█             
+  ▂▂▂▂▁▂▂▂▂▂▂▂▂▂▂▁▁▂▂▂▁▂▁▂▂▁▁▂▂▂▂▁▂▁▁▁▁▄█▄▄▃▂▃▃▃▃▃██▇▆▃▃▅▄▃▂▂▂▂ ▃
+  200 μs           Histogram: frequency by time          234 μs <
 
  Memory estimate: 112 bytes, allocs estimate: 1.
@@ -1158,7 +1158,7 @@

laplaceapprox(pirls!(m))
-
2373.5180527521634
+
2373.518052752164

The remaining step is to optimize Laplace’s approximation to the GLMM deviance with respect to \(\theta\) and \({\boldsymbol{\beta}}\), which we do using the BOBYQA optimizer from NLopt.jl

@@ -1188,7 +1188,7 @@

fit!(m);
-
[ Info: (ret = :ROUNDOFF_LIMITED, fevals = 567, minf = 2354.474481568814)
+
[ Info: (ret = :ROUNDOFF_LIMITED, fevals = 550, minf = 2354.4744815688055)
@@ -1202,7 +1202,7 @@

)

-
Converged to θ = 0.5683043987329829 and β =[-0.3409777185006387, 0.39337972485653033, 0.606485842218137, -0.012926166672796164, 0.03323478753359014, -0.0056261864970479246]
+
Converged to θ = 0.5683043594028967 and β =[-0.3409777149845993, 0.3933796201906975, 0.6064857599227369, -0.012926172564277872, 0.03323478854784157, -0.005626184982660486]

These estimates differ somewhat from those for model com05.

@@ -1219,7 +1219,7 @@

)
-
Estimates for com05: θ = 0.5761302648250215, fmin = 2353.8241975646893, and β =[-0.3414688923098128, 0.3935941398175495, 0.6064453377878877, -0.012909611190401555, 0.03321034920788019, -0.0056245886330953615]
+
Estimates for com05: θ = 0.5761507901895634, fmin = 2353.8241980539815, and β =[-0.3414913998306781, 0.3936080536502067, 0.6064861079468472, -0.012911714642169572, 0.03321662487439253, -0.005625046845040066]

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.

@@ -1304,10 +1304,10 @@

ev.values
5-element Vector{Float64}:
- -2.8569700138728016
- -1.3556261799742617
-  8.881784197001252e-16
-  1.3556261799742675
+ -2.8569700138728
+ -1.3556261799742608
+  1.3322676295501878e-15
+  1.3556261799742677
   2.8569700138728056
@@ -1315,8 +1315,8 @@

abs2.(ev.vectors[1, :])
5-element Vector{Float64}:
- 0.01125741132772062
- 0.22207592200561319
+ 0.011257411327720667
+ 0.2220759220056134
  0.5333333333333334
  0.222075922005612
  0.011257411327720648
@@ -1341,7 +1341,7 @@

- +
Figure C.3: Change in the penalized deviance contribution from that at the conditional mode, for each of the first 5 groups, in model com05, as a function of u. @@ -1616,7 +1616,7 @@

- +
Figure C.6: Exponential of half the difference between the quadratic approximation and the contribution to the penalized deviance, for each of first 5 groups in model com05 as a function of z. @@ -1667,20 +1667,20 @@

extrema(m.utbl.aGHQ)
-
(-0.008514109733813818, -0.000413268627218805)
+
(-0.008514108854172236, -0.0004132698576107887)

As we see, these “correction terms” relative to Laplace’s approximation are relatively small, compared to the contributions to the objective from each component of \({\mathbf{u}}\). Also, the corrections are all negative, in this case. Close examination of the individual curves in Figure C.5 shows that these curves, which are \(-2\log(f_j(z))\), are more-or-less odd functions, in the sense that the value at \(-z\) is approximately the negative of the value at \(z\). If we were integrating \(\log(f_j(z_j))\phi(z_j)\) with a normalized Gauss-Hermite rule the negative and positive values would cancel out, for the most part, and some of the integrals would be positive while others would be negative.

@@ -1729,24 +1729,24 @@

m.θβ
┌ Warning: PIRLS iteration did not reduce penalized deviance
-└ @ Main.Notebook ~/projects/EmbraceUncertainty/aGHQ.qmd:1212
+└ @ Main.Notebook ~/Work/EmbraceUncertainty/aGHQ.qmd:1064
 ┌ Warning: PIRLS iteration did not reduce penalized deviance
-└ @ Main.Notebook ~/projects/EmbraceUncertainty/aGHQ.qmd:1212
-[ Info: (ret = :ROUNDOFF_LIMITED, fevals = 502, minf = 2353.8241975532205)
+└ @ Main.Notebook ~/Work/EmbraceUncertainty/aGHQ.qmd:1064 +[ Info: (ret = :ROUNDOFF_LIMITED, fevals = 479, minf = 2353.82419755322)
7-element Vector{Float64}:
-  0.5761321943567461
- -0.3414656014988162
-  0.3935993795906205
-  0.6064447386597025
- -0.012909682389235384
-  0.033209946254759815
- -0.005624606286375493
+ 0.5761321679271924 + -0.3414655990254175 + 0.39359939391066806 + 0.6064447618771712 + -0.012909685721680265 + 0.03320994962034241 + -0.005624606329593786
-

This page was rendered from git revision 5657dd7 +

This page was rendered from git revision 05a171b .

diff --git a/datatables.html b/datatables.html index 16f8019..db512e1 100644 --- a/datatables.html +++ b/datatables.html @@ -2,7 +2,7 @@ - + @@ -333,9 +333,7 @@

Tables.RowTable
-
-
AbstractVector{T} where T<:NamedTuple (alias for AbstractArray{T, 1} where T<:NamedTuple)
-
+
AbstractVector{T} where T<:NamedTuple (alias for AbstractArray{T, 1} where T<:NamedTuple)

The actual implementation of a row-table or column-table type may be different from these prototypes but it must provide access methods as if it were one of these types. Tables.jl provides the “glue” to treat a particular data table type as if it were row-oriented, by calling Tables.rows or Tables.rowtable on it, or column-oriented, by calling Tables.columntable on it.

@@ -345,7 +343,7 @@

TypedTables.jl is a lightweight package (about 1500 lines of source code) that provides a concrete implementation of column-tables, called simply Table, as a NamedTuple of vectors.

A Table that is constructed from another type of column-table, such as an Arrow.Table or a DataFrame or an explicit NamedTuple of vectors, is simply a wrapper around the original table’s contents. On the other hand, constructing a Table from a row table first creates a ColumnTable, then wraps it.

-
contratbl = Table(contra)
+
contratbl = Table(contra)
Table with 5 columns and 1934 rows:
       dist  urban  livch  age     use
@@ -371,7 +369,7 @@ 

-
typeof(contratbl)
+
typeof(contratbl)
Table{@NamedTuple{dist::String, urban::String, livch::String, age::Float64, use::String}, 1, @NamedTuple{dist::Arrow.DictEncoded{String, Int8, Arrow.List{String, Int32, Vector{UInt8}}}, urban::Arrow.DictEncoded{String, Int8, Arrow.List{String, Int32, Vector{UInt8}}}, livch::Arrow.DictEncoded{String, Int8, Arrow.List{String, Int32, Vector{UInt8}}}, age::Arrow.DictEncoded{Float64, Int8, Arrow.Primitive{Float64, Vector{Float64}}}, use::Arrow.DictEncoded{String, Int8, Arrow.List{String, Int32, Vector{UInt8}}}}}
@@ -383,7 +381,7 @@

-
contratbl.urban
+
contratbl.urban
1934-element Arrow.DictEncoded{String, Int8, Arrow.List{String, Int32, Vector{UInt8}}}:
  "Y"
@@ -410,14 +408,14 @@ 

Symbols, not strings, usually typed as a : followed by the name, as shown in

-
columnnames(contratbl)
+
columnnames(contratbl)
(:dist, :urban, :livch, :age, :use)

The : form for creating the Symbol requires that the column name be a valid variable name in Julia. If, for example, a column name contains a blank, the : form must be replaced by an expression like var"<name>", which invokes what is called a “string macro”.

-
contratbl.var"urban"
+
contratbl.var"urban"
1934-element Arrow.DictEncoded{String, Int8, Arrow.List{String, Int32, Vector{UInt8}}}:
  "Y"
@@ -444,13 +442,13 @@ 

-
contratbl[1]
+
contratbl[1]
(dist = "D01", urban = "Y", livch = "3+", age = 18.44, use = "N")

-
contratbl[2:5]
+
contratbl[2:5]
Table with 5 columns and 4 rows:
      dist  urban  livch  age     use
@@ -468,7 +466,7 @@ 

A.3.2 A trivial example done several ways

Suppose we wish to select the rows from district D49 as a table. We could create a Boolean vector and use it to index into contratbl

-
contratbl[contratbl.dist .== "D49"]
+
contratbl[contratbl.dist .== "D49"]
Table with 5 columns and 4 rows:
      dist  urban  livch  age     use
@@ -497,8 +495,8 @@ 

.

-
isD49dist(row) = row.dist == "D49" # a 'one-liner' function definition
-filter(isD49dist, contratbl)
+
isD49dist(row) = row.dist == "D49" # a 'one-liner' function definition
+filter(isD49dist, contratbl)
Table with 5 columns and 4 rows:
      dist  urban  livch  age     use
@@ -511,7 +509,7 @@ 

-
filter(r -> r.dist == "D49", contratbl)
+
filter(r -> r.dist == "D49", contratbl)
Table with 5 columns and 4 rows:
      dist  urban  livch  age     use
@@ -524,7 +522,7 @@ 

.

-
filter(==("D49")  first, contratbl)
+
filter(==("D49")  first, contratbl)
Table with 5 columns and 4 rows:
      dist  urban  livch  age     use
@@ -553,7 +551,7 @@ 

generator expression

-
Table(r for r in contratbl if r.dist == "D49")
+
Table(r for r in contratbl if r.dist == "D49")
Table with 5 columns and 4 rows:
      dist  urban  livch  age     use
@@ -567,10 +565,10 @@ 

Chapter 6 a newdata table is constructed from the Cartesian product of vectors of covariates as the newdata table.

-
newdata = Table(
-  (; age=a, ch=c, urban=u)  # NamedTuple from iterator product
-  for a in -10:3:20, c in [false, true], u in ["N", "Y"]
-)
+
newdata = Table(
+  (; age=a, ch=c, urban=u)  # NamedTuple from iterator product
+  for a in -10:3:20, c in [false, true], u in ["N", "Y"]
+)
Table with 3 columns and 44 rows:
       age  ch     urban
@@ -609,7 +607,7 @@ 

In general a Tuple is written as a comma-separated set of values within parentheses.

-
typeof((1, true, 'R'))
+
typeof((1, true, 'R'))
Tuple{Int64, Bool, Char}
@@ -618,10 +616,10 @@

-
newdata = Table(
-  (; age, ch, urban) for age in -10:3:20, ch in [false, true],
-  urban in ["N", "Y"]
-)
+
newdata = Table(
+  (; age, ch, urban) for age in -10:3:20, ch in [false, true],
+  urban in ["N", "Y"]
+)
Table with 3 columns and 44 rows:
       age  ch     urban
@@ -657,7 +655,7 @@ 

Chapter 6 we added a Boolean column, ch, indicating if livch is not "0", to the contra table using an expression like

-
contratbl = Table(contratbl; ch=contratbl.livch .== "0")
+
contratbl = Table(contratbl; ch=contratbl.livch .== "0")
Table with 6 columns and 1934 rows:
       dist  urban  livch  age     use  ch
@@ -684,9 +682,9 @@ 

-
contratbl = Table(
-  getproperties(contratbl, (:dist, :urban, :livch, :age, :use)),
-)
+
contratbl = Table(
+  getproperties(contratbl, (:dist, :urban, :livch, :age, :use)),
+)
Table with 5 columns and 1934 rows:
       dist  urban  livch  age     use
@@ -718,8 +716,8 @@ 

<

The JuliaData organization manages the development of several packages related to data science and data management, including DataFrames.jl, a comprehensive system for working with column-oriented data tables in Julia. Kamiński (2023), written by the primary author of that package, provides an in-depth introduction to data science facilities, in particular the DataFrames package, in Julia.

This package is particularly well-suited to more advanced data manipulation such as the split-apply-combine strategy (Wickham, 2011) and “joins” of data tables.

Bouchet-Valat & Kamiński (2023) compares the performance of DataFrames.jl to other data frame implementations in R and Python.

-

This page was rendered from git revision 5657dd7 +

This page was rendered from git revision 05a171b .

diff --git a/glmmbernoulli.html b/glmmbernoulli.html index 8cc1e20..1bba742 100644 --- a/glmmbernoulli.html +++ b/glmmbernoulli.html @@ -2,7 +2,7 @@ - + @@ -534,18 +534,18 @@

(Intercept) --0.0125 +-0.0126 0.1058 -0.12 -0.9061 +0.9052 0.4787 livch: 1 -0.1533 +0.1532 0.0982 1.56 -0.1185 +0.1188 @@ -558,7 +558,7 @@

livch: 3+ -0.2591 +0.2590 0.1022 2.53 0.0113 @@ -569,7 +569,7 @@

0.0006 0.0095 0.07 -0.9479 +0.9466 @@ -582,7 +582,7 @@

urban: Y -0.3771 +0.3770 0.0804 4.69 <1e-05 @@ -593,7 +593,7 @@

-0.0067 0.0069 -0.98 -0.3263 +0.3261 @@ -601,7 +601,7 @@

-0.0004 0.0007 -0.51 -0.6070 +0.6075 @@ -765,7 +765,7 @@

(Intercept) --0.2193 +-0.2194 0.1155 -1.90 0.0576 @@ -784,7 +784,7 @@

0.0035 0.0082 0.43 -0.6669 +0.6674 @@ -808,7 +808,7 @@

-0.0068 0.0069 -0.99 -0.3233 +0.3231 @@ -880,7 +880,7 @@

(Intercept) --0.2303 +-0.2302 0.1140 -2.02 0.0434 @@ -888,7 +888,7 @@

urban: Y -0.3462 +0.3461 0.0599 5.78 <1e-08 @@ -907,7 +907,7 @@

0.0063 0.0078 0.80 -0.4247 +0.4249 @@ -1034,7 +1034,7 @@

-0.0131 0.0110 -1.19 -0.2352 +0.2351 @@ -1131,7 +1131,7 @@

ch: true -0.6064 +0.6065 0.1045 5.80 <1e-08 @@ -1142,7 +1142,7 @@

-0.0129 0.0112 -1.16 -0.2471 +0.2470 @@ -1174,29 +1174,29 @@

Generalized Linear Mixed Model fit by maximum likelihood (nAGQ = 9)
   use ~ 1 + urban + ch + age + :(abs2(age)) + ch & age + (1 | dist & urban)
-  Distribution: Distributions.Bernoulli{Float64}
-  Link: GLM.LogitLink()
+  Distribution: Bernoulli{Float64}
+  Link: LogitLink()
 
    logLik    deviance     AIC       AICc        BIC    
  -1177.2418  2353.8242  2368.4836  2368.5418  2407.4550
 
 Variance components:
                 Column   Variance Std.Dev. 
-dist & urban (Intercept)  0.331929 0.576133
+dist & urban (Intercept)  0.331927 0.576131
 
  Number of obs: 1934; levels of grouping factors: 102
 
 Fixed-effects parameters:
-────────────────────────────────────────────────────────
-                      Coef.  Std. Error      z  Pr(>|z|)
-────────────────────────────────────────────────────────
-(Intercept)     -0.341466     0.126905   -2.69    0.0071
-urban: Y         0.393594     0.0859087   4.58    <1e-05
-ch: true         0.606442     0.104529    5.80    <1e-08
-age             -0.0129098    0.0111548  -1.16    0.2471
-abs2(age)       -0.00562462   0.0008441  -6.66    <1e-10
-ch: true & age   0.0332098    0.0128227   2.59    0.0096
-────────────────────────────────────────────────────────
+───────────────────────────────────────────────────────── + Coef. Std. Error z Pr(>|z|) +───────────────────────────────────────────────────────── +(Intercept) -0.341486 0.126906 -2.69 0.0071 +urban: Y 0.393595 0.0859086 4.58 <1e-05 +ch: true 0.606464 0.104531 5.80 <1e-08 +age -0.0129123 0.0111549 -1.16 0.2470 +abs2(age) -0.00562457 0.000844101 -6.66 <1e-10 +ch: true & age 0.0332117 0.0128228 2.59 0.0096 +─────────────────────────────────────────────────────────

Notice that, although there are 60 distinct districts, there are only 102 distinct combinations of dist and urban represented in the data. In 15 of the 60 districts there are no rural women in the sample and in 3 districts there are no urban women in the sample, as shown in a frequency table

@@ -1307,23 +1307,23 @@

Table with 4 columns and 44 rows: age ch urban η ┌───────────────────────────── - 1 │ -10 false N -1.44277 - 2 │ -7 false N -1.29427 - 3 │ -4 false N -1.24702 - 4 │ -1 false N -1.30101 - 5 │ 2 false N -1.45624 - 6 │ 5 false N -1.71271 - 7 │ 8 false N -2.07043 - 8 │ 11 false N -2.5294 - 9 │ 14 false N -3.0896 - 10 │ 17 false N -3.75105 - 11 │ 20 false N -4.51374 - 12 │ -10 true N -0.89408 - 13 │ -7 true N -0.546324 - 14 │ -4 true N -0.299812 - 15 │ -1 true N -0.154542 + 1 │ -10 false N -1.44276 + 2 │ -7 false N -1.29428 + 3 │ -4 false N -1.24704 + 4 │ -1 false N -1.30104 + 5 │ 2 false N -1.45629 + 6 │ 5 false N -1.71278 + 7 │ 8 false N -2.07051 + 8 │ 11 false N -2.52948 + 9 │ 14 false N -3.0897 + 10 │ 17 false N -3.75115 + 11 │ 20 false N -4.51385 + 12 │ -10 true N -0.894068 + 13 │ -7 true N -0.546316 + 14 │ -4 true N -0.299807 + 15 │ -1 true N -0.15454 16 │ 2 true N -0.110516 - 17 │ 5 true N -0.167733 + 17 │ 5 true N -0.167734 ⋮ │ ⋮ ⋮ ⋮ ⋮

@@ -1346,7 +1346,7 @@

- +
Figure 6.3: Linear predictor versus centered age from model com05 @@ -1411,23 +1411,23 @@

<
Table with 5 columns and 44 rows:
       age  ch     urban  η          μ
     ┌────────────────────────────────────────
- 1  │ -10  false  N      -1.44277   0.191117
- 2  │ -7   false  N      -1.29427   0.215131
- 3  │ -4   false  N      -1.24702   0.223217
- 4  │ -1   false  N      -1.30101   0.213996
- 5  │ 2    false  N      -1.45624   0.189043
- 6  │ 5    false  N      -1.71271   0.152812
- 7  │ 8    false  N      -2.07043   0.112004
- 8  │ 11   false  N      -2.5294    0.073823
- 9  │ 14   false  N      -3.0896    0.0435383
- 10 │ 17   false  N      -3.75105   0.0229538
- 11 │ 20   false  N      -4.51374   0.0108386
- 12 │ -10  true   N      -0.89408   0.290269
- 13 │ -7   true   N      -0.546324  0.366718
- 14 │ -4   true   N      -0.299812  0.425604
- 15 │ -1   true   N      -0.154542  0.461441
+ 1  │ -10  false  N      -1.44276   0.191118
+ 2  │ -7   false  N      -1.29428   0.215129
+ 3  │ -4   false  N      -1.24704   0.223213
+ 4  │ -1   false  N      -1.30104   0.213989
+ 5  │ 2    false  N      -1.45629   0.189035
+ 6  │ 5    false  N      -1.71278   0.152804
+ 7  │ 8    false  N      -2.07051   0.111996
+ 8  │ 11   false  N      -2.52948   0.0738171
+ 9  │ 14   false  N      -3.0897    0.0435342
+ 10 │ 17   false  N      -3.75115   0.0229515
+ 11 │ 20   false  N      -4.51385   0.0108374
+ 12 │ -10  true   N      -0.894068  0.290271
+ 13 │ -7   true   N      -0.546316  0.366719
+ 14 │ -4   true   N      -0.299807  0.425605
+ 15 │ -1   true   N      -0.15454   0.461442
  16 │ 2    true   N      -0.110516  0.472399
- 17 │ 5    true   N      -0.167733  0.458165
+ 17 │ 5    true   N      -0.167734  0.458164
  ⋮  │  ⋮     ⋮      ⋮        ⋮          ⋮

@@ -1450,7 +1450,7 @@

<
- +
Figure 6.5: Predicted probability of contraception use versus centered age from model com05. @@ -1466,10 +1466,10 @@

<
Table with 5 columns and 4 rows:
      age  ch     urban  η          μ
    ┌───────────────────────────────────────
- 1 │ 2    false  N      -1.45624   0.189043
+ 1 │ 2    false  N      -1.45629   0.189035
  2 │ 2    true   N      -0.110516  0.472399
- 3 │ 2    false  Y      -0.669052  0.338709
- 4 │ 2    true   Y      0.676672   0.662995
+ 3 │ 2 false Y -0.669101 0.338698 + 4 │ 2 true Y 0.676673 0.662996

The predicted probability of woman with centered age of 2, with children, living in an urban environment using artificial contraception is about 2/3, which is reasonably close to the smoothed frequency for that combination of covariates in Figure 6.2.

@@ -1487,7 +1487,7 @@

- +
Figure 6.6: Caterpillar plot of the conditional modes of the random-effects for model com05 @@ -1506,12 +1506,12 @@

Table with 2 columns and 6 rows: dist & urban (Intercept) ┌────────────────────────── - 1 │ ("D01", "N") -0.957367 - 2 │ ("D11", "N") -0.931983 - 3 │ ("D24", "N") -0.60342 + 1 │ ("D01", "N") -0.957366 + 2 │ ("D11", "N") -0.93198 + 3 │ ("D24", "N") -0.603418 4 │ ("D01", "Y") -0.580203 - 5 │ ("D27", "N") -0.576648 - 6 │ ("D55", "Y") -0.548263

+ 5 │ ("D27", "N") -0.576647 + 6 │ ("D55", "Y") -0.548261

@@ -1520,12 +1520,12 @@

Table with 2 columns and 6 rows: dist & urban (Intercept) ┌────────────────────────── - 1 │ ("D43", "N") 0.644081 - 2 │ ("D04", "Y") 0.644671 - 3 │ ("D42", "N") 0.665117 - 4 │ ("D58", "N") 0.67742 + 1 │ ("D43", "N") 0.64408 + 2 │ ("D04", "Y") 0.644669 + 3 │ ("D42", "N") 0.665114 + 4 │ ("D58", "N") 0.677418 5 │ ("D14", "Y") 0.695322 - 6 │ ("D34", "N") 1.08592

+ 6 │ ("D34", "N") 1.08591

The largest random effect is for rural settings in D34. There were 26 women in the sample from rural D34

@@ -1565,12 +1565,12 @@

exp(last(first(srtdre)))
-
0.3839023558380497
+
0.38390287360272524

or about 40%.

-

This page was rendered from git revision 5657dd7 +

This page was rendered from git revision 05a171b .

diff --git a/index.html b/index.html index 0ed055f..efb2049 100644 --- a/index.html +++ b/index.html @@ -2,14 +2,14 @@ - + - + Embrace Uncertainty