[R] help for code in jump diffusion

From: subbudas <subratdas0407sssu_at_gmail.com>
Date: Fri, 21 Nov 2008 22:37:31 -0800 (PST)

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_at_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.
Received on Sat 22 Nov 2008 - 06:43:34 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 22 Nov 2008 - 09:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive