Logistic Regression Continued Flashcards

1
Q

Why would we include more than one variable in a model?

A
  • Investigate multiple associations at once
  • Adjust for confounding
  • Model effect modification
  • Increase the power of analysis of randomised trials
  • Provide better predictions by accurately modelling data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

When conducting regression with binary data what can be used?

A

Logistic regression

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does logistic regression involve?

A

Modelling the log odds (logit) of the probability of outcome

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Why is the logit link used instead of the log odds?

A

The logit link is used so we can model probability on a linear scale;probability is bounded between 0 and 1

The log odds takes any number from -infinity to +infinity. It is unbounded

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What do we measure the log odds with in a logistic regression?

A

A linear predictor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

To interpret coefficients how must we exponentiate them?

A

exp(Bo) = eBo= odds of Y = 1 when x1= 0

if x1 is binary
exp(B1) = eB1= odds ratio comparing x1 = 1 when x1= 0

if x1 is continuous

exp(B1) = eB1= odds ratio comparing x1 = x+1 to x1=x

i.e odds ratio for a one unit increase in x1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What else needs to be exponentiated?

A

Confidence intervals

Lower limits(OR) = ell

Upper limits(OR) = eul

Standard errors are given on the log scale and thus do not need to calculate CIs from standard errors on the odds ratio scale

An odds ratio of 1 means no effect - CI significant if excludes 1

p-values need no exponentiating

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

When doing logistic regression what is assumed?

A
  1. Outcome is binary
  2. Observations are independent, conditional on covariates in the model
  3. The linear predictor is correctly specified
    * The log odds are correctly modelled by additive combinations of the variables in the model
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The linear predictor can contain as many variables as we need

True or false

A

True

