Reputation: 375
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)
Upvotes: 3
Views: 2775
Reputation: 5067
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
Upvotes: 3