Displaying 20 results from an estimated 100 matches similar to: "Is it solve.QP or is it me?"
2009 Feb 16
2
solve.QP with box and equality constraints
Dear list,
I am trying to follow an example that estimates a 2x2 markov transition
matrix across several periods from aggregate data using restricted least
squares.
I seem to be making headway using solve.QP(quadprog) as the unrestricted
solution matches the example I am following, and I can specify simple
equality and inequality constraints. However, I cannot correctly specify a
constraint
2005 Jan 13
1
how to use solve.QP
At the risk of ridicule for my deficient linear algebra skills, I ask
for help using the solve.QP function to do portfolio optimization. I
am trying to following a textbook example and need help converting the
problem into the format required by solve.QP. Below is my sample code
if anyone is willing to go through it. This problem will not solve
because it is not set up properly. I hope I
2012 Mar 16
1
quadprog error?
I forgot to attach the problem data, 'quadprog.Rdata' file, in my prior
email.
I want to report a following error with quadprog. The solve.QP function
finds a solution to the problem below that violates the last equality
constraint. I tried to solve the same problem using ipop from kernlab
package and get the solution in which all equality constraints are
enforced. I also tried an old
2011 May 30
0
definition of meq at spg
For my problem I have
#Constraints
b11<-0
b21<-0
b12<-0
b22<-0
n1>=0
n2>=0
n1<=1
n1<=1
n1+n2=1
In order to use spg I set
Amat<-matrix(rbind(c(rep(0,10)),c(rep(0,10)),c(rep(0,2),1,rep(0,7)),
c(rep(0,3),1,rep(0,6)),c(rep(0,10)),c(rep(0,10)),
c(rep(0,6),1,rep(0,3)),c(rep(0,7),1,rep(0,2)),
c(rep(0,8),1,rep(0,1)),c(rep(0,9),1,rep(0,0)),
2013 Mar 15
1
quadprog issues---how to define the constriants
Hi list:
This is my first time to post my question on the list. Thanks for your
help.
I am solving a quadratic programming using R. Here is my question:
w = arg min 0.5*w'Mw - w'N
s. t. sum(w) = 1;
w>0
note: w is weight vector, each w_i must >=0, and the sum of w =1.
Here is my R code:
A <-matrix(c(2.26,1.26,1.12,1.12,2.27,1.13,1.12,1.13,2.2),3,3);
B <-
2003 Aug 24
1
regression constraints (again)
Im trying to do regressions with constraints that the weights
are all >=0 and sum(weights) = 1. I've read the archive and have
set the problem up with solve.QP and just the non-negativity constraints
along the lines of:
y as the data vector
X as the design matrix
D <- t(X) %*% X
d <- t(t(y) %*% X)
A <- diag(ncol(X))
b <- rep(0,ncol(X))
fit <-
2007 Sep 03
2
The quadprog package
Hi everybody,
I'm using Windows XP Prof, R 2.5.1 and a Pentium 4 Processor.
Now, I want to solve a quadratic optimization program (Portfolio Selection) with the quadprog package
I want to minimize (\omega'%*%\Sigma%*%\omega)
Subject to
(1) \iota' %*% \omega = 1 (full investment)
(2) R'%*%\omega = \mu (predefined expectation value)
(3) \omega \ge 0 (no short sales).
Where
2018 May 05
1
adding overall constraint in optim()
Hi,
You can use the projectLinear argument in BB::spg to optimize with linear equality/inequality constraints.
Here is how you implement the constraint that all parameters sum to 1.
require(BB)
spg(par=p0, fn=myFn, project="projectLinear", projectArgs=list(A=matrix(1, 1, length(p0)), b=1, meq=1))
Hope this is helpful,
Ravi
[[alternative HTML version deleted]]
2005 Nov 29
1
Constraints in Quadprog
I'm having difficulty figuring out how to implement the
following set of constraints in Quadprog:
1). x1+x2+x3+x4=a1
2). x1+x2+x5+x6=a2
3). x1+x3+x5+x7=a3
4). x1+x2=b1
5). x1+x3=b2
6). x1+x5=b3
for the problem: MIN (x1-c1)2+(x2-c2)2+...+(x8-c8)2.
As far a I understand, "solve.QP(Dmat, dvec, Amat, bvec, meq=0,
factorized=FALSE)" reads contraints using an element-by-element
2015 May 20
0
xl stack problems on CentOS6 XEN4
Hi George,
I already outlined the drbd-stuff on xen-users (see attachement). Yes - elrepo is right on mark.
Excerpt:
"The script (/etc/xen/scripts/block-drbd) I am using is from drbd84-utils-8.9.2-1.el6.elrepo.x86_64 - and already seems to contain the "drbd or phy" case;
both in the add and the remove branch.
CentOS6 XEN4 is based on the Kernel 3.10.68-11.el6.centos.alt.x86_64
2002 Nov 20
0
error: prs_mem_get: reading data of size 60 would overrun buffer.
Hello everyone,
we try to use a server running linux in an NT-domain and get the error message
given in the subject-line. More details from the logfile and smb.conf are given below.
Can anyone give us a hint what the problem is?
(Of course...) The problem is very urgent for us.
Thanks a lot in advance.
Helmut Rickel
================= smb.conf ========================
[global]
2006 Jun 06
1
Problems using quadprog for solving quadratic programming problem
Hi,
I'm using the package quadprog to solve the following quadratic programming problem.
I want to minimize the function
(b_1-b_2)^2+(b_3-b_4)^2
by the following constraints b_i, i=1,...,4:
b_1+b_3=1
b_2+b_4=1
0.1<=b_1<=0.2
0.2<=b_2<=0.4
0.8<=b_3<=0.9
0.6<=b_4<=0.8
In my opinion the solution should be b_1=b_2=0.2 und b_3=b_4=0.8.
Unfortunately R doesn't find
2010 Jan 21
0
fPortfolio prob: maxreturnPortfolio() returns Na/NaN/Inf error
Hi - First posting here.
I am using fPortfolio to try and optimize a simple portfolio consisting of 5 daily return series. I want to maximize return subject to setTargetRisk(myspec)=0.08 using only constraints="LongOnly"
I can run feasiblePortfolio() using a spec file that specifies the weights, and it works fine.
When I run maxreturnPortfolio(mydata,myspec,"LongOnly"),
2001 Nov 20
0
Summary: non-negative least squares
Thank you Brian Ripley, Gardar Johannesson, and Marcel Wolbers for your
prompt
and friendly help! I will share any further learnings as I move through
these suggestions. -Bob Abugov
Brian Ripley wrote:
I just use optim() on the sum of squares with non-negativity constraints.
That did not exist in 1999.
Gardar Johannesson wrote:
You can always just use the quadratic programing library in R
2013 Apr 04
5
Help for bootstrapping‏
I have a set of data for US t-bill returns and US stock returns frm 1980-2012. I am trying to bootstrap the data and obtain the minimum variance portfolio and repeat this portfolio 1000 times. However I am unable to get the correct code function for the minimum variance portfolio. When I tried to enter Opt(OriData+1, 1, 5, 0), I get "error:subscript out of bounds" Please help!
2010 Mar 10
2
help R non-parametric IRT simulation
Hello R,
I am looking for non-parametric simulation in IRT. Is there any IRT
package that does non-parametric simulation?
helen L
[[alternative HTML version deleted]]
2007 Jul 11
0
Some questions about quadratic programming (QP)
Dear R Users ,
As a beginner in QP, I'm trying to solve a Support Vector Machine problem by a QP. In particulare I am using the quadprog package.
My questions are here:
1- In the document for the package (The quadprog Package), the inequality constraint is mentioned with >= , however in a standard QP, this usaully is written with <= . This constraint should be multiplied by a
2003 Jun 02
1
Help with factorized argument in solve.QP
Hi
I'm having problems getting the "factorized" argument in solve.QP (part
of the quadprog library) to work as expected. The helpfile states that
when the factorized argument is set to TRUE, then the function requires
the inverse of a square-root factor of the Hessian instead of the
Hessian itself. That is, when factorized=TRUE, the Dmat argument should
be a matrix R^(-1), such
2007 Jul 02
1
QP for solving Support Vector Regression
Dear R users,
I'm trying to run the Support Vector Regression by a general quadratic programming function like ipop ( ) in kernlab or solve.QP ( ) in quadprog packages.
Since they are general, their application in Support Vector Regression can lead to misunderstanding, particularly when constructing matrices. Even their examples are general and applied in Support Vector
2007 Dec 22
0
regarding lack of quadratic term in solve.qp
I was thinking about my solve.qp problem on my way home tonight and I think
I can fix it by making Dmat the identity matrix. I'll check this weekend to
make sure
but my thinking is that doing this will make all the "variances" the same so
that they shouldn't come into play during the evaluation of the objective
function.
Thanks though for any confirmation of this or other