Question: Instructions: This is statistics in Python. Please answer in great detail and explanation for any calculations! Thank you :) This lab asks you to compute

Instructions:

This is statistics in Python. Please answer in great detail and explanation for any calculations! Thank you :)

This lab asks you to compute confidence intervals (CI) for sample averages. We compare ticket price (fare) for men and women on Titanic. We want to see if they paid a similar price in average. Well, the averages do not match, but can it be just statistical noise? First, you are asked to simulate the prices for both genders, and thereafter you need to answer this using theoretical considerations, based on CLT.

DATA YOULL BE USING: https://1drv.ms/x/s!AtfXPbdjkmO7oJlxGnbu7-lnwEDEAQ?e=1amk8H

THERE IS NO MISSING INFORMATION, THE DATA YOU WILL BE DOING THE STATISTICS ON IS IN THE DATA FILE ABOVE (https://1drv.ms/x/s!AtfXPbdjkmO7oJlxGnbu7-lnwEDEAQ?e=1amk8H)!

1. Simulations: 1. Load Titanic data. Ensure it is good.

AGAIN, HERE IS THE DATA YOULL BE USING: https://1drv.ms/x/s!AtfXPbdjkmO7oJlxGnbu7-lnwEDEAQ?e=1amk8H 2. Remove all cases with missing fare, sex. Create two fare vectors: fare for females, and fare for males (just fare subsets for that gender). Find the corresponding sample sizes. 3. Compute the average and standard deviation of fare for both genders. 4. Choose your number of repetitions (1000 is good). What are your sample sizes? 5. Now simulate the age for both sexes: (a) For R times, create simulated fare: you can use normal distribution with the same mean and sd along these lines: import numpy as np mean = 10 (what you calculated and saved in a variable) sd = 1 (what you calculated and saved in a variable) np.random.normal(mean, sd, size = 5) (what you calculated and saved in a variable) ## array([10.34177352, 9.52661579, 9.60330662, 10.25023359, 9.2303816 ])

(b) Each time compute average simulated fare for both men and women. (c) Stored these averages in vectors. 6. Find the 95% CI for your simulated samples. Use sample quantiles.

Hint: I got [23, 29] for men. 7. Do the CI for females, males overlap?

2. Theoretical approach: 1. What does CLT tell about the expected value and standard deviation of the sample average? 2. Use the sample means and standard deviations you found above, and compute the expected value and standard deviation for the sample means using CLT, not simulations 3. Compute 95% CI using the formula [ 1.96 , + 1.96 ]. 4. Did you get similar CI?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!