;-------------------------------------------------- ;STATISTICAL METHODS IN ASTRONOMY ; EXERCISES I ; 21.02.2008 Heikki Salo ; exercise1_bino1.pro ;-------------------------------------------------- program='exercise1_poisson1' ps=0 psdirect,program,ps ;------------------------------------------------- ;Poisson distribution ; ; mu^V ; prob(V) = ----- exp(-mu) V=0,1,2,3,... ; V! ;------------------------------------------------- ;Draw with in the case mu=1.69 and mu=11.48 ;(corresponds to plots in page 31, except that the curves ;should be multiplied by the number of samples (100 and 60) ;make also a 10 finer grid !p.multi=[0,2,1] ;---------------------------------------------------------- mu=1.69 vtab=findgen(10) ptab=vtab for v=0,n_elements(vtab)-1 do begin ptab(v)=mu^v/exp(lngamma(v+1))*exp(-mu) endfor nwin plot,vtab,ptab,title='Poisson with mu='+string(mu),psym=6,syms=0.5 vtab=findgen(100)*.1 ptab=vtab for i=0,n_elements(vtab)-1 do begin v=vtab(i) ptab(i)=mu^v/exp(lngamma(v+1))*exp(-mu) endfor oplot,vtab,ptab ;---------------------------------------------------------- mu=11.48 vtab=findgen(23) ptab=vtab for v=0,n_elements(vtab)-1 do begin ptab(v)=mu^v/exp(lngamma(v+1))*exp(-mu) endfor plot,vtab,ptab,title='Poisson with mu='+string(mu),psym=6,syms=0.5 vtab=findgen(230)*.1 ptab=vtab for i=0,n_elements(vtab)-1 do begin v=vtab(i) ptab(i)=mu^v/exp(lngamma(v+1))*exp(-mu) endfor oplot,vtab,ptab psdirect,program,ps,/stop end