Displaying 20 results from an estimated 100 matches similar to: "quadprog issues---how to define the constriants"
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
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
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
2008 Jan 11
1
Adding weights to ecdf
I would like you consider that the function ecdf
could be extended in the following way to handle weights
when computing Empirical distribution Functions. There
exist particular cases that supports this kind of
extension, see for example:
Rao, C. R., 1997.
Statistic and True. Putting chance to work.
World Scientific Publishing.
Cox, D. R., 1969.
Some Sampling Problems in Technology.
New
2005 Oct 09
1
enter a survey design in survey2.9
Hi dears,
I expect that Mr Thomas Lumley will read this message.
I have data from a complexe stratified survey. The population is divide in 12 regions and a region consist to and urban area and rural one. there to region just with urbain area.
stratification variable is a combinaison of region and area type (urban/rural)
In rural area, subdivision are sample with probabilties proporionnal to
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
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
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 <-
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]]
2008 Mar 03
2
Constrained regression
Dear list members,
I am trying to get information on how to fit a linear regression with
constrained parameters. Specifically, I have 8 predictors , their
coeffiecients should all be non-negative and add up to 1. I understand it is
a quadratic programming problem but I have no experience in the subject. I
searched the archives but the results were inconclusive.
Could someone provide suggestions
2010 Oct 31
2
Constrained Regression
Hello everyone,
I have 3 variables Y, X1 and X2. Each variables lies between 0 and 1. I want
to do a constrained regression such that a>0 and (1-a) >0
for the model:
Y = a*X1 + (1-a)*X2
I tried the help on the constrained regression in R but I concede that it
was not helpful.
Any help is greatly appreciated
--
Thanks,
Jim.
[[alternative HTML version deleted]]
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!
2003 Jul 24
0
negative binomial
I am trying to model counts data from three different sites where the number of zeros differs significantly from one sight to another and also the counts gets bigger in site with few number of zeros considerably, meaning that the k's are different. In my model I am including about 10 covariates to start with, and I have beed attempting to fit a NEGATIVE BINOMIAL MODEL. The problem is the
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)),
2002 May 30
0
Followup on quadprog installation
Oops... just realized there were a couple mistakes in the question
I posted regarding installation of quadprog:
1) The gcc command line is shown wrapped to the next line.
Please ignore this.
2) In addition to adding a -Lc:/apps/rw1050/bin option to the
command line, I also added -lRblas.
Thanks,
-jh-
=================================
John Heumann, Agilent Technologies,
2004 Sep 01
0
not positive definite D matrix in quadprog
Hello to everybody,
I have a quadratic programming problem that I am trying to solve by various
methods. One of them is to use the quadprog package in R.
When I check positive definiteness of the D matrix, I get that one of the
eigenvalues is negative of order 10^(-8). All the others are positive. When
I set this particular eigenvalue to 0.0 and I recheck the eigenvalues in R,
the last
2006 Apr 26
1
MacOSX package install problem: pkgs quadprog & tseries
I upgraded to R-2.2.1 on two PPC G5 computers today. Further I want
to work with the tseries package for the first time.
As root with
R CMD INSTALL tseries_0.10-0.tar.gz
I get the following
gcc-3.3 -bundle -flat_namespace -undefined suppress -L/usr/local/lib -
o tseries.so arma.o bdstest.o boot.o dsumsl.o garch.o ppsum.o
tsutils.o -framework vecLib -L/usr/local/lib/gcc/powerpc-apple-
2009 Nov 04
3
Constrained Optimization
Hi All,
I'm trying to do the following constrained optimization example.
Maximize x1*(1-x1) + x2*(1-x2) + x3*(1-x3)
s.t. x1 + x2 + x3 = 1
x1 >= 0 and x1 <= 1
x2 >= 0 and x2 <= 1
x3 >= 0 and x3 <= 1
which are the constraints.
I'm expecting the answer x1=x2=x3 = 1/3.
I tried the "constrOptim" function in R and I'm running into some issues.
I first start off
2010 Feb 19
1
Quadprog help
I am having some problems using Quadprog in R. I want to minimize the
objective function :
200*P1-1/2*10*P1^2+100*P2-1/2*5*P2^2+160*P3-1/2*8*P3^2+50*P4-1/2*10*P4^2+50*P
5-1/2*20*P5^2+50*P6-1/2*10*P6^2,
Subject to a set of constrains including not only the variables P1, P2, P3,
P4, P5, P6, but also the variables X1, X2,X3,X4,X5,X6,X7,X8,X9.
As the set of variables X's are not