Example #1
0
a. What is the point estimate of the population mean for the number of weekly hours worked at the Tidelands Medical Center?
b. What is the point estimate of the population standard deviation?
c. What is the margin of error for a 90% confidence interval estimate?
d. Develop a 90% confidence interval for the population mean.
e. Is the Tidelands Medical Center within the ACGME guideline? Why?
'''
import my_stat_functions as my_stats

SAMPLE = (84, 86, 84, 86, 79, 82, 87, 81, 84, 78, 74, 86)
sample_mean = my_stats.sample_mean(SAMPLE)
sample_std_dev = my_stats.sample_std_dev(SAMPLE)
sample_size = len(SAMPLE)
CONF_LEVEL = .90
t_value = 1.796

print('\na. What is the point estimate of the population mean for the number of weekly hours worked at the Tidelands Medical Center?')
print(f'{sample_mean:.2f}')

print('\nb. What is the point estimate of the population standard deviation?')
print(f'{sample_std_dev:.2f}')

print('\nc. What is the margin of error for a 90% confidence interval estimate?')
margin_err = my_stats.margin_error_no_sigma(sample_std_dev, sample_size, t_value, True)

print('\nd. Develop a 90% confidence interval for the population mean.')
conf_int = my_stats.confidence_interval_no_sigma(sample_mean, sample_std_dev, sample_size, t_value, True)

print('\ne. Is the Tidelands Medical Center within the ACGME guideline? Why?')
print(f'The ACGME guideline is no more than 80 hours per week. That falls below our interval for \
the population mean and is therefore we are 90% confident that it is not realistic')
Example #2
0
'''
import my_stat_functions as my_stats

SAMPLE_OF = 'apartments'
METRIC = 'cost per month'
SAMPLE_SIZE = 40
SAMPLE_MEAN = 1147
SAMPLE_STD_DEV = 50
CONF_LEVEL = .98
Z = 2.3275
T = 2.426

print('\na. What is the point estimate of the population mean?')
print(SAMPLE_MEAN)

print('\nb. What is the point estimate of the population standard deviation?')
print(SAMPLE_STD_DEV)

print(
    '\nc. What is the margin of error for a 98% confidence interval estimate?')
margin_err = my_stats.margin_error_no_sigma(SAMPLE_STD_DEV, SAMPLE_SIZE, T,
                                            True)

print(
    '\nd. Would it be reasonable to conclude that the population mean is $1,250 per month?'
)
conf_int = my_stats.confidence_interval_no_sigma(SAMPLE_MEAN, SAMPLE_STD_DEV,
                                                 SAMPLE_SIZE, T, True)
print(
    f'1250.000 falls outside of our confidence interval at a 98% confidence level so, \
no it would not be reasonable to conclude that the population mean in $1,250.')
Example #3
0
\ngiven that a sample of {SAMPLE_SIZE} {SAMPLE_OF} is representative of all {SAMPLE_OF}, the average \
\nnumber of {METRIC} is {X_BAR}.')

print(
    '\nb. Explain why we need to use the t-distribution. What assumption do you need to make?'
)
print(
    f'We need to use the t-distribution because we don\'t know what the population mean is. \
\nA consequence of this is that we have to assume that the confidence interval at a given confidence \
\nlevel will be wider than if we knew the population std deviation and count us the z-distribution.'
)

print('\nc. For a 95% confidence interval, what is the value of t?')
print(t_95)

print('\nd. What is the margin of error?')
margin_err = my_stats.margin_error_no_sigma(S, SAMPLE_SIZE, t_95, verbose=True)

print('\ne. Develop the 95% confidence interval for the population mean.')
conf_int = my_stats.confidence_interval_no_sigma(X_BAR,
                                                 S,
                                                 SAMPLE_SIZE,
                                                 t_95,
                                                 verbose=True)

print(
    '\nf. Would it be reasonable to conclude that the population mean is 21 eggs? What about 25 eggs?'
)
print(
    'Both values are outside the confidence interval and therefore not reasonable to expect with a 95% confidence level.'
)