r - use an "array" to store objects -
i have use copulas create large sample of size n. problem procedure time consuming since have recreate same copulas n times.
what i'm trying find way of storing copulas in kind of array, create copulas once, store them, , use them n times.
in r, idea this: fill upper left diagonal matrix copulas kind of bi-dimensional container (named copula)
for(r in 1:dimension){ for(c in 1:(dimension+1-r) ){ copula[r,c] = getcopula(copulastr, pcopula[r,c]) }
}
, can access copula i,j (copula[i,j] )as if array.
the copulas i'm tryinng sore are:
class(getcopula('frankcopula', 2)) [1] "frankcopula" attr(,"package") [1] "copula"
a may of solving issue creating array lists
mat<-matrix(list(), nrow = dimension, ncol = dimension) for(r in 1:(dimension+1-r)){ for(c in 1:dimension){ mat[[r,c]] = obtercopula(copulastr, pcopula[r,c]) } }
Comments
Post a Comment