# Re: [R] simulating data from a multivariate dist

From: Joris Meys <jorismeys_at_gmail.com>
Date: Thu, 17 Jun 2010 17:47:07 +0200

Dirty hack, but it's working.

library(MASS)
mu <- aic.mv\$best.model_at_expected.value
sigma <- aic.mv\$best.model_at_variance

mvrnorm(100,mu,sigma)

If you'd like to follow the rules, look for the functions to extract the expected value and the variance of the best model out of the stepAIC.ghyp object. I didn't find them, but then again, I'm a lazy bastard and didn't look for them either.

Cheers
Joris

On Thu, Jun 17, 2010 at 2:49 PM, suman dhara <suman.dhara89_at_gmail.com> wrote:
> Sir,
> I am working on fitting distribution on multivariate financial data and then
> simulate observations from that fitted distribution. I use stepAIC.ghyp()
> function of 'ghyp' library which select the best fitted distribution from
> generalized hyperbolic distribution class on the given dataset.
>
> data(indices)
>
>  # Multivariate case:
>  aic.mv <- stepAIC.ghyp(indices, dist = c("ghyp", "hyp", "t", "gauss"),
>                         symmetric = NULL, control = list(maxit = 500),
>                         silent = TRUE, nit = 500)
>
>  summary(aic.mv\$best.model)
>
> It fits asymmetic student-t dist. to the data 'indices'. Now, I want to
> simulate data from this best fitted distribution. I use
> simulate(aic.mv\$best.model).
> But, it is not working. Can you give me the funtion/code to simulate data
> from this best fitted distribution.
>
>
>
> Thanks & Regards,
> Suman Dhara
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> and provide commented, minimal, self-contained, reproducible code.
>

```--
Joris Meys
Statistical consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

tel : +32 9 264 59 87
Joris.Meys_at_Ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help