Added attributes to BootstrapResult

parent 55eddab2
v1.3.2, ??
- Correct use of kernel in non-parametric regression
- Added attributes to BootstrapResult
v1.3.1, 8/8/2014
- Removed necessity of calling fit
- Added warning to main text
......
......@@ -25,20 +25,35 @@ Main Boostrap Functions
.. py:attribute:: y_fit
Estimator object, fitted on the original data
:type: fun(xs) -> ys
.. py:attribute:: y_est
Y estimated on xdata
:type: ndarray
.. py:attribute:: eval_points
.. py:attribute:: y_est: ndarray
Points on which the confidence interval are evaluated
.. py:attribute:: y_eval
Y estimated on eval_points
.. py:attribute:: CIs_val
Tuple containing the list of percentiles extracted (i.e. this is a copy of
the ``CIs`` argument of the bootstrap function.
.. py:attribute:: CIs
List of confidence intervals. The first element is for the estimated values
on ``eval_points``. The others are for the extra attributes specified in
``extra_attrs``. Each array is a 3-dimensional array (Q,2,N), where
Q is the number of confidence interval and N is the number of data
points. Values (x,0,y) give the lower bounds and (x,1,y) the upper
bounds of the confidence intervals.
Q is the number of confidence interval (e.g. the length of ``CIs_val``)
and N is the number of data points. Values (x,0,y) give the lower bounds
and (x,1,y) the upper bounds of the confidence intervals.
.. py:attribute:: shuffled_xs
......
......@@ -98,7 +98,6 @@ def bootstrap_residuals(fct, xdata, ydata, repeats=3000, residuals=None,
if correct_bias:
kde = nonparam_regression.NonParamRegression(xdata, res)
kde.method.q = 1
kde.fit()
bias = kde(xdata)
shuffled_res += bias
......@@ -167,7 +166,7 @@ def getCIs(CI, *arrays):
return CIs
BootstrapResult = namedtuple('BootstrapResult', '''y_fit y_est y_eval CIs
BootstrapResult = namedtuple('BootstrapResult', '''y_fit y_est eval_points y_eval CIs_val CIs
shuffled_xs shuffled_ys full_results''')
......@@ -325,7 +324,7 @@ def bootstrap(fit, xdata, ydata, CI, shuffle_method=bootstrap_residuals,
result_array = result_array.copy() # copy in local memory
extra_arrays = [ea.copy for ea in extra_arrays]
return BootstrapResult(y_fit, y_fit(xdata), y_eval, CIs,
return BootstrapResult(y_fit, y_fit(xdata), eval_points, y_eval, tuple(CI), CIs,
shuffled_x, shuffled_y, result_array)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment