How to plot partial correlation?
7 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Jeff Miller
2018 年 8 月 8 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Descriptive Statistics and Visualization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!