Rev 5776 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
c Part of R package KernSmoothc Copyright (C) 1995 M. P. Wandcc Unlimited use and distribution (see LICENCE).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: 20 MAR 2009subroutine linbin(X,n,a,b,M,trun,gcnts)double precision X(*),a,b,gcnts(*),lxi,delta,reminteger n,M,i,li,trunc Initialize grid counts to zerodo 10 i=1,Mgcnts(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 = int(lxi)rem = lxi - liif (li.ge.1.and.li.lt.M) thengcnts(li) = gcnts(li) + (1-rem)gcnts(li+1) = gcnts(li+1) + remendifif (li.lt.1.and.trun.eq.0) thengcnts(1) = gcnts(1) + 1endifif (li.ge.M.and.trun.eq.0) thengcnts(M) = gcnts(M) + 1endif20 continuereturnendcccccccccc End of linbin.f cccccccccc