An Introduction to Applied Multivariate Analysis with R

📚 An Introduction to Applied Multivariate Analysis with R.pdf

Brief overview

This document provides a comprehensive introduction to multivariate data analysis techniques and their implementation using the R statistical software. It equips readers with the statistical foundations and practical skills to analyze complex datasets across various disciplines.

Key points

  • Overview of multivariate data types, challenges, and foundational statistical concepts
  • Visualizing multivariate data distributions and relationships using R
  • Dimensionality reduction through Principal Components and Canonical Correlation Analysis
  • Representing proximity and categorical data with Multidimensional Scaling and Correspondence Analysis
  • Techniques for identifying latent structures and grouping observations via Factor and Cluster Analysis

1. Introduction to multivariate data and analysis (part 1)

1.1 Introduction to multivariate data

  • Multivariate data: Data where multiple measurements are taken on each unit.
  • Units can be subjects, objects, or any entities of interest.
  • These data are common across many research disciplines.
  • Often, analyzing variables together reveals more than analyzing them separately.

Data collected in research are usually multivariate, requiring simultaneous analysis.

  • Purpose: To understand structure, extract signals, and find patterns in data.
  • Multivariate analysis includes methods for exploration and formal inference.

1.2 History of multivariate analysis

  • Origins trace back to Galton and Pearson's work on correlation in the late 19th century.
  • Spearman laid foundations for factor analysis in the early 20th century.
  • Hotelling and Thurstone extended Spearman's work.
  • Fisher developed discriminant function analysis in the 1930s.
  • Multivariate analysis of variance (MANOVA) followed Fisher's ANOVA.

Early multivariate methods relied on extensive mathematics due to limited computation.

  • The advent of electronic computers in the late 20th century boosted practical applications.
  • Modern powerful computers and software enable routine application to large datasets.
  • "Data mining" is a term for extracting information from large datasets.

1.3 Variable types and missing values

  • Multivariate datasets are typically organized in a rectangular format (like spreadsheets).
  • Rows represent units, and columns represent variables.
  • Data can be represented as an n×qn \times q matrix XX, where nn is units and qq is variables.
  • xijx_{ij} denotes the value of the jthj^{th} variable for the ithi^{th} unit.

Data structure: nn units ×\times qq variables matrix.

  • Variables in a dataset are not always of the same type.
  • Four common measurement levels are distinguished:
    • Nominal: Unordered categories (e.g., sex, hair color).
    • Ordinal: Ordered categories with no equal distance (e.g., social class, health perception).
    • Interval: Equal differences, arbitrary zero (e.g., Celsius temperature).
    • Ratio: Equal differences, fixed zero (e.g., age, weight, Kelvin temperature).

Measurement levels can be pragmatic; ordinal data is often treated as interval.

1.3.1 Missing values

  • Missing values (NA) occur when data should be recorded but is not.
  • Reasons for missing values include non-response, dropouts, or unanswered questions.
  • Avoiding missing data during collection is the primary strategy.

Missing values complicate statistical analysis.

  • Complete-case analysis: Omitting any case with a missing value on any variable.
  • This can lead to substantial data loss with many variables.

Complete-case analysis: Removing entire rows with any missing data.

1.4 Covariances, correlations, and distances

  • Multivariate analysis uses relationships between variables to gain insights.
  • Separate univariate analyses might miss key data patterns.
  • Methods can be exploratory or used for statistical inference.
  • Exploratory methods focus on graphical displays and finding patterns.
  • Inferential methods assume data samples a population and test hypotheses.
  • The multivariate normal distribution is often assumed for inference.

Multivariate analysis combines variable information to reveal deeper structure.

  • The general aim is to uncover "signal" amidst "noise."
  • Exploratory techniques are often graphical and probabilistic models are absent.
  • Inferential techniques use sample data to make population statements.

Goal: Extract signal from noise.

🔑 Important: Multivariate analysis is essential because variables are usually related, and analyzing them together reveals more than separate analyses.

🔑 Important: Multivariate analysis can be either exploratory (finding patterns) or inferential (testing hypotheses about populations).

🔑 Important: The multivariate normal distribution is a common assumption for formal inference.

2. Introduction to multivariate data and analysis (part 2)

2.1 Handling missing data

Missing data can complicate multivariate analysis. Ignoring observations with any missing values, known as complete-case analysis, leads to data loss and potential bias if missingness is not random.

Using all available data for each specific calculation, termed available-case analysis, improves data usage but changes the sample for each statistic. This can lead to an estimated covariance matrix that isn't positive-definite, problematic for some methods.

  • Complete-case analysis:

    • Discards individuals with any missing values.
    • Reduces sample size and power.
    • Can introduce bias if data are not "missing completely at random."
  • Available-case analysis:

    • Uses all available data for each calculation (e.g., pairs of variables).
    • Sample varies for each statistic.
    • May produce invalid matrices (e.g., not positive-definite).

Imputation, filling in missing values, is another approach. Simple imputation methods, like using the mean, distort variance and covariance.

Regression-based imputation can inflate correlations.

  • Imputation:
    • Replaces missing values with estimated ones.
    • Retains observed data from incomplete cases.
    • Simple methods can distort statistics like covariance.

The most robust method is multiple imputation. This involves creating multiple complete datasets by simulating missing values.

Each dataset is analyzed, and results are combined.

🔑 Important: Multiple imputation provides estimates and confidence intervals that account for missing-data uncertainty.

2.2 Key multivariate data examples

Multivariate data arise in various fields, prompting different analytical questions.

  • Body measurements: Data on chest, waist, and hip measurements can be used to summarize body shape or identify subtypes of body shapes. Techniques like principal components analysis and cluster analysis are relevant here.

  • Pottery chemical analysis: Chemical profiles of pottery from different regions can help identify types of pots and their relation to origin. Cluster analysis is a potential method for this.

  • Exam scores: Scores in multiple subjects might reflect an underlying trait, like "general intelligence." Exploratory factor analysis can explore these relationships.

  • Air pollution: Variables like SO2 concentration, temperature, and manufacturing data for US cities can be analyzed to understand pollution levels. Multiple linear regression is a common approach for such problems.

2.3 Covariances, correlations, and distances

Understanding relationships between variables and similarity between observations is key to multivariate analysis.

2.4 Covariances

Covariance measures the linear dependence between two random variables (XiX_i and XjX_j). It is defined as E[(Xi−μi)(Xj−μj)]E[(X_i - \mu_i)(X_j - \mu_j)].

  • If XiX_i and XjX_j are independent, their covariance is zero. The converse is not always true.
  • The covariance of a variable with itself is its variance (σii=σi2\sigma_{ii} = \sigma_i^2).
  • Larger positive covariances indicate stronger positive linear association.
  • Larger negative covariances indicate stronger negative linear association.

In a dataset with qq variables, the covariances and variances are organized into a q×qq \times q symmetric matrix called the variance-covariance matrix (Σ\Sigma). The sample covariance matrix (SS) is an estimate of Σ\Sigma.

S=1n−1∑i=1n(xi−xˉ)(xi−xˉ)⊤S = \frac{1}{n-1} \sum_{i=1}^{n} (x_i - \bar{x})(x_i - \bar{x})^\top

🔑 Important: The covariance matrix captures the spread of data along each dimension and the linear relationships between dimensions.

2.5 Correlations

The correlation coefficient (ρij\rho_{ij}) standardizes covariance by dividing by the product of standard deviations.

ρij=σijσiσj\rho_{ij} = \frac{\sigma_{ij}}{\sigma_i \sigma_j}

  • Correlations range from -1 to +1.
  • +1 indicates perfect positive linear relationship.
  • -1 indicates perfect negative linear relationship.
  • 0 indicates no linear relationship.
  • It is scale-independent.

The correlation matrix (RR) is derived from the covariance matrix (SS).

R=D−1/2SD−1/2R = D^{-1/2}SD^{-1/2} where D−1/2D^{-1/2} is a diagonal matrix with reciprocals of standard deviations.

🔑 Important: Correlation is a more interpretable measure of linear association than covariance due to its standardized scale.

MeasureFormulaRangeInterpretation
CovarianceE[(Xi−μi)(Xj−μj)]E[(X_i - \mu_i)(X_j - \mu_j)](−∞,∞)(-\infty, \infty)Strength of linear association, scale-dependent
Correlationσijσiσj\frac{\sigma_{ij}}{\sigma_i \sigma_j}[−1,1][-1, 1]Strength and direction of linear association, scale-independent

2.6 Distances

Distances quantify the similarity or dissimilarity between observations (units).

  • Euclidean distance: The most common measure, calculated as: dij=∑k=1q(xik−xjk)2d_{ij} = \sqrt{\sum_{k=1}^{q} (x_{ik} - x_{jk})^2} This measures the straight-line distance between two points in a qq-dimensional space.

  • Standardization is crucial when variables have different scales. Dividing each variable by its standard deviation before calculating distance is a common approach.

🔑 Important: Distance measures are fundamental for techniques like cluster analysis and multidimensional scaling, which group or visualize data points based on their proximity.

2.7 The multivariate normal density function

The multivariate normal distribution is a cornerstone for many statistical methods, though not always strictly required for exploratory analysis.

  • Density function: For a vector of qq variables, xx, the density is: f(x;μ,Σ)=(2π)−q/2det⁡(Σ)−1/2exp⁡{−12(x−μ)⊤Σ−1(x−μ)}f(x; \mu, \Sigma) = (2\pi)^{-q/2} \det(\Sigma)^{-1/2} \exp\left\{-\frac{1}{2}(x - \mu)^\top \Sigma^{-1}(x - \mu)\right\} where μ\mu is the mean vector and Σ\Sigma is the covariance matrix.

  • Properties:

    • Linear combinations of multivariate normal variables are also normally distributed. This is crucial for methods like principal components analysis.

🔑 Important: Linearity of transformations preserves normality, a key assumption for many multivariate techniques.

2.8 Checking for multivariate normality

Assessing normality is important for methods that assume it.

  • Univariate checks: Probability plots (or QQ-plots) for each variable can reveal deviations from univariate normality. These plots compare ordered data quantiles against theoretical quantiles of a distribution.

  • Multivariate checks:

    • Generalized distances: Calculate (xi−xˉ)⊤S−1(xi−xˉ)(x_i - \bar{x})^\top S^{-1}(x_i - \bar{x}) for each observation xix_i. These distances measure how far an observation is from the sample mean, considering variances and covariances.
    • Chi-square plot: Plotting these ordered generalized distances against the quantiles of a chi-squared distribution (χq2\chi_q^2) helps assess multivariate normality. A straight line suggests normality.

🔑 Important: The chi-square plot of generalized distances is a powerful tool for detecting deviations from multivariate normality and identifying potential outliers simultaneously.

🔑 Important: While graphical methods like probability plots and chi-square plots are useful for assessing multivariate normality and detecting outliers, they are most reliable with larger sample sizes. Small samples may show deviations that are not statistically significant.

2.9 Distance metrics

  • City block distance, also known as Manhattan or L1 distance, measures the sum of absolute differences between coordinates. It is like calculating distance by walking on a grid.

    📝 Example: Imagine moving between two points in a city with only streets running north-south and east-west. You can only travel along these streets, not diagonally. The total distance traveled is the city block distance.

  • R code can calculate the city block distance matrix for a given dataset. This matrix shows the distance between every pair of data points.

    🔑 Important: Understanding different distance metrics is crucial for clustering and classification algorithms, as the choice of metric can significantly impact results.

Data PointCoordinate 1Coordinate 2Coordinate 3Coordinate 4Coordinate 5
136407
242746
340315
462611
516214
651202
711261
811544
970133
1033051

🔑 Important: The data provided represents 10 data points, each with 5 coordinates (variables). Calculating pairwise distances allows us to understand the similarity or dissimilarity between these points.

3. Visualizing multivariate data with R

3.1 Introduction to graphical data display

  • Power of graphs: Visualizations are highly effective for understanding data, revealing patterns, and sparking interest.
  • Definition of a graph: A graph uses points, lines, coordinates, numbers, symbols, words, shading, and color to visually represent data.
  • Advantages of charts:
    • Create interest and attract attention.
    • Easily grasp and remember visual relationships.
    • Save time by allowing quick understanding of large datasets.
    • Provide a comprehensive overview for better understanding.
    • Reveal hidden facts and stimulate analytical thinking.
  • Goals of graphical displays:
    • Provide an overview.
    • Tell a story.
    • Suggest hypotheses.
    • Critique a model.

Graphs are most valuable when they reveal unexpected insights 41.

3.2 The scatterplot

The scatterplot is a fundamental tool for visualizing relationships between two continuous variables. It helps assess potential causal links and confront theories with empirical evidence.

  • Basic scatterplot: Displays two variables, with one on the x-axis and the other on the y-axis.
  • Enhancements: Scatterplots can be augmented to include information about additional variables.
  • Marginal distributions: Showing how individual variables are distributed alongside the joint distribution is good practice.
    • Rug plots: Small lines on the axes indicating individual data points.
    • Histograms: Show the distribution of one variable.
    • Boxplots: Display the distribution of one variable, highlighting quartiles and outliers.

