library(tidyverse)
library(easystats)mariokart-korr2
datawrangling
dplyr
eda
association
num
Aufgabe
Importieren Sie den Datensatz mariokart in R. Filtern Sie die neuen Spiele. Berechnen Sie die Korrelation von Verkaufspreis (total_pr) und Startgebot (start_pr)!
Hinweise:
- Runden Sie auf 2 Dezimalstellen.
Lösung
Pakete starten:
Daten importieren:
d_url <- "https://vincentarelbundock.github.io/Rdatasets/csv/openintro/mariokart.csv"
d <- data_read(d_url)Oder so:
data(mariokart, package = "openintro")solution <-
d %>%
filter(cond == "new") %>%
summarise(pr_cor = cor(total_pr, start_pr))
solution| pr_cor |
|---|
| 0.405102 |
Alternativ kann man (komfortabel) die Korrelation z.B. so berechnen:
d %>%
select(start_pr, total_pr, cond) %>%
filter(cond == "new") %>%
correlation()| Parameter1 | Parameter2 | r | CI | CI_low | CI_high | t | df_error | p | Method | n_Obs |
|---|---|---|---|---|---|---|---|---|---|---|
| start_pr | total_pr | 0.405102 | 0.95 | 0.1662683 | 0.5990402 | 3.345235 | 57 | 0.001459 | Pearson correlation | 59 |
Lösung: 0.41.
Categories:
- datawrangling
- dplyr
- eda
- association
- num