smartdata-analysis-and-statistics / precmed

A doubly robust precision medicine approach to estimate and validate conditional average treatment effects
https://smartdata-analysis-and-statistics.github.io/precmed/
Apache License 2.0
4 stars 0 forks source link

Check use of wrapper functions #27

Closed NightlordTW closed 1 year ago

NightlordTW commented 1 year ago

wrappers are already there (e.g., cv function), we should check if they are properly defined and consistently used in the examples.

Usually, a wrapper function would be very small, and forward function calls to the dedicated functions. An example is given below:

uvmeta <- function(r, r.se, r.vi, method="REML", test="knha", labels, na.action, 
                   n.chains=4, pars, verbose=FALSE, ...) 
  UseMethod("uvmeta")

We can specify in the cv function which outcome is being modelled, and then use a switch statement to forward the function call the the relevant cv subfunction

StanWijn commented 1 year ago

Check (and remove) all arguments being passed on from cv to cvcount:

  if (response == "count"){
    cvout <- cvcount(cate.model = cate.model, ps.model = ps.model, data = data, score.method = score.method,
                     higher.y = higher.y, abc = abc,
                     prop.cutoff = prop.cutoff, prop.multi = prop.multi,
                     ps.method = ps.method, minPS = minPS, maxPS = maxPS,
                     train.prop = train.prop, cv.n = cv.n, error.max = error.max, max.iter = max.iter,
                     initial.predictor.method = initial.predictor.method, xvar.smooth = xvar.smooth.score,
                     tree.depth = tree.depth, n.trees.boosting = n.trees.boosting, B = B, Kfold = Kfold,
                     error.maxNR = error.maxNR, max.iterNR = max.iterNR, tune = tune,
                     seed = seed, plot.gbmperf = plot.gbmperf, verbose = verbose)
StanWijn commented 1 year ago

Resolved in cba5ce740103c840e71509998803681fecd456f4