-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathTornado_Kuras.Rmd
57 lines (42 loc) · 1.75 KB
/
Tornado_Kuras.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
title: "1,000-years Tornadoes"
author: "Agnieszka Kuras"
date: "7 November 2017"
output:
pdf_document: default
html_document: default
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r tornado}
##What can we say about the probabilities of observing multiple 1,000-year tornadoes in thousand years?
#Anzahl der betrachteten Jahren ist:
n <- 1000
#die jährliche Auftrittwsahrscheinlichkeit beträgt:
p <- 1 / n
#die Wahrscheinlichkeit, *keinen* 1,000-year Tornado in 1000 Jahren anzutreffen, beträgt:
(1 - p) ^ n
#y ist eine zufällige Anzahl des Tornadoauftretens in 1000 Jahren
y <- runif(1000)
(obs <- sum(y >= 0.999))
#Um ein quantitatives und qualitatives Ergebnis zu bekommen, werden 1000 Experimente in Form von Matrix berechnet
y_long <- matrix(runif(1e6), ncol = 1000)
obs_long<- colSums(y_long >=0.999)
#Es wird ein Diagramm erzeugt
plot(table(obs_long), lwd = 10,
main = "Simulierte 1,000-year Tornados",
col = "hotpink",
xlab = "1,000 year-Tornado - Anzahl",
ylab = "Frequenz",
cex.lab = 1.5, cex.main = 1.5)
```
## Including Plots
You can also embed plots, for example:
```{r pressure, echo=FALSE}
plot(pressure)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.