# Does the stepwisefit function in MATLAB handle correlation between the factors?

I have been told to run a factor analysis using the stepwisefit function in MATLAB.

Basically, this function helps you fit a model composed of $T$ factors $F=(f_1, ... , f_T)$ each of which have $N$ values with a target vector $y$ with the same length.

I know for a fact that my factors are correlated, and I was wondering if this function was assuming that the factors are uncorrelated or not...

Should I still use this function or, if it's not the case, which function/method should I choose to perform my analysis?

-
Strange. I don't see any reference to factor analysis under the link. It reads that stepwisefit is stepwise regression analysis – ttnphns Jul 14 '12 at 14:30
Maybe my wording is wrong, I understand factor analysis as a multiple regression over different factors. – SRKX Jul 14 '12 at 14:31
I can't know what you might intend. You can see definition of "factor analysis" by pointing on the tag (or read in Wikipedia). Does its meaning fit your case? – ttnphns Jul 14 '12 at 14:35
Yes, it absolutely does. Basically, I have a lot of underlying factors and I would like to know which of them are really meaningful. I would then like to find the right weight to the remaining factors to find my optimal fit. – SRKX Jul 14 '12 at 14:41
@SRKX, why don't you simply drop the correlated factors from further analysis? It is easy to do. Moreover, stepwisefit will do this for you. – Paul Jul 14 '12 at 15:54

## 1 Answer

You should use the method "Elastic Net", instead of the Stepwise method.

You can put the highly correlated predictors in your multiple linear regression, however, you won't get accurate results from your stepwise analysis unless you regularize your regression.

The regularized linear regression method is "lasso" in Matlab. When you are using that, you should set the alpha to something between 0 to 1, in order to use the Elastic Net method, instead of the default Lasso method. That is because you have predictors which are correlated, and you would like your regression model to consider this fact.

-