Posts

Showing posts from February, 2026

Module # 6 Doing math in R part 2

Module # 6 Doing math in R part 2 1. Matrix Operations Given two matrices: A <- matrix(c(2, 0, 1, 3), ncol = 2) B <- matrix(c(5, 2, 4, -1), ncol = 2) a) Find A + B To find the sum of matrices A and B , simply add corresponding elements: A + B Output: [,1] [,2] [1,] 7 2 [2,] 5 2 Explanation: The sum of the matrices is calculated element by element: (2 + 5) = 7 (0 + 2) = 2 (1 + 4) = 5 (3 + -1) = 2 b) Find A - B To find the difference between matrices A and B , subtract corresponding elements: A - B Output: [,1] [,2] [1,] -3 -2 [2,] -3 4 Explanation: The difference of the matrices is calculated element by element: (2 - 5) = -3 (0 - 2) = -2 (1 - 4) = -3 (3 - -1) = 4 2. Creating a Diagonal Matrix To build a 4x4 matrix with the diagonal values 4, 1, 2, and 3 using the diag() function. diag(c(4, 1, 2, 3), nrow = 4) Output: [,1] [,2] [,3] [,4] [1,] 4 0 0 0 [2,] 0 1 0 0 [3,] 0 0 2 0 [4,] 0 0 0 3 Explana...

Module # 5 Doing Math

Image
  Matrix Inversion and Determinants in R

Module # 4 Programming structure assignment

Image
  Hospital Data Analysis In this assignment, I analyzed data collected by a local hospital. The dataset includes the following variables: The analysis involves visualizing the data through  boxplots  and  histograms  to understand patterns in blood pressure and visit frequency. Boxplot of Blood Pressure by Doctor's First Assessment Patients with a "good" assessment green box have a more consistent and moderate blood pressure, generally ranging between 50 and 150, with most values clustered near the middle of that range. This suggests that patients rated as "good" tend to have stable blood pressure. Patients with a "bad" assessment red box , on the other hand, have more variability in their blood pressure, ranging from as low as 50 to as high as 100. This wider spread could indicate that patients with more extreme or unpredictable blood pressure tend to be rated poorly by the doctor. Histogram of Frequency of Visits The majority of patients have a low ...

Module # 3 data.frame

Image
  Module # 3 data.frame > Name <- c("Jeb", “Donald”, "Ted”, “Marco” “Carly”, “Hillary”, “Berine”) > ABC political poll results <- c(4, 62 51, 21, 2, 14, 15) > CBS political poll results <- c(12, 75, 43, 19, 1, 21, 19)  This dataset compares polling results from two different sources, ABC and CBS, for several presidential candidates during the 2016 election. Although the data is fictional for this assignment, it demonstrates how different polling organizations may report varying levels of support for the same candidates. Overall, CBS tends to report higher poll numbers than ABC for most candidates, particularly for Donald and Hillary. Some candidates, such as Carly, show consistently low support across both polls, while others like Ted show notable differences between the two sources. These differences highlight how polling results can vary depending on methodology, sample size, or reporting source. In this blog I used RStudio to organize and analyze t...