From: Fabian Zäpernick <fab.zaep_at_web.de>

Date: Sun, 13 Jun 2010 15:54:17 +0200

}

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 Sun 13 Jun 2010 - 13:51:01 GMT

Date: Sun, 13 Jun 2010 15:54:17 +0200

Hi

I want to write a C function for the R Code below and call it with .Call:

SimPoisson <- function(lambda,tgrid,T2M)
#Simulation eines Poissonprozesses

{

NT <- 0 Ni <- rep(0,length(tgrid)) tau <- 0 sign <- 0 if(lambda != 0) { i=1 j=1 while (1)

{

EVar <- rexp(1,lambda) sign <- sign + EVar if (sign > T2M) { break } tau[i] <- sign i = i+1 for (j in j:length(tgrid)) { if (tgrid[j] < sign) { Ni[j] <- NT }else { break } } NT <- NT + 1 } for (j in j:length(tgrid))

{

Ni[j] <- NT } } return(list(NT=NT,Ni=Ni,tau=tau))

}

Fabian

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 Sun 13 Jun 2010 - 13:51:01 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 Sun 13 Jun 2010 - 17:50:29 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.
*