conroylau / lpinfer

lpinfer: An R Package for Inference in Linear Programs
GNU General Public License v3.0
3 stars 5 forks source link

qpci progress format should be tabular #7

Closed a-torgovitsky closed 4 years ago

a-torgovitsky commented 4 years ago

something like this

iter lb ub test pt. p-value reject
1 -1 0 -.5 0 TRUE
2 -.5 0 -.25 .06 FALSE
3 -.5 -.25 -.375 .04 TRUE

with each new row printed after each iteration

so if progress = TRUE there should be two tables printed: One for the left endpoint, one for the right endpoint after the table, you can print why termination happened the same way you do now

a-torgovitsky commented 4 years ago

Also, summary should print

  1. The call
  2. The significance level
  3. The two tables with termination messages
conroylau commented 4 years ago

Done!

Sample output during bisection method:

=== Computing lower bound of confidence interval ===
Iteration    Test point      Lower bound     Upper bound     p-value     Decision
Left end-pt.     0.00000     0.00000     NA      0.00000     Reject     
Right end-pt.    0.40000     NA      0.40000     0.78790     Do not reject  
1        0.20000     0.00000     0.40000     0.00000     Reject     
2        0.30000     0.20000     0.40000     0.00000     Reject     
3        0.35000     0.30000     0.40000     0.00000     Reject     
4        0.37500     0.35000     0.40000     0.25260     Do not reject  
5        0.36250     0.35000     0.37500     0.02290     Reject     
6        0.36875     0.36250     0.37500     0.09170     Do not reject  
7        0.36562     0.36250     0.36875     0.04640     Do not reject  
8        0.36406     0.36250     0.36562     0.03300     Do not reject  
9        0.36328     0.36250     0.36406     0.02780     Do not reject  
>>> Length of interval is below tolerance level. Bisection method is completed.

Sample message when using summary command:

Call:
invertci(f = dkqs, farg = farg, alpha = 0.05, lb0 = 0, lb1 = 0.4, 
    ub0 = 1, ub1 = 0.6, tol = 0.001, max_iter = 50, df_ci = NULL, 
    progress = TRUE)

Significance level: 0.05.

=== Iterations in constructing upper bound:
Iteration    Test point      Lower bound     Upper bound     p-value     Decision
Left end-pt.     0.60000     0.60000     NA      0.77780     Do not reject  
Right end-pt.    1.00000     NA      1.00000     0.00000     Reject     
1        0.80000     0.60000     1.00000     0.00000     Reject     
2        0.70000     0.60000     0.80000     0.00000     Reject     
3        0.65000     0.60000     0.70000     0.04140     Do not reject  
4        0.67500     0.65000     0.70000     0.00000     Reject     
5        0.66250     0.65000     0.67500     0.00000     Reject     
6        0.65625     0.65000     0.66250     0.01180     Reject     
7        0.65312     0.65000     0.65625     0.02130     Reject     
8        0.65156     0.65000     0.65312     0.03000     Do not reject  
9        0.65234     0.65156     0.65312     0.02570     Do not reject  
>>> Reached maximum number of iterations

=== Iterations in constructing lower bound:
Iteration    Test point      Lower bound     Upper bound     p-value     Decision
Left end-pt.     0.00000     0.00000     NA      0.00000     Reject     
Right end-pt.    0.40000     NA      0.40000     0.78790     Do not reject  
1        0.20000     0.00000     0.40000     0.00000     Reject     
2        0.30000     0.20000     0.40000     0.00000     Reject     
3        0.35000     0.30000     0.40000     0.00000     Reject     
4        0.37500     0.35000     0.40000     0.25260     Do not reject  
5        0.36250     0.35000     0.37500     0.02290     Reject     
6        0.36875     0.36250     0.37500     0.09170     Do not reject  
7        0.36562     0.36250     0.36875     0.04640     Do not reject  
8        0.36406     0.36250     0.36562     0.03300     Do not reject  
9        0.36328     0.36250     0.36406     0.02780     Do not reject  
>>> Reached maximum number of iterations
a-torgovitsky commented 4 years ago

Looks good. A couple minor edits:

conroylau commented 4 years ago

Done!

Updated sample output:

=== Iterations in constructing lower bound:
Iteration    Lower bound     Upper bound     Test point      p-value     Reject?
Left end pt.     0.00000     NA      0.00000     0.00000     TRUE   
Right end pt.    NA      0.40000     0.40000     0.78790     FALSE  
1        0.00000     0.40000     0.20000     0.00000     TRUE   
2        0.20000     0.40000     0.30000     0.00000     TRUE   
3        0.30000     0.40000     0.35000     0.00000     TRUE   
4        0.35000     0.40000     0.37500     0.25260     FALSE  
5        0.35000     0.37500     0.36250     0.02290     TRUE   
6        0.36250     0.37500     0.36875     0.09170     FALSE  
7        0.36250     0.36875     0.36562     0.04640     FALSE  
8        0.36250     0.36562     0.36406     0.03300     FALSE  
9        0.36250     0.36406     0.36328     0.02780     FALSE  
>>> Reached maximum number of iterations