Home > chronux > locfit > Book > fig6_1.m

# fig6_1

## PURPOSE Local Regression and Likelihood, Figure 6.1.

## SYNOPSIS This is a script file.

## DESCRIPTION ``` Local Regression and Likelihood, Figure 6.1.

Derivative (local slope) estimation, for the Old Faithful Geyser Data.
The 'deriv' argument specifies derivative estimation,
'deriv',1        First-order derivative.
'deriv',[1 1]    Second-order derivative.
'deriv',2        For bivariate fits, partial deriv. wrt second variable.
'deriv',[1 2]    Mixed second-order derivative.

Density estimation is done on the log-scale. That is, the estimate
is of g(x) = log(f(x)), where f(x) is the density.

The relation between derivatives is therefore
f'(x) = f(x)g'(x) = g'(x)exp(g(x)).
To estimate f'(x), we must estimate g(x) and g'(x) (fit1 and fit2 below),
evaluate on a grid of points (p1 and p2), and apply the back-transformation.

Disclaimer: I don't consider derivative estimation from noisy data
to be a well-defined problem. Use at your own risk.

NEED: m argument passed to lfmarg().```

## CROSS-REFERENCE INFORMATION This function calls:
This function is called by:

## SOURCE CODE ```0001 % Local Regression and Likelihood, Figure 6.1.
0002 %
0003 % Derivative (local slope) estimation, for the Old Faithful Geyser Data.
0004 % The 'deriv' argument specifies derivative estimation,
0005 %   'deriv',1        First-order derivative.
0006 %   'deriv',[1 1]    Second-order derivative.
0007 %   'deriv',2        For bivariate fits, partial deriv. wrt second variable.
0008 %   'deriv',[1 2]    Mixed second-order derivative.
0009 %
0010 % Density estimation is done on the log-scale. That is, the estimate
0011 % is of g(x) = log(f(x)), where f(x) is the density.
0012 %
0013 % The relation between derivatives is therefore
0014 %     f'(x) = f(x)g'(x) = g'(x)exp(g(x)).
0015 % To estimate f'(x), we must estimate g(x) and g'(x) (fit1 and fit2 below),
0016 % evaluate on a grid of points (p1 and p2), and apply the back-transformation.
0017 %
0018 % Disclaimer: I don't consider derivative estimation from noisy data
0019 % to be a well-defined problem. Use at your own risk.
0020 %
0022 %
0023 % NEED: m argument passed to lfmarg().
0024