how do one weight lsqcurvefit with standard error from dependent data?
조회 수: 4 (최근 30일)
이전 댓글 표시
I ran into this post about weighted lsqcurvefit:
https://www.mathworks.com/matlabcentral/answers/48802-nonlinear-fit-with-constraints-in-r2012b
Shouldn't the weight from:
Weights = 1./(N.*SE.^2);
nonlinmodelW = @(B,t) Weights .* nonlinearmodel(B,t);
x = lsqcurvefit(nonlinmodelW,x0,xdata,ydata,lb,ub);
Be:
Weights = 1./(N.*SE);
nonlinmodelW = @(B,t) Weights .* nonlinearmodel(B,t);
x = lsqcurvefit(nonlinmodelW,x0,xdata,ydata.*Weights,lb,ub);
I noticed it did mentioned earlier in the post the weight ydata as well. The reason I don't square SE is because the function value return:
sum([(nonlinmodelW(B,xdata) - ydata)/(N*SE)].^2);
so if you weight with Weights = 1./SE it will returns the above equation, rather than:
the quadrature of the weight:
sum([(nonlinmodelW(B,xdata) - ydata)/((N*SE).^2)].^2);
Also, on the standard error of the fitted parameters, I found other source that it can be found by:
v=residuals from nonlinear least squares;
J=jacobian;
Q_xx = resnorm*inv(J'*J)/length(ydata);
% Precision measures ,i.e. the standard deviation of each parameter
Precision_of_solved_parameters = sqrt(diag(Q_xx));
Can anyone confirm this standard deviation? The code Star Strider provided will give error.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Least Squares에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!