A practical and example filled tour of simple and multiple regression techniques (linear, logistic, and Cox PH) for estimation, adjustment and prediction.

Loading...

From the course by Johns Hopkins University

Statistical Reasoning for Public Health 2: Regression Methods

76 ratings

A practical and example filled tour of simple and multiple regression techniques (linear, logistic, and Cox PH) for estimation, adjustment and prediction.

From the lesson

Module 3B: More Multiple Regression Methods

This set of lectures extends the techniques debuted in lecture set 3 to allow for multiple predictors of a time-to-event outcome using a single, multivariable regression model.

- John McGready, PhD, MSAssociate Scientist, Biostatistics

Bloomberg School of Public Health

Greetings and welcome to lecture set nine.

Â In this lecture set, we'll give a brief overview to handling effect

Â modification in a multiple regression context, and

Â also look at another approach above and beyond categorizing continuous

Â predictors in a regression model to handle non-linear associations.

Â So in this lecture set, an overview, we will look at testing for effect

Â modification and estimating different outcome/predictor associations for

Â different levels of a potential effect modifier via the use of

Â something called interaction terms in regression.

Â And we'll also look at conceptualizing non-linearity as a type of

Â effect modification and showing another way to model it in a regression context,

Â which will be very similar to the concept of interaction terms, and

Â we can do this without categorizing the continuous predictor.

Â So this is just another approach that's sometimes used in the literature.

Â But let's first get started by first looking at the idea of regression with

Â interaction terms.

Â So hopefully at the end of this lecture you will describe the interaction term

Â approach and appreciate that it exists, this approach for

Â estimating separate outcome/predictor associations for

Â different levels of effect modifier and for testing for effect modification.

Â I'm going to give some details in here, and

Â what I really want you to get is the big picture.

Â But some of you will be interested in using these techniques in

Â your own analyses and may go on to do your own analyses or

Â take further courses in regression analyses so I want to show you at

Â least some of the basic mechanics for those of you who are interested.

Â So one way to handle effect modification in the regression context is to

Â present stratified results.

Â So here is an example of a study where the effect modification by sex of

Â the person was of interest and the results were presented for multiple, simple and

Â multiple logistic regression models.

Â Separately estimated only for data from males and data for females.

Â This was an article that was looking for suicide outcomes.

Â Both the idea of having suicidal thoughts and attempting suicide as a function of

Â a person's self sexual identify, whether they identify as homosexual or not.

Â And the authors look both at the unadjusted associations between these

Â outcomes and homosexuality and the same association adjusted for

Â other factors like ethnicity, alcohol abuse, et cetera, but

Â they did so separately for males and females.

Â So, a closeup of the first the top of this table shows these

Â associations estimated for boys only.

Â And at the bottom of the table the same analysis is presented for females.

Â One way to summarize this concisely, with regards to the outcome of suicide attempts

Â would be that show the unadjusted and adjusted odds ratios comparing the odds

Â of having attempted suicide for those who identify as homosexual to not.

Â Doing so separately for males and females, and

Â that's what the author's ultimately were talking about.

Â And they wanted to investigate whether the relationship between suicidal outcomes and

Â homosexuality was different for males and females.

Â So they completely stratified their data by sex and ran these separate analyses.

Â Another example is an article that came out in the New England Journal of

Â Medicine looking at coffee drinking and mortality.

Â And the authors, what they did was they looked at time to event data,

Â time to mortality data in a follow-up period as a function of how much coffee,

Â on average, people reported drinking at the start of the follow-up period.

Â And so what they did separately for males and

Â females to see if there were any differences in the associations,

Â either directionally or in terms of the magnitude is they

Â estimated both the essentially unadjusted association, only adjusted for age.

Â The association between mortality and coffee consumption.

Â And the estimated hazard ratios of mortality for

Â the different levels of coffee consumption relative to those who didn't drink coffee.

Â And then they reestimated these adjusted for a, a multitude of other factors and

Â here's a list of those factors here.

Â Body mass index, race or ethnic group, et cetera.

Â But they did these analyses both the unadjusted or only age adjusted and then

Â multiple adjustments totally separately for the data on men and again on women.

Â So they never combine the data between the sex groups,

Â they did the analyses completely separately.

Â Sometimes, however, the researcher may want to estimate separate associations for

Â one predictor only.

Â Like sex.

Â And then use the information across both sexes, or

Â across all groups that they want to present separate associations for

Â one predictor, to estimate the association with other predictors.

Â So for example, we may want to estimate the sex specific association between

Â wages and years of education after adjusting for

