Sufficient Statistics
Sufficient statistics for various models.
RegressionSuf(X = NULL, y = NULL, xtx = crossprod(X), xty = crossprod(X, y), yty = sum(y^2), n = length(y), xbar = colMeans(X)) GaussianSuf(y)
X |
The predictor matrix for a regression problem. |
y |
The data, or the regression response variable. |
xtx |
The cross product of the design matrix. "X transpose X." |
xty |
The cross product of the design matrix with the response vector. "X transpose y." |
yty |
The sum of the squares of the response vector. "y transpose y." |
n |
The sample size. |
xbar |
A vector giving the average of each column in the predictor matrix. |
The returned value is a function containing the sufficient statistics for a regression model. Arguments are checked to ensure they have legal values. List names match the names expected by underlying C++ code.
Steven L. Scott steve.the.bayesian@gmail.com
X <- cbind(1, matrix(rnorm(3 * 100), ncol = 3)) y <- rnorm(100) ## Sufficient statistics can be computed from raw data, if it is ## available. suf1 <- RegressionSuf(X, y) ## The individual components can also be computed elsewhere, and ## provided as arguments. If n is very large, this can be a ## substantial coomputational savings. suf2 <- RegressionSuf(xtx = crossprod(X), xty = crossprod(X, y), yty = sum(y^2), n = 100, xbar = colMeans(X))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.