scb.m 482 B

123456789101112131415161718
  1. function z=scb(x,y,varargin)
  2. % Simultaneous Confidence Bands
  3. %
  4. % Example:
  5. % load ethanol;
  6. % z = scb(E,NOx,'h',0.5);
  7. %
  8. % result (z) is a matrix with four columns: evaluation points,
  9. % fitted values, lower confidence limit, upper confidence limit.
  10. % Most locfit arguments should work.
  11. fit = locfit(x,y,'ev','grid','mg',20,varargin{:});
  12. kap = kappa0(x,y,varargin{:});
  13. cb = predict(fit,'fitp','band','g','kappa',kap);
  14. z = [fit.fit_points.evaluation_points' cb{1} cb{3}];
  15. return;