How to plot partial correlation?
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Robert Eisenbecker
le 7 Août 2018
Réponse apportée : Jeff Miller
le 8 Août 2018
Hello,
for my analysis I ran a couple of Pearson partial correlations, controlling for variables such as gender and age. Now I want to plot the correlation in a scatterplot. How would I do that? If I use plot(X,Y,'o') then I get only the normal and (not partialled out) correlation, right?
Thank you very much in advance
0 commentaires
Réponse acceptée
Jeff Miller
le 8 Août 2018
The partial correlation of X and Y controlling for some other variables [Z] is the correlation of rX with rY, where rX and rY are the residuals from two separate regression equations predicting X from [Z] and predicting Y from [Z] Wikipedia. If you wanted to represent that partial correlation in a plot, you would have to use fitlm to predict X and Y separately, and then get the residuals from those two fits (see Save residuals) as rX and rY. Then you could use
plot(rX,rY,'o');
I'm not sure this plot will really be what you want, though, since the numbers will not be on the same scale as your original X and Y scores (i.e., they will have means of 0). Of course, a plot is just a display device, so maybe this type of display will be fine for you.
A side comment: It probably isn't a good idea to use partial correlation to control for gender as if it were a normally distributed numerical variable, which it isn't. To display the X/Y relationship controlling for gender, it would be better to make separate scatterplots for males versus females or to make a single scatterplot but use separate symbols for the two genders.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Descriptive Statistics and Visualization 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!