*************************************************************** * LOESS smoothing scattered data in one or more variables * * documentation of Fortran routines * * Cleveland, Devlin, Grosse, Shyu * *************************************************************** 1. The typical program would call lowesd, set tolerances in iv,v if desired, then call lowesb and lowese. 2. To save the k-d tree, call lowesd, lowesb and then losave; subsequent programs would call lohead, set liv and lv, then call loread and lowese. 3. For statistics, get diagL and then call lowesa or get the full hat matrix and call lowesc. Robustness iterations can take advantage of lowesw and lowesp. lowesd(106,iv,liv,lv,v,d,n,f,tdeg,nvmax,setLf) setup workspace lowesf(x,y,w,iv,liv,lv,v,m,z,L,hat,s) slow smooth at z lowesb(x,y,w,diagL,infl,iv,liv,lv,v) build k-d tree lowesr(y,iv,liv,lv,v) rebuild with new data values (does not change y) lowese(iv,liv,lv,v,m,z, s) evaluate smooth at z lowesl(iv,liv,lv,v,m,z, L) explicit hat matrix, which maps from y to z lofort(iunit,iv,liv,lv,v) save k-d tree as Fortran losave(iunit,iv,liv,lv,v) save k-d tree in file lohead(iunit,d,vc,nc,nv) read d,vc,nc,nv from file liv = 50+(vc+3)*nc determine space lv = 50+(2*d+1)*nv+nc requirements loread(iunit,d,vc,nc,nv,iv,liv,lv,v) finish reading k-d tree, ready for lowese lowesa(trL,n,d,tau,nsing, del1,del2) approximate delta lowesc(n,L,LL, trL,del1,del2) exact delta lowesp(n,y,yhat,w,rw, pi,ytilde) pseudo-values lowesw(res,n, rw,pi) robustness weights === arguments === d number of independent variables [integer] (called "p" elsewhere) del1,del2 delta1, delta2 diagL diagonal of hat matrix, only set if infl=.true. (n) f fraction of points to use in local smooth (called "alpha" elsewhere) fc don't refine cells with less than fc*n points; ordinarily=.05 hat is hat matrix desired? [integer] 0 = none 1 = diagonal only 2 = full matrix infl is diagonal of hat matrix desired? [logical] iunit Fortran unit number for i/o iv workspace (liv) L hat matrix (m,n) [real] in lowesf, only computed if hat nonzero; if hat=1 only size (n) LL workspace (n,n) liv 50+(2^d+4)*nvmax+2*n if setLf, add nf*nvmax lv 50+(3*d+3)*nvmax+n+(tau0+2)*nf if setLf, add (d+1)*nf*nvmax m number of points to smooth at; ordinarily=n n number of observations nf min(n,floor(n*f)) nsing if 0, print warning in lowesa when trL0. 4 RCOND reciprocal condition number ... 49 reserved for future use iv(V1) v vertices (nv,d) iv(VV1) vval vertex values (0:d,nv) iv(XI1) xi cut values (nc) ------------------------eval only needs workspace up to here iv(WORK1) workspace (n) l2fit:dist iv(WORK2) workspace (nf) l2fit:eta iv(WORK3) workspace (dim,nf) l2fit:X iv(VV2) vval2 workspace ((d+1)*nv) pseudo-vval for trL computation iv(LF) Lf hat matrix (data to vertex) ((d+1)*nvmax*nf) iv(WORK4) workspace (nf) l2fit:w Internal routine names have been hidden as follows: ehg106 select q-th smallest by partial sorting ehg124 rbuild ehg125 cpvert ehg126 bbox ehg127 l2fit,l2tr computational kernel ehg128 eval ehg129 spread ehg131 lowesb after workspace expansion ehg133 lowese after workspace expansion ehg134 abort by calling S Recover function ehg136 l2fit with hat matrix L ehg137 vleaf ehg138 descend ehg139 l2tr ehg140(w,i,j) w(i)=j used when w is declared real, but should store an int ehg141 delta1,2 from trL ehg142 robust iteration ehg144 now called lowesc ehg152 like ehg142, but for lowesf ehg167 kernel for losave ehg168 kernel for loread ehg169 compute derived k-d tree information ehg170 generate Fortran ehg176,ehg177,ehg178,ehg179,ehg180,ehg181 loeval for delta ehg182 ehgdie(i) ehg183 warning(message,i,n,inc) ehg184 warning(message,x,n,inc) ehg190 now called lowesa, with slight change in calling sequence ehg191 lowesl after workspace expansion ehg192 lowesr after workspace expansion ehg196(tau,d,f,trl) trL approximation ehg197 for deg=1,2 m9rwt now called lowesw pseudo now called lowesp