Week 5: Doing Math

Hi everyone!

This week we learned about multiple mathematical operations used in R. For statistical analysis, we can study multiple variables either categorical or quantitative through descriptive statistics such as mean, median, mode, standard deviation, and range. Data can be visualized in histograms, bar plots, box plots, or probability distributions for bivariate analysis.  

The math functions we learned include matrix algebra. A matrix has n * m dimensions with vectors constituting each row or column. We can add two matrices by each element, multiply each element by a number, multiply two matrices by each element, create an identity matrix, or find the inverse of a matrix. An important note is if the matrix has a determinant of zero, there is no inverse for this matrix and is said to be singular. If the matrix is not a square matrix, there will be no determinant and therefore no inverse. A determinant of a matrix is a special number of a matrix indicating it is a square matrix with the same number of rows and columns. The determinant can be calculated using det() and the inverse can be calculated using solve().

Find the value of inverse of a matrix, determinant of a matrix by using the following values:
A=matrix(1:100, nrow=10)
B=matrix(1:1000, nrow=10)




























Matrix A has a determinant of 0 meaning this matrix will not have a inverse matrix due to it being singular. To check this, I ran solve(A) to calculate the inverse matrix and received an error message saying the matrix is singular.

Since Matrix B is 1000 x 10, this matrix does not have a determinant and when calculated shows an error because the matrix must first be a square matrix. To check this, I ran solve(B) and received an error message saying 10 x 100 is not square.

Check this out in GitHub!

-Ramya's POV


Comments

Popular posts from this blog

Week 6: Doing Math P2