Scatterplots link variables, inviting viewers to assess relationships 42.

3.2.1 Bivariate boxplot

The bivariate boxplot extends the univariate boxplot to two dimensions, offering a more formal way to identify outliers.

  • Construction: Based on robust measures of location, scale, and correlation.
  • Components:
    • Concentric ellipses: One (the "hinge") encloses 50% of the data.
    • "Fence" ellipse: Delineates potential outliers.
    • Resistant regression lines: Lines for y on x and x on y, intersecting at the bivariate location estimator.
  • Purpose: Helps identify outliers that might be masked by standard univariate methods, especially when data is distorted by extreme values.

The bivariate boxplot uses ellipses to define data density and identify outliers 44.

Comparison of correlation coefficients:

MethodCorrelation (manu, popul)Notes
All data0.9553Sensitive to outliers.
Excluding bivariate boxplot outliers0.7956Removes cities like Chicago, Philadelphia, Detroit, Cleveland.
Excluding convex hull points0.9225Robust estimation by removing boundary points.

3.2.2 Convex hull of bivariate data

Convex hull trimming provides another method for robust correlation estimation by removing extreme points.

  • Convex hull: The smallest convex polygon containing all data points.
  • Process: Points lying on the convex hull are removed.
  • Benefit: Eliminates isolated outliers without altering the main distribution shape, leading to a more robust correlation estimate.

Removing convex hull points offers a robust alternative to outlier identification 47.

3.2.3 The chi-plot

The chi-plot aids in detecting independence between two continuous variables, as random scatter can be hard to judge visually.

  • Underlying principle: Compares observed joint distribution to the expected distribution under independence.
  • Transformation: Data points are transformed into χi\chi_i and λi\lambda_i values.
  • Interpretation:
    • χi\chi_i values: Should fluctuate randomly around zero under independence.
    • λi\lambda_i values: Measure distance from the distribution's center.
  • Detection: Deviations from independence are indicated by a lack of points in a specific horizontal band on the plot.

Chi-plots transform data to visually highlight deviations from independence 49.

3.3 Bubble and glyph plots

These plots extend scatterplots by encoding additional variables using visual attributes of symbols.

  • Bubble plot: Uses circle size to represent a third variable. Two variables define the scatterplot axes.
  • Glyph plots: A broader category where data values control symbol parameters.
    • Stars: Represent multiple variables with the lengths of a star's sides or arms.
    • Chernoff's faces: Use facial features to represent variables (largely historical).

Glyph plots map data values to visual symbol characteristics 52.

Symbol plot types:

Plot TypeVariables RepresentedVisual EncodingPrimary Use
Scatterplot2Position (x, y)Basic bivariate relationships.
Bubble plot3Position (x, y), Circle sizeAdding a third quantitative variable.
Stars plotMultiplePosition (x, y), Arm lengthsVisualizing several variables simultaneously.
Chernoff's faceMultipleFacial featuresRepresenting many variables (historical significance).

3.4 The scatterplot matrix

A scatterplot matrix displays all pairwise scatterplots of a set of variables in a single grid.

  • Structure: A symmetric grid where each cell shows a scatterplot of two variables.
  • Benefit: Allows easy visual scanning of one variable against all others by aligning scales. This helps integrate information across multiple bivariate relationships.
  • Enhancements: Linear regression lines can be added to each panel to visualize linear relationships.

Scatterplot matrices organize pairwise plots for comprehensive data overview 54.

Scatterplot Matrix Components:

Cell LocationPlot TypeAxis VariablesPurpose
Off-diagonalScatterplotVariable i vs. jShows relationship between pairs of variables.
DiagonalHistogram/DensityVariable iDisplays marginal distribution of variable i.
Upper TriangleScatterplot (j vs. i)Variable j vs. iRedundant but aids vertical scanning.
Lower TriangleScatterplot (i vs. j)Variable i vs. jAids horizontal scanning.

3.5 Enhancing scatterplots with bivariate density estimates

Estimating bivariate densities helps identify clusters or regions of high/low observation density that are hard to see in raw scatterplots.

  • Bivariate density estimate: An approximation of the joint probability density function of two variables.
  • Non-parametric methods: Allow data to reveal its own structure without assuming a specific distribution.
  • Kernel density estimators: A popular class of non-parametric estimators.
    • Concept: Summing weighted "bumps" centered at each data point.
    • Kernel function (K): Determines the shape of the bumps (e.g., rectangular, triangular, Gaussian).
    • Bandwidth (h): Controls the width of the bumps, acting as a smoothing parameter.

Kernel density estimators smooth individual data point contributions to reveal overall density 58 60.

Kernel functions:

Kernel TypeFunction FormulaShape
RectangularK(x)=0.5K(x) = 0.5 for $x
Triangular$K(x) = 1 -x
GaussianK(x)=12πe−x2/2K(x) = \frac{1}{\sqrt{2\pi}} e^{-x^2/2}Smooth, bell-shaped curve.

🔑 Important: Visualizing density helps in identifying clusters, which are groups of observations with similar characteristics 57.

4. Principal components and canonical correlation analysis (part 1)

4.1 Introduction to dimensionality reduction

  • Many multivariate datasets have too many variables. This is called the "curse of dimensionality."
  • High dimensionality makes graphical analysis and other multivariate techniques difficult.
  • Principal Components Analysis (PCA) aims to reduce dimensionality. It does this while retaining as much of the original data's variation as possible.
  • PCA transforms original variables into a new set of uncorrelated variables called principal components.
  • These components are ordered by how much variation they explain, with the first few capturing most of the data's variability.
  • The goal is to create fewer new variables that can serve as simpler summaries for graphing or further analysis.

4.2 Principal components analysis (PCA)

  • PCA describes variation in correlated variables (xx) using a new set of uncorrelated variables (yy).
  • Each new variable (yy) is a linear combination of the original variables (xx).
  • The components are ordered by "importance." The first component (y1y_1) explains the most variation in the original data.
  • The second component (y2y_2) explains the most of the remaining variation and must be uncorrelated with y1y_1.
  • Subsequent components are found similarly.

4.3 Applications of PCA

  • Overall performance index: Constructing an index of student examination performance. PCA can create a measure that best separates students.
  • Economic indices: Summarizing complex economic data into index numbers (e.g., cost of living). The first principal component often serves this purpose.
  • Describing "shape" in taxonomy: For morphological measurements, the second and later components can describe an animal's "shape," while the first captures "size."
  • Symptom patterns in psychiatry: The first component might show symptom severity, while others reveal patterns of symptoms.
  • Regression analysis: Replacing highly correlated explanatory variables with a few principal components can solve issues in regression.
  • Exploratory factor analysis: In some fields, principal components are interpreted directly, similar to factors in exploratory factor analysis.

4.4 Purpose of principal components

  • PCA is primarily an exploratory technique for understanding observed data.
  • It's used to construct informative graphical representations.
  • Components can also be used as input for other analyses, like regression.
  • While inferential methods exist, sample principal components are most commonly used to aid understanding of the data itself.

4.5 Finding the sample principal components

  • The first principal component (y1y_1) is the linear combination of original variables (xx) with the greatest sample variance.
  • It is defined as: y1=a11x1+a12x2+⋯+a1qxqy_1 = a_{11}x_1 + a_{12}x_2 + \cdots + a_{1q}x_q
  • The second principal component is the linear combination that captures the maximum remaining variance, provided it is uncorrelated with the first component.
  • Subsequent components are found using a similar process.

🔑 Important: PCA reduces data dimensionality by creating new, uncorrelated variables (principal components) that capture the most variation.

4.6 Principal components analysis

Principal Component Analysis (PCA) is a technique for reducing data dimensionality. It transforms original variables into a new set of uncorrelated variables called principal components.

These components capture the most variance in the data. The first principal component accounts for the largest share of the total variance.

Principal components are linear combinations of the original variables. They are ordered by the amount of variance they explain.

The first component captures the most variance, subsequent components capture decreasing variance.

4.7 Extracting principal components

Principal components are derived from the sample covariance matrix (SS) of the original variables (xx). The coefficients for each component are eigenvectors of SS.

The variance explained by each component is its corresponding eigenvalue.

  • First principal component (y1=a1Txy_1 = a_1^T x): Maximizes variance subject to a1Ta1=1a_1^T a_1 = 1.
  • Second principal component (y2=a2Txy_2 = a_2^T x): Maximizes variance subject to a2Ta2=1a_2^T a_2 = 1 and a2Ta1=0a_2^T a_1 = 0. This ensures it is uncorrelated with the first.
  • jth principal component (yj=ajTxy_j = a_j^T x): Maximizes variance subject to ajTaj=1a_j^T a_j = 1 and ajTai=0a_j^T a_i = 0 for all i<ji < j.

The vector of coefficients (aja_j) for the jjth component is the eigenvector of SS associated with the jjth largest eigenvalue (λj\lambda_j). The variance of the jjth principal component is equal to λj\lambda_j.

Coefficients aja_j are eigenvectors, variances λj\lambda_j are eigenvalues.

4.8 Variance explained by principal components

The sum of all eigenvalues equals the total variance of the original variables. This sum is also the trace of the covariance matrix SS.

∑i=1qλi=trace(S)=∑i=1qsi2\sum_{i=1}^{q} \lambda_i = \text{trace}(S) = \sum_{i=1}^{q} s_i^2

The proportion of total variation explained by the jjth principal component is:

Pj=λjtrace(S)P_j = \frac{\lambda_j}{\text{trace}(S)}

The proportion of total variation explained by the first mm components is:

P(m)=∑j=1mλjtrace(S)P^{(m)} = \frac{\sum_{j=1}^{m} \lambda_j}{\text{trace}(S)}

If the first mm components account for most of the variance, the original qq-dimensional data can be represented in mm dimensions. This is like projecting the data onto the space defined by the first mm principal components.

High P(m)P^{(m)} means mm components adequately summarize the data.

4.9 Geometric interpretation

The first principal component defines the line of best fit for the data. This minimizes residuals orthogonal to the line.

Projecting observations onto this line provides a one-dimensional representation. Using the first mm components provides the best fit in mm dimensions.

If the sample covariance matrix has q−mq-m zero eigenvalues, the data fits perfectly into an mm-dimensional space. This indicates q−mq-m linear relationships among the variables.

In practice, all eigenvalues are usually non-zero.

PCA finds the best lower-dimensional representation of data.

4.10 Covariance vs. correlation matrix

PCA is not scale-invariant. This means the choice of units for variables affects the results.

For instance, using pounds vs. ounces for weight will change the principal components.

To address this, PCA can be performed on the correlation matrix instead of the covariance matrix. This standardizes the variables to have unit variance.

This is useful when variables have very different scales.

Scaling matters: use correlation matrix for variables with different units.

5. Principal components and canonical correlation analysis (part 2)

5.1 Covariance versus correlation matrix in PCA

Principal Components Analysis (PCA) can be performed on either the covariance matrix (SS) or the correlation matrix (RR). The choice significantly impacts the results.

  • Covariance matrix: Results depend on the original units and scales of the variables. Variables with larger variances tend to dominate. This is suitable only when variables have comparable scales.
  • Correlation matrix: Variables are standardized to have unit variance before analysis. This makes variables equally important, regardless of their original scale. This is the more common approach in practice.

The choice between covariance and correlation matrices for PCA depends on whether variables have similar scales.

5.2 Example: Blood chemistry data

An analysis of blood chemistry data showed that using the covariance matrix resulted in components dominated by a single variable (plate, due to its much larger variance). In contrast, the correlation matrix yielded components representing weighted contrasts of variables, providing a more meaningful dimensionality reduction.

Matrix UsedDominant Component FeatureExplained Variance
Covariance (SS)Dominated by variable with largest variance (plate)~99%
Correlation (RR)Represents a weighted contrast of variables.More distributed

5.3 Principal components for bivariate data

For bivariate data (x1,x2x_1, x_2) with a correlation coefficient rr, the principal components are derived from the correlation matrix R=(1rr1)R = \begin{pmatrix} 1 & r \\ r & 1 \end{pmatrix}.

  • The eigenvalues are λ1=1+r\lambda_1 = 1 + r and λ2=1−r\lambda_2 = 1 - r.
  • The corresponding eigenvectors are a1=(1/21/2)a_1 = \begin{pmatrix} 1/\sqrt{2} \\ 1/\sqrt{2} \end{pmatrix} and a2=(1/2−1/2)a_2 = \begin{pmatrix} 1/\sqrt{2} \\ -1/\sqrt{2} \end{pmatrix}.
  • The principal components are:
    • y1=12(x1+x2)y_1 = \frac{1}{\sqrt{2}}(x_1 + x_2) (associated with eigenvalue 1+r1+r)
    • y2=12(x1−x2)y_2 = \frac{1}{\sqrt{2}}(x_1 - x_2) (associated with eigenvalue 1−r1-r)

