Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions src/curve_fit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -256,17 +256,10 @@ end
function StatsAPI.vcov(fit::LsqFitResult)
# computes covariance matrix of fit parameters
J = fit.jacobian

if isempty(fit.wt)
r = fit.resid

# compute the covariance matrix from the QR decomposition
Q, R = qr(J)
Rinv = inv(R)
covar = Rinv * Rinv' * mse(fit)
else
covar = inv(J' * J)
end
# compute from the QR decomposition of the Jacobian
Q, R = qr(J)
Rinv = inv(R)
covar = Rinv * Rinv' * mse(fit)

return covar
end
Expand Down