Calculate a one-way chi-square test. Please see the docstring for :py:func:`scipy.stats.chisquare` for complete information including notes, references, and examples. Some inconsistencies with the Dask version may exist. The chi-square test tests the null hypothesis that the categ
(f_obs, f_exp=None, ddof=0, axis=0)
| 146 | |
| 147 | |
| 148 | def chisquare(f_obs, f_exp=None, ddof=0, axis=0): |
| 149 | """Calculate a one-way chi-square test. |
| 150 | |
| 151 | Please see the docstring for :py:func:`scipy.stats.chisquare` for |
| 152 | complete information including notes, references, and examples. |
| 153 | |
| 154 | Some inconsistencies with the Dask version may exist. |
| 155 | |
| 156 | The chi-square test tests the null hypothesis that the categorical |
| 157 | data has the given frequencies. |
| 158 | |
| 159 | Parameters |
| 160 | ---------- |
| 161 | f_obs : array_like |
| 162 | Observed frequencies in each category. |
| 163 | f_exp : array_like, optional |
| 164 | Expected frequencies in each category. By default the categories are |
| 165 | assumed to be equally likely. |
| 166 | ddof : int, optional |
| 167 | "Delta degrees of freedom": adjustment to the degrees of freedom |
| 168 | for the p-value. The p-value is computed using a chi-squared |
| 169 | distribution with ``k - 1 - ddof`` degrees of freedom, where `k` |
| 170 | is the number of observed frequencies. The default value of `ddof` |
| 171 | is 0. |
| 172 | axis : int or None, optional |
| 173 | The axis of the broadcast result of `f_obs` and `f_exp` along which to |
| 174 | apply the test. If axis is None, all values in `f_obs` are treated |
| 175 | as a single data set. Default is 0. |
| 176 | |
| 177 | Returns |
| 178 | ------- |
| 179 | res: Delayed Power_divergenceResult |
| 180 | An object containing attributes: |
| 181 | |
| 182 | chisq : float or ndarray |
| 183 | The chi-squared test statistic. The value is a float if `axis` is |
| 184 | None or `f_obs` and `f_exp` are 1-D. |
| 185 | pvalue : float or ndarray |
| 186 | The p-value of the test. The value is a float if `ddof` and the |
| 187 | return value `chisq` are scalars. |
| 188 | |
| 189 | """ |
| 190 | return power_divergence(f_obs, f_exp=f_exp, ddof=ddof, axis=axis, lambda_="pearson") |
| 191 | |
| 192 | |
| 193 | @derived_from(scipy.stats) |
nothing calls this directly
no test coverage detected