TU Wien:Statistik und Wahrscheinlichkeitstheorie UE (Bura)/Übungen 2019W/4.6
Zur Navigation springen
Zur Suche springen
- Simulations
- (a) By applying the R-function
replicate()
generate a sample of size 10 from an exponential distribution with a rate parameter 0.2 and sum up its elements. Do this sum 10 000 times and make a histogram of the simulation. Can you say something about the shape of distribution? - (b) Use R to simulate 50 tosses of a fair coin (0 and 1). We call a run a sequence of all 1's or all 0's. Estimate the average length of the longest run in 10000 trials and report the result.
- Hint: Use the commands
rbinom
andrle
. The commandrle()
stands for run length encoding. For example, rle(rbinom(10, 1, 0.5))$lengths
- is a vector of the lengths of all the different runs in trial of 10 flips of a fair coin.
Dieses Beispiel hat noch keinen Lösungsvorschlag. Um einen zu erstellen, kopiere folgende Zeilen, bearbeite die Seite und aktualisiere den status=unsolved
Mögliche status=...
Werte stehen hier: Vorlage:Beispiel
== Lösungsvorschlag von ~~~ == --~~~~
Siehe auch Hilfe:Formeln und Hilfe:Beispielseiten.