[R] Linear optimization with quadratic constraints
jdnewmil at dcn.davis.ca.us
Sun Jan 8 06:56:41 CET 2017
I did't really feel like digging through your HTML-contaminated email 
that has nothing concrete in it, most notably R code and input data, nor
an expected result that the code should yield. (Before you protest that
you are LOOKING for R code, please go read about reproducible R examples
 since you CAN translate a sample problem of the type you want to solve
into input data and expected results as dput() output. If you can't then
you may not understand your own problem clearly yet and we are unlikely to
understand what you want anyway.)
A quick skim leaves me wondering why you don't just use the lm function. I
don't get why you have formulated this with a constraint at all... the
B_hat complication seems counterproductive since there is no particular
reason to think that a solution is even present meeting that constraint.
(Then again, I am looking at corrupted HTML which may be contributing to
the confusion.) Anyway, I am not a mathematician and this is not a theory
discussion list, so you need make the problem more concrete and perhaps
someone here can come up with a concrete solution.
When you say you found stuff on the web that didn't meet your needs, you
should cite it and describe why not specifically so we don't find it and
think "you should have found this yourself". The second hit that came up
when I typed 'R linear optimization "quadratic constraint"' into Google
was https://cran.r-project.org/web/packages/ROI/ROI.pdf, which seems
relevant though I have never used that particular package and you have not
explicitly said why the examples in that package are not useful to you.
 Read the Posting Guide at the footer of every email on this mailing
list... the mailing list is explicitly for plain text email and usually
damages HTML format so don't put it in there to begin with.
 Google "reproducible R example"
On Sat, 7 Jan 2017, Preetam Pal wrote:
> Hi Guys,
> Any help with this,please?
> On Thu, Jan 5, 2017 at 4:09 AM, Preetam Pal <lordpreetam at gmail.com> wrote:
>> Hello guys,
>> The context is ordinary multivariate regression with k (>1) regressors,
>> i.e. *Y = XB + Error*, where
>> Y = n X 1 vector of predicted variable,
>> X = n X (k + 1) matrix of regressor variables(including ones in the first
>> B = (k+1) vector of coefficients, including intercept.
>> Say, I have already estimated B as B_hat = (X'X)^(-1) X'Y.
>> I have to solve the following program:
>> *minimize f(B) = LB* ( L is a fixed vector 1 X (k+1) )
>> such that:
>> *[(B-B_hat)' * X'X * (B-B_hat) ] / [ ( Y - XB_hat)' (Y - XB_hat) ] * is
>> less than a given value *c*.
>> Note that this is a linear optimization program *with respect to B* with
>> quadratic constraints.
>> I don't understand how we can solve this optimization - I was going
>> through some online resources, each of which involve manually computing
>> gradients of the objective as well as constraint functions - which I want
>> to avoid (at least manually doing this).
>> Can you please help with solving this optimization problem? The inputs
>> would be:
>> - X and Y
>> - B_hat
>> - L
>> - c
>> Please let me know if any further information is required - the set-up is
>> pretty general.
> Preetam Pal
> M-Stat 2nd Year, Room No. N-114
> Statistics Division, C.V.Raman
> Indian Statistical Institute, B.H.O.S.
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
More information about the R-help