Setup

Details

Packete laden

library(foreign)
library(RSA)
library(rgl)
library(dplyr)
library(tidyverse)
library(readr)

Daten einlesen und entsprechende Variablen z-standardisieren

dataset = read_tsv("Hauptstudie.dat")

dataset <- dataset %>% mutate_each_(funs(scale(.) %>% as.vector), 
                             vars=c("iq_se_anf","hil_se_anf","hil_se_end","iq_se_end","Rohwert_APM","viq","vul_ges","pers","zug","qual","hilk_24","swe","heinstr"))

Es werden polynominale Regressionsmodelle gerechnet und über Response-Surface realisiert und dargestellt unter Verwendung des RSA-Pakets von Schönbrodt, 2015 Dabei werden über Strukturmodelle verschiedene genestete Modelle geschätzt und in eine RSA gespeichert.

HIL auf Quellendimensionen

Es wird die Interaktion von objektiver HIL(HILK) und subjektiver HIL(SWE) auf alle drei Quellendimensionen (Expertise, Zugänglichkeit & Persönliche Interaktion) berechnet.

RSA Berechnung

# RSA durchführen und Ergebnisse in r1-r3 speichern
r1 <-RSA(qual ~ hilk_24*swe, data=dataset)
## [1] "Computing additive model (additive) ..."
## [1] "Computing x + x^2 model (onlyx2) ..."
## [1] "Computing y + y^2 model (onlyy2) ..."
## [1] "Computing x model (onlyx) ..."
## [1] "Computing y model (onlyy) ..."
## [1] "Computing interaction model (IA)..."
## [1] "Computing squared difference model (SQD) ..."
## [1] "Computing shifted squared difference model (SSQD) ..."
## [1] "Computing rising ridge model (RR) ..."
## [1] "Computing shifted rising ridge model (SRR) ..."
## [1] "Computing rotated and shifted rising ridge model (SRRR), up ..."
## [1] "Computing rotated and shifted rising ridge model (SRRR), down ..."
## [1] "Direction of SRRR curvature: up"
## [1] "Computing rotated squared difference model (SRSQD), up ..."
## [1] "Computing rotated squared difference model (SRSQD), down ..."
## [1] "Direction of SRSQD curvature: "
## [1] "Computing polynomial model (full) ..."
r2 <-RSA(pers ~ hilk_24*swe, data=dataset)
## [1] "Computing additive model (additive) ..."
## [1] "Computing x + x^2 model (onlyx2) ..."
## [1] "Computing y + y^2 model (onlyy2) ..."
## [1] "Computing x model (onlyx) ..."
## [1] "Computing y model (onlyy) ..."
## [1] "Computing interaction model (IA)..."
## [1] "Computing squared difference model (SQD) ..."
## [1] "Computing shifted squared difference model (SSQD) ..."
## [1] "Computing rising ridge model (RR) ..."
## [1] "Computing shifted rising ridge model (SRR) ..."
## [1] "Computing rotated and shifted rising ridge model (SRRR), up ..."
## [1] "Computing rotated and shifted rising ridge model (SRRR), down ..."
## [1] "Direction of SRRR curvature: down"
## [1] "Computing rotated squared difference model (SRSQD), up ..."
## [1] "Computing rotated squared difference model (SRSQD), down ..."
## [1] "Direction of SRSQD curvature: up"
## [1] "Computing polynomial model (full) ..."
r3 <-RSA(zug ~ hilk_24*swe, data=dataset)
## [1] "Computing additive model (additive) ..."
## [1] "Computing x + x^2 model (onlyx2) ..."
## [1] "Computing y + y^2 model (onlyy2) ..."
## [1] "Computing x model (onlyx) ..."
## [1] "Computing y model (onlyy) ..."
## [1] "Computing interaction model (IA)..."
## [1] "Computing squared difference model (SQD) ..."
## [1] "Computing shifted squared difference model (SSQD) ..."
## [1] "Computing rising ridge model (RR) ..."
## [1] "Computing shifted rising ridge model (SRR) ..."
## [1] "Computing rotated and shifted rising ridge model (SRRR), up ..."
## [1] "Computing rotated and shifted rising ridge model (SRRR), down ..."
## [1] "Direction of SRRR curvature: down"
## [1] "Computing rotated squared difference model (SRSQD), up ..."
## [1] "Computing rotated squared difference model (SRSQD), down ..."
## [1] "Direction of SRSQD curvature: down"
## [1] "Computing polynomial model (full) ..."

