[R] Central limit theorem

Dennis Murphy djmuser at gmail.com
Mon Aug 15 00:57:38 CEST 2011


Hi:

This definitely sounds like a homework problem but it's very easy to
do in R if you think about it the right way.

(1) Generate a matrix of random numbers. This is easier than it looks,
since you can generate a long vector of random numbers and then
reshape it into a matrix. Typically, a row corresponds to a single
random sample, so that should tell you how many columns you need; the
number of samples tells you the number of rows. Type ?rpois at the R
prompt to see its help page. If necessary, also read the result of
?matrix.
(2) See the help page of the function rowMeans(). Run it on your
matrix; it will return a vector.
(3) Plot the histogram. See ?hist
(4) Read the Posting Guide, which is linked at the bottom of this
e-mail, and pay attention to the policy on homework questions. (This
should be point (0), but I'm being pragmatic.)

Dennis

On Sun, Aug 14, 2011 at 6:16 AM, maggy yan <kiotoqq at googlemail.com> wrote:
> my data looks like this:
>
>         PM10       Ref   UZ     JZ         WT   RH   FT   WR
> 1   10.973195  4.338874 nein Winter   Dienstag   ja nein West
> 2    6.381684  2.250446 nein Sommer    Sonntag nein   ja  Süd
> 3   62.586512 66.304869   ja Sommer    Sonntag nein nein  Ost
> 4    5.590101  8.526152   ja Sommer Donnerstag nein nein Nord
> 5   30.925054 16.073091 nein Winter    Sonntag nein nein  Ost
> 6   10.750567  2.285075 nein Winter   Mittwoch nein nein  Süd
> 7   39.118316 17.128691   ja Sommer    Sonntag nein nein  Ost
> 8    9.327564  7.038572   ja Sommer     Montag nein nein Nord
> 9   52.271744 15.021977 nein Winter     Montag nein nein  Ost
> 10  27.388416 22.449102   ja Sommer     Montag nein nein  Ost
> 11   6.460829  4.486329   ja Winter    Samstag nein nein  Süd
> 12   5.937690 10.247768   ja Sommer    Sonntag nein nein Nord
> 13  14.004685  5.155790 nein Winter    Sonntag nein nein Nord
> 14  12.244333  7.063825   ja Sommer   Mittwoch nein   ja Nord
> 15  35.195541 12.148438 nein Winter     Montag nein nein  Ost
> .
> .
> .
> .
> til 200
> now I should illustrate the Central limit theorem with my data. I need to
> make 80 times the arithmetic means of each of the 100 poisson distributet
> random numbers with an expected value 7.
> the hint says I need a metrices first which includes all of the 8000 values.
> but I have no idea where the 8000 values are and how to make the matrices.
> please help me
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> 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.
>
>



More information about the R-help mailing list