# search for: meq

Displaying 8 results from an estimated 8 matches for "meq".

Did you mean: me
2011 May 30
0
definition of meq at spg
...0)),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)), c(rep(0,8),1,rep(0,1)),c(rep(0,9),1,rep(0,0)), c(rep(0,8),1,1)),ncol=10) b<-c(rep(0,4),rep(0,4),0,0,-1,-1,-1) meq<-c(seq(1:8),13) #1:8 &13 condition is an equality Although spg gives "Successful convergence" it also gives the message: There were 50 or more warnings (use warnings() to see the first 50) Warning messages: 1: In if (meq > 0 | any(b - c(A %*% par) > 0)) { ... : the condi...
2009 Feb 16
2
solve.QP with box and equality constraints
...olstoy.newcastle.edu.au/R/help/05/10/14251.html), but when I pass this expanded constraint matrix to solve.QP it complains that Amat and dvec are incompatible. How should I expand dvec (and consequently Dmat) to accomodate the larger Amat? Moreover, I am unclear how to apply the meq equality constraint across more than one cell (i.e. rows summing to one) although I have attempted a guess below. Any help warmly received. Selwyn. ################ #examples below ################ library(quadprog) #pairs of population values over time mat = cbind( cal = c(12988,13408,13834,1...
2003 Aug 24
1
regression constraints (again)
...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 <- solve.QP(D=D,d=d,A=t(A),b=b,meq=0) (as per Gardar Johannesson '01) When I try to add the extra constraint that sum(weights)=1 I get errors owing to incompatibility of matrices. I add the constraint by putting an extra column of all ones to A and setting meq=1. I can work round it I think, by using an intercept and usin...
2012 Mar 16
1
.... Turlach <Berwin.Turlach at gmail.com> (maintainer for quadprog package) a week ago, with no success. ############################################################## load(file='quadprog.Rdata') # solve QP using quadprog require(quadprog) sol = solve.QP(Dmat, dvec, Amat, bvec, meq) x = sol\$solution check = x %*% Amat - bvec # for some reason last equality constraint is violated round(check[1:meq], 4) # solve QP using kernlab require(kernlab) n = nrow(Amat) sv = ipop(c = matrix(dvec), H = Dmat, A = t(Amat[,1:meq]), b = bvec[1:meq], l = rep(-1000, n), u =...
2005 Jan 13
1
how to use solve.QP
...1, mu.target, Inf, bLo, -bUp) zMat <- matrix(rep(0,2*n*n),ncol=n, nrow=n*2) zMat[,1] <- c(rep(1,n), rep(-1,n)) Amat <- t(rbind(Amat, zMat)) #So I set Dmat=Cov and set dvec=0 Dmat=Cov dvec=rep(0, nrow(Amat)) #The first two rows of Amat should be equality constraints (so weights sum to 1) meq <- 2 sol <- solve.QP(Dmat=Dmat, dvec=dvec, Amat=Amat, bvec=bvec, meq) sol
2018 May 05
1