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
-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