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 3A: Multiple Regression Methods

This module extends linear and logistic methods to allow for the inclusion of multiple predictors in a single regression model.

- John McGready, PhD, MSAssociate Scientist, Biostatistics

Bloomberg School of Public Health

All right everyone, welcome to Section B.

Â Here we're going to look at Multiple Logistic Regression,

Â talk about about the basics of model selection.

Â Basically, reiterate what we said for linear regression.

Â And show how to estimate proportions or

Â probabilities from logistic regression models with multiple predictors.

Â And actually make comparisons on the odds ratio scale between

Â groups who differ by more than one predictor.

Â So hopefully, by the end of this lecture,

Â you'll understand the linearity assumption as it applies to multiple logistic

Â regression with regards to the linear relationship between the log odds and

Â continuous predictors in the multiple logistic regression model.

Â We will just briefly explain different strategies for picking quote, unquote,

Â final multiple logistic regression model among candidate models.

Â And use the results of multiple logistic regression models to compare groups who

Â differ by more than one predictor.

Â And estimate proportions or probabilities for groups given their x values.

Â So, let's talk about the estimation process for Logistic Regression.

Â Just like it was with simple Logistic Regression,

Â the algorithm to estimate the equation of the multiple logistic regression is

Â called maximum likelihood estimation.

Â So given the data, the estimates for the intercept in slopes,

Â however many there are given the number of xs, are the values that make the observed

Â data set most likely among all choices for the intercept and the slopes chosen.

Â So this actually is an iterative process, requires numerical algorithms and

Â it must be done by the computer.

Â And I don't think that's any surprise.

Â None of us would want to do this by hand anyway.

Â And the resulting shape we're estimating in terms of the log odds,

Â just like with linear progression when we have more than one predictor, the logistic

Â regression model's no longer estimating a line, a single line, describing

Â the relationship between the log odds in our predictor in two-dimensional space.

Â It's actually describing an object in multidimensional space,

Â which we can't really visualize in three dimensions, per se.

Â So what is the linearity assumption with logistic regression?

Â Remember, we used low s plots in simple logistic regression

Â when we had a continuous predictor to see and

Â assess whether the relationship with the log odds of our binary outcome and

Â our continuous predictor was linear or roughly linear in nature.

Â And in logistic regression, when we have continuous predictors, and

Â there's other predictors in the model, this just extends to the notion that

Â the adjusted relationship between the log odds for

Â a binary outcome in this predictor is linear in nature.

Â There's not really any visual tools we can to see the adjusted relationship.

Â But there are techniques,

Â like comparing something we saw with Cox Regression previously.

Â Like comparing the results of a model where we fit the x's single continuous

Â predictor versus putting in categories, and look at how the results compare.

Â So, when faced with potentially many possible predictors, how does a researcher

Â go about chosing a best model, if that is indeed his or her goal?

Â And certainly,

Â it's not necessary to come up with one final multiple regression model.

Â Sometimes, as we've seen, researchers are interested in presenting the results from

Â several models and comparing them.

Â But model building and selection is a combination of science, statistics and

Â the research goals.

Â The same as it were with linear regression modeling and

Â also the same as it will be for Cox.

Â So if the goal is to maximize the precision of adjusted estimates,

Â then the best strategy is to keep only those predictors that are statistically

Â significant in the final model, with all the caveat about power issues, etc.

Â But estimating things that quote, unquote don't need to be there,

Â don't add extra value or information about the outcome will take

Â away from the precision of those things that do add information about the outcome.

Â And so throwing that, if you will, dead weight from model will

Â maximize the precision of the predictors that are associated with the outcome.

Â If the goal was to present results comparable to results of similar analyses

Â by presented by other researchers, on similar or different populations, for

Â example, if we want to look at breast feeding practices as a function of child's

Â age and sex in Nepali children and compare that to research that's been done in

Â African populations, European populations, Asian populations and the United States.

Â And everybody else had actually presented their results adjusted for age and sex,

