Displaying 1 result from an estimated 1 matches for "invvech".
Did you mean:
intech
2009 Jan 19
0
optim() example in relist() help page
...particular, in the current form it is
not taken into account that vcov should be a symmetric matrix and only
the parameters in the lower (or upper) triangular part should be optimized.
A possible fix is:
ipar <- list(mean = c(0, 1), vcov = c(1, 1, 0))
initial.param <- as.relistable(ipar)
invvech <- function (x) {
d <- 0.5 * (sqrt(8 * length(x) + 1) - 1)
out <- matrix(0, d, d)
out[lower.tri(out, TRUE)] <- x
ind <- upper.tri(out)
out[ind] <- t(out)[ind]
out
}
ll <- function (param.vector) {
param <- relist(param.vector, skeleton = i...