Rev 4692 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
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: 06/02/95subroutine rlbin(X,Y,n,a,b,M,trun,xcounts,ycounts)double precision X(*),Y(*),a,b,xcounts(*),ycounts(*),lxi,delta,reminteger n,M,i,li,trunc Initialize grid counts to zerodo 10 i=1,Mxcounts(i) = dble(0)ycounts(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) thenxcounts(li) = xcounts(li) + (1-rem)xcounts(li+1) = xcounts(li+1) + remycounts(li) = ycounts(li) + (1-rem)*y(i)ycounts(li+1) = ycounts(li+1) + rem*y(i)elseif (li.lt.1.and.trun.eq.0) thenxcounts(1) = xcounts(1) + 1ycounts(1) = ycounts(1) + y(i)elseif (li.ge.M) thenif (li.eq.M.or.trun.eq.0) thenxcounts(M) = xcounts(M) + 1ycounts(M) = ycounts(M) + y(i)endifendif20 continuereturnendcccccccccc End of rlbin.f cccccccccc