Presentation is loading. Please wait.

Presentation is loading. Please wait.

Statistics and Linear Algebra (the real thing). Vector A vector is a rectangular arrangement of number in several rows and one column. A vector is denoted.

Similar presentations


Presentation on theme: "Statistics and Linear Algebra (the real thing). Vector A vector is a rectangular arrangement of number in several rows and one column. A vector is denoted."— Presentation transcript:

1 Statistics and Linear Algebra (the real thing)

2 Vector A vector is a rectangular arrangement of number in several rows and one column. A vector is denoted by a lowercase bold font weight: x A vector element is given by the value (scalar) of a given row. x 1 =6 and x 2 =1 The number of elements gives its dimensionality Since there are two elements, the dimensionality of x is 2. (Each elements can be considered as a subject score) The transpose of vector, denoted T (or `), is a rotation of the column and rows. Definitions

3 Vector If the dimensionality of a vector is equal or less than 3, it can be represented graphically A vector is represented as an arrow (orientation and length)

4 Vector Operations: scalar multiplication When a vector is multiply by a scalar, each element of the vector is multiply by the scalar. When a vector is multiply by a scalar (number), then its length is increased by the factor of the scalar.

5 Vector When a vector is multiply by -1, then it will reverse is direction. Operations: -1 multiplication

6 Vector When two vectors are added together, we sum their corresponding elements. Graphically, we put the beginning of the second vector at the end of the first. Operations: Addition of two vectors

7 Vector When two vectors are added together, we sum their corresponding elements. Graphically, we put the beginning of the second vector at the end of the first one, once the second vector has been multiply by -1. Operations: Subtraction of two vectors What 2x-3y will gives ?

8 Matrices A matrix can be view as a collection of vectors. A matrix is denoted by an uppercase bold font weight: M The matrix dimension is given by its number of rows and columns Example: 2 rows and 4 columns: 2  4 A vector can be view as a matrix with many rows and one column. A matrix is called “square”, if n×n. A matrix element is given by the junction of the given row and column, denoted at M ij Definitions

9 Matrices When a matrix is multiply by a scalar, each element is multiply by the scalar. Operation: multiplication of matrix by a scalar

10 If two vectors have the same dimension, then they can be multiply together There will be two possible results: a) A scalar or b) A matrix Scalar (inner product, dot product) Two vectors will output a scalar, if the first vector is transposed before being multiplied with the second vector (of equal dimension). The row of the first vector is multiplied by the corresponding element of the second vector, and the resulting products are sum up.Matrices Operation: Product of two vectors If we divided x T y by their corresponding degrees of freedom (n-1) we obtain the covariance between the two variables (if the mean is zero).

11 Matrices Matrix (outer product) Two vectors will output a matrix, if the second vector is transposed before being multiplied. The column of first vector is multiplied by the corresponding element of the second vector row. Operation: Product of two vectors

12 Matrices Two matrices can be multiplied together, if the number of columns of the first matrix is equal to the number of rows of the second matrix. Ex: If A is a m  3 matrix, then B must be a 3  n matrix. The resulting matrix C will be a m  n matrix The matrix product is not commutative: AB  BA Operation: Product of two matrices

13 Matrices There is a special kind of matrix that is similar to the arithmetic multiplication by one. 5  1=5 This matrix is called: Identity, denoted by I, where all its diagonal elements are set to one and the remaining elements to 0. Since this matrix has the same number of columns and rows: AI=A or IA=A Identity matrix

14 Matrices A vector whose all elements are equal to 1. It is denoted by 1 Addition-Operator Vector

15 Matrices If the norm is divided by the degrees of freedom (n-1), then the standard deviation (if the mean is zero) is obtained. The Norm-Operation of a vector 6 1

16 Matrices Is a function that associates a scalar, det(A), to every n×n square matrix A. This can be interpreted as the volume of the matrix. In 2D, the area of the parallelogram The Determinant of Matrix

17 Matrices Is a function depending on n that associates a scalar, det(A), to every n×n square matrix A. S4 = the area of the rectangle The Determinant of Matrix T1 S3 T2 S3 T2

18 Matrices Is a function depending on n that associates a scalar, det(A), to every n×n square matrix A. S4 = the area of the rectangle The Determinant of Matrix T1 S3 T2 S3 T2

19 Matrices In analogy with the exponential notation for reciprocal of a number (1/a=a -1 ), the inverse of matrix is denoted A -1. If a matrix is square, then A -1 A=AA -1 =I. For a 2  2 matrix, the operation is The Inverse of Matrix

20 Linear Algebra and Statistics A vector is normalized if its length is equal to one. Normalizing a vector = data standardization. The Normalization of Vector

21 Linear Algebra and Statistics If two variables (u and v) have the same score, then the two vectors are superposed on each other. However, as the two variables differs from one another, the angle between them will increase. Relation between two vectors

22 Linear Algebra and Statistics The greater the angle between the two vectors, the lesser they share in common. If the angle reach 90° then there are no common part. Relation between two vectors

23 Linear Algebra and Statistics The cosine of that angle is the correlation coefficient. If the angle is null (or 180°) then the cosine is 1 (or -1); indicating a perfect relation. If the relation is 90° (or 270 °) then the cosine is 0; indication an absence of relation. Relation between two vectors

24 Linear Algebra and Statistics Relation between two vectors

25 Linear Algebra and Statistics The Mean From the previously defined addition-operation, the mean is straightforward. Let us say that we have one variable with 5 participants.

26 Linear Algebra and Statistics The Mean (several variables) Let us say that we have two variables with 5 participants. Let us define a 5  2 mean-score matrix as

27 Linear Algebra and Statistics Example of statistical Import

28 Linear Algebra and Statistics Example of statistical Import Deviation Score Matrix

29 Linear Algebra and Statistics Example of statistical Import Sums of Square and Cross Product (SSCP)

30 Linear Algebra and Statistics Example of statistical Import Sums of Square and Cross Product (SSCP) Note: the SSCP is square and symmetric If the SSCP is divided by the number of degrees of freedom, then we get the information about variance and covariance for all the data. Variance for the first variable Variance for the second variable Covariance

31 Linear Algebra and Statistics Example of statistical Import Simple regression How can we find the weights that describe (optimally) the following function ? The solution is to find the shadow of v on u that has the shortest distance The shortest distance is the one that crosses at 90° the vector u

32 Linear Algebra and Statistics Example of statistical Import Simple regression Therefore, the error e can be defined as: Where b 1 is the value that multiply u that makes the shadow of v the shortest (90°)

33 Linear Algebra and Statistics Example of statistical Import Simple regression As a consequence, the angle between u and e will also be 90° Therefore, the correlation (and covariance) between u and e will be zero. By substitution, we can isolate the b 1 coefficient. This is the least mean squared method

34 Linear Algebra and Statistics Example of statistical Import Simple regression With 2 variables this is identical to the solution given in textbooks. uv Deviation score matrix

35 Linear Algebra and Statistics Example of statistical Import Simple regression The constant b0 is obtained the usual way Therefore, the final regression equation is


Download ppt "Statistics and Linear Algebra (the real thing). Vector A vector is a rectangular arrangement of number in several rows and one column. A vector is denoted."

Similar presentations


Ads by Google