Zum Hauptinhalt springen

388  moderation

Schlüsselwörter

Aufgaben, Statistik, Prognose, Modellierung, R, Datenanalyse, Regression

Gegeben sei das folgende lineare Modell.

library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.2.1     ✔ readr     2.2.0
## ✔ forcats   1.0.1     ✔ stringr   1.6.0
## ✔ ggplot2   4.0.3     ✔ tibble    3.3.1
## ✔ lubridate 1.9.5     ✔ tidyr     1.3.2
## ✔ purrr     1.2.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.7.5 (red = needs update)
## ✖ bayestestR  0.17.0   ✔ correlation 0.8.8 
## ✖ datawizard  1.3.1    ✖ effectsize  1.0.2 
## ✖ insight     1.5.1    ✖ modelbased  0.15.0
## ✖ performance 0.16.0   ✖ parameters  0.29.0
## ✔ report      0.6.4    ✖ see         0.13.0
## 
## Restart the R-Session and update packages with `easystats::easystats_update()`.
library(rstanarm)
## Lade nötiges Paket: Rcpp
## This is rstanarm version 2.32.2
## - See https://mc-stan.org/rstanarm/articles/priors for changes to default priors!
## - Default priors may change, so it's safest to specify priors, even if equivalent to the defaults.
## - For execution on a local, multicore CPU with excess RAM we recommend calling
##   options(mc.cores = parallel::detectCores())
## 
## Attache Paket: 'rstanarm'
## 
## Das folgende Objekt ist maskiert 'package:parameters':
## 
##     compare_models
data(mariokart, package = "openintro")

mariokart_z <-
  mariokart |>
  standardise(select = c("wheels", "total_pr"))

model1 <- stan_glm(total_pr ~ wheels + stock_photo + wheels:stock_photo, data = mariokart_z)
## 
## SAMPLING FOR MODEL 'continuous' NOW (CHAIN 1).
## Chain 1: 
## Chain 1: Gradient evaluation took 1.6e-05 seconds
## Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.16 seconds.
## Chain 1: Adjust your expectations accordingly!
## Chain 1: 
## Chain 1: 
## Chain 1: Iteration:    1 / 2000 [  0%]  (Warmup)
## Chain 1: Iteration:  200 / 2000 [ 10%]  (Warmup)
## Chain 1: Iteration:  400 / 2000 [ 20%]  (Warmup)
## Chain 1: Iteration:  600 / 2000 [ 30%]  (Warmup)
## Chain 1: Iteration:  800 / 2000 [ 40%]  (Warmup)
## Chain 1: Iteration: 1000 / 2000 [ 50%]  (Warmup)
## Chain 1: Iteration: 1001 / 2000 [ 50%]  (Sampling)
## Chain 1: Iteration: 1200 / 2000 [ 60%]  (Sampling)
## Chain 1: Iteration: 1400 / 2000 [ 70%]  (Sampling)
## Chain 1: Iteration: 1600 / 2000 [ 80%]  (Sampling)
## Chain 1: Iteration: 1800 / 2000 [ 90%]  (Sampling)
## Chain 1: Iteration: 2000 / 2000 [100%]  (Sampling)
## Chain 1: 
## Chain 1:  Elapsed Time: 0.02 seconds (Warm-up)
## Chain 1:                0.027 seconds (Sampling)
## Chain 1:                0.047 seconds (Total)
## Chain 1: 
## 
## SAMPLING FOR MODEL 'continuous' NOW (CHAIN 2).
## Chain 2: 
## Chain 2: Gradient evaluation took 1e-05 seconds
## Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.1 seconds.
## Chain 2: Adjust your expectations accordingly!
## Chain 2: 
## Chain 2: 
## Chain 2: Iteration:    1 / 2000 [  0%]  (Warmup)
## Chain 2: Iteration:  200 / 2000 [ 10%]  (Warmup)
## Chain 2: Iteration:  400 / 2000 [ 20%]  (Warmup)
## Chain 2: Iteration:  600 / 2000 [ 30%]  (Warmup)
## Chain 2: Iteration:  800 / 2000 [ 40%]  (Warmup)
## Chain 2: Iteration: 1000 / 2000 [ 50%]  (Warmup)
## Chain 2: Iteration: 1001 / 2000 [ 50%]  (Sampling)
## Chain 2: Iteration: 1200 / 2000 [ 60%]  (Sampling)
## Chain 2: Iteration: 1400 / 2000 [ 70%]  (Sampling)
## Chain 2: Iteration: 1600 / 2000 [ 80%]  (Sampling)
## Chain 2: Iteration: 1800 / 2000 [ 90%]  (Sampling)
## Chain 2: Iteration: 2000 / 2000 [100%]  (Sampling)
## Chain 2: 
## Chain 2:  Elapsed Time: 0.022 seconds (Warm-up)
## Chain 2:                0.026 seconds (Sampling)
## Chain 2:                0.048 seconds (Total)
## Chain 2: 
## 
## SAMPLING FOR MODEL 'continuous' NOW (CHAIN 3).
## Chain 3: 
## Chain 3: Gradient evaluation took 5e-06 seconds
## Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.05 seconds.
## Chain 3: Adjust your expectations accordingly!
## Chain 3: 
## Chain 3: 
## Chain 3: Iteration:    1 / 2000 [  0%]  (Warmup)
## Chain 3: Iteration:  200 / 2000 [ 10%]  (Warmup)
## Chain 3: Iteration:  400 / 2000 [ 20%]  (Warmup)
## Chain 3: Iteration:  600 / 2000 [ 30%]  (Warmup)
## Chain 3: Iteration:  800 / 2000 [ 40%]  (Warmup)
## Chain 3: Iteration: 1000 / 2000 [ 50%]  (Warmup)
## Chain 3: Iteration: 1001 / 2000 [ 50%]  (Sampling)
## Chain 3: Iteration: 1200 / 2000 [ 60%]  (Sampling)
## Chain 3: Iteration: 1400 / 2000 [ 70%]  (Sampling)
## Chain 3: Iteration: 1600 / 2000 [ 80%]  (Sampling)
## Chain 3: Iteration: 1800 / 2000 [ 90%]  (Sampling)
## Chain 3: Iteration: 2000 / 2000 [100%]  (Sampling)
## Chain 3: 
## Chain 3:  Elapsed Time: 0.022 seconds (Warm-up)
## Chain 3:                0.029 seconds (Sampling)
## Chain 3:                0.051 seconds (Total)
## Chain 3: 
## 
## SAMPLING FOR MODEL 'continuous' NOW (CHAIN 4).
## Chain 4: 
## Chain 4: Gradient evaluation took 5e-06 seconds
## Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0.05 seconds.
## Chain 4: Adjust your expectations accordingly!
## Chain 4: 
## Chain 4: 
## Chain 4: Iteration:    1 / 2000 [  0%]  (Warmup)
## Chain 4: Iteration:  200 / 2000 [ 10%]  (Warmup)
## Chain 4: Iteration:  400 / 2000 [ 20%]  (Warmup)
## Chain 4: Iteration:  600 / 2000 [ 30%]  (Warmup)
## Chain 4: Iteration:  800 / 2000 [ 40%]  (Warmup)
## Chain 4: Iteration: 1000 / 2000 [ 50%]  (Warmup)
## Chain 4: Iteration: 1001 / 2000 [ 50%]  (Sampling)
## Chain 4: Iteration: 1200 / 2000 [ 60%]  (Sampling)
## Chain 4: Iteration: 1400 / 2000 [ 70%]  (Sampling)
## Chain 4: Iteration: 1600 / 2000 [ 80%]  (Sampling)
## Chain 4: Iteration: 1800 / 2000 [ 90%]  (Sampling)
## Chain 4: Iteration: 2000 / 2000 [100%]  (Sampling)
## Chain 4: 
## Chain 4:  Elapsed Time: 0.021 seconds (Warm-up)
## Chain 4:                0.026 seconds (Sampling)
## Chain 4:                0.047 seconds (Total)
## Chain 4:

