How to plot partial correlation?

19 Ansichten (letzte 30 Tage)
Robert Eisenbecker
Robert Eisenbecker am 7 Aug. 2018
Beantwortet: Jeff Miller am 8 Aug. 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

Akzeptierte Antwort

Jeff Miller
Jeff Miller am 8 Aug. 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.

Weitere Antworten (0)

Kategorien

Mehr zu Descriptive Statistics and Visualization finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by