how to calculate singular values in collin test to detect multicollinearity
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am a bit confused as to how we find the singular values and therefore condition index number to detect multicollinearity in multiple linear regression analysis. Some mathematicians say the singular values are the square roots of the eigenvalues of the correlation matrix of the predictors of a model. While others says we use covariance matrix instead. Again some math publications said The singular values are the square roots of the eigenvalues of the square matrix X'X of multiple linear regression model. Then I treid using all three methods but when I cross checked with MATLAB results using collintest it does not match with either of my calculations. it does not explain how we go the output. can someone explain it to me?
5 Kommentare
Umar
am 30 Jun. 2024
Hi Nafisa, Glad to help, to answer your question regarding Belsely collinearity diagnostics, we have to understand the concept of comparing the singular values obtained from SVD (Singular Value Decomposition) with those from the Belsley collinearity diagnostics in Matlab, differences may arise due to the nature of the methods. SVD directly computes the singular values of a matrix, while collinearity diagnostics like the collin test in Matlab focus on assessing multicollinearity in regression models rather than directly computing singular values. It's essential to understand the specific purpose and methodology of each approach to interpret the results correctly. If you seek singular values, SVD is the appropriate method, whereas collinearity diagnostics are more suitable for assessing multicollinearity in regression analysis.
Hope this help clarifies to resolve your problem.
Akzeptierte Antwort
Umar
am 30 Jun. 2024
Hi Nafisa,
In order to help you further with your problem, can you share the matlab code which is causing error, I have to review it in order to share my detailed thoughts. Hope that should not be a problem.
Weitere Antworten (4)
Umar
am 30 Jun. 2024
Hi Nafisa,
Due to incorrect calculation of the condition indices formula. The condition index should be the ratio of the largest singular value to the smallest singular value, not to each singular value individually. So, in order to correctly calculate the condition indices, modify the calculation as follows:
condition_indices = singular_values(1) ./ singular_values;
By modifying it will ensure that the largest singular value divided by each singular value individually, which gives us the correct condition indices for the predictors.
Hope this will help resolve your problem.
0 Kommentare
Paul
am 30 Jun. 2024
Bearbeitet: Paul
am 30 Jun. 2024
Hi NAFISA,
Using the example from the the doc collintest
load Data_Canada
Output from collintest
[sValues,condInx] = collintest(Data);
The same output for the sValue and condIndx can be found by (not including various error checks)...
Scale Data so that each column has unit magnitude
sData = Data./vecnorm(Data,2,1);
Take the svd of the scaled data.
[~,S,V] = svd(sData);
S = diag(S);
Compute the indices
idx = max(S)./S;
table(S,idx)
Hopefully that makes sense in the context of what collintest is supposed to do. I have zero knowledge of that function.
7 Kommentare
Umar
am 3 Jul. 2024
Hi Nafisa,
You asked how do I calculate the singular values from collin test and from svd function theoretically.
To answer this question, regarding collinearity test, you can calculate singular values by examining the condition number of a matrix. The condition number is the ratio of the largest to the smallest singular value. Higher condition numbers indicate a higher degree of collinearity. While using the Singular Value Decomposition (SVD) function in Matlab, you can directly compute the singular values of a matrix.
Umar
am 3 Jul. 2024
Hi Nafisa,
Glad to hear back from you. Please see my answers to your comments below.
Comment#1:did not quite understand when you said by examining the condition number of a matrix. It would be better if you can provide a formula or something.
Answer:The condition number of a matrix measures its sensitivity to changes in input, where a high condition number indicates potential numerical instability. In Matlab, you can compute the condition number of a matrix A using the cond() function: cond(A).The condition number of a matrix indicates how sensitive the matrix is to changes in its input values.Here is an example demonstrating how to compute the condition number of a matrix A in Matlab by creating a 2x2 matrix A and then use the cond() function to calculate its condition number. The result is displayed using disp().
>> % Define a matrix A A = [1, 2; 3, 4];
>> % Calculate the condition number of matrix A condition_number = cond(A);
>> disp(['The condition number of matrix A is: ', num2str(condition_number)]);
This information is valuable in assessing the stability and accuracy of numerical computations involving the matrix A.
Comment#2:Also you said that While using the Singular Value Decomposition (SVD) function in Matlab, I can directly compute the singular values of a matrix
Answer: Yes, you can directly compute the singular values of a matrix A using the svd() function: [U, S, V] = svd(A). Ensure that A is a square matrix for SVD computation.
Comment#3: To compute the singular values I need to have a square matrix so I tried finding the eigenvalues of X'X where X isthe design matrix and when I did that I am getting different eigenvalues.
Answer: When finding the eigenvalues of X'X, ensure that X is properly defined and that X'X results in a square matrix. To compute eigenvalues, you can use the eig() function: eigenvalues = eig(X' * X). Ensure that X is correctly defined to match the expected behavior.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Linear Algebra finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!