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 rlbin.f ccccccccccc Obtains bin counts for univariate regression 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: 26 MAR 2009subroutine rlbin(X,Y,n,a,b,M,trun,xcnts,ycnts)double precision X(*),Y(*),a,b,xcnts(*),ycnts(*),lxi,delta,reminteger n,M,i,li,trunc Initialize grid counts to zerodo 10 i=1,Mxcnts(i) = dble(0)ycnts(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) thenxcnts(li) = xcnts(li) + (1-rem)xcnts(li+1) = xcnts(li+1) + remycnts(li) = ycnts(li) + (1-rem)*y(i)ycnts(li+1) = ycnts(li+1) + rem*y(i)endifif (li.lt.1.and.trun.eq.0) thenxcnts(1) = xcnts(1) + 1ycnts(1) = ycnts(1) + y(i)endifif (li.ge.M.and.trun.eq.0) thenxcnts(M) = xcnts(M) + 1ycnts(M) = ycnts(M) + y(i)endif20 continuereturnendcccccccccc End of rlbin.f cccccccccc