cdf emp c3 adrica python

Solutions on MaxInterview for cdf emp c3 adrica python by the best coders in the world

showing results for - "cdf emp c3 adrica python"
Ben
13 Mar 2020
1# fit an empirical cdf to a bimodal dataset
2from matplotlib import pyplot
3from numpy.random import normal
4from numpy import hstack
5from statsmodels.distributions.empirical_distribution import ECDF
6# generate a sample
7sample1 = normal(loc=20, scale=5, size=300)
8sample2 = normal(loc=40, scale=5, size=700)
9sample = hstack((sample1, sample2))
10# fit a cdf
11ecdf = ECDF(sample)
12# get cumulative probability for values
13print('P(x<20): %.3f' % ecdf(20))
14print('P(x<40): %.3f' % ecdf(40))
15print('P(x<60): %.3f' % ecdf(60))
16# plot the cdf
17pyplot.plot(ecdf.x, ecdf.y)
18pyplot.show()
19
Yannic
04 Apr 2018
1...
2# get cumulative probability for values
3print('P(x<20): %.3f' % ecdf(20))
4print('P(x<40): %.3f' % ecdf(40))
5print('P(x<60): %.3f' % ecdf(60))
6
Antonio
21 Jul 2016
1# example of a bimodal data sample
2from matplotlib import pyplot
3from numpy.random import normal
4from numpy import hstack
5# generate a sample
6sample1 = normal(loc=20, scale=5, size=300)
7sample2 = normal(loc=40, scale=5, size=700)
8sample = hstack((sample1, sample2))
9# plot the histogram
10pyplot.hist(sample, bins=50)
11pyplot.show()
12
Paola
16 Oct 2016
1...
2# fit a cdf
3ecdf = ECDF(sample)
4
Kyler
15 Jun 2016
1P(x<20): 0.149
2P(x<40): 0.654
3P(x<60): 1.000
4