Module # 4 Programming Structure

 

Hospital Data: Boxplot and Histogram

1) This week I am tasked with completing two major objectives. The first is to create a boxplot with some data I am given and the second is to create a histogram. The boxplot is to be a side by side boxplot, which I will be displaying Blood Pressure and Frequency. I will then create two histograms, one just about frequency and the other about blood pressure and frequency. The data I was given came in a way that I have to go and format it myself in RStudio. Here is what I came up with:

> #Box plot and Histogram
> #Creating the variables
> Freq <- c(0.6, 0.3, 0.4, 0.4, 0.2, 0.6, 0.3, 0.4, 0.9, 0.2)
> BP <- c(103, 87, 32, 42, 59, 109, 78, 205, 135, 176)
> First <- c(1, 1, 1, 1, 0, 0, 0, 0, NA, 1)
> Second <- c(0, 0, 1, 1, 0, 0, 1, 1, 1, 1)
> FinalDecision <- c(0, 1, 0, 1, 0, 1, 0, 1, 1, 1) 
> 
> #create a data frame
> hospital_data <- data.frame(Freq, BP, First, Second, FinalDecision)
2) This takes care of the initial set up, and all that is left is to create the charts. 
> #creating a boxplot for BP and Freq side by side
> boxplot(hospital_data$BP, hospital_data$Freq,
+         names = c("Blood Pressure", "Frequency"),
+         main = "Side-by-side Boxplot of Blood Pressure and Frequency",
+         ylab = "Values")
> 







3) That concludes the bulk work of the assignment, the last thing we have to do is now analyze what the data all means. 

4) The boxplot for blood pressure (BP) shows a wide range, from 32 to 205, indicating significant variability among patients. Several extreme cases, like a BP of 205, suggest critical conditions requiring immediate attention. The frequency of visits, however, is more consistent, with most patients visiting between 0.2 and 0.6 times per month, showing a mix of regular and infrequent patients.

5) The histogram for BP shows a skewed distribution, with most values under 150, while a few outliers indicate severe conditions. The frequency histogram shows a more normal distribution, reflecting that most patients visit occasionally.

6) The MD ratings reflect the final care decisions. Patients rated as severe by both the first and second assessments tend to receive high-priority care, indicating consistency in triage and treatment decisions based on the severity of patient conditions. This suggests a reliable process for determining the urgency of care using both blood pressure data and expert evaluation.

7) You can see all the code I used for this assignment on my GitHub here:
https://github.com/MoeenKhan99/LIS4370-Module-4-Assignment

Comments

Popular posts from this blog

Module # 10 Building my own R package

Module # 13 Shiny Web App

Module # 1: My first assignment