Logistic regression

Last updated: November 01, 2022

Logistic regression

Watch later

Watch later

Diabetes mellitus: Pathology review
Osmoregulation
Cranial nerves
Renin-angiotensin-aldosterone system
Light microscopy and staining methods
Glucose-6-phosphate dehydrogenase (G6PD) deficiency
Tobacco use disorder
Introduction to biostatistics
Types of data
Probability
Mean, median, and mode
Range, variance, and standard deviation
Standard error of the mean (Central limit theorem)
Normal distribution and z-scores
Paired t-test
Two-sample t-test
Hypothesis testing: One-tailed and two-tailed tests
One-way ANOVA
Two-way ANOVA
Repeated measures ANOVA
Correlation
Methods of regression analysis
Linear regression
Logistic regression
Spearman's rank correlation coefficient
Mann-Whitney U test
Kappa coefficient
Chi-squared test
Fisher's exact test
Kaplan-Meier survival analysis
Type I and type II errors
Cardiovascular system anatomy and physiology
Coronary circulation
Blood pressure, blood flow, and resistance
Pressures in the cardiovascular system
Measuring cardiac output (Fick principle)
Stroke volume, ejection fraction, and cardiac output
Cardiac contractility
Cardiac preload
Cardiac afterload
Law of Laplace
Cardiac and vascular function curves
Altering cardiac and vascular function curves
Cardiac cycle
Cardiac work
Pressure-volume loops
Changes in pressure-volume loops
Frank-Starling relationship
Microcirculation and Starling forces
Abnormal heart sounds
Normal heart sounds
HIV (AIDS)
Integrase and entry inhibitors
Nucleoside reverse transcriptase inhibitors (NRTIs)
Protease inhibitors
Hepatitis medications
Non-nucleoside reverse transcriptase inhibitors (NNRTIs)
Neuraminidase inhibitors
Herpesvirus medications
Diarrhea: Clinical
Celiac disease
Ketone body metabolism
Pediatric allergies: Clinical
Phenylketonuria (NORD)
Antituberculosis medications
Diabetes mellitus
Insulins
Hypertension
Hypertension: Clinical
Type III hypersensitivity
Type IV hypersensitivity
Type I hypersensitivity
Type II hypersensitivity
Poliovirus
Gastrointestinal hormones
Cell cycle
Osteoarthritis
Pediatric brain tumors
Adult brain tumors
Pediatric bone tumors: Clinical
Bone tumors: Pathology review
Inflammatory bowel disease: Clinical
Cholinergic receptors
Adrenergic receptors
Cholinomimetics: Direct agonists
Cholinomimetics: Indirect agonists (anticholinesterases)
Muscarinic antagonists
Sympathomimetics: Direct agonists
Sympatholytics: Alpha-2 agonists
Adrenergic antagonists: Presynaptic
Adrenergic antagonists: Alpha blockers
Adrenergic antagonists: Beta blockers
Sexually transmitted infections: Clinical
Cell wall synthesis inhibitors: Penicillins
Lung volumes and capacities
Gas exchange in the lungs, blood and tissues
Clostridium botulinum (Botulism)
Dyslipidemias: Pathology review
Lactose intolerance
Glucagon
Cystic fibrosis: Pathology review
MHC class I and MHC class II molecules
Fetal circulation
Hypokalemia: Clinical
Hyperkalemia: Clinical
Anatomy and physiology of the male reproductive system
Anatomy of the male reproductive organs of the pelvis
Anatomy and physiology of the female reproductive system
Anatomy of the female urogenital triangle
Vaginal and vulvar disorders: Pathology review
Iron deficiency anemia
Appendicitis: Clinical
Hyperthyroidism: Pathology review
Hunger and satiety
Thyroid cancer
Syndrome of inappropriate antidiuretic hormone secretion (SIADH)
Autoimmune polyglandular syndrome type 1 (NORD)
Multiple endocrine neoplasia
Multiple endocrine neoplasia: Pathology review
Selective serotonin reuptake inhibitors
Serotonin and norepinephrine reuptake inhibitors
Tricyclic antidepressants
Monoamine oxidase inhibitors
Atypical antidepressants
Typical antipsychotics
Atypical antipsychotics
Lithium
Nonbenzodiazepine anticonvulsants
Anticonvulsants and anxiolytics: Barbiturates
Anticonvulsants and anxiolytics: Benzodiazepines
Psychomotor stimulants
Anticoagulants: Heparin
Anticoagulants: Warfarin
Anticoagulants: Direct factor inhibitors
Antiplatelet medications
Thrombolytics
Nervous system anatomy and physiology
Blood brain barrier
Ascending and descending spinal tracts
Pyramidal and extrapyramidal tracts
Dementia: Pathology review
Muscular dystrophies and mitochondrial myopathies: Pathology review
Hidradenitis suppurativa
Viral hepatitis: Clinical
Cauda equina syndrome
Cervical cancer
Skin cancer
Gastric cancer
Lung cancer
Colorectal cancer
Pancreatic cancer
Skin cancer: Clinical
Breast cancer: Clinical
Cytokines
Intracerebral hemorrhage
Amino acid metabolism
Citric acid cycle
DNA mutations
Rotator cuff tear
Compartment syndrome
Anatomy of the knee joint
Acute intermittent porphyria
Primary sclerosing cholangitis
Primary biliary cholangitis
Drug misuse, intoxication and withdrawal: Alcohol: Pathology review
Substance misuse and addiction: Clinical
Gene regulation
General anesthetics
Retinopathy of prematurity
Erythema multiforme
Papulosquamous skin disorders: Clinical
Psoriasis
DNA damage and repair
Attention deficit hyperactivity disorder
Glycogen storage disorders: Pathology review
Coronary steal syndrome
Anatomy of the coronary circulation
Coronary artery disease: Clinical
ECG cardiac infarction and ischemia
Local anesthetics
Chest trauma: Clinical
Polycystic ovary syndrome
Pediatric vomiting: Clinical
Pediatric ophthalmological conditions: Clinical
BRUE, ALTE, and SIDS: Clinical
Pediatric orthopedic conditions: Clinical
Congenital heart defects: Clinical
Neonatal jaundice: Clinical
Congenital adrenal hyperplasia: Clinical
Thyroid nodules and thyroid cancer: Clinical
Hypothyroidism and thyroiditis: Clinical
Ectoderm
Endoderm
Mesoderm
Breast cancer
Amyloidosis
Coronary artery disease: Pathology review
Introduction to the immune system
Contracting the immune response and peripheral tolerance
Innate immune system
Viral structure and functions
Bone histology
Bone remodeling and repair
Vessels and nerves of the hand
Jaundice: Clinical
Neonatal ICU conditions: Clinical
Jaundice: Pathology review
Stroke: Clinical
Transcription of DNA
Lac operon
Oncogenes and tumor suppressor genes
Epigenetics
Dizziness and vertigo: Clinical
ECG axis
ECG basics
ECG intervals
ECG QRS transition
ECG normal sinus rhythm
ECG rate and rhythm
ECG cardiac hypertrophy and enlargement
Carcinoid syndrome
Cushing syndrome and Cushing disease: Pathology review
Lung cancer and mesothelioma: Pathology review
Lung cancer: Clinical
Imaging features of COVID-19 (LifeBridge Health)
Development of the COVID-19 vaccine
Standards of care for COVID-19 patients
Safety of the COVID-19 vaccines
COVID-19 mutant variants and herd immunity
COVID-19 vaccines: What healthcare providers need to know
Mitosis and meiosis
Amino acids and protein folding
Neurofibromatosis
Drug administration and dosing regimens
Neuron action potential
Gestational trophoblastic disease: Clinical
Physiological changes during exercise
Nitrogen and urea cycle
Fatty acid synthesis
Electron transport chain and oxidative phosphorylation
Cellular structure and function
Carbohydrates and sugars
Glycolysis
Rheumatoid arthritis
Systemic lupus erythematosus
Ischemic stroke
Anatomy of the heart
Headaches: Pathology review
Herpes simplex virus
Neurocutaneous disorders: Pathology review
Temporomandibular joint dysfunction
Pituitary tumors: Pathology review
Anatomy of the blood supply to the brain
Anatomy of the brainstem
Immunodeficiencies: T-cell and B-cell disorders: Pathology review

