{
  "id": "main-effect",
  "title": "Main Effect",
  "lang": "en",
  "source_lang": "en",
  "summary": "A main effect describes a factor’s average association with an outcome across other factors’ levels, or its lower-order contribution in a statistical model.",
  "category": "mathematics",
  "subcategory": "probability-statistics",
  "type": "concept",
  "aliases": [],
  "generated_at": "2026-11-06",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/main-effect/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/main-effect/",
      "json": "https://aiwiki.page/zh/main-effect.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "In statistics, a main effect describes the contribution of one explanatory variable, or factor, to an outcome, considered separately from interactions with other variables. In a factorial design, it usually means a comparison of outcome means across that factor’s levels, averaging over the levels of the other factors. In a regression model, “main-effect term” also denotes a term involving a single predictor rather than a product of predictors. These meanings are closely related, but a main-effect coefficient is not always an average effect: its interpretation depends on the model, variable coding, and averaging weights."
    },
    {
      "heading": "Definition in factorial designs",
      "text": "A factorial design studies combinations of levels of two or more factors. For example, an experiment might compare two manufacturing methods at three temperatures. The main effect of manufacturing method compares the methods after averaging over temperature; the main effect of temperature compares temperatures after averaging over method.\n\nLet \\(A\\) have \\(a\\) levels and \\(B\\) have \\(b\\) levels, and define the cell mean\n\n\\[\\mu_{ij}=\\operatorname{E}(Y\\mid A=i,B=j),\\]\n\nwhere \\(\\operatorname{E}\\) denotes expected value. Under equal weighting of the levels, define\n\n\\[\\mu_{i\\cdot}=\\frac{1}{b}\\sum_{j=1}^{b}\\mu_{ij}, \\qquad \\mu_{\\cdot j}=\\frac{1}{a}\\sum_{i=1}^{a}\\mu_{ij},\\]\n\nand the grand mean\n\n\\[\\mu_{\\cdot\\cdot} =\\frac{1}{ab}\\sum_{i=1}^{a}\\sum_{j=1}^{b}\\mu_{ij}.\\]\n\nThe main-effect component for level \\(i\\) of \\(A\\) is\n\n\\[\\alpha_i=\\mu_{i\\cdot}-\\mu_{\\cdot\\cdot}.\\]\n\nThus, a factor with several levels generally has several main-effect components, subject to a constraint such as \\(\\sum_i\\alpha_i=0\\), rather than a single effect number. Its overall main effect concerns whether the marginal means differ.\n\nFor a factor with two levels, a common summary is the difference\n\n\\[\\Delta_A=\\mu_{2\\cdot}-\\mu_{1\\cdot}.\\]\n\nThe hypothesis of no main effect of \\(A\\) is\n\n\\[H_0:\\mu_{1\\cdot}=\\mu_{2\\cdot}=\\cdots=\\mu_{a\\cdot}.\\]\n\nThis is a statement about averages, not necessarily about the effect of \\(A\\) at every level of \\(B\\)."
    },
    {
      "heading": "Main effects, simple effects, and interactions",
      "text": "A simple effect compares levels of one factor at a particular level of another. For a two-level factor \\(A\\), its simple effect at \\(B=j\\) is\n\n\\[\\Delta_A(j)=\\mu_{2j}-\\mu_{1j}.\\]\n\nThe equally weighted main effect is the average of these simple effects:\n\n\\[\\Delta_A=\\frac{1}{b}\\sum_{j=1}^{b}\\Delta_A(j).\\]\n\nA statistical interaction occurs when the effect of one factor depends on the level of another. For two factors with two levels each, an additive-scale interaction can be expressed as a difference of differences:\n\n\\[I= (\\mu_{22}-\\mu_{12}) - (\\mu_{21}-\\mu_{11}).\\]\n\nConsider the following population means:\n\n | \\(B=1\\) | \\(B=2\\) | Equally weighted mean\n\\(A=1\\) | 10 | 20 | 15\n\\(A=2\\) | 20 | 10 | 15\n\nThe main effect of \\(A\\) is zero, but its simple effects are \\(10\\) at \\(B=1\\) and \\(-10\\) at \\(B=2\\). Averaging conceals a reversal.\n\nConsequently:\n\n- A zero main effect does not imply that a factor has no effect under any condition.\n- A nonzero main effect does not imply that its effect has the same magnitude or direction under all conditions.\n- Main effects and interactions can both be present.\n- An interaction does not make an average effect mathematically invalid, but it can make that average an incomplete description.\n\nThese distinctions are central to interpreting factorial experiments and interaction plots."
    },
    {
      "heading": "Representation in analysis of variance",
      "text": "A two-factor fixed-effects analysis of variance model with interaction is\n\n\\[Y_{ijk} = \\mu+\\alpha_i+\\beta_j+\\gamma_{ij}+\\varepsilon_{ijk},\\]\n\nwhere \\(k\\) indexes observations within a cell, \\(\\alpha_i\\) and \\(\\beta_j\\) are main-effect terms, \\(\\gamma_{ij}\\) is the interaction term, and \\(\\varepsilon_{ijk}\\) is an error term.\n\nA common parameterization imposes\n\n\\[\\sum_i\\alpha_i=0,\\qquad \\sum_j\\beta_j=0,\\]\n\ntogether with\n\n\\[\\sum_i\\gamma_{ij}=0\\quad\\text{for each }j, \\qquad \\sum_j\\gamma_{ij}=0\\quad\\text{for each }i.\\]\n\nUnder these constraints, the parameters correspond to the equally weighted marginal means defined above. The interaction captures departures of cell means from an additive representation.\n\nFor a balanced design with \\(n\\) independent observations in each cell, the sum of squares for factor \\(A\\) is\n\n\\[SS_A = bn\\sum_{i=1}^{a} \\left(\\bar{Y}_{i\\cdot\\cdot}-\\bar{Y}_{\\cdot\\cdot\\cdot}\\right)^2.\\]\n\nIts degrees of freedom are \\(a-1\\). Under the classical model with independent, normally distributed errors having a common variance, the hypothesis test uses\n\n\\[F_A=\\frac{SS_A/(a-1)}{MS_E},\\]\n\nwhere \\(MS_E\\) estimates the error variance. With replication in every cell and the full interaction model, the error degrees of freedom are \\(ab(n-1)\\).\n\nOther designs require different error structures or tests. Repeated measurements and clustered observations, for example, cannot generally be treated as independent replicates. In an unreplicated two-factor design, a full interaction model leaves no residual degrees of freedom for estimating error without additional assumptions."
    },
    {
      "heading": "Main-effect terms in regression",
      "text": "In linear regression, main-effect terms are terms involving individual predictors. Consider\n\n\\[\\operatorname{E}(Y\\mid X,Z) = \\beta_0+\\beta_X X+\\beta_Z Z+\\beta_{XZ}XZ.\\]\n\nHere, \\(\\beta_X X\\) and \\(\\beta_Z Z\\) are main-effect terms, while \\(\\beta_{XZ}XZ\\) is an interaction term. Nevertheless,\n\n\\[\\frac{\\partial\\operatorname{E}(Y\\mid X,Z)}{\\partial X} = \\beta_X+\\beta_{XZ}Z.\\]\n\nThus, \\(\\beta_X\\) is the slope of \\(X\\) when \\(Z=0\\), not automatically the slope averaged across \\(Z\\). For a binary \\(X\\) coded \\(0\\) and \\(1\\), the same expression gives the conditional mean difference.\n\nCoding determines the reference condition:\n\n- With reference-category coding, a lower-order coefficient typically describes a comparison at the reference levels of interacting categorical predictors.\n- With suitable sum-to-zero coding in a complete factorial model, lower-order terms can correspond to equally weighted marginal comparisons.\n- Centering a continuous interacting variable changes the condition represented by zero and therefore changes the interpretation of the lower-order coefficient.\n\nFor example, defining \\(Z_c=Z-c\\) changes the coefficient of \\(X\\) to\n\n\\[\\beta_X+\\beta_{XZ}c.\\]\n\nThe fitted response surface is unchanged; only its parameterization changes. This is why the presence of an interaction makes an isolated “main-effect coefficient” uninterpretable without information about coding and reference values."
    },
    {
      "heading": "Weighting and unbalanced data",
      "text": "In balanced experiments, observed marginal means and equally weighted averages of cell means coincide. With unequal cell sizes, they need not.\n\nA general marginal comparison can be defined using common weights \\(w_j\\):\n\n\\[\\Delta_A(w) = \\sum_{j=1}^{b}w_j(\\mu_{2j}-\\mu_{1j}), \\qquad w_j\\geq 0,\\quad \\sum_jw_j=1.\\]\n\nEqual weights describe a hypothetical population with equally represented levels of \\(B\\). Population-frequency weights describe a specified target population. These are different quantities when the simple effects vary across \\(B\\).\n\nRaw group means can introduce a further complication. If the distribution of \\(B\\) differs between the levels of \\(A\\), the raw comparison uses different weights in the two groups. It may therefore reflect both within-level differences and differences in group composition. Depending on the setting, confounding or selection processes may explain part of the observed association.\n\nModel-based adjusted means, often called estimated marginal means, specify a reference grid and averaging rule. They are not automatically identical to raw sample means.\n\nIn unbalanced analysis of variance, different sums-of-squares conventions can test different hypotheses. Sequential, or Type I, sums of squares can depend on term order; Type II and Type III procedures use different adjustment rules. None substitutes for specifying the intended marginal comparison, particularly when interactions or empty cells are present."
    },
    {
      "heading": "Scale and nonlinear models",
      "text": "Main effects and interactions depend on the scale of the outcome or model. Additivity on one scale does not imply additivity on another.\n\nFor example, logistic regression may specify\n\n\\[\\operatorname{logit}\\Pr(Y=1\\mid X,Z) = \\beta_0+\\beta_X X+\\beta_Z Z.\\]\n\nThere is no interaction term on the log-odds scale. Nevertheless, the probability difference associated with changing \\(X\\) generally varies with \\(Z\\), because the inverse-logit function is nonlinear. For binary \\(X\\), \\(\\exp(\\beta_X)\\) is a common conditional odds ratio, not a common probability difference.\n\nInterpretation therefore distinguishes among a model coefficient, a conditional outcome contrast, and a contrast averaged over a specified population. In generalized linear models, these quantities need not coincide."
    },
    {
      "heading": "Interpretation and limitations",
      "text": "Main effects are used in experimental design, behavioral research, industrial experiments, and regression analysis to describe factor contributions and test planned comparisons. Their interpretation depends on several distinctions.\n\nAssociation and causation. A main effect is not inherently causal. A causal interpretation requires a design or assumptions that identify the relevant intervention contrast. Randomization can support such an interpretation in factorial experiments; observational associations require additional causal inference assumptions.\n\nStatistical evidence and magnitude. A p-value for an overall main effect does not describe its practical size. Mean differences, other effect sizes, and confidence intervals convey different information. For a multilevel factor, an overall test also does not identify which levels differ.\n\nAveraging and heterogeneity. The same average can result from uniform effects, effects concentrated in a few conditions, or opposing effects that partially cancel. Main effects therefore answer a different question from simple effects and interactions.\n\nModel specification. An additive model may provide a useful approximation, but excluding interactions imposes a restriction on how factor effects vary. A main effect estimated under that restriction should not be confused with evidence that the restriction is correct."
    }
  ],
  "links": [
    "statistics",
    "factorial-design",
    "expected-value",
    "statistical-interaction",
    "analysis-of-variance",
    "degrees-of-freedom",
    "variance",
    "statistical-hypothesis-testing",
    "linear-regression",
    "confounding",
    "logistic-regression",
    "odds-ratio",
    "generalized-linear-model",
    "experimental-design",
    "randomization",
    "causal-inference",
    "p-value",
    "effect-size",
    "confidence-interval"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}