Â other factors, but we want to use the data from both males and

Â females to estimate the association with these adjustment factors.

Â So, they don't want to do the analysis completely separately for males only and

Â females only.

Â Similarly we might want to estimate age specific associations between

Â mortality and race in dialysis patients, after adjusting for other factors.

Â But we want to, want to use the data for all age groups combined in order to

Â estimate the adjusted associations in one model with these other factors.

Â Well this can be done by concluding what's called an interaction term in

Â a multiple regression model.

Â So let's look at an example here, this is the data set 534.

Â US workers in 1985 and what I want to look at,

Â is the association between hourly wages and years of education.

Â What I am presenting in this table is the unadjusted and adjusted linear

Â regression slopes for years of education only in models that were adjusted for

Â various multiple characteristics.

Â So, what we have here.

Â Here is this slope of years of education from a simple linear regression model of

Â wages on years of education.

Â So the unadjusted association suggests that two groups who differ by one year

Â in years of education will have hourly wages that differ by 75 cents on average,

Â and the higher salary is associated with more years of education.

Â This result doesn't change at all after adjusting for

Â sex differences in the years of education groups nor essentially

Â stays the same after additionally adjusting for for union membership.

Â Then estimate attenuates a bit, but

Â is still statistically significant when we start adjusting for job type.

Â But in all these analyses, these comparisons, all these adjusted analyses,

Â this compares, the slope for years of education compares the difference

Â in hourly wages on average for two groups who differ by one year of education.

Â But are the same in all other characteristics.

Â It doesn't matter what those other characteristic values are as long as

Â the two groups being compared in terms of

Â the years of education difference are the same on these.

Â So for example, let's look at the results for model c.

Â This was the one that estimated the association between hourly wages,

Â years of education, sex, and union membership.

Â And in the table I only showed you the results, resulting slope for

Â years of education, but

Â there were also resulting slope estimates for sex and union membership.

Â So what I'm showing here is a graphic that shows what this model's estimating with

Â regards to the union membership adjusted relationship between hourly wages and

Â years of education and I'm applying this separately by sex groups.

Â So you'll notice that these lines are parallel.

Â The slope of each of these lines is 0.76,

Â that adjusted slope we reported, adjusted for sex and years in education.

Â And it, additionally if you look here if we fix years of education of any value and

Â look at the vertical distance between these two lines.

Â What that's estimating is the difference in average salary between males and

Â females of the same years of education and union membership status.

Â And we don't have any visual component to membership status, but

Â I am telling you that this association is adjusted.

Â So the slope of each sex-specific regression line for

Â years of education is the same.

Â This is the slope of years of education from that multiple linear regression model

Â with years of education and sex as predictors as well as union membership.

Â Similarly, the difference between the estimated hourly wages for

Â males and females is the same at each value of years of education.

Â This is the difference in hourly wages between males and

Â females adjusting for years of education and also union membership.

Â And this difference is a $1.89.

Â Similar graphics could be shown for the other models that adjust for

Â things beyond union membership.

Â So in these models where we adjust for sex and other things once

Â sex has been adjusted for, for example the wages/years of education.

Â Relationship is the same in each level of sex, for both males and females.

Â Once years education has been adjusted for the relationship between wages and sex is

Â the same for groups with the same years of education, and other adjustment variables.

Â So suppose however, we are interested in investigating whether the sex,

Â relationship between wages and

Â years of education is modified by sex, after we've adjusted for other things.

Â Well, one thing we could do is what I

Â was talking about at the beginning of the lecture.

Â We could stratify the sample by sex and look at the results of a regression

Â analysis on wages years and education using males only, the data for

Â males, and do the same thing using the data for females only but

Â never combine the males and females data for an overall analysis.

Â If we did this we'd get a slope estimate for years of education for

Â males of 0.71 and a larger estimate for females of 0.84.

Â But let's talk about another approach,

Â that will allow us to use the information for males and females together.

Â So approach number two is to add what's called interaction term,

Â between years of education and

Â sex to the model, which includes usually multiple other adjustment variables.

Â Here's how it works.

Â We actually if we read the computer,

Â the computer I have to actually create it myself.

Â It doesn't come with the data set and there is no automatic command on

Â the computer to say create an interaction term.

Â But it's actually elegant in its simplicity once we get through

Â the mechanics here are, hopefully you'll appreciate that this is kind of neat.

Â So the interaction term can be created.

Â It sounds kind of strange at first but we'll see why it works.

Â Can be created by taking the product of the two variables we want to interact.

Â In other words, if we want to estimate whether the relationship between years of

