Posts

Showing posts from February, 2026

Module 6 Assignment

Image
  First, two small matrices are created and used to practice matrix addition and subtraction . These operations combine values based on their position in the matrix. Addition adds corresponding elements, while subtraction finds the difference between elements in the same row and column positions. This demonstrates how matrix arithmetic works element by element. Since we are creating a matrices using the matrix() function, R will fill the matrices by column. The matrices will look like this:  By combining all the corresponding numbers to each column by adding, you will get the value of what it equals to in each spot. Matrix addition adds corresponding positions: 2 + 5 = 7 1 + 4 = 5 0 + 2 = 2 3 + (-1) = 2 Here we are doing the same thing to the matrix. Only this time we are subtracting the values in each box. Matrix subtraction subtracts corresponding elements: 2 - 5 = -3 1 - 4 = -3 0 - 2 = -2 3 - (-1) = 4 Next, the assignment uses the diag() function to build a diagonal matrix...

Module 5

Image
  This a 10 x 10 in R. Matrix A contains the numbers 1 - 100, and the Matrix B contains the numbers 1 - 1,000. The matrix() function arranges the numbers into rows and columns so they can be used to matrix calculations. By specifying nrow = 10, it tells R to place the numbers into 10 rows. Since there are 100 values total, R fill 10 columns automatically. That how you get the 10 x 10 square matrix. With the 1:1000, it creates a sequence from 1 to 1000. The matrix () functions arrange the numbers into 10 rows, since there is 1000 numbers total, R creates 100 columns (1000 / 10 = 100). So, B becomes a 10 100 matrix, which is rectangular rather than square. This matters since there is only square matrices and can have determinants and inverses. The rm() function removes all existing objects from memory and ensure that no old variables interfere with your results. 1 :100 created numbers from 1 to 100. These numbers were arranged into 10 rows, producing a 10 x 10 matrix for A. 1: 1000 c...

Module 4 Assignment

Image
I implemented each code and assigned them a vector by name. Each data given base of the module.   The boxplot shows that the patients who got a high final emergency decision usually had higher blood pressure values compared to those who received low care. The group who received high care showed a wider range of blood pressure levels, including extreme values.  This shows a clear difference between patients who received low care and those who received high care. While patients with low-care group had a lower and more tightly grouped blood pressure measurements. It indicates that the blood pressure remains within a lower or more stable range, which would make the final decision more likely to be a low emergency care. The histogram shows that most patients have blood pressure below 120, but there are a lot of high outliers above 150, including one extreme case above 200. These higher blood pressure values appear to influence the doctors' final decision to be flagged for high emer...

Module 3 Assignment

Image
  The result of the dataset are the polling data from the 2016 presidential election. The dataset includes candidates' names and polling results from two sources: ABC and CBS. The data being shared is for practice only and does not reflect the real election outcomes. After putting the data through R, the results are a big difference between the two sources. CBS poll reports a higher average support with a mean of 27.14 while ABC poll has a mean of 24.14. This suggests that CBS measured stronger voter support across candidates than ABC. Donald received the highest level of support in both polls, with 62 in the ABC polls and 75 in the CBS poll. This indicates the consistent popularity across the polling source. Carly has the lowest support in both polls, suggesting minimal voter. In comparison of polls being different in terms of some candidates. For example, it shows that Hillary and Bernie received higher values in CBS poll than in the ABC poll. It showed that Ted and Marco had hig...