aeDensity: Asymptotic Expansion - Density

View source: R/ae.R

aeDensityR Documentation

Asymptotic Expansion - Density

Description

Asymptotic Expansion - Density

Usage

aeDensity(..., ae, eps = 1, order = NULL)

Arguments

...

named argument, data.frame, list, or environment specifying the grid to evaluate the density. See examples.

ae

an object of class yuima.ae-class.

eps

numeric. The intensity of the perturbation.

order

integer. The expansion order. If NULL (default), it uses the maximum order used in ae.

Value

Probability density function evaluated on the given grid.

Examples

## Not run: 
# model
gbm <- setModel(drift = 'mu*x', diffusion = 'sigma*x', solve.variable = 'x')

# settings
xinit <- 100
par <- list(mu = 0.01, sigma = 0.2)
sampling <- setSampling(Initial = 0, Terminal = 1, n = 1000)

# asymptotic expansion
approx <- ae(model = gbm, sampling = sampling, order = 4, true.parameter = par, xinit = xinit)

# The following are all equivalent methods to specify the grid via ....
# Notice that the character 'x' corresponds to the solve.variable of the yuima model.

# 1) named argument  
x <- seq(50, 200, by = 0.1)
density <- aeDensity(x = x, ae = approx, order = 4)
# 2) data frame
df <- data.frame(x = seq(50, 200, by = 0.1))
density <- aeDensity(df, ae = approx, order = 4)
# 3) environment
env <- new.env()
env$x <- seq(50, 200, by = 0.1)
density <- aeDensity(env, ae = approx, order = 4)
# 4) list
lst <- list(x = seq(50, 200, by = 0.1))
density <- aeDensity(lst, ae = approx, order = 4)

# exact density
exact <- dlnorm(x = x, meanlog = log(xinit)+(par$mu-0.5*par$sigma^2)*1, sdlog = par$sigma*sqrt(1))

# compare
plot(x = exact, y = density, xlab = "Exact", ylab = "Approximated")

## End(Not run)

yuima documentation built on Nov. 14, 2022, 3:02 p.m.

Related to aeDensity in yuima...