similar to: Constraints in Quadprog

Displaying 20 results from an estimated 300 matches similar to: "Constraints in Quadprog"

2009 Feb 16
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
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 Jun 02
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
2010 Dec 04
Quadratic programming with semi-definite matrix
Hello. I'm trying to solve a quadratic programming problem of the form min ||Hx - y||^2 s.t. x >= 0 and x <= t using solve.QP in the quadprog package but I'm having problems with Dmat not being positive definite, which is kinda okay since I expect it to be numerically semi-definite in most cases. As far as I'm aware the problem arises because the Goldfarb and Idnani method first
2012 Mar 16
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
2004 Sep 01
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
2010 Dec 06
use pcls to solve least square fitting with constraints
Hi, I have a least square fitting problem with linear inequality constraints. pcls seems capable of solving it so I tried it, unfortunately, it is stuck with the following error: > M <- list() > M$y = Dmat[,1] > M$X = Cmat > M$Ain = as.matrix(Amat) > M$bin = rep(0, dim(Amat)[1]) > M$p=qr.solve(as.matrix(Cmat), Dmat[,1]) > M$w = rep(1, length(M$y)) > M$C = matrix(0,0,0)
2006 Nov 08
Solving a maximization problem using QUADPROD
Hello, here is an example from the manual. How to turn this minimization problem into maximization problem, i.e. -(0 5 0) %*% b - 1/2 b^T b? # Assume we want to minimize: -(0 5 0) %*% b + 1/2 b^T b # under the constraints: A^T b >= b0 # with b0 = (-8,2,0)^T # and (-4 2 0) # A = (-3 1 -2) # ( 0 0 1) # we can use solve.QP.compact as follows: # library(quadprog) Dmat <- matrix(0,3,3)
2007 Jul 11
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
2011 May 11
Problem with constrained optimization with maxBFGS
Dear all, I need to maximize the v: v= D' W D D is a column vector ( n , 1) W is a given matrix (n, n) subject to: sum D= 1 (BTW, n is less than 300) I´ve tried to use maxBFGS, as follows: ##################################### objectiveFunction<-function(x) { return(t(D)%*%W%*%D) } Amat<-diag(nrow(D)) Amat<-rbind((rep(-1, nrow(D))), Amat) bvec<-matrix( c(0), nrow(D)+1,
2003 Aug 24
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 <-
2011 May 30
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)),
2008 Dec 24
Implementing a linear restriction in lm()
Dear All! I want to test a coeffcient restriction beta=1 in a univariate model lm (y~x). Entering lm((y-x)~1) does not help since anova test requires the same dependent variable. What is the right way to proceed? Thank you for your help and marry xmas, Serguei Kaniovski ________________________________________ Austrian Institute of Economic Research (WIFO)
2007 Feb 06
Questions on counts by case
Hi all, for the data below I would like to 1. generate a dummy variable for each group "gr" of the same composition by people, then save each portion in a separate file, 2. compute the frequency of "1"'s in "x" for each person by group "gr". So, "mike" will have freq=2/3, as he has two "1" and one "0" in 3 groups.
2009 Apr 18
Dummy (factor) based on a pair of variables
Dear All! my data is on pairs of countries, i and j, e.g.: y,i,j 1,AUT,BEL 2,AUT,GER 3,BEL,GER I would like to create a dummy (indicator) variable for use in regression (using factor?), such that it takes the value of 1 if the country is in the pair (i.e. EITHER an i-country OR an j-country). Thank you for your help, Serguei ________________________________________ Austrian Institute of
2006 Apr 26
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 arma.o bdstest.o boot.o dsumsl.o garch.o ppsum.o tsutils.o -framework vecLib
2002 May 30
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
2005 Dec 14
mysql connection problems
Hi hi i have a problem trying to connect to the mysql database when I do a rake it says: Access denied for user: ''@localhost'' to database '''' My database.yml file is fine Any ideas why this is happening -- Posted via
2018 Mar 05
Interpret List Label as Date from Quantmod getOptionChain
Hi Dirk, Thanks for your note. I understand that expiry dates are the dates that the option expires, so I don't think that I am confused about that (although the upper limits of one's confusion is difficult to accurately estimate). My lack of clarity come from treating those "dates" as actual dates as opposed to strings, which one could reasonably interpret them to be from
2003 Apr 03
Matrix eigenvectors in R and MatLab
Dear R-listers Is there anyone who knows why I get different eigenvectors when I run MatLab and R? I run both programs in Windows Me. Can I make R to produce the same vectors as MatLab? #R Matrix PA9900<-c(11/24 ,10/53 ,0/1 ,0/1 ,29/43 ,1/24 ,27/53 ,0/1 ,0/1 ,13/43 ,14/24 ,178/53 ,146/244 ,17/23 ,15/43 ,2/24 ,4/53 ,0/1