Build sum of squares and crossproducts matrix (SSCP). From the means, covariances, and n's you can recover the raw sum-of-squares and products matrix for all the variables. Say the matrix of all the variables is X, with mean vector bar(x), and covariance matrix S, based on sample-size n. Then the SSCP matrix is X'X = (n - 1)S + n bar(x) bar(x)'. You then need to add the row/column for the constant, which is just n in the 1, 1 position and n bar(x) elsewhere.

1 | ```
buildSSCP(sample.cov, sample.mean, sample.nobs)
``` |

`sample.cov` |
Numeric matrix. A sample variance-covariance matrix. The rownames and colnames must contain the observed variable names. |

`sample.mean` |
A sample mean vector. |

`sample.nobs` |
Number of observations in the full data frame. |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.