(10) ポアソン過程(ランダムに起きること)

  • 一定間隔で起きること、まったくでたらめに起きること(どの時点も同じ確率で起きうる〜ポアソン過程、生起間隔が指数分布)、起きるとなったら集中しておきがちなこと
# ぽつりぽつりと起きる現象
m<-0.5
Ne<-20
proportionRunif<-0.3
proportionRnorm<-0.4
events<-rexp(Ne*(1-proportionRunif-proportionRnorm),m)

evPows<-c(0.01,0.1,0.5,1,2,3,5)
for(ep in evPows){
	evPow<-ep
events2<-events^evPow


cumeve<-cumsum(events2)
dur<-20
cumeve<-cumeve/max(cumeve)*dur
currentTime<-Sys.time()
par(ask=FALSE)
for(i in 1:length(cumeve)){
	while(Sys.time()-currentTime<cumeve[i]){
	}
			plot(cumeve[1:i],rep(0,i),pch=19,cex=0.5,xlim=c(0,max(cumeve)),main="",xlab="時間",ylab="")

}
par(ask=TRUE)

			plot(cumeve[1:i],rep(0,i),pch=19,cex=0.5,xlim=c(0,max(cumeve)),main="",xlab="時間",ylab="")

}

for(ep in evPows){
	evPow<-ep
events2<-events^evPow

cumeve<-cumsum(events2)
dur<-10
cumeve<-cumeve/max(cumeve)*dur
currentTime<-Sys.time()
xlim<-ylim<-c(-1,1)
par(ask=FALSE)

for(i in 1:length(cumeve)){
		plot(c(10),c(10),pch=19,cex=4,main="",xlab="",ylab="",xlim=xlim,ylim=ylim)
	while(Sys.time()-currentTime<cumeve[i]){
	
	}
			plot(c(0),c(0),pch=19,cex=10,xlim=xlim,ylim=ylim,main="",xlab="",ylab="")

}

par(ask=TRUE)
			plot(c(0),c(0),pch=19,cex=10,xlim=xlim,ylim=ylim,main="",xlab="",ylab="")

}