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.
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) ..."
Es werden über Modellparameter und Fit-Indizes alle Modelle miteinander verglichen und das bestgeeignetste ausgewählt
# Plot mit Modellvergleichen
a1 <- aictab(r1, plot=TRUE)
a2 <- aictab(r2, plot=TRUE)
a3 <- aictab(r3, plot=TRUE)
rmarkdown::paged_table(a1)
rmarkdown::paged_table(a2)
rmarkdown::paged_table(a3)
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 ..."
# Alle RSA-Parameter vom finalen Modell mit robusten SEs, p-Werten und Konfidenzintervallen
r1coef <- getPar(r1, "coef", model="onlyx")
rmarkdown::paged_table(r1coef)
# Alle RSA-Parameter vom finalen Modell mit robusten SEs, p-Werten und Konfidenzintervallen
r2coef <- getPar(r2, "coef", model="SRRR")
rmarkdown::paged_table(r2coef)
# Alle RSA-Parameter vom finalen Modell mit robusten SEs, p-Werten und Konfidenzintervallen
r3coef <- getPar(r3, "coef", model="onlyy")
rmarkdown::paged_table(r3coef)
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.
## 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")
plot(r1, points=TRUE, model="onlyx", axes="PA1",
xlim=c(-4.1, 4.1), ylim=c(-4.1, 4.1), showSP=FALSE,
legend=TRUE, bw=FALSE, pal.range="surface", pal="flip",
xlab="HILK", ylab="SWE",
zlab="Expertise", type="contour")
## Das finale Modell plotten (für weitere optionen ?plotRSA)
# 3d Plot
plot(r2, aces="PA1", model="SRRR",
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="Persönliche Interaktion")
plot(r2, points=TRUE, model="SRRR", axes="PA1",
xlim=c(-4.1, 4.1), ylim=c(-4.1, 4.1), showSP=FALSE,
legend=TRUE, bw=FALSE, pal.range="surface", pal="flip",
xlab="HILK", ylab="SWE",
zlab="Persönliche Interaktion", type="contour")
## Das finale Modell plotten (für weitere optionen ?plotRSA)
# 3d Plot
plot(r3, aces="PA1", model="onlyy",
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="Zugänglichkeit")
plot(r3, points=TRUE, model="onlyy", axes="PA1",
xlim=c(-4.1, 4.1), ylim=c(-4.1, 4.1), showSP=FALSE,
legend=TRUE, bw=FALSE, pal.range="surface", pal="flip",
xlab="HILK", ylab="SWE",
zlab="Zugänglichkeit", type="contour")
Es wird die Interaktion von kognitiven Fähigkeiten
(Ravens APM) und selbsteingeschätztem IQ auf Quellendimensionen (Expertise, Zugänglichkeit & Persönliche Interaktion) berechnet.
RSA Berechnung
# RSA durchführen und Ergebnisse in r1 speichern
r4 <-RSA(qual ~ Rohwert_APM*iq_se_anf, 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) ..."
r5 <-RSA(pers ~ Rohwert_APM*iq_se_anf, 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) ..."
r6 <-RSA(zug ~ Rohwert_APM*iq_se_anf, 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) ..."
Es werden über Modellparameter und Fit-Indizes alle Modelle miteinander verglichen und das bestgeeignetste ausgewählt
# Plot mit Modellvergleichen
a4 <- aictab(r4, plot=TRUE)
a5 <- aictab(r5, plot=TRUE)
a6 <- aictab(r6, plot=TRUE)
rmarkdown::paged_table(a4)
rmarkdown::paged_table(a5)
rmarkdown::paged_table(a6)
Für die bestgeeigneten Modelle werden robuste Fehlerwerte und Konfidenzintervalle unter bootstraping berechnet.
details
# Konfidenzintervalle mit robusten SE
#CI.SQD <- confint(r4, model="SQD")
# Percentile bootsrap Konfidenzintervalle und p-Werte
# Dies kann mehrere Minuten dauern
#CI.boot.SQD <- confint(r4, model="SQD",
# method="boot", R=1000,
# parallel="multicore", ncpus=4)
# Konfidenzintervalle mit robusten SE
#CI.null <- confint(r5, model="null")
# Percentile bootsrap Konfidenzintervalle und p-Werte
# Dies kann mehrere Minuten dauern
#CI.boot.null <- confint(r5, model="null",
# method="boot", R=1000,
# parallel="multicore", ncpus=4)
# Konfidenzintervalle mit robusten SE
CI.onlyx2 <- confint(r6, model="onlyx2")
# Percentile bootsrap Konfidenzintervalle und p-Werte
# Dies kann mehrere Minuten dauern
#CI.boot.onlyx2 <- confint(r6, model="onlyx2",
# method="boot", R=1000,
# parallel="multicore", ncpus=4)
# Alle RSA-Parameter vom finalen Modell mit robusten SEs, p-Werten und Konfidenzintervallen
r4coef <- getPar(r4, "coef", model="SQD")
rmarkdown::paged_table(r4coef)
# Alle RSA-Parameter vom finalen Modell mit robusten SEs, p-Werten und Konfidenzintervallen
#r5coef <- getPar(r5, "coef", model="null")
#rmarkdown::paged_table(r5coef)
# Alle RSA-Parameter vom finalen Modell mit robusten SEs, p-Werten und Konfidenzintervallen
r6coef <- getPar(r5, "coef", model="onlyx2")
rmarkdown::paged_table(r6coef)
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.
## Das finale Modell plotten (für weitere optionen ?plotRSA)
# 3d Plot
plot(r4, aces="PA1", model="SQD",
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="Raven APM", ylab="IQ Selbsteinschätzung",
zlab="Expertise")
plot(r4, points=TRUE, model="SQD", axes="PA1",
xlim=c(-4.1, 4.1), ylim=c(-4.1, 4.1), showSP=FALSE,
legend=TRUE, bw=FALSE, pal.range="surface", pal="flip",
xlab="Raven APM", ylab="IQ Selbsteinschätzung",
zlab="Expertise", type="contour")
## Das finale Modell plotten (für weitere optionen ?plotRSA)
# 3d Plot
#plot(r5, aces="PA1", model="null",
# 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="Raven APM", ylab="IQ Selbsteinschätzung",
# zlab="Persönliche Interaktion")
#plot(r5, points=TRUE, model="null", axes="PA1",
# xlim=c(-4.1, 4.1), ylim=c(-4.1, 4.1), showSP=FALSE,
# legend=TRUE, bw=FALSE, pal.range="surface", pal="flip",
# xlab="Raven APM", ylab="IQ Selbsteinschätzung",
# zlab="Persönliche Interaktion", type="contour")
# Contour Plot
plot(r6, aces="PA1", model="onlyx2",
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="Raven APM", ylab="IQ Selbsteinschätzung",
zlab="Zugänglichkeit")
plot(r6, points=TRUE, model="onlyx2", axes="PA1",
xlim=c(-4.1, 4.1), ylim=c(-4.1, 4.1), showSP=FALSE,
legend=TRUE, bw=FALSE, pal.range="surface", pal="flip",
xlab="Raven APM", ylab="IQ Selbsteinschätzung",
zlab="Zugänglichkeit", type="contour")