program warpings(input,output); {First written on August, 1994; last correction September 12, 1994. Authors: Isaias Hazarmabeth Salgado-Ugarte, Makoto Shimizu and Toru Taniuchi. Reference: Stata Technical Bulletin XX, snp6.1 This version do 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[1..maxsize] of real; striname = string[30]; vectorint = array[1..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; ch,answer1,answer3 : char; name : striname; data,resul : text; procedure DataInput; begin writeln; writeln('TYPE THE PATH, NAME AND EXTENSION OF TEXT DATA FILE'); readln(name); assign(data,name); reset(data); i:=1; while (not eof(data)) do begin read(data,x[i]); i:=i+1; end; close(data); n:=i-2; writeln; writeln('THE NUMBER OF VALUES READ IS: ',n:10); writeln; writeln('!!!!!WARNING!!!!!'); writeln('IF THIS IS NOT CORRECT PLEASE INTERRUPT AND'); writeln('USE STATA COMMAND outfile TO GENERATE AN ASCII'); writeln('FILE WITH THE DESIRED DATA VECTOR'); writeln; writeln('GIVE THE VALUE OF THE BANDWIDTH ''h'' '); readln(h); writeln; writeln('GIVE THE NUMBER OF HISTOGRAMS TO SHIFT AND AVERAGE'); readln(M); writeln; end; procedure SelectKernel; begin kerneltype:=0; writeln; writeln('SPECIFY THE WEIGHT FUNCTION: '); writeln; writeln('1 = Uniform; 2 = Triangle (ASH); 3 = Epanechnikov'); writeln('4 = Quartic; 5 = Triweight; 6 = Gaussian'); readln(kerneltype); if (kerneltype>6) then begin writeln; writeln('Error in the choice of the kernel! Use a valid option'); writeln; writeln('TO TRY AGAIN PUSH ENTER'); readln; SelectKernel; end; end; procedure SortData; var loc : integer; temp : real; begin for loc:=1 to n-1 do for i:=loc+1 to n do if x[i]