Multivariate Statistical analysis, regression? correlation?
1 次查看(过去 30 天)
显示 更早的评论
Hi, my statistics is not my strongest.
What's the best method for analysing for the effects of different variables on the output results on MATLAB?
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!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/277422/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/277423/image.jpeg)
0 个评论
回答(1 个)
Sourabh Kondapaka
2020-3-24
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 :
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Descriptive Statistics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!