Transcript

Watch video only

Content Reviewers

Logistic regression is a type of statistical method that’s used to describe the relationship between an outcome variable and one or more exposure variables.

In logistic regression, the outcome variable is always categorical, and the exposure variables can be either categorical or quantitative.

For example, let’s say you want to figure out if smoking more cigarettes increases the chance of having a heart attack. In this case, the number of cigarettes is a quantitative exposure and whether or not a person has a heart attack is a categorical outcome.

Now, to figure this out, you might ask 200 people how many cigarettes they smoke in a day, and then follow that group of people for five years and see who has a heart attack and who doesn’t.

You could organize your data in a table like this—where the first column, or variable, is the number of cigarettes a person smokes, the second column is if they had a heart attack or not, and the rest of the columns are other characteristics, or variables, that you collected about each person, like their age, sex, and body mass index, or BMI.

Usually, for binary variables, like yes or no, we use the numbers zero and 1 to represent the two possible answers.

So, for the heart attack variable, we might say that zero represents “no” and 1 represents “yes”. We could do the same thing for sex, where zero represents females and 1 represents males.

Now, let’s just look at the first two variables, so how many cigarettes they smoke and if they had a heart attack or not. You could plot these measurements, or data points, on a scatterplot, with the number of cigarettes on the x-axis, and heart attack on the y-axis, and where each data point represents one individual.

