library(tidyverse)
library(easystats)mariokart-korr3
datawrangling
dplyr
eda
association
num
Aufgabe
Importieren Sie den Datensatz mariokart in R. Berechnen Sie die Korrelation von mittlerem Verkaufspreis (total_pr) und Startgebot (start_pr) für Spiele, die sowohl neu sind und über Lenkräder (wheels) verfügen.
Hinweise:
- Runden Sie auf 1 Dezimalstelle.
- Beachten Sie die Hinweise des Datenwerk.
Lösung
Pakete starten:
Daten importieren:
d_url <- "https://vincentarelbundock.github.io/Rdatasets/csv/openintro/mariokart.csv"
d <- data_read(d_url)solution <-
d %>%
filter(cond == "new" & wheels > 0) %>%
summarise(pr_corr = cor(total_pr, start_pr))
solution| pr_corr |
|---|
| 0.4315485 |
Alternativ kann man (komfortabel) die Korrelation z.B. so berechnen:
d %>%
select(start_pr, total_pr, cond, wheels) %>%
filter(cond == "new" & wheels > 0) %>% # logisches UND
correlation()| Parameter1 | Parameter2 | r | CI | CI_low | CI_high | t | df_error | p | Method | n_Obs |
|---|---|---|---|---|---|---|---|---|---|---|
| start_pr | total_pr | 0.4315485 | 0.95 | 0.1877461 | 0.6252604 | 3.4827135 | 53 | 0.0020065 | Pearson correlation | 55 |
| start_pr | wheels | 0.1173873 | 0.95 | -0.1526642 | 0.3711267 | 0.8605421 | 53 | 0.3933665 | Pearson correlation | 55 |
| total_pr | wheels | 0.7713931 | 0.95 | 0.6363173 | 0.8605750 | 8.8249370 | 53 | 0.0000000 | Pearson correlation | 55 |
Lösung: 0.4.
Categories:
- datawrangling
- dplyr
- eda
- association
- num