Home > chronux > locfit > m > kappa0.m

kappa0

PURPOSE ^

Compute the constants for `tube-formula' based simultaneous

SYNOPSIS ^

function kap=kappa0(x,y,varargin)

DESCRIPTION ^

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

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

Generated on Fri 28-Sep-2012 12:34:30 by m2html © 2005