Tutorials › Statistical Learning (Graduate) › When a Design Is Fixed Rather Than Random

Statistical Experiments and Targets · Tutorial 5 of 989

When a Design Is Fixed Rather Than Random

Learn to distinguish fixed covariate values from sampled covariates and to interpret regression targets in light of the sampling protocol.

Beginner 10 min read

What You'll Learn

  • Identify which quantities are random under fixed- and random-design sampling.
  • Express both formulations using the same linear regression model.
  • Explain why conditioning on a random design recovers a fixed-design response law.
  • Derive conditional unbiasedness of the least-squares slope under either formulation.
  • Distinguish a target about a conditional mean relationship from a target averaged over sampled covariates.

One Regression Model, Two Sampling Plans

A regression data set contains covariates and responses, but the fact that both appear in a table does not mean they were generated in the same way. The covariate values might have been selected in advance, or they might have been observed as part of a sample from a population. This difference changes which quantities are random and what the data can represent.

Use the same simple regression model in both cases:

$$ Y_i=\beta_0+\beta_1 X_i+\varepsilon_i, $$

where \(\beta_0\) and \(\beta_1\) describe a linear conditional mean, and the errors have mean zero given the covariates. The model alone does not determine whether the \(X_i\)'s are fixed or random. That is specified by the sampling plan.

Definition: In a fixed-design formulation, the covariate values \(x_1,\ldots,x_n\) are treated as specified constants, while the responses vary according to a response model at those values. In a random-design formulation, the covariates \(X_1,\ldots,X_n\) are random variables, as are the responses \(Y_1,\ldots,Y_n\). A fixed-design analysis may also be understood as conditioning on the realized covariates in a random-design analysis, when that conditional response law is the same.

In the fixed-design formulation, randomness comes from the responses or errors, not from the chosen covariate values. In the random-design formulation, the covariates vary across repetitions of the sampling process as well. “Fixed” here describes the statistical formulation; it does not necessarily mean that a researcher physically set every covariate. Conversely, random assignment of units to treatment groups does not by itself settle whether the covariates used in a regression are modeled as random or conditioned upon.

What Is Random, and What Is the Target?

Suppose \(x_1,\ldots,x_n\) are chosen as study settings, such as planned dosage levels. The responses \(Y_i\) are then random, but \(x_i\) is a constant in the sampling model. A statement such as \(E[Y_i]=\beta_0+\beta_1x_i\) refers to the response mean at that particular setting.

In a random-design formulation, \(X_i\) varies from one sample to another. The analogous model statement is conditional:

$$ E[Y_i\mid X_i]=\beta_0+\beta_1X_i. $$

Here \(\beta_1\) describes the change in conditional mean for a one-unit change in \(X_i\), under the assumed linear mean model. A fixed design asks about this relationship at specified covariate values. A random design also raises questions about which covariate values are sampled and how often. For example, an average prediction error over the sampled covariates depends on their distribution; it is not automatically the same quantity as error averaged over a different covariate distribution.

Thus the algebraic form of a regression target may be unchanged while its interpretation shifts. Under fixed design, a target can describe responses at the chosen settings or a contrast across them. Under random design, a target may describe a conditional relationship over covariate values generated by the sampling process, or an average that weights values according to that process. The sampling plan determines which interpretation is justified.

Worked Example: Prespecified Dosage Levels

A study specifies three dosage levels, \(x_1=0\), \(x_2=5\), and \(x_3=10\) mg, and plans to collect responses at each level. Suppose the response mean follows \(E[Y_i\mid x_i]=4+2x_i\), with mean-zero response errors at each setting.

The design values are constants: \(0\), \(5\), and \(10\). The corresponding response means are \(4+2(0)=4\), \(4+2(5)=14\), and \(4+2(10)=24\). Responses can differ from these means across repeated studies, but the specified dosage levels do not vary in this fixed-design formulation.

The slope \(2\) describes a two-unit increase in mean response for each one-mg increase in dosage within this model. It is a statement about the mean relationship at the study settings; the fixed design does not, by itself, say that these settings are a representative sample of dosage levels in a broader population.

Conditioning Connects the Formulations

A random-design study can be viewed in two stages: covariates are generated, then responses are generated according to their conditional law. Once the realized covariates are held fixed, the response model is a fixed-design model at those values. This connection concerns the conditional response law; it does not make the covariates nonrandom in the original sampling plan.

Result: Suppose the covariate vector \(X=(X_1,\ldots,X_n)\) and response vector \(Y=(Y_1,\ldots,Y_n)\) take values in standard Borel spaces, so a conditional distribution \(Q_x\) of \(Y\) given \(X=x\) exists. If the joint law is generated by first drawing \(X\) and then drawing \(Y\) from \(Q_X\), then the response distribution conditional on \(X=x\) is \(Q_x\). A fixed-design analysis at \(x\) uses this same response law.

To verify the statement, let \(A\) be a measurable set of response vectors and \(B\) a measurable set of covariate vectors. The joint sampling rule gives

$$ P(Y\in A,\ X\in B)=\int_B Q_x(A)\,P_X(dx), $$

where \(P_X\) is the distribution of \(X\). The defining property of the conditional distribution is therefore

$$ P(Y\in A\mid X)=Q_X(A)\quad\text{almost surely}. $$

At a realized design \(X=x\), the conditional response law is \(Q_x\), exactly the law used when the design is fixed at \(x\). The unconditional random-design law additionally averages over the distribution of \(X\). This result does not require the covariates to be independent or identically distributed; it only states the conditional-law relationship.

Worked Example: A Random Covariate, Then Conditioning

