[R] How to set up a function for "Central Limit Theorem"

baptiste auguie ba208 at exeter.ac.uk
Mon Mar 23 19:39:07 CET 2009


(a <- replicate(5,rnorm(10)))
colMeans(a)

should get you started.

HTH,

baptiste


On 23 Mar 2009, at 18:29, pfc_ivan wrote:

>
> I tried using the for (i..) to make 1000 differents sets of numbers,  
> but then
> I dont know how to get the mean value of all of them... because I  
> dont even
> think 1000 different sets of numbers were made, because when i print  
> it it
> always shows me the same values, basically I dont know how to  
> replicate the
> funcion many times.
>
>
>
> stephen sefick wrote:
>>
>> homework?
>>
>> On Mon, Mar 23, 2009 at 1:30 PM, pfc_ivan <pfc_ivan at hotmail.com>  
>> wrote:
>>>
>>> Hello guys, I am stuck here:
>>>
>>> How do I make 1000 samples of n = 10 observations from an  
>>> Exponential
>>> distribution and then compute the mean for all those 1000 samples?
>>>
>>> Basically I need to prove the Central Limit theorem, which states:
>>>
>>> http://www.nabble.com/file/p22664113/d175f06cbf200bd52a2c27a2e56dc594.png
>>>
>>> Where the Sn is sum of random variables, n we have from the  
>>> question, mu
>>> is
>>> mean and (sigma)^2 is variance.
>>>
>>> I am having trouble setting up the function to do this.
>>>
>>> Any help apreciated!
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/How-to-set-up-a-function-for-%22Central-Limit-Theorem%22-tp22664113p22664113.html
>>> Sent from the R help mailing list archive at Nabble.com.
>>>
>>> ______________________________________________
>>> 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.
>>>
>>
>>
>>
>> -- 
>> Stephen Sefick
>>
>> Let's not spend our time and resources thinking about things that are
>> so little or so large that all they really do for us is puff us up  
>> and
>> make us feel like gods.  We are mammals, and have not exhausted the
>> annoying little problems of being mammals.
>>
>> 								-K. Mullis
>>
>> ______________________________________________
>> 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.
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/How-to-set-up-a-function-for-%22Central-Limit-Theorem%22-tp22664113p22666250.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.

_____________________________

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag




More information about the R-help mailing list