- The matrix used to fit a linear model by will become rank deficient. When we try to fit a linear model with the above mentioned fields, MATLAB will throw a warning that the Regression design matrix is rank deficient.
- Also, the above mentioned fields do not add any value to the model fitting. If some property is same at all data samples, its value has no importance in deciding the output of the model for any sample. It is a constant property.
Scatterplot and Correlation of table variables
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MBUNYA NERVILLE ANYANG
le 3 Juin 2023
Commenté : MBUNYA NERVILLE ANYANG
le 16 Juin 2023
Hello there
Q = readtable("DA.xlsx")
x=[Q.Tam,Q.Az,Q.Clp,Q.Dp,Q.DH,Q.DN,Q.EB, Q.Pw ,Q.Sd,Q.Prs,Q.WD,Q.WV,Q.AD, Q.ZT, Q.La, Q.Lo, Q.Al];
y=[Q.GH];
mdl=fitlm(x,y)
corrplot(Q)
Please why does the pvalue for X9, X13, X15, X16 return NaN and not X17 even though X17 have the same values all through.?
Also how do I get how do I get scatter plot and how can I fix the correlation of Input variables with output GH?
0 commentaires
Réponse acceptée
Pratyush
le 16 Juin 2023
Hi Mbunya.
It is my understanding that you are trying to fit a linear model to the data stored in x with y as the ground truth. However, you are getting NaN as the value of some weights after fittting a linear model. I have analysed your data and I feel the problem seems to be occuring because of the following reason.
Some columns in your data - Sd, AD, La, Lo and Al have the same value at all data samples. There are two problems that will occur because of this while fitting a linear model.
I retrained the model using your data after removing the above mentioned constant properties as shown below.
x=[Q.Tam,Q.Az,Q.Clp,Q.Dp,Q.DH,Q.DN,Q.EB, Q.Pw ,Q.Prs,Q.WD,Q.WV, Q.ZT];
y=[Q.GH];
mdl=fitlm(x,y)
This time no NaN vaues were observed for any weights or the intercepts in the linear model as shown in the image below. Hope this resolves your problem.
Here are some additional resources to help you with linear regression.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Regression dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!