Rev 4692 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
cccccccccc FORTRAN subroutine linbin.f ccccccccccc Obtains bin counts for univariate datac via the linear binning strategy. If "trun=0" thenc weight from end observations is given to correspondingc end grid points. If "trun=1" then end observationsc are truncated.c Last changed: 27/01/95subroutine linbin(X,n,a,b,M,trun,gcounts)double precision X(*),a,b,gcounts(*),lxi,delta,reminteger n,M,i,li,trunc Initialize grid counts to zerodo 10 i=1,Mgcounts(i) = dble(0)10 continuedelta = (b-a)/(M-1)do 20 i=1,nlxi = ((X(i)-a)/delta) + 1c Find integer part of "lxi"li = lxirem = lxi - liif (li.ge.1.and.li.lt.M) thengcounts(li) = gcounts(li) + (1-rem)gcounts(li+1) = gcounts(li+1) + remelseif (li.lt.1.and.trun.eq.0) thengcounts(1) = gcounts(1) + 1elseif (li.ge.M) thenif (li.eq.M.or.trun.eq.0) thengcounts(M) = gcounts(M) + 1endifendif20 continuereturnendcccccccccc End of linbin.f cccccccccc