class_docstr: Test power.py.
docstr: Test function power_chi2.
  Values are compared to the pwr R package.
code: def test_power_chi2(self):
      """Test function power_chi2.
      Values are compared to the pwr R package.
      """
      # Power
      assert np.isclose(power_chi2(dof=1, w=0.3, n=20), 0.2686618)
      assert np.isclose(power_chi2(dof=2, w=0.3, n=100), 0.7706831)
  
      # Sample size
      assert np.isclose(power_chi2(dof=1, w=0.3, power=0.80), 87.20954)
      assert np.isclose(power_chi2(dof=3, w=0.3, power=0.80), 121.1396)
  
      # Effect size
      assert np.isclose(power_chi2(dof=4, n=50, power=0.80), 0.4885751)
      assert np.isclose(power_chi2(dof=1, n=50, power=0.80), 0.3962023)
  
      # Alpha
      assert np.isclose(
          power_chi2(dof=1, w=0.3, n=100, power=0.80, alpha=None),
          0.03089736,
          atol=1e-03,
      )
  
      # Error
      with pytest.raises(ValueError):
          power_chi2(1, w=0.3)
  
file_path: pingouin/pingouin/tests/test_power.py
imports: import pytest
  import numpy
  from unittest import TestCase
  from pingouin.power import power_ttest, power_ttest2n, power_anova, power_rm_anova, power_corr, power_chi2
label_desc: Use image node_id 6 for calling the TestPower obj's underlying member method code with example usage: obj.test_power_chi2() without return types