Correlation Coefficient (r): Always between -1 and +1
Direction:
- Positive values (+): As one variable increases, the other increases
- Negative values (-): As one variable increases, the other decreases
Strength interpretation:
- ±0.00 to ±0.19: Very weak
- ±0.20 to ±0.39: Weak
- ±0.40 to ±0.59: Moderate
- ±0.60 to ±0.79: Strong
- ±0.80 to ±1.00: Very strong
When looking at statistical output, focus on:
Look for these patterns:
Direction
Positive / Negative \ No relationship •
Strength
Shape
Outliers
Template for writing results: “There was a [strength] [direction] correlation between [variable 1] and [variable 2], r(df) = [value], p = [value]”
Examples: - “There was a strong positive correlation between height and weight, r(28) = 0.75, p < .001” - “Sleep and exam performance showed a moderate positive correlation, r(98) = 0.45, p = .003”
When interpreting correlations, always check:
[ ] Direction (positive/negative)
[ ] Strength (weak/moderate/strong)
[ ] Statistical significance (p-value)
[ ] Sample size
[ ] Any obvious outliers or patterns
[ ] Whether assumptions are met (linear relationship)
Remember: Correlation only measures linear relationships. Two variables might be strongly related in other ways but show low correlation if the relationship isn’t linear.
The standard equation for a bivariate regression model is:
\[Y = \beta_0 + \beta_1X + \varepsilon\]
Where:
- \(Y\) denotes the dependent (outcome)
variable.
- \(X\) denotes the independent
(predictor) variable.
- \(\beta_0\) is the intercept
(constant term), representing the predicted value of \(Y\) when \(X =
0\).
- \(\beta_1\) is the slope coefficient,
representing the amount of change in \(Y\) for a one-unit change in \(X\).
- \(\varepsilon\) represents the
residuals (or error term): the difference between the observed and
predicted values of \(Y\).
Intercept (\(\beta_0\)):
This is the expected value of \(Y\)
when \(X = 0\). For instance, if \(\beta_0 = 5\), the model predicts that
\(Y\) is 5 when there is no
contribution from \(X\).
Slope (\(\beta_1\)):
This indicates how much \(Y\) is
expected to change for each one-unit increase in \(X\). For example, if \(\beta_1 = 2.5\), then for every additional
unit of \(X\), the predicted \(Y\) increases by 2.5 units.
Residuals are the differences between the actual observed values and the values predicted by the model:
\[{Residual} = Y_{observed} - Y_{predicted}\]
When you are given output from a bivariate regression analysis (such as an output table), here’s what to look for:
If you are provided with a regression equation and specific values of \(X\), you can predict \(Y\) by plugging these values into the equation.
Example:
Suppose the estimated regression equation is:
\[\hat{Y} = 10 + 3X\]
To predict \(Y\) when \(X = 4\):
\[ \hat{Y} = 10 + 3(4) = 10 + 12 = 22 \]
This means when \(X=4\), the predicted value of \(Y\) is 22.
Remember:
- Always check the context to determine if the intercept is meaningful.
Sometimes, \(X=0\) may be outside the
range of the data.
- Consider the error (residual) as a measure of uncertainty in your
prediction.
Understand the Story:
Be clear on what the intercept and slope mean in the given context. For
instance, if you’re predicting exam scores from study hours, explain
what each unit change in study hours implies for exam scores.
Check Assumptions:
Ensure linearity, normality, and homoscedasticity by examining residual
plots (even though you don’t have to generate them in the exam, be ready
to critique output).
Report Clearly:
Use a template such as:
“The regression analysis revealed that for every one-unit increase in
\(X\), the predicted value of \(Y\) increases/decreases by \(\beta_1\) units (p < .05). The
intercept, \(\beta_0\), represents the
predicted value of \(Y\) when \(X = 0\). This model explained \(R^2\) of the variance in \(Y\).”
Practice Interpretation:
Look at multiple examples of regression output to get comfortable with
the language and interpretation before the exam.
Basic multiple regression equation:
\[ Y = \beta_0 + \beta_1X_1 + \beta_2X_2 + ... + \beta_kX_k + \varepsilon \]
Where:
\(Y\) = Dependent/outcome variable
\(beta_0\) = Intercept (Y-value when all Xs = 0)
\(beta_1, \beta_2, ..., \beta_k\) = Regression coefficients (slopes) for each predictor
\(X_1, X_2, ..., X_k\) = Independent/predictor variables
\(\varepsilon\) = Error term (residuals)
\(k\) = Number of predictors
Unique Effects:
Each coefficient (\(\beta\)) represents the unique effect of that predictor
“Holding all other variables constant” or “controlling for other variables”
Different from bivariate correlations because other variables are controlled
Multiple R²:
Proportion of variance in Y explained by all predictors together
Range: 0 to 1 (often reported as percentage)
Larger = better overall model fit
Adjusted R²:
Corrected R² that accounts for number of predictors
Always smaller than Multiple R²
Use this when comparing models with different numbers of predictors
For Each Predictor (X):
Look at coefficient (β):
Positive = As X increases, Y increases
Negative = As X increases, Y decreases
Size = Change in Y for one unit increase in X
Check p-value:
p < .05 = “statistically significant”
p > .05 = “not statistically significant”
Check standard error:
For Overall Model:
F-test and its p-value:
Tests if model explains significant variance
If p < .05, model is significant
R² and Adjusted R²:
Template: “The multiple regression model was significant, F(df1, df2) = [value], p = [value], R² = [value]. [Significant predictor] was a significant predictor (β = [value], p = [value]), indicating that for each unit increase in [predictor], [outcome] increased/decreased by [value] units, holding other variables constant.”
Example: “The multiple regression model was significant, F(3, 96) = 15.42, p < .001, R² = .32. Study time was a significant predictor (β = 2.5, p = .003), indicating that for each additional hour of study, test scores increased by 2.5 points, holding other variables constant.”
Given equation: \[ Y = 10 + 2X_1 + 3X_2 - 1X_3 \]
To solve:
1. Plug in values for each X
2. Calculate Y
Example: If X₁ = 5, X₂ = 3, X₃ = 2:
\[ Y = 10 + 2(5) + 3(3) - 1(2) \]
\[ Y = 10 + 10 + 9 - 2 \] \[ Y = 27 \]
Watch out for:
Very high R² (>.90) might indicate multicollinearity
Very different results from bivariate correlations
Non-significant F-test but significant predictors
Coefficients that don’t make theoretical sense
Key assumptions to remember:
Linearity - Independence of observations
Homoscedasticity (equal variance)
Normality of residuals
No perfect multicollinearity
Remember: In the exam, you might be asked to interpret output rather than check assumptions, but knowing them helps understand the limitations of your interpretations.
teaching_method
with levels
interactive
and traditional
, R would set
interactive
as the reference (if “i” comes before “t”). The
dummy variable is then created for traditional
(1 =
traditional, 0 = interactive).D
is the dummy for the non-reference group, then:
Model Example:
Suppose we have two categorical predictors:
teaching_method
(levels: interactive
[reference] and traditional
)assessment_style
(levels: objective
[reference] and subjective
)The regression model might look like:
\[ Y = \beta_0 + \beta_1 D_{teaching} +
\beta_2 D_{assessment} + \varepsilon \]
Interpretation:
teaching_method
: The difference in the outcome between
traditional and interactive teaching, holding assessment style
constant.assessment_style
: The difference in the outcome between
subjective and objective assessments, holding teaching method
constant.Extended Model:
Including a continuous predictor, e.g., study_hours
,
modifies the model:
\[ Y = \beta_0 + \beta_1 D_{teaching} +
\beta_2 D_{assessment} + \beta_3 X_{study} + \varepsilon
\]
Interpretation Changes:
study_hours = 0
. (Note: Check if zero is
meaningful.)study_hours
, assuming
other predictors (including dummy variables) remain constant.study_hours
.Output Example:
Predictor | Estimate | Std. Error | t value | Pr(> |
---|---|---|---|---|
(Intercept) | 50.0 | 2.0 | 25.0 | < .001 |
teaching_methodtraditional | -8.0 | 2.5 | -3.2 | 0.002 |
assessment_stylesubjective | 5.0 | 2.3 | 2.2 | 0.03 |
study_hours | 3.0 | 0.5 | 6.0 | < .001 |
Intercept (50.0):
The predicted outcome for the reference group, i.e., students in the
interactive teaching method with an objective assessment when
study_hours = 0
.
teaching_methodtraditional (-8.0):
When switching from interactive to traditional teaching, the outcome is
expected to decrease by 8 units, holding assessment
style and study hours constant.
assessment_stylesubjective (5.0):
Changing from objective to subjective assessment is associated with a
5-unit increase in the outcome, holding other
predictors constant.
study_hours (3.0):
For every additional hour studied, the outcome is predicted to
increase by 3 units, controlling for teaching method
and assessment style.
Reference Group Matters:
The intercept reflects the reference group defined by your dummy
coding.
Coefficients are Relative:
Dummy coefficients show differences relative to the reference category,
not the absolute effect of being in a given group.
Model Interpretation with Continuous
Variables:
Adding a continuous predictor shifts the meaning of the intercept to the
predicted outcome when that continuous variable is zero, so ensure zero
is a meaningful value or consider centering.
Always Check Output in Context:
Interpret coefficients in light of your specific research question and
data context.
Effect coding is a contrast method where category weights sum to zero (zero-sum contrasts). Unlike dummy coding (which typically uses 0/1), effect coding uses values like -1 and 1. This approach allows for comparing each category’s effect relative to the overall mean rather than a single reference group.
For a categorical variable with two levels (e.g., A and B), effect coding can be represented as:
\[Y = \beta_0 + \beta_1X + \varepsilon\]
However, under effect coding:
- The two levels are coded as:
- Level A: -1
- Level B: 1
Intercept (\(\beta_0\)):
Represents the grand mean (i.e., the mean of all groups), because the
contrast weights sum to zero.
Coefficient (\(\beta_1\)):
Represents the deviation from the grand mean for the effect coded
variable. A positive \(\beta_1\)
indicates that the group coded 1 is above the overall mean, while the
group coded -1 is below it (by the same magnitude).
Assume you have two categorical predictors that are effect coded. For example
Predictor 1: Teaching method
with two levels
(interactive
= -1, traditional
= 1)
Predictor 2: Assessment style
with two levels
(objective
= -1, subjective
= 1)
The multiple regression model becomes:
\[Y = \beta_0 + \beta_1X_1 + \beta_2X_2 + \varepsilon\]
Interpretation:
- Intercept (\(\beta_0\)):
The overall (grand) mean of the outcome across all groups.
- \(\beta_1\) (Teaching Method):
Half the difference between traditional and interactive. Specifically,
if \(\beta_1 = 4\) then the mean for
traditional is \(\beta_0 + 4\) and for
interactive is \(\beta_0 - 4\).
- \(\beta_2\) (Assessment Style):
Similarly, it represents half the difference between subjective and
objective assessment groups.
When a continuous variable is added to an effect coded model, it looks like:
\[Y = \beta_0 + \beta_1X_1 + \beta_2X_2 + \beta_3Z + \varepsilon\]
Where:
- \(Z\) is the continuous predictor
(e.g., study hours).
Interpretation:
- Intercept (\(\beta_0\)):
Represents the predicted outcome when both effect coded predictors are
at their midpoint (their contributions cancel out) and the continuous
variable is 0.
Note: If 0 is not a meaningful value for \(Z\), consider centering it.
- Coefficients for Effect-Coded Variables (\(\beta_1, \beta_2\)):
Indicate the effect each categorical variable has relative to the grand
mean, holding the continuous predictor constant.
- Coefficient for the Continuous Variable (\(\beta_3\)):
Represents the change in the outcome for each one-unit change in \(Z\), holding the categorical effects
constant.
Imagine the regression output is:
Predictor | Estimate | Std. Error | t value | Pr(> |
---|---|---|---|---|
(Intercept) | 70.0 | 3.0 | 23.33 | < .001 |
teaching_method (interactive = -1, traditional = 1) | 6.0 | 2.0 | 3.00 | 0.004 |
assessment_style (objective = -1, subjective = 1) | -4.0 | 2.5 | -1.60 | 0.115 |
study_hours | 2.5 | 0.75 | 3.33 | 0.001 |
Interpretation:
Intercept (70.0):
This is the grand mean of the outcome when the effect coded variables
are at their midpoint (i.e., the average of the two categories) and
study_hours = 0
(if not centered, interpret with
caution).
Teaching Method (6.0):
Indicates that the traditional method (coded as 1) has a predicted
outcome 6 points above the grand mean, while the interactive method
(coded as -1) is 6 points below the grand mean.
Assessment Style (-4.0):
Suggests that the subjective assessment groups (coded as 1) have a
predicted outcome 4 points below the grand mean, while the objective
assessment (coded as -1) is 4 points above the grand mean.
Study Hours (2.5):
For each additional hour of study, the outcome increases by 2.5 units,
irrespective of the categorical groupings.
Zero-Sum Property:
Effect coding ensures that the contrast weights sum to zero, which
shifts the interpretation of the intercept to the grand mean rather than
a specific reference category.
Comparisons are Relative:
Each effect coded coefficient represents half the difference between its
two groups relative to the grand mean.
Inclusion of Continuous Variables:
When adding continuous predictors, the interpretation for categorical
variables remains relative to the overall mean, holding the continuous
variable constant.
Use When Appropriate:
Effect coding is particularly useful when no single category serves as a
natural reference or when the focus is on comparing group effects
against an overall mean.
Orthogonal contrasts compare group means using sets of weights that sum to zero and are independent (i.e., uncorrelated). Two contrasts, say \(c\) and \(d\), are orthogonal if: \[ \sum_{i=1}^{k} w_{c,i} \times w_{d,i} = 0 \] where \(k\) represents the number of groups.
Assume we have three groups with means \(\mu_1\), \(\mu_2\), and \(\mu_3\).
Using the fractional style:
Group 1: \(1\)
Group 2: \(-\frac{1}{2}\)
Group 3: \(\frac{1}{2}\)
Table: Contrast 1 (c₁)
Group | Weight |
---|---|
\(\mu_1\) | \(1\) |
\(\mu_2\) | \(-\frac{1}{2}\) |
\(\mu_3\) | \(\frac{1}{2}\) |
Interpretation:
A positive regression coefficient for \(c₁\) indicates that Group 1’s mean exceeds
the average of Groups 2 and 3 by the value of the coefficient.
Using fractional weights:
Group 1: \(0\)
Group 2: \(\frac{1}{2}\)
Group 3: \(-\frac{1}{2}\)
Table: Contrast 2 (c₂)
Group | Weight |
---|---|
\(\mu_1\) | \(0\) |
\(\mu_2\) | \(\frac{1}{2}\) |
\(\mu_3\) | \(-\frac{1}{2}\) |
Interpretation:
A positive coefficient for \(c₂\) means
that Group 2’s mean is higher than Group 3’s mean.
Compute the dot product of \((c₁\)) and \(c\): \[ (1 \times 0) + \left(-\frac{1}{2} \times \frac{1}{2}\right) + \left(-\frac{1}{2} \times -\frac{1}{2}\right) = 0 - \frac{1}{4} + \frac{1}{4} = 0. \] Since the sum equals 0, \(c₁\) and \(c₂\) are orthogonal.
Now suppose we have four groups with means \(\mu_1\), \(\mu_2\), \(\mu_3\), and \(\mu_4\). Here is one set of orthogonal contrasts using fractional weights:
Suggested weights:
Group 1: \(-\frac{3}{4}\)
Group 2: \(\frac{1}{4}\)
Group 3: \(\frac{1}{4}\)
Group 4: \(\frac{1}{4}\)
Table: Contrast A
Group | Weight |
---|---|
\(\mu_1\) | \(-\frac{3}{4}\) |
\(\mu_2\) | \(\frac{1}{4}\) |
\(\mu_3\) | \(\frac{1}{4}\) |
\(\mu_4\) | \(\frac{1}{4}\) |
Suggested weights:
Group 1: \(0\)
Group 2: \(-\frac{1}{2}\)
Group 3: \(\frac{1}{2}\)
Group 4: \(0\)
Table: Contrast B
Group | Weight |
---|---|
\(\mu_1\) | \(0\) |
\(\mu_2\) | \(-\frac{1}{2}\) |
\(\mu_3\) | \(\frac{1}{2}\) |
\(\mu_4\) | \(0\) |
One possible set of weights:
Group 1: \(0\)
Group 2: \(\frac{1}{4}\)
Group 3: \(\frac{1}{4}\)
Group 4: \(-\frac{1}{2}\)
Table: Contrast C
Group | Weight |
---|---|
\(\mu_1\) | \(0\) |
\(\mu_2\) | \(\frac{1}{4}\) |
\(\mu_3\) | \(\frac{1}{4}\) |
\(\mu_4\) | \(-\frac{1}{2}\) |
Contrast A \(\cdot\) Contrast B: \[ \left(-\frac{3}{4}\times 0\right) + \left(\frac{1}{4} \times -\frac{1}{2}\right) + \left(\frac{1}{4} \times \frac{1}{2}\right) + \left(\frac{1}{4} \times 0\right) = 0 - \frac{1}{8} + \frac{1}{8} + 0 = 0. \]
Contrast A\(\cdot\) Contrast C:
\[ \left(-\frac{3}{4}\times 0\right) +
\left(\frac{1}{4} \times \frac{1}{4}\right) + \left(\frac{1}{4} \times
\frac{1}{4}\right) + \left(\frac{1}{4} \times -\frac{1}{2}\right) = 0
+ \frac{1}{16} + \frac{1}{16} - \frac{1}{8} = 0 \]
Contrast B \(\cdot\) Contrast C:
\[ (0 \times 0) + \left(-\frac{1}{2} \times
\frac{1}{4}\right) + \left(\frac{1}{2} \times \frac{1}{4}\right) + (0
\times -\frac{1}{2}) = 0 - \frac{1}{8} + \frac{1}{8} + 0 =
0 \]
Group | Contrast A | Contrast B | Contrast C | Interpretation |
---|---|---|---|---|
\[\mu_1\] | \[-\frac{3}{4}\] | \[0\] | \[0\] | A: Group 1 vs. average of Groups 2,3,4 |
\[\mu_2\] | \[\frac{1}{4}\] | \[-\frac{1}{2}\] | \[\frac{1}{4}\] | B: Group 2 vs. Group 3 |
\[\mu_3\] | \[\frac{1}{4}\] | \[\frac{1}{2}\] | \[\frac{1}{4}\] | C: Group 4 vs. average of Groups 2,3 |
\[\mu_4\] | \[\frac{1}{4}\] | \[0\] | \[-\frac{1}{2}\] | |
Sum | 0 | 0 | 0 | All contrasts sum to zero |
For a regression model using these contrasts:
\[Y = \beta_0 + \beta_A(\text{Contrast A}) +
\beta_B(\text{Contrast B}) + \beta_C(\text{Contrast C}) +
\varepsilon\]
Comparison Type | Example Weights | Notes |
---|---|---|
One vs. One | \[(0, \frac{1}{2}, -\frac{1}{2}, 0)\] | Compare two specific groups |
One vs. Rest | \[-\frac{3}{4}, \frac{1}{4}, \frac{1}{4}, \frac{1}{4}\] | Compare one group to average of others |
Subset vs. Subset | \[0, \frac{1}{4}, \frac{1}{4}, -\frac{1}{2}\] | Compare average of some groups to others |
Regression analysis relies on several assumptions that must be checked to ensure valid inferences. This section summarizes the main assumptions, the relevant diagnostic plots, and what to look for in each.
Linearity:
The relationship between predictors and the outcome is linear.
Diagnostic: Look for a straight-line pattern in scatterplots
and partially in residual plots.
Independence of Errors:
Observations and their errors are independent.
Homoscedasticity:
The variance of the residuals is constant across all levels of the
predictors.
Diagnostic: Residual versus fitted plots should display a
random scatter with no clear funneling or pattern.
Normality of Residuals:
The residuals are normally distributed.
Diagnostic: Q-Q plots (quantile–quantile plots) should show
points roughly along a 45° line.
No Influential Outliers/High Leverage
Points:
There are no extreme observations that unduly influence the model
fit.
Diagnostic: Leverage statistics and Cook’s distance help
identify points that might be problematic.
Evaluate Plots Together:
No single plot tells the whole story. Use the residual plot, Q-Q plot,
and leverage statistics in conjunction.
Transformations:
If assumptions are violated (e.g., heteroscedasticity or non-normality),
consider data transformations (like logarithmic transformations) or
robust regression methods.
Document Findings:
In exam responses or reports, clearly state which assumptions were
checked, what the plots showed, and if any issues were identified (and
how you might address them).
Red Flag Examples:
These plots effectively illustrate the red flag examples of diagnostic issues:
Heteroscedasticity: Unequal variance in residuals.
Non-linearity: Curved residual patterns.
Outliers/High Leverage: Extreme observations that could unduly influence the estimates.
Number of possible bootstrap samples: \[ \text{Number of possible samples} = \binom{n+n-1}{n} = \frac{(2n-1)!}{n!(n-1)!} \] where n is the sample size
\[ SE_{boot} = \sqrt{\frac{\sum_{i=1}^B (\hat{\theta}_i - \bar{\theta})^2}{B-1}} \]
\[ \bar{\theta} = \frac{\sum_{i=1}^B \hat{\theta}_i}{B} \]
\[ \text{Bias} = \bar{\theta} - \hat{\theta}_{original} \]
Q: Outline the steps for performing a non-parametric bootstrap for a linear regression coefficient.
A:
From original dataset (n observations):
Sample n observations with replacement
Fit regression model
Store coefficient estimate
Repeat process B times (e.g., 2000)
Calculate: Bootstrap SE using stored estimates
Q: Given these bootstrap results for a slope coefficient: - Original estimate: 0.35
Bootstrap mean: 0.34
Bootstrap SE: 0.12
95% CI: [0.11, 0.58]
What can you conclude?
A:
1. Minimal bias (original 0.35 vs bootstrap 0.34)
2. Significant effect (CI excludes 0)
3. Moderate uncertainty (SE = 0.12)
4. Relatively symmetric CI suggests normality
Q: When would you choose BCa intervals over percentile intervals?
A:
1. When there’s evidence of bias in estimates
2. Small sample sizes (n < 50)
3. When distribution of bootstrap estimates is skewed
4. When more precise confidence intervals are needed
5. When computational resources allow for larger B
Remember: Bootstrap is a tool for understanding uncertainty in estimates, not a way to improve the estimates themselves!
Logistic regression is ideal for modeling binary outcomes. Below are the key concepts, interpretation guidelines, and exam questions to help you understand logistic regression.
Consider the following output table from a logistic regression:
Predictor | Coefficient (\(\beta\)) | 95% CI (log-odds) | Odds Ratio (OR) | 95% CI (OR) | p-value |
---|---|---|---|---|---|
(Intercept) | -1.2 | (-1.8, -0.6) | 0.30 | (0.17, 0.55) | <0.001 |
Age | 0.05 | (0.01, 0.09) | 1.05 | (1.01, 1.09) | 0.02 |
Income | 0.002 | (0.0005, 0.0035) | 1.002 | (1.0005, 1.0035) | 0.01 |
Smoker (1=Yes) | 0.7 | (0.3, 1.1) | 2.01 | (1.35, 3.00) | 0.001 |
Intercept:
The log-odds of the outcome when Age = 0, Income = 0, and the subject is
not a smoker is -1.2. The corresponding probability is:
\[ p = \frac{e^{-1.2}}{1+e^{-1.2}} \approx
0.23. \]
Age:
For every one-year increase in age, the log-odds increase by 0.05. The
odds increase by about 5% (OR = 1.05).
Income:
Each unit increase in income (appropriately scaled) increases the
log-odds by 0.002. This is a very small effect on the odds.
Smoker:
Smokers have log-odds that are 0.7 higher than non-smokers. The odds of
the outcome are about twice as high for smokers (OR ≈ 2.01).
Confidence Intervals:
The 95% CI for each predictor indicates the range in which we are 95%
confident that the true coefficient (or OR) lies. For example, the OR
for smoker falls between 1.35 and 3.00, showing a robust increase in
odds.
Q: What is the interpretation of a slope coefficient of 0.05
in terms of odds?
Answer:
1. First, calculate the odds ratio:
\[e^{0.05} = 1.051\]
2. Interpretation:
- For a one-unit increase in the predictor, the odds of the outcome
multiply by 1.051
- This represents a 5.1% increase in the odds
- Since the coefficient is small, we can also say approximately a 5%
increase in odds
Q: How would you convert a log-odds coefficient into an odds
ratio?
Answer:
1. Take the exponential (e^x) of the coefficient
2. Example steps:
- If coefficient β = 0.7
- Odds ratio = e^0.7 = 2.014
- The odds are approximately doubled for a one-unit increase in the
predictor
Q: Given a coefficient of 0.7 for a binary predictor with a
95% CI of (0.3, 1.1), interpret this confidence interval.
Answer:
1. Convert to odds ratios:
- Lower bound: e^0.3 = 1.35
- Coefficient: e^0.7 = 2.01
- Upper bound: e^1.1 = 3.00
Q: How does exponentiating a confidence interval help in
interpreting odds ratios?
Answer:
1. Exponentiating transforms log-odds to odds ratios, which are more
intuitive
2. Key benefits:
- Odds ratios are always positive
- Value of 1 indicates no effect
- Values > 1 indicate increased odds
- Values < 1 indicate decreased odds
3. Example: CI of (-0.5, 0.3) becomes (e^-0.5, e^0.3) = (0.61,
1.35)
- Interpretation: We’re 95% confident the true odds ratio is between
0.61 and 1.35
- Since this CI includes 1, the effect is not statistically
significant
Q: Explain why logistic regression models the log-odds
instead of directly modeling probabilities.
Answer:
1. Key reasons:
- Log-odds can take any real value (-∞ to +∞)
- Probabilities are constrained between 0 and 1
- Log-odds transformation creates a linear relationship with
predictors
- Coefficients can be interpreted as additive effects on log-odds
scale
Q: If the intercept in a model is -1.2, what is the
corresponding predicted probability when all predictors equal
zero?
Answer:
1. Steps to convert log-odds to probability:
\[p = \frac{e^{-1.2}}{1 +
e^{-1.2}}\]
Q: List and explain at least two diagnostic methods to assess
goodness-of-fit.
Answer:
1. Hosmer-Lemeshow Test:
- Groups observations by predicted probabilities
- Compares observed vs. expected frequencies
- Non-significant p-value indicates good fit
- Look for p > 0.05 to suggest adequate fit
Q: How would you interpret an ROC curve?
Answer:
1. Key aspects to examine:
- Area Under Curve (AUC) ranges from 0.5 to 1.0
- AUC = 0.5 suggests no discrimination
- AUC > 0.7 indicates acceptable discrimination
- AUC > 0.8 indicates excellent discrimination
Answer:
1. Intercept (-2.300):
- Log-odds when all predictors are zero
- Probability = e^-2.3/(1 + e^-2.3) = 0.091
- 9.1% probability for non-smokers at age zero
For any odds ratio (OR):
- Percentage change = (OR - 1) × 100%
- For ORs < 1: Percentage change = (1 - OR) × 100% decrease
\[ \text{Percentage increase} = (OR - 1) \times 100\% \]
# Example output
Predictor OR 95% CI
Age 1.25 (1.10, 1.42)
SmokingYes 2.50 (1.80, 3.47)
Exercise 1.75 (1.25, 2.45)
Interpretations:
Age: OR = 1.25 (1.25 - 1) × 100% = 25% increase in odds Smoking: OR = 2.50 (2.50 - 1) × 100% = 150% increase in odds Exercise: OR = 1.75 (1.75 - 1) × 100% = 75% increase in odds
Example
library(performance)
titanic <- carData::TitanicSurvival
titanic$survived_binary <- as.numeric(titanic$survived) - 1
##
## Call:
## lm(formula = survived_binary ~ sex, data = titanic)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.7275 -0.1910 -0.1910 0.2725 0.8090
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.72747 0.01912 38.05 <2e-16 ***
## sexmale -0.53648 0.02382 -22.52 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4127 on 1307 degrees of freedom
## Multiple R-squared: 0.2795, Adjusted R-squared: 0.279
## F-statistic: 507.1 on 1 and 1307 DF, p-value: < 2.2e-16
##
## Call:
## glm(formula = survived_binary ~ sex + age, family = "binomial",
## data = na.omit(titanic))
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.235414 0.192032 6.433 1.25e-10 ***
## sexmale -2.460689 0.152315 -16.155 < 2e-16 ***
## age -0.004254 0.005207 -0.817 0.414
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1414.6 on 1045 degrees of freedom
## Residual deviance: 1101.3 on 1043 degrees of freedom
## AIC: 1107.3
##
## Number of Fisher Scoring iterations: 4
m4_null <- glm(survived_binary ~ 1, family = "binomial", na.omit(titanic))
anova(m4_null, mod.4, test= "Chisq")
## Analysis of Deviance Table
##
## Model 1: survived_binary ~ 1
## Model 2: survived_binary ~ sex + age
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 1045 1414.6
## 2 1043 1101.3 2 313.28 < 2.2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## (Intercept) sexmale age
## 3.43980286 0.08537609 0.99575479
## [1] -91.46239
## [1] -0.424521
For sex, being Male leads to 91% decreased odds of survival.
For every one unit increase in age, the odds of survival decrease by 0.43%. (nbn-significant)
## Waiting for profiling to be done...
## 2.5 % 97.5 %
## (Intercept) 2.37427561 5.0440368
## sexmale 0.06307172 0.1146265
## age 0.98559653 1.0059398
m4_null <- glm(survived_binary ~ 1, family = "binomial", na.omit(titanic))
m4_sex <- glm(survived_binary ~ sex, family = "binomial", na.omit(titanic))
m4_full <- glm(survived_binary ~ sex + age, family = "binomial", na.omit(titanic))
## df AIC
## m4_null 1 1416.620
## m4_sex 2 1106.008
## m4_full 3 1107.339
## df BIC
## m4_null 1 1421.573
## m4_sex 2 1115.914
## m4_full 3 1122.197
\[ \text{Power} = f(\text{Effect Size}, \text{Sample Size}, \alpha) \]
Cohen’s d: \[ d = \frac{\mu_1 - \mu_2}{\sigma_{pooled}} \] where σ_pooled is the pooled standard deviation
Standardized Guidelines:
Required sample size per group: \[ n_{per group} = 2\left(\frac{(z_α + z_β)}{d}\right)^2 \]
Total sample size: \[ N_{total} = 2n_{per group} \]
Q: A researcher wants to detect a medium effect size (d = 0.5) using an independent samples t-test. What sample size per group is needed for 80% power with α = 0.05?
A: 1. Using the formula: \[ n_{per group} = 2\left(\frac{(1.96 + 0.84)}{0.5}\right)^2 \] 2. n ≈ 64 per group 3. Total N needed = 128
Q: Given these values from a study:
- Mean Group 1 = 75
- Mean Group 2 = 65
- Pooled SD = 20
Calculate and interpret Cohen’s d.
A: 1. d = (75 - 65)/20 = 0.5
2. This represents a medium effect size
3. Means differ by half a standard deviation
Q: A study found no significant difference between groups (p = 0.08). Sample size was 20 per group. What issues might exist regarding statistical power?
A:
1. Likely underpowered study
2. Small sample size increases Type II error risk
3. Should calculate achieved power
4. Consider effect size and practical significance
5. Results might be inconclusive rather than “no effect”
\[ \text{Power} = 1 - \beta \] \[ \text{Required N} = f(\alpha, \text{power}, \text{effect size}) \]
\[ d = \frac{\mu_1 - \mu_2}{\sigma_{pooled}} \] \[ \eta^2 = \frac{SS_{effect}}{SS_{total}} \]
Remember:
- Always conduct power analysis before data collection
- Consider practical and statistical significance
- Report effect sizes alongside p-values
- Use appropriate effect size measures for your analysis
cat x cat Interactions
Power
Aff R2/F/Model comparison to document