inst/examples/mc_gbm_vett.R

# TODO: con f_rand NULL non funziona


matur<-1

# Definizione di tre processi
gen1<-gbmTimeVar(to=1,mand=list(final=matur),f_disc=disc,f_dvd=function(t) .0363, fxcor=.1, f_sd=function(t) .1963)
gen2<-gbmTimeVar(to=1,mand=list(final=matur),f_disc=disc,f_dvd=function(t) .0363, fxcor=.2,f_sd=function(t) .1963)
gen3<-gbmTimeVar(to=1,mand=list(final=matur),f_disc=disc,f_dvd=function(t) .0363, fxcor=.3,f_sd=function(t) .1963)



# Accorpamento in un singolo processo vettoriale correlato
gens<-c(gen1,gen2,gen3)
cormat<-matrix(c(1,.2,-.7,.2,1,.5,-.7,.5,1),3,3)
gensVect<-gbmVectTimeVar(to=1,mand=list(final=matur),gens=gens,f_rand=rmvnorm,p_rand=list(n=NA,sigma=cormat))

# WO & BASKET CALL
mc(N=1000, pathgen=gensVect, call(s=min(final),strike = 1.0), disc(final))
mc(N=1000, pathgen=gensVect, call(s=mean(final),strike = 1.0), disc(final))


mc(N=1000, pathgen=gensVect, callput(b=mean(final),w=min(final),strike1=1.0,strike2=0.8), disc(final), nris=3)








# Plot
Y<-gensVect()
plot.ts(Y, plot.type = 'multiple')

R<-Y[-1,]/Y[-nrow(Y),]-1
cor(R)
lampoverde/Der documentation built on Jan. 8, 2018, 12:01 p.m.