2a EDA
2a EDA
Guidelines:
1. An assignment submission is considered complete only when the correct and executable code(s) is
submitted along with the documentation explaining the method and results. Failing to submit either
of those will be considered an invalid submission and will not be considered a correct submission.
2. Ensure that you submit your assignments correctly. Resubmission is not allowed.
3. Post the submission you can evaluate your work by referring to the keys provided. (will be available
only post the submission).
dictionary as displayed in the image below:
Make a table as shown above and provide information about the features such as its data
type and its relevance to the model building. And if not relevant, provide reasons and a
description of the feature.
Problem Statements:
import pandas as pd
mean_speed = data['speed'].mean()
std_dev_speed = data['speed'].std()
mean_distance = data['dist'].mean()
std_dev_distance = data['dist'].std()
mean_sp = data['SP'].mean()
std_dev_sp = data['SP'].std()
mean_wt = data['WT'].mean()
std_dev_wt = data['WT'].std()
scores = [34, 36, 36, 38, 38, 39, 39, 40, 40, 41, 41, 41, 41, 42, 42, 45, 49, 56]
mean = np.mean(scores)
median = np.median(scores)
mode = stats.mode(scores)[0][0]
variance = np.var(scores)
print(f"Mean: {mean}")
print(f"Median: {median}")
print(f"Mode: {mode}")
print(f"Variance: {variance}")
std_dev = np.std(scores)
3) What can you say about the Excepted value for the student score?
Q3) Three Coins are tossed, find the probability that two heads and one tail are obtained.
import numpy as np
num_trials = 1000000 # You can adjust this number based on desired accuracy
def roll_dice():
"""Simulates rolling two dice and returns their sum."""
return random.randint(1, 6) + random.randint(1, 6)
def main():
simulations = 10000
count_equal_to_1 = 0
count_less_than_or_equal_to_4 = 0
count_divisible_by_2_and_3 = 0
for _ in range(simulations):
sum = roll_dice()
if sum == 1:
count_equal_to_1 += 1
if sum <= 4:
count_less_than_or_equal_to_4 += 1
if sum % 2 == 0 and sum % 3 == 0:
count_divisible_by_2_and_3 += 1
if __name__ == "__main__":
main()
Q5) A bag contains 2 red, 3 green, and 2 blue balls. Two balls are drawn at random. What is the
probability that none of the balls drawn is blue?
import math
total_red = 2
total_green = 3
total_blue = 2
total_balls = total_red + total_green + total_blue
Q6) Calculate the Expected number of candies for a randomly selected child:
Below are the probabilities of the count of candies for children (ignoring the nature of the child-
Generalized view)
i. Child A – the probability of having 1 candy is 0.015.
ii. Child B – the probability of having 4 candies is 0.2.
Q7) Calculate Mean, Median, Mode, Variance, Standard Deviation, and Range & comment
about the values / draw inferences, for the given dataset.
- For Points, Score, Weigh>
Find Mean, Median, Mode, Variance, Standard Deviation, and Range and comment on the
values/ Draw some inferences.
weights = [108, 110, 123, 134, 135, 145, 167, 187, 199]
# Number of patients
n = len(weights)
Q9) Look at the data given below. Plot the data, find the outliers, and find out: μ , σ , σ 2
Hint: [Use a plot that shows the data distribution, and skewness along with the outliers; also
use Python code to evaluate measures of centrality and spread]
measure_x = [
24.23, 25.53, 25.41, 24.14, 29.62, 28.25, 25.81, 24.39,
40.26, 32.95, 91.36, 25.99, 39.42, 26.71, 35.00
]
Q10) AT&T was running commercials in 1990 aimed at luring back customers who had switched
to one of the other long-distance phone service providers. One such commercial shows a
businessman trying to reach Phoenix and mistakenly getting Fiji, where a half-naked native on a
beach responds incomprehensibly in Polynesian. When asked about this advertisement, AT&T
admitted that the portrayed incident did not actually take place but added that this was an
enactment of something that “could happen.” Suppose that one in 200 long-distance telephone
calls is misdirected.
What is the probability that at least one in five attempted telephone calls reaches the wrong
number? (Assume independence of attempts.)
Hint: [Using the Probability formula evaluate the probability of one call being wrong out of five
attempted calls]
import numpy as np
# Parameters
p_misdirected = 1 / 200 # Probability of a misdirected call
# Print results
print(f"Probability of a misdirected call (simulated): {simulated_probability:.4f}")
print(f"Number of misdirected calls in {num_trials} simulated calls: {num_misdirected_calls}")
(i) What is the most likely monetary outcome of the business venture?
Hint: [The outcome is most likely the expected returns of the venture]
(iii) What is the long-term average earning of business ventures of this kind? Explain.
Hint: [Here, the expected return to the venture is considered as the
required average]
(iv) What is a good measure of the risk involved in a venture of this kind? Compute
this measure.
Hint: [Risk here stems from the possible variability in the expected returns,
therefore, name the risk measure for this venture]
# Given data
Hints:
For each assignment, the solution should be submitted in the below format.
1. Research and Perform all possible steps for obtaining the solution.
2. For Statistics calculations, an explanation of the solutions should be documented in detail
along with codes. Use the same word document to fill in your explanation.
Must follow these guidelines:
2.1 Be thorough with the concepts of Probability, Probability Distributions, Business
Moments, and Univariate & Bivariate visualizations.
2.2 For True/False Questions, or short answer type questions explanation is a must.
2.3 Python code for Univariate Analysis (histogram, box plot, bar plots, etc.) the data
distribution is to be attached.
3. All the codes (executable programs) should execute without errors
4. Code modularization should be followed
5. Each line of code should have comments explaining the logic and why you are using that
function