[,1] [,2]
[1,] 7 12
[2,] 9 8
Pearson's Chi-squared test with Yates' continuity correction
data: data
X-squared = 0.40263, df = 1, p-value = 0.5257
Cramer V
0.1617
How to run bivariate analyses in R
The Total Survey Error (TSE) framework (Biemer, 2010) accounts for the different sources of errors that occur at each stage of an investigation (e.g. coverage errors, selection errors, and measurement errors).
Two important concepts are: reliability and validity.
Reliability refers to the idea of replicability. It accounts for the degree of consistency of a measurement (by different observers, at different times).
Validity addresses the conclusions we can draw from of a measure. For instance, internal validity aims at measuring the fit between the concept and the measure.
Sample statistics are estimators of population parameters. A particular point estimate cannot be expected to be exactly equal to the value of the parameter in the population. Therefore, the estimate always contains a margin of error.
Normal law distribution (or Gaussian curve): suggests that the distribution of a variable is around an average value and the other values increase and decrease in a homogeneous and symmetrical way around this average value.
The margin of error is also called the confidence interval. It corresponds to the area where we know for a given probability that the average or the percentage of a value will be found.
For a mean: \(\overline{x}\pm1.96(\frac{\sigma(X)}{\sqrt{n}})\)
For a proportion: \(Z_\alpha\sqrt{\frac{p(1-p)}{n}}\)
For each cell of the table, we have to calculate the expected value under null hypothesis. For a given cell, the expected value is calculated as follow:
\[ e = \frac{row.sum ∗ col.sum}{grand.total} \] The Chi-square statistic is calculated as follow:
\[ Chi2 = \frac{\sum{(o−e)^2}}{e} \]
General logic: Compare the distribution of values for a quantitative variable across different groups (different categories of the categorical independent variable).
Assumptions (same for ANOVA):
\[ t = \frac{\hat{x_1}-\hat{x_2}}{\sqrt{(\frac{s_1^2}{n1})+(\frac{s_2^2}{n_2})}}\] where \(\hat{x_1}\) and \(\hat{x_2}\) are the sample means, \(s_1^2\) and \(s_2^2\) the sample variances, and \(n_1\) and \(n_2\) the sample sizes.
Key Concepts:
\[ r = \frac{\sum(x−m_x)(y−m_y)}{\sqrt{\sum(x−m_x)^2\sum(y−m_y)^2}} \]
The p-value can be determined by:
\[ t = \frac{r}{\sqrt{1−r^2}}\sqrt{n-2} \] If the p-value is < 5%, then the correlation between x and y is significant.
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">${opt}</div>`
)}
<div style="font-weight: bold">Statements</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")
True or false?
MC_1_1 = [
["I use cross-tables to test a relation between two catagorical variables", "true"],
["Correlations measures the association (direction and strength) of the association between two numeric variables", "true"],
["A t-test is used to determine if there is a significant difference between the means of three groups.", "false"],
["Eta indicates the strenght of the relation between one numeric dependent variable and one categorical independent variable", "true"]
]
viewof answers_1_1 = quizInput({
questions: MC_1_1,
options: ["true", "false"]
})
Punkte_1_1 = {
const Sum =
(answers_1_1[0] == MC_1_1[0][1])*1 +
(answers_1_1[1] == MC_1_1[1][1])*1 +
(answers_1_1[2] == MC_1_1[2][1])*1 +
(answers_1_1[3] == MC_1_1[3][1])*1
var Punkte_1_1 = Sum - 2
if (Punkte_1_1 < 1) {Punkte_1_1 = 0}
return(Punkte_1_1)
}
Score:
Multivariate statistics