The variances of these components are 1+r1+r and 1−r1-r, respectively. When rr approaches 1, the data becomes nearly one-dimensional.

5.4 Rescaling principal components

Principal component coefficients can be rescaled to represent correlations or covariances between original variables and the components.

  • Covariance between variable xix_i and component yjy_j: Cov(xi,yj)=λjajiCov(x_i, y_j) = \lambda_j a_{ji}.
  • Correlation between variable xix_i and component yjy_j (from covariance matrix): rxi,yj=λjajisiλj=ajiλjsir_{x_i, y_j} = \frac{\lambda_j a_{ji}}{s_i \sqrt{\lambda_j}} = \frac{a_{ji}\sqrt{\lambda_j}}{s_i}.
  • Correlation between variable xix_i and component yjy_j (from correlation matrix): rxi,yj=ajiλjr_{x_i, y_j} = a_{ji}\sqrt{\lambda_j}.

These rescaled coefficients are similar to factor loadings.

5.5 Reproducing the covariance matrix

The principal components can reconstruct the original covariance matrix. If AA is the matrix of eigenvectors and Λ\Lambda is the diagonal matrix of eigenvalues (from SS), then S=AΛA⊤S = A\Lambda A^\top.

If scaled eigenvectors A∗A^* are used, then S=A∗(A∗)⊤S = A^* (A^*)^\top. Using the first mm components allows for an approximation of SS.

5.6 Choosing the number of components

Selecting the appropriate number of components is crucial for effective dimensionality reduction. Several methods exist:

  • Proportion of variance explained: Retain components that collectively explain a target percentage (e.g., 70-90%) of the total variance.
  • Average eigenvalue: Exclude components whose eigenvalues are less than the average eigenvalue.
  • Kaiser's criterion: For correlation matrices, retain components with eigenvalues greater than one.
  • Jolliffe's criterion: For correlation matrices, retain components with eigenvalues greater than 0.7.
  • Scree diagram: Plot eigenvalues against component number and identify an "elbow" or change in slope.
  • Log-eigenvalue diagram: Plot the logarithm of eigenvalues against component number.

The choice of method can lead to different numbers of retained components.

5.7 Calculating principal component scores

Once mm components are chosen, scores for each individual can be calculated.

  • For components derived from the covariance matrix: yi=aj⊤xiy_{i} = a_j^\top x_i, where xix_i is the vector of original variable values for individual ii, and aja_j is the jj-th eigenvector.
  • For components derived from the correlation matrix: xix_i would be the standardized scores for individual ii.

These scores have variances equal to their corresponding eigenvalues. Scores with mean zero and variance one can be obtained by further standardization.

Principal component scores represent the individual's position along each derived component axis.

5.8 Applications of PCA

PCA can reveal underlying structures in data.

5.9 Head sizes of sons

PCA on head lengths of first and second sons revealed that the first component represented "size" (sum of head lengths), and the second represented "shape" (difference in head lengths). The analysis illustrated how PCA rotates the data axes.

  • Component 1 (Size): y1=0.693x1+0.721x2y_1 = 0.693x_1 + 0.721x_2
  • Component 2 (Shape): y2=−0.721x1+0.693x2y_2 = -0.721x_1 + 0.693x_2

5.10 Olympic heptathlon results

PCA on heptathlon results helps understand the relationships between different events and how they contribute to an athlete's overall performance.

  • An initial correlation analysis showed that most events were positively correlated, except for the javelin.
  • Removing an outlier (Papua New Guinea competitor) adjusted these correlations.
  • The first two principal components often explain a substantial portion of the variance, suggesting underlying abilities (e.g., speed/endurance vs. strength/power).

PCA on heptathlon data can identify broad performance dimensions beyond individual event scores.

  • The first principal component explained about 61.8% of the variance, with hurdles and long jump receiving the highest weights.
  • The first two components together accounted for approximately 75% of the total variance.

🔑 Important: PCA is a powerful tool for reducing data dimensionality and uncovering latent structures by transforming correlated variables into uncorrelated components.

5.11 Application of principal components analysis

  • Principal Component Analysis (PCA) can be used to understand how well a calculated component aligns with an existing scoring system. This helps validate the component's interpretation.

  • A high correlation between a principal component score and an official score indicates strong agreement. The sign of the correlation is not critical; only its magnitude matters.

📝 Example: In heptathlon scoring, the first principal component strongly correlated with the official score. This means the component effectively captures the essence of athletic performance as judged by Olympic rules. The correlation was −0.9931-0.9931, showing near-perfect agreement.

  • PCA can reduce complex datasets into fewer, more meaningful variables. These components can then be analyzed further.

  • The first principal component often represents the most significant source of variation in the data. Its interpretation provides insight into the dominant patterns.

  • Subsequent principal components capture progressively smaller amounts of variance. They may represent secondary or more specialized aspects of the data.

🔑 Important: When interpreting PCA, always check the correlation between components and existing metrics to validate their meaning. The magnitude of the correlation is key, not its sign.

6. Principal components and canonical correlation analysis (part 3)

6.1 Principal components analysis examples

Principal components analysis (PCA) can explore data aspects and simplify other analyses. It reduces dimensionality by creating uncorrelated variables, provided the original variables are correlated.

PCA can be used for graphical displays and as explanatory variables in regression.

  • PCA application: Analyzing air pollution data to understand relationships between human ecology and climate variables.
  • Data transformation: Using negative temperature values can help interpret components, making higher values represent less attractive environments.
  • Correlation vs. Covariance: For variables on different scales (like in the air pollution data), PCA is typically performed on the correlation matrix 101.

PCA output interpretation: The summary() function in R provides key information:

  • Standard deviation: The standard deviation of each principal component.
  • Proportion of Variance: The fraction of total variance explained by each component.
  • Cumulative Proportion: The total variance explained by a component and all preceding components.
  • Loadings: Coefficients indicating how original variables contribute to each component.

PCA is useful for displaying multivariate data in lower dimensions and simplifying other analyses.

6.2 Interpreting principal components

Interpreting components involves examining their loadings, but this can be challenging and prone to overinterpretation. Components are often labeled based on the variables that strongly contribute to them.

  • Quality of life index: Component 1 in the air pollution example might represent this, with high values indicating a poorer environment.
  • "Wet weather" component: Component 2 might relate to a city's rainfall, indicated by high loadings for precipitation and precipitation days.
  • "Climate type" component: Component 3 could contrast temperature and rainfall, distinguishing between warm/wet and cold/dry climates.

Be cautious of overinterpreting PCA components; physical meaning may arise from data structure or luck, not the math itself 103.

6.3 Using PCA in regression

PCA can be used in regression to address multicollinearity (high correlation between predictor variables). Instead of using highly correlated original variables, their principal components are used as predictors.

  • Challenge: Deciding how many components to use as predictors. Using only components with eigenvalues greater than one is common but not always optimal 104 105.
  • Example: Regressing SO2 concentration on principal components derived from climate and human ecology variables 106.
  • Finding: The first principal component often explains a significant portion of the response variable's variance, but components with smaller variances can also be significant predictors.

6.4 The biplot

A biplot is a graphical method to represent an n×pn \times p data matrix in a single diagram. It displays variances and covariances of variables alongside distances between observations.

  • Construction: Based on the singular value decomposition (SVD) of the data matrix.
  • Visual interpretation:
    • Distance between points representing observations approximates their generalized distance.
    • Length of vectors from the origin indicates variable variance.
    • Angle between variable vectors reflects their correlation; smaller angles mean higher correlation.

Biplots visualize both observations and variables in a single 2D space 107.

  • Example: Biplot of heptathlon data shows Jackie Joyner-Kersee's strength in long jump, hurdles, and 200m. It also highlights correlations between events and how competitors perform overall and in specific events.

6.5 Sample size for PCA

Determining the appropriate sample size (nn) for PCA is debated.

  • Common suggestions:
    • nn should be greater than 100.
    • nn should be at least five times the number of variables (qq).
  • Alternative view: The minimum value of nn might be more critical than the n:qn:q ratio 108.
  • Key factor: The separation of eigenvalues. If eigenvalues are close, a larger sample size is needed to uncover the structure precisely.

The "best" PCA results occur when both sample size (nn) and the n:qn:q ratio are large.

6.6 Canonical correlation analysis (CCA)

CCA assesses the statistical relationships between two distinct sets of variables 109.

  • Objective: To find linear combinations of variables from each set that are maximally correlated.
  • Analogy: An extension of multiple regression, but instead of one response variable, you have a set of response variables, and instead of one set of predictors, you have two sets of predictors.
  • Purpose: Characterize independent statistical relationships between two variable sets, xx and yy.

6.7 Canonical variates

CCA identifies pairs of linear functions, called canonical variates, that maximize correlations between the two sets.

  • Structure:
    • ui=aiTxu_i = a_i^T x: A linear combination of variables in set xx.
    • vi=biTyv_i = b_i^T y: A linear combination of variables in set yy.
  • Properties:
    • uiu_i are mutually uncorrelated.
    • viv_i are mutually uncorrelated.
    • Correlation between uiu_i and viv_i is RiR_i, with R1>R2>⋯>RsR_1 > R_2 > \dots > R_s (canonical correlations).
    • uiu_i are uncorrelated with all vjv_j where i≠ji \neq j.
  • Calculation: The coefficients aia_i and bib_i are found as eigenvectors of specific matrices derived from the correlation matrices of the two sets (R11,R22R_{11}, R_{22}) and their cross-correlation matrix (R12R_{12}).

CCA finds linear combinations that maximize the correlation between two sets of variables.

6.8 Interpreting canonical variates

Interpreting canonical variates involves examining the coefficients of the original variables in each variate, similar to interpreting principal components. However, differences in variances and covariances of original variables can complicate interpretation.

  • Standardized coefficients: Using standardized coefficients can help by making coefficients comparable across variables with different scales.
  • Challenges: Interpretation can be difficult due to varying scales and the potential for multiple significant canonical correlations 111.

6.9 Canonical correlation analysis examples

  • Head measurements: Analyzing head length and breadth for pairs of sons to see the relationship between measurements of first and second sons 112.
    • The first canonical variate ("girth") showed a strong negative correlation (-0.79) between the first and second sons' head measurements 113.
    • The second canonical variate ("shape") had a very low correlation (0.05), indicating shape is largely independent between sons 114.
  • Health and personality: Examining the relationship between health variables (depression scores) and personal variables (gender, age, income, education).
    • First canonical correlation (0.409): Suggests older, medicated individuals perceive their health poorly and have lower depression scores, while younger, educated individuals have better perceived health 115.
    • Second canonical correlation (0.261): Links younger, less educated females to higher depression scores and poorer perceived health.

Interpretation of CCA results requires deep knowledge of the variables involved 116.

🔑 Important: CCA helps understand how two sets of variables relate to each other by finding linear combinations that are maximally correlated 110.

6.10 Canonical correlation analysis and exercises

Canonical correlation analysis (CCA) helps understand relationships between two sets of variables. It is useful when direct relationships are complex.

CCA can provide descriptive insights into these associations.

🔑 Important: CCA is particularly valuable when dealing with multiple measurements on the same subjects, like head measurements or health indicators.

Exercises

Several exercises are provided to reinforce understanding of PCA and CCA. These include:

  • Constructing scatterplots with density contours for bivariate data.
  • Visualizing relationships between a response variable and explanatory variables using regression and locally weighted regression.
  • Calculating and interpreting principal components for a given correlation matrix 117.
  • Applying Bartlett's test to determine the statistical significance of canonical correlations.
  • Performing regression analysis and interpreting principal component scores after outlier removal.

Exercise 3.3: Principal Components for Physical Characteristics

This exercise involves calculating principal components from a correlation matrix of seven physical characteristics measured on 3000 criminals. The goal is to interpret these components.

Exercise 3.4: Bartlett's Test for Canonical Correlations

This exercise uses Bartlett's test to assess the statistical significance of canonical correlations. The test statistic is given by:

Φ02=−{n−12(q1+q2+1)}∑i=1slog⁡(1−λi)\Phi^2_0 = -\left\{n - \frac{1}{2}(q_1 + q_2 + 1)\right\} \sum_{i=1}^s \log(1 - \lambda_i)

Here, λi\lambda_i are eigenvalues, q1q_1 and q2q_2 are the number of variables in each set, and s=min⁡(q1,q2)s = \min(q_1, q_2). Under the null hypothesis of no significant correlations, Φ02\Phi^2_0 follows a chi-square distribution with q1×q2q_1 \times q_2 degrees of freedom.

📝 Example: The provided R code applies this test to headsize and depression data.

🔑 Important: The number of significant canonical correlations is determined by testing hypotheses about the remaining eigenvalues.

🔑 Important: Understanding which canonical correlations are statistically significant is crucial for valid interpretation of the relationships between variable sets 118.

7. Multidimensional scaling and correspondence analysis

