User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

public:t-701-rem4:s4._hints [2007/09/11 21:54] (current)
helgi created
Line 1: Line 1:
 +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 ''help(sapply)'' and ''sapply(rep(100,10)''.
 +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/ailab/WWW/wiki/data/pages/public/t-701-rem4/s4._hints.txt ยท Last modified: 2007/09/11 21:54 by helgi