Displaying 14 results from an estimated 14 matches for "dvec".

Did you mean:
dec

2003 Jun 02

1

Help with factorized argument in solve.QP

...an itself. That is, when factorized=TRUE, the Dmat argument should
be a matrix R^(-1), such that the Hessian of the objective function is
t(R) %*% R.
I modified the example in the helpfile slightly to test this out:
R = matrix(rnorm(9),3,3)
R.inv = solve(R)
Dmat = t(R) %*% R
dvec = c(0,5,0)
Amat = matrix(c(-4,-3,0,2,1,0,0,-2,1),3,3)
bvec = c(-8,2,0)
x1 = solve.QP(Dmat=Dmat, dvec=dvec, Amat=Amat, bvec=bvec,
factorized=FALSE)
x2 = solve.QP(Dmat=R.inv, dvec=dvec, Amat=Amat, bvec=bvec,
factorized=TRUE)
print(x1$solution)
print(x2$solution)
I wou...

2009 Feb 16

2

solve.QP with box and equality constraints

...general principle of creating box constraints by creating
pairs of positive and negative values within the constraint matrix (
http://tolstoy.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.
#######...

2005 Jan 13

1

how to use solve.QP

...<= w #<=1=bUp] to
Amat <- rbind(-1, 1, -mu, mu)
dim(bLo) <- c(n,1)
dim(bUp) <- c(n,1)
bvec <- rbind(-1, 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

2013 Feb 21

0

About multivariate GARCH: DVEC and BEKK

Dear All,
I attempted to fit a DVEC and a BEKK multivariate GARCH model, but am
wondering which package to use.
1. I tried to use "rmgarch" package in R, but I couldn't find the
subroutines for DVEC and BEKK.
2. I tried to find "rmgarch" package of R, which is not located on the
official R site. This is...

2010 Dec 04

1

Quadratic programming with semi-definite matrix

...matrix. Are there any (fast) packages
that allows me to do QP with (large) semidefinite matrices?
Example:
t <- 100
y <- signalConvNoisy[1,]
D <- crossprod(H,H)
d <- crossprod(H,y)
A <- cbind(rep(-1, nrow(H)), diag(ncol(H)))
b0 <- c(t, rep(0, ncol(H)))
sol <- solve.QP(Dmat=D, dvec = d, Amat = A, bvec = b0)$solution
Error in solve.QP(Dmat = D, dvec = d, Amat = A, bvec = b0) :
matrix D in quadratic function is not positive definite!
Thanks in advance,
Andreas Jensen

2018 Mar 05

0

Interpret List Label as Date from Quantmod getOptionChain

...6" "2018-04-13" "2018-04-20" "2018-05-18"
[8] "2018-06-15" "2018-08-17" "2018-09-21" "2018-10-19" "2018-11-16" "2019-01-18" "2019-06-21"
[15] "2020-01-17" "2020-06-19"
R> dvec <- anydate(names(aapl_total)) # helper variable
R> ind <- dvec >= anydate("2018-04-01") & dvec <= anydate("2018-04-30") # one example
R> ind
[1] FALSE FALSE FALSE TRUE TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
R...

2018 Mar 05

2

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

2004 Sep 01

0

not positive definite D matrix in quadprog

...s)
#now all eigenvalues are positive:
D.values.new <-
eigen(D.vectors%*%D.quad%*%ginv(D.vectors),only.values=F)$values
D.values.new
[1] 4.609489e+04 2.458166e+03 8.232288e+01 1.961199e+00 5.976441e-01
[6] 2.810968e-01 1.253140e-09 1.428534e-12
Dmat <- D.vectors%*%D.quad%*%ginv(D.vectors)
dvec <-
-c(-2910.533769,-2905.609008,-3012.223863,-16274.97455,-17222.46423,-18380.6
391,-357.8878464,-379.6371849)
#this ensures that coefficients are positive:
Amat <- matrix(0,8,8)
diag(Amat) <- 1
bvec <- rep(0,8)
#it says D is not positive definite ...
solve.QP(Dmat,dvec,Amat,bvec=...

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
multiplication, i.e. Amat'*x, not using the matrix-product, i.e.
Amat'%*%x, required for the sums on the left-hand-side of 1-6).
I would very much appreciate a suggestion on this problem.
Thank you,...

2006 Nov 08

0

Solving a maximization problem using QUADPROD

...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)
diag(Dmat) <- 1
dvec <- c(0,5,0)
Aind <- rbind(c(2,2,2),c(1,1,2),c(2,2,3))
Amat <- rbind(c(-4,2,-2),c(-3,1,1))
bvec <- c(-8,2,0)
solve.QP.compact(Dmat,dvec,Amat,Aind,bvec=bvec)
Thanks,
Serguei

2012 Mar 16

1

quadprog error?

...o contact Berwin A. 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(...

2013 Nov 21

1

how can I import a number of datsets in a folder in my working directory to a list in R

Hi,
Suppose, if I create 15 files in my working directory.
set.seed(48)
lapply(1:15,function(i) {m1 <- matrix(sample(1:20,1686*2,replace=TRUE),nrow=1686,ncol=2); write.table(m1,paste0("file_",i,".txt"),row.names=FALSE,quote=FALSE)})
?D <-dir()
D1 <- D[order(as.numeric(gsub("\\D+","",D)))]
D1
?res <- t(sapply(D1,function(x) {x1<-

2007 May 03

0

Problem with GARCH models in R compared to S-PLUS

Hi R,
I have three queries regarding handling GARCH functions in R. Below I
document the same:
Unlike S-Plus, R doesn't handle Multivariate GARCH models.
R has a package for BEKK GARCH model but not for DVEC GARCH models.
The GARCH function in S-PLUS has the capability of fixing some model
parameters at certain values to evaluate the fit of a particular model. But
the same optionality is not provided by the GARCH models in R.
So, how can I overcome these difficulties which I am facing in R? Are these...

2007 Jul 11

0

Some questions about quadratic programming (QP)

...gument for that?
3- In QP formulation we have a constant 1/2 in objective function. This should be multiplied by the user or it is done by the algorithm?
4- More important, when I multiply a b*b matrix by D in quadratic term of objective function, I get thise message:
Error in solve.QP(Dmat, dvec, Amat, bvec) :
matrix D in quadratic function is not positive definite!
How to multiply b*b matrix by the diagonal matrix ?
Thank you very much for any help.
Amir
---------------------------------
Park yourself in front of a world of choices in alternative vehicles.
[[alte...