To generate the samples, one can proceed like in Exercise 1.7 (pg. 44 in ISwR). A solution there is
apply(sapply(rep(100,10),rnorm),2,mean). To understand how it works, start with
In the assignment, we need to pass parameters to the
sample function. This is done by named parameters:
sapply(1:1000,sample,x=101:111,size=5) . One could also use
replicate in a similar manner or use a
for loop instead of the implicit loop.
The means and medians are obtained like in Ex. 1.7.
/var/www/cadia.ru.is/wiki/data/pages/public/t-701-rem4/s4._hints.txt · Last modified: 2007/09/11 21:54 by helgi