hello everyone ,
i have written some code in R for jump diffusion model.
the code generates answer as 
" NaN 
There were 50 or more warnings (use warnings() to see the first 50)"
my code is 

mu<-0.2
sig<-0.2
S0<-100
j<-0.2
dt<-1/252
int<-0.1
i<-0
while(i<=1)
{
  is.nan
  k<-rnorm(1,0,1)
  theta<-ifelse((k<(int*dt)),1,0)
  m<-rnorm(1)
  gam<-qnorm(m,0,1)
  S0<-abs(S0*((1+mu*dt+sig*sqrt(dt)+ gam)- j*theta))
  if(!is.nan (S0 <= 0))
     warning("S0 must be positive")
     cat("NaN","\n")
  cat(S0,"\n")
  i<-i+(1/252)
}

the problem i am facing is i am not able to find out the reason for this NaN
output.
please help 

thanks in advance.



-----
analyze and live life
-- 
View this message in context: 
http://www.nabble.com/help-for-code-in-jump-diffusion-tp20633880p20633880.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to