1 / 27

Presented by Jian Chen PhD (Applied Statistics) MS (Computer Science) Sr. Statistician, Credigy

Statistical computing with SAS/IML. Presented by Jian Chen PhD (Applied Statistics) MS (Computer Science) Sr. Statistician, Credigy . SAS/IML. SAS Interactive Matrix Language: Beyond!. Outline. Overview of SAS/IML. Language nuts and bolts. An example in Bayesian Analysis.

zizi
Download Presentation

Presented by Jian Chen PhD (Applied Statistics) MS (Computer Science) Sr. Statistician, Credigy

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Statistical computing with SAS/IML Presented by Jian ChenPhD (Applied Statistics) MS (Computer Science) Sr. Statistician, Credigy Jian Chen

  2. SAS/IML SAS Interactive Matrix Language: Beyond! Jian Chen

  3. Outline • Overview of SAS/IML. • Language nuts and bolts. • An example in Bayesian Analysis. • Applications. • References. Jian Chen

  4. Features of SAS/IML • The simple SAS/IML program: Proc iml; Print ‘Hello World!’; Quit; • Is a programming language operating on matrices. • Has a complete set of control statements. • Has a powerful vocabulary of operators. • Can use operators that apply to entire matrices. • Can be interactive. Jian Chen

  5. Features of SAS/IML (2-2) • Many Base SAS functions are accessible from SAS/IML and has many built-in functions. • Can define function or subroutine and write the core algorithm. • Can call a C program (or Fortran, Cobol, PL/I programs) within SAS/IML via the module() functions (Windows only). Jian Chen

  6. With SAS/IML • Edit existing SAS data sets or create new ones. • Access external files with an extensive set of data processing commands for data input and output. Jian Chen

  7. Numerical Functions and Algorithms • Subroutines: • Outlier detection and robust regression. • Performs numerical integration of scalar functions in one dimension over infinite, connected semi-infinite, and connected finite intervals • Optimization: for minimizing or maximizing a continuous nonlinear function f = f(x) of n parameters. • Produce graphics with a powerful set of graphics commands (Need SAS/Graph). • Kalman Filters. • Time Series Analysis. • Wavelet Analysis. • Genetic Algorithms – Experimental. • Sparse Matrices – Experimental. Jian Chen

  8. An example • Problem: Assume we know Y(1),…,Y(n), what are the future values: Y(n+1), Y(n+2), ……? • The p-th autoregressive model: AR(p) where Jian Chen

  9. Priors • Bayes Approach: • Under the Normal-Gamma prior where Jian Chen

  10. Loss Function • Modified Higgins-Tsokos loss function where and C1 , C2 make the loss function continuous, that is: Jian Chen

  11. Loss Function Jian Chen

  12. Loss Function Jian Chen

  13. The k-step Bayes prediction • The Bayesian predictive density of Wk (k-step ahead Bayes forecasting) is where Wk=(Y(n+1),Y(n+2),…,Y(n+k) ) and Sn=(Y(1),…,Y(n)); Jian Chen

  14. The k-step Bayes prediction • where • Others are the parameters in prior or matrix from n observations. Jian Chen

  15. Example • For Hölfer sunspot data, the shape of the joint pdf of future two-step ahead forecasting is graphed using (14.1) Jian Chen

  16. Practical k-step ahead forecasting • Get the one-step ahead forecasting . • Apply one-step ahead forecasting method again with (Y(1), Y(2), …, Y(n), ) to get . • …… Jian Chen

  17. K-th step ahead forecasting • The pdf of one-step ahead forecasting is: Jian Chen

  18. K-th step ahead forecasting • where t-distribution is defined as Jian Chen

  19. Bayes estimate under MHT loss • Bayes expected loss: Jian Chen

  20. Bayes estimate under MHT loss • Bayes estimate (Bayes action) under MHT loss function. Jian Chen

  21. Simulation and Calculation with SAS • Based on the assumption on priors, simulate the parameters in model (7.1). • Generate AR(p) series. • Calculate the one-step ahead Bayes estimate under MHT loss function. • Calculate the two-step ahead Bayes estimate under MHT loss function. Jian Chen

  22. Simulation and Calculation with SAS SAS techniques used: • Simulation • Time Series (model identification and calculation). • SAS/IML: • Import from/export to SAS dataset. Interface with other SAS PROCs. • Matrix calculation. • Integration. • Optimization. Jian Chen

  23. Integration • CALL QUAD (result, "fun", points <, EPS=eps> <, PEAK=peak><, SCALE=scale> <, MSG=msg> <, CYCLES=cycles> ) ; • CALL QUAD ( r, "fun", points) < EPS=eps> < PEAK=peak> < SCALE=scale> < MSG=msg> < CYCLES=cycles> ; • The QUAD subroutine quad is a numerical integrator based on adaptive Romberg-type integration techniques. Refer to Rice (1973), Sikorsky (1982), Sikorsky and Stenger (1984), and Stenger (1973a, 1973b, 1978). Jian Chen

  24. Optimization • Optimization: The IML procedure offers a set of optimization subroutines for minimizing or maximizing a continuous nonlinear function f = f(x) of n parameters, where x = (x1, ... ,xn)’: • NLPCG Conjugate Gradient Method • NLPDD Double Dogleg Method • NLPNMS Nelder-Mead Simplex Method • NLPNRA Newton-Raphson Method • NLPNRR Newton-Raphson Ridge Method • NLPQN (Dual) Quasi-Newton Method • NLPQUA Quadratic Optimization Method • NLPTR Trust-Region Method Jian Chen

  25. Applications • “Computing Group Sequential Boundaries Using the Lan-DeMets Method with SAS”. • Sample size and power analysis. • SAS for Monte Carlo Studies: A Guide for Quantitative Researchers: By Xitao Fan, Akos Felsovalyi, Stephen A. Sivo, and Sean C. Keenan: http://support.sas.com/publishing/bbu/companion_site/57323.html • A collection of SAS macro programs using SAS/IML software to generate, randomize and inspect orthogonal arrays for computer experiments and integration. http://sunsite.univie.ac.at/statlib/designs/oa.SAS Jian Chen

  26. References • Jian Chen, Bayes Inferences and forecasting of Time Series, PhD thesis, UNC Charlotte. • SAS Online Documentation for SAS/IML: http://support.sas.com/onlinedoc/913/docMainpage.jsp • Sample programs installed with your installation: Located in directory: C:\Program Files\SAS\ SAS 9.1 \iml\sample Jian Chen

  27. Jian Chen

More Related