Spaces:
Build error
Build error
Update pages/6_Measurement of Disperssion.py
Browse files
pages/6_Measurement of Disperssion.py
CHANGED
|
@@ -93,4 +93,184 @@ st.markdown("""Relative is a method to find the spread which involves the metho
|
|
| 93 |
<li>Coefficent Of Standard Deviation</li>
|
| 94 |
</ul>
|
| 95 |
""",unsafe_allow_html=True)
|
| 96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
<li>Coefficent Of Standard Deviation</li>
|
| 94 |
</ul>
|
| 95 |
""",unsafe_allow_html=True)
|
| 96 |
+
st.markdown(''':orange[**Range**] is one of the measure to find the disperssion.But is not at all mostly used beause it don't focus on the entire data.
|
| 97 |
+
''')
|
| 98 |
+
st.subheader("Absolute Range")
|
| 99 |
+
st.latex(r'''
|
| 100 |
+
\text{Absolute Range} = \text{Maximum Value} - \text{Minimum Value}
|
| 101 |
+
''')
|
| 102 |
+
st.subheader("Relative Range")
|
| 103 |
+
st.latex(r'''
|
| 104 |
+
\text{Relative Range} = \frac{\text{Absolute Range}}{\text{Mean}} \times 100
|
| 105 |
+
''')
|
| 106 |
+
def absolute_range(list1):
|
| 107 |
+
max_val = np.max(list1)
|
| 108 |
+
min_val = np.min(list1)
|
| 109 |
+
return max_val - min_val
|
| 110 |
+
st.title("Calculate Absolute Range")
|
| 111 |
+
num_input = st.text_input("Enter the values separated by commas (e.g., 1,2,3,4)", key="num_input")
|
| 112 |
+
list1 = []
|
| 113 |
+
value = num_input.split(",")
|
| 114 |
+
for i in value:
|
| 115 |
+
if i.isdigit():
|
| 116 |
+
list1.append(int(i))
|
| 117 |
+
if list1:
|
| 118 |
+
result = absolute_range(list1)
|
| 119 |
+
st.write("Absolute Range:", result)
|
| 120 |
+
else:
|
| 121 |
+
st.write("Please enter valid numbers.")
|
| 122 |
+
def relative_range(list1):
|
| 123 |
+
max=np.max(list1)
|
| 124 |
+
min=np.min(list1)
|
| 125 |
+
return round((max-min)/(max+min)*100,2)
|
| 126 |
+
st.title("Calculate Relative Range")
|
| 127 |
+
num_input1=st.text_input("Enter the values separated by commas (e.g., 1,2,3,4)", key="num_input1")
|
| 128 |
+
value=num_input1.split(",")
|
| 129 |
+
list1=[]
|
| 130 |
+
for i in value:
|
| 131 |
+
if i.isdigit():
|
| 132 |
+
list1.append(int(i))
|
| 133 |
+
else:
|
| 134 |
+
pass
|
| 135 |
+
if list1:
|
| 136 |
+
result=relative_range(list1)
|
| 137 |
+
st.write("Relative Range",result)
|
| 138 |
+
else:
|
| 139 |
+
st.write("Please enter valid numbers.")
|
| 140 |
+
st.markdown(''':orange[**Quartile Deviation**] is one of the measure to find the disperssion.In this type the data is divided into 4 equal parts.
|
| 141 |
+
It will mostly focus on the central data.
|
| 142 |
+
''')
|
| 143 |
+
st.subheader("Absolute Quartile Deviation")
|
| 144 |
+
st.latex(r'''
|
| 145 |
+
QD = \frac{Q3 - Q1}{2}
|
| 146 |
+
''')
|
| 147 |
+
st.subheader("Relative Quartile Deviation")
|
| 148 |
+
st.latex(r'''
|
| 149 |
+
\text{Relative QD} = \frac{Q3 - Q1}{Q3 + Q1} \times 100
|
| 150 |
+
''')
|
| 151 |
+
def abs_quartile_dev(list1):
|
| 152 |
+
q1=np.percentile(list1,25)
|
| 153 |
+
q3=np.percentile(list1,75)
|
| 154 |
+
return round((q3-q1)/2,2)
|
| 155 |
+
st.title("Caluculate Absolute Quartile Deviation")
|
| 156 |
+
num_input2=st.text_input("Enter the values separated by commas (e.g., 1,2,3,4)", key="num_input2")
|
| 157 |
+
value=num_input2.split(",")
|
| 158 |
+
list1=[]
|
| 159 |
+
for i in value:
|
| 160 |
+
if i.isdigit():
|
| 161 |
+
list1.append(int(i))
|
| 162 |
+
else:
|
| 163 |
+
pass
|
| 164 |
+
if list1:
|
| 165 |
+
result=abs_quartile_dev(list1)
|
| 166 |
+
st.write("Absolute Quartile Deviation",result)
|
| 167 |
+
else:
|
| 168 |
+
st.write("Please enter valid numbers.")
|
| 169 |
+
def rel_quartile_dev(list1):
|
| 170 |
+
q1=np.percentile(list1,25)
|
| 171 |
+
q3=np.percentile(list1,75)
|
| 172 |
+
return round(((q3-q1)/(q3+q1))*100,2)
|
| 173 |
+
st.title("Caluculate Relative Quartile Deviation")
|
| 174 |
+
num_input3=st.text_input("Enter the values separated by commas (e.g., 1,2,3,4)", key="num_input3")
|
| 175 |
+
value=num_input3.split(",")
|
| 176 |
+
list1=[]
|
| 177 |
+
for i in value:
|
| 178 |
+
if i.isdigit():
|
| 179 |
+
list1.append(int(i))
|
| 180 |
+
else:
|
| 181 |
+
pass
|
| 182 |
+
if list1:
|
| 183 |
+
result=rel_quartile_dev(list1)
|
| 184 |
+
st.write("Relative Quartile Deviation",result)
|
| 185 |
+
else:
|
| 186 |
+
st.write("Please enter valid numbers.")
|
| 187 |
+
st.markdown(''':orange[**Varience**] is one of the measure to find the disperssion.It is one of the best measure to find the disperssion.The only
|
| 188 |
+
drawback is when in Varience is in order to overcome negitive value we square them thus the distance is doubled
|
| 189 |
+
''')
|
| 190 |
+
st.subheader("Absolute Variance")
|
| 191 |
+
st.latex(r'''
|
| 192 |
+
\text{Var} = \frac{1}{N} \sum_{i=1}^{N} (x_i - \bar{x})^2
|
| 193 |
+
''')
|
| 194 |
+
st.subheader("Relative Variance")
|
| 195 |
+
st.latex(r'''
|
| 196 |
+
\text{Relative Var} = \frac{\text{Var}}{\bar{x}} \times 100
|
| 197 |
+
''')
|
| 198 |
+
def absolute_varience(list1):
|
| 199 |
+
return np.var(list1)
|
| 200 |
+
st.title("Caluculate Absolute varience")
|
| 201 |
+
num_input4=st.text_input("Enter the values separated by commas (e.g., 1,2,3,4)", key="num_input4")
|
| 202 |
+
value=num_input4.split(",")
|
| 203 |
+
list1=[]
|
| 204 |
+
for i in value:
|
| 205 |
+
if i.isdigit():
|
| 206 |
+
list1.append(int(i))
|
| 207 |
+
else:
|
| 208 |
+
pass
|
| 209 |
+
if list1:
|
| 210 |
+
result=absolute_varience(list1)
|
| 211 |
+
st.write("Absolute Varience",result)
|
| 212 |
+
else:
|
| 213 |
+
st.write("Please enter valid numbers.")
|
| 214 |
+
def relative_varience(list1):
|
| 215 |
+
mean=round(np.mean(list1),2)
|
| 216 |
+
std_dev=np.std(list1,ddof=1)
|
| 217 |
+
return round((std_dev/mean)*100,2)
|
| 218 |
+
st.title("Caluculate Relative Varience")
|
| 219 |
+
num_input5=st.text_input("Enter the values separated by commas (e.g., 1,2,3,4)", key="num_input5")
|
| 220 |
+
value=num_input5.split(",")
|
| 221 |
+
list1=[]
|
| 222 |
+
for i in value:
|
| 223 |
+
if i.isdigit():
|
| 224 |
+
list1.append(int(i))
|
| 225 |
+
else:
|
| 226 |
+
pass
|
| 227 |
+
if list1:
|
| 228 |
+
result=relative_varience(list1)
|
| 229 |
+
st.write("Relative Varience",result)
|
| 230 |
+
else:
|
| 231 |
+
st.write("Please enter valid numbers.")
|
| 232 |
+
st.markdown(''':orange[**Standard Deviation**] is one of the measure to find the disperssion.It is one of the best measure to find the disperssion.It over comes the
|
| 233 |
+
disadvantage occured in varience by square rooting it.
|
| 234 |
+
''')
|
| 235 |
+
st.subheader("Absolute Standard Deviation")
|
| 236 |
+
st.latex(r'''
|
| 237 |
+
\sigma = \sqrt{\frac{1}{N} \sum_{i=1}^{N} (x_i - \bar{x})^2}
|
| 238 |
+
''')
|
| 239 |
+
st.subheader("Relative Standard Deviation")
|
| 240 |
+
st.latex(r'''
|
| 241 |
+
\text{Relative SD} = \frac{\sigma}{\bar{x}}
|
| 242 |
+
''')
|
| 243 |
+
def absolute_std(list1):
|
| 244 |
+
return round(np.std(list1),2)
|
| 245 |
+
st.title("Caluculate Absolute Standard Deviation")
|
| 246 |
+
num_input6=st.text_input("Enter the values separated by commas (e.g., 1,2,3,4)", key="num_input6")
|
| 247 |
+
value=num_input6.split(",")
|
| 248 |
+
list1=[]
|
| 249 |
+
for i in value:
|
| 250 |
+
if i.isdigit():
|
| 251 |
+
list1.append(int(i))
|
| 252 |
+
else:
|
| 253 |
+
pass
|
| 254 |
+
if list1:
|
| 255 |
+
result=absolute_std(list1)
|
| 256 |
+
st.write("Absolute Standard Deviation",result)
|
| 257 |
+
else:
|
| 258 |
+
st.write("Please enter valid numbers.")
|
| 259 |
+
def relative_std(list1):
|
| 260 |
+
mean=round(np.mean(list1),2)
|
| 261 |
+
std_dev=np.std(list1,ddof=1)
|
| 262 |
+
return round((std_dev/mean),2)
|
| 263 |
+
st.title("Caluculate Relative Standard Deviation")
|
| 264 |
+
num_input7=st.text_input("Enter the values separated by commas (e.g., 1,2,3,4)", key="num_input7")
|
| 265 |
+
value=num_input7.split(",")
|
| 266 |
+
list1=[]
|
| 267 |
+
for i in value:
|
| 268 |
+
if i.isdigit():
|
| 269 |
+
list1.append(int(i))
|
| 270 |
+
else:
|
| 271 |
+
pass
|
| 272 |
+
if list1:
|
| 273 |
+
result=relative_std(list1)
|
| 274 |
+
st.write("Relative Standard Deviation",result)
|
| 275 |
+
else:
|
| 276 |
+
st.write("Please enter valid numbers.")
|