From 01d75f5d3f1baf669b9e92d6c13ea8a9b6a49b73 Mon Sep 17 00:00:00 2001 From: elisaduz Date: Tue, 8 Feb 2022 09:54:28 +0100 Subject: [PATCH] Update Dataset_study.rmd Simulation_TimeBetweenEvents --- Dataset_study.rmd | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/Dataset_study.rmd b/Dataset_study.rmd index cecbfcb..969dc10 100644 --- a/Dataset_study.rmd +++ b/Dataset_study.rmd @@ -138,9 +138,29 @@ PoissonProcess <- function(lambda,T) { return(sort(runif(rpois(1,lambda*T),0,T))) } -lambda=2 -Ti=5 -pp=PoissonProcess(lambda,Ti) -print(pp) -plot(c(0,pp),0:length(pp),type="s",xlab="time t",ylab="number of events by time t") + + +lambda1=2 +lambda2=3 +Ti=10 +pp1=PoissonProcess(lambda1,Ti) +print(pp1) +plot(c(0,pp1),0:length(pp1),type="s",xlab="time t",ylab="number of events by time t") + +pp2=PoissonProcess(lambda2,Ti) +print(pp2) +plot(c(0,pp2),0:length(pp2),type="s",xlab="time t",ylab="number of events by time t") + +#time between events +n1=length(pp1) +tbe1=pp1[2:n1]-pp1[1:n1-1] +tbe1 + +n2=length(pp2) +tbe2=pp2[2:n2]-pp2[1:n2-1] +tbe2 + + + + ```