kappa0.m 1005 B

123456789101112131415161718192021222324252627282930313233
  1. function kap=kappa0(x,y,varargin)
  2. % Compute the constants for `tube-formula' based simultaneous
  3. % confidence bands.
  4. %
  5. % Works for regression models only. Density estimation problems
  6. % should be converted to counts, and use poisson regression
  7. % 'family','poisson'.
  8. %
  9. % Essentially, this is a front-end to locfit, and so all optional
  10. % arguments to locfit (eg, smoothing parameters) can be provided.
  11. %
  12. % To compute (or plot) the confidence bands, provide the output
  13. % of the kappa0() function as the 'kappa' argument to a
  14. % predict() or lfband() call.
  15. %
  16. %
  17. % Example:
  18. %
  19. % load ethanol;
  20. % fit = locfit(E,NOx,'alpha',0.5)
  21. % kap = kappa0(E,NOx,'alpha',0.5) % give same arguments!
  22. % lfplot(fit)
  23. % lfband(fit,'kappa',kap) % plot the simultaneous bands
  24. % z = predict(fit,[0.6 0.7 0.8]','kappa',kap,'band','g')
  25. % z{3} % evaluate the bands.
  26. fit = locfit(x,y,'module','kappa','ev','grid','mg',20,varargin{:});
  27. z = fit.fit_points.kappa;
  28. d = size(fit.data.x,2);
  29. kap = z(1:(d+1));
  30. return;