Skip to content

Latest commit

 

History

History
18 lines (12 loc) · 722 Bytes

File metadata and controls

18 lines (12 loc) · 722 Bytes

Repetition

The function

  • replicate(nrep, expression) repeats the expression provided nrep times.

    • e.g. replicate(10, mean(rnorm(100))) reads: 'draw 100 values from a normal distribution with a mean 0 and sd 1, caclulate the mean of these 100 values, and do all that 10 times.'

YOUR TURN:
In your local exercise script:
Replicate 1000 times the mean of 10 values drawn from a unifrom distribution between 0 and 10.
Replicate 100 times the mean of 50 values drawn from a normal distribution of mean 10 and standard deviation 5.
Make a histogram of each of your results, are the distributions looking as expected?


Previous | Next