From: Liaw, Andy <andy_liaw_at_merck.com>

Date: Thu 06 Jul 2006 - 02:50:28 EST

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 Received on Thu Jul 06 02:54:29 2006

Date: Thu 06 Jul 2006 - 02:50:28 EST

From: Shin, David

*>
*

> Dear all,

*>
**> I would like to generate bi-variate normal data given that
**> the first column of the data is known. for example:
**> I first generate a set of data using the command, x <-
**> rmvnorm(10, c(0, 0), matrix(c(1, 0, 0, 1), 2))
**>
**> then I would like to sum up the two columns of x:
**> x.sum <- apply(x, 1, sum)
**>
**> now with x.sum I would like to generate another column of
**> data, say y, that makes cbind(x.sum, y) follow a bi-variate
**> normal distribution with mean = c(0, 0) and sigma =
**> matrix(c(1, 0, 0, 1),2)
*

x.sum as you described would be distributed as normal with mean=0 and variance=2 (so you might as well just use x.sum <- rnorm(10, 0, sqrt(2))), so I don't see how you can get to the second step where you want x.sum to have variance=1. Also, since the covariances are 0, you could just generate the columns separately using rnorm() and cbind() them together.

It might be helpful for you to get some basic understanding of math stat. I only say that because most likely there are other steps to whatever task you are doing (people are unlikely to be generating random numbers just for kicks), and there's no telling what other things you are doing inefficiently, or even erroneously.

Andy

> I will appreciate for all insights.

*>
**> David s.
**>
**> **************************************************************
**> **************
**> This email may contain confidential material.\ If you were...{{dropped}}
*

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 Received on Thu Jul 06 02:54:29 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Thu 06 Jul 2006 - 04:17:31 EST.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*