Linear regression

Last updated: November 01, 2022

Linear regression

Step2 Review

Step2 Review

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
Sensitivity and specificity
Positive and negative predictive value
Test precision and accuracy
Incidence and prevalence
Relative and absolute risk
Odds ratio
Attributable risk (AR)
Mortality rates and case-fatality
DALY and QALY
Direct standardization
Indirect standardization
Study designs
Clinical trials
Disease causality
Selection bias
Confounding
Interaction
Prevention
Eczematous rashes: Clinical
Papulosquamous skin disorders: Clinical
Alopecia: Clinical
Hypersensitivity skin reactions: Clinical
Autoimmune bullous skin disorders: Clinical
Blistering skin disorders: Clinical
Hypopigmentation skin disorders: Clinical
Benign hyperpigmented skin lesions: Clinical
Skin cancer: Clinical
Immunodeficiencies: Clinical
Antihistamines for allergies
Glucocorticoids
Advanced cardiac life support (ACLS): Clinical
Supraventricular arrhythmias: Pathology review
Ventricular arrhythmias: Pathology review
Heart blocks: Pathology review
Coronary artery disease: Clinical
Heart failure: Clinical
Syncope: Clinical
Pericardial disease: Clinical
Cardiomyopathies: Clinical
Hypertension: Clinical
Hypercholesterolemia: Clinical
Sympatholytics: Alpha-2 agonists
Adrenergic antagonists: Presynaptic
Adrenergic antagonists: Alpha blockers
Adrenergic antagonists: Beta blockers
ACE inhibitors, ARBs and direct renin inhibitors
Thiazide and thiazide-like diuretics
Calcium channel blockers
cGMP mediated smooth muscle vasodilators
Class I antiarrhythmics: Sodium channel blockers
Class II antiarrhythmics: Beta blockers
Class III antiarrhythmics: Potassium channel blockers
Class IV antiarrhythmics: Calcium channel blockers and others
Lipid-lowering medications: Statins
Lipid-lowering medications: Fibrates
Miscellaneous lipid-lowering medications
Positive inotropic medications
Diabetes mellitus: Clinical
Hyperthyroidism: Clinical
Hypothyroidism and thyroiditis: Clinical
Parathyroid conditions and calcium imbalance: Clinical
Pituitary adenomas and pituitary hyperfunction: Clinical
Hypopituitarism: Clinical
Cushing syndrome: Clinical
Adrenal masses and tumors: Clinical
Adrenal insufficiency: Clinical
MEN syndromes: Clinical
Hyperthyroidism medications
Hypothyroidism medications
Insulins
Hypoglycemics: Insulin secretagogues
Miscellaneous hypoglycemics
Adrenal hormone synthesis inhibitors
Mineralocorticoids and mineralocorticoid antagonists
Esophageal disorders: Clinical
Esophagitis: Clinical
Gastroesophageal reflux disease (GERD): Clinical
Gastroparesis: Clinical
Malabsorption: Clinical
Inflammatory bowel disease: Clinical
Jaundice: Clinical
Cirrhosis: Clinical
Laxatives and cathartics
Antidiarrheals
Acid reducing medications
Fever of unknown origin: Clinical
Fat-soluble vitamin deficiency and toxicity: Pathology review
Anemia: Clinical
Microcytic anemia: Pathology review
Non-hemolytic normocytic anemia: Pathology review
Intrinsic hemolytic normocytic anemia: Pathology review
Extrinsic hemolytic normocytic anemia: Pathology review
Macrocytic anemia: Pathology review
Heme synthesis disorders: Pathology review
Leukemia: Clinical
Lymphoma: Clinical
Thrombocytopenia: Clinical
Bleeding disorders: Clinical
Thrombophilia: Clinical
Myeloproliferative neoplasms: Clinical
Plasma cell disorders: Clinical
Blood products and transfusion: Clinical
Anticoagulants: Heparin
Anticoagulants: Warfarin
Anticoagulants: Direct factor inhibitors
Antiplatelet medications
Thrombolytics
Hematopoietic medications
Ribonucleotide reductase inhibitors
Topoisomerase inhibitors
Platinum containing medications
Anti-tumor antibiotics
Microtubule inhibitors
DNA alkylating medications
Monoclonal antibodies
Antimetabolites for cancer treatment
Infective endocarditis: Clinical
Pneumonia: Clinical
Tuberculosis: Pathology review
Diarrhea: Clinical
Viral hepatitis: Clinical
Urinary tract infections: Clinical
Meningitis, encephalitis and brain abscesses: Clinical
Bites and stings: Clinical
Protein synthesis inhibitors: Aminoglycosides
Antimetabolites: Sulfonamides and trimethoprim
Antituberculosis medications
Miscellaneous cell wall synthesis inhibitors
Protein synthesis inhibitors: Tetracyclines
Cell wall synthesis inhibitors: Penicillins
Miscellaneous protein synthesis inhibitors
Cell wall synthesis inhibitors: Cephalosporins
DNA synthesis inhibitors: Metronidazole
DNA synthesis inhibitors: Fluoroquinolones
Integrase and entry inhibitors
Nucleoside reverse transcriptase inhibitors (NRTIs)
Protease inhibitors
Hepatitis medications
Non-nucleoside reverse transcriptase inhibitors (NNRTIs)
Neuraminidase inhibitors
Herpesvirus medications
Azoles
Echinocandins
Miscellaneous antifungal medications
Anthelmintic medications
Antimalarials
Anti-mite and louse medications
Hypernatremia: Clinical
Hyponatremia: Clinical
Hyperkalemia: Clinical
Hypokalemia: Clinical
Metabolic and respiratory acidosis: Clinical
Metabolic and respiratory alkalosis: Clinical
Toxidromes: Clinical
Medication overdoses and toxicities: Pathology review
Acute kidney injury: Clinical
Chronic kidney disease: Clinical
Nephritic and nephrotic syndromes: Clinical
Renal tubular defects: Pathology review
Renal tubular acidosis: Pathology review
Osmotic diuretics
Carbonic anhydrase inhibitors
Loop diuretics
Potassium sparing diuretics
Stroke: Clinical
Seizures: Clinical
Headaches: Clinical
Hyperkinetic movement disorders: Clinical
Hypokinetic movement disorders: Clinical
Muscle weakness: Clinical
Disorders of consciousness: Clinical
Spinal cord disorders: Pathology review
Sympathomimetics: Direct agonists
Muscarinic antagonists
Cholinomimetics: Direct agonists
Cholinomimetics: Indirect agonists (anticholinesterases)
Anticonvulsants and anxiolytics: Barbiturates
Anticonvulsants and anxiolytics: Benzodiazepines
Nonbenzodiazepine anticonvulsants
Migraine medications
Anti-parkinson medications
Medications for neurodegenerative diseases
Asthma: Clinical
Chronic obstructive pulmonary disease (COPD): Clinical
Diffuse parenchymal lung disease: Clinical
Venous thromboembolism: Clinical
Acute respiratory distress syndrome: Clinical
Pleural effusion: Clinical
Pneumothorax: Clinical
Lung cancer: Clinical
Bronchodilators: Beta 2-agonists and muscarinic antagonists
Bronchodilators: Leukotriene antagonists and methylxanthines
Joint pain: Clinical
Rheumatoid arthritis: Clinical
Seronegative arthritis: Clinical
Systemic lupus erythematosus (SLE): Clinical
Sjogren syndrome: Clinical
Inflammatory myopathies: Clinical
Vasculitis: Clinical
Acetaminophen (Paracetamol)
Non-steroidal anti-inflammatory drugs
Opioid agonists, mixed agonist-antagonists and partial agonists
Antigout medications
Osteoporosis medications
Pregnancy
Routine prenatal care: Clinical
Hypertensive disorders of pregnancy: Clinical
Antepartum hemorrhage: Clinical
Premature rupture of membranes: Clinical
Stages of labor
Abnormal labor: Clinical
Vaginal versus cesarean delivery: Clinical
Postpartum hemorrhage: Clinical
Gestational trophoblastic disease: Clinical
Breastfeeding
Abdominal pain: Clinical
Puberty and Tanner staging
Amenorrhea: Clinical
Contraception: Clinical
Virilization: Clinical
Infertility: Clinical
Vulvovaginitis: Clinical
Sexually transmitted infections: Clinical
Menopause
Abnormal uterine bleeding: Clinical
Ovarian cysts, cancer, and other adnexal masses: Clinical
Endometrial hyperplasia and cancer: Clinical
Cervical cancer: Clinical
Vaginal cancer: Clinical
Vulvar cancer: Clinical
Estrogens and antiestrogens
Progestins and antiprogestins
Androgens and antiandrogens
Aromatase inhibitors
Uterine stimulants and relaxants
Newborn management: Clinical
Neonatal ICU conditions: Clinical
Congenital TORCH infections: Pathology review
Neonatal jaundice: Clinical
Perinatal infections: Clinical
Congenital disorders: Clinical
Congenital heart defects: Clinical
Autosomal trisomies: Pathology review
Miscellaneous genetic disorders: Pathology review
Disorders of carbohydrate metabolism: Pathology review
Disorders of fatty acid metabolism: Pathology review
Glycogen storage disorders: Pathology review
Lysosomal storage disorders: Pathology review
Mood disorders: Clinical
Anxiety disorders: Clinical
Schizophrenia spectrum disorders: Clinical
Dissociative disorders: Clinical
Eating disorders: Clinical
Obsessive compulsive disorders: Clinical
Trauma- and stressor-related disorders: Clinical
Disruptive, impulse-control and conduct disorders: Clinical
Personality disorders: Clinical
Sleep disorders: Clinical
Somatic symptom disorders: Clinical
Sexual dysfunctions: Clinical
Paraphilic disorders: Clinical
Substance misuse and addiction: Clinical
Drug misuse, intoxication and withdrawal: Hallucinogens: Pathology review
Psychiatric emergencies: Pathology review
Preoperative evaluation: Clinical
Postoperative evaluation: Clinical
General anesthetics
Local anesthetics
Neuromuscular blockers
Esophageal surgical conditions: Clinical
Gastrointestinal bleeding: Clinical
Peptic ulcers and stomach cancer: Clinical
Appendicitis: Clinical
Diverticular disease: Clinical
Hernias: Clinical
Bowel obstruction: Clinical
Colorectal cancer: Clinical
Abdominal trauma: Clinical
Anal conditions: Clinical
Gallbladder disorders: Clinical
Pancreatitis: Clinical
Breast cancer: Clinical
Benign breast conditions: Pathology review
Anatomy clinical correlates: Anterior and posterior abdominal wall
Anatomy clinical correlates: Breast
Valvular heart disease: Clinical
Chest trauma: Clinical
Anatomy clinical correlates: Thoracic wall
Anatomy clinical correlates: Heart
Anatomy clinical correlates: Pleura and lungs
Anatomy clinical correlates: Mediastinum
Dizziness and vertigo: Clinical
Thyroid nodules and thyroid cancer: Clinical
Neck trauma: Clinical
Nasal, oral and pharyngeal diseases: Pathology review
Traumatic brain injury: Clinical
Brain tumors: Clinical
Lower back pain: Clinical
Eye conditions: Refractive errors, lens disorders and glaucoma: Pathology review
Eye conditions: Retinal disorders: Pathology review
Eye conditions: Inflammation, infections and trauma: Pathology review
Anatomy clinical correlates: Clavicle and shoulder
Anatomy clinical correlates: Axilla
Anatomy clinical correlates: Arm, elbow and forearm
Anatomy clinical correlates: Wrist and hand
Anatomy clinical correlates: Median, ulnar and radial nerves
Burns: Clinical
Prostate disorders and cancer: Pathology review
Testicular tumors: Pathology review
Kidney stones: Clinical
Renal cysts and cancer: Clinical
Urinary incontinence: Pathology review
PDE5 inhibitors
Peripheral vascular disease: Clinical
Leg ulcers: Clinical
Aortic aneurysms and dissections: Clinical

