Skip to contents

Discretizes circular-linear observations into angular sectors and linear bins and returns binned mass flows for phase loom displays.

Usage

phase_loom_data(
  theta,
  x,
  n_sectors = 48,
  n_x_bins = 24,
  min_mass = 0.002,
  max_flows = 180,
  mass_type = c("joint", "conditional")
)

Arguments

theta

Angles in radians.

x

Real-valued response.

n_sectors

Number of angular sectors.

n_x_bins

Number of linear bins.

min_mass

Minimum mass to retain.

max_flows

Maximum number of flows to retain. Use NULL to keep all.

mass_type

Either "joint" for joint masses or "conditional" for masses normalized within each angular sector.

Value

A data frame with sector identifiers, endpoints and mass values.

See also

Examples

dat <- simulate_cylindrical(n = 80, seed = 1)
phase_loom_data(dat$theta, dat$x, n_sectors = 12, n_x_bins = 8)
#>    sector x_bin count joint_mass conditional_mass   mass theta_center
#> 1       8     1     5     0.0625       0.71428571 0.0625    3.9269908
#> 2       5     5     5     0.0625       0.41666667 0.0625    2.3561945
#> 3      10     6     5     0.0625       0.55555556 0.0625    4.9741884
#> 4       5     4     4     0.0500       0.33333333 0.0500    2.3561945
#> 5       6     4     4     0.0500       0.44444444 0.0500    2.8797933
#> 6       2     5     4     0.0500       1.00000000 0.0500    0.7853982
#> 7       4     6     4     0.0500       0.66666667 0.0500    1.8325957
#> 8       6     3     3     0.0375       0.33333333 0.0375    2.8797933
#> 9       9     3     3     0.0375       0.50000000 0.0375    4.4505896
#> 10      3     5     3     0.0375       0.50000000 0.0375    1.3089969
#> 11     10     5     3     0.0375       0.33333333 0.0375    4.9741884
#> 12     11     5     3     0.0375       0.33333333 0.0375    5.4977871
#> 13     11     6     3     0.0375       0.33333333 0.0375    5.4977871
#> 14     11     7     3     0.0375       0.33333333 0.0375    5.4977871
#> 15      7     2     2     0.0250       0.50000000 0.0250    3.4033920
#> 16      8     2     2     0.0250       0.28571429 0.0250    3.9269908
#> 17      9     4     2     0.0250       0.33333333 0.0250    4.4505896
#> 18      6     5     2     0.0250       0.22222222 0.0250    2.8797933
#> 19      3     6     2     0.0250       0.33333333 0.0250    1.3089969
#> 20      5     6     2     0.0250       0.16666667 0.0250    2.3561945
#> 21      1     7     2     0.0250       0.50000000 0.0250    0.2617994
#> 22     12     7     2     0.0250       0.50000000 0.0250    6.0213859
#> 23      7     1     1     0.0125       0.25000000 0.0125    3.4033920
#> 24      9     2     1     0.0125       0.16666667 0.0125    4.4505896
#> 25      7     3     1     0.0125       0.25000000 0.0125    3.4033920
#> 26     10     4     1     0.0125       0.11111111 0.0125    4.9741884
#> 27      1     5     1     0.0125       0.25000000 0.0125    0.2617994
#> 28      4     5     1     0.0125       0.16666667 0.0125    1.8325957
#> 29      1     6     1     0.0125       0.25000000 0.0125    0.2617994
#> 30     12     6     1     0.0125       0.25000000 0.0125    6.0213859
#> 31      3     7     1     0.0125       0.16666667 0.0125    1.3089969
#> 32      5     7     1     0.0125       0.08333333 0.0125    2.3561945
#> 33      4     8     1     0.0125       0.16666667 0.0125    1.8325957
#> 34     12     8     1     0.0125       0.25000000 0.0125    6.0213859
#>            x0         y0         x1 y1    x_mid
#> 1  -0.7071068 -0.7071068 -0.8500000  0 2.270898
#> 2  -0.7071068  0.7071068  0.1214286  0 5.279346
#> 3   0.2588190 -0.9659258  0.3642857  0 6.031458
#> 4  -0.7071068  0.7071068 -0.1214286  0 4.527234
#> 5  -0.9659258  0.2588190 -0.1214286  0 4.527234
#> 6   0.7071068  0.7071068  0.1214286  0 5.279346
#> 7  -0.2588190  0.9659258  0.3642857  0 6.031458
#> 8  -0.9659258  0.2588190 -0.3642857  0 3.775122
#> 9  -0.2588190 -0.9659258 -0.3642857  0 3.775122
#> 10  0.2588190  0.9659258  0.1214286  0 5.279346
#> 11  0.2588190 -0.9659258  0.1214286  0 5.279346
#> 12  0.7071068 -0.7071068  0.1214286  0 5.279346
#> 13  0.7071068 -0.7071068  0.3642857  0 6.031458
#> 14  0.7071068 -0.7071068  0.6071429  0 6.783570
#> 15 -0.9659258 -0.2588190 -0.6071429  0 3.023010
#> 16 -0.7071068 -0.7071068 -0.6071429  0 3.023010
#> 17 -0.2588190 -0.9659258 -0.1214286  0 4.527234
#> 18 -0.9659258  0.2588190  0.1214286  0 5.279346
#> 19  0.2588190  0.9659258  0.3642857  0 6.031458
#> 20 -0.7071068  0.7071068  0.3642857  0 6.031458
#> 21  0.9659258  0.2588190  0.6071429  0 6.783570
#> 22  0.9659258 -0.2588190  0.6071429  0 6.783570
#> 23 -0.9659258 -0.2588190 -0.8500000  0 2.270898
#> 24 -0.2588190 -0.9659258 -0.6071429  0 3.023010
#> 25 -0.9659258 -0.2588190 -0.3642857  0 3.775122
#> 26  0.2588190 -0.9659258 -0.1214286  0 4.527234
#> 27  0.9659258  0.2588190  0.1214286  0 5.279346
#> 28 -0.2588190  0.9659258  0.1214286  0 5.279346
#> 29  0.9659258  0.2588190  0.3642857  0 6.031458
#> 30  0.9659258 -0.2588190  0.3642857  0 6.031458
#> 31  0.2588190  0.9659258  0.6071429  0 6.783570
#> 32 -0.7071068  0.7071068  0.6071429  0 6.783570
#> 33 -0.2588190  0.9659258  0.8500000  0 7.535682
#> 34  0.9659258 -0.2588190  0.8500000  0 7.535682