# Ridge Regression

I have pretty much the same question as in this post:

I have a situation where I want to regress 50 daily observations of interest rate swap yields on four factors. Actually it's the Nelson Siegel Svensson model

see the section

modelling the yield curve

At the moment I have an optimisation process that finds the optimal set of parameters for the factors and the beta (weighting) coefficients.

As can be seen if the factors tau1 and tau2 are the same the model matrix will be singular or if they are close it will be ill conditioned.

The optimisation process works well for test data sets where the parameters used to produce the yeld curves are chosen to ensure there is no ill-conditioning.

However when I apply it to real data best fit parameters seem to jump around alot from day to day even when the curve is hardly moving. I think this may well be because the optimal fits to the real data are based on parameter sets that produce ill-conditioned matrices meaning the mapping of the Beta weights is incorrect.

I could just incorporate a penalty into the optimisation process that prevents badly conditioned matrices from being considered. However, there is nothing in principal (that I can think of) that means that the optimal mapping of these 50 observations onto the factors will result in a matrix that is not have at lest some ill conditioning.

So I really need a way to handle these ill conditioned cases and to be able to compare the results from matrices where the not ill conditioned.

I have reserched the topic and the main methods to deal with such situations is to use Ridge Regression, Principal Components Regressiona and Partial Least Squares.

With Ridge Regression generally being seen as the best. (Do you agree).

Even then there seems to be different kinds of Ridge Regression, unbiased ridge regression, mixture methods.

eg

http://www.utgjiu.ro/math/sma/v04/p08.pdf

I don't want to remove any of the 4 factors ao anything like that indeed its imperative that all 4 factors remain. I just want to get the best fit to those factors.

I just wondered what the best method would be for my problem? Ideally I also need the standard errors for the cofficients. Can anyone receommend code ideally in MATLAB or R that can implement the best method? Is cross validation the best way to compare the competing models? It is OK To compare ill conditioned and non ill conditioned models in this way?