Â education is modified by sex, we're seeing whether

Â there's an interaction between years of education and sex.

Â And so we would create this interaction term.

Â I'll generically call it x3.

Â By taking the product of years of education and sex, x1 times x2.

Â And so let's look at what the new model we're going to estimate is.

Â It's going to include years of education and sex, just like

Â the model that adjusted for each other, plus the other adjustment variables.

Â But we're actually going to also add in this interaction term, x3.

Â And then any other x's we want to include to either better predict wages or

Â adjust the relationship between wages and years of education above and beyond sex.

Â So let's see why this works.

Â So in this coding schema I've called x1 years of education and

Â x2 is sex which takes on a value of 1 for

Â females and zero for males and then x3 is the interaction term.

Â So what is the value of this interaction term for males?

Â Well for males this equals the years of education measure

Â times the sex value for males, x2 is equal to 0 for males.

Â So this interaction term is nothing, it disappears.

Â It's equal to 0 for males.

Â What about for females?

Â Well for females, x3 our interaction term, is equal to years of education for

Â x1 times x2, the sex indicator which is a 1 for females.

Â So for females, x3 is ultimately equal to another copy of years of education.

Â So, let's see how this all plays out.

Â So, what I did here was estimated this regression that includes years of

Â education and sex, and other adjustment variables.

Â In this case, just union membership, but

Â I just want to make this more gen, general in its conceptualization.

Â And I also included the interaction term.

Â And here are the resulting estimates I got from the computer.

Â The slope of years of education is 0.7, the slope of sex is negative 3.69,

Â and the slope of the interaction term is 0.14.

Â So, let's see how this plays out.

Â Well lets look at what, first what this model estimates, the relationship between

Â wages, years of education, and everything else to be for males, males only.

Â Males are kind of easy given their coding because their value of x2 is equal to

Â 0 and hence their value of the interaction term is equal to 0.

Â So when we write out, if we were only looking at males, when we write out what

Â this estimates for males, we get the intercept of 0.4 plus the slope for

Â years of education times years of education.

Â And then both sex and the interaction term disappear because they're both equal to 0.

Â Plus whatever else we have in this model.

Â In this case its just union membership but

Â I'm not showing that slope because I want to focus on this years of education piece.

Â So in males, in males the slope of years of education here.

Â The piece that describes the relationship between hourly wages and

Â years of education is equal to that 0.7.

Â So for males,

Â hourly wages increase by 70 cents on average per additional year of education.

Â For females we're going to have to do a little more accounting to get this story,

Â but what we're basically going to see is by generating this

Â interaction we get to put in another copy of years of education, and

Â when we combine the two parts that we'll get for years of education we get

Â a different slope estimate of years of education for the females.

Â So let's do this out.

Â So for females we get this, we get the intercept that the males got.

Â We get everything that the males got.

Â And then we get the slope of sex times 1, so plus -3.69.

Â Then we get this interaction term times the years of education variable times 1,

Â like we said before.

Â And then plus there's the piece about union membership, but

Â I'm just leaving that generic.

Â So if we do a little accounting here we can bring the negative 3.69 over here.

Â Sorry about this extra negative sign, but, and

Â then if we order the 0.7 x1 and the 0.14 x1 together.

Â And then we do a little factoring we see the combine, these two combine to give,

Â if you will, the slope of years of education among females.

Â So among females, the average increase in hourly wages per year increase in

Â years in education is that increase for

Â males of 0.7 plus this additional piece, plus another 14 cents.

Â So in total the slope or

Â association between hourly wages and years of education for females is 0.84.

Â And this piece, this piece for the interaction term

Â quantifies the difference in the relationship between hourly wages and

Â years of education for females compared to males.

Â So here's what this would look like if we plotted it.

Â Similar to the plot we did before, but now you'll notice that these lines,

Â these sex specific associations have different slopes.

Â The slope for males is 0.7.

Â And the slope for females is larger, 0.84.

Â So you can see that these lines are starting to

Â converge with increased years of education.

Â The other side of this story, and that we could go back and

Â rewrite the model to estimate this piece as well, but

Â just conceptually, if we are estimating interaction between these two variables.

Â Not only are we estimating differing relationships between hourly wages and

Â years of education by sex, but we're estimating different associations between

Â hourly wages and sex depending on years of education.

Â So if we look at two groups who have ten years of education,

Â males compared to females, this vertical distance here is the average difference

Â in salaries between males and females with ten years of education.

Â If we did the same thing for those with 15 years of education,

Â this vertical distance is the average difference between males and females.

Â So you can see that the average difference between males and

