From: Gabriel on
Hello everyone,
I've the following problem with using spline toolbox in matlab:

I want to use matlab's csaps smoothing spline function to fit noisy brain data.
To optimize the fit (and avoid overfitting) a further smoothness constraint input parameter p is neccessary. Furthermore, I want to estimate this smoothness parameter in dependence of AIC criterion of the current fit. For this, the degrees of freedom of the used smoothing spline is needed, but I don't know how to access this value in matlab. I read that it is related to the trace of the smoothing matrix (also called hat matrix) of the spline fit but I could not find it in the csaps or another smoothing spline function. So how can I calculate effective degrees of freedom of current smoothing spline based on ppform or B-spline form???

thanx
Gabriel
From: Matt J on
"Gabriel " <kurtroswi(a)web.de> wrote in message <hkcedt$ogj$1(a)fred.mathworks.com>...
> Hello everyone,
> I've the following problem with using spline toolbox in matlab:
>
> I want to use matlab's csaps smoothing spline function to fit noisy brain data.
> To optimize the fit (and avoid overfitting) a further smoothness constraint input parameter p is neccessary. Furthermore, I want to estimate this smoothness parameter in dependence of AIC criterion of the current fit. For this, the degrees of freedom of the used smoothing spline is needed, but I don't know how to access this value in matlab. I read that it is related to the trace of the smoothing matrix (also called hat matrix) of the spline fit but I could not find it in the csaps or another smoothing spline function. So how can I calculate effective degrees of freedom of current smoothing spline based on ppform or B-spline form???
===========================

I don't know about doing this with MATLAB's native tools, but if you're willing to fit using regularly spaced splines, this tool

http://www.mathworks.com/matlabcentral/fileexchange/26292-regular-control-point-interpolation-matrix-with-boundary-conditions

will let you choose the number of degrees of freedom yourself and gives you direct access to the "smoothing matrix" (if I understand the term correctly). Example applications to B-spline fitting are given as well.