diffsvg.tl.shape_metric#
- diffsvg.tl.shape_metric(n_bsplines=10, degree=3, n_grid=2001, support=(0.0, 1.0))#
Quadratic form
Qthat measures how far two condition curves are from parallel.For interaction coefficients
b(beta_1of the per-gene model),sqrt(b @ Q @ b)is the shape difference of the difference curved(x) = f1(x) - f0(x)on[0, 1], in slope-equivalent units:sqrt(12) * RMS(d - mean(d)). When the gap between the curves changes linearly,d(x) = a + s * x, this is exactly|s|, the slope difference; for any other shape it is the linear change with the same RMS departure from parallel. Level differences contribute nothing (Q @ ones = 0). Centring the basis does not changeQ, so it depends only on the knots, i.e. onn_bsplinesanddegreeofdiffsvg.pp.bin_obs.- Parameters:
- n_bsplines default:
10 As in
diffsvg.pp.bin_obs.- degree default:
3 As in
diffsvg.pp.bin_obs.- n_grid default:
2001 Grid points for the numerical integral.
- support default:
(0.0, 1.0) The part of
[0, 1]the shape is measured over (seefit_model). Slopes stay in units of the full anchor range.
- n_bsplines default:
- Returns:
numpy.ndarray
Q, shape(n_bsplines, n_bsplines), positive semi-definite with rankn_bsplines - 1.