Introduction

We are given a data set that contains the systolic vs. diastolic blood pressure of 32 participants in two different positions; their arms at their sides while lying down and standing with their arms supported at hear level. We are interested in observing the differences between these conditions and see how blood pressure might differ depending on the position of the patient.

Statistical raw data

The code chunk below reads the data set and save it as a data frame in a variable called HyperData.

HyperData <- read.delim("HyperDataAR.txt", sep = "\t")
HyperData <- as.data.frame(HyperData)

Two new columns were added to the original data set containing the differences of systolic and diastolic BP between each position for each subject. The new data set was saved as BPData.

BPData <- HyperData
BPData$SystolicDifference <- HyperData$recumbent.sbp - HyperData$standing.sbp
BPData$DiastolicDifference <- HyperData$recumbent.dbp - HyperData$standing.dbp

Table 1
SubjectID recumbent.sbp recumbent.dbp standing.sbp standing.dbp SystolicDifference DiastolicDifference
101 99 71 105 79 -6 -8
102 126 74 124 76 2 -2
103 108 72 102 68 6 4
104 122 68 114 72 8 -4
105 104 64 96 62 8 2
106 108 60 96 56 12 4

The code chunk below computes arithmetic mean and median for systolic and diastolic blood pressure in different positions. Mean and median of the differences in systolic and diastolic blood pressure was calculated as well. We’ll also compute standard deviation (sd), variance, and coefficient of variation to aid us in further interpretation of the data set.

#RSA is the abbriviation for Recumbent Systolic Average
#SDA is the abbriviation for Standing Distolic Average
RSA <- mean(BPData$recumbent.sbp)
RDA <- mean(BPData$recumbent.dbp)
SSA <- mean(BPData$standing.sbp)
SDA <- mean(BPData$standing.dbp)
#RSM is the abbriviation for Recumbent Systolic Median
#SDM is the abbriviation for Standing Distolic Median
RSM <- median(BPData$recumbent.sbp)
RDM <- median(BPData$recumbent.dbp)
SSM <- median(BPData$standing.sbp)
SDM <- median(BPData$standing.dbp)
#DA stands for Difference Average, and DM stands for Difference Median
SystolicDA <- mean(BPData$SystolicDifference)
SystolicDM <- median(BPData$SystolicDifference)
DiastolicDA <- mean(BPData$DiastolicDifference)
DiastolicDM <- median(BPData$DiastolicDifference)
#Standard deviation
SDRS <- sd(BPData$recumbent.sbp)
SDRD <- sd(BPData$recumbent.dbp)
SDSS <- sd(BPData$standing.sbp)
SDSD <- sd(BPData$standing.dbp)
SDDS <- sd(BPData$SystolicDifference)
SDDD <- sd(BPData$DiastolicDifference)
#Coefficient of Variation (CV)
CVRS <- (SDRS / RSA) * 100
CVRD <- (SDRD / RDA) * 100
CVSS <- (SDSS / SSA) * 100
CVSD <- (SDRS / SDA) * 100
CVDS <- (SDDS / SystolicDA) * 100
CVDD <- (SDDD / DiastolicDA) * 100

The results are presented in a new table containing all the mean and median values.

MeanMedian <- matrix(c(RSA, RSM, SDRS, CVRS, RDA, RDM, SDRD, CVRD, SSA, SSM, SDSS, CVSS, SDA, SDM, SDSD, CVSD, SystolicDA, SystolicDM, SDDS, CVDS, DiastolicDA, DiastolicDM, SDDD, CVDD), ncol = 4, byrow = TRUE)
MeanMedian <- as.data.frame(MeanMedian)
colnames(MeanMedian) <- c("Mean", "Median", "Standard Deviation", "Coefficient of Variation (%)")
rownames(MeanMedian) <- c("Recumbent Systolic BP", "Recumbent Diastolic BP", "Standing Systolic BP", "Standing Diastolic BP", "Systolic Difference", "Diastolic Difference")

Table 2
Mean Median Standard Deviation Coefficient of Variation (%)
Recumbent Systolic BP 117.40625 118.0 12.788249 10.89231
Recumbent Diastolic BP 73.96875 74.0 8.464287 11.44306
Standing Systolic BP 108.59375 105.5 15.131380 13.93393
Standing Diastolic BP 73.03125 71.0 10.501872 17.51065
Systolic Difference 8.81250 8.0 7.735288 87.77632
Diastolic Difference 0.93750 1.0 6.116807 652.45937

To gain better understanding of the data some of the computed values are visualized.

boxplot(BPData$recumbent.sbp, BPData$standing.sbp, BPData$recumbent.dbp, BPData$standing.dbp, names = c("Recumbent Systolic", "Standing Systolic", "Recumbent Diastolic", "Standing Diastolic"), boxwex = 0.3, col = c("grey"), xlab = "Type", ylab = "Blood pressure (mmHg)", main = "Different Types of Blood Pressure (fig. 1)", cex.axis = 0.8)

boxplot(BPData$SystolicDifference, BPData$DiastolicDifference, names = c("Systolic Difference", "Diastolic Difference"), boxwex = 0.3, col = c("grey"), xlab = "Type", ylab = "Blood pressure (mmHg)", main = "Blood Pressure Differences in Systolic and Diastolic (fig. 2)", cex.axis = 0.8)

plot(BPData$SystolicDifference, BPData$DiastolicDifference, xlab = "Differences in Systolic BP (mmHg)", ylab = "Differences in Diastolic BP (mmHg)", main = "BP Differences in Systolic and Diastolic (fig. 3)")

The code chunk below computes the 10% and 90% quantile for the different types of blood pressure and calculate the percentage of the subjects who fall within this range

QRS <- quantile(BPData$recumbent.sbp, probs = c(0.1,0.9))
NQRS <- (nrow(subset(BPData, recumbent.sbp > QRS[1] & recumbent.sbp < QRS[2]))/nrow(BPData))*100
QRD <- quantile(BPData$recumbent.dbp, probs = c(0.1,0.9))
NQRD <- (nrow(subset(BPData, recumbent.dbp > QRD[1] & recumbent.dbp < QRD[2]))/nrow(BPData))*100
QSS <- quantile(BPData$standing.sbp, probs = c(0.1,0.9))
NQSS <- (nrow(subset(BPData, standing.sbp > QSS[1] & standing.sbp < QSS[2]))/nrow(BPData))*100
QSD <- quantile(BPData$standing.dbp, probs = c(0.1,0.9))
NQSD <- (nrow(subset(BPData, standing.dbp > QSD[1] & standing.dbp < QSD[2]))/nrow(BPData))*100
QDS <- quantile(BPData$SystolicDifference, probs = c(0.1, 0.9))
NQDS <- (nrow(subset(BPData, SystolicDifference > QDS[1] & SystolicDifference < QDS[2]))/nrow(BPData))*100
QDD <- quantile(BPData$DiastolicDifference, probs = c(0.1, 0.9))
NQDD <- (nrow(subset(BPData, DiastolicDifference > QDD[1] & DiastolicDifference < QDD[2]))/nrow(BPData))*100

Table 3
10% Quantile 90% Quantile Percentage of subjects within the range (%)
Systolic BP of recumbent subjects 104.2 135.8 75.00
Systolic BP of standing subjects 94.0 127.8 68.75
Diastolic BP of recumbent subjects 62.2 85.6 75.00
Diastolic BP of standing subjects 60.0 88.0 68.75
Differences in Systolic BP 0.2 15.8 75.00
Differences in Diastolic BP -5.8 7.8 75.00

Analysis