package com.imsl.test.example.stat; import com.imsl.stat.PartialCovariances; import com.imsl.math.PrintMatrix; /** *

* Computes the partial covariances for a set of 9 variables. *

* This example computes partial covariances, scaled from a nine-variable * correlation matrix originally given by Emmett (1949). In the input, the upper * \(3\) by \(3\) matrix contains the data for the independent variables. * * @see Code * @see Output */ public class PartialCovariancesEx1 { static public void main(String arg[]) throws Exception { double sigma[][] = { {6.300, 3.050, 1.933, 3.365, 1.317, 2.293, 2.586, 1.242, 4.363}, {3.050, 5.400, 2.170, 3.346, 1.473, 2.303, 2.274, 0.750, 4.077}, {1.933, 2.170, 3.800, 1.970, 0.798, 1.062, 1.576, 0.487, 2.673}, {3.365, 3.346, 1.970, 8.100, 2.983, 4.828, 2.255, 0.925, 3.910}, {1.317, 1.473, 0.798, 2.983, 2.300, 2.209, 1.039, 0.258, 1.687}, {2.293, 2.303, 1.062, 4.828, 2.209, 4.600, 1.427, 0.768, 2.754}, {2.586, 2.274, 1.576, 2.255, 1.039, 1.427, 3.200, 0.785, 3.309}, {1.242, 0.750, 0.487, 0.925, 0.258, 0.768, 0.785, 1.300, 1.458}, {4.363, 4.077, 2.673, 3.910, 1.687, 2.754, 3.309, 1.458, 7.400} }; int nIndependent = 3, df = 30; PartialCovariances pcov = new PartialCovariances(nIndependent, sigma, df); double covar[][] = pcov.getPartialCovarianceMatrix(); new PrintMatrix("Partial Covariances").print(covar); int pdf = pcov.getPartialDegreesOfFreedom(); System.out.println("Partial Degrees of Freedom " + pdf); System.out.println(); double pvalues[][] = pcov.getPValues(); new PrintMatrix("p Values").print(pvalues); } }