Learn R Programming

yuima (version 1.15.34)

setLaw: Random Variable Constructor

Description

'setLaw' constructs an object of class yuima.law that contains user-defined random number generator, density, cdf, quantile function and characteristic function of a driving noise for a stochastic model.

Usage

setLaw(rng = function(n, ...) {
    NULL
}, density = function(x, ...) {
    NULL
}, cdf = function(q, ...) {
    NULL
}, quant = function(p, ...) {
    NULL
}, characteristic = function(u, ...) {
    NULL
}, time.var = "t", dim = NA)

Value

The constructor returns an object of class yuima.law

Arguments

rng

A user defined function for the generation of the noise sample.

density

A user defined function for the computation of the noise density.

cdf

A user defined function for the computation of the noise cumulative distribution function.

characteristic

A user defined function for the computation of the characteristi function.

quant

A user defined function for the computation of the quantile.

time.var

A label of the time variable.

dim

Dimension of the noise.

Author

YUIMA TEAM

Details

The constructor produces an yuima.law-object entirely specified by the user. This object can be employed in all stochastic processes available in yuima as a driving noise.

The minimal requirement for simulating the stochastic model is the specification of the rng function.

The density function is used internally in the qmleLevy function for the estimation of the Levy parameters.

References

Masuda, H., Mercuri, L. and Uehara, Y. (2022), Noise Inference For Ergodic Levy Driven SDE, Electronic Journal of Statistics, 16(1), 2432-2474. tools:::Rd_expr_doi("10.1214/22-EJS2006")

Examples

Run this code
if (FALSE) {
### The following example reports all steps 
### for the construction of an yuima.law
### object using the external R package 
### VarianceGamma available on CRAN

library(VarianceGamma)

## Definition of a yuima.law object 

# User defined rng
myrng <- function(n, eta, t){ 
          rvg(n, vgC = 0, sigma = sqrt(t), theta = 0, nu = 1/(eta*t))
}

# User defined density
mydens <- function(x, eta, t){
           dvg(x, vgC = 0, sigma = sqrt(t), theta = 0, nu = 1/(eta*t))
}

mylaw <- setLaw(rng = myrng, density = mydens, dim = 1)

}

Run the code above in your browser using DataLab