7.1 Introduction to proximity data analysis

  • Proximity data represents relationships between objects, like distances or similarities.
  • Methods analyze these proximities to create low-dimensional maps, revealing underlying structures.
  • These maps help visualize complex relationships and reduce data dimensionality.

7.2 Spatial models for proximities

  • Spatial models represent each unit as a point in a multi-dimensional space.
  • The goal is to arrange points so that distances between them match the observed proximities.
  • Larger dissimilarities should correspond to greater distances between points.
  • The number of dimensions, mm, is kept small (ideally 2 or 3) for easy visualization.
  • Multidimensional scaling (MDS) is a family of techniques for finding these spatial representations.
  • MDS methods differ in how they measure the fit between proximities and distances.

Spatial models aim to represent proximities as distances in a low-dimensional geometric space.

7.3 Classical multidimensional scaling (MDS)

Classical MDS aims to represent a proximity matrix (often distances) as a configuration of points in mm dimensions.

7.4 Technical details

  • Assumes the proximity matrix is a matrix of Euclidean distances (DD) derived from an n×qn \times q data matrix (XX).
  • It reverses the process: given distances, find the original coordinates XX.
  • This is achieved by first calculating the n×nn \times n inner products matrix B=XX⊤B = XX^\top.
  • The squared Euclidean distances (dij2d_{ij}^2) are related to elements of BB by dij2=bii+bjj−2bijd_{ij}^2 = b_{ii} + b_{jj} - 2b_{ij}.
  • The matrix BB can be reconstructed from distances using: bij=−12(dij2−di.2−d.j2+d..2)b_{ij} = -\frac{1}{2} (d_{ij}^2 - d_{i.}^2 - d_{.j}^2 + d_{..}^2) where di.2d_{i.}^2, d.j2d_{.j}^2, and d..2d_{..}^2 are averages of squared distances.
  • The coordinates XX are found by factoring BB using its spectral decomposition: B=VΛV⊤B = V\Lambda V^\top.
  • The coordinates are X=V1Λ11/2X = V_1 \Lambda_1^{1/2}, where V1V_1 and Λ1\Lambda_1 contain eigenvectors and eigenvalues corresponding to the largest eigenvalues.

Classical MDS recovers original coordinates from distance matrices via matrix factorization.

7.5 Fit assessment

  • The proportion of variance explained by the mm largest eigenvalues (PmP_m) assesses the fit. Pm=∑i=1mλi∑i=1nλiP_m = \frac{\sum_{i=1}^m \lambda_i}{\sum_{i=1}^n \lambda_i}
  • A value Pm≈0.8P_m \approx 0.8 suggests a reasonable fit.
  • Classical MDS is equivalent to Principal Components Analysis (PCA) when applied to Euclidean distances.
  • When distances are not strictly Euclidean, BB may have negative eigenvalues.
  • Modified criteria (Pm,PmP_m^{ }, P_m^{ }) are used to assess fit with non-Euclidean distances: Pm=∑i=1m∣λi∣∑i=1n∣λi∣P_m^{ } = \frac{\sum_{i=1}^m |\lambda_i|}{\sum_{i=1}^n |\lambda_i|} 1. Pm=∑i=1mλi2∑i=1nλi2P_m^{ } = \frac{\sum_{i=1}^m \lambda_i^2}{\sum_{i=1}^n \lambda_i^2} 2.
  • Values above 0.8 generally indicate a good fit.

High PmP_m values indicate that the selected dimensions capture most of the variance in distances.

7.6 Examples of classical MDS

  • Airline distances: MDS successfully mapped US cities based on flight distances, recovering their geographical layout.
  • Egyptian skulls: MDS revealed a unidimensional trend in skull measurements over time, indicating changes in skull shape.
  • Water voles: MDS showed distinct groupings of British and European water vole populations, suggesting potential species differences. The minimum spanning tree helped identify distortions in the 2D representation.

Visualizing distances between related objects (cities, skulls, populations) is a key MDS application.

7.7 Non-metric multidimensional scaling (NMDS)

NMDS is used when only ordinal judgments of similarity or dissimilarity are available.

7.8 Core principle

  • NMDS aims to preserve the rank order of the observed proximities, not their exact values.
  • It seeks a spatial configuration where the distances (dijd_{ij}) are monotonically related to "disparities" (d^ij\hat{d}_{ij}), which are themselves monotonic with the original proximities.
  • The relationship is d^ij=dij+ϵij\hat{d}_{ij} = d_{ij} + \epsilon_{ij}, where ϵij\epsilon_{ij} are error terms.

NMDS focuses on the relative order of proximities, not their precise magnitudes.

7.9 Minimizing Stress

  • The goal is to find coordinates X^\hat{X} that minimize a measure called Stress.
  • Stress quantifies the disagreement between the rank order of fitted distances and observed dissimilarities.
  • The formula for Stress (SS) is: S(X^)=min⁡∑i<j(d^ij−dij)2∑i<jdij2S(\hat{X}) = \min \frac{\sum_{i<j} (\hat{d}_{ij} - d_{ij})^2}{\sum_{i<j} d_{ij}^2}
  • The minimum is taken over d^ij\hat{d}_{ij} values that are monotonic with observed dissimilarities.
  • A Stress value of 0 indicates a perfect fit, while higher values indicate poorer fit.
    • S<5%S < 5\%: Good fit
    • S≈10%S \approx 10\%: Fair fit
    • S≥20%S \geq 20\%: Poor fit

Stress measures how well the rank order of distances in the spatial map matches the rank order of original proximities.

7.10 Application example

  • House of Representatives voting: NMDS can reveal party affiliations by plotting congressmen's voting patterns, where similar voting records lead to points being close together.

7.11 Correspondence Analysis (CA)

*(Note: The provided document content focuses heavily on MDS and does not detail Correspondence Analysis beyond a brief mention. Therefore, the summary for CA will be minimal, based on its typical application in the context of proximity data.

If more detailed information were present, it would be expanded.)*

Correspondence Analysis (CA) is a technique used to analyze contingency tables (cross-tabulations of categorical data).

  • It represents rows and columns of a contingency table as points in a low-dimensional space.
  • The spatial configuration reveals associations between categories of the variables.
  • Similar to MDS, it aims to represent categorical associations in a visual map.

CA visualizes relationships between categories in contingency tables.

🔑 Important: MDS and CA are powerful tools for visualizing complex relationships within distance, dissimilarity, or contingency data, enabling pattern discovery and hypothesis generation.

7.12 Multidimensional scaling (MDS)

MDS is a technique used to visualize proximity data. It maps items into a low-dimensional space based on their dissimilarities.

The goal is to represent the observed dissimilarities as distances between points in a map.

  • Classical MDS: Assumes dissimilarities are Euclidean distances. It directly models distances between points.
  • Non-metric MDS: Focuses on preserving the rank order of dissimilarities. It is more flexible as it does not assume a specific relationship between dissimilarities and distances.

The quality of an MDS solution can be assessed using a Shepard diagram. This plot compares the original dissimilarities with the distances from the MDS solution.

Ideally, points should fall on a bisecting line.

📝 Example: Visualizing the ideological similarity of World War II leaders based on subjective dissimilarity judgments.

7.13 Correspondence analysis (CA)

Correspondence analysis (CA) is a technique for visualizing associations in categorical data, typically presented in a contingency table. It is a form of multidimensional scaling applied to such tables.

CA can be viewed as:

  • Decomposing the chi-squared statistic for independence.
  • Simultaneously scaling row and column categories to maximize correlation.

CA derives coordinates for row and column categories, which are then plotted together. This map displays patterns of association between the variables.

🔑 Important: CA is often used to supplement a standard chi-squared test of independence.

7.14 Chi-squared distance

CA uses specific distance measures based on proportions in the contingency table.

  • Column chi-squared distance: Measures similarity between columns based on their row profiles. Rare categories have more influence. d(cols)ij=∑k=1r1pk⋅(pkic−pkjc)2d(\text{cols})_{ij} = \sum_{k=1}^{r} \frac{1}{p_{k\cdot}} (p_{ki}^{c} - p_{kj}^{c})^2 where pkic=nki/n⋅jp_{ki}^{c} = n_{ki} / n_{\cdot j} is the column proportion and pk⋅=nk⋅/np_{k\cdot} = n_{k\cdot}/n.
  • Row chi-squared distance: Measures similarity between rows based on their column profiles. d(rows)ij=∑k=1c1p⋅k(pikr−pjkr)2d(\text{rows})_{ij} = \sum_{k=1}^{c} \frac{1}{p_{\cdot k}} (p_{ik}^{r} - p_{jk}^{r})^2 where pikr=nik/ni⋅p_{ik}^{r} = n_{ik} / n_{i\cdot} is the row proportion and p⋅k=n⋅k/np_{\cdot k} = n_{\cdot k}/n.

7.15 Interpreting the CA map

The plot resulting from CA allows for interpretation of associations.

  • Row points close together: Indicate row categories with similar profiles across columns.
  • Column points close together: Indicate column categories with similar profiles across rows.
  • Row point near column point: Suggests a row/column combination that occurs more frequently than expected under independence.
  • Row and column points distant: Indicate a cell count lower than expected under independence.

📝 Example: Analyzing teenage girls' relationships with boyfriends based on age and relationship status. The map shows progression from "no boyfriend" to "boyfriend/sexual intercourse" as age increases.

🔑 Important: The chi-squared distances can be represented exactly in min⁡(r−1,c−1)\min(r-1, c-1) dimensions. If rr and cc are greater than three, a two-dimensional solution is an approximation.

Age GroupNo boyfriendBoyfriend no sexBoyfriend sex
<162182
16-172193
17-181464
18-1913810
19-208210

🔑 Important: Both Multidimensional Scaling and Correspondence Analysis visually represent complex data, with MDS handling proximity matrices and CA focusing on associations in contingency tables.

8. Exploratory factor analysis and cluster analysis (part 1)

8.1 Introduction to exploratory factor analysis

Exploratory Factor Analysis (EFA) helps identify underlying, unmeasurable concepts called latent variables. These are inferred from directly measurable or observable manifest variables.

EFA investigates relationships between manifest variables and latent factors without pre-defined assumptions. This differs from confirmatory factor analysis, which tests a specific proposed factor model.

EFA explores latent structure; CFA tests a specific structure.

8.2 The k-factor analysis model

The core of EFA is a regression model linking manifest variables (xx) to kk latent variables (factors, ff). The model is expressed as:

x=Λf+ux = \Lambda f + u

  • xx: Vector of manifest variables.
  • Λ\Lambda: Matrix of factor loadings (regression coefficients). These show how each manifest variable depends on the common factors.
  • ff: Vector of latent common factors.
  • uu: Vector of specific variates (disturbance terms), assumed to be uncorrelated with each other and the factors.

The model implies that the population covariance matrix (Σ\Sigma) of observed variables can be decomposed as:

Σ=ΛΛ⊤+Ψ\Sigma = \Lambda \Lambda^\top + \Psi

  • Ψ\Psi: Diagonal matrix of specific variances (ψi\psi_i).

8.3 Variance decomposition

The variance of each manifest variable (xix_i) is split into two parts:

  • Communality (hi2h_i^2): The variance shared with other variables via common factors. hi2=∑j=1kλij2h_i^2 = \sum_{j=1}^k \lambda_{ij}^2.
  • Specific variance (ψi\psi_i): The variability in xix_i not shared with other variables.

The covariance between two manifest variables (xi,xjx_i, x_j) is solely accounted for by the common factors:

σij=∑l=1kλilλjl\sigma_{ij} = \sum_{l=1}^k \lambda_{il} \lambda_{jl}

8.4 Scale invariance

The factor analysis model is essentially unaffected by rescaling the manifest variables (y=Cxy = Cx). The factor loading matrix and specific variances for the scaled variables are derived from the original ones by scaling.

This means EFA can be applied to either the covariance or correlation matrix, yielding essentially equivalent results.

8.5 Estimating model parameters

Applying EFA to data involves estimating the factor loading matrix (Λ^\hat{\Lambda}) and the specific variances (Ψ^\hat{\Psi}). The goal is to make the matrix predicted by the model (Λ^Λ^⊤+Ψ^\hat{\Lambda}\hat{\Lambda}^\top + \hat{\Psi}) closely match the sample covariance matrix (SS).

Estimated specific variances are calculated as:

ψ^i=si2−∑j=1kλ^ij2\hat{\psi}_i = s_i^2 - \sum_{j=1}^k \hat{\lambda}_{ij}^2

This ensures that the diagonal terms of the fitted matrix exactly match the observed variances.

8.6 Principal factor analysis

This method is similar to principal components analysis but operates on the reduced covariance matrix (S∗=S−Ψ^S^* = S - \hat{\Psi}).

  • S∗S^*: Replaces the original variances in SS with estimated communalities.
  • Process: Uses eigenvalues and eigenvectors on S∗S^* to estimate loadings.
  • Initial communalities: Must be estimated before loadings. Common methods include using the squared multiple correlation coefficient or the largest absolute correlation coefficient.
  • Iteration: The process can be iterated to refine communality estimates and loadings.
  • Heywood case: A problem occurring when a communality estimate exceeds the variable's variance, leading to negative specific variance.

