At 16:29 30/07/2007, Gregory Gentlemen wrote:

>Douglas Bates <[EMAIL PROTECTED]> wrote: On 7/27/07, Gregory 
>Gentlemen  wrote:
> > Greetings,
>
> > I have a seemingly simple task which I have not been able to 
> solve today. I want to construct a symmetric matrix of arbtriray 
> size w/o using loops. The following I thought would do it:
>
> > p <- 6
> > Rmat <- diag(p)
> > dat.cor <- rnorm(p*(p-1)/2)
> > Rmat[outer(1:p, 1:p, "<")] <- Rmat[outer(1:p, 1:p, ">")] <- dat.cor
>
> > However, the problem is that the matrix is filled by column and 
> so the resulting matrix is not symmetric.
>
>Could you provide more detail on the properties of the symmetric
>matrices that you would like to generate?  It seems that you are
>trying to generate correlation matrices.  Is that the case?  Do you
>wish the matrices to be a random sample from a specific distribution.
>If so, what distribution?
>
>Yes, my goal is to generate correlation matrices whose entries have 
>been sampled independently from a normal with a specified mean and variance.

Would it sufficient to use one of the results of
RSiteSearch("random multivariate normal", restrict = "functions")
or have I completely misunderstood what you want? (I appreciate this 
is not exactly what you say you want.)

>Thanks for the help.
>
>Greg
>
>
>---------------------------------
>
>         [[alternative HTML version deleted]]

Michael Dewey
http://www.aghmed.fsnet.co.uk

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to