
Explore a comprehensive introduction to linear modeling in R, covering inference, ANOVA, regression, generalized linear and additive models, mixed and nested designs, and model validation.
Install and configure R and R Commander, then access course materials and screenshots to run analyses with both scripts and menus for comprehensive linear modeling.
Engage with every section’s exercises by watching the video, then recreate the video using the commander on your own, and attempt each exercise before checking the provided solutions.
Explore graphical displays in R Commander, using menus and scripts to create a box plot of mortality from the US melanoma dataset, and translate menu actions to R code.
Learn to set up and navigate R with our commander menus, load packages, and work with datasets like the US melanoma study, using base and lattice graphics to explore data.
Explore generating and customizing box plots and histograms in Rcmdr, including dataset reference with the dollar syntax, horizontal versus vertical orientation, and scripting versus menus.
Combine box plots and histograms in one graphics frame with range and margins. Compare mortality by ocean status using parallel box plots and consider density plots as an alternative.
Combine density plots with histograms and box plots to compare mortality by ocean proximity. Create density variables, add a legend, and use a scatterplot matrix for latitude, longitude, and mortality.
Explore graphical displays in Rcmdr for modeling relationships among happiness, health, and income, including spline plots, stacked bar charts, two-dimensional histograms, and conditional density plots with log-transformed income.
Learn to export the active dataset as a tab-delimited text file via Rcmdr menus, save it to disk, and import text files back into R with headers and tab delimiters.
Statistical inference is the process of deducing properties of an underlying distribution by analysis of data. Inferential statistical analysis infers properties about a population: this includes testing hypotheses and deriving estimates. The population is assumed to be larger than the observed data set; in other words, the observed data is assumed to be sampled from a larger population.
Explore how to infer room width using rcmdr by loading data, converting units to a consistent basis, and comparing mean estimates with grouped numerical summaries and box plots.
Subset data to create an active data set in R Commander and compare groups using Welch and Wilcoxon tests. Evaluate normality with Q-Q plots and Shapiro-Wilk tests to confirm assumptions.
Analyze the waves data by comparing two morphing methods using a difference variable, box plots, q-q plots, and a paired t-test, with an optional Wilcoxon nonparametric check.
Explore non-parametric inference with paired Wilcoxon tests, and assess relationships between water hardness and mortality across north and south towns using box plots, scatter plots, and Pearson correlation.
Revisit conditional inference using a permutation test to reanalyze a room width study, converting feet and meters to a common unit and comparing mean estimates.
Compare resident and physician counts of birth anomalies using a matrix of paired observations, apply a marginal-homogeneity test from coin, and interpret significant differences in marginal estimates.
Practice drawing a variety of plots by manipulating raw variables with arithmetic in chapter 2. Learn to label scatterplot points using the text function via help tips.
Examine graphical analysis of household spending by category (housing, food, goods and service) and gender, compute proportions from total expenditures, and compare men and women using scatterplots with regression lines.
Learn to create multiple plots in R: five side-by-side box plots of suicide rates by age groups, a labeled scatterplot matrix, and a trellised plot of homicide by income.
Explore conditional inference by creating two normal groups with different means and comparing them with exact, Wilcoxon rank-sum, and permutation tests, using a script and simulations.
Analysis of variance (ANOVA) is a collection of statistical models used to analyze the differences among group means and their associated procedures (such as "variation" among and between groups). In the ANOVA setting, the observed variance in a particular variable is partitioned into components attributable to different sources of variation. In its simplest form, ANOVA provides a statistical test of whether or not the means of several groups are equal, and therefore generalizes the t-test to more than two groups.
The lecture demonstrates creating a four-level interaction variable in Rcmdr by combining source and type, then analyzing weight gain in rats to reveal a potential beef x protein interaction.
Learn to model weight gain and foster feeding in rats with R, using lm and ANOVA to analyze main effects and interactions in unbalanced designs.
Apply a multivariate analysis of variance to test if north versus south location affects water hardness and mortality, using two dependent variables and Wilks' test.
Explores how five time-period groups of skull measurements from ancient egypt vary over time to test evolution versus interbreeding. Shows how to summarize by time period and explore the relationships among skull measurements like bh and bl through plots, with a dataset of 150 observations.
Explore relationships among four skull measurements with a scatterplot matrix of numerical variables, then run a MANOVA across five time periods and interpret pairwise time-period differences.
Engage with two exercise sets in your folder, focusing on inference, with one set a bit harder and a couple of simple problems about a Nova.
In statistics, linear regression is an approach for modeling the relationship between a scalar dependent variable y and one or more explanatory variables (or independent variables) denoted X. The case of one explanatory variable is called simple linear regression. For more than one explanatory variable, the process is called multiple linear regression
Explore estimating the age of the universe through a simple regression of galaxies' velocities on their distances using linear modeling in R with the Hubble data.
Explore testing hypotheses and estimating uncertainty in linear models with R, using t-statistics, p-values, confidence intervals, and AIC to compare models and interpret beta coefficients.
Explore how cloud seeding with silver iodide interacts with cloud tops and prior rainfall to affect rainfall, using a suitability criterion and 24 days of Florida data.
Explore rainfall relationships through scatterplot matrix, identify outliers, and fit a linear model in R to test seeding interactions with ecological factors, highlighting significant interaction effects.
Use standard diagnostic plots to evaluate fitted models, compare M1 and M2, and note how removing two outliers (rows 1 and 15) shifts seeding interactions with wetness and other factors.
Assess model assumptions with error checking plots, examine residuals, q-q plots, and Cookes distance to evaluate normality and leverage in linear modeling.
Examine how extreme x-values and outliers affect model fit and slope. Assess leverage and Cook's distance, then explore survival plots and Cox regression assumptions.
In statistics, the generalized linear model (GLM) is a flexible generalization of ordinary linear regression that allows for response variables that have error distribution models other than a normal distribution. The GLM generalizes linear regression by allowing the linear model to be related to the response variable via a link function and by allowing the magnitude of the variance of each measurement to be a function of its predicted value.
Explore how plasma proteins relate to the erythrocyte sedimentation rate using a binary generalized linear model with binomial error and logit link, focusing on fibrinogen and globulin and odds ratios.
Apply logistic regression in a generalized linear model to predict ESR rate as a binary outcome using fibrinogen and globulin; compare models with AIC and deviance for fit.
Compare two models predicting ESR with an analysis of variance; when chi-squared is not significant, choose the simpler model per Ockham's razor, noting fibrinogen's odds ratio for unhealthy ESR.
Explore how education and gender influence agreement with the statement on women's roles, using a 42-row factorial design of counts and a binomial glm with a logit link.
Explore how education relates to the probability of agreeing with a statement using R, computing predicted values, plotting by gender, and testing an education by gender interaction.
Examine how an interaction term alters gendered education effects on agreement and display results with male/female symbols; evaluate model fit via diagnostic plots, residuals, and Cookes distance.
Evaluate a placebo-controlled trial of colonic polyps using a Poisson GLM with treatment and age as covariate, then address overdispersion with a quasi-Poisson model and interpret residual deviance.
Analyzes whether driving is a risk factor for back pain from acute herniated lumbar discs using a case-control design and clogit in R to estimate odds ratios.
Survival analysis is a branch of statistics for analyzing the expected duration of time until one or more events happen, such as death in biological organisms and failure in mechanical systems. This topic is called reliability theory or reliability analysis inengineering, duration analysis or duration modelling in economics, and event history analysis in sociology. Survival analysis attempts to answer questions such as: what is the proportion of a population which will survive past a certain time? Of those that survive, at what rate will they die or fail? Can multiple causes of death or failure be taken into account? How do particular circumstances or characteristics increase or decrease the probability of survival?
A smoother is a statistical technique for estimating a real valued function by using its noisy observations, when no parametric model for this function is known. The estimated function is smooth, or non-linear, and the level of smoothness is set by a single parameter.
In statistics, a generalized additive model (GAM) is a generalized linear model in which the linear predictor depends linearly on unknown smooth functions of some predictor variables, and interest focuses on inference about these smooth functions.
Explore partial effects of six covariates on sulfur dioxide. Use a GAM boosting model with smooth fits to reveal relationships among temperature, population, manufacturing, wind, and precipitation.
Kyphosis (from Greek κυφός kyphos, a hump) refers to the abnormally excessive convex kyphotic curvature of the spine as it occurs in the thoracic and sacral regions. (Inward concave curving of the cervical and lumbar regions of the spine is called lordosis.) Kyphosis can be called roundback or Kelso's hunchback. It can result from degenerative diseases such as arthritis; developmental problems, most commonlyScheuermann's disease; osteoporosis with compression fractures of the vertebra; Multiple myeloma or trauma.
Fit a logistic generalized additive model using the GAM framework, estimate smooth terms with cubic splines, plot and interpret partial effects and 95% confidence intervals for kyphosis recurrence.
LOESS and LOWESS (locally weighted scatterplot smoothing) are two strongly related non-parametric regression methods that combine multiple regression models in a k-nearest-neighbor-based meta-model. "LOESS" is a later generalization of LOWESS; although it is not a true initialism, it may be understood as standing for "LOcal regrESSion".
LOESS and LOWESS thus build on "classical" methods, such as linear and nonlinear least squares regression.
Explore lowess smoothing for nonparametric, locally weighted regression of population changes, fit and predict with the model, and compare with a decision-tree regression to identify a potential break point.
Explore using anova and t apply to delta levels, filter out missing data, compare north and south means relative to the threshold, and reveal a stairstep relationship.
Model a binary outcome with logistic GAMs in R, using smooth area and isolation terms to predict bird presence on islands, and compare linear versus non-linear fits via deviance.
Explore generalized additive models with the mgcv package, using ozone data to compare nonparametric smooths, pairs plots, and custom panel functions for understanding relationships among wind, temperature, radiation, and ozone.
Explore generalized additive models with the mgcv package, comparing parametric and non-parametric smooth terms and using nested f-tests to select the best model for ozone data.
Explore generalized additive models with the mgcv package, including building interaction terms, comparing models by significance and predictive power, and diagnosing fit with residual plots and prediction.
Learn to build generalized additive models with parametric and non-parametric components, smooth interactions via conditioning plots, and a linear compression ratio, and assess fit via residuals and deviance explained.
A mixed model is a statistical model containing both fixed effects and random effects. These models are useful in a wide variety of disciplines in the physical, biological and social sciences. They are particularly useful in settings where repeated measurements are made on the same statistical units (longitudinal study), or where measurements are made on clusters of related statistical units.
Compare two depression treatments, treatment as usual and beat the blues, in 100 participants with five repeated BDI scores over eight months, reshaping data to tall form for covariate analysis.
Learn data wrangling in R for the beat the blues study: reattach covariates, create new columns, convert time to an ordered factor, reorder levels, and create treatment-specific box plots.
In descriptive statistics, a box plot or boxplot is a convenient way of graphically depicting groups of numerical data through their quartiles. Box plots may also have lines extending vertically from the boxes (whiskers) indicating variability outside the upper and lower quartiles, hence the terms box-and-whisker plot and box-and-whisker diagram. Outliers may be plotted as individual points. Box plots are non-parametric: they display variation in samples of a statistical population without making any assumptions of the underlying statistical distribution.
Load the lme function from the lme4 package, specify fixed and random effects for a random intercept model, and compare models with analysis of deviance to gauge improvement.
In statistics, a generalized estimating equation (GEE) is used to estimate the parameters of a generalized linear model with a possible unknown correlation between outcomes.
Parameter estimates from the GEE are consistent even when the covariance structure is misspecified, under mild regularity conditions. The focus of the GEE is on estimating the average response over the population ("population-averaged" effects) rather than theregression parameters that would enable prediction of the effect of changing one or more covariates on a given individual. GEEs are usually used in conjunction with Huber–White standard error estimates, also known as "robust standard error" or "sandwich variance" estimates. In the case of a linear model with a working independence variance structure, these are known as "heteroscedasticity consistent standard error" estimators. Indeed, the GEE unified several independent formulations of these standard error estimators in a general framework.
Explore generalized estimating equations for longitudinal data, compare identity, exchangeable, auto regressive, and unstructured correlation matrices, and distinguish marginal from conditional models.
Prepare longitudinal data for GEE analysis by ordering records by subject, then compare two models with independent and exchangeable correlations using Gaussian family, including pretreatment and treatment covariates.
Explains running gee with beat the blues as binomial glm, comparing naive and robust standard errors under different correlation structures, and interpreting coefficient significance and correlation matrices.
Prepare respiratory data in R for a binary outcome, clean month zero records, create a baseline covariate, merge datasets, and code status for logistic regression.
Explore binary outcome modeling for respiratory illness with binomial GLM and GEE in R, assess overdispersion, and interpret coefficients as odds ratios with robust standard errors and confidence intervals.
Explore poisson regression for seizure count data to compare placebo and progabide treatment, including baseline seizures and period as covariates.
Use box plots and log-transform seizure counts with an offset to stabilize variance, then compare GEEs with independence and exchangeable correlations to examine treatment effects under overdispersion.
Comprehensive Linear Modeling with R provides a wide overview of numerous contemporary linear and non-linear modeling approaches for the analysis of research data. These include basic, conditional and simultaneous inference techniques; analysis of variance (ANOVA); linear regression; survival analysis; generalized linear models (GLMs); parametric and non-parametric smoothers and generalized additive models (GAMs); longitudinal and mixed-effects, split-plot and other nested model designs. The course showcases the use of R Commander in performing these tasks. R Commander is a popular GUI-based "front-end" to the broad range of embedded statistical functionality in R software. R Commander is an 'SPSS-like' GUI that enables the implementation of a large variety of statistical and graphical techniques using both menus and scripts. Please note that the R Commander GUI is written in the RGtk2 R-specific visual language (based on GTK+) which is known to have problems running on a Mac computer.
The course progresses through dozens of statistical techniques by first explaining the concepts and then demonstrating the use of each with concrete examples based on actual studies and research data. Beginning with a quick overview of different graphical plotting techniques, the course then reviews basic approaches to establish inference and conditional inference, followed by a review of analysis of variance (ANOVA). The course then progresses through linear regression and a section on validating linear models. Then generalized linear modeling (GLM) is explained and demonstrated with numerous examples. Also included are sections explaining and demonstrating linear and non-linear models for survival analysis, smoothers and generalized additive models (GAMs), longitudinal models with and without generalized estimating equations (GEE), mixed-effects, split-plot, and nested designs. Also included are detailed examples and explanations of validating linear models using various graphical displays, as well as comparing alternative models to choose the 'best' model. The course concludes with a section on the special considerations and techniques for establishing simultaneous inference in the linear modeling domain.
The rather long course aims for complete coverage of linear (and some non-linear) modeling approaches using R and is suitable for beginning, intermediate and advanced R users who seek to refine these skills. These candidates would include graduate students and/or quantitative and/or data-analytic professionals who perform linear (and non-linear) modeling as part of their professional duties.