8.7 Maximum likelihood factor analysis

This method assumes multivariate normality of the data.

  • Goal: Minimize a function (FF) related to the determinant and trace of matrices involving the model parameters and the sample covariance matrix.
  • Formula for FF: F=ln⁡∣ΛΛ⊤+Ψ∣+trace(S∣ΛΛ⊤+Ψ∣−1)−ln⁡∣S∣−qF = \ln |\Lambda\Lambda^\top + \Psi| + \text{trace}(S|\Lambda\Lambda^\top + \Psi|^{-1}) - \ln |S| - q
  • Estimation: Uses iterative numerical algorithms to find parameter estimates that minimize FF.
  • Challenges: Can also encounter Heywood cases.

ML estimates parameters by minimizing the discrepancy between the observed and model-implied covariance matrices, assuming normality.

8.8 Estimating the number of factors (kk)

Determining the correct number of factors (kk) is crucial for a parsimonious and interpretable model.

  • Subjective interpretation: Examining solutions for different kk values.
  • Scree diagram: Less clear in EFA than PCA, as eigenvalues represent component variances, not factor variances.
  • Formal hypothesis testing (Maximum Likelihood): Tests HkH_k (k factors are sufficient) against the alternative that the covariance matrix has no constraints.

A sequential testing procedure often starts with k=1k=1 and increases kk until a non-significant test statistic is found.

8.9 Factor rotation

Factor loading matrices are not unique. An orthogonal matrix MM can be used to transform the loadings (ΛM\Lambda M) without changing the covariance matrix explained.

x=(ΛM)(M⊤f)+ux = (\Lambda M)(M^\top f) + u

  • Indeterminacy: The model has infinitely many equivalent solutions.
  • Constraints: Introduced to ensure a unique solution, e.g., ordering factors by contribution to common variance.
  • Simple structure (Thurstone): The goal of rotation, aiming for:
    • At least one zero loading per row of the loading matrix.
    • At least kk zeros per column.
    • Pairs of columns share zeros for several variables.
    • Few variables with non-zero loadings in both columns of a pair.

Rotation aims to make the solution more interpretable by simplifying loadings, not altering the underlying mathematical properties.

8.10 Types of rotation

  • Orthogonal rotation: Rotated factors remain uncorrelated (e.g., Varimax, Quartimax).
    • Varimax: Aims for factors with few large loadings and many near-zero loadings. Redistributes factor variance.
    • Quartimax: Forces one variable to load highly on one factor. Less popular.
  • Oblique rotation: Allows correlated factors (e.g., Oblimin, Promax).
    • Oblimin: Attempts simple structure considering factor pattern and correlation matrices.
    • Promax: Transforms an orthogonal solution to improve structure.

Orthogonal rotation for generalizability; oblique rotation for best fit to data.

8.11 Estimating factor scores

Factor scores estimate the values of latent variables for each individual.

  • Purpose:
    1. Parsimonious summary of data for subsequent analyses.
    2. Potentially more reliable than observed variables.
    3. Pure measures of latent variables.
  • Calculation: Involves predicting factors from variables, the opposite of the EFA model. A common method uses:

f^=Λ^⊤S−1x\hat{f} = \hat{\Lambda}^\top S^{-1}x

The indeterminacy of factor scores is a significant challenge in EFA.

8.12 Key Concepts Summary

ConceptDescription
Latent VariableUnobservable concept inferred from observed data.
Manifest VariableDirectly observable or measurable variable.
Factor LoadingCoefficient showing the relationship between a manifest variable and a latent factor.
CommunalityProportion of a variable's variance explained by common factors.
Specific VarianceProportion of a variable's variance unique to that variable.
Factor RotationTransformation of factor loadings to improve interpretability.
Orthogonal RotationRotation maintaining factor independence.
Oblique RotationRotation allowing factors to be correlated.

🔑 Important: EFA models use observable variables to uncover underlying latent structures, and factor rotation is key for interpretable results.

8.13 Exploratory factor analysis (EFA)

Exploratory Factor Analysis (EFA) is a statistical method used to identify underlying structures or latent variables within a dataset. It aims to reduce a large number of observed variables into a smaller set of unobserved factors.

These factors represent common variance shared among the observed variables. The goal is to understand the latent constructs that explain the relationships between variables.

EFA helps in data reduction and identifying relationships that are not immediately apparent. It is particularly useful in fields like psychology, sociology, and marketing for developing theories and scales.

EFA seeks common themes among observed variables.

8.14 Estimating model parameters

In EFA, parameters are estimated to represent the relationship between observed variables and latent factors. The primary goal is to model the covariance or correlation matrix of the observed variables using a smaller number of factors.

Common methods for parameter estimation include:

  • Maximum Likelihood (ML): This method estimates parameters by maximizing the likelihood function, assuming the observed variables follow a multivariate normal distribution. It provides a framework for hypothesis testing, such as determining the number of factors.
  • Principal Axis Factoring (PAF): This method aims to explain the common variance among variables by factoring the correlation matrix after accounting for unique variances.

8.15 Determining the number of factors

Deciding on the correct number of factors is crucial in EFA. Too few factors may fail to capture the underlying structure, while too many can lead to overfitting.

Several methods are used:

  • Kaiser's Rule: Retain factors with eigenvalues greater than 1. An eigenvalue represents the amount of variance explained by a factor.
  • Scree Plot: This is a graphical display of eigenvalues. Factors are retained before the point where the plot levels off.
  • Parallel Analysis: Compares the eigenvalues of the observed data to those from random data.
  • Hypothesis Tests: Statistical tests, like the chi-square test in maximum likelihood estimation, can assess the fit of a specified number of factors. A non-significant p-value suggests the proposed number of factors is adequate.

Choosing factors: eigenvalue > 1 (Kaiser), scree plot, parallel analysis, and statistical tests.

8.16 Factor rotation

After initial factor extraction, the resulting factors might be difficult to interpret. Factor rotation is applied to simplify the factor structure and improve interpretability.

Rotation aims to achieve "simple structure," where each variable loads highly on only one factor and weakly on others.

There are two main types of rotation:

  • Orthogonal Rotation: This type maintains the independence of factors, meaning the factors remain uncorrelated. A common orthogonal rotation is Varimax, which maximizes the variance of the squared loadings for each factor across variables.
  • Oblique Rotation: This type allows factors to be correlated. Oblimin is a common oblique rotation method. It is used when it is theoretically expected that the underlying latent variables are related.

Rotation clarifies factors by simplifying loadings.

8.17 Estimating factor scores

Factor scores are estimates of an individual's standing on each latent factor. They are calculated based on the factor loadings and the observed variables.

These scores can be used for further analysis, such as plotting or regression. Common methods for estimating factor scores include:

  • Regression Method: This is a widely used method that provides estimates that are uncorrelated with each other, even if oblique rotation is used.
  • Bartlett Method: This method minimizes the sum of squares of the errors in estimating the factor scores.

Factor scores quantify an individual's level on each latent factor.


8.18 Visualizing factor analysis results

Graphical displays are essential for understanding EFA results. Scatterplots of factor scores help visualize the relationships between observations along the extracted factors.

Scatterplots of factor scores show data patterns across factors.

FeatureDescription
Factor loadingsIndicate the strength of the relationship between observed variables and latent factors.
EigenvaluesRepresent the variance explained by each factor.
Factor scoresEstimated scores for each observation on each factor.

Example: In life expectancy data, factors might represent "life force at birth" and "life force for elderly men." Countries can then be plotted based on their scores on these factors to see how they cluster or differ. .

EFA visualisations aid interpretation of latent structures.

📝 Example: In a study of drug use, correlations between substances were visualized. Ellipses represented correlations, with size and shape indicating strength and direction. Numbers inside showed 100 times the correlation coefficient. 167.

🔑 Important: When interpreting factors, look for variables with high loadings on specific factors. This helps to assign meaningful labels to the latent constructs. .

8.19 Cluster analysis

Cluster analysis is a set of techniques used to group similar objects or observations into clusters. The goal is to place similar items within the same cluster and dissimilar items into different clusters.

It is an unsupervised learning method, meaning it does not use pre-defined labels.

Cluster analysis is used for:

  • Segmentation: Dividing a market into distinct groups of consumers.
  • Pattern Recognition: Identifying natural groupings in data.
  • Data Exploration: Discovering underlying structures.

Cluster analysis groups similar observations together.

🔑 Important: Cluster analysis is about discovering natural groupings, not imposing pre-existing ones. -168 164.

9. Exploratory factor analysis and cluster analysis (part 2)

9.1 Exploratory factor analysis: interpretation and comparison

Exploratory factor analysis (EFA) helps explain observed correlations using fewer latent variables. Principal components analysis (PCA), however, focuses on explaining the variance of observed variables.

EFA identifies common factors, while PCA creates components that are linear combinations of the original variables.

  • EFA: Aims to explain covariances/correlations via common factors.
  • PCA: Aims to explain variance of observed variables.

Changes in the number of factors in EFA can alter all existing factors. In contrast, adding a component in PCA does not change the previously retained components.

Calculating factor scores in EFA is complex, with various methods. PCA scores are more straightforward to compute.

EFA for latent factors, PCA for explained variance.

The formal test for the number of factors can sometimes suggest too many factors, leading to over-fitting. Analyzing the differences between observed and predicted correlations can reveal if a model describes the data well.

Small residuals suggest a good fit.

Over-fitting occurs when a model fits noise, not just signal.

For EFA, the maximum likelihood (ML) method is suitable for multivariate normal data. Special methods are needed for non-normal data, like binary variables.

9.2 Cluster analysis: introduction and methods

Cluster analysis groups similar observations into clusters. This process formalizes how humans naturally categorize objects.

The effectiveness of a classification is judged by its usefulness. For instance, classifying people by economic status is more useful than classifying them by hair length.

Usefulness is key for a good classification.

Visualizing data, perhaps using scatterplots of principal component scores, is a helpful first step in cluster analysis.

  • Scatterplots: Aid in identifying potential clusters visually.

The chapter covers three main types of clustering:

  • Agglomerative hierarchical clustering
  • k-means clustering
  • Model-based clustering

9.3 Agglomerative hierarchical clustering

Agglomerative hierarchical clustering creates a hierarchy of partitions. It starts with each observation as a separate cluster and successively merges the closest clusters.

Once merged, clusters cannot be separated. The process stops when all observations are in a single cluster.

Hierarchical clustering builds up, from individuals to one big group.

Before clustering, an inter-individual distance matrix or similarity matrix is needed. Euclidean distance is a common measure.

If variables have different scales, standardization is often necessary.

The Euclidean distance between individual ii and individual jj is calculated as: dij=∑k=1q(xik−xjk)2d_{ij} = \sqrt{\sum_{k=1}^{q} (x_{ik} - x_{jk})^2}

Different methods define the distance between clusters:

  • Single linkage: Minimum distance between any two individuals in the clusters (dAB=min⁡i∈A,j∈B(dij)d_{AB} = \min_{i \in A, j \in B} (d_{ij})).
  • Complete linkage: Maximum distance between any two individuals (dAB=max⁡i∈A,j∈B(dij)d_{AB} = \max_{i \in A, j \in B} (d_{ij})).
  • Group average clustering: Average distance between all pairs of individuals (dAB=1nAnB∑i∈A∑j∈Bdijd_{AB} = \frac{1}{n_A n_B} \sum_{i \in A} \sum_{j \in B} d_{ij}).

Hierarchical classifications are often visualized using a dendrogram. This diagram shows fusions at each stage, resembling an evolutionary tree.

Dendrograms visualize the nested structure of hierarchical clusters.

Deciding on the "correct" number of clusters from a dendrogram can be challenging.

  • Informal approach: Look for large changes in height between successive fusions.

9.4 Clustering specific examples

Applying different linkage methods to body measurements reveals how they group data.

  • Single linkage can suffer from chaining, where intermediate points create long, straggly clusters.
  • Complete and average linkage often produce more compact and interpretable clusters.

For the jet fighter data, clustering using standardized variables revealed two main groups. This division largely corresponded to whether the aircraft could land on a carrier.

VariableDescription
FFDFirst flight date (months after Jan 1940)
SPRSpecific power (power per unit weight)
RGFFlight range factor
PLFPayload as fraction of gross weight
SLFSustained load factor
CARBinary (1 if carrier-capable, 0 otherwise)

Clustering jet fighters separated them by carrier capability.

🔑 Important: Hierarchical clustering builds groups by successively merging the closest observations or clusters, visualized by dendrograms.

🔑 Important: Choosing the number of clusters from a dendrogram is subjective; visual inspection and specific methods guide this decision.

9.5 Hierarchical clustering visualization

  • Hierarchical clustering can be visualized by cutting a dendrogram.
  • This cut determines the number of clusters.
  • The resulting clusters can then be plotted.
  • Plotting often uses principal components for dimensionality reduction.

