BS Assignment Part2
BS Assignment Part2
ASSIGNMENT
SUBMITTED TO:
SUBMITTED BY:
TISHA - 2501221
PRATYUSH - 2501202
Rationale for Data Cleaning: Data cleaning was undertaken to eliminate physiologically impossible
values, correct measurement errors, and refine extreme outliers. This ensured the dataset reflected
plausible health characteristics of the target population. By improving accuracy and consistency, the
cleaned data provided a reliable foundation for valid statistical analysis and meaningful interpretation.
For the purpose of this practical exercise, our dataset is treated as the complete population. This
approach allows for a direct comparison between population parameters and sample statistics, providing
a clear and tangible demonstration of each concept.
gender=1 (female) and gender=2 (male). The initial population distribution was determined to be
approximately 65% female and 35% male. To ensure the sample mirrored this distribution, a stratified
sample of 50 patients was selected, with 19 males (62%) and 31 females (38%).
This method is especially valuable in clinical research, where risk factors and outcomes for conditions like
cardiovascular disease can differ between males and females. A simple random sample might over- or
under-represent one gender, leading to biased conclusions. Stratified sampling mitigates this risk, ensuring
gender-specific trends are accurately captured in the data. The choice of sampling method, therefore,
represents a fundamental trade-off between the increased precision and reliability of methods like stratified
sampling and the logistical challenges and costs associated with them.
To generate the sampling distribution of the mean BMI, a process was simulated where 1,000 independent
random samples, each of size n=50, were drawn from the population. The mean BMI was calculated for
each of these 1,000 samples. The frequency distribution of these 1,000 sample means constitutes the
sampling distribution. (Sample 1000 sheet)
This confirms the assertion that averaging reduces variability. In a clinical context, this demonstrates why a
large number of independent patient BMI readings are a more stable and trustworthy indicator of population
health than any single patient's BMI.
The Central Limit Theorem (CLT) posits that for a sufficiently large sample size, typically considered to be
30 or more observations, the sampling distribution of the mean will be approximately normally distributed,
regardless of the shape of the original population distribution.
A point estimate is a single, numerical value calculated from a sample, which serves as the "best guess"
for population parameter. Example, the sample mean (x̄) is a point estimate for the population mean μ.
An interval estimate, also known as a confidence interval, addresses this limitation by providing a range of
values within which the true population parameter is likely to be found. This interval provides a measure of
the precision of the estimate and the level of certainty associated with it.
Confidence Interval = Sample Mean ± Margin of Error, where the Margin of Error is calculated as:
The choice between a critical Z-value and a T-value depends on the sample size and whether the
population standard deviation is known. Given a large sample size of 50 (n≥30), the Z-distribution can be
used. For a 95% confidence level, the critical Z-value is 1.96.
Application: 95% Confidence Interval for Mean Systolic Blood Pressure (ap_hi)
Using the sample data from the previous section (n=50, x̄ =125.5, s=14.0), a 95% confidence interval for
the mean systolic blood pressure of the population was constructed.
1. Calculate the Standard Error (SE): SE = 𝑠/√𝑛 = 14/ √50 = 1.98
2. Calculate the Margin of Error (ME): ME = Z × SE = 1.96×1.98 = 3.88
3. Construct the Confidence Interval: Confidence Interval = x̄ ± ME=125.5 ± 3.88 leading to Lower Bound
= 121.62, Upper Bound = 129.38
Application: 99% Confidence Interval for Mean Systolic Blood Pressure (ap_hi)
Using the sample data from the previous section (n=50, x̄ =125.5, s=14.0), a 99% confidence interval for
the mean systolic blood pressure of the population was constructed.
The 95% confidence interval for the mean systolic blood pressure is approximately [121.62, 129.38]. The
interpretation is that if this method of creating a confidence interval were repeated with many different
samples, approx. 95% of those intervals would contain the true population mean. A crucial relationship
exists between the margin of error, the confidence level, & sample size. To achieve a higher level of
confidence (e.g., 99%), a larger critical Z-value is required, which in turn widens the interval and
decreases the precision of the estimate.
Confidence Interval = Sample Proportion (p̂) ± Margin of Error, where the Margin of Error is:
The 95% confidence interval for the proportion of patients with cardiovascular disease is approx. [0.4855,
0.7545]. This means that, based on our sample, we are 95% confident that the true percentage of
patients with cardiovascular disease in the entire population lies between 48.55% and 75.44%.
The relationship between these criteria is often formalized through a calculation for the required sample
size, such as the following formula for a proportion: n= (z ɑ/2 𝛔 /E)2 or n = ((z ɑ/2 /E)2 * p̂(1-p̂)
n = The required sample size is approximately 138 patients. This demonstrates a relationship
between the chose nmargin of error and the resources needed. For instance, if a researcher wanted to
increase the precision to a margin of error of ±3%, the required sample size would increase to 384
patients. This illustrates that sample size is a direct and calculable consequence of the study's
objectives regarding confidence and precision, tempered by the expected variability of the population.
Fundamentals of Hypothesis Testing
Before conducting any hypothesis tests on samples, it is essential to establish the true parameters of our
defined population. These parameters represent the "ground truth" that our null hypotheses will be based
on. The following parameters have been calculated.
These values are the benchmarks for our analyses. For instance, when we test a sample's mean BMI, our
null hypothesis will state that the mean is equal to the population value of 27.44
Scenario and Problem Statement: A health analytics firm wants to assess the impact of a public health
intervention on BMI. The known population mean BMI is 27.44 (σ = 5.18). They collect a random sample of
50 individuals to test if the current average BMI differs from the population mean. Since the population
standard deviation is known and the sample size is large, a z-test is appropriate.
Hypotheses
Significance Level: α=0.5, this means we are willing to accept a 5% risk of concluding there is a difference
when one does not actually exist (a Type I error).
Sample BMI Data (n=50): 24.3, 27.3, 26.9, 23.9, 25.4, 28.7, 26.5, 23.5, 30.8, 30.1, 33.5, 22.1, 25.1, 29.8,
26.8, 25.2, 29.4, 25.1, 22.1, 23.5, 30.1, 25.8, 23.5, 26.5, 28.7, 25.4, 23.9, 26.9, 27.3, 24.3, 24.3, 27.3, 26.9,
23.9, 25.4, 28.7, 26.5, 23.5, 25.8, 30.1, 23.5, 22.1, 25.1, 29.8, 26.8, 25.2, 29.4, 25.1, 22.1, 23.5
Test Statistic:
𝑥̅ − 𝜇
𝑧 = 𝜎
√𝑛
26.15 − 27.44 −1.29
𝑧 = = ≈ − 1.762
0.732 0.732
where x̄ is the sample mean, μ is the hypothesized population mean, σ is the population standard deviation,
and n is the sample size.
• Calculate P-Value: The probability of getting a z-score of -1.762 or less is P(Z≤−1.762). Using Excel's
[Link](-1.762, TRUE) function, this is approximately 0.039. Since this is a two-tailed test, we
multiply this probability by 2.
𝑝̂-value = 2 × 𝑃(𝑍 ≤ −1.762) = 2 × 0.039 = 0.078
• Since 0.078 is greater than our significance level of 0.05, We fail to reject the null hypothesis.
Interpretation of Findings
Both the critical value (|−1.762| < 1.96) and p-value (0.078 > 0.05) methods lead to failing to reject the null
hypothesis. At a 5% significance level, there’s insufficient evidence to say the average BMI changed from
27.44. The observed sample mean (26.15) likely reflects random variation, so the health intervention hasn’t
shown a statistically significant impact.
Scenario and Problem Statement: A clinician suspects the average systolic blood pressure in a
community differs from the healthy level of 120 mmHg. Since the population standard deviation is unknown,
a random sample of 50 patients is collected. A one-sample t-test is appropriate to compare the sample
mean against the hypothesized value, using the sample standard deviation for estimation.
Sample ap_hi Data (n=50): 120, 110, 140, 120, 120, 130, 120, 140, 110, 130, 140, 120, 110, 130, 120,
140, 120, 120, 110, 140, 120, 130, 120, 140, 110, 130, 140, 120, 110, 130, 120, 140, 120, 120, 110, 140,
120, 130, 120, 140, 110, 130, 140, 120, 110, 130, 120, 140, 120, 120
x̅−μ
t-Statistic: t = s
√n
124.8 − 120 4.8
t= = ≈ 3.221
1.49 1.49
α=0.05 & df=49, critical t-value = [Link].2T(0.05, 49) function, we get 𝒕critical ≈ ±𝟐. 𝟎𝟏
• T-statistic = ∣3.221∣ = 3.221 > 2.01, our test statistic falls into the rejection region.
• Conclusion: We reject the null hypothesis.
• P-Value: For a two-tailed test, we use Excel's [Link].2T(3.221,49) function. p−value ≈ 0.002 < 0.05.
• Conclusion: We reject the null hypothesis.
Interpretation: Both methods lead to rejecting the null hypothesis. The p-value of 0.002 shows a 0.2%
chance of observing a sample mean of 124.8 mmHg if the true average were 120 mmHg. This provides
strong evidence that the community’s average systolic blood pressure is significantly higher than the
recommended 120 mmHg.
A national health organization reports an 8.8% adult smoking rate. A local health department surveys 50
residents to see if their community’s rate differs from this benchmark. A one-proportion z-test is used to
compare the sample proportion against the known population proportion.
Hypotheses
• H0:P=0.088
• Ha:P≠0.088 (two-tailed test)
Sample Data
Assumption Check:
𝑛 × 𝑃 = 50 × 0.088 = 4.4
where p̂ is the sample proportion, P is the hypothesized population proportion, and n is the sample size.
• Critical Values: For a two-tailed test with α=0.05, the critical z-values are ±1.96.
• Decision Rule: Reject H0 if ∣ zcalculated ∣>1.96.
• Since ∣1.297∣<1.96, the test statistic does not fall into the rejection region.
• Conclusion: We fail to reject the null hypothesis.
Interpretation:
The sample smoking rate (14%) exceeds the national average (8.8%) but isn’t statistically significant (p-
value = 0.1946) with a sample size of 50. The local health department lacks sufficient evidence to conclude
a difference; a larger sample is needed.
Comparing means of two Independent Variables
Hypothesis:
H0: Μ1≥Μ2
HA: Μ1<Μ2
Blood Pressure when weight < 100 Blood Pressure when weight > 100
Mean 126.58 139.19
Variance 259.06 205.07
Observations 179.00 75.00
Hypothesized Mean
Difference 0.00
df 155.00
t Stat -6.17
P(T<=t) one-tail 0.00
t Critical one-tail 1.65
P(T<=t) two-tail 0.00
t Critical two-tail 1.98
The results show a statistically significant difference in mean blood pressure between people weighing less
than 100 and those weighing more than 100.
Key Results:
t Stat: -6.17
Inference:
• The p-value is much less than 0.05 (commonly used significance level), and the t-Stat is far below the
critical value. This means we reject the null hypothesis.
• There is strong evidence that people weighing less than 100 have significantly lower mean blood
pressure than those weighing over 100.
• The test results support your alternative hypothesis: high weight is associated with higher blood
pressure in the data.
In plain language: People who weigh above 100 have higher average blood pressure, and this difference is
statistically meaningful.
Blood Pressure when weight < 100 Blood Pressure when weight >100
Mean 126.58 139.19
Variance 259.06 205.07
Observations 179.00 75.00
df 178.00 74.00
F 1.26
P(F<=f) one-tail 0.13
F Critical one-tail 1.40
The F-test results show that the F value is 1.26 and the p-value is 0.13, which is higher than the standard
threshold of 0.05.
Inference:
• Since the p-value (0.13) >0.05, we do not have enough evidence to say the variances (spread) of blood
pressure are different between people with weight less than 100 and those with weight more than 100.
• The variability in blood pressure readings is similar for both low weight and high weight groups.
Therefore, there is no significant difference in how spread out the blood pressure values is for the two
weight categories.
Analysis of Variance (ANOVA)
The objective of this section is to apply Analysis of Variance (ANOVA) techniques to examine whether
certain health indicators differ significantly across patient groups. Specifically, a One-Way ANOVA and a
Two-Way ANOVA are performed to analyse variations in Body Mass Index (BMI) across selected
categorical health factors.
One-Way Anova: The purpose of the One-Way ANOVA is to test whether BMI differs significantly across
different cholesterol categories.
• Null Hypothesis (H₀): Mean BMI is equal across all cholesterol groups.
• Alternative Hypothesis (H₁): At least one cholesterol group has a different mean BMI.
Variables Used
SUMMARY
Groups Count Sum Average Variance
BMI for C1 51367 1383543 26.93447 24.03897
BMI for C2 9283 264740.8 28.51889 30.70357
BMI for C3 7856 231499.1 29.46781 33.03306
ANOVA
Source of Variation SS df MS F P-value F crit
Between Groups 56236.93 2 28118.47 1082.59 0 2.995863
Within Groups 1779251 68503 25.97333
Interpretation:
Group Statistics are as follows:
• C1 (Normal): Mean BMI = 26.93
• C2 (Above Normal): Mean BMI = 28.52
• C3 (Well Above Normal): Mean BMI = 29.47
This shows a gradual increase in mean BMI with higher cholesterol levels.
There is a statistically significant difference in BMI across cholesterol categories. In other words,
cholesterol level has a strong influence on BMI. Patients with higher cholesterol levels (C2, C3) tend to
have higher BMI compared to those with normal cholesterol (C1).
Two-Way Anova: While One-Way ANOVA tested if BMI differs across cholesterol levels, it did not consider
the combined effects. Two-Way ANOVA examines whether cholesterol and glucose individually affect
BMI. This is important since both are key metabolic indicators whose joint effect may reveal deeper insights
into body weight and cardiovascular risks.
Variables Used
• Dependent Variable: BMI (continuous).
• Independent Variable (Categorical): Cholesterol level (3 categories: 1 = normal, 2 = above normal,
3 = well above normal) and Glucose level (3 categories: 1 = normal, 2 = above normal, 3 = well
above normal)
ANOVA
Source of
Variation SS df MS F P-value F crit
Rows 6.710081 2 3.3550405 3.816085159 0.118249 6.944272
Columns 4.68066951 2 2.340334756 2.661940066 0.184046 6.944272
Error 3.51673546 4 0.879183865
Total 14.907486 8
There is no statistically significant difference in BMI across cholesterol levels or glucose levels in this test.
In other words, neither cholesterol level nor glucose level alone has a strong influence on BMI when
considered separately. This suggests that other factors (such as lifestyle, genetics, or combined
interactions not captured here) may be stronger determinants of BMI. Please note that, since we used
“without replication,” interaction between cholesterol and glucose could not be tested.
[Link]
27/Term%201/Business%20Statistics/Workings_Anova.xlsx
Chi-Square Test:
Frequency Table
Chi-Square Table
High BP Normal BP Total
Weight <100 143.06 35.94 179
Weight >100 59.94 15.06 75
Total 203 51 254
Chi-Square 3E-05
Inference
• Very strong association: The extremely low p-value means the distribution of High/Normal BP is
statistically different between Weight < 100 and Weight > 100 groups.
• Chi-square value is extremely small, and the result is statistically significant.
• This means people with more than 100 kg weight are much more likely to have blood pressure
above 120, and this pattern is not just a coincidence.
• Conclusion: Weight is significantly associated with blood pressure status at the 120 BP threshold;
higher weight is linked to a much higher proportion of High BP cases.
SUMMARY OUTPUT
Regression Statistics
Multiple R 0.27
R Square 0.07
Adjusted R Square 0.07
Standard Error 13.66
Observations 68506.00
ANOVA
Significance
df SS MS F F
Regression 1 1014988.33 1014988.33 5439.53 0
Residual 68504 12782487.64 186.59
Total 68505 13797475.97
Coefficients Standard Error t Stat P-value Lower 95% Upper 95%
Intercept 44.88 0.40 112.24 0.00 44.10 45.66
ap_hi 0.23 0.00 73.75 0.00 0.22 0.24
This regression output shows how weight predicts blood pressure in your sample of 68,506 people.
Inferences:
• Multiple R (0.27): This shows a weak positive relationship between weight and blood pressure; as
weight increases, blood pressure tends to go up with a little movement.
• R Square (0.07): Only about 7% of the variation in blood pressure can be explained by weight. This
means many other factors are also affecting blood pressure.
• Standard Error (13.66): This means that on average, predictions from the model may be off by about
13.66 units of blood pressure.
Regression Coefficients
• Intercept (44.88): When weight is zero, the model predicts a blood pressure value of 44.88 (which is not
realistic, but just to give a baseline).
• Blood Pressure (0.23): For every increase of 1 unit in weight, predicted blood pressure rises by 0.23
units on average.
• P-values (both 0.00): Both coefficients are statistically significant (highly unlikely to happen by chance).
• Confidence Intervals for Blood Pressure: The true effect is likely between 0.22 and 0.24 units per kg.
To sum it up:
• Heavier people tend to have slightly higher blood pressure, but weight alone doesn't explain blood
pressure well (weak link).
• The model is significant (not due to chance), but other factors play a much bigger role in causing blood
pressure differences.
• In summary: There's a weak, positive, and statistically significant relationship between weight and blood
pressure in the data.
ap_hi
ap_hi Linear (ap_hi) Linear (ap_hi)
200
Weight
150
100
50
0
0 20 40 60 80 100 120 140 160 180
This scatter plot with a trend line shows the relationship between blood pressure (ap_hi) and weight for
hospital patients.
• The orange dots are individual data points, each representing a patient's blood pressure and weight.
• The trend line equation y=0.3187x+103.06y=0.3187x+103.06 shows that as blood pressure (x)
increases, predicted weight (y) also rises slightly.
• The plot confirms a positive but weak relationship—heavier patients generally have higher blood
pressure.
• The R^2 value is 0.0736; meaning that only about 7% of the variation in weight is explained by blood
pressure.
• Most orange points scatter widely around the trend line, illustrating significant overlap and other factors
that influence blood pressure.
Let’s look at how all this data can be used by the hospital from a business point of view:
From a business perspective, analysing hospital data showing a weak but statistically significant
relationship between weight and blood pressure provides several insights and opportunities:
• The data confirms that higher weight is associated with slightly higher blood pressure—a known risk
factor for cardiovascular diseases.
• The hospital can develop targeted weight management and blood pressure monitoring programs to
identify and support patients at risk early, reducing complications and long-term healthcare costs.
• Based on this relationship, the hospital might design specialized health packages focused on obesity-
related risk assessments, including regular blood pressure and weight checks, nutritional counselling,
and fitness programs.
• These packages can be marketed to corporate wellness programs, insurance providers, & individual
patients.
• Understanding that weight influences blood pressure helps anticipate the demand for cardiovascular
services, potentially influencing staffing, equipment procurement (e.g., for cardiac care), and budget
planning.
• High-risk patient groups can be prioritized for more intensive monitoring, optimizing resource use.
• The hospital can leverage data insights to create educational content emphasizing weight control to
manage blood pressure, encouraging patient adherence to lifestyle interventions.
• Increased patient engagement can improve long-term outcomes and reduce readmissions.
or
Where b0, b1, b2, and b3 are estimators of β0, β1, β2 and β3 respectively.
• β₁ (Age → ap_hi): Expected sign positive as systolic BP typically rises with age (arterial stiffening etc.)
• β₂ (BMI → ap_hi): Expected sign positive since higher BMI is associated with higher systolic BP.
• β₃ (ap_lo → ap_hi): Expected sign positive (strongly) since systolic and diastolic pressures are
correlated physiologically; therefore higher diastolic tends to fo together with higher systolic.
Regression Statistics
Multiple R 0.745
R Square 0.555
Adjusted R Square 0.555
Standard Error 11.129
Observations 68506
ANOVA
df SS MS F Significance F
Regression 3 10569417.451 3523139.150 28447.006 0
Residual 68502 8483918.547 123.849
Total 68505 19053336
Lower Upper
Coefficients Standard Error t Stat P-value 95% 95%
Intercept 6.478 0.480 13.509 1.562E-41 5.538 7.418
age (years) 0.225 0.006 35.203 4.667E-269 0.212 0.237
BMI 0.293 0.008 34.554 2.124E-259 0.277 0.310
ap_lo 1.232 0.005 262.670 0.000E+00 1.223 1.241
• The model explains approximately 55.5% of the variation in systolic blood pressure (R² = 0.555).
• F-test for overall significance is highly significant (p < 0.001), indicating the model provides a good fit.
1. Intercept (b = 6.478): The model predicts that when Age, BMI & ap_lo are all zero, the expected
systolic BP (ap_hi) would be 6.48 mmHg. However, such situation is not realistic in practice, so the
intercept mainly serves as baseline constant that adjusts the regression line for accurate prediction.
2. Age (b = 0.225): For each additional year of age, ap_hi increases by 0.23 mmHg, holding BMI & ap_lo
constant. This aligns with medical evidence that blood pressure tends to rise with age.
3. BMI (b = 0.293): For every one-unit increase in BMI, systolic blood pressure (ap_hi) increases by about
0.29 mmHg, keeping other variables like age and ap_lo constant. This suggests that higher body mass
index (overweight/obesity) is positively associated with elevated systolic blood pressure.
4. Diastolic blood pressure, ap_lo (b = 1.232): For every 1 mmHg increase in diastolic blood pressure
(ap_lo), systolic blood pressure increases by about 1.23 mmHg, keeping Age and BMI constant. This
strong association is expected since systolic and diastolic blood pressures are physiologically related.
Conclusion: All three predictors are statistically significant (p<0.05) and positively associated with systolic
blood pressure. Among them, diastolic blood pressure (ap_lo) has the largest effect, while Age and BMI
also contribute meaningfully. The results highlight that older age, higher BMI, and higher diastolic BP are
important risk factors linked to higher systolic BP.
Hypotheses:
H0 : β1 = β2 = β3 = 0
HA : At least one βj ≠ 0
Conclusion: The regression model with Age, BMI, and ap_lo explains a statistically significant portion of
the variation in systolic blood pressure. In other words, taken together the three predictors provide
explanatory power beyond the intercept alone (R² = 0.555), and the overall model is statistically
significant at the 5% level
Hypotheses (two-tailed):
H0 : βj = 0
HA : βj ≠ 0
Conclusion: Age, BMI, and diastolic blood pressure (ap_lo) are all statistically significant predictors of
systolic blood pressure at the 5% level.
Contributions Topics Covered
Focused on multiple sample hypothesis testing such as one-way/two-way ANOVA.
Vanshika
Took up regression and correlation topics including covariance, correlation matrix, and
Tisha multiple linear regression with categorical variables.
Handled two-sample hypothesis testing comparing means, proportions, and variance
Yuvraj ratios (F-test).
Covered non-parametric tests including Chi-square tests for difference in proportions and
Kartikey independence, Simple Linear Regression.