[R] simulate from conditional distribution
Thomas Lumley
tlumley at uw.edu
Thu Sep 13 23:10:40 CEST 2012
On Fri, Sep 14, 2012 at 9:02 AM, li li <hannah.hlx at gmail.com> wrote:
> Dear all,
> Y, X are bivariate normal with all the parameters known.
> I would like to generate numbers from the distribution Y | X > c
> where c is a constant.
> Does there exist an R function generating
> random numbers from such a distribution?
Not directly, as far as I know, but you can easily simulate X|X>c by
transforming uniform random numbers using the inverse CDF, and Y|X=x
is univariate Normal with mean linear in x and variance independent of
x.
-thomas
--
Thomas Lumley
Professor of Biostatistics
University of Auckland
More information about the R-help
mailing list