Skip to contents

Parametric bootstrap for Julia mixed effects models

Usage

parametricbootstrap(
  x,
  nsim,
  seed,
  ...,
  optsum_overrides = list(ftol_rel = 1e-08)
)

Arguments

x

A Julia MixedModel of class jlme

nsim

Number of simulations

seed

Seed for the random number generator (Random.MersenneTwister)

...

Not implemented

optsum_overrides

Values to override in the OptSummary.

Value

MixedModels.parametricboostrap() output as object of class jlmeboot

Examples

# \donttest{
jlme_setup(restart = TRUE)
#> Starting Julia (v1.10.5) ...
#> Successfully set up Julia connection. (13s)

jmod <- jlmer(Reaction ~ Days + (Days | Subject), lme4::sleepstudy)
tidy(jmod)
#> # A tibble: 6 × 7
#>   effect   group    term                 estimate std.error statistic    p.value
#>   <chr>    <chr>    <chr>                   <dbl>     <dbl>     <dbl>      <dbl>
#> 1 fixed    NA       (Intercept)          251.          6.63     37.9   2.02e-314
#> 2 fixed    NA       Days                  10.5         1.50      6.97  3.22e- 12
#> 3 ran_pars Subject  sd__(Intercept)       23.8        NA        NA    NA        
#> 4 ran_pars Subject  cor__(Intercept).Da…   0.0813     NA        NA    NA        
#> 5 ran_pars Subject  sd__Days               5.72       NA        NA    NA        
#> 6 ran_pars Residual sd__Observation       25.6        NA        NA    NA        

samp <- parametricbootstrap(jmod, nsim = 100L, seed = 42L)
samp
#> <Julia object of type MixedModelBootstrap{Float64}>
#> MixedModelBootstrap with 100 samples
#>      parameter  min        q25         median     mean       q75        max
#>    ┌────────────────────────────────────────────────────────────────────────────
#>  1 │ β1         228.0      246.58      250.863    250.977    256.082    264.406
#>  2 │ β2         6.72055    9.91274     10.8382    10.696     11.6725    13.7769
#>  3 │ σ          21.6856    24.6536     25.6211    25.838     26.7439    30.5968
#>  4 │ σ1         3.57556    17.8908     22.1421    21.5799    25.6259    31.9446
#>  5 │ σ2         1.63637    4.53406     5.36349    5.47536    6.38651    8.34052
#>  6 │ ρ1         -0.739267  -0.226513   0.120712   0.107686   0.389495   1.0
#>  7 │ θ1         0.146373   0.675859    0.845334   0.839596   1.02343    1.29287
#>  8 │ θ2         -0.18147   -0.0508505  0.0248657  0.0155747  0.0708033  0.226194
#>  9 │ θ3         0.0        0.156785    0.193042   0.188678   0.238505   0.334108
#> 

tidy(samp)
#> # A tibble: 6 × 6
#>   effect   group    term                  estimate conf.low conf.high
#>   <chr>    <chr>    <chr>                    <dbl>    <dbl>     <dbl>
#> 1 fixed    NA       (Intercept)           251.      241.       263.  
#> 2 fixed    NA       Days                   10.5       7.73      13.5 
#> 3 ran_pars Subject  sd__(Intercept)        23.8      12.6       31.9 
#> 4 ran_pars Subject  cor__(Intercept).Days   0.0813   -0.595      1   
#> 5 ran_pars Subject  sd__Days                5.72      3.67       8.07
#> 6 ran_pars Residual sd__Observation        25.6      22.5       29.1 

stop_julia()
# }