[R] Multivariate regression in R
(Ted Harding)
Ted.Harding at nessie.mcc.ac.uk
Thu Jan 16 16:27:06 CET 2003
Hi Folks,
I want to do multivariate regression in R, i.e. basically
(but with a complication -- see below):
given an Nxp matrix Y of p-variate responses, and an Nxk
matrix X of covariates, to fit the model
Y = X*B + e
with estimation of the kxp matrix of coefficients B
and estimation of the pxp matrix of covariances between
the p variates in Y.
I haven't managed to find a function/package in R which
seems to address this problem directly (maybe I'm overlooking
a way of using a standard one). One way, of course, could
be to stack the columns of Y on top of each other, replicate
X vertically accordingly, and try to introduce a suitably
structured covariance matrix; but I would like to think
that there's an easier way ... !
The complication: for each row of Y, each of the p variates
is associated with one level of a p-level factor W (on a
permuted basis, so that y1,...,yp are associated with levels
i1,...,ip of W where (i1,...,ip) is a permutation of levels
(1,...,p) of W).
I'm wondering, too, how to represent this in R. In the univariate
case, for instance, the matrix representation for a factor when
regressing y on r levels of a factor F represents the factor as
an Nxr matrix with zeros except for 1s in col j for rows where
y has the level j of F. In the multivariate case, each row of Y
would by analogy be associated with a matrix of factor levels,
one row for each variate in Y, so as to pick out the factor levels
by columns as in the univariate case for that variate.
Any help/advice would be much appreciated!
With thanks,
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 16-Jan-03 Time: 15:16:12
------------------------------ XFMail ------------------------------
More information about the R-help
mailing list