📝 Example: Cutting a dendrogram to get two clusters and plotting them in PCA space. The plot shows different symbols and colors for each cluster, labeled by cluster and a relevant variable 187.

9.6 K-means clustering

  • K-means clustering aims to partition data into a specified number of groups, kk.
  • It minimizes the within-group sum of squares (WGSS) criterion.
  • WGSS measures the total variance within each cluster.
  • This is calculated by summing the squared distances from each data point to its cluster's mean.

WGSS=∑j=1q∑l=1k∑i∈Gl(xij−xˉl,j)2WGSS = \sum_{j=1}^{q} \sum_{l=1}^{k} \sum_{i \in G_l} (x_{ij} - \bar{x}_{l,j})^2

  • qq: number of variables.
  • kk: number of clusters.
  • GlG_l: set of individuals in cluster ll.
  • nln_l: number of individuals in cluster ll.
  • xijx_{ij}: value of individual ii on variable jj.
  • xˉl,j\bar{x}_{l,j}: mean of individuals in cluster ll on variable jj.

🔑 Important: The exact calculation of WGSS involves the mean of points within each cluster.

  • The number of possible partitions grows extremely rapidly with sample size (nn) and number of clusters (kk).
  • This makes checking every possible partition computationally infeasible.
Sample Size (nn)Number of Clusters (kk)Number of Possible Partitions
1532,375,101
20445,232,115,901
258690,223,721,118,368,580
10051068

🔑 Important: Exhaustive search for the best partition is impossible for practical dataset sizes.

  • Algorithms are used to find good solutions rather than guarantee the global minimum.
  • These algorithms iteratively improve partitions by rearranging existing ones.
  • They do not guarantee finding the absolute best solution.

🔑 Important: K-means uses iterative algorithms to approximate the optimal clustering, not a complete search.

🔑 Important: The problem of choosing the "true" value of kk (number of clusters) is addressed in later sections 188.

10. Exploratory factor analysis and cluster analysis (part 3)

10.1 K-means clustering

The k-means algorithm groups data into a specified number of clusters. It iteratively moves data points to the nearest cluster center to minimize within-group sum of squares.

  • Initial partition: Start with an initial grouping of data points.
  • Calculate movement: Determine how much moving each point improves the clustering criterion.
  • Make best move: Execute the move that yields the greatest improvement.
  • Repeat: Continue until no further improvements can be made.

k-means seeks to minimize the sum of squared distances between data points and their cluster centroids.

The k-means method has limitations. It is not scale-invariant, meaning results can change if data is standardized.

It also assumes clusters are "spherical" or hyper-football shaped, which may not fit all data. Despite this, it remains popular due to the ability to specify the number of clusters.

Choosing the optimal number of clusters often involves plotting the within-groups sum of squares against the number of groups, looking for an "elbow" point.

10.1.1 Crime rate data example

Crime rates per 100,000 residents for 50 US states plus Washington D.C. were analyzed.

  • Data: Crime data includes rates for murder, rape, robbery, assault, burglary, theft, and vehicle theft.
  • Outlier: The District of Columbia (DC) showed exceptionally high rates across most crime categories, identified as an outlier.
  • Standardization: Variances in raw crime rates were very different. Data was standardized by dividing each variable by its range to ensure similar scales.

Standardizing variables by range is crucial for k-means when variables have vastly different scales.

After standardizing, a plot of within-groups sum of squares for one to six clusters showed an "elbow" at two groups. The two-group solution essentially separated states based on an overall crime rate average.

10.1.2 Romano-British pottery data example

K-means clustering was applied to standardized measurements of 45 pots. An image plot of the distance matrix suggested at least three distinct groups.

  • Distance matrix: Calculated Euclidean distances between standardized pottery measurements.
  • Image plot: Visualized the distance matrix, showing dark areas for small distances (within clusters) and pale areas for large distances (between clusters).

The k-means analysis on the pottery data, using three clusters, corresponded well with regional groupings of kiln sites.

  • Cluster 1: Contained all pots from kiln site 1 (Region 1).
  • Cluster 2: Contained pots from kiln sites 2 and 3 (Region 2).
  • Cluster 3: Contained pots from kiln sites 4 and 5 (Region 3).

10.2 Model-based clustering

Model-based clustering uses formal statistical models to group data. It assumes data comes from a population composed of several subpopulations (clusters), each with a distinct probability density function.

This forms a finite mixture density for the overall population.

  • Advantages: Offers more persuasive solutions, especially to statisticians, and allows for formal inference.
  • Model selection: Helps in determining the number of clusters and choosing between methods.

Finite mixture models provide a formal statistical basis for cluster analysis.

Finite mixture models treat cluster membership as a latent categorical variable. This approach is also known as latent class cluster analysis.

10.2.1 Finite mixture densities

A finite mixture density is a probability density function formed by a weighted sum of component densities:

f(x;p,θ)=∑j=1cpjgj(x;θj)f(x; p, \theta) = \sum_{j=1}^{c} p_j g_j(x; \theta_j)

  • xx: A pp-dimensional random variable.
  • p=(p1,p2,...,pc−1)p = (p_1, p_2, ..., p_{c-1}): Mixing proportions (non-negative, sum to 1).
  • θ=(θ1⊤,θ2⊤,...,θc⊤)\theta = (\theta_1^{\top}, \theta_2^{\top}, ..., \theta_c^{\top}): Parameters for component densities.
  • gjg_j: Component densities.
  • cc: The number of components (clusters).

This model is suitable for cluster analysis if each cluster in the data originates from a population with a different probability distribution. These distributions may share the same family but differ in their parameters.

  • Posterior probability: Observations are assigned to clusters based on the maximum estimated posterior probability: P^(cluster j∣xi)=p^jgj(xi;θ^j)f(xi;p^,θ^)\hat{P}(\text{cluster } j | x_i) = \frac{\hat{p}_j g_j(x_i; \hat{\theta}_j)}{f(x_i; \hat{p}, \hat{\theta})}

10.2.2 Maximum likelihood estimation

Estimating parameters in finite mixture densities typically uses iterative algorithms because the likelihood function is complex. For multivariate normal components with mean vector μj\mu_j and covariance matrix Σj\Sigma_j, the estimation involves:

  • Mixing proportions: p^j=1n∑i=1nP^(j∣xi)\hat{p}_j = \frac{1}{n} \sum_{i=1}^{n} \hat{P}(j | x_i)
  • Mean vectors: μ^j=1np^j∑i=1nxiP^(j∣xi)\hat{\mu}_j = \frac{1}{n\hat{p}_j} \sum_{i=1}^{n} x_i \hat{P}(j | x_i)
  • Covariance matrices: Σ^j=1n∑i=1n(xi−μj)(xi−μj)⊤P^(j∣xi)\hat{\Sigma}_j = \frac{1}{n} \sum_{i=1}^{n} (x_i - \mu_j)(x_i - \mu_j)^{\top} \hat{P}(j | x_i)

An iterative process refines parameter estimates by:

  1. Estimating posterior probabilities using current parameters.
  2. Updating parameters (p^j\hat{p}_j, μ^j\hat{\mu}_j, Σ^j\hat{\Sigma}_j) based on new probabilities.
  3. Repeating until convergence.

Convergence issues can arise unless component covariance matrices are handled carefully.

🔑 Important: Model-based clustering offers a more formal and statistically grounded approach to cluster analysis compared to heuristic methods.

11. Confirmatory factor analysis and structural equation models (part 1)

11.1 Introduction to CFA and SEM

  • Exploratory Factor Analysis (EFA): Used early to see if factors can simplify relationships between observed variables. It determines which variables link to factors and how many factors are needed. No constraints on variable-factor loadings.
  • Confirmatory Factor Analysis (CFA): Tests specific hypothesized models. Certain variables are allowed to relate to specific factors, while others are fixed to zero loadings.
  • CFA models can stem from theory or EFA results. If using EFA results, the model must be tested on new, independent data.
  • Structural Equation Models (SEM): A broader category including CFA. They model relationships between latent (unobserved) variables using linear equations. SEM explains correlations between observed variables via latent variables and their relationships.
  • SEM combines traditions from psychology, econometrics, and biometrics. Latent variables appeared early in psychometrics (Spearman). Path analysis (Wright) studied direct and indirect effects. Blalock and Duncan combined path analysis with simultaneous equations.
  • Jöreskog, Bentler, and Browne developed SEM in the 1970s, allowing complex models to be handled routinely.

CFA specifies relationships; SEM models latent variable links.

11.2 Estimation, identification, and assessing fit

11.3 Estimation methods

  • SEM parameters are estimated from the covariance or correlation matrix of manifest variables.
  • Estimation finds parameter values that minimize a discrepancy function. This function measures differences between observed and model-implied covariance matrices.
  • The observed covariance matrix is S. The model-implied matrix is Σ(θ), where θ represents model parameters.

Estimation minimizes the gap between observed and model-predicted covariances.

  • Ordinary Least Squares (OLS) Discrepancy Function (FLS):

    • Formula: FLS(S,Σ(θ))=∑i<j∑j(sij−σij(θ))2FLS(S,Σ(θ)) = ∑_{i<j} ∑_{j} (s_{ij} −σ_{ij}(θ))^2
    • Problems: Sensitive to the scale of variables. Different results for covariance vs. correlation matrices.
  • Maximum Likelihood (ML) Estimation:

    • Most common method, assumes multivariate normal data.
    • Minimizes the ML discrepancy function, FML.
    • Formula: FML(S,Σ(θ)) = log |Σ(θ)| − log |S| + tr(SΣ(θ)⁻¹) − q
    • Requires iterative numerical algorithms to find minimum.

11.4 Model identification

  • Identifiability: A model is identifiable if different sets of parameter values lead to different predicted covariance matrices. Formally, Σ(θ₁) = Σ(θ₂) implies θ₁ = θ₂.
  • Problem: If a model is unidentifiable, parameters cannot be uniquely estimated. Different parameter sets can produce the same Σ(θ).
  • Example: A model with three manifest variables (x, y, xp) and two latent variables (u, v). The covariance matrix Σ(θ) might have parameters θ₁ and θ₂ that are not uniquely determined (e.g., θ₁ increases, θ₂ decreases by the same amount, without changing Σ(θ)).
ParameterRepresentsIssue
θ₁Var(v)Not uniquely determined with θ₂
θ₂Var(ϵ)Not uniquely determined with θ₁
θ₃Cov(v,u)Determined
θ₄Var(u)Determined
θ₅Var(δ)Determined
θ₆Var(δₚ)Determined
  • CFA/SEM Identification: Depends on model choice and specification of fixed, constrained, and free parameters.
  • Necessary Condition: Number of free parameters (t) must be less than q(q+1)/2, where q is the number of manifest variables. This is not sufficient.
  • Difficulty: No simple, universal rules for evaluating identification.

Identification is crucial: without it, parameter estimates are meaningless.

11.5 Assessing model fit

  • After estimation, assess how well the model-predicted covariance matrix matches the observed one.
  • Likelihood Ratio Test Statistic (X²):
    • Formula: X² = (N − 1)FML_min, where N is sample size and FML_min is the minimized ML discrepancy.
    • Tests if population covariance matrix equals the model-implied matrix.
    • Distribution: Chi-squared with degrees of freedom ν = q(q+1)/2 − t.
  • Limitations of X²:
    • In large samples, even small model departures can lead to rejection.
    • Many models might be rejected due to large sample sizes.
  • Nested Models: Use X² differences to compare models. A large difference in X² relative to the difference in degrees of freedom indicates a genuine improvement in fit.
  • Non-normality: If data are non-normal (e.g., high kurtosis), the X² test approximation may be poor. Assessing kurtosis is advised.

X² tests perfect fit; use it cautiously, especially with large samples or non-normal data.

11.6 Model assessment and fit indices

Assessing a statistical model's fit involves multiple checks. The X² statistic is a primary tool.

It should be used alongside other methods for a comprehensive evaluation.

  • Visual inspection of residuals: Differences between observed and predicted covariances should be small relative to observed values.
  • Parameter standard errors: Large correlations between parameter estimates may suggest model identification issues.
  • Parameter ranges: Estimated values must fall within their valid theoretical ranges. Negative variances or correlations greater than 1 indicate a flawed model.

Several fit indices provide additional insights:

Index NameDescriptionInterpretation
Goodness-of-Fit Index (GFI)Measures variance and covariance accounted for by the model compared to observed data.Values > 0.90 or 0.95 suggest acceptable fit.
Adjusted GFI (AGFI)Adjusts GFI for the model's degrees of freedom relative to the number of variables.Useful for comparing models with different complexity.
Root-Mean-Square Residual (RMSR)The square root of the average squared difference between observed and predicted covariances.RMSR < 0.05 generally indicates a reasonable fit.

These indices can compare models fitted to the same data or models fitted to different datasets.

11.7 Confirmatory factor analysis models

