Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings #391

Merged
merged 3 commits into from
Nov 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pingouin/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,16 +457,16 @@ def anderson(*args, dist="norm"):
(True, 15.0)
"""
k = len(args)
from_dist = np.zeros(k, "bool")
from_dist = np.zeros(k, dtype="bool")
sig_level = np.zeros(k)
for j in range(k):
st, cr, sig = scipy.stats.anderson(args[j], dist=dist)
from_dist[j] = True if (st < cr).any() else False
sig_level[j] = sig[np.argmin(np.abs(st - cr))]

if k == 1:
from_dist = bool(from_dist)
sig_level = float(sig_level)
from_dist = from_dist[0]
sig_level = sig_level[0]
return from_dist, sig_level


Expand Down Expand Up @@ -1001,7 +1001,7 @@ def sphericity(data, dv=None, within=None, subject=None, method="mauchly", alpha
S_pop = S - S.mean(0)[:, None] - S.mean(1)[None, :] + S.mean()
eig = np.linalg.eigvalsh(S_pop)[1:]
eig = eig[eig > 0.001] # Additional check to remove very low eig
W = np.product(eig) / (eig.sum() / d) ** d
W = np.prod(eig) / (eig.sum() / d) ** d
logW = np.log(W)

# Compute chi-square and p-value (adapted from the ezANOVA R package)
Expand Down
2 changes: 1 addition & 1 deletion pingouin/tests/test_correlation.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def test_corr(self):
# Compare BF10 with JASP
df = read_dataset("pairwise_corr")
stats = corr(df["Neuroticism"], df["Extraversion"])
assert np.isclose(1 / float(stats["BF10"].to_numpy()), 1.478e-13)
assert np.isclose(1 / float(stats.at["pearson", "BF10"]), 1.478e-13)
# Perfect correlation, CI and power should be 1, BF should be Inf
# https://github.com/raphaelvallat/pingouin/issues/195
stats = corr(x, x)
Expand Down
4 changes: 2 additions & 2 deletions pingouin/tests/test_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,5 +201,5 @@ def test_sphericity(self):

def test_anderson(self):
"""Test function test_anderson."""
assert anderson(np.random.random(size=1000))[0] is False
assert anderson(np.random.normal(size=10000))[0] is True
assert not anderson(np.random.random(size=1000))[0]
assert anderson(np.random.normal(size=10000))[0]
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ statistics=True
[coverage:run]
branch = True
source = pingouin
include = */pingouin/*
omit =
*/setup.py
*/examples/*
Expand Down
Loading