Grafische Modellidentifikation

Es werden über Modellparameter und Fit-Indizes alle Modelle miteinander verglichen und das bestgeeignetste ausgewählt

Expertise

# Plot mit Modellvergleichen
a1 <- aictab(r1, plot=TRUE)

Persönliche Interaktion

a2 <- aictab(r2, plot=TRUE)

Zugänglichkeit

a3 <- aictab(r3, plot=TRUE)

Tabelle der Modellparameter

Expertise

rmarkdown::paged_table(a1)

Persönliche Interaktion

rmarkdown::paged_table(a2)

Zugänglichkeit

rmarkdown::paged_table(a3)

Tabelle der Koeffizienten

Für die bestgeeigneten Modelle werden robuste Fehlerwerte und Konfidenzintervalle unter bootstraping berechnet.

details

# Konfidenzintervalle mit robusten SE
CI.SRRR <- confint(r2, model="SRRR")

# Percentile bootsrap Konfidenzintervalle und p-Werte
# Dies kann mehrere Minuten dauern
CI.boot.SRRR <- confint(r2, model="SRRR",
        method="boot", R=10,
        parallel="multicore", ncpus=4)
## [1] "Drawing 10 bootstrap samples, please be patient ..."
# Konfidenzintervalle mit robusten SE
CI.onlyx <- confint(r1, model="onlyx")

# Percentile bootsrap Konfidenzintervalle und p-Werte
# Dies kann mehrere Minuten dauern
CI.boot.onlx <- confint(r1, model="onlyx",
        method="boot", R=10,
        parallel="multicore", ncpus=4)
## [1] "Drawing 10 bootstrap samples, please be patient ..."
# Konfidenzintervalle mit robusten SE
CI.onlyy <- confint(r3, model="onlyy")

# Percentile bootsrap Konfidenzintervalle und p-Werte
# Dies kann mehrere Minuten dauern
CI.boot.onlyy <- confint(r3, model="onlyy",
        method="boot", R=10,
       parallel="multicore", ncpus=4)
## [1] "Drawing 10 bootstrap samples, please be patient ..."

Expertise

# Alle RSA-Parameter vom finalen Modell mit robusten SEs, p-Werten und Konfidenzintervallen
r1coef <- getPar(r1, "coef", model="onlyx")
rmarkdown::paged_table(r1coef)

Persönliche Interaktion

# Alle RSA-Parameter vom finalen Modell mit robusten SEs, p-Werten und Konfidenzintervallen
r2coef <- getPar(r2, "coef", model="SRRR")
rmarkdown::paged_table(r2coef)

Zugänglichkeit

# Alle RSA-Parameter vom finalen Modell mit robusten SEs, p-Werten und Konfidenzintervallen
r3coef <- getPar(r3, "coef", model="onlyy")
rmarkdown::paged_table(r3coef)

Response surface plot

Zur Darstellung und Interpretation wird das geeignete Modell dreidimensional dargestellt und ein Contourplot erstellt, der anzeigt, wo die beobachteten Daten liegen. 50% sind dabei im inneren Kreis und 50% außerhalb.

Expertise

## Das finale Modell plotten (für weitere optionen ?plotRSA)

# 3d Plot
plot(r1, aces="PA1", model="onlyx",
     project=c("points", "PA1", "LOC", "LOIC", "hull"),
     points=FALSE, xlim=c(-4.1,4.1), ylim=c(-4.1,4.1),
     param=FALSE, legend=TRUE, bw=FALSE,
     pal.range="surface", pal="flip",
     xlab="HILK", ylab="SWE",
     zlab="Expertise")