Displaying 2 results from an estimated 2 matches for "pernick".
Did you mean:
zernick
2010 Jun 13
1
Simulating a Poisson Process in R by calling C Code over .Call
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
2010 Jun 15
1
Error when callin g C-Code
Hi
when I call the function below in R, i get the error: Object 'pairlist'
can't be converted to 'double'.
#include <R.h>
#include <Rdefines.h>
#include <Rmath.h>
SEXP CSimPoisson(SEXP lambda, SEXP tgrid, SEXP T2M, SEXP Ni, SEXP NT)
{
double sign, EVar;
double *xlambda, *xtgrid, *xT2M, *xNi, *xNT, *xtau;
SEXP tau;
int ltgrid =0;
int i = 0;
int j = 0;