buildSSCP: build the sum of squares and cross products matrix

View source: R/buildSSCP.R

buildSSCPR Documentation

build the sum of squares and cross products matrix

Description

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.

Usage

buildSSCP(sample.cov, sample.mean, sample.nobs)

Arguments

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.


zackfisher/MIIVsem documentation built on March 11, 2024, 11:34 a.m.