This solution addresses the issue "Write NumPy docstring for hypothesis_predictor_core_n()" by providing a detailed NumPy-style docstring for the hypothesis_predictor_core_n() function.
Summary:
The function hypothesis_predictor_core_n() conducts hypothesis testing on numerical data, choosing appropriate tests based on data characteristics. It performs hypothesis testing between groups defined by a categorical variable for a numerical target variable. The appropriate statistical test is selected based on the normality of the data and the homogeneity of variances across groups, utilizing t-tests, Mann-Whitney U tests, ANOVA, or Kruskal-Wallis tests as appropriate. The docstring follows the NumPy format and includes details on the parameters, return values, exceptions, and examples.
Docstring Sections Preview:
Description
"""
Conducts hypothesis testing on numerical data, choosing appropriate tests based on data characteristics.
This function performs hypothesis testing between groups defined by a categorical variable for a numerical
target variable. It selects the appropriate statistical test based on the normality of the data and the homogeneity
of variances across groups, utilizing t-tests, Mann-Whitney U tests, ANOVA, or Kruskal-Wallis tests as appropriate.
"""
Parameters
"""
Parameters
----------
df : pd.DataFrame
The DataFrame containing the data to be analyzed.
target_variable : str
The name of the numerical variable to test across groups.
grouping_variable : str
The name of the categorical variable used to define groups.
normality_bool : bool
A boolean indicating if the data follows a normal distribution within groups.
equal_variances_bool : bool
A boolean indicating if the groups have equal variances.
"""
Returns
"""
Returns
-------
output_info : dict
A dictionary containing the results of the hypothesis test, including test statistics, p-values,
conclusions regarding the differences between groups, the name of the test used, and the assumptions
tested (normality and equal variances).
"""
Raises
"""
Raises
------
TypeError
- If `df` is not a pandas DataFrame.
- If `target_variable` or `grouping_variable` is not a string.
- If `normality_bool` or `equal_variances_bool` is not a boolean.
ValueError
- If the `df` is empty, indicating that there's no data to evaluate.
- If `target_variable` or `grouping_variable` is not found in the DataFrame's columns.
- If `target_variable` is not numerical.
- If `grouping_variable` is not categorical.
"""
Written and accessible:
This solution addresses the issue "Write NumPy docstring for hypothesis_predictor_core_n()" by providing a detailed NumPy-style docstring for the
hypothesis_predictor_core_n()
function.Summary:
The function
hypothesis_predictor_core_n()
conducts hypothesis testing on numerical data, choosing appropriate tests based on data characteristics. It performs hypothesis testing between groups defined by a categorical variable for a numerical target variable. The appropriate statistical test is selected based on the normality of the data and the homogeneity of variances across groups, utilizing t-tests, Mann-Whitney U tests, ANOVA, or Kruskal-Wallis tests as appropriate. The docstring follows the NumPy format and includes details on the parameters, return values, exceptions, and examples.Docstring Sections Preview:
Description
Parameters
Returns
Raises