Home > chronux_1_50 > locfit > kappa0.m

kappa0

PURPOSE ^

Compute the constants for `tube-formula' based simultaneous confidence bands.

SYNOPSIS ^

function kap=kappa0(x,y,varargin)

DESCRIPTION ^

 Compute the constants for `tube-formula' based simultaneous confidence bands.
 
 Usage: kap=kappa0(x,y,varargin)


 Works for regression models only. Density estimation problems
 should be converted to counts, and use poisson regression
 'family','poisson'.

 Essentially, this is a front-end to locfit, and so all optional
 arguments to locfit (eg, smoothing parameters) can be provided.

 To compute (or plot) the confidence bands, provide the output
 of the kappa0() function as the 'kappa' argument to a
 predict() or lfband() call.


 Example:

 load ethanol;
 fit = locfit(E,NOx,'alpha',0.5)
 kap = kappa0(E,NOx,'alpha',0.5)  % give same arguments!
 lfplot(fit)
 lfband(fit,'kappa',kap)     % plot the simultaneous bands
 z = predict(fit,[0.6 0.7 0.8]','kappa',kap,'band','g')
 z{3}                        % evaluate the bands.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function kap=kappa0(x,y,varargin)
0002 % Compute the constants for `tube-formula' based simultaneous confidence bands.
0003 %
0004 % Usage: kap=kappa0(x,y,varargin)
0005 %
0006 %
0007 % Works for regression models only. Density estimation problems
0008 % should be converted to counts, and use poisson regression
0009 % 'family','poisson'.
0010 %
0011 % Essentially, this is a front-end to locfit, and so all optional
0012 % arguments to locfit (eg, smoothing parameters) can be provided.
0013 %
0014 % To compute (or plot) the confidence bands, provide the output
0015 % of the kappa0() function as the 'kappa' argument to a
0016 % predict() or lfband() call.
0017 %
0018 %
0019 % Example:
0020 %
0021 % load ethanol;
0022 % fit = locfit(E,NOx,'alpha',0.5)
0023 % kap = kappa0(E,NOx,'alpha',0.5)  % give same arguments!
0024 % lfplot(fit)
0025 % lfband(fit,'kappa',kap)     % plot the simultaneous bands
0026 % z = predict(fit,[0.6 0.7 0.8]','kappa',kap,'band','g')
0027 % z{3}                        % evaluate the bands.
0028 
0029 fit = locfit(x,y,'what','kappa','ev','grid','mg',20,varargin{:});
0030 z = fit{4}{6};
0031 d = size(fit{1}{1},2);
0032 kap = z(1:(d+1));
0033 
0034 return;

Generated on Mon 09-Oct-2006 00:54:52 by m2html © 2003