Posts

Showing posts from September, 2025

Assignment #5

Image
  Why  solve(A)   and   det(A)   work  A is a square matrix (10×10), hence det(A) is defined and equals 0, which means that A is unique (not invertible). det(A) = 0, solve(A) properly gives a solitary system error (there is no inverse). Why operations on B fail (non‑square matrix). B is not a square (10×100). Inverse and determinants are only defined for square matrices, therefore both calls are wrong by definition. A determinant close to 0 means (almost) singularity and computations that aren't stable. It's better to use solution(A, b) (or qr.solve/SVD) to solve systems than to make an explicit inverse; it's more reliable and quicker. https://github.com/shanzay28/r-programming-assignments/edit/main/Doing%20Math%20in%20R%20-%20Part%201%20-README.md

Assignment 4 -Programming Sructure in R

Image
The boxplots next to each other reveal that patients who had a Bad rating on the first assessment and a High rating on the second assessment usually had greater blood pressure. The High final decision category also goes along with high blood pressure. In other words, it seems like the doctors' decisions in this small sample are in line with BP: patients who are labeled as more worrying tend to have higher BP numbers. The histograms show two things: Visit Frequency is grouped together between 0.2 and 0.6, while Blood Pressure is considerably more spread out and has distinct outliers, such a very low number at 30 and a very high value over 200. In a genuine clinical dataset, numbers so severe would cause tests for data quality (measurement mistake, unit mix-ups, or true but uncommon occurrences) before looking for patterns. The patterns in this dataset are simply examples, not generalizable, since it is little and made up (only 10 rows, decreased to 9 after cleaning). I used n...

Module 3 -Introduction to Data Frame

Image
From this chapter and exercise, I have taken away a number of operations I can perform to explore and understand a data frame in R. By utilizing functions such as str(), head() and summary(), it allowed me to visually see the structure and column names of my dataset, as well summary statistics for each variable. I also drilled how to calculate statistics such as the mean, median and range, which helped me further understand what was going on with the poll data. The results indicate that Donald is leading with the most support in both polls, but his strength varies between ABC and CBS. Ted does well. Carly and Hillary still suck. The biggest difference was caused by Donald, who received a lot more points on CBS than ABC. Since the dataset is entirely manufactured, none of these results can be taken at face value. There is no sample size or margin of error behind the numbers and no demographics to break it down. The data is only useful if you want to practice R skills that involve creati...

Assignment

Image
I used R to test a custom function that was meant to determine a vector's mean for this assignment. The steps I took, the mistake I ran into, the cause, and how I fixed the function are all detailed here. I tried the provided myMean method with a vector I named assignment2. The error notice "Error in sum(assignment): object 'assignment' not found" appeared when it was run. This occurred because assignment2 was the name of the function parameter, but assignment and someData, which were never specified, were used inappropriately within the function. I changed the code to use assignment2 as the parameter consistently in order to address issue. The updated version runs correctly and yields the vector's accurate mean of 19.25.