Closed FelicienLL closed 2 years ago
Something like this:
final_eta %>%
hessian() %>% # <- find a way to compute it
solve() %>%
multiply_by(2) %>%
diag() %>%
sqrt()
Was not convinced of my previous attempt
(hessian = TRUE)
in the control list as default rather than adding a new argument to mapbayest()
.$final_eta
; with an associated get_cov()
method ?Nlmixr has an exported hessian method that is more similar to what NONMEM uses. In tests the standard errors without using that method were off.
Hello, thanks for your comment @mattfidler. That's good to know ; I'll definitely have a look into it and keep you informed. Félicien
Hello @mattfidler I tested nlmixrHess vs optimHess on a few patients, and it turns that results were often very close between each other, but still (somewhat) different from NONMEM. Don't know if there is something I did wrong. Nevermind. I'll probably push with optimHess nevertheless, and just keep in mind that it is not as reliable as I could hope. Maybe I'll investigate it later. Thanks again for your feedback.
$optimHess
# A tibble: 10 x 6
ETC11 ETC12 ETC13 ETC22 ETC23 ETC33
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 0.0136825 0.00503530 -0.000305194 0.0237150 0.0213066 0.132214
2 0.0290800 0.0283385 -0.00732591 0.177288 0.00126383 0.201054
3 0.0186945 0.0245448 -0.0187729 0.0369761 -0.0148816 0.186758
4 0.0487145 0.0789953 -0.00700705 0.167763 0.00308537 0.196837
5 0.0275728 -0.00573297 -0.0101148 0.0243365 0.0293306 0.138650
6 0.0601378 0.0897458 -0.00532107 0.151483 0.00332034 0.197242
7 0.0108475 0.00915594 0.00758177 0.0415659 0.0267983 0.134075
8 0.0321328 0.0444571 -0.00774746 0.189320 0.00192683 0.199362
9 0.0121780 0.00824785 0.00577110 0.0235335 0.0230167 0.0804586
10 0.0302423 0.00718001 -0.00776195 0.156584 0.000421537 0.202562
$nlmixrHess
# A tibble: 10 x 6
ETC11 ETC12 ETC13 ETC22 ETC23 ETC33
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 0.0136827 0.00503522 -0.000305312 0.0237151 0.0213068 0.132215
2 0.0290801 0.0283382 -0.00732593 0.177288 0.00126394 0.201054
3 0.0186941 0.0245439 -0.0187722 0.0369748 -0.0148803 0.186757
4 0.0487147 0.0789951 -0.00700703 0.167763 0.00308553 0.196837
5 0.0275732 -0.00573320 -0.0101150 0.0243370 0.0293311 0.138651
6 0.0601327 0.0897369 -0.00532115 0.151468 0.00332050 0.197243
7 0.0108476 0.00915586 0.00758176 0.0415660 0.0267983 0.134075
8 0.0321329 0.0444570 -0.00774745 0.189320 0.00192690 0.199362
9 0.0121781 0.00824780 0.00577102 0.0235335 0.0230168 0.0804588
10 0.0302425 0.00717970 -0.00776197 0.156584 0.000421609 0.202562
> phi1
# A tibble: 4,000 x 7
ID ETC11 ETC21 ETC22 ETC31 ETC32 ETC33
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 1 0.0128120 0.00540869 0.0231664 0.000469547 0.0219134 0.125253
2 2 0.0315751 0.0278753 0.195386 -0.00716980 0.00118665 0.199695
3 3 0.0170443 0.0220648 0.0333487 -0.0197813 -0.0154167 0.195512
4 4 0.0476201 0.0768924 0.161199 -0.00698803 0.00352623 0.199680
5 5 0.0349610 -0.00818342 0.0270017 -0.0123977 0.0305114 0.150705
6 6 0.0587815 0.0872319 0.146116 -0.00540675 0.00333980 0.199793
7 7 0.0107253 0.00879663 0.0403477 0.00614566 0.0246981 0.137189
8 8 0.0326341 0.0442259 0.188313 -0.00772443 0.00204115 0.199643
9 9 0.0120836 0.00887946 0.0240298 0.00632080 0.0234488 0.0816501
10 10 0.0370990 0.000563275 0.199998 -0.00732788 0.0000253381 0.199670
To be clear, when we did the vaidation of nlmixr against nonmem and monolix optimHess provided poorer estimates than nlmixrHess. That is not to say that I had the exact same vaules as nonmem.
This I think the accuracy of the two methods depends on you minization surface. Often they were comparable. In some lost reference they proposes that optimHess is a good method when you know the derivatives ot the surface well. The nlmixrHess method procided better results when you dont know the derivatives.
With sd eta perhaps optimHess is enough
I should study the possibility to compute a standard deviation on parameters (computed from the Hessian etc...)