Skip to content

Instantly share code, notes, and snippets.

@jdegenstein
jdegenstein / 95conf.py
Last active January 3, 2025 15:47 — forked from danieljfarrell/95conf.py
Python code implementing some of MATLAB's nlparci functionality (Nonlinear regression parameter confidence intervals)
def non_linear_parameters_95_percent_confidence_interval(fvec, jac):
"""Returns the 95% confidence interval on parameters from
non-linear fit results."""
# residual sum of squares
rss = np.sum(fvec**2)
# number of data points and parameters
n, p = jac.shape
# the statistical degrees of freedom
nmp = n - p
# mean residual error