Mediator = Middle, Moderator = Magnitude
A mediator lies in the middle of the road between X and Y; a moderator decides the magnitude (strength) of the effect.
30 mnemonics
Mediator = Middle, Moderator = Magnitude
A mediator lies in the middle of the road between X and Y; a moderator decides the magnitude (strength) of the effect.
Confounder = Corrupts the relationship
A confounder stands outside the path and corrupts the relationship between X and Y with a third cause.
68 - 95 - 99.7: one, two, three sigma
One sigma gives 68%, two sigma 95%, three sigma 99.7% of the values.
1.64 - 1.96 - 2.58 for 90 - 95 - 99
Higher confidence level, larger critical value, wider interval.
Four times n, half the SE
SE uses the square root of n: to halve it n must become four times larger.
Strata = Spread over all groups, Cluster = Complete from a few groups
With stratified sampling you draw from every group; with cluster sampling you choose a few whole groups and measure inside them.
Internal = In here, External = Elsewhere too
Internal validity is about the source (here), external validity about generalising (elsewhere).
Selection = Selected beforehand, Non-response = Nobody home, Response = Remarkable answers
Selection bias lies in the design, non-response bias in who stays away, response bias in what people say.
Pearson = Points straight, Spearman = Stays rising in ranks
Pearson measures linear association; Spearman uses ranks and fits a rising relationship that is not straight.
A, B, C, F, X: A to B, B to A, Chance, Feedback, X as confounder
Always run through the five explanations before you draw a causal conclusion.
p low, H0 must go: at p <= alpha you cross the boundary and reject H0.
If p <= alpha you reject H0; if p is greater, H0 stays.
Type I is the smoke detector that goes off without a fire: H0 (no fire) is wrongly rejected. Type II is a fire without an alarm.
Type I: rejecting H0 while it is true, probability alpha. Type II: maintaining H0 while it is false, probability beta.
One group against a value, or two groups, or linked: t-test. Three or more groups: ANOVA. Proportion or known sigma: z-test. Two categorical variables: chi-square.
First the type of data (numeric or categorical), then the number of groups, only then the test.
H0 is innocent. You convict (reject H0) only with convincing evidence. Acquittal does not mean proven innocent.
Maintaining H0 is not proof that H0 is true, only that evidence against H0 is lacking.
Seven tenths is the bar: a Cronbach's alpha above 0.7 is acceptable; below it you take care, and negative points to a coding error.
Alpha above 0.7 means acceptable internal consistency; negative: flip reverse coded items.
Accurate, consistent, complete, reliable: use them as a checklist of what you want after cleaning.
Go through the four properties: is it right, is it noted the same way, is nothing missing, can you rely on it?
With an outlier first ask (investigate), only then delete (remove) or tame (transform).
You remove only clear errors; rare valid values you investigate or transform.
rbind = rows stacked (same columns), merge = columns side by side via a key.
Same columns: rbind. Different columns with a shared key: merge.
Normalization scales to [0, 1]; standardization gives z-scores without a limit.
Normalization: range 0 to 1. Standardization: mean 0, spread 1, unbounded.
mutate() adds a column and leaves all rows; summarise() gives one row per group.
Ask: do I want as many rows as before (mutate) or one row per group (summarise)?
SSE on top: Success first (explained = SSE)
R-squared = SSE/SST: the explained variation is in the numerator. SSR is the residual (Rest). SST = SSE + SSR.
How many standard errors is b away from zero?
t = b / SE: if the estimate is more than about 2 standard errors from zero, it is significant at 5%.
One dummy fewer than categories (k - 1)
The missing category is the reference group; the intercept belongs to that group and each dummy is the difference.
Slope = b1 + b3 x2: the slope moves along
With an interaction term the effect of x1 depends on x2. You always read the effect at a chosen value of x2.
VIF = 1 / (1 - R2_j): at R2_j = 0.8 the VIF is 5
The better the other predictors explain x_j, the higher the VIF and the larger the standard error of x_j.
Log in, odds out: exp(b) gives the odds ratio
The coefficient is in log-odds; take exp() to get the factor on the odds.
Sensitivity searches, precision checks
Sensitivity: what share of the real cases you find (denominator TP + FN). Precision: what share of your alerts is right (denominator TP + FP).
Lower is wider: catch more, more false alarms
A lower threshold raises sensitivity and lowers specificity.
Train top, test flop
Much better on the training set than on the test set means overfitting.
AIC: smaller is better, less is more
A lower AIC is better; extra parameters are penalised with 2k.