[R] Simulation

Stefan Grosse singularitaet at gmx.net
Thu May 14 15:09:38 CEST 2009


Debbie Zhang schrieb:
> Now, I am trying to obtain the sample variance (S^2) of the 1000 samples that I have generated before.
>
> I am wondering what command I should use in order to get the sample variance for all the 1000 samples.
>
>  
>
> What I am capable of doing now is just typing in
>
> var(z[[1]])
>
> var(z[[2]])..................... 
>
>  
>
>   
Common please use the package brain 2.0. What is the difference between
this and what you already had here (???):
>> for(i in 1:n){
>> x[[i]]=rnorm(i,0,1)
>> }
>>     

hint: its only a small change.

Please do some introductionary exercises. You find plenty of material here:
http://cran.r-project.org/manuals.html
and here:
http://cran.r-project.org/other-docs.html

Stefan




More information about the R-help mailing list