hello all,

i'm trying to use QPmat, from the popbio package. it appears to be based
on solve.QP and is intended for making a population projection matrix.
QPmat asks for: nout, A time series of population vectors and C, C
constraint matrix, (with two more vectors, b and nonzero). i believe the
relevant code from QPmat is:

function (nout, C, b, nonzero)
{
    if (!"quadprog" %in% (.packages())) {
        library(quadprog)
    }
    n <- dim(nout)
    z <- nout[, 2:n[2]]
    z <- matrix(z, n[1] * (n[2] - 1), 1)
    M <- c()
    for (i in 1:(n[2] - 1)) {
        N <- kronecker(t(nout[, i]), diag(n[1]))
        m <- N[, nonzero]
        M <- rbind(M, m)
    }
    G <- t(M) %*% M
    f <- t(M) %*% z
    res <- solve.QP(G, f, -t(C), -b)

i'm receiving the error
"Error in solve.QP(G, f, -t(C), -b) :
  matrix D in quadratic function is not positive definite!"

solve.QP documentation says that Dmat goes into the place that is referred
to in the code as G. i've two matrices. nout is 31x3 and all elements are
0 or positive. my C matrix is 31 x 31 and has a -1 running diagonal from
the upper left to the lower right, with everything else 0. i'm somewhat
confused by what matrix or element is being multiplied as it leads up to G
and all i can guess is that i didn't construct the C matrix correctly. how
would i do that?

sorry if i have too much info or am missing something. thanks for your time.

john

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to