Open swihart opened 5 years ago
Can we get nlminb from above to give the L-BGFS-B answers?
Can we get the bobyqa to give the L-BGFS-B answers?
Progress! But the estimates are still way off for nlminb:
> gapr_marg_nlminb <-
+ gnlrim(y=y_cbind,
+ mu=~ stable_cdf2((a0 + a1*group)*(1^alpha)/phi + rand, c(alpha, 0, 1, 0)),
+ ##pmu=c( a0=bm0_start, a1=bm1_start, alpha=1.5, phi=0.50),
+ pmu=c( a0=0, a1=0, alpha=1.5, phi=0.50),
+ pmix=c(alpha=1.5, phi=0.50),
+ p_uppb = c( Inf , Inf, 2-1e-5, 1-1e-5),
+ p_lowb = c( -Inf, -Inf, 0+1e-5, 0+1e-5),
+ distribution="binomial",
+ nest=id,
+ random="rand",
+ mixture="libstableR-subgauss-phi",
+ ooo=TRUE,
+ compute_hessian = FALSE,
+ compute_kkt = FALSE,
+ trace=1,
+ method="nlminb",
+ abs.tol.nlminb=1e-5, ## 1e-20,
+ xf.tol.nlminb=2.2e-6, ##2.2e-14,
+ x.tol.nlminb=1.5e-3, ##1.5e-8,
+ rel.tol.nlminb=1e-4, ##1e-10,
+ )
fn is fn
Looking for method = nlminb
Function has 4 arguments
par[ 1 ]: -Inf <? 0 <? Inf In Bounds
par[ 2 ]: -Inf <? 0 <? Inf In Bounds
par[ 3 ]: 1e-05 <? 1.5 <? 1.99999 In Bounds
par[ 4 ]: 1e-05 <? 0.5 <? 0.99999 In Bounds
Analytic gradient not made available.
Analytic Hessian not made available.
Scale check -- log parameter ratio= 0.4771213 log bounds ratio= 0.3010343
Method: nlminb
0: 71.819860: 0.00000 0.00000 1.50000 0.500000
1: 66.496600: 0.00326712 -0.00469494 1.52102 0.420905
2: 59.810823: 0.0124732 -0.0157064 1.56418 0.263259
3: 58.541368: 0.147661 -0.145900 1.35375 0.0953913
4: 56.504180: 0.349478 -0.391080 1.31257 0.167135
5: 47.982940: 2.14036 -3.57406 0.972066 0.126653
6: 47.227792: 2.60489 -4.19355 1.15703 0.149198
7: 46.806567: 2.88977 -4.90150 0.934450 0.100404
8: 46.714417: 2.89010 -4.90138 0.907603 0.103759
9: 46.643799: 2.89426 -4.90027 0.908689 0.116539
10: 45.757018: 4.74674 -8.18016 0.903677 0.124912
11: 45.006723: 7.22065 -11.0193 0.905033 0.216867
12: 44.045505: 7.78897 -12.6115 0.906680 0.249119
13: 43.962659: 8.41807 -13.7239 0.906992 0.262863
14: 43.905812: 9.20864 -14.9814 0.907918 0.282674
15: 43.889650: 10.0922 -16.3553 0.909293 0.303567
16: 43.869667: 10.9824 -17.7519 0.910845 0.321277
17: 43.864211: 10.7292 -17.3406 0.910824 0.313492
Post processing for method nlminb
Successful convergence!
Save results from method nlminb
$par
a0 a1 alpha phi
10.7292082 -17.3405664 0.9108244 0.3134918
$message
[1] "relative convergence (4)"
$convcode
[1] 0
$value
[1] 43.86421
$fevals
function
31
$gevals
gradient
72
$nitns
[1] 17
$kkt1
[1] NA
$kkt2
[1] NA
$xtimes
user.self
91.086
goal! But had to put lower bound on alpha to do it. Interesting.
> gapr_marg_nlminb2 <-
+ gnlrim(y=y_cbind,
+ mu=~ stable_cdf2((a0 + a1*group)*(1^alpha)/phi + rand, c(alpha, 0, 1, 0)),
+ ##pmu=c( a0=bm0_start, a1=bm1_start, alpha=1.5, phi=0.50),
+ pmu=c( a0=0, a1=0, alpha=1.5, phi=0.50),
+ pmix=c(alpha=1.5, phi=0.50),
+ p_uppb = c( Inf , Inf, 2-1e-5, 1-1e-5),
+ p_lowb = c( -Inf, -Inf, 1.15, 0+1e-5),
+ distribution="binomial",
+ nest=id,
+ random="rand",
+ mixture="libstableR-subgauss-phi",
+ ooo=TRUE,
+ compute_hessian = FALSE,
+ compute_kkt = FALSE,
+ trace=1,
+ method="nlminb",
+ abs.tol.nlminb=1e-20, ## 1e-20,
+ xf.tol.nlminb=2.2e-10, ##2.2e-14,
+ x.tol.nlminb=1.5e-8, ##1.5e-8,
+ rel.tol.nlminb=1e-10, ##1e-10,
+ )
fn is fn
Looking for method = nlminb
Function has 4 arguments
par[ 1 ]: -Inf <? 0 <? Inf In Bounds
par[ 2 ]: -Inf <? 0 <? Inf In Bounds
par[ 3 ]: 1.15 <? 1.5 <? 1.99999 In Bounds
par[ 4 ]: 1e-05 <? 0.5 <? 0.99999 In Bounds
Analytic gradient not made available.
Analytic Hessian not made available.
Scale check -- log parameter ratio= 0.4771213 log bounds ratio= 0.0705775
Method: nlminb
0: 71.819860: 0.00000 0.00000 1.50000 0.500000
1: 66.496600: 0.00326712 -0.00469494 1.52102 0.420905
2: 59.810823: 0.0124732 -0.0157064 1.56418 0.263259
3: 58.541368: 0.147661 -0.145900 1.35375 0.0953913
4: 56.504180: 0.349478 -0.391080 1.31257 0.167135
5: 46.515541: 2.84655 -4.73472 1.15000 0.174623
6: 46.198757: 3.38396 -5.19292 1.15000 0.187130
7: 44.753816: 4.55416 -7.76376 1.15000 0.250539
8: 44.038791: 6.07374 -10.1432 1.15000 0.358069
9: 43.916601: 6.70881 -11.2583 1.15000 0.397498
10: 43.864832: 7.40337 -12.4510 1.15000 0.439471
11: 43.862070: 7.55060 -12.6867 1.15000 0.447611
12: 43.861449: 7.59436 -12.7462 1.15000 0.449680
13: 43.861295: 7.59347 -12.7370 1.15000 0.449507
14: 43.861240: 7.58402 -12.7191 1.15000 0.449129
15: 43.861193: 7.57288 -12.7007 1.15000 0.448908
16: 43.861174: 7.56972 -12.6973 1.15000 0.449090
17: 43.861173: 7.56813 -12.6949 1.15021 0.449208
18: 43.861171: 7.56942 -12.6975 1.15016 0.449278
19: 43.861171: 7.56940 -12.6975 1.15019 0.449238
20: 43.861170: 7.56931 -12.6975 1.15020 0.449298
21: 43.861170: 7.56935 -12.6977 1.15023 0.449288
22: 43.861168: 7.56897 -12.6980 1.15033 0.449343
23: 43.861168: 7.57026 -12.7004 1.15033 0.449439
24: 43.861168: 7.57128 -12.7022 1.15035 0.449521
25: 43.861168: 7.57133 -12.7023 1.15035 0.449523
Post processing for method nlminb
Successful convergence!
Save results from method nlminb
$par
a0 a1 alpha phi
7.5713326 -12.7022632 1.1503501 0.4495231
$message
[1] "relative convergence (4)"
$convcode
[1] 0
$value
[1] 43.86117
$fevals
function
39
$gevals
gradient
146
$nitns
[1] 25
$kkt1
[1] NA
$kkt2
[1] NA
$xtimes
user.self
90.121
Assemble the answers
I'm working up these cases in scratch_testing.R. Here's how it looks before any edits:
Note the warning message for "L-BGFS-B":
Now start bobyqa -- same model same data...
Note the warning messages involving maxfun:
bobyqa is so quick, but convereges to something weird.
start nlminb -- the default. are tolerances too tight?
Note the warnings:
Slow and steady. Now, the nlminb marg model matches the conditional model in the TSJYO summary table, and the conditional model converged. This makes me think it might be a false alarm about not converging...
Compare the L-BFGS-B above to the conditional model below. Looks like a winner!