fitdata1pv.m 673 B

123456789101112131415
  1. function [px,ci,resnorm,simres]=fitdata1pv(stimrep)
  2. % input stimrep : stimulus and response
  3. % output px : parameters of the model kmodel(p,stimrep)
  4. % output ci : confidence interval of px
  5. %
  6. % fit wrapper for the two-stage model published in
  7. % Petzschner FH, Glasauer S. Iterative bayesian estimation as an explanation for range and regression effects: a study on human path integration. J Neurosci. 2011 Nov 23;31(47):17220-9.
  8. %
  9. % S.Glasauer 2011/2021
  10. p0=1;lb=0;
  11. [px,resnorm,residual,~,~,~,jacobian]=lsqnonlin(@(p)kmodel1pv(p,stimrep),p0,lb);
  12. ci=nlparci(px,residual,'jacobian',jacobian);
  13. [~,~,~,simres]=kmodel1pv(px,stimrep);
  14. % simres=stimrep(:,2)-kmodel(px,stimrep);
  15. end