conroylau / lpinfer

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

Bounds output from invertci is strange #96

Closed a-torgovitsky closed 4 years ago

a-torgovitsky commented 4 years ago
library("lpinfer")
source("~/R/x86_64-pc-linux-gnu-library/3.6/lpinfer/example/dgp_mixedlogit.R")

dgp <- mixedlogit_dgp()
set.seed(1)
data <- mixedlogit_draw(dgp, n = 2000)

lpm <- lpmodel(A.obs = mixedlogit_Aobs(dgp),
               beta.obs = function(d) mixedlogit_betaobs(d, dgp),
               A.shp = rep(1, nrow(dgp$vdist)),
               beta.shp = 1,
               A.tgt = mixedlogit_Atgt_dfelast(dgp, w2eval = 1, eeval = -1))

r <- invertci(f = fsst, farg = list(lpm = lpm, data = data))
print(r$lb)
print(str(r$lb))
[[1]]
[[1]][[1]]
[1] 0.1042175

List of 1
 $ :List of 1
  ..$ : num 0.104
NULL

I see no reason that r$lb should be such a complicated object, nor why it should be different than r$ub. Why not just return r$ci as a simple vector with two elements?

conroylau commented 4 years ago

Done! In fact, I have added a data frame in an earlier commit when I added the feature for invertci to consider the case with multiple tuning parameters. However, it was in a different format and in another name.

I have revised the data frame for the confidence intervals as follows:

The lb and ub objects are redundant now so they are dropped.

Thanks!

a-torgovitsky commented 4 years ago

Looks good now, thanks