lm1

regression
lm
stats-nutshell
schoice
Published

May 8, 2023

Aufgabe

Laden Sie den Datensatz mtcars aus dieser Quelle.

Berechnen Sie eine Regression mit mpg als Ausgabevariable und hp als Eingabevariable!

Welche Aussage ist für diese Analyse richtig?

Answerlist

  • mpg und hp sind positiv korreliert laut dem Modell.
  • Der Achsenabschnitt ist nahe Null.
  • Die Analyse beinhaltet einen nominal skalierten Prädiktor.
  • Das geschätzte Betagewicht für hp liegt bei 30.099.
  • Das geschätzte Betagewicht für hp liegt bei -0.068.











Lösung

Das geschätzte Betagewicht für hp liegt bei -0.068.

Die Analyse könnte so aussehen:

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.3     ✔ readr     2.1.4
✔ forcats   1.0.0     ✔ stringr   1.5.0
✔ ggplot2   3.4.4     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.0
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(easystats)
# Attaching packages: easystats 0.6.0 (red = needs update)
✔ bayestestR  0.13.1   ✔ correlation 0.8.4 
✔ datawizard  0.9.0    ✔ effectsize  0.8.6 
✔ insight     0.19.6   ✔ modelbased  0.8.6 
✔ performance 0.10.8   ✔ parameters  0.21.3
✔ report      0.5.7    ✖ see         0.8.0 

Restart the R-Session and update packages in red with `easystats::easystats_update()`.
mtcars <- read_csv("https://vincentarelbundock.github.io/Rdatasets/csv/datasets/mtcars.csv")
Rows: 32 Columns: 12
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (1): rownames
dbl (11): mpg, cyl, disp, hp, drat, wt, qsec, vs, am, gear, carb

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
lm1 <- lm(mpg ~ hp, data = mtcars)

parameters(lm1) 
Parameter   | Coefficient |   SE |         95% CI | t(30) |      p
------------------------------------------------------------------
(Intercept) |       30.10 | 1.63 | [26.76, 33.44] | 18.42 | < .001
hp          |       -0.07 | 0.01 | [-0.09, -0.05] | -6.74 | < .001

Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
  using a Wald t-distribution approximation.

Answerlist

  • Falsch
  • Falsch
  • Falsch
  • Falsch
  • Richtig

Categories:

  • regression
  • lm
  • stats-nutshell
  • schoice