This scatterplot might seem a little funny looking, and that’s because all of the data points are clustered on two points on the y-axis—they’re either on the zero, which represents no, or the 1, which represents yes.

This scatterplot can help us figure out how the odds of having a heart attack changes for people as they smoke more and more cigarettes.

And that’s the goal of logistic regression.

Now, in statistics, probability and odds are often confused with one another, so let’s break down the difference.

The probability is the number of times an outcome happened divided by the number of times the outcome could have happened, and it’s often represented by a capital P.

So, using our data, we could figure out the probability of having a heart attack for each number of cigarettes smoked per day.

Let’s say the range for the number of cigarettes smoked is between zero and 19, so we can break up the scatterplot up into 20 different sections - and it’s 20 sections instead of just 19 because zero is also a section.

Now, to find the probability of having a heart attack in a specific section, we count up the number of people who had heart attacks in that section and divide it by the total number of people in that section.

As an example, let’s say there are 10 people in the 15-cigarette section - or in other words, there are 10 people in the study that smoke 15 cigarettes per day - and of those 10 people, 6 people had heart attacks. So, the probability of having a heart attack for people that smoke 15 cigarettes per day is 6 over 10, or 60%.

Now let’s switch gears and talk about odds. Odds compare the probability of an outcome occurring with the probability of an outcome not occurring, so the equation for odds is P divided by 1 minus P.

So, in our example, we’d use the probability of having a heart attack - which is 60%, or 0.6 - compared with the probability of not having a heart attack, which is 1 minus 0.6, or 0.4. If we divide both sides by 0.4 we get 1.5 compared to 1.

To make it easier to interpret, let’s multiply both sides by two, so we get a 3 to 2 ratio. In other words, out of all the people that smoke 15 cigarettes per day, there are 3 people that have heart attacks for every 2 people that don’t have heart attacks.

Okay, coming back to the scatterplot... typically, in linear regression, a linear trend line is drawn to represent the pattern of data points on the plot, and that line is represented by the equation: y-hat equals b0 plus b1x1, where y-hat is the estimated value for the outcome variable; x1 is the value of the exposure variable; b0 represents the y-intercept; and b1 represents the slope of the line.

But in logistic regression, the trend line looks a bit different. That’s because the data points for logistic regression aren’t arranged in a straight line, so a linear trend line isn’t a good fit, or representation, of the data.

Instead, the trend line for logistic regression is curved, and specifically, it’s an S-shaped curve. And the equation for this S-shaped curve is P equals e, raised to the power of b0 plus b1x1, divided by 1 plus e, raised to the power of b0 plus b1x1.

At this point, you might be wondering what trend lines have to do with probability and odds.

Well, the slope of a line at a specific point represents a certain probability - so a data point on a very steep slope represents a high probability and a data point on a very shallow slope represents a low probability.

So with an S-shaped curve, the probability of an occurrence - which in this case, is the probability of having a heart attack - is different at various points along the line, which makes it pretty hard to interpret.

For example, toward the bottom of the line, the probability is low, then toward the middle of the line, the probability is higher, and then at the top of the line, the probability is low again.

And this is a problem because typically, we want to draw a line that represents the whole sample population, so that we can make conclusions about the whole sample population.

To fix this problem, we have to transform, or change, our data points so that they’re arranged on the plot in a more linear pattern. To do this, we have to change our data from looking at probability to looking at odds, and we actually have to go one step further and change them to the logarithm of odds, or the log-odds.

So, if the basic equation for odds is P over 1 minus P, then to change our probability equation to an odds equation, we do P over 1 minus P equals - e, raised to the power of b0 plus b1x1 - over - 1 minus e, raised to the power of b0 plus b1x1.

If you simplify this equation - which we won’t show here, just for simplicity’s sake - what you end up with is P over 1 minus P equals e, raised to the power of b0 plus b1x1. Okay, so that’s the odds equation.

And to change the odds equation to the log-odds, we just take the log of both sides. So, we end up with log of P over 1 minus P equals b0 plus b1x1.

This equation, as you might recognize, is the equation for a linear trend line. And, in fact, if we look at the newly transformed data, we’ll see that it’s now linearly arranged on the plot.

Whew! Sometimes the math can seem a little confusing, but luckily, statistical software does most of that work for us!

Basically, the software spits out values for b0 and b1, which we can then plug into our equation. For example, let’s say the software gives us a b0 of 0.05 and a b1 of 0.2, so the equation for the line would be y-hat equals 0.05 plus 0.2 times x1.

Key Takeaways

Logistic regression is a statistical method used to describe the relationship between an outcome variable and one or more exposure variables. Logistic regression can help to figure out the effect of an exposure variable (e.g. the number of cigarettes per day) on a categorical outcome variable (e.g. Having a heart attack). Note that the outcome variable is always categorical, but the exposure variables can be either categorical or quantitative.