X-Git-Url: https://git.auder.net/?p=morpheus.git;a=blobdiff_plain;f=pkg%2FR%2FoptimParams.R;h=c42e6c54e022d454196c2ded156b3a4d1caa553d;hp=b7d901c16fae591f7c320d235cf7be825d76115c;hb=44559add0e38058d9ce539c4b91246e4a088f67a;hpb=0f5fbd1371011f25cd1f6caf0e826d2ea9e4e245 diff --git a/pkg/R/optimParams.R b/pkg/R/optimParams.R index b7d901c..c42e6c5 100644 --- a/pkg/R/optimParams.R +++ b/pkg/R/optimParams.R @@ -104,7 +104,7 @@ setRefClass( list( # p: dimension K-1, need to be completed "p" = c(v[1:(K-1)], 1-sum(v[1:(K-1)])), - "β" = matrix(v[K:(K+d*K-1)], ncol=K), + "β" = t(matrix(v[K:(K+d*K-1)], ncol=d)), "b" = v[(K+d*K):(K+(d+1)*K-1)]) }, @@ -112,12 +112,12 @@ setRefClass( { "Linearize vectors+matrices from list L into a vector" - c(L$p[1:(K-1)], as.double(L$β), L$b) + # β linearized row by row, to match derivatives order + c(L$p[1:(K-1)], as.double(t(L$β)), L$b) }, computeW = function(θ) { - #return (diag(c(rep(6,d), rep(3, d^2), rep(1,d^3)))) require(MASS) dd <- d + d^2 + d^3 M <- Moments(θ)