[R] Quadratic programming

Abby Spurdle @purd|e@@ @end|ng |rom gm@||@com
Wed Sep 23 08:11:22 CEST 2020


> I'm trying to replicate a C++ code with R.

Notes:
(1) I'd recommend you make the code more modular.
i.e. One function for initial data prep/modelling, one function for
setting up and solving the QP, etc.
This should be easier to debug.
(However, you would probably have to do it to the C++ code first).
(2) Your R code is not completely reproducible.
i.e. AEJData
(3) For the purposes of a reproducible example, your code can be simplified.
i.e. Only one contributed R package should be attached.

Regardless of (1) above, you should be able to identify at what point
the C++ and R code becomes inconsistent.
The simplest approach is to add print-based functions into both the
C++ and R code, and print out state data, at each major step.
Then all you need to do is compare the output for both.

> Is there a better/another package for these types of problems?

I'm not sure.
After a quick search, this is the best I found:

scam::scam
scam::shape.constrained.smooth.terms



More information about the R-help mailing list