Transcript

Watch video only

Content Reviewers

Contributors

Let’s say you want to figure out if smoking more cigarettes leads to a lower forced expiratory volume, or FEV, which is the total amount of air, in liters per second, that a person can exhale in a single forced breath.

And let’s say that healthy men generally have an FEV of around 4 liters per second.

Now, to figure out if men who smoke have a lower FEV, you might ask 100 men how many cigarettes they smoke in a day, and then measure each man’s FEV.

You could plot these measurements, or data points, on a scatterplot, with the number of cigarettes, which is the exposure, on the x-axis, and FEV, which is the outcome, on the y-axis, and where each data point represents one individual.

Typically, a linear trend line, or model, is drawn to represent the pattern of data points on the plot.

Theoretically, there are lots of lines that can be drawn to represent the data points, but the best trend line is the one with the smallest amount of error, which is a measurement of how far away an individual data point is from the trend line.

Usually, we look at the squared error, which is the distance between the data point and the line, squared.

For example, if a data point is very close to the trend line, then the squared error is small.

On the other hand, if a data point is very far from the trend line, then the squared error is large.

If you add up all the squared error for a line, you get the total squared error, and a line with a smaller total squared error is considered a better fit for the data than a line with a larger total squared error.

Now, when two variables are linearly related, we might want to know specifically what happens to the outcome variable when the exposure variable changes.