Confirmatory Factor Analysis (CFA) tests a hypothesized structure of latent variables. In CFA, specific factor loadings are fixed to zero.

Correlations between factors might also be set to zero. The model is then fitted to data by estimating the parameters not fixed by the researcher.

Maximum likelihood estimation is commonly used.

🔑 Important: Unlike exploratory factor analysis, CFA requires researchers to specify which observed variables load onto which latent factors a priori.

11.8 Ability and aspiration example

Calsyn and Kenny studied self-concept, parental evaluation, teacher evaluation, friend’s evaluation, educational aspiration, and college plans in eighth-grade students. They hypothesized two latent variables: ability and aspiration .

  • The first four observed variables were indicators of ability.
  • The last two observed variables were indicators of aspiration.
  • The latent variables, ability and aspiration, were assumed to be correlated.

The model specifies relationships using regression-like equations. For instance, self-concept of ability (SCA) is related to the latent ability factor (f1) and aspiration factor (f2).

Many loadings are set to zero, meaning these observed variables are not predicted by certain latent factors.

The model's parameters include:

  • Factor loadings (λ) for each observed variable on its factor.
  • Specific variances (ψ) for each observed variable, representing unique error.
  • The correlation (ρ) between the latent factors.

With 6 observed variables, there are 21 terms in the correlation matrix. The specified model has 13 estimated parameters, leaving 8 degrees of freedom (21 - 13).

📝 Example: The equation for self-concept of ability is SCA = λ1f1 + 0f2 + u1. This means SCA is explained by the latent ability factor (f1) and its unique error (u1), but not by the latent aspiration factor (f2).

The correlation matrix of the data is visualized with ellipses, where color and value indicate the strength and direction of correlations. Lighter colors and higher positive values signify stronger positive relationships.

Darker colors indicate stronger negative relationships.

R code for fitting the CFA model

ability_model <- specify.model(file = "ability_model.txt")

ability_sem <- sem(ability_model, ability, 556)

🔑 Important: CFA models are tested by estimating free parameters, with loadings fixed to zero and correlations between factors optionally constrained.

🔑 Important: The degrees of freedom in a CFA model are calculated as the number of unique variances and covariances in the data minus the number of estimated parameters.

12. Confirmatory factor analysis and structural equation models (part 2)

12.1 Model specification and fitting

  • Reticular Action Model (RAM) notation: This is a text-based method for specifying SEM models. It uses arrows to represent relationships.
    • Single-headed arrows: Indicate regression coefficients.
    • Double-headed arrows: Indicate variance parameters.
  • Model Fitting: After specification, models are fitted to observed data, typically using maximum likelihood estimation.
  • Parameter Estimates: The output includes estimates for model parameters, their standard errors, and z-values to test significance.
    • lambda values: Loadings of observed variables on latent variables.
    • rho values: Correlations between latent variables.
    • theta values: Variances of error terms for observed variables (unique variances).

These parameters quantify how observed variables relate to latent ones and how latent variables relate to each other.

Model Specification Example (Ability and Aspiration)

Arrow SpecificationParameter NameValue Assignment
Ability -> SCAlambda1NA
Ability -> PPElambda2NA
Aspiration -> EAlambda5NA
Ability <-> AspirationrhoNA
SCA <-> SCAtheta1NA
Ability <-> AbilityNA1

[ ] 221.

12.2 Assessing model fit

  • Chi-square statistic: Tests if the model-implied covariance matrix matches the observed covariance matrix.
    • A non-significant p-value (typically > 0.05) suggests good fit.
    • A significant p-value indicates poor fit.
  • Fit Indices: Provide a more nuanced assessment of model fit.
Fit IndexValue (Ability Model)Value (Drug Use Model)Interpretation Guideline
Goodness-of-fit index (GFI)0.9940.970Higher is better (e.g., > 0.90)
Adjusted GFI (AGFI)0.9850.953Higher is better, accounts for complexity
Root Mean Square Error of Approximation (RMSEA)0.0170.053Lower is better (e.g., < 0.08)
Normed Fit Index (NFI)0.9950.951Higher is better (e.g., > 0.90)
Tucker-Lewis Index (TLI/NNFI)0.9990.945Higher is better (e.g., > 0.90)
Comparative Fit Index (CFI)0.9990.959Higher is better (e.g., > 0.90)
Standardized Root Mean Square Residual (SRMR)0.0120.039Lower is better (e.g., < 0.08)
Bayesian Information Criterion (BIC)-41.310-105.04Lower is better; penalizes complexity

