[R] How can I generate this numbers

Rolf Turner rolf at erdos.math.unb.ca
Tue Oct 3 00:43:55 CEST 2006


Ricardo Rios wrote:

> Hi Rolf Turner, I have a  statistical model, it model need this
> numbers for calculate the probability. This numbers must be random.
> 
> For example I need that
> >magicfunction(3)
> >[1] 0.3152460 0.5231614 0.1615926
> >magicfunction(3)
> >[1]  0.6147933 0.3122999  0.0729068
> 
> but the argument of the function is arbitrary , does somebody
> know if exist this function in R?

	As far as I know, no such function exists in R, but
	it would be totally trivial to write one, if that's
	what you really want.

	However the question you pose makes little sense to me.  If
	you really have a ``statisical model'' then there must be
	some marginal distribution for each of the probabilities (I
	*assume* They are probabilities) going into the sequence
	which you wish to sum to 1.

	You mention no such distribution.

	To generate such a sequence with an arbitray marginal
	distribution is so trivial that it does not bear discussing.

	If you really can't see how to do this, then you probably
	shouldn't be messing about with ``statistical models''.

	You did not explicitly deny that this is a homework problem.

	I still suspect that it is.

				cheers,

					Rolf Turner



More information about the R-help mailing list