Re: [R] generate random numbers subject to constraints

From: Giovanni Petris <GPetris_at_uark.edu>
Date: Wed, 26 Mar 2008 14:39:43 -0600 (CST)

You have 4 random variables that satisfy 2 linear constraints, so you are trying to generate a point in a (4-2) = 2 dimensional linear (affine, in fact) subspace of R^4.

If you don't have any further requirement for the distribution of the random points you want to generate, there are infinitely many ways of doing it.

It would be a good idea if you could explain in some more detail what you want to do, so that we can give you relevant suggestions.

Best,
Giovanni

> Date: Wed, 26 Mar 2008 11:28:28 -0700
> From: "Ala' Jaouni" <ajaouni_at_gmail.com>
> Sender: r-help-bounces@r-project.org
> Precedence: list
>
> I am trying to generate a set of random numbers that fulfill the
> following constraints:
>
> X1 + X2 + X3 + X4 = 1
>
> aX1 + bX2 + cX3 + dX4 = n
>
> where a, b, c, d, and n are known.
>
> Any function to do this?
>
> Thanks,
> -Ala'
>
> ______________________________________________
> R-help_at_r-project.org 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.
>
>

-- 

Giovanni Petris  <GPetris @ uark.edu>
Department of Mathematical Sciences
University of Arkansas - Fayetteville, AR 72701
Ph: (479) 575-6324, 575-8630 (fax)
http://definetti.uark.edu/~gpetris/

______________________________________________
R-help_at_r-project.org 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.
Received on Wed 26 Mar 2008 - 19:43:23 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 26 Mar 2008 - 20:30:25 GMT.

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

list of date sections of archive