randomLinComb {alr3} | R Documentation |
Compute a random linear combination of the columns of a matrix or data frame
Description
Computes Xa
where X
is an n \times p
matrix, and a
is
a random vector of length p
.
Usage
randomLinComb(X, seed = NULL)
## S3 method for class 'lm'
randomLinComb(X, seed=NULL)
Arguments
X |
An |
seed |
If not NULL, use this to initialize the random number generator |
Details
The matrix X
is first scaled and centered. a
is computed to have random
uniform components on (-1,1)
.
Value
A vector of length n
.
Author(s)
Sanford Weisberg, sandy@stat.umn.edu
See Also
Examples
randomLinComb(matrix(rnorm(9),ncol=3))
[Package alr3 version 2.0.8 Index]