Â then we would want to do the same, even if the association between one or either was

Â not statistically significant, so that we could compare our findings to theirs.

Â If the goal was to show what happens to the magnitude of association with

Â different levels of adjustment, then there isn't really one final model.

Â But you'd want to present the results from several models that include different

Â subsets.

Â Or combinations of adjustment variables to show how robust.

Â If you're looking at one main association and seeing how much it's affected

Â by potential confounding, looking at the results across several models can

Â help assess the degree to which the original association is confounded.

Â And if the goal is prediction, well again, this is slightly more complicated story,

Â and we'll discuss briefly a little later in the course.

Â But let's talk about predictions, though, how we could, given the results of

Â the regression model, estimate probabilities from the resulting model for

Â different subgroups of the population which are included in our sample.

Â So this, just recall,

Â these are the results from the logistic regression results for

Â predictors of breast feeding when we considered age of the child and sex.

Â I'll keep it, one of the smaller models here just for illustrative purposes.

Â And this was the model that had both predictors in it age and sex of the child.

Â So suppose we're using this to estimate probability.

Â So, the probability or proportion of children that are breastfed by different

Â age and sex groups based on the results of this model.

Â Well, here's what the model looks like on the log odds scale.

Â The logistic regression model that generated those

Â outcomes was the ln(odds of breast feeding) = an intercept

Â of 7.2 + -0.24 times x1, where x1 is age.

Â And 0.27 times x2 where x2 is sex.

Â And again, I could call these x anything or switch the order,

Â as long as I knew which each referred to and assigned a proper slope value to them.

Â So if we had this model and I wanted to estimate the probability or proportion of

Â female children 22 months old that are breastfed, how could we do this?

Â Well, what can we estimate straight up for this group, given the equation?

Â Well, we could say,

Â a log odds of being breastfed when age = 22 and

Â sex = female, which is the 0 for

Â the sex variable = intercept

Â 7.2 + -0.24 times

Â 22 + 0.27 times (0).

Â So this is just like we did with linear regression, and we'll get a number here.

Â The problem here, though, is in linear regression, we were done,

Â this number was on the scale we wanted.

Â The problem here is we're still a couple steps removed from the scale.

Â So this is the log odds, so if we wanted the odds estimate for

Â this group, we'd take e and raise it to the 1.92 power.

Â And that would give us an odds of 6.82 And

Â then we could get the estimate proportion or

Â probability by taking the estimated odds over 1 plus the odds,

Â which is 6.82 over 7.82 which is about 0.87.

Â So we estimate it 87% or so of female children,

Â 22 months old are being breastfed.

Â Just wanted to show you something.

Â In papers, you generally won't get the results on the log scale.

Â If they gave us all the information, including the baseline odds, we could take

Â the log of the slopes and the log of the baseline out and recreate the equation.

Â Let me show you if this is on the exponentiative scale.

Â If we had, let's recall, the log odds from

Â the way we did it was equal to the intercept,

Â 7.2 + the slope of -0.24 times 8.

Â But if I actually, I'm going to just exponentiate it without adding.

Â So if I exponentiate this portion here,

Â e to the -7.2 + -0.24 times 22.

Â You may recall, if you're familiar with exponents,

Â this is equal to e to the -7.2 times e to the -0.24 times 22.

Â And we could rewrite this as e to

Â the -7.2 times e to the -0.24,

Â raised to the 22nd power.

Â But e to the -7.2 is just this baseline odds, this 1,333.

Â And e to the -0.24 is just the odds ratio, per one month difference in age.

Â So if we took the baseline odds of 1,333 times the odds ratio

Â per one unit difference in age raised to the 22nd power and

Â we multiply this all out, this would give us the odds of 6.82.

Â And then we could convert that to a probability.

Â So this just provides an alternative to try and to recreate the equation from

Â published results that are presented on the exponentiated scale.

Â But if you're more comfortable and want to do this at some point, there's no shame in

