Compute partial correlation coefficients for
each pair of variables in the `x`

and `y`

input
matrices, while controlling for the effects of the remaining variables
in `x`

.

Load the sample data.

The data contains measurements from cars manufactured in 1970,
1976, and 1982. It includes `MPG`

and `Acceleration`

as
performance measures, and `Displacement`

, `Horsepower`

,
and `Weight`

as design variables. `Acceleration`

is
the time required to accelerate from 0 to 60 miles per hour, so a
high value for `Acceleration`

corresponds to a vehicle
with low acceleration.

Define the input matrices. The `y`

matrix
includes the performance measures, and the `x`

matrix
includes the design variables.

Compute the correlation coefficients. Include only rows
with no missing values in the computation.

rho =
-0.0537 -0.1520 -0.4856
-0.3994 -0.4008 0.4912

The results suggest, for example, a 0.4912 correlation between
weight and acceleration after controlling for the effects of displacement
and horsepower. You can return the *p*-values as
a second output, and examine them to confirm whether these correlations
are statistically significant.

For a clearer display, create a table with appropriate
variable and row labels.

Partial Correlation Coefficients
Displacement Horsepower Weight
------------ ---------- --------
MPG -0.053684 -0.15199 -0.48563
Acceleration -0.39941 -0.40075 0.49123

Test for partial correlation between pairs
of variables in the `x`

and `y`

input
matrices, while controlling for the effects of the remaining variables
in `x`

plus additional variables in matrix `z`

.

Load the sample data.

The data contains measurements from cars manufactured in 1970,
1976, and 1982. It includes `MPG`

and `Acceleration`

as
performance measures, and `Displacement`

, `Horsepower`

,
and `Weight`

as design variables. `Acceleration`

is
the time required to accelerate from 0 to 60 miles per hour, so a
high value for `Acceleration`

corresponds to a vehicle
with low acceleration.

Create a new variable `Headwind`

, and
randomly generate data to represent the notion of an average headwind
along the performance measurement route.

Since headwind can affect the performance measures, control
for its effects when testing for partial correlation between the remaining
variables.

Define the input matrices. The `y`

matrix
includes the performance measures, and the `x`

matrix
includes the design variables. The `z`

matrix contains
additional variables to control for when computing the partial correlations,
such as headwind.

Compute the partial correlation coefficients. Include
only rows with no missing values in the computation.

rho =
0.0572 -0.1055 -0.5736
-0.3845 -0.3966 0.4674
pval =
0.5923 0.3221 0.0000
0.0002 0.0001 0.0000

The small returned *p*-value of 0.001 in `pval`

indicates,
for example, a significant negative correlation between horsepower
and acceleration, after controlling for displacement, weight, and
headwind.

For a clearer display, create tables with appropriate
variable and row labels.

Partial Correlation Coefficients, Accounting for Headwind
Displacement Horsepower Weight
------------ ---------- --------
MPG 0.057197 -0.10555 -0.57358
Acceleration -0.38452 -0.39658 0.4674
P-values, Accounting for Headwind
Displacement Horsepower Weight
------------ ---------- ----------
MPG 0.59233 0.32212 3.4401e-09
Acceleration 0.00018272 0.00010902 3.4091e-06