For example, we might want to know how a person’s FEV changes if they smoke five cigarettes per day compared to if they smoke ten cigarettes per day.

To figure this out, we have to use linear regression, which is a statistical method that calculates an equation for the best fitting trend line for a set of data points.

Specifically, in this case, we would use simple linear regression, since we only have two variables—one y-variable, which is the FEV measurement, and one x-variable, which is the number of cigarettes.

This is different from multiple linear regression, where there’s one y-variable and two or more x-variables.

Typically, multiple linear regression is used to control for confounding variables, or x-variables that distort the true relationship between the main exposure variable and the outcome variable.

For example, age is a confounding variable in the relationship between smoking and FEV, because older people tend to have a lower FEV than younger people.

So, let’s say you wanted to figure out how FEV changes for people who smoke more cigarettes per day, controlling for age.

In this example, there are two x-variables—the number of cigarettes a person smokes and a person’s age—so, you’d have to use multiple linear regression.

Now, there are four key assumptions that are used in linear regression, and an acronym for these assumptions is L-I-N-E, or LINE.

First, the relationship between the two variables has to be Linear, which means that the trendline drawn to represent the data points is a straight line.

Relationships that have a different type of curve, like in an exponential relationship or a U-shaped relationship, will have a low correlation coefficient because a straight trendline doesn’t match the shape of the data points.

