unable to load module
unable to load module
unable to load module
Nonmetrische Zusammenhangsmasse
Beantwortet so kurz wie möglich und nur so ausführlich wie nötig die folgenden offenen Fragen.
Was ist der Vorteil, wenn man sich das Konfidenzintervall eines Korrelationskoeffizienten anschaut, statt r nur gegen die Nullhypothese H0 zu testen?
Welchen Kennwert für Korrelation bei
kennen Sie?
Wenn Spearman’s ρ allgemeiner angewendet werden kann als Pearson’s r, warum nimmt man dann nicht immer einfach Spearman?
a) Erklären Sie kurz das Prinzip von Bootstrapping.
b) Was bringt Bootstrapping für Vorteile?
Was ist das Ziel der Poweranalyse?
Was ist das Problem, wenn eine Stichprobe für die Power eines Testes zu klein ist?
Was sind in R Typumwandlungen und wozu braucht man das?
MC 11.1: Sind folgende Aussagen richtig oder falsch?
MC_11_1 = [
["Auch für Korrelationskoeffizienten kann man Konfidenzintervalle berechnen.", "richtig"],
["Das Konfidenzintervall von r ist immer grösser als die Summe der Standardabweichungen.", "falsch"],
["Schliesst das KI von r die 0 ein, ist r nicht signifikant von 0 verschieden.", "richtig"],
["Überschneiden sich die KIs von zwei Korrelationskoeffizienten nicht, sind sie signifikant voneinander unterschieden.", "richtig"]
]
viewof answers_11_1 = quizInput({
questions: MC_11_1,
options: ["richtig", "falsch"]
})
Punkte_11_1 = {
const Sum =
(answers_11_1[0] == MC_11_1[0][1])*1 +
(answers_11_1[1] == MC_11_1[1][1])*1 +
(answers_11_1[2] == MC_11_1[2][1])*1 +
(answers_11_1[3] == MC_11_1[3][1])*1
var Punkte_11_1 = Sum - 2
if (Punkte_11_1 < 1) {Punkte_11_1 = 0}
return(Punkte_11_1)
}
unable to load module
unable to load module
unable to load module
Punkte: unable to load module
MC 11.2: Sind folgende Aussagen richtig oder falsch?
MC_11_2 = [
["Bei kategorialen Variablen kann man Spearman's 𝜌 berechnen.", "richtig"],
["Bei dichotomen Variablen kann man Pearsons r berechnen.", "falsch"],
["Der Phi-Koeffizient für dichotome Variablen ist dasselbe wie r.", "richtig"],
["Die Punkt-Biseriale Korrelation ist dasselbe wie r.", "richtig"]
]
viewof answers_11_2 = quizInput({
questions: MC_11_2,
options: ["richtig", "falsch"]
})
Punkte_11_2 = {
const Sum =
(answers_11_2[0] == MC_11_2[0][1])*1 +
(answers_11_2[1] == MC_11_2[1][1])*1 +
(answers_11_2[2] == MC_11_2[2][1])*1 +
(answers_11_2[3] == MC_11_2[3][1])*1
var Punkte_11_2 = Sum - 2
if (Punkte_11_2 < 1) {Punkte_11_2 = 0}
return(Punkte_11_2)
}
unable to load module
unable to load module
unable to load module
Punkte: unable to load module
MC 11.3: Sind folgende Aussagen richtig oder falsch?
MC_11_3 = [
["Beim Bootstrapping werden aus einer bestehenden Stichprobe sehr viele Stichproben mit demselben Umfang gezogen.", "richtig"],
["Beim Bootstrapping werden für jede der Zufallsstichproben die KIs berechnet.", "falsch"],
["Mit Bootstrapping kann man die KIs von Kennwerten bestimmen, ohne dass Vorraussetzungen wie die Normalverteilung erfüllt sein müssen.", "richtig"],
["Bootstrapping kann man nicht in R nutzen.", "falsch"]
]
viewof answers_11_3 = quizInput({
questions: MC_11_3,
options: ["richtig", "falsch"]
})
Punkte_11_3 = {
const Sum =
(answers_11_3[0] == MC_11_3[0][1])*1 +
(answers_11_3[1] == MC_11_3[1][1])*1 +
(answers_11_3[2] == MC_11_3[2][1])*1 +
(answers_11_3[3] == MC_11_3[3][1])*1
var Punkte_11_3 = Sum - 2
if (Punkte_11_3 < 1) {Punkte_11_3 = 0}
return(Punkte_11_3)
}
unable to load module
unable to load module
unable to load module
Punkte: unable to load module
SC 11.4: Was versucht man mit Hilfe von Poweranalysen zu bestimmen?
SC_11_4 = [
[
"die Effektstärke",
"die Power",
"den Stichprobenumfang n",
"das Signifikanznviveau",
"den β-Fehler"
],
2 // Index der richtigen Antwort
]
viewof answer_SC_11_4 = singleChoiceInput({
options: SC_11_4[0],
correctIndex: SC_11_4[1]
})
Punkte_SC_11_4 = {
const correctIndex = SC_11_4[1];
return answer_SC_11_4 === correctIndex ? 1 : 0;
}
Punkte: 0
MC 11.5: Sind folgende Aussagen richtig oder falsch?
MC_11_5 = [
["Kennwerte haben unterschiedliche Power.", "richtig"],
["Power ist eine Eigenschaft von Stichproben.", "falsch"],
["Poweranalysen werden herangezogen, um Mindeststichprobengrössen zu bestimmen.", "richtig"],
["Die Effektstärke ist die Grösse, die eine Ursache annehmen kann.", "falsch"]
]
viewof answers_11_5 = quizInput({
questions: MC_11_5,
options: ["richtig", "falsch"]
})
Punkte_11_5 = {
const Sum =
(answers_11_5[0] == MC_11_5[0][1])*1 +
(answers_11_5[1] == MC_11_5[1][1])*1 +
(answers_11_5[2] == MC_11_5[2][1])*1 +
(answers_11_5[3] == MC_11_5[3][1])*1
var Punkte_11_5 = Sum - 2
if (Punkte_11_5 < 1) {Punkte_11_5 = 0}
return(Punkte_11_5)
}
unable to load module
unable to load module
unable to load module
Punkte: unable to load module
MC 11.6: Sind folgende Aussagen richtig oder falsch?
MC_11_6 = [
["In R sind «tibbles» besondere «data frames» die im tidyverse verwendet werden.", "richtig"],
["Jeder «data frame» ist auch ein «tibble»", "falsch"],
["Wenn man in R eine ANOVA berechnen möchte, muss man vorher die UV in eine character-Variable umwandeln.", "richtig"],
["Typumwandlung ist die Umwandlung eines «data frames» in ein «tibble».", "falsch"]
]
viewof answers_11_6 = quizInput({
questions: MC_11_6,
options: ["richtig", "falsch"]
})
Punkte_11_6 = {
const Sum =
(answers_11_6[0] == MC_11_6[0][1])*1 +
(answers_11_6[1] == MC_11_6[1][1])*1 +
(answers_11_6[2] == MC_11_6[2][1])*1 +
(answers_11_6[3] == MC_11_6[3][1])*1
var Punkte_11_6 = Sum - 2
if (Punkte_11_6 < 1) {Punkte_11_6 = 0}
return(Punkte_11_6)
}
unable to load module
unable to load module
unable to load module
Punkte: unable to load module
MC 11.7: Sind folgende Aussagen richtig oder falsch?
MC_11_7 = [
["Importiert man Daten (zB aus Excel) bestimmt R Variablen-Typen automatisch.", "richtig"],
["Wenn man in einer Textspalte (in einer Exceldatei) eine reine Zahl hat, wird beim Import der Typ als «numeric» festgelegt.", "falsch"],
["Wenn man in einer Zahlenspalte (in einer Exceldatei) einen Buchstaben hat, wird beim Import der Typ als «character» festgelegt.", "richtig"],
["«factors» in R sind kategoriale Variablen, deren Level und Label man festlegen kann.", "richtig"]
]
viewof answers_11_7 = quizInput({
questions: MC_11_7,
options: ["richtig", "falsch"]
})
Punkte_11_7 = {
const Sum =
(answers_11_7[0] == MC_11_7[0][1])*1 +
(answers_11_7[1] == MC_11_7[1][1])*1 +
(answers_11_7[2] == MC_11_7[2][1])*1 +
(answers_11_7[3] == MC_11_7[3][1])*1
var Punkte_11_7 = Sum - 2
if (Punkte_11_7 < 1) {Punkte_11_7 = 0}
return(Punkte_11_7)
}
unable to load module
unable to load module
unable to load module
Punkte: unable to load module
Prüfungssimulation mit «Rechnerin»
Wechseln Sie in unseren OLAT-Kurs und gehen dort auf “Testaufgaben Rechnerin”, starten Sie den Test und lösen Sie die Aufgaben mit der Rechnerin (dort auch nochmal verlinkt).
round = (n, places) => {
if (!places) return Math.round(n);
const d = 10 ** places;
return Math.round(n * d) / d;
}
function textReplacementWithText({ text, placeholder, correctText, fontFamily = "monospace", color = "#000000" }) {
const parts = text.split(/\{\{input\}\}/); // Teilt den Text an den Eingabestellen
const root = htl.html`<div style="font-size: HUGE; margin-top: -40; margin-bottom: -40; margin-left: -50px; line-height: 1.8; font-family: ${fontFamily}; color: ${color}; white-space: pre-wrap; text-indent: 0; display: flex; align-items: baseline;">
<div style="flex: 1;">
${parts.map((part, index) =>
htl.html`${part}${index < parts.length - 1 ? htl.html`<span style="display: inline-flex; align-items: baseline;">
<input
type="text"
placeholder="${placeholder}"
style="padding: 3px; font-size: HUGE; border: 1px solid #ccc; margin-left: 35px; border-radius: 4px; width: calc(${correctText.length}ch + 1em); font-family: ${fontFamily}; color: ${color}; text-align: right; box-sizing: border-box; margin-right: 0.2em;"
oninput=${(e) => {
const feedbackElement = root.querySelector(`#feedback-final`);
const allInputsCorrect = Array.from(root.querySelectorAll("input")).every((input) => input.value.trim() === correctText.trim());
if (allInputsCorrect) {
feedbackElement.textContent = "💚";
feedbackElement.style.color = "green";
} else {
feedbackElement.textContent = "🔴";
feedbackElement.style.color = "red";
}
}}
/></span>` : ""}`
)}
</div>
<span id="feedback-final" style="font-weight: bold; font-size: HUGE; margin-left: 0.5em; color: inherit;"></span>
</div>`;
return root;
}
function textReplacementTask({ placeholder, correctText, width = "300px", fontFamily = "monospace", color = "black" }) {
let enteredText = "";
const root = htl.html`<div style="font-size: 14px; line-height: 1.5; margin-bottom: 20px;">
<h4>Bitte ersetzen Sie den Text:</h4>
<!-- Eingabefeld -->
<div style="display: flex; align-items: center;">
<input
type="text"
placeholder="${placeholder}"
style="padding: 5px; font-size: 14px; border: 1px solid #ccc; border-radius: 4px; width: ${width}; font-family: ${fontFamily}; color: ${color};"
onInput=${(e) => {
enteredText = e.target.value;
root.value = enteredText;
root.dispatchEvent(new CustomEvent("input"));
updateFeedback();
}}
/>
<!-- Feedback -->
<div id="feedback" style="font-weight: bold; font-size: 14px; margin-left: 10px; text-align: left; white-space: nowrap; color: inherit;"></div>
</div>
</div>`;
// Funktion zur Aktualisierung des Feedbacks
function updateFeedback() {
const feedbackElement = root.querySelector("#feedback");
if (enteredText.trim() === correctText.trim()) {
feedbackElement.textContent = "💚";
feedbackElement.style.color = "green";
} else if (enteredText.trim() === "") {
feedbackElement.textContent = "";
} else {
feedbackElement.textContent = "🔴";
feedbackElement.style.color = "red";
}
}
root.value = null;
return root;
}
function singleChoiceInput({ options, correctIndex }) {
let selectedAnswer = null;
const root = htl.html`<div style="font-size: HUGE; line-height: 1.5; margin-bottom: 0px;">
<!-- Antworten -->
<div style="display: grid; row-gap: 12px;">
${options.map(
(option, index) =>
htl.html`<div style="display: flex; align-items: center;">
<!-- Radiobutton und Option -->
<label style="display: flex; align-items: center; padding-left: 4pt; font-weight: normal;">
<input
type="radio"
name="singleChoice"
value=${index}
style="margin-right: 10px;"
onChange=${() => {
selectedAnswer = index;
root.value = selectedAnswer;
root.dispatchEvent(new CustomEvent("input"));
updateFeedback();
}}
/>
<span>${option}</span>
</label>
<!-- Feedback -->
<div id="feedback-${index}" style="font-weight: bold; font-size: 14px; margin-left: 10px; text-align: left; white-space: nowrap; color: inherit;"></div>
</div>`
)}
</div>
</div>`;
// Funktion zur Aktualisierung des Feedbacks
function updateFeedback() {
options.forEach((_, index) => {
const feedbackElement = root.querySelector(`#feedback-${index}`);
if (selectedAnswer === index) {
feedbackElement.textContent =
index === correctIndex ? "💚" : "🔴";
feedbackElement.style.color = index === correctIndex ? "green" : "red";
} else {
feedbackElement.textContent = ""; // Löscht Feedback für nicht ausgewählte Optionen
}
});
}
root.value = null;
return root;
}
function quizInput({ questions, options}) {
let answers = questions.map(() => null);
let root = htl.html`<div
style="
display: grid;
grid-template-columns: 10% 10% 70% 10%;"
>
${options.map(
(opt) => htl.html`<div style="font-weight: bold; font-size: HUGE">${opt}</div>`
)}
<div style="font-weight: bold">Aussagen</div>
<div style="font-weight: bold"></div>
${Array.from(questions.entries(), ([i, [question, correct]]) =>
quizInputRow({
question,
options,
correct,
onChange: (newAnswer) => {
answers[i] = newAnswer;
root.value = answers;
root.dispatchEvent(new CustomEvent("input"));
}
})
)}
</div>`;
root.value = answers;
return root;
}
function quizInputRow({
question,
options,
correct,
onChange = () => {}
}) {
let root = htl.html`<div>`;
function setAnswer(answer, initial = false) {
morph(
root,
htl.html`<div style="display: contents">
<form style="display: contents">
${options.map(
(opt) =>
htl.html`<label> </label>
<input
name=${question}  
type="radio"
value="${opt}"
checked=${opt === answer}
onChange=${() => setAnswer(opt)}
>
</input>`
)}
</form>
<div>${question}</div>
<div>   ${
answer === null ? "" : answer === correct ? "💚" : "🔴"
}</div>
</div>`
);
root.value = answer;
if (!initial) {
root.dispatchEvent(new CustomEvent("input"));
onChange(answer);
}
}
setAnswer(null, true);
return root;
}
morph = require("https://bundle.run/nanomorph@5.4.2")
unable to load module
unable to load module
RequireError: unable to load module
ToDo Hausaufgabe: «HA-Woche-11.qmd». Sie finden hier die benötigte Zip-Datei mit drei Umfragedatensätzen.
Ablauf etwa gleich wie auch schon:
Wenn ihr in R noch üben möchtet, ohne dass noch viel Neues dazukommt, steht euch hier von der Tutorin Martina Di Marco die Übung «Pixar Movies» (inklusive Lösungen) zur Verfügung.
Bis nächste Woche!