{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"provenance":[],"authorship_tag":"ABX9TyOAr04w6si475LFMpkl9lbu"},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"}},"cells":[{"cell_type":"code","execution_count":1,"metadata":{"id":"BGETSijFpgvX","executionInfo":{"status":"ok","timestamp":1717752869880,"user_tz":-330,"elapsed":1749,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}}},"outputs":[],"source":["import scipy.stats as st\n","import numpy as np\n","import matplotlib.pyplot as plt"]},{"cell_type":"code","source":["df=30\n","UpperT = st.t.ppf(q = 0.95, df=30)\n","LowerT = st.t.ppf(q = 0.05, df=30)\n","print(\"Upper T Value:\", UpperT )\n","print(\"Lower T Value:\", LowerT )"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"u9kikhiwr62D","executionInfo":{"status":"ok","timestamp":1717752869881,"user_tz":-330,"elapsed":14,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}},"outputId":"4b9ef90c-4dd4-4831-bc22-18a30cecae02"},"execution_count":2,"outputs":[{"output_type":"stream","name":"stdout","text":["Upper T Value: 1.6972608943617378\n","Lower T Value: -1.6972608943617384\n"]}]},{"cell_type":"code","source":["plt.figure()\n","xs = np.linspace(-3,3,100)\n","plt_1 = plt.figure(figsize=(8, 6))\n","plt.plot(xs, st.t.pdf(xs,df))\n","plt.title('90% Confidence Intervel Lines in T Distribution, df=30')\n","lineheight = np.linspace(0,.33)\n","xl = len(lineheight) * [LowerT]\n","xu = len(lineheight) * [UpperT]\n","plt.plot(xl, lineheight, 'r', label=\"Lower T Value\")\n","plt.plot(xu, lineheight,'b', label=\"Upper T Value\")\n","plt.xlabel('T Values')\n","plt.legend()"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":599},"id":"zF-pcJZdr65L","executionInfo":{"status":"ok","timestamp":1717752869881,"user_tz":-330,"elapsed":10,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}},"outputId":"5b47bddf-3457-4322-eaac-f509a5af7647"},"execution_count":3,"outputs":[{"output_type":"execute_result","data":{"text/plain":["<matplotlib.legend.Legend at 0x78ac069514b0>"]},"metadata":{},"execution_count":3},{"output_type":"display_data","data":{"text/plain":["<Figure size 640x480 with 0 Axes>"]},"metadata":{}},{"output_type":"display_data","data":{"text/plain":["<Figure size 800x600 with 1 Axes>"],"image/png":"[encoded data, 50600 characters]\n"},"metadata":{}}]},{"cell_type":"code","source":["fig, ax = plt.subplots(figsize=(8, 6))\n","x = np.linspace(-3,3,100)\n","ax.plot(x, st.t.pdf(x,df))\n","ax.set_title(\"90% Confidence Intervel Lines in T Distribution, df=30\")\n","px=np.arange(LowerT,UpperT,0.01)\n","ax.set_ylim(0,0.5)\n","ax.fill_between(px,st.t.pdf(px,df),alpha=0.5, color='g')\n","plt.xlabel('T Values')\n","plt.show()"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":564},"id":"j_vdSJcGr68M","executionInfo":{"status":"ok","timestamp":1717752870951,"user_tz":-330,"elapsed":1075,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}},"outputId":"0fb2bd04-5df0-4153-9983-14a0b2767166"},"execution_count":4,"outputs":[{"output_type":"display_data","data":{"text/plain":["<Figure size 800x600 with 1 Axes>"],"image/png":"[encoded data, 40452 characters]\n"},"metadata":{}}]},{"cell_type":"code","source":[],"metadata":{"id":"kWkCvQWZr6_G","executionInfo":{"status":"ok","timestamp":1717752870952,"user_tz":-330,"elapsed":6,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}}},"execution_count":4,"outputs":[]},{"cell_type":"code","source":[],"metadata":{"id":"Lg17S5Aer7CR","executionInfo":{"status":"ok","timestamp":1717752870952,"user_tz":-330,"elapsed":5,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}}},"execution_count":4,"outputs":[]},{"cell_type":"code","source":[],"metadata":{"id":"JPqGFKjCr7Fk","executionInfo":{"status":"ok","timestamp":1717752870952,"user_tz":-330,"elapsed":5,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}}},"execution_count":4,"outputs":[]}]}