MATLAB Answers

Multivariate Statistical analysis, regression? correlation?

45 views (last 30 days)
In-chan Kim
In-chan Kim on 12 Mar 2020
Answered: Sourabh Kondapaka on 24 Mar 2020
Hi, my statistics is not my strongest.
What's the best method for analysing for the effects of different variables on the output results?
I want to see how the variables in the graphs such as total duration of trips, total distance etc affect the results OF and benefit comp. See if some of them effect the results more than others.
Thanks!

Answers (1)

Sourabh Kondapaka
Sourabh Kondapaka on 24 Mar 2020
The best approach would be to use Correlation when analyzing effect of a specific variable on another variable.
The function "Corrcoef()" can be used to get the correlation between all columns or for a specific column.
If your data is in the form of a matrix, say matrix A:
R = corrcoef(A)
% R is a matrix of correlation coefficients for A, where the columns of A
% represent random variables and the rows represent observations
R = corrcoef(A,B)
% R is matrix of coefficients between two random variables A and B.
After obtaining the correlation matrix. You can check for the specific column which is the result variable.
In your case it is “OF”. Check the column “OF” against each of the rows.
If your data is in the form of a table instead of a matrix then you can use the “corr()“ function. Here “X” is the table.
R = corr(X{:,:});
% Or you could use :
R = corr(X.Variables);
For reference on corrcoef() function :
For reference on how correlation coefficients are calculated:
In case you want to visualize / plot the correlation matrix, you can use “corrplot()” function.
For reference on corrplot() function :

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by