Last data update: 2014.03.03

R: Generate simulations
MonteCarloSimulationsR Documentation

Generate simulations

Description

Run multiple simulations

Usage

    is.MonteCarloSimulations(obj)
    MonteCarloSimulations(model, simulation.args=NULL, 
           replications=100, rng=NULL, quiet =FALSE, ...)
    ## Default S3 method:
MonteCarloSimulations(model, simulation.args = NULL, 
 		replications = 100, rng = NULL, quiet =FALSE, ...)
    ## S3 method for class 'TSmodel'
MonteCarloSimulations(model, simulation.args=NULL,
          replications=100, rng=NULL, quiet=FALSE, ...)

    ## S3 method for class 'TSestModel'
MonteCarloSimulations(model, simulation.args=NULL, 
           replications=100, rng=NULL, quiet=FALSE, ...)
    ## S3 method for class 'EstEval'
MonteCarloSimulations(model, simulation.args=NULL,
            replications=100, rng=getRNG(model),  quiet=FALSE, ...)
    ## S3 method for class 'MonteCarloSimulations'
MonteCarloSimulations(model, 
       simulation.args=NULL, replications=100, rng=getRNG(model),  quiet=FALSE, ...)

Arguments

model

an object from which a model can be extracted. The model must have an associated simulation method (e.g. a TSmodel).

simulation.args,

A list of arguments in addition to model which are passed to simulate.

replications

The number of simulations.

rng

The RNG and starting seed.

quiet

logical indicating if printing and many warning messages should be suppressed.

obj

an object.

...

arguments passed to other methods.

Details

This function runs many simulations using simulate. Often it not be necessary to do this since the seed can be used to reproduce the sample and many functions for testing estimation methods, etc., will produce samples as they proceed. This function is useful for verification and for looking at the stochastic properties of the output of a model. If model is an object of class EstEval or simulation then the model and the seed!!! are extracted so the same sample will be generated. The default method expects the result of simulate(model) to be a matrix. There is a tfplot method (time series plots of the simulations) and a distribution method for the result. The latter plots kernel estimates of the distribution of the simulations at specified periods.

Value

A list of simulations.

See Also

simulate EstEval distribution forecastCovWRTtrue

Examples

data("eg1.DSE.data.diff", package="dse")
model <- estVARXls(eg1.DSE.data.diff)
z <-  MonteCarloSimulations(model, simulation.args=list(sampleT=100))
tfplot(z)
distribution(z)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(EvalEst)
Loading required package: tfplot
Loading required package: tframe
Loading required package: dse

Attaching package: 'dse'

The following objects are masked from 'package:stats':

    acf, simulate

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/EvalEst/MonteCarloSimulations.Rd_%03d_medium.png", width=480, height=480)
> ### Name: MonteCarloSimulations
> ### Title: Generate simulations
> ### Aliases: MonteCarloSimulations MonteCarloSimulations.default
> ###   MonteCarloSimulations.TSmodel MonteCarloSimulations.TSestModel
> ###   MonteCarloSimulations.EstEval
> ###   MonteCarloSimulations.MonteCarloSimulations is.MonteCarloSimulations
> ### Keywords: ts
> 
> ### ** Examples
> 
> data("eg1.DSE.data.diff", package="dse")
> model <- estVARXls(eg1.DSE.data.diff)
> z <-  MonteCarloSimulations(model, simulation.args=list(sampleT=100))
> tfplot(z)
> distribution(z)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>