SAS Interactive Matrix Language Computing for Research I Spring 2012 Ramesh.

Slides:



Advertisements
Similar presentations
4.1 Introduction to Matrices
Advertisements

Matrices A matrix is a rectangular array of quantities (numbers, expressions or function), arranged in m rows and n columns x 3y.
Slide deck by Dr. Greg Reese Miami University MATLAB An Introduction With Applications, 5 th Edition Dr. Amos Gilat The Ohio State University Chapter 3.
Maths for Computer Graphics
Matrix A matrix is a rectangular array of elements arranged in rows and columns Dimension of a matrix is r x c  r = c  square matrix  r = 1  (row)
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 12 System of Linear Equations.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 14 Elimination Methods.
Part 3 Chapter 8 Linear Algebraic Equations and Matrices PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright © The.
Pam Perlich Urban Planning 5/6020
Matrix Approach to Simple Linear Regression KNNL – Chapter 5.
Intro to Matrices Don’t be scared….
Arithmetic Operations on Matrices. 1. Definition of Matrix 2. Column, Row and Square Matrix 3. Addition and Subtraction of Matrices 4. Multiplying Row.
MATRICES MATRIX OPERATIONS. About Matrices  A matrix is a rectangular arrangement of numbers in rows and columns. Rows run horizontally and columns run.
CE 311 K - Introduction to Computer Methods Daene C. McKinney
Chapter 7 Matrix Mathematics Matrix Operations Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
1 Statistical Analysis Professor Lynne Stokes Department of Statistical Science Lecture 5QF Introduction to Vector and Matrix Operations Needed for the.
ECON 1150 Matrix Operations Special Matrices
Review of Matrices Or A Fast Introduction.
Array Addition  Two arrays can be added if and only if both arrays have exactly the same dimensions.  Assuming the dimension requirement is satisfied,
Row 1 Row 2 Row 3 Row m Column 1Column 2Column 3 Column 4.
Copyright © 2011 Pearson, Inc. 7.2 Matrix Algebra.
Matrices Addition & Subtraction Scalar Multiplication & Multiplication Determinants Inverses Solving Systems – 2x2 & 3x3 Cramer’s Rule.
Lecture 28: Mathematical Insight and Engineering.
Unit 3: Matrices.
Algebra 3: Section 5.5 Objectives of this Section Find the Sum and Difference of Two Matrices Find Scalar Multiples of a Matrix Find the Product of Two.
Matrices. Definitions  A matrix is an m x n array of scalars, arranged conceptually as m rows and n columns.  m is referred to as the row dimension.
Matrix Algebra and Regression a matrix is a rectangular array of elements m=#rows, n=#columns  m x n a single value is called a ‘scalar’ a single row.
Multivariate Statistics Matrix Algebra I W. M. van der Veld University of Amsterdam.
Linear Algebra 1.Basic concepts 2.Matrix operations.
Matrices Matrices A matrix (say MAY-trix) is a rectan- gular array of objects (usually numbers). An m  n (“m by n”) matrix has exactly m horizontal.
2009/9 1 Matrices(§3.8)  A matrix is a rectangular array of objects (usually numbers).  An m  n (“m by n”) matrix has exactly m horizontal rows, and.
ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University.
Slide Copyright © 2009 Pearson Education, Inc. 7.3 Matrices.
MATRICES MATRIX OPERATIONS. About Matrices  A matrix is a rectangular arrangement of numbers in rows and columns. Rows run horizontally and columns run.
Matrices and Matrix Operations. Matrices An m×n matrix A is a rectangular array of mn real numbers arranged in m horizontal rows and n vertical columns.
Use Inverse Matrices to Solve Linear Systems Objectives 1.To find the inverse of a square matrix 2.To solve a matrix equation using inverses 3.To solve.
CS 450: COMPUTER GRAPHICS TRANSFORMATIONS SPRING 2015 DR. MICHAEL J. REALE.
Linear System of Simultaneous Equations Warm UP First precinct: 6 arrests last week equally divided between felonies and misdemeanors. Second precinct:
Unit 3: Matrices. Matrix: A rectangular arrangement of data into rows and columns, identified by capital letters. Matrix Dimensions: Number of rows, m,
Matrices. Matrix - a rectangular array of variables or constants in horizontal rows and vertical columns enclosed in brackets. Element - each value in.
Chapter 5: Matrices and Determinants Section 5.1: Matrix Addition.
Matrices. Variety of engineering problems lead to the need to solve systems of linear equations matrixcolumn vectors.
1 Matrix Math ©Anthony Steed Overview n To revise Vectors Matrices.
MTH108 Business Math I Lecture 20.
Haas MFE SAS Workshop Lecture 3:
Matrices and Vector Concepts
Linear Algebraic Equations and Matrices
12-1 Organizing Data Using Matrices
Linear Algebra review (optional)
Copyright © 2009 Dan Nettleton
Linear Algebraic Equations and Matrices
Matrix Operations SpringSemester 2017.
Warm-up a. Solve for k: 13 −5
Five Basic Programming Elements
7.3 Matrices.
MATRICES MATRIX OPERATIONS.
الوحدة السابعة : المصفوفات . تنظيم البيانات فى مصفوفات . الوحدة السابعة : المصفوفات . تنظيم البيانات فى مصفوفات . 1 جمع المصفوفات وطرحها.
MATRICES MATRIX OPERATIONS.
Appendix D: SAS PROC IML
Unit 3: Matrices
MATRICES MATRIX OPERATIONS.
2.2 Introduction to Matrices
MATRICES Operations with Matrices Properties of Matrix Operations
Matrices.
Linear Algebra review (optional)
1.8 Matrices.
MATRICES MATRIX OPERATIONS.
MATRICES MATRIX OPERATIONS.
Matrix Operations SpringSemester 2017.
1.8 Matrices.
Presentation transcript:

SAS Interactive Matrix Language Computing for Research I Spring 2012 Ramesh

Solve this system of linear equations: 3x + 2y − 4z = 11 5x − 4y = 9 3y + 10z = 42 In matrix form = =

Reading in Data proc iml; n = 3; *scalar; b = { }; *1 x 3 row vector; A = {3 2 -4, , }; *3 x 3 matrix; print n b a; quit;

Matrix Operators: Arithmetic Addition: + Subtraction: - Division, Elementwise: / Multiplication, Elementwise: # Multiplication, Matrix: * Power, Elementwise: ## Power, Matrix: ** Concatenation, Horizontal: || Concatenation, Vertical: // Number of rows: nrow() Number of columns: ncol()

Subscript Operations [ ] Addition + Multiplication # Mean : Sum of squares ## Maximum <> Minimum >< Index of maximum Index of minimum >:< Transpose: ` (Near number 1 on keyboard) Determinant: det(matrix) Inverse: inv(matrix) Trace: tr(matrix) Select a single element: i,j Select a row: i, Select a column:,j

Creating special Matrices: Identity matrix with dimension = size : I(size) Matrix having # rows = nrow # cols = ncol with all elements = x : j(nrow,ncol,x) Diagonal matrix: diag(vector) (diag(matrix)) Block diagonal matrix: block (M1, M2,...)

proc iml; call randseed( ); y = j(400,1); call randgen(y,normal'); z = j(100,1); call randgen(z,'normal', 2, 2.5); x = y // z; create a var{"x"}; append; close a; submit; proc univariate data=a; var x; histogram /kernel; run; endsubmit; Calling SAS PROC’s into IML

proc iml; do i=1 to 3; call randseed( ); mean=i*2; var=0.5*i; y = j(400,1); call randgen(y, 'normal'); z = j(100,1); call randgen(z, 'normal',mean, var); x = y // z; create a var {"x"}; append; close a; submit; proc univariate data=a noprint; var x; histogram / kernel; run; endsubmit; end; Using DO loops

data mult; input v1 v2 v3; datalines; ; proc iml; use mult; read all into v; X=v`*v; print v; run;