Posts

Showing posts from February, 2025

Module # 6 Doing math in R part 2

Image
 Module # 6 Doing math in R part 2 Answer the following questions and post your answer on your blog: 1. Consider A=matrix(c(2,0,1,3), ncol=2) and B=matrix(c(5,2,4,-1), ncol=2). a) Find A + B b) Find A - B ncol = 2 means that numbers will be arranged into 2 columns in a 2x2 matrix. When performing A+B, it would look like this: (2+5) (1+4)        =  7  5 (0+2) (3+(-1))    =  2  2 When performing A - B, it would look like this:  ( 2 -5 )    ( 1 -4 )       =  -3  -3  ( 0 -2 )    ( 3 -( -1 ))   =  -2   4 2. Using the  diag()  function to build a matrix of size 4 with the following values in the diagonal 4,1,2,3. With diag(c(4,1,2,3), we get a 4x4 matrix. These number would be placed in the diagonal elements.  3. Generate the following matrix: ##        [,1] [,2] [,3] [,4] [,5] ## [1,]     3    1...

Module # 5 Doing Math

Image
Module # 5 Doing Math Your Assignment : 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) Post your result and procedure you took on your blog. A good start will be : >A <- matrix(1:100, nrow=10)   >B <- matrix(1:1000, nrow=10)  This is the result of the A matrix. This is the result of the B matrix.  As you can see from this image, the determinant is 0. If a determinant is non-zero, the matrix has an inverse.  A is a square matrix. It has 10 rows and 10 columns. However if you carefully examine matrix A, you can see a pattern. Starting from row 1 column 1, the value is 1. If you look at row 1 column 2, the value is 11. That is an increase of 10. If you look down the row, each value is an increment of 10. If you continue to observe the matrix, it continues this pattern. Each row increases by one. There is linear dependence in this matrix resulting in determinant ...

Module # 4 Programming structure in R

Image
Module # 4 Programming structure in R   Your assignment: The following data was collected by the local hospital. This data set contains 5 variables based on observation of 8 patients. In addition to the measurements of the patients checking in to the hospital that night, this data provides the patients' histories regarding the frequency of their visits to the hospital in the last 12 months. This data displays the measurement of blood pressure, first assessment by general doctor (bad=1, good =0) titled "first," the second assessment by external doctor (called "second"), and the last row provides the head of the emergency unit's decision regarding immediate care for the patient based on the values 0 or 1 (low = 0, high =1). The names of your variables are as follows: "Freq","bloodp","first”, " second”, ”finaldecision” The rows  1.    "0.6","103","bad","low","low” 2.     "0.3",...