[R] gamm(): degrees of freedom of the fit

Thomas Lumley tlumley at u.washington.edu
Wed Nov 1 22:26:16 CET 2006

On Wed, 1 Nov 2006, Fabian Scheipl wrote:
> Calculating the smoother/projection matrix S: y -> \hat y and then its 
> trace by sum(eigen(S))$values is what I've been doing so far- but I was 
> hoping there might be a more efficient way than doing the spectral 
> decomposition of an NxN-matrix.

Well, there are more efficient ways to compute the trace of a matrix than 
spectral decomposition. The trace is just the sum of the diagonal 
elements: sum(diag(S))


More information about the R-help mailing list