def draw_bs_pairs_linreg(x, y, size=1):
"""
Perform pairs bootstrap for linear regression.
Parameters
----------
x : array_like
x-values of data.
y : array_like
y-values of data.
size : int, default 1
Number of pairs bootstrap replicates to draw.
Returns
-------
slope_reps : ndarray
Pairs bootstrap replicates of the slope.
intercept_reps : ndarray
Pairs bootstrap replicates of the intercept.
Notes
-----
.. Entries where either `x` or `y` has a nan are ignored.
.. It is possible that a pairs bootstrap sample has the
same pair over and over again. In this case, a linear
regression cannot be computed. The pairs bootstrap
replicate in this instance is NaN.
"""
x, y = _convert_two_data(x, y, inf_ok=False, min_len=2)
if np.isclose(x, y).all():
raise RuntimeError('All x and y values are equal, cannot do regression')
return _draw_bs_pairs_linreg(x, y, size=size)
# @numba.jit(nopython=True)
评论列表
文章目录