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