Learn R Programming

BaPreStoPro (version 0.1)

set.to.class: Building of model classes

Description

Definition of the model classes.

Usage

set.to.class(class.name = c("jumpDiffusion", "Merton", "Diffusion", "mixedDiffusion", "hiddenDiffusion", "hiddenmixedDiffusion", "jumpRegression", "NHPP", "Regression", "mixedRegression"), parameter, prior, start, b.fun, s.fun, h.fun, sT.fun, y0.fun, fun, Lambda, priorDensity)

Arguments

class.name
name of model class
parameter
list of parameter values
prior
optional list of prior parameters
start
optional list of starting values
b.fun
drift function b
s.fun
variance function s
h.fun
jump high function h
sT.fun
variance function $\widetilde{s}$
y0.fun
function for the starting point, if dependent on parameter
fun
regression function
Lambda
intensity rate of Poisson process
priorDensity
list of functions for prior densities, if missing: non-informative estimation

Details

set.to.class is the central function to define a S4 model class, where the simulate and the estimate methods build up. Main input parameter is class.name, which is one out of "jumpDiffusion", "Merton", "Diffusion", "mixedDiffusion", "hiddenDiffusion", "hiddenmixedDiffusion", "jumpRegression", "NHPP", "Regression" and "mixedRegression", which is the name of the class object containing all information of the model. If you write set.to.class(class.name) without any further input parameter, the function tells you which entries the list parameter has to contain. This is the second central input parameter. If input parameter start is missing, it is set to parameters. If input parameter prior, which is a list of prior parameters, is missing, they are calculated from parameter in that way, that prior mean and standard deviation is equal to the entries of parameter. Functions b.fun, s.fun, h.fun can be seen in the model definition of the jump diffusion $dY_t = b(\phi, t, Y_t)dt + s(\gamma^2, t, Y_t)dW_t + h(\theta, t, Y_t)dN_t$. In the case of a continuous diffusion, one out of "Diffusion", "mixedDiffusion", "hiddenDiffusion" or "hiddenmixedDiffusion", variance function $s(\gamma^2, t, y)$ is restricted to the case $s(\gamma^2, t, y)=\gamma\widetilde{s}(t, y)$. sT.fun stands for $\widetilde{s}(t, y)$. In the case of a regression model, "Regression" or "mixedRegression", sT.fun means the variance function dependent on t of the regression error $\epsilon_i\sim N(0,\sigma^2\widetilde{s}(t))$. In both cases, default value is sT.fun = function(t, y) 1. y0.fun is for the models, where the starting value depends on the parameter phi, "mixedDiffusion", "hiddenDiffusion" or "hiddenmixedDiffusion". Default value is a constant function in 1. fun is the regression function for the models "Regression", "mixedRegression" and "jumpRegression". In the first two cases, this is $f(\phi, t)$ and in the third $f(t, N_t, \theta)$. Function Lambda is the cumulative intensity function in the models including the non-homogeneous Poisson process. Input parameter priorDensity is for the model class jumpDiffusion-class a list of functions for the prior density functions. For the model classes NHPP-class and Merton-class, priorDensity is the density of the intensity rate parameter of the Poisson process. Default is a non-informative approach for all cases.

Examples

Run this code
set.to.class("jumpDiffusion")
(names <- set.to.class("jumpDiffusion"))
model <- set.to.class("jumpDiffusion",
             parameter = list(theta = 0.1, phi = 0.01, gamma2 = 0.1, xi = 3))
summary(class.to.list(model))

Run the code above in your browser using DataLab