sphstat.twosample module

Functions for inferential statistics on two or more samples

Functions for inferential statistics on two or more samples

Utility functions

sphstat.twosample.a20(N=12, alpha: float = 0.05, Rbar: float = 0.7)[source]

Utility function used by isfishercommonmean() to extract tabulated critical values

sphstat.twosample.a21(gamma=2, N=20, alpha=0.05, Rbar=0.1)[source]

Utility function used by isfishercommonmean() to extract tabulated critical values

sphstat.twosample.a23(nu=2, r=2)[source]

Utility function used by isfishercommonkappa() to extract tabulated critical values

sphstat.twosample.bilinearinterp(z00: float, z01: float, z10: float, z11: float, alpha: float, beta: float)[source]

Bilinear interpolation between 4 values

Parameters
  • z00 (float) – Value 1

  • z01 (float) – Value 2

  • z10 (float) – Value 3

  • z11 (float) – Value 4

  • alpha (float) – Interpolation coefficient along axis 1 (0<=alpha<=1)

  • beta (float) – Interpolation coefficient along axis 2 (0<=beta<=1)

Returns

Interpolated value

Return type

float

sphstat.twosample.errors(samplecart: dict, srcpos: tuple) list[source]

Calculate angular error from a given direction

Parameters
  • samplecart (dict) – Sample in cart format

  • srcpos – Direction (th, ph) with respect to which the error will be calculated

Returns

Errors in radians

Return type

list

sphstat.twosample.fishercommonkappa(samplecartlist, alpha=0.05)[source]

Estimation of the common concentration parameter of two or more Fisher distributions

Parameters
  • samplecartlist (list[dict]) – List containing individual samples top be tested in ‘cart’ format

  • alpha (float) – Semi-vertical angle for (1-alpha)% confidence cone is calculated

Returns

  • kappahat: Pooled concentration parameter [float]

  • ku, kl: Upper and lower critical values for the (1-alpha)% CI

Return type

tuple

sphstat.twosample.fishercommonmean(samplecartlist: list, alpha: float = 0.05) tuple[source]

Estimation of the common mean direction of two or more Fisher distributions 1, 2

Parameters
  • samplecartlist (list[dict]) – List containing individual samples top be tested in ‘cart’ format

  • alpha (float) – Semi-vertical angle for (1-alpha)% confidence cone is calculated

Returns

  • mdir: Tuple containing the common mean direction [th, ph]

  • qw: Semi-vertical angle [float]

Return type

tuple

1

Fisher, N. I. & Lewis, T. (1983). Estimating the common mean direction of several circular or spherical distributions with differing dispersions. Biometrika 70, 333-341.

2

Watson, G. S. (1983). Statistics on Spheres. University of Arkansas Lecture Notes in the Mathematical Sciences, Volume 6. New York: John Wiley.

sphstat.twosample.iscommonmean(samplecartlist: list, alpha: float = 0.05) dict[source]

Test of whether two or more axisymmetric distributions have a common mean 3

Parameters
  • samplecartlist (list[dict]) – List containing individual samples top be tested in ‘cart’ format

  • alpha (float) – Type-I error level

Returns

Dictionary containing: - Gr: Test statistic [float] - cval: Critical value to test against [float] - testresult: Test result [bool]

3

Watson, G. S. (1983a). Statistics on Spheres. University of Arkansas Lecture Notes in the Mathematical Sciences, Volume 6. New York: John Wiley.

sphstat.twosample.iscommonmedian(samplecartlist: list, similarflag: bool = True, alpha: float = 0.05) dict[source]

Test for a common median direction of two or more distributions 4

Parameters
  • samplecartlist (list[dict]) – List containing individual samples top be tested in ‘cart’ format

  • similarflag (bool) – Flag indicating similar distributions for all samples

  • alpha (float) – Type-I error level

Returns

Dictionary containing… - Z2: Test statistic [float] - cval: Critical value to test against [float] - result: Test result [bool]

4

Fisher, N. I. (1985). Spherical medians. J.R. Statist. Soc. B47, 342-348.

sphstat.twosample.isfishercommonkappa(samplecartlist: list) dict[source]

Test of whether two or more Fisher distributions (with unknown means) have a common concentration parameter at 0.05 level 5, 6

Parameters

samplecartlist (list[dict]) – List containing individual samples top be tested in ‘cart’ format

Returns

Dictionary containing test results… - Z: Test statistics [float] - cval: Critical value [float] - df: Degrees of freedom [int, tuple(int, int)] - testresult: Test result [bool]

Return type

dict

5

Watson, G. S. & Irving, E. (1957). Statistical methods in rock magnetism. Mon. Not. R. astr. Soc. geophys. Suppl. 7, 289-300. (66, 136, 224)

6

Watson, G. S. & Williams, E. J. (1956). On the construction of significance tests on the circle and the sphere. Biometrika 43, 344-352. (14, 133, 211, 224)

sphstat.twosample.isfishercommonmean(samplecartlist: list, alpha: float = 0.05) dict[source]

Test of whether two or more Fisher distributions have a common mean direction 7, 8, 9

Parameters
  • samplecartlist (list[dict]) – List containing individual samples top be tested in ‘cart’ format

  • alpha (float) – Type-I error level

Returns

Dictionary with the fields… - gr: Test statistic [float] - cval: Critical value to test against [float] - testresult: Test result [bool]

Return type

dict

7

Watson, G. S. (1956). Analysis of dispersion on a sphere. Mon. Not. R. Astr. Soc. Geophys. Suppl. 7, 153-159.

8

Watson, G. S. & Williams, E. J. (1956). On the construction of significance tests on the circle and the sphere. Biometrika 43, 344-352.

9

Watson, G. S. (1983). Large sample theory of the Langevin distributions. Journal of Statistical Planning and Inference 8, 245-256.

sphstat.twosample.linearinterp(z00: float, z01: float, alpha: float) float[source]

Linear interpolation between 4 values

Parameters
  • z00 (float) – Value 1

  • z01 (float) – Value 2

  • alpha (float) – Interpolation coefficient (0<=alpha<=1)

Returns

Interpolated value

Return type

float

sphstat.twosample.pooledmean(samplecartlist: list, alpha: float = 0.05) tuple[source]

Estimation of the common mean direction of two or more rotationally symmetric distributions

Parameters
  • samplecartlist (list[dict]) – List containing individual samples top be tested in ‘cart’ format

  • alpha (float) – (1-alpha)% confidence cone is calculated

Returns

  • mdirpooled: Estimated pooled mean direction in radians [np.array]

  • sigmaw: Spherical standard error [float]

  • qw: Semi-vertical angle in radians [float]

sphstat.twosample.pooledmedian(samplecartlist: list, similarflag: bool = False) tuple[source]

Estimation of the common median direction of two or more unimodal distributions

Parameters
  • samplecartlist (list[dict]) – List containing individual samples top be tested in ‘cart’ format

  • similarflag (bool) – Flag indicating similar distributions for all samples

Returns

  • pooledmedi: Pooled median in polar coordinates [th, ph]

  • V: Matrix to be used for calculating the confidence cone [np.array]

Return type

tuple