Hier sind die Ergebnisse des Modells:

parameters(model1)
## Parameter             | Median |        95% CI |     pd |  Rhat |  ESS |                      Prior
## ---------------------------------------------------------------------------------------------------
## (Intercept)           |   0.19 | [-0.11, 0.50] | 89.22% | 1.000 | 3631 | Normal (-5.01e-18 +- 2.50)
## wheels                |   0.39 | [ 0.11, 0.67] | 99.58% | 1.000 | 2625 |      Normal (0.00 +- 2.50)
## stock_photoyes        |  -0.26 | [-0.61, 0.10] | 92.77% | 1.001 | 3785 |      Normal (0.00 +- 5.64)
## wheels:stock_photoyes |  -0.08 | [-0.42, 0.25] | 69.25% | 1.000 | 2602 |      Normal (0.00 +- 3.03)
## 
## Uncertainty intervals (equal-tailed) computed using a MCMC distribution
##   approximation.
plot(parameters(model1))

plot of chunk unnamed-chunk-2

plot of chunk unnamed-chunk-2

Welche Aussage zum Modell model1 ist korrekt?

Hinweise:

  • Beachten Sie die üblichen Hinweise des Datenwerks.

  • Liegen Stock-Photos bei, ist ein höheres Preis zu erwarten.

  • Es liegt ein Interaktionseffekt vor und zwar so, dass der Effekt von wheels negativ ist, wenn Stock-Photos vorliegen.

  • Es liegt ein Interaktionseffekt vor und zwar so, dass der Effekt von wheels positiv ist, wenn Stock-Photos vorliegen.

  • Es kann nicht ausgeschlossen werden, dass kein Interaktionseffekt vorliegt, da die Null im 95%-CI enthalten ist.

  • wheels hat einen negativen Effekt, wobei die Null aus dem 95% CI ausgeschlossen ist.

D

Aufgabenname: moderation

  • Falsch
  • Falsch
  • Falsch
  • Richtig
  • Falsch