{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"provenance":[],"authorship_tag":"ABX9TyOjs7vLVvCwnga/NsRcyB5G"},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"}},"cells":[{"cell_type":"code","execution_count":1,"metadata":{"id":"urBHwl5HR85x","executionInfo":{"status":"ok","timestamp":1717750792649,"user_tz":-330,"elapsed":1271,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}}},"outputs":[],"source":["import scipy.stats as stats\n","import numpy as np\n","import matplotlib.pyplot as plt"]},{"cell_type":"code","source":["x = (0,1,2,3,4,5,6,7,8)\n","λ=5\n","x1=stats.poisson.pmf(x,λ)\n","print(x1)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"itBgqGfpTV2l","executionInfo":{"status":"ok","timestamp":1717750792649,"user_tz":-330,"elapsed":7,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}},"outputId":"d85ca09f-7ca8-45d2-8d54-4148cf6f4505"},"execution_count":2,"outputs":[{"output_type":"stream","name":"stdout","text":["[0.00673795 0.03368973 0.08422434 0.1403739  0.17546737 0.17546737\n"," 0.14622281 0.10444486 0.06527804]\n"]}]},{"cell_type":"code","source":["m, v, s, k = stats.poisson.stats(λ, moments='mvsk')\n","print(\"mean             \",m)\n","print(\"var              \",v)\n","print(\"skew             \",s)\n","print(\"kurt             \",k)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"bM4JCnUhTVza","executionInfo":{"status":"ok","timestamp":1717750792649,"user_tz":-330,"elapsed":4,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}},"outputId":"9eb4d0e7-dd4e-4813-c9e6-97a65df34cab"},"execution_count":3,"outputs":[{"output_type":"stream","name":"stdout","text":["mean              5.0\n","var               5.0\n","skew              0.4472135954999579\n","kurt              0.2\n"]}]},{"cell_type":"code","source":["q4 = stats.poisson(λ)\n","fig, ax = plt.subplots(1, 1)\n","ax.vlines(x, 0, q4.pmf(x), label='Poisson Probability')\n","ax.legend(loc='upper right')\n","plt.show()"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":430},"id":"EQadCFMLTVwj","executionInfo":{"status":"ok","timestamp":1717750793491,"user_tz":-330,"elapsed":844,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}},"outputId":"18a6d437-9208-42cb-aaaf-5d81798ab305"},"execution_count":4,"outputs":[{"output_type":"display_data","data":{"text/plain":["<Figure size 640x480 with 1 Axes>"],"image/png":"[encoded data, 18892 characters]\n"},"metadata":{}}]},{"cell_type":"code","source":[],"metadata":{"id":"DdKvttD9TVtM","executionInfo":{"status":"ok","timestamp":1717750793491,"user_tz":-330,"elapsed":3,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}}},"execution_count":4,"outputs":[]},{"cell_type":"code","source":[],"metadata":{"id":"BqsRws26TVqA","executionInfo":{"status":"ok","timestamp":1717750793492,"user_tz":-330,"elapsed":4,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}}},"execution_count":4,"outputs":[]}]}