# [R] R simulations

Greg Snow Greg.Snow at imail.org
Thu Dec 4 18:17:49 CET 2008

```Your teacher did not assign this homework to you because he/she does not know the answer, rather he/she has some vague hope that by You doing Your homework You may actually learn something.  The chances of You learning something (supposedly the purpose behind you taking the class) is greatly increased when You do Your Own homework.  As many of us on the list are also teachers and interested in students actually learning something rather than just jumping through the hoops, we are unlikely to do Your homework for you.

If you do not understand something in the questions, then your teacher (who presumably wrote the questions) or TA (who works with the teacher) are more likely to be able to help you understand than a bunch of people who have less information than you do about the goals of the course.  Your teacher/TA are also being paid to help with this, those on the list are not.

The posting guide (linked to from every r-help e-mail) has more detail on what types of questions are appropriate and how to increase your chances of getting useful replies.

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of João Cruz
> Sent: Thursday, December 04, 2008 6:33 AM
> To: r-help at r-project.org
> Subject: [R] R simulations
>
> I need help with these R simulations
>
> _______________________________________
> The generation of pseudo-random numbers with uniform distribution [0.1]
> can be done through a method called Congruencial Committee, which
> consists
> the use of a recursive relationship of the type:
> xi +1 = (a.xi + c) mod m
> being a, c, and the positive integers m, c <m.
> Discuss in light of possible values of a, c, my values seed x0
> the behavior of the generator in order to obtain sequences
> evenly distributed with cycles of large dimensions.
> Tip: Write a program in R to implement the generator and
> thus obtain different sequences depending on the values of a, c, d.
>
> ____________________________________
> Write a program to deploy the generator
> xi +1 = (25173 xi + 13,849) 65536 mod
> and considering initial value x0 = 10000
> obtain the
> first 10 values generated
>
> ___________________________
>
> Develop a program for simulation to estimate the probability of exit
> 1,2,3,4,5,6 each of the sides in the launch of a non-addict.
> Then obtain and comment on the likelihood obtained considering the
> simulation of 100, 1,000, 10,000 and 100,000 entries. Represents
> graphically
> results.
>
> ______________________________
>
> Get an algorithm and implement  in order to generate variables
> Random exponential function whose density is f (x) = lambda.e ^ [(-
> lambda) x]. Consider
> the case where lambda = 1 and get a list of 10 values generated.
>
> Tip: Use the method of generating investment and the R runif.
> __________________________________
>
> Let f (x) = 3x a density function of a continuous random variable
> X with area defined in range [0, 2]. Apply the method of investment and
> describe an algorithm to generate variables
> random function of density. Implement the algorithm in the U.S. and
> proceed to the generation of a sample of
> Size 100. Estimate addition, the quantiles 2%, 10%, 25%, 50%, 90%, 95%
> and 99% and compare them
> with the theoretical quantiles.
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help