log(p(y=1)/1-P(Y=1) = B0, B1x1, B2x2, B3x3, B4x4…

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Exponentiating any coefficient gives what?

A

An odds ratio that can be interpreted as with the single variable model

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are coefficients now conditional upon?

A

Other coefficients in the model

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How must categorical variables be handled and what is this sometimes called?

A

By splitting into multiple binary variables

Sometimes called one hot endcoding

There will be one less variable than categories, the category with no variable is the reference category
* E.g. race (coded as White, Black, Hispanic, Other)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Coefficients for categorical variables are relative to what?

A

Reference category

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How must categorical variables be coded to be used in regression and what can they have?

A

Numerically and they can have value labels

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Putting what in front of a variable in stata tells it to treat it as categorical?

What happens if this is not included?

A

an i.

Stata will treat the variable as continuous

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

In stata what is the default category?

A

The one with the lowest number
- The default category can be changed by having b# in front of the i
- They can have value labels
Eg. to have the category coded as 4 as reference

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q
  1. What happens when a categorical variable is added to a model?
  2. What needs to be done consequentially?
A

You add more than one variable and will get more than one p-value reported

Correctly test whether there is an association between the categorical variable and the outcome a joint test must be carried out

Two types of test:

Wald test: Simpler to implement

  • Generally give same result

Likelihood ratio test: Better statistical properties

  • It is best practice to report the p-value from the joint rather than the p-values for individual categories
  • Report confidence intervals and estimates for individual categories
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What can a likelihood ratio
test be used to compare?

A

Nested models

  • Model A is said to be nested in model B if model B contains at least all the variables that are in model A
    E.g. a model adjusting for age and smoking is nested in a model adjusting for age, smoking and gender.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What does likelihood refer to?

A

How likely the data is to be observed based on the parameter estimates.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What do Likelihood ratio tests compare?

A

The likelihood from the two models

Fit both models
Compare the likelihood

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What do Wald tests use?

A

A quadratic approximation to the likelihood to calculate p-values based on the fitted model only

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

The p-values you see in the output from linear regression are what?

A

Wald tests

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Joint tests (Likelihood ratio or Wald tests) must be used when..

A

Testing associations of categorical variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Odds ratios from multiple logistic regression are conditional on what?

A

Other variables in the model

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What is the table 2 fallacy?

A

Reports of multiple adjusted effect estimates from a single model. This practice, which remains common in published literature, can be problematic when different types of effect estimates are presented together in a single table.

It is not obvious how to interpret coefficients
* There are different reasons why a variable may show no effect
* Keep in mind:
* Confounders
* Mediation
* Colliders

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

If a third variable is a common cause of both the variable of interest and the outcome it is called what?

A

A confounder

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

What happens if we do not adjust for the confounder?

A

The association between the variable and outcome will be distorted

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

What will adjusting for the confounder reveal?

A

The correct association

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

Confounders lie on the causal pathway between the variable of interest and outcome

True or false

A

FALSE
Confounders do not lie on the causal pathway between the variable of interest and outcome

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

If a variable lies on the causal pathway between variable of interest and outcome it is called what?

A

A mediator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

What will adjusting for a mediator reduce?

A

The association between the variable of interest and outcome

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

If a variable is caused by both the outcome and exposure it is called what?

A

A collider

33
Q

Adjusting for the collider distorts what?

A

The association between outcome and exposure

34
Q

What is an example of a collider?

A

Hospital admission

Adjusting for hospital admission can make two
unrelated conditions appear associated

35
Q

What is the guidance if interested in a single variable?

A
  • Attempt to adjust for confounding
  • Include Variables that you suspect might cause the variable of interest or the outcome
  • Include potential confounders regardless of whether they are statistically significant
  • Be careful adjusting for variables that could be caused by the variable of interest
  • Mediators
  • Colliders

No need to report coefficients from suspected confounders in model

36
Q

What is the guidance if interested in multiple variables?

A
  • Be mindful of possible causal structures
  • Presence of mediators may mean that no association does not mean that variable is not a cause or would
    not be associated if intermediate factor not adjusted for
  • Colliders can distort associations
  • Be clear in interpretation that adjustment for other factors has occurred
37
Q

What is the guidance if interested in prediction modelling?

A

Often appropriate to include all variables that may be predictive in model
* You do not necessarily need to report effects of components
* If you do avoid providing causal interpretation

38
Q

Care must be taken when interpreting coefficients from what?

A

Multiple logistic regression

39
Q
  1. When extending a linear model each term is multiplied by what?
  2. What does this encode?
  3. How do continuous variable act?
  4. What is the effect of variable?
A
  1. A beta parameter and added to the other
  2. assumption about the linear predictor
  3. “linearly”
  4. Additive
40
Q

What do additive linear predictors assume?

A

The effect of a change in one variable is the same regardless of the value the other variables take.

41
Q

What is effect modification?

A

A variable which changes the effect of a variable of interest and is not on the causal pathway between the variable of interest and the outcome

For example the effect of age on heart attack risk may be moderated by smoking status

42
Q

When the effect of a variable in our model changes with another variable this is called what?

A

Effect modification.

43
Q

What is Subgroup analysis in clinical trials is an example of?

A

Effect modification

44
Q

Subgroup analysis aim to show what?

A

Whether treatment effects differs according patient characteristics

E.g. is treatment more effective for smokers than non-smokers

Here the effect is modified by smoking status

45
Q

What do we model modification with?

A

An interaction term

46
Q

Interactions are model terms where two variables are…

A

multiplied together

47
Q

How can we carry out statistical tests for effect modifiers?

A

To test whether an effect modifier is statistically significant you must test whether the interaction term is significant

Comparing p-values at different levels of the moderator will lead to increased type 1 error rates as multiple tests are carried out. This leads to concluding there is moderation, when there is not.

When a categorical variable is involved in effect modification all levels must be tested simultaneously (likelihood ratio test, wald tests)

Report confidence intervals and estimates for each level of effect modifier

48
Q

What are other uses for interaction terms?

A

Can be used to improve the fit of the model to the data

This may be useful when adjusting for confounding to capture true relationship between confounder and outcome (rarely used)

Also good for prediction when aim is to find model which best predicts unseen data

Excessive use of interaction or non-linear terms can lead to overfitting or challenges in interpretation
T

49
Q

Typically we assume what?

A

Variables act additively in logistic regression

50
Q

What can interactions be used to allow?

A

The effect of a variable to be different depending on the value of other variables in the model e.g effect modification

51
Q

What is used in Stata to estimate effects when more than one variable is used to model as a prediction?

A

lincom

52
Q

When using statistical tests to assess effect modification what should be
reported?

A

p-value for the interaction term should

53
Q

What can be used to make predictions?

A

A logistic regression model

The prediction is the value of their linear predictor

54
Q
  1. To get the odds of the person experiencing an event you exponentiate what?
  2. To get the probability you use what?
A
  1. The linear predictor
  2. The transformation
55
Q

How can a model fit be compared and assessed?

A

AIC and BIC
Calibration
Discrimination

56
Q

What does a lower AIC and BIC mean?

A

The model is good

57
Q

Likelihood ratio tests can be used to compare nested models but what
if the models are not nested?

A

AIC (Akaike information criteria) and BIC (Bayesian information criteria) take into account the how well the model fits and the number of parameters

BIC penalizes more heavily for more parameters in model

Often the same conclusions are the same from both measures

58
Q

What does calibration refer to?

A

The level of agreement betweenobserved and predicted values – if we predict a 20% probability of an event for a group of people the observed frequencies should beclose to 20%

59
Q

How can calibration be assessed?

A

By statistical tests, plots or linear regression

60
Q

What does a linear regression of observed values against predicted probabilities give?

A

A slope and intercept – these are sometime referred to as calibration in the small and calibration in the large

61
Q

Calibration can also be stratified by what?

A

Covariates

62
Q

What is a good way to evaluate calibration?

A

using plots comparing predicted probabilities to observed outcomes

One approach is to group observations by predicted probabilities, then plot predicted frequencies vs observed frequencies from each group

Alternatively the Lowess smoother can compare predicted probabilities to the outcome

Calibration plots should be compared to the line with slope 1 and intercept zero – this line represents perfect calibration

63
Q

What statistical test can be carried out for calibration?

A

Hosmer-Lemshow test

Group observations into bins based on predicted values or covariate patterns, compare observed to predicted frequencies in the bins

Lower p-value = poorer fit: A statistically significant result indicates evidence that differences between observed and predicted frequencies were unlikely to happen by chance.

Can either select a number of bins e.g. 10 or if only categorical covariates have a bin for every pattern

64
Q

What are drawbacks to the Hosmer-Lemeshow test?

A

p-value dependent on sample size – whether test is significant depends on goodness of fit and sample size

p-value can vary with number of bins – no clear way to decide

65
Q

What does discrimination describe?

A

Ability of model predictions to differentiate between those with and without the outcome

66
Q

What does good discrimination mean?

A

The predictions are higher for those with the outcome and lower for those without.

67
Q

When does poor discrimination occur?

A

When there high and low predictions occur with similar frequencies for those with (or without) the outcome

68
Q

What can discrimination be assessed using?

A

C-statistic

69
Q

What is the c-statistics also known as?

A

Area under the curve (AUC)

70
Q

What is the c-statistic?

A

C-statistic is the probability a randomly selected person who has a positive outcome has a higher predicted probability than a randomly selected patient who does not have a positive outcome.

71
Q

How is the c-statistic calculated?

A

By comparing all possible pairs of patients with different outcomes and comparing predicted probabilities.

72
Q

What does a c statistic of 0.5 mean?

A

No predictive ability

73
Q

What does a c-statistic of 1 mean?

A

Perfect prediction

74
Q

What is the AUC mathematically equivalent?

A

The definition of a c-statistic, they always agree

75
Q

In an AUC the receiver operating curve compares what?

A

Sensitivity with specificity

Sensitivity: True positive rate - Correct prediction for someone who has the outcome

Specificity: True negative rate - Correct prediction for someone who does not have the outcome

76
Q

How is AUC calculated?

A

By taking the area under the curve formed by varying a cutoff for classifying positives and negatives

Sensitivity is plotted against
1 - specificity

No predictive ability would result in the sensitivity being equal to
1– specificity

77
Q

Perfect predictive ability based on AUC would mean what?

A

Sensitivity and specificity were always one

78
Q

When using statistical tests to assess effect modification the p-value for the interaction term should be reported

TRUE or FALSE

A

True