similar to: use pcls to solve least square fitting with constraints

Displaying 20 results from an estimated 800 matches similar to: "use pcls to solve least square fitting with constraints"

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
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
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
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
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
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
2007 Dec 22
1
using solve.qp without a quadratic term
I was playing around with a simple example using solve.qp ( function is in the quadprog package ) and the code is below. ( I'm not even sure there if there is a reasonable solution because I made the problem up ). But, when I try to use solve.QP to solve it, I get the error that D in the quadratic function is not positive definite. This is because Dmat is zero because I don't have a
2010 Dec 04
1
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
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
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 <-
2009 Nov 11
1
Help with fPortfolio
Hi I'm getting the following errors while using the efficientPortfolio function even though I'm setting the target return to the mean of the TargetReturn I obtain from the portfolio object created by the feasiblePortfolio function. First Error: Error: targetReturn >= min(mu) is not TRUE Second Error: Error in .rquadprog(Dmat = args$Dmat, dvec = args$dvec, Amat = args$Amat, :
2007 Jul 02
0
relocation error in grDevices.so
(Warning: I'm not an R guy. I'm a Python guy trying to get the R-Python interface working again after some upgrades.) I'm trying to upgrade our numpy/rpy/matplotlib environment (Solaris 10/Intel, Python 2.4). In the process I found I needed to rebuild R (2.1.1) because it was compiled with gcc 3.3.2 and we have since migrated to gcc 3.4.1. I'm using this configure setup:
2008 May 08
0
solve.QP() error
I got following error while I was using solve.QP() in my problem: > Dmat = matrix(c(0.0001741, 0.0001280, 0.0001280, 0.0002570), nrow=2) > dvec = t(c(0,0)) > Amat = matrix(c(-1,1,0,-1,0, 1,0,1,0,-1), nrow=5) > bvec = c(-20000, 1, 1, -50000, -50000) > solve.QP(Dmat,dvec,Amat,bvec=bvec) Error in solve.QP(Dmat, dvec, Amat, bvec = bvec) : Amat and dvec are incompatible! >
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
2013 Mar 11
1
Use pcls in "mgcv" package to achieve constrained cubic spline
Hello everyone,          Dr. wood told me that I can adapting his example to force cubic spline to pass through certain point.          I still have no idea how to achieve this. Suppose we want to force the cubic spline to pass (1,1), how can I achieve this by adapting the following code? # Penalized example: monotonic penalized regression spline ..... # Generate data from a monotonic truth.
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"),
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
2007 Dec 14
1
Quadratic Programming
Hi all! I have a little question concerning quadprog. To make it simple I'll start by stating the problem: I want to minimize h(d,delta)=0.5d^T B d +nabla(f(x))^T d +rho*delta^2 With respect to d\in R^n and delta \in R. I obviously have constraints (depending on both d and delta). Solve.QP does give me a good result for d but I cannot obtain anything for delta. Simce dim(Dmat)=n and
2006 Nov 08
0
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)
2020 Nov 03
2
Query on constrained regressions using -mgcv- and -pcls-
Hello all, I'll level with you: I'm puzzled! How is it that this constrained regression routine using -pcls- runs satisfactorily (courtesy of Tian Zheng): library(mgcv) options(digits=3) x.1=rnorm(100, 0, 1) x.2=rnorm(100, 0, 1) x.3=rnorm(100, 0, 1) x.4=rnorm(100, 0, 1) y=1+0.5*x.1-0.2*x.2+0.3*x.3+0.1*x.4+rnorm(100, 0, 0.01) x.mat=cbind(rep(1, length(y)), x.1, x.2, x.3, x.4)