Â females also depends or changes depending on years of education.

Â So, now that we've done this we have to

Â remember that everything we've done is just an estimate.

Â So this 0.14, that inter-estimates the difference in the slopes

Â of years of education for females compared to males is just an estimate.

Â If we want to test formally whether there's evidence of

Â an effect modification based on these data, whether there is

Â a statistically significant difference in the relationship between hourly wages and

Â years of education between males and females.

Â We would test that this slope is equal to 0 because think about it.

Â This slope estimate of years of education for males was equal to

Â just that original piece for years of education.

Â The slope for females was, we start with males, and add.

Â So suppose there were no difference in the relationship between

Â education and hourly wages between males and females.

Â Then this piece that quantifies the difference would be 0 because,

Â because there'd be no difference in the association.

Â So testing whether or not the,

Â at the population level the coefficient of this interaction term is equal to 0 is

Â akin to asking is there evidence of a difference in this hourly wages, years of

Â education relationship between the sexes after counting for sampling variability.

Â So this is sometimes called a formal test of interaction.

Â In this example the p-value for

Â testing this null of, coefficient of 0 for the interaction term, is 0.38.

Â So there's not a statistically significant interaction between years of education and

Â sex after adjusting for union membership status.

Â And the purposes of our investigation are to either confirm or

Â rule out effect modification after adjustment for union membership status we

Â would say we've ruled it out power considerations notwithstanding.

Â And we would probably go back and report that common adjusted association between

Â years of education and hourly wages adjusted for sex and union membership.

Â Let's look at another example though, and

Â again I'm just trying to give you the basic idea here.

Â Being able to handle the mechanics of this are not essential for this course, but for

Â some of you this may be interesting and you may want to apply this.

Â At some point in your data analysis projects, or

Â you may go on to do further courses in statistics and this will

Â give you at least a starting point for the mechanics of interaction and regression.

Â So let's look at an example of mortality in

Â patients with primary biliary cirrhosis.

Â This Mayo Clinic data we've looked at so often before.

Â And this is a randomized trial for patients randomized to

Â receive the drug DPCA or Placebo, and the outcome of interest is death.

Â And the results the unadjusted hazard ratio mortality for

Â patients receiving DPCA Placebo, was 1.06

Â a slight increase in the mortality in the sample for those who receive the drug.

Â But this result was not statistically significant.

Â And as we've seen if we adjusted for something like age the unadjusted and

Â adjusted hazard ratios,

Â DCPA to placebo, are very similar because this was a randomized trial.

Â However, we still may have a question about age, in knowing if

Â one could found the overall relationship between DPCA and mortality.

Â But we might want to ask maybe,

Â maybe the drug, the affected drug was modified by the age of the patient.

Â Maybe it doesn't work.

Â Or is even harmful for some age groups but works well for others.

Â Well, at this level of analysis,

Â all we have is one overall association between DPCA and mortality.

Â That would use to describe the association for all ages.

Â So if we want to investigate whether there is effect modification by age,

Â we have to go a little further.

Â So, I'm going to look at age categorized into quartiles so

Â that we can do this interaction approach, and there's four quartiles.

Â The first quartile is persons four, less than 42 years.

Â Second quartile is those 42 to 49.9 years.

Â Just less than 50, etc.

Â You can see what's going on here.

Â So to investigate whether age modifies the effect of

Â the drug we will need to fit a Cox model.

Â That includes drug as a predictor but also the age quartile indicators.

Â We've got four groups here so we'll need three binary indicators.

Â And then interaction terms between the drug variable and

Â each of the age quartile indicators.

Â So this actually looks a little daunting when it all comes down.

Â And again, for those of you that are not interested in the mechanics, I just want

Â you to get the basic idea of what the interaction term or terms allow us to do.

Â But for those of you interest, I'll detail this a little bit.

Â So this x1 here is an indicator of DPCA or placebo.

Â [NOISE] And then these indicators here are for

Â the second through fourth age quartiles.

Â The reference group is the first age quartiles.

Â And then what I have here are interaction terms between the drug indicator and

Â each of the indicators for the second through fourth age quartiles.

Â So literally we just multiplied those things through.

Â So let me show you just how this shakes down.

Â If we're looking at age quartile one.

Â Well, all the indicators are 0 because age quartile 1 is a reference group, and

Â all the interaction terms are 0 because they're a product

Â of each of these indicators.

Â And so the relationship we get on the log hazard scale,

Â between mortality and treatment is this slope of negative 0.07.

Â So this is our log hazard ratio for the relationship between

