conroylau / lpinfer

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

DKQS does not choose tau automatically if the user does not specify it #86

Closed a-torgovitsky closed 4 years ago

a-torgovitsky commented 4 years ago

This conflicts with the behavior discussed in the README.md whereby if the user does not pass tau then we automatically compute the largest feasible one and use that.

devtools::load_all()
source("../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))
dkqs(data = data, lpm, .5)

gives

 Error: The object 'tau' has to be a nonnegative number. 
conroylau commented 4 years ago

Done! I have coded the part to choose tau when the user does not specify it, but there was a bug in the part that checks the arguments so it results in the error. It has been updated and the above code now gives the following:

 p-value: 1                                                                               
 tau used: 1

Thanks!