# Error with Bootstrap

**URL:** <https://discourse.pumas.ai/t/error-with-bootstrap/793>\
**Category:** bootstrap\
**Created:** [November 17, 2022, 12:02am UTC](https://discourse.pumas.ai/t/error-with-bootstrap/793 "2022-11-17T00:02:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahmed.salem](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@ahmed.salem](https://discourse.pumas.ai/u/ahmed.salem)\
**Post date:** [November 17, 2022, 12:02am UTC](https://discourse.pumas.ai/t/error-with-bootstrap/793/1 "2022-11-17T00:02:41Z")

</div>

I am trying to get the bootstrap for a fitted pumas model ( the minimization was successful and the infer function ran successfully as well). The model is as follows:

```auto
pac_carb_ANC = @model begin
  @param begin

    tvPOP_CIRC0 ∈ RealDomain(lower=0.00)
    tvPOP_MTT ∈ RealDomain(lower=0.00)
    tvPOP_GAMMA ∈ RealDomain(lower=0.00)
    tvPOP_SLOP ∈ RealDomain(lower=0.00)
    tvPOP_SLOPC ∈ RealDomain(lower=0.000)
    Ω_1 ∈ PDiagDomain(3)
    Ω_2 ∈ PDiagDomain(1)
    σ_prop ∈ RealDomain(lower=0.00)
  end

  @random begin
    η_1 ~ MvNormal(Ω_1)
    η_2 ~ MvNormal(Ω_2)
  end

  @covariates BSA SEX BILIRUBIN AGE Regimen # BSA (/m2) , SEX 0 Female 1 male Bilirubin (micromole), AGE (years)

  @pre begin
  Vc = 12.8
  Vp = 252 * (BSA/1.8)^1.17
  VMEL = 37.4 * 1.2^SEX * (BSA/1.8)^0.842 * (BILIRUBIN/7)^(-0.167) * (AGE/56)^(-0.352)
  KMEL = 0.53
  VMTR = 169 * 1.2^SEX * (BSA/1.8)^0.911
  KMTR = 0.83 * 2.11^SEX
  K21 = 1.15 * 0.893^SEX
  Q = 20.1 * (BSA/1.8)^0.724
  cl = 7.38
  q = 90.5
  vc = 11.9
  vp = 8.23
  CIRC0 = tvPOP_CIRC0 * exp(η_1[1])
  MTT = tvPOP_MTT * exp(η_1[2])
  SLOP = tvPOP_SLOP * exp(η_1[3])
  SLOPC = tvPOP_SLOPC * exp(η_2[1])
  GAMMA = tvPOP_GAMMA
  NN = 3
  KTR = ((NN+1)/MTT)
  end

  @init begin
    Prol = CIRC0
    Transit1 = CIRC0
    Transit2 = CIRC0
    Transit3 = CIRC0
    Circ = CIRC0
  end
  @vars begin

    CONC = (Central/Vc)
    conc = (central_carb/vc)
    EDRUG = (1-(SLOP*CONC))
    EDRUGC = (1-(SLOPC*conc))
    FEED = (abs(CIRC0/Circ)^GAMMA)

  end
  @dynamics begin

    Central' = -((CONC*VMEL)/(CONC + KMEL)) + (K21*PERIPH1) - ((CONC*VMTR)/(CONC + KMTR)) + ((Q/Vp)*PERIPH2) - ((Q/Vc)*Central)
    PERIPH1' = -(K21*PERIPH1) + ((CONC*VMTR)/(CONC + KMTR))
    PERIPH2' = - ((Q/Vp)*PERIPH2) + ((Q/Vc)*Central)
    #CARB' = -KC*CARB
    central_carb' = -(cl/vc)*central_carb + (q/vp)*Periph_carb - (q/vc)*central_carb
    Periph_carb' = (q/vc)*central_carb - (q/vp)*Periph_carb
    # PD
    Prol' = ((((KTR*Prol)*EDRUG*FEED*EDRUGC))-(KTR*Prol))
    Transit1' = ((KTR*Prol)-(KTR*Transit1))
    Transit2' = ((KTR*Transit1)-(KTR*Transit2))
    Transit3' = ((KTR*Transit2)-(KTR*Transit3))
    Circ' = ((KTR*Transit3)-(KTR*Circ))
  end

  @derived begin
    CONC = @. (Central/Vc)
    conc = (central_carb/vc)
    E = @. Circ
    ANC = @. Normal(E, E*σ_prop)
  end
end

```

However the bootstrap runs for very long time and it keeps giving the following error:

```auto
bs= infer(fit_pacli_carb_ANC, Pumas.Bootstrap(rng=MersenneTwister(1234),
           samples=200, ensemblealg = EnsembleThreads()))
┌ Warning: Interrupted. Larger maxiters is needed.
└ @ SciMLBase /builds/PumasAI/PumasSystemImages-jl/.julia/packages/SciMLBase/mndcy/src/integrator_interface.jl:331
^C
┌ Warning: Interrupted. Larger maxiters is needed.
└ @ SciMLBase /builds/PumasAI/PumasSystemImages-jl/.julia/packages/SciMLBase/mndcy/src/integrator_interface.jl:331
^C

```

Could you please let me know what does this warning message mean and if there is a way to make it run faster ?

Thanks

---

<div class="post-metadata">

**Author:** ![vijay](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/vijay/32/96_2.png) [@vijay](https://discourse.pumas.ai/u/vijay)\
**Post date:** [November 17, 2022, 1:02am UTC](https://discourse.pumas.ai/t/error-with-bootstrap/793/2 "2022-11-17T01:02:34Z")

</div>

It looks like some of the resampled datasets have issues. Do you get these warnings during the fitting of the original model

---

<div class="post-metadata">

**Author:** ![ahmed.salem](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@ahmed.salem](https://discourse.pumas.ai/u/ahmed.salem)\
**Post date:** [November 17, 2022, 1:08am UTC](https://discourse.pumas.ai/t/error-with-bootstrap/793/3 "2022-11-17T01:08:06Z")

</div>

Actually the fitting of the original model runs very smooth with no warnings. here is the output

```auto
Iter Function value Gradient norm 
     0 5.080082e+03 2.657559e+01
 * time: 0.02542591094970703
     1 5.079981e+03 2.004248e+01
 * time: 149.61270904541016
     2 5.079961e+03 1.497125e+01
 * time: 293.2913498878479
     3 5.079924e+03 1.386949e+01
 * time: 404.4286630153656
     4 5.079919e+03 1.275754e+01
 * time: 519.6313679218292
     5 5.079840e+03 4.859565e+00
 * time: 631.5725409984589
     6 5.079835e+03 3.599118e+00
 * time: 770.0869359970093
     7 5.079796e+03 1.848765e+00
 * time: 882.0380258560181
     8 5.079784e+03 1.772230e+00
 * time: 986.7223229408264
     9 5.079773e+03 7.275160e-01
 * time: 1067.3959460258484
    10 5.079765e+03 8.293510e-01
 * time: 1146.2089738845825
    11 5.079762e+03 1.422620e-01
 * time: 1223.3514399528503
    12 5.079762e+03 2.062762e-02
 * time: 1297.7948999404907
    13 5.079762e+03 2.165612e-03
 * time: 1366.6582679748535
    14 5.079762e+03 1.802472e-03
 * time: 1433.9624688625336
    15 5.079762e+03 3.306187e-03
 * time: 1499.6750829219818
    16 5.079762e+03 3.313480e-03
 * time: 1578.7967178821564
    17 5.079762e+03 3.667299e-03
 * time: 1661.0921380519867
    18 5.079762e+03 3.121457e-03
 * time: 1731.8161239624023
    19 5.079762e+03 3.241176e-03
 * time: 1805.8876328468323
    20 5.079762e+03 3.255183e-03
 * time: 1882.551826953888
    21 5.079762e+03 3.278371e-03
 * time: 2026.176521062851
    22 5.079762e+03 3.269786e-03
 * time: 2173.9755730628967
    23 5.079762e+03 3.274075e-03
 * time: 2320.8510229587555
    24 5.079762e+03 3.277968e-03
 * time: 2469.7986998558044
    25 5.079762e+03 3.278351e-03
 * time: 2620.940274953842
    26 5.079762e+03 3.282005e-03
 * time: 2767.507360935211
    27 5.079762e+03 3.285948e-03
 * time: 2915.770865917206
    28 5.079762e+03 3.290329e-03
 * time: 3069.461163043976
    29 5.079762e+03 3.286230e-03
 * time: 3169.5120148658752
    30 5.079762e+03 3.286927e-03
 * time: 3299.151221036911
    31 5.079762e+03 3.287002e-03
 * time: 3405.686693906784
    32 5.079762e+03 3.287002e-03
 * time: 3466.962636947632
FittedPumasModel

Successful minimization: true

Likelihood approximation: Pumas.FOCE
Log-likelihood value: -5079.7618
Number of subjects: 405
Number of parameters: Fixed Optimized
                                  0 10
Observation records: Active Missing
    ANC: 2274 0
    Total: 2274 0

---------------------------
                Estimate
---------------------------
tvPOP_CIRC0 6.2787
tvPOP_MTT 143.71
tvPOP_GAMMA 0.19585
tvPOP_SLOP 5.8194
tvPOP_SLOPC 0.0058817
Ω_1₁,₁ 0.23317
Ω_1₂,₂ 0.031576
Ω_1₃,₃ 0.11131
Ω_2₁,₁ 3.3201
σ_prop 0.36922
---------------------------

```

---

<div class="post-metadata">

**Author:** ![ahmed.salem](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@ahmed.salem](https://discourse.pumas.ai/u/ahmed.salem)\
**Post date:** [November 17, 2022, 1:10am UTC](https://discourse.pumas.ai/t/error-with-bootstrap/793/4 "2022-11-17T01:10:09Z")

</div>

And this is the output of `infer` function:

```auto
symptotic inference results using sandwich estimator

Successful minimization: true

Likelihood approximation: Pumas.FOCE
Log-likelihood value: -5079.7618
Number of subjects: 405
Number of parameters: Fixed Optimized
                                  0 10
Observation records: Active Missing
    ANC: 2274 0
    Total: 2274 0

---------------------------------------------------------------------------
                Estimate SE 95.0% C.I.
---------------------------------------------------------------------------
tvPOP_CIRC0 6.2787 0.18622 [5.9137 ; 6.6437]
tvPOP_MTT 143.71 4.2255 [135.43 ; 151.99]
tvPOP_GAMMA 0.19585 0.011701 [0.17291 ; 0.21878]
tvPOP_SLOP 5.8194 0.2963 [5.2386 ; 6.4001]
tvPOP_SLOPC 0.0058817 0.0020094 [0.0019434; 0.00982]
Ω_1₁,₁ 0.23317 0.024729 [0.1847 ; 0.28164]
Ω_1₂,₂ 0.031576 0.0083073 [0.015294 ; 0.047858]
Ω_1₃,₃ 0.11131 0.022134 [0.067931 ; 0.15469]
Ω_2₁,₁ 3.3201 0.9243 [1.5085 ; 5.1317]
σ_prop 0.36922 0.01312 [0.34351 ; 0.39494]
---------------------------------------------------------------------------

```
