Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -357,34 +357,49 @@ def perform_analysis():
|
|
357 |
if st.button("μ κ·μ± κ²μ μν"):
|
358 |
check_normality(st.session_state.filtered_data, normality_column)
|
359 |
|
360 |
-
# T-κ²μ
|
361 |
-
st.write("T-κ²μ ")
|
362 |
-
test_type = st.radio("T-κ²μ μ ν μ ν:", ["λ
립 νλ³Έ", "λμ νλ³Έ", "λ¨μΌ νλ³Έ"])
|
363 |
-
|
364 |
if test_type == "λ
립 νλ³Έ":
|
365 |
-
|
366 |
-
|
367 |
-
|
|
|
|
|
368 |
|
369 |
-
|
370 |
-
|
371 |
-
options=active_slicers + [col for col in st.session_state.categorical_columns if col not in active_slicers]
|
372 |
-
)
|
373 |
-
|
374 |
-
value_column = st.selectbox("λΉκ΅ν κ°μ΄ μλ μ΄ μ ν:", st.session_state.numeric_columns)
|
375 |
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
|
384 |
-
if
|
385 |
-
|
386 |
else:
|
387 |
-
st.
|
|
|
|
|
388 |
|
389 |
|
390 |
elif test_type == "λμ νλ³Έ":
|
|
|
357 |
if st.button("μ κ·μ± κ²μ μν"):
|
358 |
check_normality(st.session_state.filtered_data, normality_column)
|
359 |
|
|
|
|
|
|
|
|
|
360 |
if test_type == "λ
립 νλ³Έ":
|
361 |
+
# νμ±νλ μ¬λΌμ΄μμ κ·Έ μ νλ κ°λ€μ νμΈ
|
362 |
+
active_slicers = {}
|
363 |
+
for col, values in st.session_state.slicers.items():
|
364 |
+
if values: # μ νλ κ°μ΄ μλ κ²½μ°λ§ ν¬ν¨
|
365 |
+
active_slicers[col] = values
|
366 |
|
367 |
+
if active_slicers:
|
368 |
+
group_column = st.selectbox("κ·Έλ£Ή ꡬλΆμ μν μ΄ μ ν:", options=list(active_slicers.keys()))
|
|
|
|
|
|
|
|
|
369 |
|
370 |
+
# μ νλ κ·Έλ£Ή μ΄μ κ°λ€ μ€μμ λ κ·Έλ£Ή μ ν
|
371 |
+
available_groups = active_slicers[group_column]
|
372 |
+
group1 = st.selectbox("첫 λ²μ§Έ κ·Έλ£Ή μ ν:", options=available_groups, key="group1")
|
373 |
+
group2 = st.selectbox("λ λ²μ§Έ κ·Έλ£Ή μ ν:",
|
374 |
+
options=[g for g in available_groups if g != group1],
|
375 |
+
key="group2")
|
376 |
+
else:
|
377 |
+
st.warning("νμ±νλ μ¬λΌμ΄μκ° μμ΅λλ€. λ¨Όμ μ¬λΌμ΄μμμ κ·Έλ£Ήμ μ νν΄μ£ΌμΈμ.")
|
378 |
+
group_column = None
|
379 |
+
group1 = None
|
380 |
+
group2 = None
|
381 |
+
|
382 |
+
value_column = st.selectbox("λΉκ΅ν κ°μ΄ μλ μ΄ μ ν:", st.session_state.numeric_columns)
|
383 |
+
|
384 |
+
if st.button("λ
립 νλ³Έ T-κ²μ μν"):
|
385 |
+
if group_column and group1 and group2:
|
386 |
+
# μ νλ λ κ·Έλ£ΉμΌλ‘ λ°μ΄ν° νν°λ§
|
387 |
+
group1_data = st.session_state.filtered_data[st.session_state.filtered_data[group_column] == group1]
|
388 |
+
group2_data = st.session_state.filtered_data[st.session_state.filtered_data[group_column] == group2]
|
389 |
+
|
390 |
+
# T-κ²μ μν
|
391 |
+
t_stat, p_value = stats.ttest_ind(group1_data[value_column], group2_data[value_column])
|
392 |
+
|
393 |
+
st.write(f"λ
립 νλ³Έ T-κ²μ κ²°κ³Ό ({group_column}: {group1} vs {group2}, {value_column} λΉκ΅):")
|
394 |
+
st.write(f"t-ν΅κ³λ: {t_stat:.4f}")
|
395 |
+
st.write(f"p-value: {p_value:.4f}")
|
396 |
|
397 |
+
if p_value < 0.05:
|
398 |
+
st.write(f"{group1}κ³Ό {group2} κ°μ ν΅κ³μ μΌλ‘ μ μν μ°¨μ΄κ° μμ΅λλ€.")
|
399 |
else:
|
400 |
+
st.write(f"{group1}κ³Ό {group2} κ°μ ν΅κ³μ μΌλ‘ μ μν μ°¨μ΄κ° μμ΅λλ€.")
|
401 |
+
else:
|
402 |
+
st.error("κ·Έλ£Ή μ νμ΄ μλ£λμ§ μμμ΅λλ€.")
|
403 |
|
404 |
|
405 |
elif test_type == "λμ νλ³Έ":
|