program TMLE; (* PROJECT : StatPascal demonstration program. FILE-SPEC. : tmle.sp AUTHOR : R.-D. Reiss, M. Thomas CREATION DATE : Apr-19-2000 LAST UPDATE : Dec-6-2000 VERSION : 1.0 RELATED FILES : Requires unit maximize.sp FUNCTIONAL DESCR.: MLE for Student distribution SPECIAL FEATURES : requires Xtremes Version 3.0 *) uses maximize; var x: realvector; function f (theta: realvector): real; function tden (x: real): real; begin return tdensity (theta [1], x / theta [2]) / theta [2] end; begin return sum (log (tden (x))) end; function c (theta: realvector): boolean; begin return (theta [1] > 0.0) and (theta [2] > 0.0) end; var alpha, mu, sigma: real; res: integer; d1: realvector; begin x := columndata (1); HillGP1 (x, size (x) div 10, alpha, mu, sigma, res); sigma := (sort (x)) [8 * size (x) div 10] / tqf (alpha, 0.8); writeln ('Pre-Est: alpha = ', alpha, ', sigma = ', sigma); d1 := searchmax (f, combine (alpha, sigma), c, 2); writeln ('MLE: alpha = ', d1 [1], ', sigma = ', d1 [2]) end.