Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Partial Correlation Plot

612 views
Skip to first unread message

aainaa

unread,
Oct 13, 2010, 1:32:04 AM10/13/10
to
Hi and good day.

Currently, im doing project on Partial Correlation Analysis. I am facing difficulties in plotting the graph for Partial Correlation between some variables. Is there anyone who knows about this? Appreciate if you could share your knowledge on how to plot the graph. Thank you.

Tom Lane

unread,
Oct 13, 2010, 10:45:22 AM10/13/10
to

If I understand correctly what you want, you would like a plot of x vs y
adjusted for one or more other variable z. This would be a plot of the
residuals in a regression of x on z, vs the residuals in a regression of y
on z. If that is the case and you have the Statistics Toolbox, you might
want to look at the addedvarplot function. The partialcorr function may also
be helpful.

-- Tom

aainaa

unread,
Oct 13, 2010, 11:33:04 AM10/13/10
to
"Tom Lane" <tl...@mathworks.nospam.com> wrote in message <i94gm2$bpq$1...@fred.mathworks.com>...

Tom,
Thanks for your help.
Specifically, I need to make partial correlations plot between model residuals and the MVs. This is MIMO system with 3 MVs and 3 CVs. From the simulation, I got data for model residuals in 3 columns, that means I have 3 residuals (e1, e2 and e3). Also I have data for MVs in 3 columns (MV1, MV2 and MV3).
How can I make partial correlation plot between these residuals and MVs and come out with 9 plots? For example the 1st plot is correlation between e1 and MV1, the 2nd plot is between e2 and MV1 etc.
Is there any function I can use? I already tried parcorr function. For example,

parcorr(e(:,1))

But I think this is wrong. Appreciate if you can help me. Thanks.

aainaa

Tom Lane

unread,
Oct 14, 2010, 10:50:59 AM10/14/10
to
> Specifically, I need to make partial correlations plot between model
> residuals and the MVs. This is MIMO system with 3 MVs and 3 CVs. From the
> simulation, I got data for model residuals in 3 columns, that means I have
> 3 residuals (e1, e2 and e3). Also I have data for MVs in 3 columns (MV1,
> MV2 and MV3). How can I make partial correlation plot between these
> residuals and MVs and come out with 9 plots? For example the 1st plot is
> correlation between e1 and MV1, the 2nd plot is between e2 and MV1 etc. Is
> there any function I can use? I already tried parcorr function. For
> example,
> parcorr(e(:,1))
>
> But I think this is wrong. Appreciate if you can help me. Thanks.

aainaa, if I understand correctly parcorr deals with partial autocorrelation
of a time series. I have not been interpreting your question as related to
time series. If it is, please clarify.

If it is not, I am still uncertain because I am unfamiliar with the world of
CV, MV, and MIMO.

Here's some code I just posted in what may be a related thread:

Tom Lane

unread,
Oct 14, 2010, 10:55:21 AM10/14/10
to
(Sorry for a typo that sent my previous item prematurely.)

> Specifically, I need to make partial correlations plot between model
> residuals and the MVs. This is MIMO system with 3 MVs and 3 CVs. From the
> simulation, I got data for model residuals in 3 columns, that means I have
> 3 residuals (e1, e2 and e3). Also I have data for MVs in 3 columns (MV1,
> MV2 and MV3). How can I make partial correlation plot between these
> residuals and MVs and come out with 9 plots? For example the 1st plot is
> correlation between e1 and MV1, the 2nd plot is between e2 and MV1 etc. Is
> there any function I can use? I already tried parcorr function. For
> example,
> parcorr(e(:,1))
>
> But I think this is wrong. Appreciate if you can help me. Thanks.

aainaa, if I understand correctly parcorr deals with partial autocorrelation

of a time series. I have not been interpreting your question as related to
time series. If it is, please clarify.

If it is not, I am still uncertain because I am unfamiliar with the world of
CV, MV, and MIMO.

Here's some code I just posted in what may be a related thread:

>> x = randn(20,2)*[1 1;0 1];
>> y = 1 + x*[2;3] + randn(20,1);
>> b = [ones(20,1),x] \ y
b =
0.9060
2.0969
3.1281
>> addedvarplot(x,y,1,2)

I generate a two-column x matrix (call the columns x1 and x2) and a
response. I fit the data and see that the coefficient of x1 is 2.0969 when
it appears in the model with x2. The last command generates a plot that
includes only two variables:

y adjusted for x2
x1 adjusted for x2

The fitted line on that plot is 2.0969. This may be the plot you need.

In your example, you may have more than two x variables and more than one y
variable, but you can loop over the combinations.

-- Tom

aainaa

unread,
Oct 14, 2010, 10:40:07 PM10/14/10
to

Thanks for you reply.
Actually my problem deals with partial autocorrelation of a time series. I need to make partial correlation plots. The plots is between residual and manipulated variable(MV). In Matlab, there is a function parcorr. This function can produce partial autocorrelation plot.

parcorr(Series, nLags, R, nSTDs)

But the problem is I don't know how to make a plot that correlate two variables using this function. In the function above, at the series part, I only can put one series. How to put more than one series? Do you have any idea?

Specifically, below is the link for the journal that I referred to.
http://www.sciencedirect.com/science?_ob=ArticleURL&_udi=B6V4N-4WFPPFJ-1&_user=1196560&_coverDate=09%2F30%2F2009&_rdoc=1&_fmt=high&_orig=search&_origin=search&_sort=d&_docanchor=&view=c&_searchStrId=1498900176&_rerunOrigin=google&_acct=C000048039&_version=1&_urlVersion=0&_userid=1196560&md5=4fafe423946bf22601deacd3b367ff74&searchtype=a

The plots that I mention are in Fig. 3. Case Study 1: gain mismatch &#8211; partial correlations plots.

Other terms are;
CV (controlled variable)
MIMO (multi input multi output).

Thanks.

aainaa

Tom Lane

unread,
Oct 18, 2010, 2:06:39 PM10/18/10
to
> Actually my problem deals with partial autocorrelation of a time series. I
> need to make partial correlation plots. The plots is between residual and
> manipulated variable(MV). In Matlab, there is a function parcorr. This
> function can produce partial autocorrelation plot.

Okay, now that I understand that I can definitely say that I'm not aware of
a MATLAB function for computing it.

As I understand it, the jth partial autocorrelation is the jth coefficient
in an AR(j) model. There are shortcut ways of computing that, but you could
just do it by fitting the model and extracting the desired coefficient. I
suppose you could similarly fit ARX (autoregressive exogenous) models that
include your other variable, and pull the desired coefficients out of those
fits.

-- Tom

aainaa

unread,
Oct 19, 2010, 5:21:04 AM10/19/10
to
> Okay, now that I understand that I can definitely say that I'm not aware of
> a MATLAB function for computing it.
>
> As I understand it, the jth partial autocorrelation is the jth coefficient
> in an AR(j) model. There are shortcut ways of computing that, but you could
> just do it by fitting the model and extracting the desired coefficient. I
> suppose you could similarly fit ARX (autoregressive exogenous) models that
> include your other variable, and pull the desired coefficients out of those
> fits.
>
> -- Tom


Tom,
Thanks a lot for your explanation.


aainaa

0 new messages