Hi all,

I have to ask this and I know that the reason is that I am a newbie with R
programming. So apologize if it is too obvious but I didn't find an answer
after googling and reading "An introduction to R". So i have return
data from 30 instruments and I am fitting a mixture of normal
distributions for the asymmetric marginal distributions and then simulating
from those distributions. For this I have tried to build a function as
below




 "mclustSim" <- function(x){

library(mclust)
nr=dim(x)[1]
nc=dim(x)[2]
NumberOfSim=100

for (i in 1:nc){
y<-Mclust(as.matrix(x[,i]))
z<-sim(modelName=y$modelName,parameters=y$parameters,n=NumberOfSim)
#print(c(colnames(x[i]),z[,2]),digits=3)

}
}

z is the simulated return series. How can I say: "print z next to previous
z and form a matrix"
How could I get an matrix as a result..? So that I would have simulations
from asset1 distribution at first column, simulation from asset2 at second
column etc. And the result would be NumberOfSim X Ncol matrix..

Thanks for any help

Br,
John

        [[alternative HTML version deleted]]

______________________________________________
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