Â mortality and DPCA compared to placebo amongst persons in age quartile 1.

Â If we look at age quartile 2 we pick up the same piece that we have for

Â age quartile 1.

Â We also picked up another piece of information because they're in

Â age quartile 2, and we pick up

Â the interaction term between the indicator being in age quartile 2 and

Â the drug variable and the piece for that is the coefficient of 0.28.

Â Similarly if we look at age quartile 3 we pick up this first piece, negative 0.07

Â plus a piece that has to do with the age differential and then a piece that has

Â to do with the interaction between the drug and the age quartile 3 indicator.

Â Notice what we're getting with each of these interactions is just another

Â copy of x1, the dug indicator.

Â And you can see the same sort of thing applies for age quartile 4.

Â So let's do a little reorganization here to make this a little more cogent.

Â In age quartile 1 the only number that has to do

Â with our drug indicator is that initial slope of negative 0.07.

Â So this is the log hazard ratio mortality for

Â those in the DPCA group to the placebo amongst the lowest age quartile.

Â If we wanted to get the log hazard ratio comparing patients on the drug to placebo

Â for age quartile 2, we would take that initial slope for the first quartile and

Â then add the coefficient for the interaction term, that 0.28.

Â So the log hazard ratio here is, when all the dust settles, 0.21.

Â And this 0.28 estimates the difference in the association between mortality and

Â treatment for those in age quartile 2 compared to age quartile 1.

Â Similarly for age quartile 3 we start with the estimated association of log hazard

Â ratio for those in age quartile 1 and then add the coefficient for the interaction

Â term between the drug indicator and the indicator for age quartile 3.

Â And the log hazard ratio for this group would be the sum of those two things,

Â 0.03, and this 0.01 is the estimated difference in

Â the association between mortality on the log scale, and treatment for

Â those in the third quartile to the first.

Â And you could do something similar for the fourth quartile.

Â If I were presenting these results to somebody else who wasn't as

Â knowledgeable as we are about regression models I would

Â use the computer to estimate the hazard ratios.

Â Exponentiate those log hazard ratios and

Â then also with the computer I can the confidence intervals.

Â So this just shows me that there's a slight benefit for the drug for

Â these in age quartile 1 but it's not statistically significant.

Â And age quartile 2 and 3 the drug is positively associated with mortality

Â in this study, but again it's not statistically significant for either.

Â And then it looks like the results are promising for the oldest group.

Â In older persons there's an estimated reduction in

Â mortality that's notable on the order of 27%.

Â But again, unfortunately this result is not statistically significant in either.

Â But what this interaction term has allowed us to do is estimate separate,

Â ultimately separate hazard ratios for between mortality and

Â treatment for these four age quartiles, and

Â then with the computer's help put confidence intervals on these.

Â We can also with the aid of a computer, we couldn't do it based on what I've given

Â you here, we could test whether any of these interaction terms.

Â We can test when any of them were statistically significant.

Â The idea being at least one of these interaction terms is different than 0 or

Â any combination of them, then the relationship between

Â mortality and treatment is different for at least two of the age groups.

Â And the resulting p-value on that is 0.74.

Â So unequivocally from both qualitatively and

Â looking at the confidence intervals, and

Â from a formal test, we conclude there's no interaction between age and treatment.

Â And on the whole this drug didn't work at, in this population of patients.

Â So in conclusion here, the effect of the drug is not modified by age.

Â Although the results looked promising for the oldest age quartile,

Â this was not significant after accounting for sampling variability in the data.

Â So, hopefully this is a, a basic introduction to

Â the idea of assessing effect modification of, with an interaction term.

Â I want you to get the basic idea.

Â I'm not going to hold you responsible for parcee models with interaction terms.

Â That requires a little more practice than what we can devote to in this course, but

Â it's really just involved accounting skills and

Â keeping track of what's turned on when etc.

Â And then combining terms where appropriate.

Â So, if the mechanics were a little daunting, don't worry about it.

Â But I do want you to appreciate that the inclusion of interaction terms allows us,

Â within the context of one model, to estimate separate outcome predictor

Â associations for the level of of potential effect modifier, for

Â different levels of a potential effect modifier in a single regression model.

Â For those of you who will go on to take further courses in statistics and/or

Â are interested in applying this in your own research, then this gives you

Â a primer on how to handle interaction terms in the regression modeling process.

Â In the next section we'll look at the use of interaction terms in,

Â in some of the published literature and how the authors report the results and

Â discuss their approach.

Â Coursera provides universal access to the worldâ€™s best education,
partnering with top universities and organizations to offer courses online.