Azzera filtri
Azzera filtri

Effects of linear model estimates

2 visualizzazioni (ultimi 30 giorni)
ga97cad
ga97cad il 6 Gen 2022
Risposto: Kartik Saxena il 15 Gen 2024
Hey everyone!
I have a problem with the interpretation of a linear regression model I generated with the function fitlm. The model has three input variables, stored in the columns of X_m and one target variable which are stored in Y_m.
The model works perfectly fine, however I am trying to find out what the standardizied effect of each of the terms of the linear model is on my target variable. After reading the documentation of fitlm function the p-value seems to only tell me the probaliliy that the certain estimate is not equal to zero.
To concretize what I am looking for: The first pareto chart of this link.
I have found a similiar question on this topic here in the mathlab cummunity (-> comm_question), but I was not able to solve my problem, since the factors in that perticular quistion have 2 factorsteps each, and my factors have 7 steps in the first column, 16 steps in for the second and four steps in the third column of X_m.
I have attached a file with the matching .csv file to this post
clear
clear all
A=readmatrix('data.csv')
X_m=A(:,1:3);
Y_m=A(:,4);
mdl=fitlm(X_m, Y_m,'poly222','RobustOpts','on');
Any help or hints would be much appreciatet! Thanks in advance
Lukas

Risposte (1)

Kartik Saxena
Kartik Saxena il 15 Gen 2024
Hi,
The 'fitlm' function in MATLAB does not directly provide standardized coefficients, but you can calculate them manually. Here's how you can do it:
  1. Standardize your input variables (X_m) and target variable (Y_m) by subtracting the mean and dividing by the standard deviation.
  2. Fit the linear model using the standardized variables.
  3. The coefficients from this model will be the standardized coefficients.
To visualize the standardized effects similar to a Pareto chart, you can create a bar chart with the absolute values of the standardized coefficients.
For more information on interpreting linear models in MATLAB, you can refer to the following MathWorks documentation:
I hope this resolves your issue.

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by