Let a single covariate \(X\) equal \(0\) or \(2\), each with probability \(1/2\). Given \(X=x\), suppose \(Y=4+3x+\varepsilon\), where \(E[\varepsilon\mid X=x]=0\). The possible conditional response means are \(4\) at \(x=0\) and \(10\) at \(x=2\).

Before observing \(X\), the covariate is random. The unconditional response mean is \(E[Y]=\tfrac12(4)+\tfrac12(10)=7\). After observing \(X=2\), the conditional response mean is \(E[Y\mid X=2]=10\). Conditioning has fixed the covariate at its realized value for the response calculation; it has not changed the original sampling plan.

The coefficient \(3\) is the slope of the conditional mean in both descriptions. But the unconditional mean \(7\) averages across the two covariate values, whereas the conditional mean \(10\) refers only to the value \(X=2\). These are different targets, even though they arise from the same model.

Least-Squares Slope Under Either Formulation

The connection is also visible in a familiar estimator. For covariate values \(z_1,\ldots,z_n\), define \(\bar z=n^{-1}\sum_i z_i\) and \(S_{zz}=\sum_i(z_i-\bar z)^2\). When \(S_{zz}>0\), the least-squares slope is

$$ \hat\beta_1=\frac{\sum_{i=1}^n(z_i-\bar z)Y_i}{S_{zz}}. $$

In fixed design, take \(z_i=x_i\), specified constants. In random design, take \(z_i=X_i\), and condition on the realized covariates. The same algebra gives the same conditional expectation result.

Theorem: In the fixed-design model \(Y_i=\beta_0+\beta_1x_i+\varepsilon_i\), if \(S_{xx}>0\) and \(E[\varepsilon_i]=0\) for each \(i\), then \(E[\hat\beta_1]=\beta_1\). In the random-design model, if \(P(S_{XX}>0)=1\) and \(E[\varepsilon_i\mid X]=0\) for each \(i\), then \(E[\hat\beta_1\mid X]=\beta_1\) almost surely.

For either formulation, write the slope numerator by substituting the model:

$$ \sum_i(z_i-\bar z)Y_i =\sum_i(z_i-\bar z)(\beta_0+\beta_1z_i+\varepsilon_i). $$

Because \(\sum_i(z_i-\bar z)=0\), the intercept term vanishes. Also, \(\sum_i(z_i-\bar z)z_i=\sum_i(z_i-\bar z)^2=S_{zz}\). Therefore

$$ \hat\beta_1 =\beta_1+\frac{\sum_i(z_i-\bar z)\varepsilon_i}{S_{zz}}. $$

For fixed design, \(z_i=x_i\) and \(S_{zz}=S_{xx}\) are constants, so taking expectations and using \(E[\varepsilon_i]=0\) gives \(E[\hat\beta_1]=\beta_1\). For random design, condition on \(X\). The covariates and \(S_{XX}\) are then fixed in the conditional calculation, and \(E[\varepsilon_i\mid X]=0\) gives \(E[\hat\beta_1\mid X]=\beta_1\). This proves both claims. \(\square\)

The result is conditional unbiasedness for the stated linear mean model, not a guarantee that every regression target is identical under every sampling plan. Nor does unbiasedness establish that the model is appropriate or that the observed covariate values cover the values of interest.

Worked Example: Checking the Slope Calculation

Consider a fixed design \(x=(0,1,3)\), with responses generated by \(Y_i=2+4x_i+\varepsilon_i\), where each error has mean zero. Here \(\bar x=(0+1+3)/3=4/3\), and

$$ S_{xx}=(0-4/3)^2+(1-4/3)^2+(3-4/3)^2 =\frac{16}{9}+\frac{1}{9}+\frac{25}{9} =\frac{14}{3}. $$

Using the error decomposition for the slope, \(\hat\beta_1=4+\sum_i(x_i-\bar x)\varepsilon_i/(14/3)\). Taking expectations gives \(E[\hat\beta_1]=4\), since the covariate deviations are constants and the errors have mean zero.

If instead these three covariate values were one realized random design, and the errors had conditional mean zero given the entire design, the same calculation would give \(E[\hat\beta_1\mid X=(0,1,3)]=4\). The conditional calculation matches; what differs is whether the design values are constants from the outset or a realization of a random covariate process.

Common Pitfall: Treating a Table as a Sampling Protocol

A common mistake is to look at a data table containing several covariate values and conclude that the covariates were random because they differ across rows. Variation across rows is not enough to establish randomness in the model. A study may deliberately select different settings, making the design fixed, or it may sample units whose covariates happen to differ, making the design random.

The reverse mistake is to treat observed covariates as fixed in every interpretation simply because their values are known after data collection. In a random-design model, realized values can be conditioned upon for a particular calculation, but the sampling distribution still includes their variation. A careful analysis states both the sampling protocol and whether a claim is conditional on the realized design or averages over possible designs.

Key takeaway: Fixed and random design can share the same conditional regression model. Fixed design holds the covariates at specified values; random design includes their sampling variation. The sampling plan determines whether conclusions concern chosen settings, conditional relationships, or averages weighted by sampled covariates.

Check Your Understanding

Answer each question by naming the quantities that are random and clarifying what is being conditioned upon.

  1. A laboratory specifies five temperature settings and measures an outcome at each one. Under a fixed-design formulation, which quantities vary across repetitions?
  2. In a random-design model, what does the conditional response law given \(X=x\) have in common with a fixed-design model at \(x\)?
  3. Suppose \(E[Y\mid X]=\beta_0+\beta_1X\). Explain why \(E[Y]\) and \(E[Y\mid X=x]\) need not be the same target.
  4. Why does observing different covariate values in a data table not, by itself, prove that the design was random?
  5. State the condition on the errors that permits the least-squares slope result in the random-design formulation.
Clinical Biostats