How to plot partial correlation?
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Robert Eisenbecker
il 7 Ago 2018
Risposto: Jeff Miller
il 8 Ago 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 Commenti
Risposta accettata
Jeff Miller
il 8 Ago 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Descriptive Statistics and Visualization in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!