Â taking the odds ratios, taking their logs, and

Â taking the log of the baseline odds, if it's given, to recreate the equation.

Â And do it the way we just did.

Â So if I were presenting a paper and I wanted to put something along with these

Â logistic regression results that really showed what the impact of sex and

Â age was on the resulting probabilities of being breastfed,

Â it might be nice to include a graphic like this.

Â And these curves are estimated by, basically,

Â going through all ages in the age range for both sexes.

Â And predicting, via that equation, the proportion of children who were breastfed

Â in each age and sex group, and then plotting them on a graph.

Â And so what you can see here is that across the 30, from the 12,

Â the 36 months and the children in both sexes at 12 months,

Â a very high proportion, almost 100% are being breastfed.

Â But by the time we get to 36 months, that's on the order of, and

Â the scale starts to about 20%.

Â So on or less than 20% and this shows that

Â both groups decreased pretty rapidly in the probability over that time period.

Â But this vertical difference at any point shows the difference in the estimated

Â proportions.

Â The risk difference, if you will, for been breastfed for

Â male compared to female children of the same age.

Â And so this really takes those results that gave us relative comparisons.

Â And puts them on an absolute scale to help us understand what

Â resulting odds ratio of 0.79 or a reduction of 21% per month of

Â age means in terms of the actual proportions been breastfed.

Â We can also do comparisons between groups that differ by more than x value at once.

Â So maybe we want to estimate the odds ratio of being breastfed for

Â the group we just looked at, female children, 22 months old,

Â compared to male children, who are 19 months old.

Â So, if we did this the brute force way,

Â we would actually write out the equation and log our scale for both groups.

Â We've already done it for this group, but there's the math behind it and

Â we could do it for this group there.

Â Take the intercept 7.2, plus the slope times the age f 19 months + 0.27 times 1,

Â because they're male.

Â And the sum total of these things, if we take the difference, is -0.99.

Â And that estimates the difference in the log odds being breastfed for the first

Â group, female 22 months old, compared to the second group, males 19 months old.

Â If we look at that, if we exponentiate that, e to the -0.99

Â will give us the odds ratio comparing these two groups, which is about 0.4.

Â So the first group on the odds scale has a substantially lower odds

Â of being breastfed than the second both, both because the age difference and

Â the sex difference.

Â because males are more likely to be breastfed than females.

Â But let's look at this piece by piece.

Â If you notice that this turns out to be the intercept cancels.

Â And then the part that's due to age is the slope for

Â age times the difference in ages.

Â And then the part that's due to sex is the slope times,

Â of sex times the difference in sexes.

Â So when all the dust settles, we have this part that's because of the age differences

Â and this part that's because of the sex contributing to this difference.

Â And if we were to exponentiate this sum here,

Â this was just more fun with exponents,

Â we'd get e to the -0.24 times 22- 19 is 3,

Â + -0.27, because [INAUDIBLE].

Â We're comparing the group coded 0 to the group coded 1 in this comparison.

Â This is equal to e to the -0.24(3),

Â times e then -0.27.

Â And the odds ratio is equals e to the -0.24 to

Â the third power divided by e to the 0.27.

Â So this equals the odds ratio,

Â e to the -0.24,

Â is that reduction per month of age,

Â 0.79 to the third power divided

Â by the odds ratio for being male of 1.3.

Â And that's because the comparison

Â we have on top is 22 months female,

Â 19 months male.

Â So this is the part, the three month difference because of age, and

Â the female to male is just the inversion of the male to female ratio.

Â So, you see it breaks down to these parts.

Â This was exactly equal this up here.

Â But I just wanted to highlight that the differences of more than one predictor

Â just result in components from each, from the logistic regression model.

Â Let's look quickly at predictors of obesity from the NHANES.

Â And we looked at a couple different models.

Â One included the unadjusted we had potential predictors including HDL level,

Â male, sex, age, in four categories and then marital status and then we

Â looked at the model that had HDL sex and age and then the one that had all four.