The second assumption is that each individual in the sample was recruited independently from other individuals in the sample.

In other words, no individuals influenced whether or not any other individual was included in the study.

For example, if one person agrees to be in the study only if their friend can also be included in the study, then these two individuals would not be independent of each other and the second assumption would not be met.

Independent recruitment ensures that the people included in the study have similar characteristics to the target population, and that the results of the test can be applied to the target population - meaning it has good external validity!

Additionally, the sample population must have been recruited randomly, like if you chose 100 names randomly from a list of all names in the target population.

Like independent recruitment, random sampling is important because it ensures that the sample population approximates the target population.

The third assumption is that the errors between the observed and predicted values of y are Normally distributed around a value of x. That might sound confusing - no worries.

Let’s break it down, by reviewing the trendline, which shows a predicted y-value for a specific x-value.

For example, let’s say we have a trendline that looks like this. According to our trendline, for people that smoke 10 cigarettes per day, we predict that their FEV will be around 3 liters per second.

But in reality, some people that smoke 10 cigarettes per day will have an FEV that’s higher or lower than 3, simply because of individual differences, like how old a person is or how much a person exercises.

Now, remember that the distance a point is from the prediction line is called error, and points that are far from the line are said to have a high error.

Okay, so the third assumption says that the errors for a given point will follow a normally distributed bell curve, meaning most people will have low error, so their FEV will be clustered near the trendline; and fewer people will have high error, so their FEV will be higher or lower than the trendline. And this is true for every value of x, or for each number of cigarettes smoked per day.

The fourth assumption is that the data points must have Equal variance, which is also called homoscedasticity.

Basically, this means that the data points are equally spread out from the trendline for every value of x.

If the data points are closer to the trendline on one end and further away on the other end, then the assumption of equal variance is not met and the data are heteroscedastic.

Key Takeaways

Linear regression is a mathematical technique used to estimate the relationship between two variables. It is used when the relationship between the two variables is linear (meaning that it follows a straight line).

The linear regression equation looks like this: y = ax + b, where y is the predicted value, x is the independent variable (the one we are trying to predict), a is the slope of the line, and b is the y-intercept.

If we know the values of a and b, we can use the equation to predict the value of y for any given x. We can also use linear regression to determine how strong (or weak) the relationship between x and y actually is.