0
0
Data Analysis Pythondata~10 mins

t-test with scipy.stats in Data Analysis Python - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the t-test function from scipy.stats.

Data Analysis Python
from scipy.stats import [1]
Drag options to blanks, or click blank then click option'
Attest_ind
Bttest_1samp
Cttest_rel
Dttest
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ttest' which is not a valid function in scipy.stats.
Confusing paired and independent t-test functions.
2fill in blank
medium

Complete the code to perform an independent t-test on samples a and b.

Data Analysis Python
result = ttest_ind([1], b)
Drag options to blanks, or click blank then click option'
Aa
Bb
Csample
Dresult
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the same sample twice.
Passing the result variable as input.
3fill in blank
hard

Fix the error in the code to correctly perform a one-sample t-test on sample data.

Data Analysis Python
from scipy.stats import ttest_1samp

sample = [2, 3, 5, 6, 9]
result = ttest_1samp(sample, [1])
Drag options to blanks, or click blank then click option'
A0
BNone
C5
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Passing None or zero instead of the population mean.
Confusing the sample data with the population mean.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that stores t-statistics for samples with mean greater than 4.

Data Analysis Python
t_stats = {name: result.statistic for name, result in results.items() if result.statistic [1] 4 and result.pvalue [2] 0.05}
Drag options to blanks, or click blank then click option'
A>
B<
C>=
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong comparison operators that reverse the logic.
Mixing up p-value and t-statistic conditions.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension filtering samples with mean less than 3 and p-value less than 0.01.

Data Analysis Python
filtered = {name: result.pvalue for name, result in results.items() if result.statistic [1] 3 and result.pvalue [2] 0.01 and name.[3]('test')}
Drag options to blanks, or click blank then click option'
A<
B<=
Cstartswith
Dendswith
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong comparison operators.
Using 'endswith' instead of 'startswith' for name filtering.