{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"provenance":[],"authorship_tag":"ABX9TyNpWmnF726bUDokkeXs8CeO"},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"}},"cells":[{"cell_type":"code","execution_count":1,"metadata":{"id":"FNTFim0ZEYZh","executionInfo":{"status":"ok","timestamp":1717752419755,"user_tz":-330,"elapsed":1857,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}}},"outputs":[],"source":["import scipy.stats as st\n","import numpy as np\n","import pandas as pd\n","import matplotlib.pyplot as plt"]},{"cell_type":"code","source":["z_critical90 = st.norm.ppf(q = 0.95)\n","z_critical95 = st.norm.ppf(q = 0.975)\n","z_critical99 = st.norm.ppf(q = 0.995)"],"metadata":{"id":"CJYhh6JyGOty","executionInfo":{"status":"ok","timestamp":1717752419756,"user_tz":-330,"elapsed":10,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}}},"execution_count":2,"outputs":[]},{"cell_type":"code","source":["m=4100\n","sd=625\n","n=130\n","sem=sd/(n)**.5\n","margin_of_error90 = z_critical90 * sem\n","margin_of_error95 = z_critical95 * sem\n","margin_of_error99 = z_critical99 * sem\n","print(\"Standard error of mean:\", sem)\n","print(\"margin_of_error (90%):\", margin_of_error90)\n","print(\"margin_of_error (95%):\", margin_of_error95)\n","print(\"margin_of_error (99%):\", margin_of_error99)\n"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"8dgV8pvhEl_L","executionInfo":{"status":"ok","timestamp":1717752419756,"user_tz":-330,"elapsed":9,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}},"outputId":"85f355e4-b697-4e86-d2ab-e58955b62d1a"},"execution_count":3,"outputs":[{"output_type":"stream","name":"stdout","text":["Standard error of mean: 54.816126206689326\n","margin_of_error (90%): 90.16450400650258\n","margin_of_error (95%): 107.4376331371133\n","margin_of_error (99%): 141.19698419022518\n"]}]},{"cell_type":"code","source":["confidence_interval90 = (m - margin_of_error90, m + margin_of_error90)\n","print(\"confidence_interval (90%):\", confidence_interval90)\n","\n","confidence_interval95 = (m - margin_of_error95, m + margin_of_error95)\n","print(\"confidence_interval (95%):\", confidence_interval95)\n","\n","confidence_interval99 = (m - margin_of_error99, m + margin_of_error99)\n","print(\"confidence_interval (99%):\", confidence_interval99)\n","\n"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"Kwgl5kPgEmCY","executionInfo":{"status":"ok","timestamp":1717752419756,"user_tz":-330,"elapsed":6,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}},"outputId":"6cbf3ffb-77b8-4f09-b6f6-1a470e9ef264"},"execution_count":4,"outputs":[{"output_type":"stream","name":"stdout","text":["confidence_interval (90%): (4009.8354959934973, 4190.164504006502)\n","confidence_interval (95%): (3992.562366862887, 4207.437633137113)\n","confidence_interval (99%): (3958.803015809775, 4241.1969841902255)\n"]}]},{"cell_type":"code","source":[],"metadata":{"id":"VAuWlkQgEmFl","executionInfo":{"status":"ok","timestamp":1717752419756,"user_tz":-330,"elapsed":4,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}}},"execution_count":4,"outputs":[]},{"cell_type":"code","source":[],"metadata":{"id":"8Z9sjkJvEmIy","executionInfo":{"status":"ok","timestamp":1717752419756,"user_tz":-330,"elapsed":3,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}}},"execution_count":4,"outputs":[]},{"cell_type":"code","source":[],"metadata":{"id":"hOUeVKZjEmL5","executionInfo":{"status":"ok","timestamp":1717752419757,"user_tz":-330,"elapsed":4,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}}},"execution_count":4,"outputs":[]}]}