mariokart-korr4

datawrangling
dplyr
eda
association
num
Published

May 8, 2023

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 oder über Lenkräder (wheels) verfügen.

Hinweise:











Lösung

Pakete starten:

library(tidyverse)
library(easystats)

Daten importieren:

d_url <- "https://vincentarelbundock.github.io/Rdatasets/csv/openintro/mariokart.csv"
d <- read.csv(d_url)
solution <-
d  %>% 
  filter(cond == "new" | wheels > 0) %>% 
  summarise(pr_corr = cor(total_pr, start_pr))

solution
pr_corr
0.0472549

Alternativ kann man (komfortabel) die Korrelation z.B. so berechnen:

d %>% 
  select(start_pr, total_pr, cond, wheels) %>% 
  filter(cond == "new" | wheels > 0) %>%   # logisches ODER
  correlation()  # aus dem Paket `easystats`
Parameter1 Parameter2 r CI CI_low CI_high t df_error p Method n_Obs
start_pr total_pr 0.0472549 0.95 -0.1412363 0.2324397 0.4916361 108 0.7616424 Pearson correlation 110
start_pr wheels 0.0843747 0.95 -0.1045180 0.2673918 0.8799853 108 0.7616424 Pearson correlation 110
total_pr wheels 0.2845888 0.95 0.1028267 0.4479599 3.0851040 108 0.0077536 Pearson correlation 110

Lösung: 0.0.


Categories:

  • datawrangling
  • dplyr
  • eda
  • association
  • num