Bird
0
0

You want to compare a sample's distribution to a theoretical normal distribution using scipy. Which function and approach should you use?

hard📝 Application Q9 of 15
SciPy - Statistical Tests
You want to compare a sample's distribution to a theoretical normal distribution using scipy. Which function and approach should you use?
AUse scipy.stats.ks_2samp with the sample and a generated normal sample
BUse scipy.stats.kstest with the sample and 'norm' as the distribution
CUse scipy.stats.ttest_1samp with the sample mean
DUse scipy.stats.kstest with two samples
Step-by-Step Solution
Solution:
  1. Step 1: Identify one-sample KS test function

    scipy.stats.kstest tests if a sample matches a given theoretical distribution.
  2. Step 2: Use 'norm' for normal distribution

    Passing 'norm' as the distribution argument tests if sample fits normal distribution.
  3. Final Answer:

    Use scipy.stats.kstest with the sample and 'norm' as the distribution -> Option B
  4. Quick Check:

    kstest tests sample vs theoretical distribution [OK]
Quick Trick: Use kstest(sample, 'norm') to test normality [OK]
Common Mistakes:
MISTAKES
  • Using ks_2samp for one-sample test
  • Confusing t-test with KS test
  • Trying to pass two samples to kstest

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SciPy Quizzes