Â And we saw that the resulting association with marital status, whether we

Â adjusted for other factors or not was not statistically significantly associated.

Â So, lets use model two to make some predictions.

Â So here's what the model two equation looks like on the log scale.

Â So, the baseline odds was the exponentiate intercepted its log was negative 0.5.

Â I'm going to make x1 here arbitrarily HDL, the log of this 0.956 is -0.45.

Â I'm actually going to put age in here even though it didn't appear next in the table.

Â And then there's going to be three predictors for age, this will be

Â the second age group, 30 to 46 years, this will be a 1 if it's that group, 0 if not.

Â This'll be the third age group, 46 to 62 years, the indicator for that.

Â This'll be the greater than equal to 62, and then this last thing I

Â put inside of order is a 1 if they're male, 0 if they're female.

Â So in any case I got that from the computer, but if you take the logs of

Â these respective quantities and match them up you'll see you that get those slopes.

Â So I wanted to estimate proportions.

Â Let's just estimate for the practice.

Â Estimate the proportion or probability that 50 year old males with an HDL level

Â of 80 milligrams per deciliter are obese.

Â So just plug in these numbers, they get the intercept.

Â The slope of HDL is -0.045, we multiply that times 80.

Â They are 50 years old, so they're in the third age group.

Â So that's turned on, the other two drop out.

Â And so they get a 0.67 for that.

Â And they are male, so they get a 0.97 for

Â being male and the sum of these parts is -2.46.

Â So if we exponentiate this log odds, take out the odds.

Â We get 0.085, and

Â if we use that to estimate a resultive proportion or probability.

Â It comes out to be 0.078.

Â Or 7.8% And we could go through and do this for other groups.

Â But if we were trying to present the gestalt, the overall

Â results on the probability scale based on the result of these regressions,

Â we could present the table of the regression results to get the relative

Â comparisons on the odds scale and look at the significance in confidence intervals.

Â But then we could present graphs like this.

Â I just arbitrarily to try and get all the information we had in a,

Â hopefully digestible way, and to show both the sex and age differences I presented in

Â separate curves for the four ages groups for males and females.

Â But put them all on the same scale, so

Â that we could see the association with age.

Â The increasing or decreasing association and the fact that at any given HDL level

Â the lowest group at lowest risk is the youngest group, but

Â all four groups decrease

Â their likelihood of being obese decreases with increasing HDL and they start

Â to coverage around very high levels of HDL in terms of the predictive probability.

Â Same thing goes for females, but

Â if you actually look at the difference at a given point for females to males.

Â Fix the HDL level within an age group you can see the probability among females

Â is lower than males up to the same HDL and age.

Â So this is one way we might present the results such that none within the ratio is

Â significant but we can also see what this means in terms of the resulting estimated

Â proportions and the magnitude in different groups.

Â So, in summary multiple logistic regression results can be used to estimate

Â probabilities or proportions of binary outcomes for

Â a given subset in a population given the predictor values for the subset.

Â And multiple logistic results can be used to estimate odds ratios between groups who

Â differ by more than one characteristic or predictor.

Â And confidence intervals for both the predictive probabilities and

Â the odds ratios comparing differences in multiple predictors can be estimated.

Â And this principal is the same for the odds ratios it would be on the log scale,

Â and you take the log plus or minus two standard errors for

Â the proportions it would be similar to p hat plus or minus two standard errors.

Â But the trick is estimating the standard errors because there's multiple components

Â that go into estimating that.

Â A computer can handle that but there wouldn't be a straightforward way to get

Â those by hand, but you can certainly ask the computer to give those to

Â you if you're interested in presenting those as well.

Â So, for example on those predictive probability curves we could have

Â put confidence bands around the curve to estimate the upper and lower

Â limits of the confidence interval for each estimated proportion on the curve.

Â If we ever wanted to do that.

Â All right, anyway we are going to look at some examples of logistic regression from

Â the published literature in the next section.

Â Thank you.

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