rawMoments | R Documentation |
Computes the “uncorrected” sum-of-squares-and-products matrix divided by the number of observations.
## S3 method for class 'formula'
rawMoments(formula, data, subset, na.action,
contrasts=NULL, ...)
## Default S3 method:
rawMoments(object, na.rm=FALSE, ...)
cov2raw(cov, mean, N, sd)
## S3 method for class 'rawmoments'
print(x, ...)
object |
a one-sided model formula or an object coercible to a numeric matrix. |
formula |
a one-sided model formula specifying the model matrix for
which raw moments are to be computed; note that a constant is included
if it is not explicitly suppressed by putting |
data |
an optional data frame containing the variables in the formula.
By default the variables are taken from the environment from which
|
subset |
an optional vector specifying a subset of observations to be used in computing moments. |
na.action |
a function that indicates what should happen when the data
contain |
contrasts |
an optional list. See the |
.
na.rm |
if |
cov |
a covariance or correlation matrix. |
mean |
a vector of means. |
N |
the number of observations on which the covariances or correlations are based. |
sd |
an optional vector of standard deviations, to be given if |
x |
an object of class |
... |
arguments passed down. |
rawMoments
and cov2raw
return an object of class rawmoments
,
which is simply a matrix
with an attribute "N"
that contains the number of observations on
which the moments are based.
John Fox jfox@mcmaster.ca
sem
# the following are all equivalent (with the exception of the name of the intercept):
rawMoments(cbind(1, Kmenta))
rawMoments(~ Q + P + D + F + A, data=Kmenta)
Cov <- with(Kmenta, cov(cbind(Q, P, D, F, A)))
cov2raw(Cov, colMeans(Kmenta), nrow(Kmenta))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.