3

Problem statement - Suppose a variable X has a bell-shaped distribution with a mean of 150 and a standard deviation of 20. a. What percentage of X values lies above 190?

My code so far:

import numpy as np
import math
import scipy.stats

X=scipy.stats.norm(150,20)

I know that 68% of X lie within 1 standard deviation ie (between 130 to 170) and 95% within 2 standard deviation (110 to 190).

But how to find percentage of values above 190? (I wrote 2.50 as the answer but it was incorrect)

MVKXXX
  • 193
  • 1
  • 2
  • 11
  • Can you clarify whether you want to count the output from X or the theoretical percentage for the normal distribution. – jdowner Jan 31 '21 at 14:48
  • According to [wikipedia](https://en.wikipedia.org/wiki/Normal_distribution#/media/File:Standard_deviation_diagram.svg) it is 2.2% – addem Jan 31 '21 at 14:52
  • The first answer here has everything you're looking for. https://stackoverflow.com/questions/20864847/probability-to-z-score-and-vice-versa – BLimitless Jan 31 '21 at 15:04

1 Answers1

3

Use sf() (see section "methods" at https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.norm.html):

import scipy.stats

scipy.stats.norm(150, 20).sf(190) # result: 0.022750131948179195
Stephan Kulla
  • 4,739
  • 3
  • 26
  • 35