[ 226 223.

  • Normalized Residuals: Differences between observed and model-predicted correlations, scaled to be independent of variances.
    • Absolute values less than 2 generally suggest good fit.
    • Large residuals indicate areas where the model does not adequately explain the data.

Low chi-square values and high fit indices suggest that the proposed model aligns well with the observed data.

12.3 Confirmatory Factor Analysis examples

12.3.1 Ability and aspiration

  • This model tests two latent variables: Ability and Aspiration, each indicated by several observed variables.
  • The estimated correlation between Ability and Aspiration is 0.666, which is a disattenuated correlation, meaning it's not affected by measurement error in the indicators. [ ] 222.

12.3.2 Drug use

  • This model investigates three latent variables: Alcohol use, Cannabis use, and Hard drug use.
  • Some observed variables (e.g., Cigs, Wine) load onto multiple latent variables, reflecting their association with different types of drug use.
  • The initial model fit was poor (chi-square p-value = 0), indicated by large normalized residuals. Modifications were needed to improve fit.

Drug Use Latent Variables and Indicators

Latent VariableIndicators
Alcohol useCigs, Beer, Wine, Liqr (spirits)
Cannabis useCigs, Wine, Marj (marijuana), Hash (hashish)
Hard drug useLiqr (spirits), Cocn (cocaine), Tran (tranquillizers), Drug (drug store medication), Hern (heroin), Hash, Inhl (inhalants), Hall (hallucinogenics), Amph (amphetamines)

[ 225, 227 224.

12.4 Structural equation models

  • Definition: SEM extends CFA by including regression equations that link latent variables to each other.
  • Purpose: Used to model complex relationships and test hypothesized causal pathways between latent constructs.
  • Model Identification: Latent variable scales must be fixed (e.g., by setting a variance to 1 or a loading to 1) for the model to be identifiable.

12.4.1 Stability of alienation

  • This example models the stability of alienation and its relationship with socioeconomic status (SES) over time.
  • Latent variables SES, alienation 67 (in 1967), and alienation 71 (in 1971) are measured by observed variables.
  • The model includes regressions of SES on alienation and alienation in 1967 on alienation in 1971.

Alienation Model Path Specifications

Predictor VariableOutcome VariableParameter
SESEducationNA (fixed loading to 1)
SESSEI (Socioeconomic Index)lambda1
Alienation67Anomia67NA (fixed loading to 1)
Alienation67Powerlessness67lambda2
Alienation71Anomia71NA (fixed loading to 1)
Alienation71Powerlessness71lambda3
SESAlienation67beta1
SESAlienation71beta2
Alienation67Alienation71beta3

[ 232 231.

  • Model Fit Issues: The initial alienation model showed poor fit (chi-square p-value < 0.001).
  • Model Improvement: Correlating measurement errors for anomia at different time points significantly improved the model fit.

When assessing model fit, consider multiple indices and residuals, not just the chi-square test, and ensure theoretical justification for model modifications.

Revised Alienation Model Modification

[ ] 235.

🔑 Important: SEM and CFA allow testing complex theoretical relationships between unobserved constructs, but causal inference requires careful consideration of study design and all relevant variables.

13. Analysis of repeated measures data (part 1)

13.1 Data formats and overview

Repeated measures data involve multiple observations of the same variable for each unit. These data can be stored in two main formats:

  • Wide form: Each row represents a unit, with repeated measures in separate columns.
  • Long form: Each row represents a single measurement, including unit identifiers, time, and the response.

The primary goal in analyzing repeated measures data is to understand how the response variable changes and identify associated explanatory variables. Because measurements on the same unit are likely correlated, specialized analytical methods are required.

These methods account for both fixed effects of explanatory variables and the correlational structure of the repeated measurements.

Repeated measures data analysis requires models that handle correlated observations.

13.2 Linear mixed-effects models

Linear mixed-effects models (LMMs) are powerful tools for analyzing repeated measures. They incorporate random effects to account for unobserved individual characteristics influencing response patterns.

The core idea is that within-unit correlation arises from shared, unobserved factors.

13.2.1 Random intercept model

The random intercept model introduces a subject-specific random component (uiu_i). This component adds to the intercept and is constant across all measurements for that subject.

  • Model: yij=(β0+ui)+β1xj+ϵijy_{ij} = (\beta_0 + u_i) + \beta_1 x_j + \epsilon_{ij}
  • ui∼N(0,σu2)u_i \sim N(0, \sigma^2_u)
  • ϵij∼N(0,σ2)\epsilon_{ij} \sim N(0, \sigma^2)

This model allows for different intercepts for each subject but assumes a common slope for the fixed effect.

Random intercept model: subjects have unique baseline levels but follow the same trend.

The variance components are:

  • Total variance: σu2+σ2\sigma^2_u + \sigma^2
  • Covariance between measurements: σu2\sigma^2_u
  • Intra-class correlation: σu2σu2+σ2\frac{\sigma^2_u}{\sigma^2_u + \sigma^2}

This intra-class correlation represents the proportion of variance due to between-subject differences. The random intercept model imposes a compound symmetry structure on the correlations, meaning all pairs of measurements have the same correlation.

This may not be realistic, especially for longitudinal data where correlations often decrease with time.

13.2.2 Random intercept and slope model

The random intercept and slope model allows for greater flexibility by enabling heterogeneity in both intercepts and slopes.

  • Model: yij=(β0+ui1)+(β1+ui2)xj+ϵijy_{ij} = (\beta_0 + u_{i1}) + (\beta_1 + u_{i2}) x_j + \epsilon_{ij}
  • (ui1,ui2)(u_{i1}, u_{i2}) have a bivariate normal distribution with variances σu12\sigma^2_{u1}, σu22\sigma^2_{u2} and covariance σu1u2\sigma_{u1u2}.

This model provides a more realistic correlation structure by allowing different variances and correlations for repeated measurements.

Random intercept and slope model: subjects have unique baselines and individual trends.

The variance of the total residual is: Var(ui1+xjui2+ϵij)=σu12+2σu1u2xj+σu22xj2+σ2\text{Var}(u_{i1} + x_j u_{i2} + \epsilon_{ij}) = \sigma^2_{u1} + 2 \sigma_{u1u2} x_j + \sigma^2_{u2} x^2_j + \sigma^2 The covariance between two residuals for the same individual is: Cov(ui1+xjui2+ϵij,ui1+xjpui2+ϵijp)=σu12+σu1u2(xj+xjp)+σu22xjxjp\text{Cov}(u_{i1} + x_j u_{i2} + \epsilon_{ij}, u_{i1} + x_{jp} u_{i2} + \epsilon_{ijp}) = \sigma^2_{u1} + \sigma_{u1u2} (x_j + x_{jp}) + \sigma^2_{u2} x_j x_{jp}

13.2.3 Model fitting and comparison

Linear mixed-effects models are typically estimated using maximum likelihood (ML) or restricted maximum likelihood (REML). REML is often preferred as it provides more consistent estimates of variance components.

Model comparison is usually done using:

  • Likelihood ratio tests (LRTs): To compare nested models.
  • Information criteria (AIC, BIC): For model selection, especially when models are not nested.

Model comparison helps choose the best-fitting structure for the data's random effects.

Example: Timber slippage data

The timber slippage data illustrate fitting these models.

  • A simple linear model (yij=β0+β1xj+ϵijy_{ij} = \beta_0 + \beta_1 x_j + \epsilon_{ij}) assumes independence.
  • A random intercept model (yij=(β0+ui)+β1xj+ϵijy_{ij} = (\beta_0 + u_i) + \beta_1 x_j + \epsilon_{ij}) accounts for subject-specific intercepts.
  • A random intercept and slope model (yij=(β0+ui1)+(β1+ui2)xj+ϵijy_{ij} = (\beta_0 + u_{i1}) + (\beta_1 + u_{i2}) x_j + \epsilon_{ij}) allows for subject-specific intercepts and slopes.

Initially, the random intercept model did not significantly improve upon the simple linear model. However, the random intercept and slope model was preferred over the random intercept model.

Adding a quadratic term for slippage significantly improved the model fit, indicating a non-linear relationship.

Example: Glucose challenge data

The glucose challenge data demonstrate fitting models with time-varying covariates.

  • Plots revealed curvature in plasma phosphate levels over time and potential group differences.
  • A model including linear and quadratic time effects, group, and random intercepts and slopes was fitted.
  • The random intercept and slope model showed significant linear and quadratic time effects, and a significant group effect.

Comparing this LMM to a model assuming independence highlighted that the independence assumption leads to underestimated standard errors, potentially causing misleading conclusions about group differences.

Assuming independence in repeated measures data can lead to inflated significance for fixed effects.

🔑 Important: Linear mixed-effects models are crucial for correctly analyzing repeated measures data by accounting for within-subject correlation through random effects.

14. Analysis of repeated measures data (part 2)

14.1 Checking model assumptions

  • Assumptions verification: Check model assumptions for normality of random effects and residuals.
  • Methods: Use functions like random.effects() and resid() to obtain predicted random effects and residuals.
  • Visualization: Employ normal probability plots to assess the linearity of these components.
  • Interpretation: Deviations from linearity in random effects plots suggest potential model issues. Linear residuals are ideal.

🔑 Important: Linear mixed-effects models require checking the normality of random effects and residuals.

14.2 Prediction of random effects

  • Empirical Bayes estimates: These are used as estimates for random effects.
  • Shrinkage effect: Predicted random effects are smaller in absolute value than their fixed-effect counterparts.
  • BLUPs: Best Linear Unbiased Predictions are linear combinations of responses that minimize mean square error and are unbiased estimators of random effects 260.

14.3 Handling dropouts in longitudinal data

  • Missing data issue: Dropouts are a common problem in longitudinal studies, leading to missing outcome measures.
  • Types of missingness:
    • Intermittent missing values: Occur when a participant misses a single visit.
    • Dropouts: Result in all subsequent planned observations being missing.
  • Impact: Dropouts cause more significant analytical challenges than intermittent missing values [261-262]

📝 Example: In a clinical trial, a patient not attending a scheduled visit causes intermittent missing data. A patient withdrawing from the study entirely causes all future data to be missing.

14.4 Dropout mechanisms

Three types of dropout mechanisms influence analysis suitability:

Mechanism TypeProbability of Dropout Depends OnImplications for Analysis
Dropout Completely at Random (DCAR)Neither observed nor missing valuesObserved data form a simple random sample. Least problematic but a strong assumption.
Dropout at Random (DAR)Past observed outcomes (conditionally independent of future outcomes)Missingness depends only on observed data. Valid for mixed-effects models.
Non-ignorable (Informative)Unrecorded missing valuesDropout probability depends on future unobserved values (e.g., condition worsening). Difficult to analyze; requires specialized models.

[266-268]

🔑 Important: Mixed-effects models are valid under the Dropout at Random (DAR) assumption, which is less strict than DCAR.

14.5 Analyzing data with dropouts

  • Model fitting: Use lme() with na.action = na.omit to handle missing values. This excludes only rows with missing values, not entire participants with any missingness.
  • Model comparison: Likelihood ratio tests (e.g., anova(model1, model2)) can compare models with different random effects structures 264.
  • Assessing dropout mechanism:
    • Graphical procedures can help identify dropout mechanisms.
    • Plotting observations by attendance at the next visit can reveal differences, indicating non-DCAR dropout.

📝 Example: For the BtheB data, plotting BDI values based on whether patients attend their next visit helps assess dropout randomness 268.

14.6 Summary of repeated measures analysis

  • Linear mixed-effects models are essential for longitudinal and repeated measures data.
  • They account for correlations between measurements, enabling valid inferences.
  • Models can be extended to non-normal responses and account for clustering (e.g., by study centers) 270.

🔑 Important: Linear mixed-effects models are powerful tools for repeated measures data, handling correlations and allowing for complex fixed and random effects.

14.7 Handling missing data and dropouts

Missing data in longitudinal studies can arise from various reasons. Understanding why data is missing is crucial for choosing appropriate analysis methods.

The analysis techniques for repeated measures data must account for these missing values to provide unbiased results.

🔑 Important: Ignoring missing data or using simple imputation methods can lead to biased estimates and incorrect conclusions in longitudinal studies.

Missing data can be categorized based on the mechanism causing it. This mechanism influences how the data can be handled.

Common mechanisms include Missing Completely At Random (MCAR), Missing At Random (MAR), and Missing Not At Random (MNAR).

Missingness MechanismDescriptionImplication for Analysis
MCARMissingness does not depend on observed or unobserved data.Standard methods are often unbiased if applied to observed data; complete case analysis is valid.
MARMissingness depends on observed data, but not on the missing value itself.More advanced methods are needed; likelihood-based methods are generally preferred.
MNARMissingness depends on the unobserved missing value itself.Most difficult to handle; requires strong assumptions and specific modeling approaches.

The primary challenge with repeated measures data is that missingness can occur at different time points for different subjects. This creates an unbalanced dataset.

Simple methods like listwise deletion (removing entire subjects with any missing data) can drastically reduce sample size and introduce bias if the missingness is not MCAR.

🔑 Important: Listwise deletion is only appropriate when data is Missing Completely At Random (MCAR).

More sophisticated methods are employed to handle missing data in longitudinal studies. These include various imputation techniques and model-based approaches that directly incorporate the missing data mechanism.

  • Imputation: Replacing missing values with estimated values.
    • Single imputation: Replaces each missing value once.
    • Multiple imputation: Replaces each missing value multiple times, creating several complete datasets. These datasets are then analyzed separately, and the results are pooled.
  • Likelihood-based methods: These methods, such as mixed-effects models, can handle MAR data by modeling the probability of missingness or by using all available data without explicit imputation.

Dropouts are a specific type of missing data in longitudinal studies where subjects discontinue participation. Analyzing data with dropouts requires careful consideration of the reasons for dropout.

If dropouts are related to treatment effects or outcomes (MNAR), standard analyses can be severely biased.

🔑 Important: Analyzing longitudinal data with informative dropouts requires specialized models that explicitly account for the dropout mechanism.

14.8 Analyzing longitudinal data with mixed-effects models

Linear mixed-effects models (LMMs) are a powerful framework for analyzing repeated measures data. They allow for the modeling of both fixed effects and random effects.

Fixed effects represent population-averaged trends, while random effects capture subject-specific deviations from these trends.

📝 Example: In a study measuring blood pressure over time, a fixed effect might represent the average decrease in blood pressure due to medication, while a random effect could account for individual differences in baseline blood pressure.

LMMs can handle unbalanced data and subjects with different numbers of observations. They also provide a flexible way to model the correlation structure between repeated measurements within subjects.

14.9 Random intercept models

A common type of LMM is the random intercept model. In this model, each subject has their own intercept, meaning they can have a different starting point for the outcome variable.

The intercept for each subject is assumed to follow a distribution (typically normal) with a mean and variance.

  • Fixed intercept: Represents the average intercept across all subjects.
  • Random intercept: The deviation of a subject's intercept from the fixed intercept. This accounts for baseline differences between individuals.
  • Subject-specific slope: The slope for the predictor variables is assumed to be the same for all subjects.

The model equation for a random intercept model can be expressed as:

Yij=(β0+u0i)+∑k=1pβkXik+ϵijY_{ij} = (\beta_0 + u_{0i}) + \sum_{k=1}^p \beta_k X_{ik} + \epsilon_{ij}

Where:

  • YijY_{ij} is the outcome for subject ii at time jj.
  • β0\beta_0 is the fixed intercept.
  • u0iu_{0i} is the random intercept for subject ii, assumed to be u0i∼N(0,σu02)u_{0i} \sim N(0, \sigma^2_{u0}).
  • βk\beta_k are the fixed slopes for predictors XikX_{ik}.
  • ϵij\epsilon_{ij} is the residual error for subject ii at time jj, assumed to be ϵij∼N(0,σϵ2)\epsilon_{ij} \sim N(0, \sigma^2_{\epsilon}).

The variance components σu02\sigma^2_{u0} and σϵ2\sigma^2_{\epsilon} are estimated from the data. A larger σu02\sigma^2_{u0} indicates greater variability in intercepts among subjects.

🔑 Important: Random intercept models assume that the effect of predictors (slopes) is the same for all subjects.

14.10 Random slope models

Random slope models extend random intercept models by allowing the slopes of predictors to vary across subjects. This accounts for situations where the effect of a predictor differs from person to person.

  • Fixed intercept and slopes: Represent population-averaged effects.
  • Random intercepts and slopes: Account for subject-specific starting points and subject-specific effects of predictors.

The model equation for a random slope model with one time predictor could be:

Yij=(β0+u0i)+(β1+u1i)tij+ϵijY_{ij} = (\beta_0 + u_{0i}) + (\beta_1 + u_{1i}) t_{ij} + \epsilon_{ij}

  • β1\beta_1 is the fixed slope for time (tijt_{ij}).
  • u1iu_{1i} is the random slope for time for subject ii, assumed to be u1i∼N(0,σu12)u_{1i} \sim N(0, \sigma^2_{u1}).

The random effects u0iu_{0i} and u1iu_{1i} can be correlated. This correlation captures the idea that subjects with higher (or lower) baseline values might also have steeper (or flatter) trajectories.

🔑 Important: Random slope models provide more flexibility by allowing subject-specific trajectories for each predictor.

Choosing between a random intercept model and a random slope model depends on the data and research question. If there is substantial evidence that the effect of a predictor varies across individuals, a random slope model is more appropriate.

  • Random intercept model: Accounts for between-subject variability in the outcome at a baseline, assuming a common trend.
  • Random slope model: Accounts for between-subject variability in both the outcome at baseline and the rate of change over time.

🔑 Important: When deciding between random intercept and random slope models, consider whether the relationship between a predictor and the outcome is expected to be consistent across all individuals.

15. Analysis of repeated measures data (part 3)

15.1 Linear mixed-effects models for longitudinal data

Linear mixed-effects models (LMMs) are powerful tools for analyzing longitudinal data. These models account for the correlation between repeated measurements on the same subject.

They do this by including both fixed effects and random effects in the model.

  • Fixed effects represent population-average effects of predictors.
  • Random effects account for subject-specific deviations from the population average. They model the variability between individuals.

15.2 Random intercept models

A common approach is the random intercept model. This model allows each subject to have their own baseline level.

All subjects share the same overall trend (fixed effect), but their starting points differ.

  • Model structure: y_ij = (X_i \beta) + (Z_i \gamma_j) + \epsilon_i
    • y_ij: The response for subject j at time i.
    • X_i: Fixed effects predictor variables.
    • \beta: Fixed effects coefficients.
    • Z_i: Random effects design matrix.
    • \gamma_j: Random intercepts for subject j.
    • \epsilon_i: Residual error.

This model assumes \gamma_j are independent and identically distributed (i.i.d.) with mean zero and variance σγ2\sigma_{\gamma}^2. The errors \epsilon_i are also i.i.d.

with mean zero and variance σϵ2\sigma_{\epsilon}^2. This captures the correlation within subjects 233.

15.3 Random slope models

Random slope models extend random intercept models. They allow the effect of a predictor to vary across subjects.

This means not only do subjects start at different points, but their trajectories also differ.

  • Random intercept and slope model: This model permits both the intercept and the slope of a predictor to vary randomly by subject.
    • This is useful when the rate of change over time or response to a predictor differs significantly among individuals.
  • Model structure: It includes terms for both random intercepts and random slopes for one or more predictors. The random effects are often assumed to be multivariate normal. [232-233]

🔑 Important: Random slope models offer greater flexibility by allowing individual differences in response trajectories, not just baseline levels.

15.4 Handling missing data and dropouts

Longitudinal studies often face missing data due to participants dropping out. Properly addressing this is crucial for valid analysis.

  • Missing Completely at Random (MCAR): The probability of missing data does not depend on any observed or unobserved variables.
  • Missing at Random (MAR): The probability of missing data depends only on observed variables, not on the missing values themselves.
  • Non-ignorable Missing Data: The probability of missingness depends on the unobserved missing values. This is the most challenging case.

Common methods for handling missing data in LMMs include:

  • Multiple Imputation: Replaces missing values with multiple plausible values, creating several complete datasets.
  • Maximum Likelihood Estimation: LMMs can often handle MAR data directly using maximum likelihood or restricted maximum likelihood (REML) estimation. This avoids explicit imputation. [253-254]

🔑 Important: Assuming data are MAR allows for more robust inference using standard LMM software packages. Non-ignorable missingness requires specialized modeling techniques.

15.5 Model fitting and interpretation

Fitting LMMs involves specifying the fixed effects structure and the random effects structure.

Model ComponentDescription
Fixed effectsPopulation-average effects. Includes terms for predictors like time, group, and their interactions.
Random effectsSubject-specific variations. Captures differences in intercepts and/or slopes.
Covariance structureDescribes how random effects and residual errors are correlated.

Interpretation focuses on:

  • Fixed effects: Their significance and magnitude estimate average population effects.
  • Random effects variance: Indicates the extent of variability among subjects for intercepts and slopes. [234-235]

🔑 Important: Software like nlme and lme4 in R are commonly used for fitting LMMs. Model selection often involves comparing goodness-of-fit statistics and examining residual plots. [235-236]

🔑 Important: The analysis of repeated measures data using linear mixed-effects models is crucial for understanding individual trajectories and population trends, especially when dealing with longitudinal designs and missing data.

© 2026 Maeve. All rights reserved. This content is protected by copyright.

See also