|
1 | 1 | { |
2 | 2 | "cells": [ |
| 3 | + { |
| 4 | + "metadata": { |
| 5 | + "ExecuteTime": { |
| 6 | + "end_time": "2025-06-20T10:09:41.037595Z", |
| 7 | + "start_time": "2025-06-20T10:09:41.031579Z" |
| 8 | + } |
| 9 | + }, |
| 10 | + "cell_type": "code", |
| 11 | + "source": [ |
| 12 | + "import numpy as np\n", |
| 13 | + "import pandas as pd\n", |
| 14 | + "import matplotlib.pyplot as plt\n", |
| 15 | + "import seaborn as sns\n", |
| 16 | + "import scipy.stats as st" |
| 17 | + ], |
| 18 | + "id": "5d3a57e53b5d4959", |
| 19 | + "outputs": [], |
| 20 | + "execution_count": 3 |
| 21 | + }, |
| 22 | + { |
| 23 | + "metadata": { |
| 24 | + "ExecuteTime": { |
| 25 | + "end_time": "2025-06-20T10:09:43.158259Z", |
| 26 | + "start_time": "2025-06-20T10:09:42.595539Z" |
| 27 | + } |
| 28 | + }, |
| 29 | + "cell_type": "code", |
| 30 | + "source": "first_data=pd.read_csv(\"/home/hammadali08/Videos/Moviesdata.csv\")", |
| 31 | + "id": "e97ebfb132d5d71b", |
| 32 | + "outputs": [], |
| 33 | + "execution_count": 4 |
| 34 | + }, |
| 35 | + { |
| 36 | + "metadata": {}, |
| 37 | + "cell_type": "markdown", |
| 38 | + "source": " Hypothesis T test(uses when number of data is less than 30)", |
| 39 | + "id": "75d490a97b674d70" |
| 40 | + }, |
| 41 | + { |
| 42 | + "metadata": { |
| 43 | + "ExecuteTime": { |
| 44 | + "end_time": "2025-06-20T10:09:44.619885Z", |
| 45 | + "start_time": "2025-06-20T10:09:44.614932Z" |
| 46 | + } |
| 47 | + }, |
| 48 | + "cell_type": "code", |
| 49 | + "source": [ |
| 50 | + "pop_mean=150\n", |
| 51 | + "n_data=25\n", |
| 52 | + "sample_mean=148\n", |
| 53 | + "sample_std=5\n", |
| 54 | + "alpha=0.05" |
| 55 | + ], |
| 56 | + "id": "f80e11c6dd45152a", |
| 57 | + "outputs": [], |
| 58 | + "execution_count": 5 |
| 59 | + }, |
| 60 | + { |
| 61 | + "metadata": { |
| 62 | + "ExecuteTime": { |
| 63 | + "end_time": "2025-06-20T10:09:45.285434Z", |
| 64 | + "start_time": "2025-06-20T10:09:45.277183Z" |
| 65 | + } |
| 66 | + }, |
| 67 | + "cell_type": "code", |
| 68 | + "source": "t_table=(st.t.ppf(alpha,n_data-1))", |
| 69 | + "id": "69f81a66d9557222", |
| 70 | + "outputs": [], |
| 71 | + "execution_count": 6 |
| 72 | + }, |
| 73 | + { |
| 74 | + "metadata": { |
| 75 | + "ExecuteTime": { |
| 76 | + "end_time": "2025-06-20T10:09:45.988490Z", |
| 77 | + "start_time": "2025-06-20T10:09:45.983877Z" |
| 78 | + } |
| 79 | + }, |
| 80 | + "cell_type": "code", |
| 81 | + "source": "T_test=(sample_mean-pop_mean)/(sample_std/np.sqrt(n_data))", |
| 82 | + "id": "d1c1559acf4f5170", |
| 83 | + "outputs": [], |
| 84 | + "execution_count": 7 |
| 85 | + }, |
| 86 | + { |
| 87 | + "metadata": { |
| 88 | + "ExecuteTime": { |
| 89 | + "end_time": "2025-06-20T10:09:46.576040Z", |
| 90 | + "start_time": "2025-06-20T10:09:46.569050Z" |
| 91 | + } |
| 92 | + }, |
| 93 | + "cell_type": "code", |
| 94 | + "source": [ |
| 95 | + "if t_table<T_test:\n", |
| 96 | + " print(\"Ho is Right\")\n", |
| 97 | + "else:\n", |
| 98 | + " print(\"Ha is right\")" |
| 99 | + ], |
| 100 | + "id": "d8d0e3d5efd2b593", |
| 101 | + "outputs": [ |
| 102 | + { |
| 103 | + "name": "stdout", |
| 104 | + "output_type": "stream", |
| 105 | + "text": [ |
| 106 | + "Ha is right\n" |
| 107 | + ] |
| 108 | + } |
| 109 | + ], |
| 110 | + "execution_count": 8 |
| 111 | + }, |
3 | 112 | { |
4 | 113 | "metadata": {}, |
5 | 114 | "cell_type": "code", |
6 | 115 | "outputs": [], |
7 | 116 | "execution_count": null, |
8 | 117 | "source": "", |
9 | | - "id": "5d3a57e53b5d4959" |
| 118 | + "id": "aae5b8c7d26159be" |
10 | 119 | } |
11 | 120 | ], |
12 | 121 | "metadata": { |
|
0 commit comments