program warpingc(input,output); {(snp9: STB-27) First written on November, 11, 1994; last correction November 18, 1994. Authors: Isaias Hazarmabeth Salgado-Ugarte, Makoto Shimizu and Toru Taniuchi. Reference: Stata Technical Bulletin XX, snp6.1 This version does not display results to screen, instead write them to a text file in order to be used by Stata's command "infile" as a part of three Stata's ado files (warpstep.ado, warpoly.ado and warping.ado). This Pascal program performs Haerdle's WARPing density estimation using modified algorithms from Haerdle (1991) "Smoothing Techniques with Implementations in S. Springer-Verlag Series in Statistics New York, and Scott (1992) "Multivariate Density Estimation: Theory, Practice, and Visualization. John Wiley and Sons, New York.} const maxsize = 2000; maxsize2 = 2000; {it is a really big limit!} type vector = array[0..maxsize] of real; striname = string[30]; vectorint = array[0..maxsize2] of integer; var binumber,n,i,M,numbin,kerneltype,index : integer; start, delta,h,origin,maxval,minval,cm : real; binmesh,counts,J : vectorint; x,wM,fh,midval : vector; inpval,data,resul : text; procedure InputValues; begin assign(data,'_data2.raw'); reset(data); i:=1; while (not eof(data)) do begin read(data,x[i]); i:=i+1; end; close(data); n:=i-2; assign(inpval,'_inpval.raw'); reset(inpval); read(inpval,h,M,kerneltype); close(inpval); end; procedure InitialCalc; var maxnoemp,ib: integer; begin maxval:=x[n]; minval:=x[1]; if (kerneltype=6) then h:=4*h; delta:= h/M; numbin:= trunc((maxval-minval)/delta)+2*(M+1+round((M/10)+0.5)); start:=(minval-h)-delta*0.1; if (start<0) then origin:=(round((start/delta)-0.5)-0.5)*delta else origin:=(trunc(start/delta)-0.5)*delta; if (n+1