You are on page 1of 4

16/04/2023, 19:18 lista1-mec-estatística.

ipynb - Colaboratory

from numpy import random


import matplotlib.pyplot as plt
import seaborn as sns

sns.distplot(random.binomial(n=10, p=0.5, size=1000), hist=False)

<ipython-input-9-f7f3d796a6b7>:1: UserWarning:

`distplot` is a deprecated function and will be removed in seaborn v0.14.0.

Please adapt your code to use either `displot` (a figure-level function with
similar flexibility) or `kdeplot` (an axes-level function for kernel density

For a guide to updating your code to use the new functions, please see
https://gist.github.com/mwaskom/de44147ed2974457ad6372750bbe5751

sns.distplot(random.binomial(n=10, p=0.5, size=1000), hist=False)


<Axes: ylabel='Density'>

sns.distplot(random.binomial(n=100, p=0.5, size=1000), hist=False)

<ipython-input-10-441bccfc27be>:1: UserWarning:

`distplot` is a deprecated function and will be removed in seaborn v0.14.0.

Please adapt your code to use either `displot` (a figure-level function with
similar flexibility) or `kdeplot` (an axes-level function for kernel density

For a guide to updating your code to use the new functions, please see
https://gist.github.com/mwaskom/de44147ed2974457ad6372750bbe5751

sns.distplot(random.binomial(n=100, p=0.5, size=1000), hist=False)


<Axes: ylabel='Density'>

sns.distplot(random.binomial(n=400, p=0.5, size=1000), hist=False)

https://colab.research.google.com/drive/1oDQ7dTFr6FhWwaP3N43n2eHlyECdO_Va#scrollTo=c9cxbhZaGlUU&printMode=true 1/4
16/04/2023, 19:18 lista1-mec-estatística.ipynb - Colaboratory

<ipython-input-11-4e851ce66820>:1: UserWarning:

`distplot` is a deprecated function and will be removed in seaborn v0.14.0.

Please adapt your code to use either `displot` (a figure-level function with
similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).

For a guide to updating your code to use the new functions, please see
https://gist.github.com/mwaskom/de44147ed2974457ad6372750bbe5751

sns.distplot(random.binomial(n=400, p=0.5, size=1000), hist=False)


<Axes: ylabel='Density'>

Observamos que a medida que N cresce a distribuição binomial se aproxima da


distribuição normal

sns.distplot(random.binomial(n=400, p=0.2, size=1000), hist=False)

<ipython-input-12-dc598999934b>:1: UserWarning:

`distplot` is a deprecated function and will be removed in seaborn v0.14.0.

Please adapt your code to use either `displot` (a figure-level function with
similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).

For a guide to updating your code to use the new functions, please see
https://gist.github.com/mwaskom/de44147ed2974457ad6372750bbe5751

sns.distplot(random.binomial(n=400, p=0.2, size=1000), hist=False)


<Axes: ylabel='Density'>

sns.distplot(random.binomial(n=400, p=0.9, size=1000), hist=False)

https://colab.research.google.com/drive/1oDQ7dTFr6FhWwaP3N43n2eHlyECdO_Va#scrollTo=c9cxbhZaGlUU&printMode=true 2/4
16/04/2023, 19:18 lista1-mec-estatística.ipynb - Colaboratory

<ipython-input-13-18cbb8b924b9>:1: UserWarning:

`distplot` is a deprecated function and will be removed in seaborn v0.14.0.

Please adapt your code to use either `displot` (a figure-level function with
similar flexibility) or `kdeplot` (an axes-level function for kernel density plots).

For a guide to updating your code to use the new functions, please see
https://gist.github.com/mwaskom/de44147ed2974457ad6372750bbe5751

sns.distplot(random.binomial(n=400, p=0.9, size=1000), hist=False)


<Axes: ylabel='Density'>

Ao mudar a probabilidade de sucesso percebemos o deslocamento da gráfico em


relação ao eixo dos n. Com probabilidade diferente de 0,5 a média não corresponderá
mais ao centro do gráfico.

import numpy as np
import scipy.stats as stats
import matplotlib.pyplot as plt

media = 200
desvio_padrao = 10

x = np.linspace(1, 401, 400)

pdf = stats.norm.pdf(x, media, desvio_padrao)

plt.plot(x, pdf, label='Distribuição normal')


plt.legend()
plt.show()

com o método linspace geramos um array "x" de 400 valores espaçados igualmente,
após isso, aplicamos o método norm para gerar os valores das probabilidades e

https://colab.research.google.com/drive/1oDQ7dTFr6FhWwaP3N43n2eHlyECdO_Va#scrollTo=c9cxbhZaGlUU&printMode=true 3/4
16/04/2023, 19:18 lista1-mec-estatística.ipynb - Colaboratory

plotamos o gráfico "pdf" por "x".

Produtos pagos do Colab - Cancelar contratos


check 0s conclusão: 19:14

https://colab.research.google.com/drive/1oDQ7dTFr6FhWwaP3N43n2eHlyECdO_Va#scrollTo=c9cxbhZaGlUU&printMode=true 4/4

You might also like