Skip to content

Commit 28a56cb

Browse files
Merge pull request #327 from petrelharp/corfix
clarifying note about Z=None
2 parents 6c156b7 + c78b85d commit 28a56cb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

python/tskit/trees.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3712,7 +3712,8 @@ def trait_correlation(self, W, windows=None, mode="site", span_normalise=True):
37123712
W, windows=windows,
37133713
mode=mode, span_normalise=span_normalise)
37143714

3715-
def trait_regression(self, W, Z, windows=None, mode="site", span_normalise=True):
3715+
def trait_regression(self, W, Z=None, windows=None, mode="site",
3716+
span_normalise=True):
37163717
"""
37173718
For each trait w (i.e., each column of W), performs the least-squares
37183719
linear regression :math:`w ~ g + Z`,
@@ -3727,7 +3728,8 @@ def trait_regression(self, W, Z, windows=None, mode="site", span_normalise=True)
37273728
:math:`Z`, and the :math:`k+2`-vector :math:`b` minimises
37283729
:math:`\\sum_i (w_i - b_0 - b_1 g_i - b_2 z_{2,i} - ... b_{k+2} z_{k+2,i})^2`
37293730
then this returns the number :math:`b_1^2`. If :math:`g` lies in the linear span
3730-
of the columns of :math:`Z`, then :math:`b_1` is set to 0.
3731+
of the columns of :math:`Z`, then :math:`b_1` is set to 0. To perform the
3732+
regression without covariates (only the intercept), set `Z = None`.
37313733
37323734
What is computed depends on ``mode``:
37333735
@@ -3752,7 +3754,7 @@ def trait_regression(self, W, Z, windows=None, mode="site", span_normalise=True)
37523754
:param ndarray W: An array of values with one row for each sample and one column
37533755
for each "phenotype".
37543756
:param ndarray Z: An array of values with one row for each sample and one column
3755-
for each "covariate", or None. Columns of `Z` must be linearly independent.
3757+
for each "covariate", or `None`. Columns of `Z` must be linearly independent.
37563758
:param iterable windows: An increasing list of breakpoints between the windows
37573759
to compute the statistic in.
37583760
:param str mode: A string giving the "type" of the statistic to be computed

0 commit comments

Comments
 (0)