Displaying 20 results from an estimated 4000 matches similar to: "regression constraints (again)"
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
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
2004 Apr 14
2
attaching data.frame/list within a function
I'm trying to find a good way of attaching a list within a function such
that the attached variables (the list's members) precede the global
environment (.GlobalEnv) in the search list. Here is a non-working example
using attach(), which hopefully explains better what I'm trying to do:
> foo <- function(x=0, input=list(a=10)) {
+ attach(input)
+ on.exit(detach(input))
+
2002 Nov 27
1
problem with attr()
I got this wired behaviour of the attr() function using R-1.6.1 on both
linux redhat 7.3 (i386) and Solaris 8 (Sparc):
> tmp <- list(id=1)
>
> attr(tmp,"n.ch") <- 2
> attr(tmp,"n") <- 1
> tmp
$id
[1] 1
attr(,"n.ch")
[1] 2
attr(,"n")
[1] 1
>
> attributes(tmp)
$names
[1] "id"
$n.ch
[1] 2
$n
[1] 1
>
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
2001 Nov 26
2
R not giving memory back to system?
This might be because I didn't get it right, but; I thought R would
release memory back to the system as (big) objects get removed?
Here is my platform (with 1Gb of RAM):
platform sparc-sun-solaris2.8
arch sparc
os solaris2.8
system sparc, solaris2.8
status
major 1
minor 3.1
year 2001
month 08
day 31
language R
A little example:
Start a new section of R, with
2001 Dec 20
1
optimizing R-1.4.0 build on Solaris; a show-and-tell storry
This is a little success story about the benefits of changing
the defaults in config.site when I was building R-1.4.0 for Solaris
(on a Sun Sparc that I'm currently using).
For previous versions of R, I had just used the default config.site and
not given it any thought. Since the Sun machine that I'm using
is not getting any faster, I decided I would give config.site a look
when building
2000 Jun 22
1
'pausing' in R
I have this 'odd' problem; I need to let R pause, for a given time, before
starting next iteration in a loop. I'm using the following to do this
task, but feel a little bit guilty because I'm using as much CPU time as I
can get while pausing:
while(keepGoing) {
t.end <- proc.time()[3] + 5 ## the time this loop should end at
[block of R commands]
while(proc.time()[3]
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 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
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 <-
2002 Sep 18
1
problem with make fullcheck on Sparc Solaris 8
I have been trying out R-1.6.0 tarballs (2002-9-10 and 2002-9-17) on:
arch sparc
os solaris2.8
system sparc, solaris2.8
status beta
major 1
minor 6.0
year 2002
month 09
day 17
language R
As you see form above, R-1.6.0 compiles fine and works. However, when I
"make fullcheck" I get the following error:
running code in 'tools-Ex.R' ... OK
2007 Apr 24
1
Matrix: how to re-use the symbolic Cholesky factorization?
I have been playing around with sparse matrices in the Matrix
package, in particularly with the Cholesky factorization of matrices
of class dsCMatrix. And BTW, what a fantastic package.
My problem is that I have to carry out repeated Cholesky
factorization of a spares symmetric matrices, say Q_1, Q_2, ...,Q_n,
where the Q's have the same non-zero pattern. I know in this case one
does
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
2007 Sep 21
1
Is it solve.QP or is it me?
Hi.
Here are three successive examples of simple quadratic programming problems
with the same structure. Each problem has 2*N variables, and should have a
solution of the form (1/N,0,1/N,0,...,1/N,0). In these cases, N=4,5,6. As
you will see, the N=4 and 6 cases give the expected solution, but the N=5
case breaks down.
>cm8
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,] 1 0
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
2002 Sep 20
0
problem with make on sparc solaris 8 ( R-1.6.0beta_2002-09-18.tar.gz)
This is something that I have not seen in earlier beta versions of 1.6.0:
.
.
.
ts.plot text html latex example
ts.union text html latex example
tsSmooth text html latex
tsdiag text html latex example
R_LIBS= ../../../bin/R CMD INSTALL
ERROR: no packages
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
2000 Jun 22
1
Summary: 'pausing' in R (fwd)
The question was:
> I have this 'odd' problem; I need to let R pause, for a given time, before
> starting next iteration in a loop. I'm using the following to do this
> task, but feel a little bit guilty because I'm using as much CPU time as I
> can get while pausing:
>
> while(keepGoing) {
> t.end <- proc.time()[3] + 5 ## the time this loop should end
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!