{"accepted_status": [true, false], "candidate_answers": [{"answer_html": "

The scale parameter is routinely analysed in survival models, because the scale parameter is a location parameter for $\\log T$. Accelerated-failure models are of the form\n$$\\log T_i=x_t\\beta+\\log T_{0i}$$\nwhere $T_{0i}$ is a Weibull with some fixed scale and shape parameters.

\n

Similar models are used for other models with scale parameters, such as the log-Normal and Gamma.

\n

I don't know of a use for regression on the shape parameter, but I could certainly see someone being interested in testing whether $\\gamma-1$ is zero vs positive or negative as @Glen_b suggests.

\n", "answer_id": 676856, "answer_text": "The scale parameter is routinely analysed in survival models, because the scale parameter is a location parameter for $\\log T$. Accelerated-failure models are of the form\n$$\\log T_i=x_t\\beta+\\log T_{0i}$$\nwhere $T_{0i}$ is a Weibull with some fixed scale and shape parameters.\n\n\n\n\nSimilar models are used for other models with scale parameters, such as the log-Normal and Gamma.\n\n\n\n\nI don't know of a use for regression on the shape parameter, but I could certainly see someone being interested in testing whether $\\gamma-1$ is zero vs positive or negative as @Glen_b suggests.", "answer_url": "https://stats.stackexchange.com/a/676856", "author": "Thomas Lumley", "author_url": "https://stats.stackexchange.com/users/249135/thomas-lumley", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-08-13T06:33:27+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 676855, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Thomas Lumley", "profile_url": "https://stats.stackexchange.com/users/249135/thomas-lumley", "user_type": "registered"}, "created_at": "2026-08-13T06:33:27+00:00", "raw_file": "raw/codex_api_v1/4f74c7234d8d68222a97a637c85bc14d5aa045a3d3f336d95a6178b29bc656cd_1790825248437413600_0.json", "raw_sha256": "8385102f4bd0517d9240ab820144fa12ccb111d0c4dd000e66bdc0e0ba0294fe", "revision_guid": "AB5891E4-C878-4F21-8C87-14A3C04B1146", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/AB5891E4-C878-4F21-8C87-14A3C04B1146/view-source"}], "score": 8, "updated_at": "2026-08-13T06:33:27+00:00"}, {"answer_html": "

To see more about the basis for Thomas Lumley's answer, look at these course notes by Germán Rodríguez. They start with the general form for accelerated-failure-time (AFT) models* in Prof. Lumley's answer, and show how that form can be used to understand how covariates enter into several families of survival models.

\n

In general, for an AFT model with no covariates, survival time $T$ can be modeled as:

\n

$$ \\log T \\sim \\alpha + \\sigma W,$$

\n

where $W$ is some standard probability distribution, $\\alpha$ is typically called the location parameter, and $\\sigma$ the scale parameter.

\n

For a Weibull model, $W$ is a standard minimum extreme value distribution. That leaves the question of how your Weibull "shape/scale" parameters correspond to $\\alpha$ and $\\sigma$.

\n

I still get confused by the multiple parameterizations of the Weibull distribution. Yours is the first optional parameterization in Wikipedia. The Rodríguez notes linked above use a form similar to Wikipedia's "Standard parameterization," but with a "$\\lambda$" the inverse of Wikipedia's choice of "scale parameter" $\\lambda$. The "$\\lambda$" in your parameterization would be $\\lambda^{-k}$ in the Wikipedia standard paramterization (where the shape parameter $k$ corresponds to your $\\gamma$).

\n

Even in R, the rweibull() function uses Wikipedia's standard parameterization while the survreg() function uses the form shown for the general AFT model above, based on $W$ distributed as minimum extreme value with a completely different use of the word "scale." The survreg() help page explains:

\n
\n

There are multiple ways to parameterize a Weibull distribution. The survreg function embeds it in a general location-scale family, which is a different parameterization than the rweibull function, and often leads to confusion.

\n

survreg's scale [$\\sigma$ in general AFT form above] = 1/(rweibull shape)

\n

survreg's intercept [$\\alpha$ in general AFT form] = log(rweibull scale).

\n
\n

In the above general AFT form without covariates in the Wikipedia/rweibull() standard parameterization of the "scale parameter" $\\lambda$, $\\alpha = \\log \\lambda$. As noted above, that's different from your "scale parameter" $\\lambda$.

\n

In the general AFT form above, covariates $x$ for regression with coefficients $\\beta$ (including an intercept) are incorporated as:

\n

$$ \\log T \\sim x'\\beta + \\sigma W$$

\n

with the intercept $\\beta_0$ representing the distribution of survival times when covariates are at their baseline values.

\n

As Prof. Lumley said, it's hard to think of a situation where you would model $\\sigma$ (inverse of Weibull shape) as a function of covariates, but it's possible for example with the R flexsurv package.

\n

To summarize:

\n

There can be interest in whether (and in what direction) the Weibull shape parameter differs "significantly" from 1 (log scale different from 0), but it's not typically modeled as a function of covariates.

\n

The different uses of "scale parameter" for Weibull make it impossible to make general statements about its "significance." As it's necessarily positive you'd might be interested in whether log(scale) (other than in the survreg() meaning) differs from 0, but what that means would differ among parameterizations.

\n

What does matter is whether covariates "significantly" affect the distribution of survival times, which typically are modeled as shown above. You can think about those as covariate-associated changes in the "scale" (in your or the Wikipedia standard parameterization).

\n
\n

*Unlike other distributions, Weibull can be modeled either as PH or AFT.

\n", "answer_id": 676861, "answer_text": "To see more about the basis for Thomas Lumley's answer, look at these course notes (https://grodri.github.io/survival/ParametricSurvival.pdf) by Germán Rodríguez. They start with the general form for accelerated-failure-time (AFT) models* in Prof. Lumley's answer, and show how that form can be used to understand how covariates enter into several families of survival models.\n\n\n\n\nIn general, for an AFT model with no covariates, survival time $T$ can be modeled as:\n\n\n\n\n$$ \\log T \\sim \\alpha + \\sigma W,$$\n\n\n\n\nwhere $W$ is some standard probability distribution, $\\alpha$ is typically called the location parameter, and $\\sigma$ the scale parameter.\n\n\n\n\nFor a Weibull model, $W$ is a standard minimum extreme value distribution. That leaves the question of how your Weibull \"shape/scale\" parameters correspond to $\\alpha$ and $\\sigma$.\n\n\n\n\nI still get confused by the multiple parameterizations of the Weibull distribution (https://stats.stackexchange.com/a/468333/28500). Yours is the first optional parameterization (https://en.wikipedia.org/wiki/Weibull_distribution#First_option) in Wikipedia. The Rodríguez notes linked above use a form similar to Wikipedia's \"Standard parameterization,\" (https://en.wikipedia.org/wiki/Weibull_distribution#Standard_parameterization) but with a \"$\\lambda$\" the inverse of Wikipedia's choice of \"scale parameter\" $\\lambda$. The \"$\\lambda$\" in your parameterization would be $\\lambda^{-k}$ in the Wikipedia standard paramterization (where the shape parameter $k$ corresponds to your $\\gamma$).\n\n\n\n\nEven in R, the rweibull() function uses Wikipedia's standard parameterization while the survreg() function uses the form shown for the general AFT model above, based on $W$ distributed as minimum extreme value with a completely different use of the word \"scale.\" The survreg() help page explains:\n\n\n\n\n\n\n\nThere are multiple ways to parameterize a Weibull distribution. The survreg function embeds it in a general location-scale family, which is a different parameterization than the rweibull function, and often leads to confusion.\n\n\n\n\nsurvreg's scale [$\\sigma$ in general AFT form above] = 1/(rweibull shape)\n\n\n\n\nsurvreg's intercept [$\\alpha$ in general AFT form] = log(rweibull scale).\n\n\n\n\n\n\n\nIn the above general AFT form without covariates in the Wikipedia/rweibull() standard parameterization of the \"scale parameter\" $\\lambda$, $\\alpha = \\log \\lambda$. As noted above, that's different from your \"scale parameter\" $\\lambda$.\n\n\n\n\nIn the general AFT form above, covariates $x$ for regression with coefficients $\\beta$ (including an intercept) are incorporated as:\n\n\n\n\n$$ \\log T \\sim x'\\beta + \\sigma W$$\n\n\n\n\nwith the intercept $\\beta_0$ representing the distribution of survival times when covariates are at their baseline values.\n\n\n\n\nAs Prof. Lumley said, it's hard to think of a situation where you would model $\\sigma$ (inverse of Weibull shape) as a function of covariates, but it's possible for example with the R flexsurv package (https://cran.r-project.org/package=flexsurv).\n\n\n\n\nTo summarize:\n\n\n\n\nThere can be interest in whether (and in what direction) the Weibull shape parameter differs \"significantly\" from 1 (log scale different from 0), but it's not typically modeled as a function of covariates.\n\n\n\n\nThe different uses of \"scale parameter\" for Weibull make it impossible to make general statements about its \"significance.\" As it's necessarily positive you'd might be interested in whether log(scale) (other than in the survreg() meaning) differs from 0, but what that means would differ among parameterizations.\n\n\n\n\nWhat does matter is whether covariates \"significantly\" affect the distribution of survival times, which typically are modeled as shown above. You can think about those as covariate-associated changes in the \"scale\" (in your or the Wikipedia standard parameterization).\n\n\n\n\n\n\n\n*Unlike other distributions, Weibull can be modeled either as PH or AFT.", "answer_url": "https://stats.stackexchange.com/a/676861", "author": "EdM", "author_url": "https://stats.stackexchange.com/users/28500/edm", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-08-13T20:23:55+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 676855, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "EdM", "profile_url": "https://stats.stackexchange.com/users/28500/edm", "user_type": "registered"}, "created_at": "2026-08-13T20:23:55+00:00", "raw_file": "raw/codex_api_v1/01ff643b5e725b2402c38de261074c3bef3326820f24db4342e17e318353268e_1790825246205492400_0.json", "raw_sha256": "a0521ae83c8630be00a12499e9aaa253069e57a5e0ff902fea3e9b8e7acb810f", "revision_guid": "14C5622E-FF4B-4355-AE84-6E6E7028D63D", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/14C5622E-FF4B-4355-AE84-6E6E7028D63D/view-source"}], "score": 4, "updated_at": "2026-08-13T20:23:55+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "Here is a Weibull proportional hazards model:\n\n\n\n\n$$h(t \\mid \\mathbf{x}) = h_0(t)\\,\\exp(\\boldsymbol{\\beta}^\\top \\mathbf{x}) = \\gamma \\lambda\\, t^{\\gamma - 1} \\exp(\\boldsymbol{\\beta}^\\top \\mathbf{x})$$\n\n\n\n\nIs statistical inference ever performed on the shape and scale parameters ($\\gamma, \\lambda $)? For example, do researchers ever comment on whether the estimates of the shape and scale parameters are statistically significant? Or what about determining the influence an extra unit change in shape or scale would have on hazard and survival rates (marginal effects)?", "record_id": "Scientific-Answer-Ranking:stats:676855", "scores": [8, 4], "split": "train", "thread": {"accepted_answer_id": 676856, "answers": [{"answer_html": "

The scale parameter is routinely analysed in survival models, because the scale parameter is a location parameter for $\\log T$. Accelerated-failure models are of the form\n$$\\log T_i=x_t\\beta+\\log T_{0i}$$\nwhere $T_{0i}$ is a Weibull with some fixed scale and shape parameters.

\n

Similar models are used for other models with scale parameters, such as the log-Normal and Gamma.

\n

I don't know of a use for regression on the shape parameter, but I could certainly see someone being interested in testing whether $\\gamma-1$ is zero vs positive or negative as @Glen_b suggests.

\n", "answer_id": 676856, "answer_text": "The scale parameter is routinely analysed in survival models, because the scale parameter is a location parameter for $\\log T$. Accelerated-failure models are of the form\n$$\\log T_i=x_t\\beta+\\log T_{0i}$$\nwhere $T_{0i}$ is a Weibull with some fixed scale and shape parameters.\n\n\n\n\nSimilar models are used for other models with scale parameters, such as the log-Normal and Gamma.\n\n\n\n\nI don't know of a use for regression on the shape parameter, but I could certainly see someone being interested in testing whether $\\gamma-1$ is zero vs positive or negative as @Glen_b suggests.", "answer_url": "https://stats.stackexchange.com/a/676856", "author": "Thomas Lumley", "author_url": "https://stats.stackexchange.com/users/249135/thomas-lumley", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-08-13T06:33:27+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 676855, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Thomas Lumley", "profile_url": "https://stats.stackexchange.com/users/249135/thomas-lumley", "user_type": "registered"}, "created_at": "2026-08-13T06:33:27+00:00", "raw_file": "raw/codex_api_v1/4f74c7234d8d68222a97a637c85bc14d5aa045a3d3f336d95a6178b29bc656cd_1790825248437413600_0.json", "raw_sha256": "8385102f4bd0517d9240ab820144fa12ccb111d0c4dd000e66bdc0e0ba0294fe", "revision_guid": "AB5891E4-C878-4F21-8C87-14A3C04B1146", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/AB5891E4-C878-4F21-8C87-14A3C04B1146/view-source"}], "score": 8, "updated_at": "2026-08-13T06:33:27+00:00"}, {"answer_html": "

To see more about the basis for Thomas Lumley's answer, look at these course notes by Germán Rodríguez. They start with the general form for accelerated-failure-time (AFT) models* in Prof. Lumley's answer, and show how that form can be used to understand how covariates enter into several families of survival models.

\n

In general, for an AFT model with no covariates, survival time $T$ can be modeled as:

\n

$$ \\log T \\sim \\alpha + \\sigma W,$$

\n

where $W$ is some standard probability distribution, $\\alpha$ is typically called the location parameter, and $\\sigma$ the scale parameter.

\n

For a Weibull model, $W$ is a standard minimum extreme value distribution. That leaves the question of how your Weibull "shape/scale" parameters correspond to $\\alpha$ and $\\sigma$.

\n

I still get confused by the multiple parameterizations of the Weibull distribution. Yours is the first optional parameterization in Wikipedia. The Rodríguez notes linked above use a form similar to Wikipedia's "Standard parameterization," but with a "$\\lambda$" the inverse of Wikipedia's choice of "scale parameter" $\\lambda$. The "$\\lambda$" in your parameterization would be $\\lambda^{-k}$ in the Wikipedia standard paramterization (where the shape parameter $k$ corresponds to your $\\gamma$).

\n

Even in R, the rweibull() function uses Wikipedia's standard parameterization while the survreg() function uses the form shown for the general AFT model above, based on $W$ distributed as minimum extreme value with a completely different use of the word "scale." The survreg() help page explains:

\n
\n

There are multiple ways to parameterize a Weibull distribution. The survreg function embeds it in a general location-scale family, which is a different parameterization than the rweibull function, and often leads to confusion.

\n

survreg's scale [$\\sigma$ in general AFT form above] = 1/(rweibull shape)

\n

survreg's intercept [$\\alpha$ in general AFT form] = log(rweibull scale).

\n
\n

In the above general AFT form without covariates in the Wikipedia/rweibull() standard parameterization of the "scale parameter" $\\lambda$, $\\alpha = \\log \\lambda$. As noted above, that's different from your "scale parameter" $\\lambda$.

\n

In the general AFT form above, covariates $x$ for regression with coefficients $\\beta$ (including an intercept) are incorporated as:

\n

$$ \\log T \\sim x'\\beta + \\sigma W$$

\n

with the intercept $\\beta_0$ representing the distribution of survival times when covariates are at their baseline values.

\n

As Prof. Lumley said, it's hard to think of a situation where you would model $\\sigma$ (inverse of Weibull shape) as a function of covariates, but it's possible for example with the R flexsurv package.

\n

To summarize:

\n

There can be interest in whether (and in what direction) the Weibull shape parameter differs "significantly" from 1 (log scale different from 0), but it's not typically modeled as a function of covariates.

\n

The different uses of "scale parameter" for Weibull make it impossible to make general statements about its "significance." As it's necessarily positive you'd might be interested in whether log(scale) (other than in the survreg() meaning) differs from 0, but what that means would differ among parameterizations.

\n

What does matter is whether covariates "significantly" affect the distribution of survival times, which typically are modeled as shown above. You can think about those as covariate-associated changes in the "scale" (in your or the Wikipedia standard parameterization).

\n
\n

*Unlike other distributions, Weibull can be modeled either as PH or AFT.

\n", "answer_id": 676861, "answer_text": "To see more about the basis for Thomas Lumley's answer, look at these course notes (https://grodri.github.io/survival/ParametricSurvival.pdf) by Germán Rodríguez. They start with the general form for accelerated-failure-time (AFT) models* in Prof. Lumley's answer, and show how that form can be used to understand how covariates enter into several families of survival models.\n\n\n\n\nIn general, for an AFT model with no covariates, survival time $T$ can be modeled as:\n\n\n\n\n$$ \\log T \\sim \\alpha + \\sigma W,$$\n\n\n\n\nwhere $W$ is some standard probability distribution, $\\alpha$ is typically called the location parameter, and $\\sigma$ the scale parameter.\n\n\n\n\nFor a Weibull model, $W$ is a standard minimum extreme value distribution. That leaves the question of how your Weibull \"shape/scale\" parameters correspond to $\\alpha$ and $\\sigma$.\n\n\n\n\nI still get confused by the multiple parameterizations of the Weibull distribution (https://stats.stackexchange.com/a/468333/28500). Yours is the first optional parameterization (https://en.wikipedia.org/wiki/Weibull_distribution#First_option) in Wikipedia. The Rodríguez notes linked above use a form similar to Wikipedia's \"Standard parameterization,\" (https://en.wikipedia.org/wiki/Weibull_distribution#Standard_parameterization) but with a \"$\\lambda$\" the inverse of Wikipedia's choice of \"scale parameter\" $\\lambda$. The \"$\\lambda$\" in your parameterization would be $\\lambda^{-k}$ in the Wikipedia standard paramterization (where the shape parameter $k$ corresponds to your $\\gamma$).\n\n\n\n\nEven in R, the rweibull() function uses Wikipedia's standard parameterization while the survreg() function uses the form shown for the general AFT model above, based on $W$ distributed as minimum extreme value with a completely different use of the word \"scale.\" The survreg() help page explains:\n\n\n\n\n\n\n\nThere are multiple ways to parameterize a Weibull distribution. The survreg function embeds it in a general location-scale family, which is a different parameterization than the rweibull function, and often leads to confusion.\n\n\n\n\nsurvreg's scale [$\\sigma$ in general AFT form above] = 1/(rweibull shape)\n\n\n\n\nsurvreg's intercept [$\\alpha$ in general AFT form] = log(rweibull scale).\n\n\n\n\n\n\n\nIn the above general AFT form without covariates in the Wikipedia/rweibull() standard parameterization of the \"scale parameter\" $\\lambda$, $\\alpha = \\log \\lambda$. As noted above, that's different from your \"scale parameter\" $\\lambda$.\n\n\n\n\nIn the general AFT form above, covariates $x$ for regression with coefficients $\\beta$ (including an intercept) are incorporated as:\n\n\n\n\n$$ \\log T \\sim x'\\beta + \\sigma W$$\n\n\n\n\nwith the intercept $\\beta_0$ representing the distribution of survival times when covariates are at their baseline values.\n\n\n\n\nAs Prof. Lumley said, it's hard to think of a situation where you would model $\\sigma$ (inverse of Weibull shape) as a function of covariates, but it's possible for example with the R flexsurv package (https://cran.r-project.org/package=flexsurv).\n\n\n\n\nTo summarize:\n\n\n\n\nThere can be interest in whether (and in what direction) the Weibull shape parameter differs \"significantly\" from 1 (log scale different from 0), but it's not typically modeled as a function of covariates.\n\n\n\n\nThe different uses of \"scale parameter\" for Weibull make it impossible to make general statements about its \"significance.\" As it's necessarily positive you'd might be interested in whether log(scale) (other than in the survreg() meaning) differs from 0, but what that means would differ among parameterizations.\n\n\n\n\nWhat does matter is whether covariates \"significantly\" affect the distribution of survival times, which typically are modeled as shown above. You can think about those as covariate-associated changes in the \"scale\" (in your or the Wikipedia standard parameterization).\n\n\n\n\n\n\n\n*Unlike other distributions, Weibull can be modeled either as PH or AFT.", "answer_url": "https://stats.stackexchange.com/a/676861", "author": "EdM", "author_url": "https://stats.stackexchange.com/users/28500/edm", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-08-13T20:23:55+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 676855, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "EdM", "profile_url": "https://stats.stackexchange.com/users/28500/edm", "user_type": "registered"}, "created_at": "2026-08-13T20:23:55+00:00", "raw_file": "raw/codex_api_v1/01ff643b5e725b2402c38de261074c3bef3326820f24db4342e17e318353268e_1790825246205492400_0.json", "raw_sha256": "a0521ae83c8630be00a12499e9aaa253069e57a5e0ff902fea3e9b8e7acb810f", "revision_guid": "14C5622E-FF4B-4355-AE84-6E6E7028D63D", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/14C5622E-FF4B-4355-AE84-6E6E7028D63D/view-source"}], "score": 4, "updated_at": "2026-08-13T20:23:55+00:00"}], "domain": "statistics", "external_links": ["https://cran.r-project.org/package=flexsurv", "https://en.wikipedia.org/wiki/Weibull_distribution#First_option", "https://en.wikipedia.org/wiki/Weibull_distribution#Standard_parameterization", "https://grodri.github.io/survival/ParametricSurvival.pdf"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:03.428408+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/774052c18cd9e8fa951e893347bfa3c1a85e743fc46ec4667572002cadb10cbf_1790825224163423600_0.json", "raw_sha256": "fe4dd06d3de6c0b1bb33ba88aee0ed4284118e01f76a58dcdce220a4946329b2", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "adamkostanov", "question_author_url": "https://stats.stackexchange.com/users/512554/adamkostanov", "question_author_user_type": "registered", "question_created_at": "2026-08-13T02:10:03+00:00", "question_html": "

Here is a Weibull proportional hazards model:

\n

$$h(t \\mid \\mathbf{x}) = h_0(t)\\,\\exp(\\boldsymbol{\\beta}^\\top \\mathbf{x}) = \\gamma \\lambda\\, t^{\\gamma - 1} \\exp(\\boldsymbol{\\beta}^\\top \\mathbf{x})$$

\n

Is statistical inference ever performed on the shape and scale parameters ($\\gamma, \\lambda $)? For example, do researchers ever comment on whether the estimates of the shape and scale parameters are statistically significant? Or what about determining the influence an extra unit change in shape or scale would have on hazard and survival rates (marginal effects)?

\n", "question_id": 676855, "question_license": "CC BY-SA 4.0", "question_score": 6, "question_text": "Here is a Weibull proportional hazards model:\n\n\n\n\n$$h(t \\mid \\mathbf{x}) = h_0(t)\\,\\exp(\\boldsymbol{\\beta}^\\top \\mathbf{x}) = \\gamma \\lambda\\, t^{\\gamma - 1} \\exp(\\boldsymbol{\\beta}^\\top \\mathbf{x})$$\n\n\n\n\nIs statistical inference ever performed on the shape and scale parameters ($\\gamma, \\lambda $)? For example, do researchers ever comment on whether the estimates of the shape and scale parameters are statistically significant? Or what about determining the influence an extra unit change in shape or scale would have on hazard and survival rates (marginal effects)?", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "adamkostanov", "profile_url": "https://stats.stackexchange.com/users/512554/adamkostanov", "user_type": "registered"}, "created_at": "2026-08-13T02:10:03+00:00", "raw_file": "raw/codex_api_v1/4f74c7234d8d68222a97a637c85bc14d5aa045a3d3f336d95a6178b29bc656cd_1790825248437413600_0.json", "raw_sha256": "8385102f4bd0517d9240ab820144fa12ccb111d0c4dd000e66bdc0e0ba0294fe", "revision_guid": "B7D363AF-1F5D-4946-9B8F-2F6F418F7AA6", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/B7D363AF-1F5D-4946-9B8F-2F6F418F7AA6/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "EdM", "profile_url": "https://stats.stackexchange.com/users/28500/edm", "user_type": "registered"}, "created_at": "2026-08-13T15:19:35+00:00", "raw_file": "raw/codex_api_v1/01ff643b5e725b2402c38de261074c3bef3326820f24db4342e17e318353268e_1790825246205492400_0.json", "raw_sha256": "a0521ae83c8630be00a12499e9aaa253069e57a5e0ff902fea3e9b8e7acb810f", "revision_guid": "8DA1C57F-6FD3-463B-A666-4671DB101E02", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/8DA1C57F-6FD3-463B-A666-4671DB101E02/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-08-13T20:38:59+00:00", "raw_file": "raw/codex_api_v1/01ff643b5e725b2402c38de261074c3bef3326820f24db4342e17e318353268e_1790825246205492400_0.json", "raw_sha256": "a0521ae83c8630be00a12499e9aaa253069e57a5e0ff902fea3e9b8e7acb810f", "revision_guid": "207032C0-C318-48F8-8F5C-54C79997A86B", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/207032C0-C318-48F8-8F5C-54C79997A86B/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ben Bolker", "profile_url": "https://stats.stackexchange.com/users/2126/ben-bolker", "user_type": "registered"}, "created_at": "2026-08-13T23:37:00+00:00", "raw_file": "raw/codex_api_v1/01ff643b5e725b2402c38de261074c3bef3326820f24db4342e17e318353268e_1790825246205492400_0.json", "raw_sha256": "a0521ae83c8630be00a12499e9aaa253069e57a5e0ff902fea3e9b8e7acb810f", "revision_guid": "EF625F54-00CC-4666-AC48-280CD2EF0ACE", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/EF625F54-00CC-4666-AC48-280CD2EF0ACE/view-source"}], "source_site": "stats", "source_url": "https://stats.stackexchange.com/questions/676855/do-the-shape-and-scale-parameters-have-statistical-interpretations", "split": "train", "split_group": "b21f26372276ef4da66c7b0ef2298fec9eb6475ec2b2c00bd011c6fac4d4b742", "tags": ["survival", "maximum-likelihood"], "thread_id": "stats:676855", "title": "Do the shape and scale parameters have statistical interpretations?"}} {"accepted_status": [false, false, false], "candidate_answers": [{"answer_html": "
\n

but that control has already been shown to have reduced growth compared to another genotype where that process is disrupted

\n
\n

A control can have a different baseline than the treated group. But you need to move from t-tests to regressions, eg ANCOVA. A common strategy within the world of “regression adjustments” is CUPED; you simply condition on the variable in the pre-experiment period, regardless of whether the unit is treated. Then the effect that you detect is a change relative to the baseline attributable to treatment exposure.

\n
\n

Due to time constraints and the fact that, at the time, they didn't know if this was going anywhere, these three experiments all compare to the same control.

\n
\n

This isn’t necessarily a problem if all the experiments occurred at the same time. If however the control occurred at time t as then experiment one in t+1, experiment 2 in t+2, etc. That might be the bigger red flag, especially if you’re worried about growth rates.

\n

Assuming all observed at the same time and that treatment is the same “knocking out a specific gene” then you can lump all of these experiments together in one. You may want to explore fixed effects where you effectively have one intercept per for each experimental subgroup - the baseline behavior expected for each subgroup. (This may sound like CUPED as I described earlier but they’re mechanically different.) But there shouldn’t be any correlation between experimental sub-group and treatment exposure.

\n", "answer_id": 676923, "answer_text": "but that control has already been shown to have reduced growth compared to another genotype where that process is disrupted\n\n\n\n\n\n\n\nA control can have a different baseline than the treated group. But you need to move from t-tests to regressions, eg ANCOVA. A common strategy within the world of “regression adjustments” is CUPED; you simply condition on the variable in the pre-experiment period, regardless of whether the unit is treated. Then the effect that you detect is a change relative to the baseline attributable to treatment exposure.\n\n\n\n\n\n\n\nDue to time constraints and the fact that, at the time, they didn't know if this was going anywhere, these three experiments all compare to the same control.\n\n\n\n\n\n\n\nThis isn’t necessarily a problem if all the experiments occurred at the same time. If however the control occurred at time t as then experiment one in t+1, experiment 2 in t+2, etc. That might be the bigger red flag, especially if you’re worried about growth rates.\n\n\n\n\nAssuming all observed at the same time and that treatment is the same “knocking out a specific gene” then you can lump all of these experiments together in one. You may want to explore fixed effects where you effectively have one intercept per for each experimental subgroup - the baseline behavior expected for each subgroup. (This may sound like CUPED as I described earlier but they’re mechanically different.) But there shouldn’t be any correlation between experimental sub-group and treatment exposure.", "answer_url": "https://stats.stackexchange.com/a/676923", "author": "jbuddy_13", "author_url": "https://stats.stackexchange.com/users/288172/jbuddy-13", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-08-20T14:16:06+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 676922, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jbuddy_13", "profile_url": "https://stats.stackexchange.com/users/288172/jbuddy-13", "user_type": "registered"}, "created_at": "2026-08-20T14:16:06+00:00", "raw_file": "raw/codex_api_v1/01ff643b5e725b2402c38de261074c3bef3326820f24db4342e17e318353268e_1790825246205492400_0.json", "raw_sha256": "a0521ae83c8630be00a12499e9aaa253069e57a5e0ff902fea3e9b8e7acb810f", "revision_guid": "51E42C8E-9699-4236-80F4-F62842373312", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/51E42C8E-9699-4236-80F4-F62842373312/view-source"}], "score": 0, "updated_at": "2026-08-20T14:16:06+00:00"}, {"answer_html": "

Your scenario perfectly matches an ANOVA scenario; means are compared accross multiple groups, including a control. I see nothing alarming there. Yes, you would need a multiple comparison correction (MCC) (Dunnett is indeed a good choice).
\nNow the question is, how many groups would you include in the ANOVA? It should be for all genes which were tested (not just the "significant" ones e.g.).
\nNow, could you just have gotten a very "lucky" control group? Possibly... But you say that, at least in some experiments, the results were not significant; so compare the non-significant means to the control; what is (are?) the p-value(s?)? If it is e.g. .6, then the control does not seem that extreme; if it is .06, then it may be...
\nHow difficult/time consuming is it to test a new control group? If not too bad, do it and see how it compares to the "original" control group.
\nYou also mention "technical variations in the second two experiments". That would be much more concerning. But of course if would depend on the specifics. Are you just saying this more or less out of principle, or do you have concrete details about divergences of the experimental protocols?
\nAnd note that it is quite common to be able to test only one group at a time (e.g. there is only one set of the required equipment).
\nSo, w/o more details, I do not see a cause for great alarm, if the proper test is used, with the proper MCC.

\n", "answer_id": 676925, "answer_text": "Your scenario perfectly matches an ANOVA scenario; means are compared accross multiple groups, including a control. I see nothing alarming there. Yes, you would need a multiple comparison correction (MCC) (Dunnett is indeed a good choice).\n\nNow the question is, how many groups would you include in the ANOVA? It should be for all genes which were tested (not just the \"significant\" ones e.g.).\n\nNow, could you just have gotten a very \"lucky\" control group? Possibly... But you say that, at least in some experiments, the results were not significant; so compare the non-significant means to the control; what is (are?) the p-value(s?)? If it is e.g. .6, then the control does not seem that extreme; if it is .06, then it may be...\n\nHow difficult/time consuming is it to test a new control group? If not too bad, do it and see how it compares to the \"original\" control group.\n\nYou also mention \"technical variations in the second two experiments\". That would be much more concerning. But of course if would depend on the specifics. Are you just saying this more or less out of principle, or do you have concrete details about divergences of the experimental protocols?\n\nAnd note that it is quite common to be able to test only one group at a time (e.g. there is only one set of the required equipment).\n\nSo, w/o more details, I do not see a cause for great alarm, if the proper test is used, with the proper MCC.", "answer_url": "https://stats.stackexchange.com/a/676925", "author": "jginestet", "author_url": "https://stats.stackexchange.com/users/380096/jginestet", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-08-20T15:28:37+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 676922, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-08-20T15:28:37+00:00", "raw_file": "raw/codex_api_v1/01ff643b5e725b2402c38de261074c3bef3326820f24db4342e17e318353268e_1790825246205492400_0.json", "raw_sha256": "a0521ae83c8630be00a12499e9aaa253069e57a5e0ff902fea3e9b8e7acb810f", "revision_guid": "6B4F51CB-7C7B-4DF7-AAAE-EF2A1C7E0F0A", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/6B4F51CB-7C7B-4DF7-AAAE-EF2A1C7E0F0A/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-08-21T01:35:35+00:00", "raw_file": "raw/codex_api_v1/01ff643b5e725b2402c38de261074c3bef3326820f24db4342e17e318353268e_1790825246205492400_0.json", "raw_sha256": "a0521ae83c8630be00a12499e9aaa253069e57a5e0ff902fea3e9b8e7acb810f", "revision_guid": "9B8B7347-5896-4E6F-AC75-DEC3507B4E3A", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/9B8B7347-5896-4E6F-AC75-DEC3507B4E3A/view-source"}], "score": 3, "updated_at": "2026-08-21T01:35:35+00:00"}, {"answer_html": "

The most important thing is to be very clear about what was done, and when.

\n

Many clinical or social-science reports draw conclusions that are essentially based on a single statistical analysis. For those types of reports, the details of statistical analysis are central.

\n

In contrast, basic biomedical science reports like yours typically involve multiple types of experiments. Each experiment is designed to probe a different implication of an underlying hypothesis. Even if results are reported in frequentist terms, the report as a whole has a Bayesian flavor. You start with an hypothesis for which you have some belief, and gather increasing amounts of experimental data to increase or decrease the probability that your belief is correct.

\n

In that case, it doesn't matter whether any one experimental result ends up being erroneously deemed "significant" based on the (arbitrary) $p<0.05$ criterion. The question is whether the overall evidence from the multiple types of experiments is adequate to support the conclusions.

\n

Your obligation is to make sure that your reviewers and readers understand how each experiment was conducted and interpreted. If a control from a prior experiment was reused for another statistical comparison, say so. If an intervention used as a "control" for other interventions is already known to affect growth, make sure that fact is at least acknowledged in the discussion of the results.

\n

Your clarity on those matters might lead reviewers to ask for further experiments, like those you suggest. If the paper is published without those further experiments, your clarity will allow readers to judge how much weight they should put on your results.

\n

Subject-matter issues are typically much more important than statistical analyses per se for whether a study like this is valid and reproducible. As an extreme example, tens of thousands of studies that were actually performed on the HeLa line were claimed to have been on other cell lines. See this paper by Horback and Halffman. Even if all of statistical analyses in those studies were perfect, the interpretations of their results were still wrong.

\n", "answer_id": 676926, "answer_text": "The most important thing is to be very clear about what was done, and when.\n\n\n\n\nMany clinical or social-science reports draw conclusions that are essentially based on a single statistical analysis. For those types of reports, the details of statistical analysis are central.\n\n\n\n\nIn contrast, basic biomedical science reports like yours typically involve multiple types of experiments. Each experiment is designed to probe a different implication of an underlying hypothesis. Even if results are reported in frequentist terms, the report as a whole has a Bayesian flavor. You start with an hypothesis for which you have some belief, and gather increasing amounts of experimental data to increase or decrease the probability that your belief is correct.\n\n\n\n\nIn that case, it doesn't matter whether any one experimental result ends up being erroneously deemed \"significant\" based on the (arbitrary) $p<0.05$ criterion. The question is whether the overall evidence from the multiple types of experiments is adequate to support the conclusions.\n\n\n\n\nYour obligation is to make sure that your reviewers and readers understand how each experiment was conducted and interpreted. If a control from a prior experiment was reused for another statistical comparison, say so. If an intervention used as a \"control\" for other interventions is already known to affect growth, make sure that fact is at least acknowledged in the discussion of the results.\n\n\n\n\nYour clarity on those matters might lead reviewers to ask for further experiments, like those you suggest. If the paper is published without those further experiments, your clarity will allow readers to judge how much weight they should put on your results.\n\n\n\n\nSubject-matter issues are typically much more important than statistical analyses per se for whether a study like this is valid and reproducible. As an extreme example, tens of thousands of studies that were actually performed on the HeLa line were claimed to have been on other cell lines. See this paper (https://doi.org/10.1371/journal.pone.0186281) by Horback and Halffman. Even if all of statistical analyses in those studies were perfect, the interpretations of their results were still wrong.", "answer_url": "https://stats.stackexchange.com/a/676926", "author": "EdM", "author_url": "https://stats.stackexchange.com/users/28500/edm", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-08-20T18:06:41+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 676922, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "EdM", "profile_url": "https://stats.stackexchange.com/users/28500/edm", "user_type": "registered"}, "created_at": "2026-08-20T18:06:41+00:00", "raw_file": "raw/codex_api_v1/01ff643b5e725b2402c38de261074c3bef3326820f24db4342e17e318353268e_1790825246205492400_0.json", "raw_sha256": "a0521ae83c8630be00a12499e9aaa253069e57a5e0ff902fea3e9b8e7acb810f", "revision_guid": "5370D235-4094-4143-BE97-98AE6C0D2C4B", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/5370D235-4094-4143-BE97-98AE6C0D2C4B/view-source"}], "score": 3, "updated_at": "2026-08-20T18:06:41+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I'm contributing to a paper where I am a fairly minor author. I'm concerned by the experimental design but the corresponding authors, who have decade(s) more experience in the field than I have, seem unconcerned and there's the implication that I'm being unnecessarily picky. I'm 95% sure I'm correct, but given their attitude and the fact that my remaining option is to have my name removed from the paper, I'm chasing that final 5% of sureness.\n\n\n\n\nIn the first experiment, knocking out a gene was shown to cause a significant increase in cell size (simple t-test). To confirm this phenomenon, they then knocked out another gene involved in the same biological process and showed the same effect (also using a t-test). They then tested another three or four genes more tangentially related to that process and saw a significant effect in some of them and not others (t tests). Due to time constraints and the fact that, at the time, they didn't know if this was going anywhere, these three experiments all compare to the same control. While they've built on this in later experiments, these three experiments are all in the paper and provide the base for the latter experiments.\n\n\n\n\nThis concerns me. Firstly, we know there’s a lot of variation in the experimental model over time so the control from the first experiment doesn't necessarily control for technical variations in the second two experiments. Secondly, and more importantly, in the second two experiments they compare the effects of disrupting a biological process to a \"control\", but that control has already been shown to have reduced growth compared to another genotype where that process is disrupted. To my mind, this invalidates any stats based on this experiment.\n\n\n\n\nTheir argument is that when you look at the overall results in the paper, the big picture is consistent and validates their results, and this can all be fixed with a p-value correction (in this case, Dunnett's test).\n\n\n\n\nI think presenting this data in a paper needs those experiments to be repeated with the proper controls. I think a Dunnett's test would be perfect if this was a pre-designed screen comparing knockdown of a number of genes to a single control, but not in this context.\n\n\n\n\nI'm wondering if I'm right, if they're right and I'm being picky, or if I'm right that it's a problem but they're right that it's a minor one?", "record_id": "Scientific-Answer-Ranking:stats:676922", "scores": [0, 3, 3], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "
\n

but that control has already been shown to have reduced growth compared to another genotype where that process is disrupted

\n
\n

A control can have a different baseline than the treated group. But you need to move from t-tests to regressions, eg ANCOVA. A common strategy within the world of “regression adjustments” is CUPED; you simply condition on the variable in the pre-experiment period, regardless of whether the unit is treated. Then the effect that you detect is a change relative to the baseline attributable to treatment exposure.

\n
\n

Due to time constraints and the fact that, at the time, they didn't know if this was going anywhere, these three experiments all compare to the same control.

\n
\n

This isn’t necessarily a problem if all the experiments occurred at the same time. If however the control occurred at time t as then experiment one in t+1, experiment 2 in t+2, etc. That might be the bigger red flag, especially if you’re worried about growth rates.

\n

Assuming all observed at the same time and that treatment is the same “knocking out a specific gene” then you can lump all of these experiments together in one. You may want to explore fixed effects where you effectively have one intercept per for each experimental subgroup - the baseline behavior expected for each subgroup. (This may sound like CUPED as I described earlier but they’re mechanically different.) But there shouldn’t be any correlation between experimental sub-group and treatment exposure.

\n", "answer_id": 676923, "answer_text": "but that control has already been shown to have reduced growth compared to another genotype where that process is disrupted\n\n\n\n\n\n\n\nA control can have a different baseline than the treated group. But you need to move from t-tests to regressions, eg ANCOVA. A common strategy within the world of “regression adjustments” is CUPED; you simply condition on the variable in the pre-experiment period, regardless of whether the unit is treated. Then the effect that you detect is a change relative to the baseline attributable to treatment exposure.\n\n\n\n\n\n\n\nDue to time constraints and the fact that, at the time, they didn't know if this was going anywhere, these three experiments all compare to the same control.\n\n\n\n\n\n\n\nThis isn’t necessarily a problem if all the experiments occurred at the same time. If however the control occurred at time t as then experiment one in t+1, experiment 2 in t+2, etc. That might be the bigger red flag, especially if you’re worried about growth rates.\n\n\n\n\nAssuming all observed at the same time and that treatment is the same “knocking out a specific gene” then you can lump all of these experiments together in one. You may want to explore fixed effects where you effectively have one intercept per for each experimental subgroup - the baseline behavior expected for each subgroup. (This may sound like CUPED as I described earlier but they’re mechanically different.) But there shouldn’t be any correlation between experimental sub-group and treatment exposure.", "answer_url": "https://stats.stackexchange.com/a/676923", "author": "jbuddy_13", "author_url": "https://stats.stackexchange.com/users/288172/jbuddy-13", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-08-20T14:16:06+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 676922, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jbuddy_13", "profile_url": "https://stats.stackexchange.com/users/288172/jbuddy-13", "user_type": "registered"}, "created_at": "2026-08-20T14:16:06+00:00", "raw_file": "raw/codex_api_v1/01ff643b5e725b2402c38de261074c3bef3326820f24db4342e17e318353268e_1790825246205492400_0.json", "raw_sha256": "a0521ae83c8630be00a12499e9aaa253069e57a5e0ff902fea3e9b8e7acb810f", "revision_guid": "51E42C8E-9699-4236-80F4-F62842373312", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/51E42C8E-9699-4236-80F4-F62842373312/view-source"}], "score": 0, "updated_at": "2026-08-20T14:16:06+00:00"}, {"answer_html": "

Your scenario perfectly matches an ANOVA scenario; means are compared accross multiple groups, including a control. I see nothing alarming there. Yes, you would need a multiple comparison correction (MCC) (Dunnett is indeed a good choice).
\nNow the question is, how many groups would you include in the ANOVA? It should be for all genes which were tested (not just the "significant" ones e.g.).
\nNow, could you just have gotten a very "lucky" control group? Possibly... But you say that, at least in some experiments, the results were not significant; so compare the non-significant means to the control; what is (are?) the p-value(s?)? If it is e.g. .6, then the control does not seem that extreme; if it is .06, then it may be...
\nHow difficult/time consuming is it to test a new control group? If not too bad, do it and see how it compares to the "original" control group.
\nYou also mention "technical variations in the second two experiments". That would be much more concerning. But of course if would depend on the specifics. Are you just saying this more or less out of principle, or do you have concrete details about divergences of the experimental protocols?
\nAnd note that it is quite common to be able to test only one group at a time (e.g. there is only one set of the required equipment).
\nSo, w/o more details, I do not see a cause for great alarm, if the proper test is used, with the proper MCC.

\n", "answer_id": 676925, "answer_text": "Your scenario perfectly matches an ANOVA scenario; means are compared accross multiple groups, including a control. I see nothing alarming there. Yes, you would need a multiple comparison correction (MCC) (Dunnett is indeed a good choice).\n\nNow the question is, how many groups would you include in the ANOVA? It should be for all genes which were tested (not just the \"significant\" ones e.g.).\n\nNow, could you just have gotten a very \"lucky\" control group? Possibly... But you say that, at least in some experiments, the results were not significant; so compare the non-significant means to the control; what is (are?) the p-value(s?)? If it is e.g. .6, then the control does not seem that extreme; if it is .06, then it may be...\n\nHow difficult/time consuming is it to test a new control group? If not too bad, do it and see how it compares to the \"original\" control group.\n\nYou also mention \"technical variations in the second two experiments\". That would be much more concerning. But of course if would depend on the specifics. Are you just saying this more or less out of principle, or do you have concrete details about divergences of the experimental protocols?\n\nAnd note that it is quite common to be able to test only one group at a time (e.g. there is only one set of the required equipment).\n\nSo, w/o more details, I do not see a cause for great alarm, if the proper test is used, with the proper MCC.", "answer_url": "https://stats.stackexchange.com/a/676925", "author": "jginestet", "author_url": "https://stats.stackexchange.com/users/380096/jginestet", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-08-20T15:28:37+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 676922, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-08-20T15:28:37+00:00", "raw_file": "raw/codex_api_v1/01ff643b5e725b2402c38de261074c3bef3326820f24db4342e17e318353268e_1790825246205492400_0.json", "raw_sha256": "a0521ae83c8630be00a12499e9aaa253069e57a5e0ff902fea3e9b8e7acb810f", "revision_guid": "6B4F51CB-7C7B-4DF7-AAAE-EF2A1C7E0F0A", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/6B4F51CB-7C7B-4DF7-AAAE-EF2A1C7E0F0A/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-08-21T01:35:35+00:00", "raw_file": "raw/codex_api_v1/01ff643b5e725b2402c38de261074c3bef3326820f24db4342e17e318353268e_1790825246205492400_0.json", "raw_sha256": "a0521ae83c8630be00a12499e9aaa253069e57a5e0ff902fea3e9b8e7acb810f", "revision_guid": "9B8B7347-5896-4E6F-AC75-DEC3507B4E3A", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/9B8B7347-5896-4E6F-AC75-DEC3507B4E3A/view-source"}], "score": 3, "updated_at": "2026-08-21T01:35:35+00:00"}, {"answer_html": "

The most important thing is to be very clear about what was done, and when.

\n

Many clinical or social-science reports draw conclusions that are essentially based on a single statistical analysis. For those types of reports, the details of statistical analysis are central.

\n

In contrast, basic biomedical science reports like yours typically involve multiple types of experiments. Each experiment is designed to probe a different implication of an underlying hypothesis. Even if results are reported in frequentist terms, the report as a whole has a Bayesian flavor. You start with an hypothesis for which you have some belief, and gather increasing amounts of experimental data to increase or decrease the probability that your belief is correct.

\n

In that case, it doesn't matter whether any one experimental result ends up being erroneously deemed "significant" based on the (arbitrary) $p<0.05$ criterion. The question is whether the overall evidence from the multiple types of experiments is adequate to support the conclusions.

\n

Your obligation is to make sure that your reviewers and readers understand how each experiment was conducted and interpreted. If a control from a prior experiment was reused for another statistical comparison, say so. If an intervention used as a "control" for other interventions is already known to affect growth, make sure that fact is at least acknowledged in the discussion of the results.

\n

Your clarity on those matters might lead reviewers to ask for further experiments, like those you suggest. If the paper is published without those further experiments, your clarity will allow readers to judge how much weight they should put on your results.

\n

Subject-matter issues are typically much more important than statistical analyses per se for whether a study like this is valid and reproducible. As an extreme example, tens of thousands of studies that were actually performed on the HeLa line were claimed to have been on other cell lines. See this paper by Horback and Halffman. Even if all of statistical analyses in those studies were perfect, the interpretations of their results were still wrong.

\n", "answer_id": 676926, "answer_text": "The most important thing is to be very clear about what was done, and when.\n\n\n\n\nMany clinical or social-science reports draw conclusions that are essentially based on a single statistical analysis. For those types of reports, the details of statistical analysis are central.\n\n\n\n\nIn contrast, basic biomedical science reports like yours typically involve multiple types of experiments. Each experiment is designed to probe a different implication of an underlying hypothesis. Even if results are reported in frequentist terms, the report as a whole has a Bayesian flavor. You start with an hypothesis for which you have some belief, and gather increasing amounts of experimental data to increase or decrease the probability that your belief is correct.\n\n\n\n\nIn that case, it doesn't matter whether any one experimental result ends up being erroneously deemed \"significant\" based on the (arbitrary) $p<0.05$ criterion. The question is whether the overall evidence from the multiple types of experiments is adequate to support the conclusions.\n\n\n\n\nYour obligation is to make sure that your reviewers and readers understand how each experiment was conducted and interpreted. If a control from a prior experiment was reused for another statistical comparison, say so. If an intervention used as a \"control\" for other interventions is already known to affect growth, make sure that fact is at least acknowledged in the discussion of the results.\n\n\n\n\nYour clarity on those matters might lead reviewers to ask for further experiments, like those you suggest. If the paper is published without those further experiments, your clarity will allow readers to judge how much weight they should put on your results.\n\n\n\n\nSubject-matter issues are typically much more important than statistical analyses per se for whether a study like this is valid and reproducible. As an extreme example, tens of thousands of studies that were actually performed on the HeLa line were claimed to have been on other cell lines. See this paper (https://doi.org/10.1371/journal.pone.0186281) by Horback and Halffman. Even if all of statistical analyses in those studies were perfect, the interpretations of their results were still wrong.", "answer_url": "https://stats.stackexchange.com/a/676926", "author": "EdM", "author_url": "https://stats.stackexchange.com/users/28500/edm", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-08-20T18:06:41+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 676922, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "EdM", "profile_url": "https://stats.stackexchange.com/users/28500/edm", "user_type": "registered"}, "created_at": "2026-08-20T18:06:41+00:00", "raw_file": "raw/codex_api_v1/01ff643b5e725b2402c38de261074c3bef3326820f24db4342e17e318353268e_1790825246205492400_0.json", "raw_sha256": "a0521ae83c8630be00a12499e9aaa253069e57a5e0ff902fea3e9b8e7acb810f", "revision_guid": "5370D235-4094-4143-BE97-98AE6C0D2C4B", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/5370D235-4094-4143-BE97-98AE6C0D2C4B/view-source"}], "score": 3, "updated_at": "2026-08-20T18:06:41+00:00"}], "domain": "statistics", "external_links": ["https://doi.org/10.1371/journal.pone.0186281"], "medical_sensitive": true, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:03.428408+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/774052c18cd9e8fa951e893347bfa3c1a85e743fc46ec4667572002cadb10cbf_1790825224163423600_0.json", "raw_sha256": "fe4dd06d3de6c0b1bb33ba88aee0ed4284118e01f76a58dcdce220a4946329b2", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "kcbthe86", "question_author_url": "https://stats.stackexchange.com/users/515742/kcbthe86", "question_author_user_type": "unregistered", "question_created_at": "2026-08-20T13:47:09+00:00", "question_html": "

I'm contributing to a paper where I am a fairly minor author. I'm concerned by the experimental design but the corresponding authors, who have decade(s) more experience in the field than I have, seem unconcerned and there's the implication that I'm being unnecessarily picky. I'm 95% sure I'm correct, but given their attitude and the fact that my remaining option is to have my name removed from the paper, I'm chasing that final 5% of sureness.

\n

In the first experiment, knocking out a gene was shown to cause a significant increase in cell size (simple t-test). To confirm this phenomenon, they then knocked out another gene involved in the same biological process and showed the same effect (also using a t-test). They then tested another three or four genes more tangentially related to that process and saw a significant effect in some of them and not others (t tests). Due to time constraints and the fact that, at the time, they didn't know if this was going anywhere, these three experiments all compare to the same control. While they've built on this in later experiments, these three experiments are all in the paper and provide the base for the latter experiments.

\n

This concerns me. Firstly, we know there’s a lot of variation in the experimental model over time so the control from the first experiment doesn't necessarily control for technical variations in the second two experiments. Secondly, and more importantly, in the second two experiments they compare the effects of disrupting a biological process to a "control", but that control has already been shown to have reduced growth compared to another genotype where that process is disrupted. To my mind, this invalidates any stats based on this experiment.

\n

Their argument is that when you look at the overall results in the paper, the big picture is consistent and validates their results, and this can all be fixed with a p-value correction (in this case, Dunnett's test).

\n

I think presenting this data in a paper needs those experiments to be repeated with the proper controls. I think a Dunnett's test would be perfect if this was a pre-designed screen comparing knockdown of a number of genes to a single control, but not in this context.

\n

I'm wondering if I'm right, if they're right and I'm being picky, or if I'm right that it's a problem but they're right that it's a minor one?

\n", "question_id": 676922, "question_license": "CC BY-SA 4.0", "question_score": 4, "question_text": "I'm contributing to a paper where I am a fairly minor author. I'm concerned by the experimental design but the corresponding authors, who have decade(s) more experience in the field than I have, seem unconcerned and there's the implication that I'm being unnecessarily picky. I'm 95% sure I'm correct, but given their attitude and the fact that my remaining option is to have my name removed from the paper, I'm chasing that final 5% of sureness.\n\n\n\n\nIn the first experiment, knocking out a gene was shown to cause a significant increase in cell size (simple t-test). To confirm this phenomenon, they then knocked out another gene involved in the same biological process and showed the same effect (also using a t-test). They then tested another three or four genes more tangentially related to that process and saw a significant effect in some of them and not others (t tests). Due to time constraints and the fact that, at the time, they didn't know if this was going anywhere, these three experiments all compare to the same control. While they've built on this in later experiments, these three experiments are all in the paper and provide the base for the latter experiments.\n\n\n\n\nThis concerns me. Firstly, we know there’s a lot of variation in the experimental model over time so the control from the first experiment doesn't necessarily control for technical variations in the second two experiments. Secondly, and more importantly, in the second two experiments they compare the effects of disrupting a biological process to a \"control\", but that control has already been shown to have reduced growth compared to another genotype where that process is disrupted. To my mind, this invalidates any stats based on this experiment.\n\n\n\n\nTheir argument is that when you look at the overall results in the paper, the big picture is consistent and validates their results, and this can all be fixed with a p-value correction (in this case, Dunnett's test).\n\n\n\n\nI think presenting this data in a paper needs those experiments to be repeated with the proper controls. I think a Dunnett's test would be perfect if this was a pre-designed screen comparing knockdown of a number of genes to a single control, but not in this context.\n\n\n\n\nI'm wondering if I'm right, if they're right and I'm being picky, or if I'm right that it's a problem but they're right that it's a minor one?", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "kcbthe86", "profile_url": "https://stats.stackexchange.com/users/515742/kcbthe86", "user_type": "unregistered"}, "created_at": "2026-08-20T13:47:09+00:00", "raw_file": "raw/codex_api_v1/01ff643b5e725b2402c38de261074c3bef3326820f24db4342e17e318353268e_1790825246205492400_0.json", "raw_sha256": "a0521ae83c8630be00a12499e9aaa253069e57a5e0ff902fea3e9b8e7acb810f", "revision_guid": "86B1CE7C-C99D-4B53-A120-AB9699CE0EB9", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/86B1CE7C-C99D-4B53-A120-AB9699CE0EB9/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-08-20T22:00:02+00:00", "raw_file": "raw/codex_api_v1/01ff643b5e725b2402c38de261074c3bef3326820f24db4342e17e318353268e_1790825246205492400_0.json", "raw_sha256": "a0521ae83c8630be00a12499e9aaa253069e57a5e0ff902fea3e9b8e7acb810f", "revision_guid": "C5F41EE0-9032-4006-8D8E-14BFE6FD7C57", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/C5F41EE0-9032-4006-8D8E-14BFE6FD7C57/view-source"}], "source_site": "stats", "source_url": "https://stats.stackexchange.com/questions/676922/in-this-experimental-context-does-the-re-use-of-a-control-bias-invalidate-the-r", "split": "train", "split_group": "350e0d3ac148dee5776cb68932436eea8aaea79700d560661d32a23180c6c064", "tags": ["p-value", "experiment-design", "control-group"], "thread_id": "stats:676922", "title": "In this experimental context, does the re-use of a control bias/invalidate the result?"}} {"accepted_status": [false, false, false], "candidate_answers": [{"answer_html": "

It is important here to not think about effects in a binary manner (as if the statistical message were just that an effect is "significant" vs. "not significant"; in particular, "not significant" doesn't mean that an effect doesn't really exist, it just means the data don't provide much evidence that it does). Chances are you are aware that the significance level is something that can be chosen, for example p=0.031 is significant using a 5% significance level but insignificant using a 1% level, meaning that it provides you some evidence, but the evidence is not that strong.

\n

The problem of binary thinking becomes worse once multiple tests are involved, because if nothing goes on and you run several tests, it may easily happen due to random variation that one of the tests is significant. For example, if you run 5 tests at significance level 0.05, the probability for every single test to give you a type I error (significance if in fact nothing is going on) is 0.05 (this is the definition of the significance level), but the probability that a type I error happens in any one of your 5 tests is clearly larger (as there are 5 chances to reach significance) and can be up to 5*0.05=0.25, which means that if you see one 5% significant result in 5 tests, it doesn't mean that much (if anything at all).

\n

In order to deal with this issue, there are multiple testing adjustments that basically run the involved tests in such a way that it becomes harder for a single test to be significant (this could be translated into saying that the tests are implicitly run at a lower significance level) but where the overall type I error of finding even a single significance if all null hypotheses are true (nothing is going on) is your prespecified level, here 0.05. Tukey's adjustment is such a procedure.

\n

The problem with this is that, because it makes it harder for the individual tests to become significant, it will also be harder to avoid a type II error, i.e., not finding significance even if something is going on.

\n

Chances are you feel confused by the fact that there is a significant interaction but you don't find significant treatment differences within the years, which you may expect if there were an interaction. One possible explanation of this is that 0.031 is not a very small p-value indicating that the treatment/year interaction, if existing, may not be very strong, and this will also mean that the Tukey adjusted individual tests have a hard time to find any specific difference as significant. As these are several tests adjusted, it may well happen that looking at the overall situation an interaction looks quite plausible, however the "signal" is too weak to nail down where exactly it comes from running lots of tests with adjustment.

\n

There are actually two possible explanations behind this, namely (a) this is because of the adjustment (but this doesn't mean you shouldn't adjust - Tukey called the adjustment "honest" for a reason, we should be honest about what is not so clear from our data and accept this kind of ambiguous result), and/or (b) the evidence for interaction comes from putting together what goes on in several individual differences that altogether look like something is going on, but every single one, looked at in isolated manner, is too weak to be significant.

\n", "answer_id": 677005, "answer_text": "It is important here to not think about effects in a binary manner (as if the statistical message were just that an effect is \"significant\" vs. \"not significant\"; in particular, \"not significant\" doesn't mean that an effect doesn't really exist, it just means the data don't provide much evidence that it does). Chances are you are aware that the significance level is something that can be chosen, for example p=0.031 is significant using a 5% significance level but insignificant using a 1% level, meaning that it provides you some evidence, but the evidence is not that strong.\n\n\n\n\nThe problem of binary thinking becomes worse once multiple tests are involved, because if nothing goes on and you run several tests, it may easily happen due to random variation that one of the tests is significant. For example, if you run 5 tests at significance level 0.05, the probability for every single test to give you a type I error (significance if in fact nothing is going on) is 0.05 (this is the definition of the significance level), but the probability that a type I error happens in any one of your 5 tests is clearly larger (as there are 5 chances to reach significance) and can be up to 5*0.05=0.25, which means that if you see one 5% significant result in 5 tests, it doesn't mean that much (if anything at all).\n\n\n\n\nIn order to deal with this issue, there are multiple testing adjustments that basically run the involved tests in such a way that it becomes harder for a single test to be significant (this could be translated into saying that the tests are implicitly run at a lower significance level) but where the overall type I error of finding even a single significance if all null hypotheses are true (nothing is going on) is your prespecified level, here 0.05. Tukey's adjustment is such a procedure.\n\n\n\n\nThe problem with this is that, because it makes it harder for the individual tests to become significant, it will also be harder to avoid a type II error, i.e., not finding significance even if something is going on.\n\n\n\n\nChances are you feel confused by the fact that there is a significant interaction but you don't find significant treatment differences within the years, which you may expect if there were an interaction. One possible explanation of this is that 0.031 is not a very small p-value indicating that the treatment/year interaction, if existing, may not be very strong, and this will also mean that the Tukey adjusted individual tests have a hard time to find any specific difference as significant. As these are several tests adjusted, it may well happen that looking at the overall situation an interaction looks quite plausible, however the \"signal\" is too weak to nail down where exactly it comes from running lots of tests with adjustment.\n\n\n\n\nThere are actually two possible explanations behind this, namely (a) this is because of the adjustment (but this doesn't mean you shouldn't adjust - Tukey called the adjustment \"honest\" for a reason, we should be honest about what is not so clear from our data and accept this kind of ambiguous result), and/or (b) the evidence for interaction comes from putting together what goes on in several individual differences that altogether look like something is going on, but every single one, looked at in isolated manner, is too weak to be significant.", "answer_url": "https://stats.stackexchange.com/a/677005", "author": "Christian Hennig", "author_url": "https://stats.stackexchange.com/users/247165/christian-hennig", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-08-30T09:36:51+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 676999, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Christian Hennig", "profile_url": "https://stats.stackexchange.com/users/247165/christian-hennig", "user_type": "registered"}, "created_at": "2026-08-30T09:36:51+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "866FFC9A-2B2C-4C94-B1DE-CB438F7F1E68", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/866FFC9A-2B2C-4C94-B1DE-CB438F7F1E68/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Christian Hennig", "profile_url": "https://stats.stackexchange.com/users/247165/christian-hennig", "user_type": "registered"}, "created_at": "2026-08-30T09:42:52+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "03912F67-F795-4E4B-9265-DFBBF59389DB", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/03912F67-F795-4E4B-9265-DFBBF59389DB/view-source"}], "score": 5, "updated_at": "2026-08-30T09:42:52+00:00"}, {"answer_html": "

I agree with Christian's answer. In addition, note that to see how strong an effect is, you need to look at a measure of effect size. For regression problems, betas are such.

\n

One additional reason (perhaps Christian is including this in his (b)) is that year may have effects as a linear trend, with no significant pairwise differences. This can happen even without interactions.

\n

Also, to see what is going on, graphs can be very helpful. This is true for pretty much all statistical results, but maybe especially interactions. It looks like you have N of about 500, with one ordinal (or maybe continuous) independent variable (time) and one nominal one (category) and (I hope) a continuous dependent variable. I suggest a plot with year on the x axis, DV on the y axis, and a line for each category. You can then add the 500 points (I would use a small plotting symbol, or a transparent one).

\n", "answer_id": 677006, "answer_text": "I agree with Christian's answer. In addition, note that to see how strong an effect is, you need to look at a measure of effect size. For regression problems, betas are such.\n\n\n\n\nOne additional reason (perhaps Christian is including this in his (b)) is that year may have effects as a linear trend, with no significant pairwise differences. This can happen even without interactions.\n\n\n\n\nAlso, to see what is going on, graphs can be very helpful. This is true for pretty much all statistical results, but maybe especially interactions. It looks like you have N of about 500, with one ordinal (or maybe continuous) independent variable (time) and one nominal one (category) and (I hope) a continuous dependent variable. I suggest a plot with year on the x axis, DV on the y axis, and a line for each category. You can then add the 500 points (I would use a small plotting symbol, or a transparent one).", "answer_url": "https://stats.stackexchange.com/a/677006", "author": "Peter Flom", "author_url": "https://stats.stackexchange.com/users/686/peter-flom", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-08-30T10:03:20+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 676999, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Peter Flom", "profile_url": "https://stats.stackexchange.com/users/686/peter-flom", "user_type": "registered"}, "created_at": "2026-08-30T10:03:20+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "C331109F-9307-4A79-95FC-EC369E9FB2C7", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/C331109F-9307-4A79-95FC-EC369E9FB2C7/view-source"}], "score": 5, "updated_at": "2026-08-30T10:03:20+00:00"}, {"answer_html": "

I agree with Christian and Peter's answers here, but there is a critically missed component to this question that wasn't touched upon in their answers. That is, you really shouldn't interpret main effects anymore if they are part of an interaction. I provide a visual depiction of a simple categorical x continuous interaction here. Here the main effects are a bit pointless to interpret on their own. You can use them to understand the conditional mean change in a response or what the linear effect is before changing by-category, sure. But if the interaction is what you care about, particularly if you care about significance, then the main effects are less important. In the example above, you are simply testing if the regression line pivots enough that the types of car influences the relationship between the predictor and response.

\n

I also write here about how theoretically these things don't always make sense. Sometimes an interaction will be significant with main effects not and vice versa. It will depend a lot on the nature of the data generating process, the type of interaction, how statistically powerful the design is, and other factors.

\n", "answer_id": 677016, "answer_text": "I agree with Christian and Peter's answers here, but there is a critically missed component to this question that wasn't touched upon in their answers. That is, you really shouldn't interpret main effects anymore if they are part of an interaction. I provide a visual depiction (https://stats.stackexchange.com/questions/636571/interpreting-main-effects-with-dummy-coded-and-continuous-predictors-in-regressi/636588#636588) of a simple categorical x continuous interaction here. Here the main effects are a bit pointless to interpret on their own. You can use them to understand the conditional mean change in a response or what the linear effect is before changing by-category, sure. But if the interaction is what you care about, particularly if you care about significance, then the main effects are less important. In the example above, you are simply testing if the regression line pivots enough that the types of car influences the relationship between the predictor and response.\n\n\n\n\nI also write here (https://stats.stackexchange.com/questions/636391/comparing-models-with-main-effects-and-interactions/636448#636448) about how theoretically these things don't always make sense. Sometimes an interaction will be significant with main effects not and vice versa. It will depend a lot on the nature of the data generating process, the type of interaction, how statistically powerful the design is, and other factors.", "answer_url": "https://stats.stackexchange.com/a/677016", "author": "Shawn Hemelstrand", "author_url": "https://stats.stackexchange.com/users/345611/shawn-hemelstrand", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-08-31T04:38:58+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 676999, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Shawn Hemelstrand", "profile_url": "https://stats.stackexchange.com/users/345611/shawn-hemelstrand", "user_type": "registered"}, "created_at": "2026-08-31T04:38:58+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "96A6B18E-56B1-4E3F-80CE-7C9D59B87ACC", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/96A6B18E-56B1-4E3F-80CE-7C9D59B87ACC/view-source"}], "score": 1, "updated_at": "2026-08-31T04:38:58+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I am new into statistics so asking a lot of questions (je suis vraiment desoléé).\nI fitted a linear mixed-effects model for repeated measurements with treatment, year, baseline value, and treatment × year as fixed effects. The treatment × year interaction was significant (F(8, 481.31) = 2.14, p = 0.031), while the treatment main effect was not (p = 0.674) but the years p= <0.001.\n\n\n\n\nI then compared treatments within each year using emmeans with Tukey adjustment, but none of the pairwise comparisons was significant (all p > 0.05).\n\n\n\n\nIs this combination of results statistically reasonable? Thanks in advance!", "record_id": "Scientific-Answer-Ranking:stats:676999", "scores": [5, 5, 1], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

It is important here to not think about effects in a binary manner (as if the statistical message were just that an effect is "significant" vs. "not significant"; in particular, "not significant" doesn't mean that an effect doesn't really exist, it just means the data don't provide much evidence that it does). Chances are you are aware that the significance level is something that can be chosen, for example p=0.031 is significant using a 5% significance level but insignificant using a 1% level, meaning that it provides you some evidence, but the evidence is not that strong.

\n

The problem of binary thinking becomes worse once multiple tests are involved, because if nothing goes on and you run several tests, it may easily happen due to random variation that one of the tests is significant. For example, if you run 5 tests at significance level 0.05, the probability for every single test to give you a type I error (significance if in fact nothing is going on) is 0.05 (this is the definition of the significance level), but the probability that a type I error happens in any one of your 5 tests is clearly larger (as there are 5 chances to reach significance) and can be up to 5*0.05=0.25, which means that if you see one 5% significant result in 5 tests, it doesn't mean that much (if anything at all).

\n

In order to deal with this issue, there are multiple testing adjustments that basically run the involved tests in such a way that it becomes harder for a single test to be significant (this could be translated into saying that the tests are implicitly run at a lower significance level) but where the overall type I error of finding even a single significance if all null hypotheses are true (nothing is going on) is your prespecified level, here 0.05. Tukey's adjustment is such a procedure.

\n

The problem with this is that, because it makes it harder for the individual tests to become significant, it will also be harder to avoid a type II error, i.e., not finding significance even if something is going on.

\n

Chances are you feel confused by the fact that there is a significant interaction but you don't find significant treatment differences within the years, which you may expect if there were an interaction. One possible explanation of this is that 0.031 is not a very small p-value indicating that the treatment/year interaction, if existing, may not be very strong, and this will also mean that the Tukey adjusted individual tests have a hard time to find any specific difference as significant. As these are several tests adjusted, it may well happen that looking at the overall situation an interaction looks quite plausible, however the "signal" is too weak to nail down where exactly it comes from running lots of tests with adjustment.

\n

There are actually two possible explanations behind this, namely (a) this is because of the adjustment (but this doesn't mean you shouldn't adjust - Tukey called the adjustment "honest" for a reason, we should be honest about what is not so clear from our data and accept this kind of ambiguous result), and/or (b) the evidence for interaction comes from putting together what goes on in several individual differences that altogether look like something is going on, but every single one, looked at in isolated manner, is too weak to be significant.

\n", "answer_id": 677005, "answer_text": "It is important here to not think about effects in a binary manner (as if the statistical message were just that an effect is \"significant\" vs. \"not significant\"; in particular, \"not significant\" doesn't mean that an effect doesn't really exist, it just means the data don't provide much evidence that it does). Chances are you are aware that the significance level is something that can be chosen, for example p=0.031 is significant using a 5% significance level but insignificant using a 1% level, meaning that it provides you some evidence, but the evidence is not that strong.\n\n\n\n\nThe problem of binary thinking becomes worse once multiple tests are involved, because if nothing goes on and you run several tests, it may easily happen due to random variation that one of the tests is significant. For example, if you run 5 tests at significance level 0.05, the probability for every single test to give you a type I error (significance if in fact nothing is going on) is 0.05 (this is the definition of the significance level), but the probability that a type I error happens in any one of your 5 tests is clearly larger (as there are 5 chances to reach significance) and can be up to 5*0.05=0.25, which means that if you see one 5% significant result in 5 tests, it doesn't mean that much (if anything at all).\n\n\n\n\nIn order to deal with this issue, there are multiple testing adjustments that basically run the involved tests in such a way that it becomes harder for a single test to be significant (this could be translated into saying that the tests are implicitly run at a lower significance level) but where the overall type I error of finding even a single significance if all null hypotheses are true (nothing is going on) is your prespecified level, here 0.05. Tukey's adjustment is such a procedure.\n\n\n\n\nThe problem with this is that, because it makes it harder for the individual tests to become significant, it will also be harder to avoid a type II error, i.e., not finding significance even if something is going on.\n\n\n\n\nChances are you feel confused by the fact that there is a significant interaction but you don't find significant treatment differences within the years, which you may expect if there were an interaction. One possible explanation of this is that 0.031 is not a very small p-value indicating that the treatment/year interaction, if existing, may not be very strong, and this will also mean that the Tukey adjusted individual tests have a hard time to find any specific difference as significant. As these are several tests adjusted, it may well happen that looking at the overall situation an interaction looks quite plausible, however the \"signal\" is too weak to nail down where exactly it comes from running lots of tests with adjustment.\n\n\n\n\nThere are actually two possible explanations behind this, namely (a) this is because of the adjustment (but this doesn't mean you shouldn't adjust - Tukey called the adjustment \"honest\" for a reason, we should be honest about what is not so clear from our data and accept this kind of ambiguous result), and/or (b) the evidence for interaction comes from putting together what goes on in several individual differences that altogether look like something is going on, but every single one, looked at in isolated manner, is too weak to be significant.", "answer_url": "https://stats.stackexchange.com/a/677005", "author": "Christian Hennig", "author_url": "https://stats.stackexchange.com/users/247165/christian-hennig", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-08-30T09:36:51+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 676999, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Christian Hennig", "profile_url": "https://stats.stackexchange.com/users/247165/christian-hennig", "user_type": "registered"}, "created_at": "2026-08-30T09:36:51+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "866FFC9A-2B2C-4C94-B1DE-CB438F7F1E68", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/866FFC9A-2B2C-4C94-B1DE-CB438F7F1E68/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Christian Hennig", "profile_url": "https://stats.stackexchange.com/users/247165/christian-hennig", "user_type": "registered"}, "created_at": "2026-08-30T09:42:52+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "03912F67-F795-4E4B-9265-DFBBF59389DB", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/03912F67-F795-4E4B-9265-DFBBF59389DB/view-source"}], "score": 5, "updated_at": "2026-08-30T09:42:52+00:00"}, {"answer_html": "

I agree with Christian's answer. In addition, note that to see how strong an effect is, you need to look at a measure of effect size. For regression problems, betas are such.

\n

One additional reason (perhaps Christian is including this in his (b)) is that year may have effects as a linear trend, with no significant pairwise differences. This can happen even without interactions.

\n

Also, to see what is going on, graphs can be very helpful. This is true for pretty much all statistical results, but maybe especially interactions. It looks like you have N of about 500, with one ordinal (or maybe continuous) independent variable (time) and one nominal one (category) and (I hope) a continuous dependent variable. I suggest a plot with year on the x axis, DV on the y axis, and a line for each category. You can then add the 500 points (I would use a small plotting symbol, or a transparent one).

\n", "answer_id": 677006, "answer_text": "I agree with Christian's answer. In addition, note that to see how strong an effect is, you need to look at a measure of effect size. For regression problems, betas are such.\n\n\n\n\nOne additional reason (perhaps Christian is including this in his (b)) is that year may have effects as a linear trend, with no significant pairwise differences. This can happen even without interactions.\n\n\n\n\nAlso, to see what is going on, graphs can be very helpful. This is true for pretty much all statistical results, but maybe especially interactions. It looks like you have N of about 500, with one ordinal (or maybe continuous) independent variable (time) and one nominal one (category) and (I hope) a continuous dependent variable. I suggest a plot with year on the x axis, DV on the y axis, and a line for each category. You can then add the 500 points (I would use a small plotting symbol, or a transparent one).", "answer_url": "https://stats.stackexchange.com/a/677006", "author": "Peter Flom", "author_url": "https://stats.stackexchange.com/users/686/peter-flom", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-08-30T10:03:20+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 676999, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Peter Flom", "profile_url": "https://stats.stackexchange.com/users/686/peter-flom", "user_type": "registered"}, "created_at": "2026-08-30T10:03:20+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "C331109F-9307-4A79-95FC-EC369E9FB2C7", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/C331109F-9307-4A79-95FC-EC369E9FB2C7/view-source"}], "score": 5, "updated_at": "2026-08-30T10:03:20+00:00"}, {"answer_html": "

I agree with Christian and Peter's answers here, but there is a critically missed component to this question that wasn't touched upon in their answers. That is, you really shouldn't interpret main effects anymore if they are part of an interaction. I provide a visual depiction of a simple categorical x continuous interaction here. Here the main effects are a bit pointless to interpret on their own. You can use them to understand the conditional mean change in a response or what the linear effect is before changing by-category, sure. But if the interaction is what you care about, particularly if you care about significance, then the main effects are less important. In the example above, you are simply testing if the regression line pivots enough that the types of car influences the relationship between the predictor and response.

\n

I also write here about how theoretically these things don't always make sense. Sometimes an interaction will be significant with main effects not and vice versa. It will depend a lot on the nature of the data generating process, the type of interaction, how statistically powerful the design is, and other factors.

\n", "answer_id": 677016, "answer_text": "I agree with Christian and Peter's answers here, but there is a critically missed component to this question that wasn't touched upon in their answers. That is, you really shouldn't interpret main effects anymore if they are part of an interaction. I provide a visual depiction (https://stats.stackexchange.com/questions/636571/interpreting-main-effects-with-dummy-coded-and-continuous-predictors-in-regressi/636588#636588) of a simple categorical x continuous interaction here. Here the main effects are a bit pointless to interpret on their own. You can use them to understand the conditional mean change in a response or what the linear effect is before changing by-category, sure. But if the interaction is what you care about, particularly if you care about significance, then the main effects are less important. In the example above, you are simply testing if the regression line pivots enough that the types of car influences the relationship between the predictor and response.\n\n\n\n\nI also write here (https://stats.stackexchange.com/questions/636391/comparing-models-with-main-effects-and-interactions/636448#636448) about how theoretically these things don't always make sense. Sometimes an interaction will be significant with main effects not and vice versa. It will depend a lot on the nature of the data generating process, the type of interaction, how statistically powerful the design is, and other factors.", "answer_url": "https://stats.stackexchange.com/a/677016", "author": "Shawn Hemelstrand", "author_url": "https://stats.stackexchange.com/users/345611/shawn-hemelstrand", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-08-31T04:38:58+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 676999, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Shawn Hemelstrand", "profile_url": "https://stats.stackexchange.com/users/345611/shawn-hemelstrand", "user_type": "registered"}, "created_at": "2026-08-31T04:38:58+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "96A6B18E-56B1-4E3F-80CE-7C9D59B87ACC", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/96A6B18E-56B1-4E3F-80CE-7C9D59B87ACC/view-source"}], "score": 1, "updated_at": "2026-08-31T04:38:58+00:00"}], "domain": "statistics", "external_links": [], "medical_sensitive": true, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:03.428408+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/774052c18cd9e8fa951e893347bfa3c1a85e743fc46ec4667572002cadb10cbf_1790825224163423600_0.json", "raw_sha256": "fe4dd06d3de6c0b1bb33ba88aee0ed4284118e01f76a58dcdce220a4946329b2", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Birma29", "question_author_url": "https://stats.stackexchange.com/users/515697/birma29", "question_author_user_type": "registered", "question_created_at": "2026-08-29T16:08:31+00:00", "question_html": "

I am new into statistics so asking a lot of questions (je suis vraiment desoléé).\nI fitted a linear mixed-effects model for repeated measurements with treatment, year, baseline value, and treatment × year as fixed effects. The treatment × year interaction was significant (F(8, 481.31) = 2.14, p = 0.031), while the treatment main effect was not (p = 0.674) but the years p= <0.001.

\n

I then compared treatments within each year using emmeans with Tukey adjustment, but none of the pairwise comparisons was significant (all p > 0.05).

\n

Is this combination of results statistically reasonable? Thanks in advance!

\n", "question_id": 676999, "question_license": "CC BY-SA 4.0", "question_score": 4, "question_text": "I am new into statistics so asking a lot of questions (je suis vraiment desoléé).\nI fitted a linear mixed-effects model for repeated measurements with treatment, year, baseline value, and treatment × year as fixed effects. The treatment × year interaction was significant (F(8, 481.31) = 2.14, p = 0.031), while the treatment main effect was not (p = 0.674) but the years p= <0.001.\n\n\n\n\nI then compared treatments within each year using emmeans with Tukey adjustment, but none of the pairwise comparisons was significant (all p > 0.05).\n\n\n\n\nIs this combination of results statistically reasonable? Thanks in advance!", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Birma29", "profile_url": "https://stats.stackexchange.com/users/515697/birma29", "user_type": "registered"}, "created_at": "2026-08-29T16:08:31+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "B2B4EAF9-2AAA-48F4-98F0-D111351FE815", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/B2B4EAF9-2AAA-48F4-98F0-D111351FE815/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-08-30T09:53:07+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "38EE132E-DF0E-4DAA-B191-97E114AC770D", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/38EE132E-DF0E-4DAA-B191-97E114AC770D/view-source"}, {"content_license": null, "contributor": {"display_name": "Christian Hennig", "profile_url": "https://stats.stackexchange.com/users/247165/christian-hennig", "user_type": "registered"}, "created_at": "2026-08-30T09:59:30+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "CE71F047-65B6-4F70-9E0C-269A8E6BCD02", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/CE71F047-65B6-4F70-9E0C-269A8E6BCD02/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Birma29", "profile_url": "https://stats.stackexchange.com/users/515697/birma29", "user_type": "registered"}, "created_at": "2026-08-30T18:41:01+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "724A3266-9119-452A-9113-C87906B7D39C", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/724A3266-9119-452A-9113-C87906B7D39C/view-source"}], "source_site": "stats", "source_url": "https://stats.stackexchange.com/questions/676999/significant-treatment-%c3%97-year-interaction-but-no-significant-pairwise-comparisons", "split": "train", "split_group": "a9cb603b23356afbdfe5c2e6867ee30371fd98119cdc07399de79cfe9fc81caa", "tags": ["regression", "mixed-model", "repeated-measures", "multiple-comparisons", "ancova"], "thread_id": "stats:676999", "title": "Significant treatment × year interaction but no significant pairwise comparisons in a repeated-measures ANCOVA using lmer"}} {"accepted_status": [false, false], "candidate_answers": [{"answer_html": "

The regression coefficients for variables not in the interaction are main effects, conditional on all the other variables, including the interaction.

\n

I don't know of a book that states this, but you can either a) Do the math and show it or b) Plug in different values of X, Z, C1, and C2 and show it that way.

\n", "answer_id": 677028, "answer_text": "The regression coefficients for variables not in the interaction are main effects, conditional on all the other variables, including the interaction.\n\n\n\n\nI don't know of a book that states this, but you can either a) Do the math and show it or b) Plug in different values of X, Z, C1, and C2 and show it that way.", "answer_url": "https://stats.stackexchange.com/a/677028", "author": "Peter Flom", "author_url": "https://stats.stackexchange.com/users/686/peter-flom", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-08-31T18:43:35+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677023, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Peter Flom", "profile_url": "https://stats.stackexchange.com/users/686/peter-flom", "user_type": "registered"}, "created_at": "2026-08-31T18:43:35+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "02A19662-7877-4049-B5F5-406036C72096", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/02A19662-7877-4049-B5F5-406036C72096/view-source"}], "score": 0, "updated_at": "2026-08-31T18:43:35+00:00"}, {"answer_html": "

Edit:

\n

The original answer focused more on OLS, when the question is about the logistic case. I'm leaving the commenters' suggested citations but added on another to mine and revamped the example

\n
\n\n
    \n
  1. Ordinary regression, and general issues with GLMS: Weisberg: Applied Linear Regression; Fox: Applied Regression Analysis and Generalized Linear Models
  2. \n
  3. Specific to logistic regression: Hosmer and Lemeshow: Applied Logistic Regression
  4. \n
\n

In Fox's Chapter 7, he discusses the interpretation of coefficients in the presence of interactions, quoting Nelder's principle of marginality as well (which is a nice bonus). Even though the quote is in the context of his discussion of OLS with dummy variables, Nelder's principle is important across generalized linear modeling. Hosmer and Lemeshow (p. 64 - 77) give much more detail on your question. I'll try to briefly summarize using one of their examples.

\n

Let's consider a logistic model with a indicator "exposure" variable for sex ($X_1 = 1 \\text{, if Female}$), a continuous covariate $Z = \\text{Age}$, the interaction variable $X_{1}Z$ and a separate covariate $X_2$ (say the patient's BMI). The outcome is $Y = 1$ if a patient develops coronary heart disease (CHD), and $Y = 0$ otherwise.

\n

On the log-odds scale, if we assume the $\\text{Age} \\sim \\text{CHD}$ relationship is linear in both sexes, and we introduce an interaction along with additional adjustment for BMI, we have:

\n

$$\n\\text{logit}(Y_i) = \\alpha + \\beta_1 X_{i1} + \\gamma Z_i + \\delta (X_1Z)_i + \\beta_2 X_{i2}\n$$

\n

Now write down the model separately for the two sexes substituting $0$ and $1$ accordingly for $X_1$ in each case and moving things around algebraically:

\n

$$\n\\begin{align}\n\\text{Female: } & \\text{logit}Y_i = (\\alpha + \\beta_1) + (\\gamma + \\delta)Z_i + \\beta_2 X_{i2}\\\\\n\\text{Male: } & \\text{logit}Y_i = \\alpha + \\gamma Z_i + \\beta_2 X_{i2}\n\\end{align}\n$$

\n

Though it is easier to see if we had actual estimates for $\\alpha$, $\\beta_1$, $\\beta_2$, and $\\gamma$, we have a different intercept and $\\text{logit}(Y) \\sim \\text{Age}$ slope between Males and Females, but $\\beta_2$, the slope relating BMI to $\\text{logit}(Y)$ stays the same in both cases.

\n

So on the logit scale, you can still interpret the marginal effect of educational attainment in the same way, though of course it is conditional on the rest of the terms in the model. That is, the “main effect” of age remains interpretable, unlike the main effects for treatment and whatever lab value you're interested in.

\n

This changes a bit when we exponentiate, as we must estimate odds-ratios involving the interaction terms at specific values of each of the interacting variables. However, since the additional covariate (BMI in this case) is not involved in that messiness, we can still exponentiate and do well with that odds-ratio, but still keeping in mind that we've got an interaction in our model. In many cases, however, we may be uninterested in the BMI odds ratio (i.e., the covariate), and only include it to better reduce confounding of the other effects (perhaps the exposure). This gets us into advanced territory, so I'll leave it here.

\n", "answer_id": 677039, "answer_text": "Edit:\n\n\n\n\nThe original answer focused more on OLS, when the question is about the logistic case. I'm leaving the commenters' suggested citations but added on another to mine and revamped the example\n\n\n\n\n\n\n\n\nfrom Whuber: F. Mosteller and J. Tukey, Data Analysis and Regression (https://archive.org/details/dataanalysisregr0000most)\n\n\n\n\nfrom M--: P. Roback and J. Legler: Beyond Multiple Linear Regression (https://bookdown.org/roback/bookdown-BeyondMLR/)\n\n\n\n\nMy picks:\n\n\n\n\n\n\nOrdinary regression, and general issues with GLMS: Weisberg: Applied Linear Regression (https://www.wiley.com/en-br/shop/general-introductory-statistics/applied-linear-regression-4th-edition-p-9781118386088); Fox: Applied Regression Analysis and Generalized Linear Models (https://collegepublishing.sagepub.com/products/applied-regression-analysis-and-generalized-linear-models-3-237254)\n\n\n\n\nSpecific to logistic regression: Hosmer and Lemeshow: Applied Logistic Regression (https://onlinelibrary.wiley.com/doi/book/10.1002/9781118548387)\n\n\n\n\n\nIn Fox's Chapter 7, he discusses the interpretation of coefficients in the presence of interactions, quoting Nelder's principle of marginality as well (which is a nice bonus). Even though the quote is in the context of his discussion of OLS with dummy variables, Nelder's principle is important across generalized linear modeling. Hosmer and Lemeshow (p. 64 - 77) give much more detail on your question. I'll try to briefly summarize using one of their examples.\n\n\n\n\nLet's consider a logistic model with a indicator \"exposure\" variable for sex ($X_1 = 1 \\text{, if Female}$), a continuous covariate $Z = \\text{Age}$, the interaction variable $X_{1}Z$ and a separate covariate $X_2$ (say the patient's BMI). The outcome is $Y = 1$ if a patient develops coronary heart disease (CHD), and $Y = 0$ otherwise.\n\n\n\n\nOn the log-odds scale, if we assume the $\\text{Age} \\sim \\text{CHD}$ relationship is linear in both sexes, and we introduce an interaction along with additional adjustment for BMI, we have:\n\n\n\n\n$$\n\\text{logit}(Y_i) = \\alpha + \\beta_1 X_{i1} + \\gamma Z_i + \\delta (X_1Z)_i + \\beta_2 X_{i2}\n$$\n\n\n\n\nNow write down the model separately for the two sexes substituting $0$ and $1$ accordingly for $X_1$ in each case and moving things around algebraically:\n\n\n\n\n$$\n\\begin{align}\n\\text{Female: } & \\text{logit}Y_i = (\\alpha + \\beta_1) + (\\gamma + \\delta)Z_i + \\beta_2 X_{i2}\\\\\n\\text{Male: } & \\text{logit}Y_i = \\alpha + \\gamma Z_i + \\beta_2 X_{i2}\n\\end{align}\n$$\n\n\n\n\nThough it is easier to see if we had actual estimates for $\\alpha$, $\\beta_1$, $\\beta_2$, and $\\gamma$, we have a different intercept and $\\text{logit}(Y) \\sim \\text{Age}$ slope between Males and Females, but $\\beta_2$, the slope relating BMI to $\\text{logit}(Y)$ stays the same in both cases.\n\n\n\n\nSo on the logit scale, you can still interpret the marginal effect of educational attainment in the same way, though of course it is conditional on the rest of the terms in the model. That is, the “main effect” of age remains interpretable, unlike the main effects for treatment and whatever lab value you're interested in.\n\n\n\n\nThis changes a bit when we exponentiate, as we must estimate odds-ratios involving the interaction terms at specific values of each of the interacting variables. However, since the additional covariate (BMI in this case) is not involved in that messiness, we can still exponentiate and do well with that odds-ratio, but still keeping in mind that we've got an interaction in our model. In many cases, however, we may be uninterested in the BMI odds ratio (i.e., the covariate), and only include it to better reduce confounding of the other effects (perhaps the exposure). This gets us into advanced territory, so I'll leave it here.", "answer_url": "https://stats.stackexchange.com/a/677039", "author": "Rick Hass", "author_url": "https://stats.stackexchange.com/users/97844/rick-hass", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-01T18:54:15+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677023, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Rick Hass", "profile_url": "https://stats.stackexchange.com/users/97844/rick-hass", "user_type": "registered"}, "created_at": "2026-09-01T18:54:15+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "1C96DBED-01C4-408D-8ADC-73D384ED5F3D", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/1C96DBED-01C4-408D-8ADC-73D384ED5F3D/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Rick Hass", "profile_url": "https://stats.stackexchange.com/users/97844/rick-hass", "user_type": "registered"}, "created_at": "2026-09-02T01:11:13+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "EB91F46E-AE98-4B27-B146-70EE8551482D", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/EB91F46E-AE98-4B27-B146-70EE8551482D/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "mastropi", "profile_url": "https://stats.stackexchange.com/users/217355/mastropi", "user_type": "registered"}, "created_at": "2026-09-02T11:36:08+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "EB25A932-6CB9-4775-9305-5FA8CA11BEE5", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/EB25A932-6CB9-4775-9305-5FA8CA11BEE5/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Rick Hass", "profile_url": "https://stats.stackexchange.com/users/97844/rick-hass", "user_type": "registered"}, "created_at": "2026-09-02T19:56:28+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "0C25F4DB-255E-4A29-8217-4F07665C4131", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/0C25F4DB-255E-4A29-8217-4F07665C4131/view-source"}], "score": 5, "updated_at": "2026-09-02T19:56:28+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "Logistic regression:\n\n\n\n\nglm(Y ~ X * Z + C1 + C2, family = binomial)\n\n\n\n\n\nI know β_X and β_Z are conditional (effect when the other is 0) and shouldn't be read as main effects.\n\n\n\n\nDoes this also apply to C1, which isn't in the interaction? Or is exp(β_C1) still the ordinary adjusted OR, with the p value testing the ordinary null?\n\n\n\n\nAny textbook or paper that states this explicitly?", "record_id": "Scientific-Answer-Ranking:stats:677023", "scores": [0, 5], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

The regression coefficients for variables not in the interaction are main effects, conditional on all the other variables, including the interaction.

\n

I don't know of a book that states this, but you can either a) Do the math and show it or b) Plug in different values of X, Z, C1, and C2 and show it that way.

\n", "answer_id": 677028, "answer_text": "The regression coefficients for variables not in the interaction are main effects, conditional on all the other variables, including the interaction.\n\n\n\n\nI don't know of a book that states this, but you can either a) Do the math and show it or b) Plug in different values of X, Z, C1, and C2 and show it that way.", "answer_url": "https://stats.stackexchange.com/a/677028", "author": "Peter Flom", "author_url": "https://stats.stackexchange.com/users/686/peter-flom", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-08-31T18:43:35+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677023, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Peter Flom", "profile_url": "https://stats.stackexchange.com/users/686/peter-flom", "user_type": "registered"}, "created_at": "2026-08-31T18:43:35+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "02A19662-7877-4049-B5F5-406036C72096", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/02A19662-7877-4049-B5F5-406036C72096/view-source"}], "score": 0, "updated_at": "2026-08-31T18:43:35+00:00"}, {"answer_html": "

Edit:

\n

The original answer focused more on OLS, when the question is about the logistic case. I'm leaving the commenters' suggested citations but added on another to mine and revamped the example

\n
\n\n
    \n
  1. Ordinary regression, and general issues with GLMS: Weisberg: Applied Linear Regression; Fox: Applied Regression Analysis and Generalized Linear Models
  2. \n
  3. Specific to logistic regression: Hosmer and Lemeshow: Applied Logistic Regression
  4. \n
\n

In Fox's Chapter 7, he discusses the interpretation of coefficients in the presence of interactions, quoting Nelder's principle of marginality as well (which is a nice bonus). Even though the quote is in the context of his discussion of OLS with dummy variables, Nelder's principle is important across generalized linear modeling. Hosmer and Lemeshow (p. 64 - 77) give much more detail on your question. I'll try to briefly summarize using one of their examples.

\n

Let's consider a logistic model with a indicator "exposure" variable for sex ($X_1 = 1 \\text{, if Female}$), a continuous covariate $Z = \\text{Age}$, the interaction variable $X_{1}Z$ and a separate covariate $X_2$ (say the patient's BMI). The outcome is $Y = 1$ if a patient develops coronary heart disease (CHD), and $Y = 0$ otherwise.

\n

On the log-odds scale, if we assume the $\\text{Age} \\sim \\text{CHD}$ relationship is linear in both sexes, and we introduce an interaction along with additional adjustment for BMI, we have:

\n

$$\n\\text{logit}(Y_i) = \\alpha + \\beta_1 X_{i1} + \\gamma Z_i + \\delta (X_1Z)_i + \\beta_2 X_{i2}\n$$

\n

Now write down the model separately for the two sexes substituting $0$ and $1$ accordingly for $X_1$ in each case and moving things around algebraically:

\n

$$\n\\begin{align}\n\\text{Female: } & \\text{logit}Y_i = (\\alpha + \\beta_1) + (\\gamma + \\delta)Z_i + \\beta_2 X_{i2}\\\\\n\\text{Male: } & \\text{logit}Y_i = \\alpha + \\gamma Z_i + \\beta_2 X_{i2}\n\\end{align}\n$$

\n

Though it is easier to see if we had actual estimates for $\\alpha$, $\\beta_1$, $\\beta_2$, and $\\gamma$, we have a different intercept and $\\text{logit}(Y) \\sim \\text{Age}$ slope between Males and Females, but $\\beta_2$, the slope relating BMI to $\\text{logit}(Y)$ stays the same in both cases.

\n

So on the logit scale, you can still interpret the marginal effect of educational attainment in the same way, though of course it is conditional on the rest of the terms in the model. That is, the “main effect” of age remains interpretable, unlike the main effects for treatment and whatever lab value you're interested in.

\n

This changes a bit when we exponentiate, as we must estimate odds-ratios involving the interaction terms at specific values of each of the interacting variables. However, since the additional covariate (BMI in this case) is not involved in that messiness, we can still exponentiate and do well with that odds-ratio, but still keeping in mind that we've got an interaction in our model. In many cases, however, we may be uninterested in the BMI odds ratio (i.e., the covariate), and only include it to better reduce confounding of the other effects (perhaps the exposure). This gets us into advanced territory, so I'll leave it here.

\n", "answer_id": 677039, "answer_text": "Edit:\n\n\n\n\nThe original answer focused more on OLS, when the question is about the logistic case. I'm leaving the commenters' suggested citations but added on another to mine and revamped the example\n\n\n\n\n\n\n\n\nfrom Whuber: F. Mosteller and J. Tukey, Data Analysis and Regression (https://archive.org/details/dataanalysisregr0000most)\n\n\n\n\nfrom M--: P. Roback and J. Legler: Beyond Multiple Linear Regression (https://bookdown.org/roback/bookdown-BeyondMLR/)\n\n\n\n\nMy picks:\n\n\n\n\n\n\nOrdinary regression, and general issues with GLMS: Weisberg: Applied Linear Regression (https://www.wiley.com/en-br/shop/general-introductory-statistics/applied-linear-regression-4th-edition-p-9781118386088); Fox: Applied Regression Analysis and Generalized Linear Models (https://collegepublishing.sagepub.com/products/applied-regression-analysis-and-generalized-linear-models-3-237254)\n\n\n\n\nSpecific to logistic regression: Hosmer and Lemeshow: Applied Logistic Regression (https://onlinelibrary.wiley.com/doi/book/10.1002/9781118548387)\n\n\n\n\n\nIn Fox's Chapter 7, he discusses the interpretation of coefficients in the presence of interactions, quoting Nelder's principle of marginality as well (which is a nice bonus). Even though the quote is in the context of his discussion of OLS with dummy variables, Nelder's principle is important across generalized linear modeling. Hosmer and Lemeshow (p. 64 - 77) give much more detail on your question. I'll try to briefly summarize using one of their examples.\n\n\n\n\nLet's consider a logistic model with a indicator \"exposure\" variable for sex ($X_1 = 1 \\text{, if Female}$), a continuous covariate $Z = \\text{Age}$, the interaction variable $X_{1}Z$ and a separate covariate $X_2$ (say the patient's BMI). The outcome is $Y = 1$ if a patient develops coronary heart disease (CHD), and $Y = 0$ otherwise.\n\n\n\n\nOn the log-odds scale, if we assume the $\\text{Age} \\sim \\text{CHD}$ relationship is linear in both sexes, and we introduce an interaction along with additional adjustment for BMI, we have:\n\n\n\n\n$$\n\\text{logit}(Y_i) = \\alpha + \\beta_1 X_{i1} + \\gamma Z_i + \\delta (X_1Z)_i + \\beta_2 X_{i2}\n$$\n\n\n\n\nNow write down the model separately for the two sexes substituting $0$ and $1$ accordingly for $X_1$ in each case and moving things around algebraically:\n\n\n\n\n$$\n\\begin{align}\n\\text{Female: } & \\text{logit}Y_i = (\\alpha + \\beta_1) + (\\gamma + \\delta)Z_i + \\beta_2 X_{i2}\\\\\n\\text{Male: } & \\text{logit}Y_i = \\alpha + \\gamma Z_i + \\beta_2 X_{i2}\n\\end{align}\n$$\n\n\n\n\nThough it is easier to see if we had actual estimates for $\\alpha$, $\\beta_1$, $\\beta_2$, and $\\gamma$, we have a different intercept and $\\text{logit}(Y) \\sim \\text{Age}$ slope between Males and Females, but $\\beta_2$, the slope relating BMI to $\\text{logit}(Y)$ stays the same in both cases.\n\n\n\n\nSo on the logit scale, you can still interpret the marginal effect of educational attainment in the same way, though of course it is conditional on the rest of the terms in the model. That is, the “main effect” of age remains interpretable, unlike the main effects for treatment and whatever lab value you're interested in.\n\n\n\n\nThis changes a bit when we exponentiate, as we must estimate odds-ratios involving the interaction terms at specific values of each of the interacting variables. However, since the additional covariate (BMI in this case) is not involved in that messiness, we can still exponentiate and do well with that odds-ratio, but still keeping in mind that we've got an interaction in our model. In many cases, however, we may be uninterested in the BMI odds ratio (i.e., the covariate), and only include it to better reduce confounding of the other effects (perhaps the exposure). This gets us into advanced territory, so I'll leave it here.", "answer_url": "https://stats.stackexchange.com/a/677039", "author": "Rick Hass", "author_url": "https://stats.stackexchange.com/users/97844/rick-hass", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-01T18:54:15+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677023, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Rick Hass", "profile_url": "https://stats.stackexchange.com/users/97844/rick-hass", "user_type": "registered"}, "created_at": "2026-09-01T18:54:15+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "1C96DBED-01C4-408D-8ADC-73D384ED5F3D", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/1C96DBED-01C4-408D-8ADC-73D384ED5F3D/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Rick Hass", "profile_url": "https://stats.stackexchange.com/users/97844/rick-hass", "user_type": "registered"}, "created_at": "2026-09-02T01:11:13+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "EB91F46E-AE98-4B27-B146-70EE8551482D", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/EB91F46E-AE98-4B27-B146-70EE8551482D/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "mastropi", "profile_url": "https://stats.stackexchange.com/users/217355/mastropi", "user_type": "registered"}, "created_at": "2026-09-02T11:36:08+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "EB25A932-6CB9-4775-9305-5FA8CA11BEE5", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/EB25A932-6CB9-4775-9305-5FA8CA11BEE5/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Rick Hass", "profile_url": "https://stats.stackexchange.com/users/97844/rick-hass", "user_type": "registered"}, "created_at": "2026-09-02T19:56:28+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "0C25F4DB-255E-4A29-8217-4F07665C4131", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/0C25F4DB-255E-4A29-8217-4F07665C4131/view-source"}], "score": 5, "updated_at": "2026-09-02T19:56:28+00:00"}], "domain": "statistics", "external_links": ["https://archive.org/details/dataanalysisregr0000most", "https://bookdown.org/roback/bookdown-BeyondMLR/", "https://collegepublishing.sagepub.com/products/applied-regression-analysis-and-generalized-linear-models-3-237254", "https://onlinelibrary.wiley.com/doi/book/10.1002/9781118548387", "https://www.wiley.com/en-br/shop/general-introductory-statistics/applied-linear-regression-4th-edition-p-9781118386088"], "medical_sensitive": true, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:03.428408+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/774052c18cd9e8fa951e893347bfa3c1a85e743fc46ec4667572002cadb10cbf_1790825224163423600_0.json", "raw_sha256": "fe4dd06d3de6c0b1bb33ba88aee0ed4284118e01f76a58dcdce220a4946329b2", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Konstantinos Gkirgkiris", "question_author_url": "https://stats.stackexchange.com/users/466987/konstantinos-gkirgkiris", "question_author_user_type": "registered", "question_created_at": "2026-08-31T16:28:24+00:00", "question_html": "

Logistic regression:

\n
glm(Y ~ X * Z + C1 + C2, family = binomial)\n
\n

I know β_X and β_Z are conditional (effect when the other is 0) and shouldn't be read as main effects.

\n

Does this also apply to C1, which isn't in the interaction? Or is exp(β_C1) still the ordinary adjusted OR, with the p value testing the ordinary null?

\n

Any textbook or paper that states this explicitly?

\n", "question_id": 677023, "question_license": "CC BY-SA 4.0", "question_score": 6, "question_text": "Logistic regression:\n\n\n\n\nglm(Y ~ X * Z + C1 + C2, family = binomial)\n\n\n\n\n\nI know β_X and β_Z are conditional (effect when the other is 0) and shouldn't be read as main effects.\n\n\n\n\nDoes this also apply to C1, which isn't in the interaction? Or is exp(β_C1) still the ordinary adjusted OR, with the p value testing the ordinary null?\n\n\n\n\nAny textbook or paper that states this explicitly?", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Konstantinos Gkirgkiris", "profile_url": "https://stats.stackexchange.com/users/466987/konstantinos-gkirgkiris", "user_type": "registered"}, "created_at": "2026-08-31T16:28:24+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "625D283B-6E8B-49CC-9D39-A419938D290E", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/625D283B-6E8B-49CC-9D39-A419938D290E/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-09-01T00:39:35+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "7B7DEF62-2D77-4CB5-B284-7203069E17E3", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/7B7DEF62-2D77-4CB5-B284-7203069E17E3/view-source"}], "source_site": "stats", "source_url": "https://stats.stackexchange.com/questions/677023/does-an-interaction-term-affect-the-interpretation-of-the-other-covariates", "split": "train", "split_group": "0a1bcd73d1b98426209a0c28354537686e3002366acc568482c8aa33acc3129f", "tags": ["regression", "r", "interaction"], "thread_id": "stats:677023", "title": "Does an interaction term affect the interpretation of the other covariates?"}} {"accepted_status": [false, false], "candidate_answers": [{"answer_html": "

Welcome to CV. It's not clear why you think there is multicollinearity. That is a relation among independent variables and has nothing to do with the DV. You've only listed one IV. However, collinearity does not affect prediction very much.

\n

One problem is surely what @RickHass said: Your IV contains your DV. You are then asking "can we predict number of store purchases from number of store purchases".

\n

One way around this is to take out "Num store purchases" from the feature set.

\n

You may have other problems as well. Purchasing data is often highly skewed, and, while regression does not require normal data, it does assume normal error, and that may be violated. You might want to take logs.

\n

However, if all the numbers of purchases are small (as might be the case for 'big ticket' items) then you might consider a count model.

\n

I'd consider hiring a statistician.

\n", "answer_id": 677034, "answer_text": "Welcome to CV. It's not clear why you think there is multicollinearity. That is a relation among independent variables and has nothing to do with the DV. You've only listed one IV. However, collinearity does not affect prediction very much.\n\n\n\n\nOne problem is surely what @RickHass said: Your IV contains your DV. You are then asking \"can we predict number of store purchases from number of store purchases\".\n\n\n\n\nOne way around this is to take out \"Num store purchases\" from the feature set.\n\n\n\n\nYou may have other problems as well. Purchasing data is often highly skewed, and, while regression does not require normal data, it does assume normal error, and that may be violated. You might want to take logs.\n\n\n\n\nHowever, if all the numbers of purchases are small (as might be the case for 'big ticket' items) then you might consider a count model.\n\n\n\n\nI'd consider hiring a statistician.", "answer_url": "https://stats.stackexchange.com/a/677034", "author": "Peter Flom", "author_url": "https://stats.stackexchange.com/users/686/peter-flom", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-01T11:41:58+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677033, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Peter Flom", "profile_url": "https://stats.stackexchange.com/users/686/peter-flom", "user_type": "registered"}, "created_at": "2026-09-01T11:41:58+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "D7BDB0E7-7A8C-438F-84B8-BD6B7817B150", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/D7BDB0E7-7A8C-438F-84B8-BD6B7817B150/view-source"}], "score": 3, "updated_at": "2026-09-01T11:41:58+00:00"}, {"answer_html": "

RMSE = 3.82e-13\n=> Model is getting a perfect score.\n=> Red Flag

\n

You put Store is the data.\nTotal Purchases = Store + Web + Catalog\n=> OLS Regressor didn't bother to learn about the customer behavior.\nIt is actually solving an eqn : Store = Total Purchases - Web - Catalog

\n

Do a quick check on features like MntWines or MntMeatProducts.\nMake sure those totals don't accidentally contain the physical store purchase counts we are trying to predict.

\n

If We are trying to predict NumStorePurchases (Let's say, how many times a man visited the physical store).

\n

The danger is that features like MntWines (Total dollars spent on wine) or MntMeatProducts(Total dollars spent on meat) might be acting like a Wines or Meat bought from this physical store receipt.\nThen the machine will cheat saying "He bought wines from this physical store, therefore he went to the physical store."

\n

All I am saying is If MntWines includes physical store purchases, we have to drop it. It gives away the answer.\nBut Why am I saying this? Let's say we want to predict the human behavior.
\nIf you put this model into the real world to predict what customers will do tomorrow, it will crash.

\n

Why? Because tomorrow hasn't happened yet. You don't have tomorrow's meat receipts. You only have MntMeatProducts after the target (NumStorePurchases) has already occurred.

\n

Hence, it will crash.\nIf the correlation is suspiciously high, you must drop that Mnt... feature. It is giving the model a shortcut which we don't want.\nI have tried my best to make you understand. If you still have any doubt then please leave a comment.

\n", "answer_id": 677069, "answer_text": "RMSE = 3.82e-13\n=> Model is getting a perfect score.\n=> Red Flag\n\n\n\n\nYou put Store is the data.\nTotal Purchases = Store + Web + Catalog\n=> OLS Regressor didn't bother to learn about the customer behavior.\nIt is actually solving an eqn : Store = Total Purchases - Web - Catalog\n\n\n\n\nDo a quick check on features like MntWines or MntMeatProducts.\nMake sure those totals don't accidentally contain the physical store purchase counts we are trying to predict.\n\n\n\n\nIf We are trying to predict NumStorePurchases (Let's say, how many times a man visited the physical store).\n\n\n\n\nThe danger is that features like MntWines (Total dollars spent on wine) or MntMeatProducts(Total dollars spent on meat) might be acting like a Wines or Meat bought from this physical store receipt.\nThen the machine will cheat saying \"He bought wines from this physical store, therefore he went to the physical store.\"\n\n\n\n\nAll I am saying is If MntWines includes physical store purchases, we have to drop it. It gives away the answer.\nBut Why am I saying this? Let's say we want to predict the human behavior.\n\nIf you put this model into the real world to predict what customers will do tomorrow, it will crash.\n\n\n\n\nWhy? Because tomorrow hasn't happened yet. You don't have tomorrow's meat receipts. You only have MntMeatProducts after the target (NumStorePurchases) has already occurred.\n\n\n\n\nHence, it will crash.\nIf the correlation is suspiciously high, you must drop that Mnt... feature. It is giving the model a shortcut which we don't want.\nI have tried my best to make you understand. If you still have any doubt then please leave a comment.", "answer_url": "https://stats.stackexchange.com/a/677069", "author": "Soudipta Dutta", "author_url": "https://stats.stackexchange.com/users/207636/soudipta-dutta", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-04T12:10:41+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677033, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Soudipta Dutta", "profile_url": "https://stats.stackexchange.com/users/207636/soudipta-dutta", "user_type": "registered"}, "created_at": "2026-09-04T12:10:41+00:00", "raw_file": "raw/codex_api_v1/64ee278f47b21ead17c9e9fc156835d607f15cff0518af0117a527463a68df8a_1790825256327661600_0.json", "raw_sha256": "18d894000304f6d836d0b21a9f2f35d37c183b3d25e32a897338c6dff012df04", "revision_guid": "8E0BAE17-D514-43DD-8915-7D6D1D11997B", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/8E0BAE17-D514-43DD-8915-7D6D1D11997B/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Soudipta Dutta", "profile_url": "https://stats.stackexchange.com/users/207636/soudipta-dutta", "user_type": "registered"}, "created_at": "2026-09-04T12:17:06+00:00", "raw_file": "raw/codex_api_v1/64ee278f47b21ead17c9e9fc156835d607f15cff0518af0117a527463a68df8a_1790825256327661600_0.json", "raw_sha256": "18d894000304f6d836d0b21a9f2f35d37c183b3d25e32a897338c6dff012df04", "revision_guid": "3ED08E0D-FFB4-4E46-AB7E-8287BD20CF14", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/3ED08E0D-FFB4-4E46-AB7E-8287BD20CF14/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Soudipta Dutta", "profile_url": "https://stats.stackexchange.com/users/207636/soudipta-dutta", "user_type": "registered"}, "created_at": "2026-09-08T09:35:00+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "EADD6F80-51D8-488C-90A1-B951DAE79867", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/EADD6F80-51D8-488C-90A1-B951DAE79867/view-source"}], "score": 1, "updated_at": "2026-09-08T09:35:00+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I am doing a project to understand the predictive viability of different regressors on the dependent variable(NumStorePurchases). In the feature space, we have a feature called Total Purchases- Sum of (NumStorePurchases,WebPurchases,CatalogPurchases) along with other variables Income, Kidhome, Teenhome, Recency, MntWines, MntFruits, MntMeatProducts, MntFishProducts, MntSweetProducts, MntGoldProds, NumDealsPurchases, NumWebPurchases, NumCatalogPurchases, NumStorePurchases, NumWebVisitsMonth, AcceptedCmp3, AcceptedCmp4, AcceptedCmp5, AcceptedCmp1, AcceptedCmp2, Response, Complain, Country. When we are doing an OLS regression by splitting out test-train data by 70-30% & finding out RMSE(Root Mean Squared Error), value is a minuscule number-3.8200863988425333e-13.\nSo, I am little bit skeptical with this number, although according to my understanding Multicollinearity do not impact predictive viability of a model, it's just impact the significance of each regressors.\n\n\n\n\nIs it somehow impacting the model predictive accuracy or maybe some other factors like data leakage can reduce the RMSE as well due to the presence of Y on X(Feature space) itself or maybe this small RMSE value can be possible?\n\n\n\n\nLooking for your reply community members.\n\n\n\n\nThanks.", "record_id": "Scientific-Answer-Ranking:stats:677033", "scores": [3, 1], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

Welcome to CV. It's not clear why you think there is multicollinearity. That is a relation among independent variables and has nothing to do with the DV. You've only listed one IV. However, collinearity does not affect prediction very much.

\n

One problem is surely what @RickHass said: Your IV contains your DV. You are then asking "can we predict number of store purchases from number of store purchases".

\n

One way around this is to take out "Num store purchases" from the feature set.

\n

You may have other problems as well. Purchasing data is often highly skewed, and, while regression does not require normal data, it does assume normal error, and that may be violated. You might want to take logs.

\n

However, if all the numbers of purchases are small (as might be the case for 'big ticket' items) then you might consider a count model.

\n

I'd consider hiring a statistician.

\n", "answer_id": 677034, "answer_text": "Welcome to CV. It's not clear why you think there is multicollinearity. That is a relation among independent variables and has nothing to do with the DV. You've only listed one IV. However, collinearity does not affect prediction very much.\n\n\n\n\nOne problem is surely what @RickHass said: Your IV contains your DV. You are then asking \"can we predict number of store purchases from number of store purchases\".\n\n\n\n\nOne way around this is to take out \"Num store purchases\" from the feature set.\n\n\n\n\nYou may have other problems as well. Purchasing data is often highly skewed, and, while regression does not require normal data, it does assume normal error, and that may be violated. You might want to take logs.\n\n\n\n\nHowever, if all the numbers of purchases are small (as might be the case for 'big ticket' items) then you might consider a count model.\n\n\n\n\nI'd consider hiring a statistician.", "answer_url": "https://stats.stackexchange.com/a/677034", "author": "Peter Flom", "author_url": "https://stats.stackexchange.com/users/686/peter-flom", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-01T11:41:58+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677033, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Peter Flom", "profile_url": "https://stats.stackexchange.com/users/686/peter-flom", "user_type": "registered"}, "created_at": "2026-09-01T11:41:58+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "D7BDB0E7-7A8C-438F-84B8-BD6B7817B150", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/D7BDB0E7-7A8C-438F-84B8-BD6B7817B150/view-source"}], "score": 3, "updated_at": "2026-09-01T11:41:58+00:00"}, {"answer_html": "

RMSE = 3.82e-13\n=> Model is getting a perfect score.\n=> Red Flag

\n

You put Store is the data.\nTotal Purchases = Store + Web + Catalog\n=> OLS Regressor didn't bother to learn about the customer behavior.\nIt is actually solving an eqn : Store = Total Purchases - Web - Catalog

\n

Do a quick check on features like MntWines or MntMeatProducts.\nMake sure those totals don't accidentally contain the physical store purchase counts we are trying to predict.

\n

If We are trying to predict NumStorePurchases (Let's say, how many times a man visited the physical store).

\n

The danger is that features like MntWines (Total dollars spent on wine) or MntMeatProducts(Total dollars spent on meat) might be acting like a Wines or Meat bought from this physical store receipt.\nThen the machine will cheat saying "He bought wines from this physical store, therefore he went to the physical store."

\n

All I am saying is If MntWines includes physical store purchases, we have to drop it. It gives away the answer.\nBut Why am I saying this? Let's say we want to predict the human behavior.
\nIf you put this model into the real world to predict what customers will do tomorrow, it will crash.

\n

Why? Because tomorrow hasn't happened yet. You don't have tomorrow's meat receipts. You only have MntMeatProducts after the target (NumStorePurchases) has already occurred.

\n

Hence, it will crash.\nIf the correlation is suspiciously high, you must drop that Mnt... feature. It is giving the model a shortcut which we don't want.\nI have tried my best to make you understand. If you still have any doubt then please leave a comment.

\n", "answer_id": 677069, "answer_text": "RMSE = 3.82e-13\n=> Model is getting a perfect score.\n=> Red Flag\n\n\n\n\nYou put Store is the data.\nTotal Purchases = Store + Web + Catalog\n=> OLS Regressor didn't bother to learn about the customer behavior.\nIt is actually solving an eqn : Store = Total Purchases - Web - Catalog\n\n\n\n\nDo a quick check on features like MntWines or MntMeatProducts.\nMake sure those totals don't accidentally contain the physical store purchase counts we are trying to predict.\n\n\n\n\nIf We are trying to predict NumStorePurchases (Let's say, how many times a man visited the physical store).\n\n\n\n\nThe danger is that features like MntWines (Total dollars spent on wine) or MntMeatProducts(Total dollars spent on meat) might be acting like a Wines or Meat bought from this physical store receipt.\nThen the machine will cheat saying \"He bought wines from this physical store, therefore he went to the physical store.\"\n\n\n\n\nAll I am saying is If MntWines includes physical store purchases, we have to drop it. It gives away the answer.\nBut Why am I saying this? Let's say we want to predict the human behavior.\n\nIf you put this model into the real world to predict what customers will do tomorrow, it will crash.\n\n\n\n\nWhy? Because tomorrow hasn't happened yet. You don't have tomorrow's meat receipts. You only have MntMeatProducts after the target (NumStorePurchases) has already occurred.\n\n\n\n\nHence, it will crash.\nIf the correlation is suspiciously high, you must drop that Mnt... feature. It is giving the model a shortcut which we don't want.\nI have tried my best to make you understand. If you still have any doubt then please leave a comment.", "answer_url": "https://stats.stackexchange.com/a/677069", "author": "Soudipta Dutta", "author_url": "https://stats.stackexchange.com/users/207636/soudipta-dutta", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-04T12:10:41+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677033, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Soudipta Dutta", "profile_url": "https://stats.stackexchange.com/users/207636/soudipta-dutta", "user_type": "registered"}, "created_at": "2026-09-04T12:10:41+00:00", "raw_file": "raw/codex_api_v1/64ee278f47b21ead17c9e9fc156835d607f15cff0518af0117a527463a68df8a_1790825256327661600_0.json", "raw_sha256": "18d894000304f6d836d0b21a9f2f35d37c183b3d25e32a897338c6dff012df04", "revision_guid": "8E0BAE17-D514-43DD-8915-7D6D1D11997B", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/8E0BAE17-D514-43DD-8915-7D6D1D11997B/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Soudipta Dutta", "profile_url": "https://stats.stackexchange.com/users/207636/soudipta-dutta", "user_type": "registered"}, "created_at": "2026-09-04T12:17:06+00:00", "raw_file": "raw/codex_api_v1/64ee278f47b21ead17c9e9fc156835d607f15cff0518af0117a527463a68df8a_1790825256327661600_0.json", "raw_sha256": "18d894000304f6d836d0b21a9f2f35d37c183b3d25e32a897338c6dff012df04", "revision_guid": "3ED08E0D-FFB4-4E46-AB7E-8287BD20CF14", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/3ED08E0D-FFB4-4E46-AB7E-8287BD20CF14/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Soudipta Dutta", "profile_url": "https://stats.stackexchange.com/users/207636/soudipta-dutta", "user_type": "registered"}, "created_at": "2026-09-08T09:35:00+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "EADD6F80-51D8-488C-90A1-B951DAE79867", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/EADD6F80-51D8-488C-90A1-B951DAE79867/view-source"}], "score": 1, "updated_at": "2026-09-08T09:35:00+00:00"}], "domain": "statistics", "external_links": [], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:03.428408+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/774052c18cd9e8fa951e893347bfa3c1a85e743fc46ec4667572002cadb10cbf_1790825224163423600_0.json", "raw_sha256": "fe4dd06d3de6c0b1bb33ba88aee0ed4284118e01f76a58dcdce220a4946329b2", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Abir Kar", "question_author_url": "https://stats.stackexchange.com/users/510955/abir-kar", "question_author_user_type": "registered", "question_created_at": "2026-09-01T09:40:16+00:00", "question_html": "

I am doing a project to understand the predictive viability of different regressors on the dependent variable(NumStorePurchases). In the feature space, we have a feature called Total Purchases- Sum of (NumStorePurchases,WebPurchases,CatalogPurchases) along with other variables Income, Kidhome, Teenhome, Recency, MntWines, MntFruits, MntMeatProducts, MntFishProducts, MntSweetProducts, MntGoldProds, NumDealsPurchases, NumWebPurchases, NumCatalogPurchases, NumStorePurchases, NumWebVisitsMonth, AcceptedCmp3, AcceptedCmp4, AcceptedCmp5, AcceptedCmp1, AcceptedCmp2, Response, Complain, Country. When we are doing an OLS regression by splitting out test-train data by 70-30% & finding out RMSE(Root Mean Squared Error), value is a minuscule number-3.8200863988425333e-13.\nSo, I am little bit skeptical with this number, although according to my understanding Multicollinearity do not impact predictive viability of a model, it's just impact the significance of each regressors.

\n

Is it somehow impacting the model predictive accuracy or maybe some other factors like data leakage can reduce the RMSE as well due to the presence of Y on X(Feature space) itself or maybe this small RMSE value can be possible?

\n

Looking for your reply community members.

\n

Thanks.

\n", "question_id": 677033, "question_license": "CC BY-SA 4.0", "question_score": 2, "question_text": "I am doing a project to understand the predictive viability of different regressors on the dependent variable(NumStorePurchases). In the feature space, we have a feature called Total Purchases- Sum of (NumStorePurchases,WebPurchases,CatalogPurchases) along with other variables Income, Kidhome, Teenhome, Recency, MntWines, MntFruits, MntMeatProducts, MntFishProducts, MntSweetProducts, MntGoldProds, NumDealsPurchases, NumWebPurchases, NumCatalogPurchases, NumStorePurchases, NumWebVisitsMonth, AcceptedCmp3, AcceptedCmp4, AcceptedCmp5, AcceptedCmp1, AcceptedCmp2, Response, Complain, Country. When we are doing an OLS regression by splitting out test-train data by 70-30% & finding out RMSE(Root Mean Squared Error), value is a minuscule number-3.8200863988425333e-13.\nSo, I am little bit skeptical with this number, although according to my understanding Multicollinearity do not impact predictive viability of a model, it's just impact the significance of each regressors.\n\n\n\n\nIs it somehow impacting the model predictive accuracy or maybe some other factors like data leakage can reduce the RMSE as well due to the presence of Y on X(Feature space) itself or maybe this small RMSE value can be possible?\n\n\n\n\nLooking for your reply community members.\n\n\n\n\nThanks.", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Abir Kar", "profile_url": "https://stats.stackexchange.com/users/510955/abir-kar", "user_type": "registered"}, "created_at": "2026-09-01T09:40:16+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "B8FA9293-7F0F-46F6-96CD-BA3F1590F973", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/B8FA9293-7F0F-46F6-96CD-BA3F1590F973/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Abir Kar", "profile_url": "https://stats.stackexchange.com/users/510955/abir-kar", "user_type": "registered"}, "created_at": "2026-09-03T17:20:40+00:00", "raw_file": "raw/codex_api_v1/84bb317e707465a80f008019404ef1f770e152d74ef692d3b81c48903ec855cc_1790825232001984700_0.json", "raw_sha256": "75778d86d5325e15f4b491a748dc70ae6ac6ee98840d584e01ed28416cb71fbe", "revision_guid": "8EF25545-061A-4014-BC66-7C810301BD57", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/8EF25545-061A-4014-BC66-7C810301BD57/view-source"}], "source_site": "stats", "source_url": "https://stats.stackexchange.com/questions/677033/is-removing-multicollinear-variable-necessary-to-get-a-proper-predictive-analysi", "split": "train", "split_group": "5ef7d0b2c8d8e20f5752a48c7b260f89d5ebe8ba17b51ba46fc94a6e041cd728", "tags": ["regression", "machine-learning", "python", "least-squares", "multicollinearity"], "thread_id": "stats:677033", "title": "Is removing multicollinear variable necessary to get a proper predictive analysis of RMSE(Root Mean Squared Error) of OLS regression in test data?"}} {"accepted_status": [true, false], "candidate_answers": [{"answer_html": "

If you have three items $Y_1,Y_2, Y_3$ with variance 1 each, say, and $Y_2=-Y_1$, $Y_3$ independent of $Y_1, Y_2$ so that $X=Y_1+Y_2+Y_3=Y_3$, you have $\\sum\\sigma^2_{Y_j}=3$ and $\\sigma^2_{X}=1$. Then $\\alpha=\\frac{3}{2}(1-3)=-3$.

\n

The variances are all positive as is $\\frac{k}{k-1}$, but $1-\\frac{\\sum \\sigma^2_{Y_j}}{\\sigma^2_X}$ can well be negative.

\n

If your items are negatively correlated, the variance of $X$ may be small and the sum of the item variances can be large. If just $X=Y_1+Y_2$, you even have $\\sigma^2_X=0$ and $\\alpha=-\\infty$.

\n", "answer_id": 677067, "answer_text": "If you have three items $Y_1,Y_2, Y_3$ with variance 1 each, say, and $Y_2=-Y_1$, $Y_3$ independent of $Y_1, Y_2$ so that $X=Y_1+Y_2+Y_3=Y_3$, you have $\\sum\\sigma^2_{Y_j}=3$ and $\\sigma^2_{X}=1$. Then $\\alpha=\\frac{3}{2}(1-3)=-3$.\n\n\n\n\nThe variances are all positive as is $\\frac{k}{k-1}$, but $1-\\frac{\\sum \\sigma^2_{Y_j}}{\\sigma^2_X}$ can well be negative.\n\n\n\n\nIf your items are negatively correlated, the variance of $X$ may be small and the sum of the item variances can be large. If just $X=Y_1+Y_2$, you even have $\\sigma^2_X=0$ and $\\alpha=-\\infty$.", "answer_url": "https://stats.stackexchange.com/a/677067", "author": "Christian Hennig", "author_url": "https://stats.stackexchange.com/users/247165/christian-hennig", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-04T10:50:37+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677066, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Christian Hennig", "profile_url": "https://stats.stackexchange.com/users/247165/christian-hennig", "user_type": "registered"}, "created_at": "2026-09-04T10:50:37+00:00", "raw_file": "raw/codex_api_v1/64ee278f47b21ead17c9e9fc156835d607f15cff0518af0117a527463a68df8a_1790825256327661600_0.json", "raw_sha256": "18d894000304f6d836d0b21a9f2f35d37c183b3d25e32a897338c6dff012df04", "revision_guid": "CFC09865-5603-48A3-A5A5-6087F1CF7234", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/CFC09865-5603-48A3-A5A5-6087F1CF7234/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Christian Hennig", "profile_url": "https://stats.stackexchange.com/users/247165/christian-hennig", "user_type": "registered"}, "created_at": "2026-09-04T10:56:29+00:00", "raw_file": "raw/codex_api_v1/64ee278f47b21ead17c9e9fc156835d607f15cff0518af0117a527463a68df8a_1790825256327661600_0.json", "raw_sha256": "18d894000304f6d836d0b21a9f2f35d37c183b3d25e32a897338c6dff012df04", "revision_guid": "92520B75-5858-4AF4-BFF0-E3925FDC41F7", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/92520B75-5858-4AF4-BFF0-E3925FDC41F7/view-source"}], "score": 11, "updated_at": "2026-09-04T10:56:29+00:00"}, {"answer_html": "
\n

It should not be possible for those variance terms to be negative.

\n
\n

Note that there is a negative sign. (marked red below)

\n

$${\\displaystyle \\alpha ={k \\over k-1}\\left(1\\color{red}{\\mathbf{-}}{\\sum _{i=1}^{k}\\sigma _{y_{i}}^{2} \\over \\sigma _{X}^{2}}\\right)}$$

\n

The important question is whether we can have

\n

$$\\frac{\\sum_{i=1}^{k}\\sigma_{y_{i}}^2}{ \\sigma_X^2} > 1$$

\n
\n

The minimal value is easy to understand. If all items are fully correlated and have equal variance ($\\forall i : \\sigma_{y_i}^2 = \\sigma_{Y}^2$), then $\\sigma_X^2 = k^2 \\sigma_{Y}^2$. Hence the maximum value of $$1-\\frac{\\sum_{i=1}^{k}\\sigma_{y_{i}}^2}{ \\sigma_X^2} = 1 - \\frac{k \\sigma_Y^2}{k^2 \\sigma_Y^2}$$ is equal to $1-\\frac{1}{k} = \\frac{k-1}{k}$.

\n

(with different but fully correlates variances $\\sigma_{y_i}^2$ the maximum value will be a bit lower. E.g. if $y_1 = 0.5 y_2$, then $\\frac{\\sum_{i=1}^{k}\\sigma_{y_{i}}^2}{ \\sigma_X^2} = 1.25/1.5^2 = 5/9 > 1/2$)

\n
\n

For the maximum value we can get a lot above $1$ and even up to infinite. This is what Christian Hennig explained. His approach can even work with only two negatively correlated variables. Consider the following example

\n
                y_1      y_2      x\n                item 1   item 2   total score\nParticipant A   1        4        5\nParticipant B   2        3        5\nParticipant C   3        2        5\nParticipant D   4        1        5\n
\n

The population variance of the item scores is 1.25, but for the total it is 0

\n", "answer_id": 677068, "answer_text": "It should not be possible for those variance terms to be negative.\n\n\n\n\n\n\n\nNote that there is a negative sign. (marked red below)\n\n\n\n\n$${\\displaystyle \\alpha ={k \\over k-1}\\left(1\\color{red}{\\mathbf{-}}{\\sum _{i=1}^{k}\\sigma _{y_{i}}^{2} \\over \\sigma _{X}^{2}}\\right)}$$\n\n\n\n\nThe important question is whether we can have\n\n\n\n\n$$\\frac{\\sum_{i=1}^{k}\\sigma_{y_{i}}^2}{ \\sigma_X^2} > 1$$\n\n\n\n\n\n\n\nThe minimal value is easy to understand. If all items are fully correlated and have equal variance ($\\forall i : \\sigma_{y_i}^2 = \\sigma_{Y}^2$), then $\\sigma_X^2 = k^2 \\sigma_{Y}^2$. Hence the maximum value of $$1-\\frac{\\sum_{i=1}^{k}\\sigma_{y_{i}}^2}{ \\sigma_X^2} = 1 - \\frac{k \\sigma_Y^2}{k^2 \\sigma_Y^2}$$ is equal to $1-\\frac{1}{k} = \\frac{k-1}{k}$.\n\n\n\n\n(with different but fully correlates variances $\\sigma_{y_i}^2$ the maximum value will be a bit lower. E.g. if $y_1 = 0.5 y_2$, then $\\frac{\\sum_{i=1}^{k}\\sigma_{y_{i}}^2}{ \\sigma_X^2} = 1.25/1.5^2 = 5/9 > 1/2$)\n\n\n\n\n\n\n\nFor the maximum value we can get a lot above $1$ and even up to infinite. This is what Christian Hennig explained. His approach can even work with only two negatively correlated variables. Consider the following example\n\n\n\n\n y_1 y_2 x\n item 1 item 2 total score\nParticipant A 1 4 5\nParticipant B 2 3 5\nParticipant C 3 2 5\nParticipant D 4 1 5\n\n\n\n\n\nThe population variance of the item scores is 1.25, but for the total it is 0", "answer_url": "https://stats.stackexchange.com/a/677068", "author": "Sextus Empiricus", "author_url": "https://stats.stackexchange.com/users/164061/sextus-empiricus", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-04T12:07:06+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677066, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Sextus Empiricus", "profile_url": "https://stats.stackexchange.com/users/164061/sextus-empiricus", "user_type": "registered"}, "created_at": "2026-09-04T12:07:06+00:00", "raw_file": "raw/codex_api_v1/64ee278f47b21ead17c9e9fc156835d607f15cff0518af0117a527463a68df8a_1790825256327661600_0.json", "raw_sha256": "18d894000304f6d836d0b21a9f2f35d37c183b3d25e32a897338c6dff012df04", "revision_guid": "C11330D7-FE09-4007-BED2-7A5FA5F3DC0B", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/C11330D7-FE09-4007-BED2-7A5FA5F3DC0B/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Sextus Empiricus", "profile_url": "https://stats.stackexchange.com/users/164061/sextus-empiricus", "user_type": "registered"}, "created_at": "2026-09-04T12:14:59+00:00", "raw_file": "raw/codex_api_v1/64ee278f47b21ead17c9e9fc156835d607f15cff0518af0117a527463a68df8a_1790825256327661600_0.json", "raw_sha256": "18d894000304f6d836d0b21a9f2f35d37c183b3d25e32a897338c6dff012df04", "revision_guid": "323BC7F4-6304-4932-9B41-BD55AF50F212", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/323BC7F4-6304-4932-9B41-BD55AF50F212/view-source"}], "score": 7, "updated_at": "2026-09-04T12:14:59+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I'm trying to get my head around how a negative result from Cronbach's alpha is even mathematically possible. When I look at the formula, it's defined entirely in terms of variances of the individual items (the following from wikipedia):\n\n\n\n\n$$\n{\\displaystyle \\alpha ={k \\over k-1}\\left(1-{\\sum _{i=1}^{k}\\sigma _{y_{i}}^{2} \\over \\sigma _{X}^{2}}\\right)}\n$$\n\n\n\n\nwhere:\n\n\n\n\n\n${\\displaystyle k}$ represents the number of \"parts\" (items, test parts, etc.) in the measure;\n\n\n\n\nthe ${\\displaystyle k/(k-1)}$ term causes alpha to be an unbiased estimate of reliability when the parts are parallel or essentially tau equivalent;\n\n\n\n\n${\\displaystyle \\sigma _{y_{i}}^{2}}$ the variance associated with each part i;\n\n\n\n\nand ${\\displaystyle \\sigma _{X}^{2}}$ the observed score variance (the\nvariance associated with the total test scores).\n\n\n\n\n\nIt should not be possible for those variance terms to be negative. Variances can't be negative. They're derived from sums of squares, which are always positive, because you square the deviances before summing them. (mathematically, if the summed individual item variances were larger than the variance of the entire data set, then the ratio would be larger than 1, so subtracting that ratio from 1 would be negative. But is that even possible in a data set, that the summed variances of its subparts end up greater than the variance of the whole? That smells fishy to me, although I can't produce a proof that it's impossible.)\n\n\n\n\nHowever, all the questions I see here about negative Cronbach's alpha have answers to the effect of 'your response scales need to be adjusted', and they often implicate covariances, not variances. Covariances can be negative, sure. But I don't see where covariances feature in the Cronbach's alpha formula.\n\n\n\n\nCan someone please explain, mathematically, how a negative Cronbach's alpha might be calculated based on the formula? Not the real-world situation that can give rise to it -- I understand that conceptually -- but the actual calculation steps that produce it?", "record_id": "Scientific-Answer-Ranking:stats:677066", "scores": [11, 7], "split": "train", "thread": {"accepted_answer_id": 677067, "answers": [{"answer_html": "

If you have three items $Y_1,Y_2, Y_3$ with variance 1 each, say, and $Y_2=-Y_1$, $Y_3$ independent of $Y_1, Y_2$ so that $X=Y_1+Y_2+Y_3=Y_3$, you have $\\sum\\sigma^2_{Y_j}=3$ and $\\sigma^2_{X}=1$. Then $\\alpha=\\frac{3}{2}(1-3)=-3$.

\n

The variances are all positive as is $\\frac{k}{k-1}$, but $1-\\frac{\\sum \\sigma^2_{Y_j}}{\\sigma^2_X}$ can well be negative.

\n

If your items are negatively correlated, the variance of $X$ may be small and the sum of the item variances can be large. If just $X=Y_1+Y_2$, you even have $\\sigma^2_X=0$ and $\\alpha=-\\infty$.

\n", "answer_id": 677067, "answer_text": "If you have three items $Y_1,Y_2, Y_3$ with variance 1 each, say, and $Y_2=-Y_1$, $Y_3$ independent of $Y_1, Y_2$ so that $X=Y_1+Y_2+Y_3=Y_3$, you have $\\sum\\sigma^2_{Y_j}=3$ and $\\sigma^2_{X}=1$. Then $\\alpha=\\frac{3}{2}(1-3)=-3$.\n\n\n\n\nThe variances are all positive as is $\\frac{k}{k-1}$, but $1-\\frac{\\sum \\sigma^2_{Y_j}}{\\sigma^2_X}$ can well be negative.\n\n\n\n\nIf your items are negatively correlated, the variance of $X$ may be small and the sum of the item variances can be large. If just $X=Y_1+Y_2$, you even have $\\sigma^2_X=0$ and $\\alpha=-\\infty$.", "answer_url": "https://stats.stackexchange.com/a/677067", "author": "Christian Hennig", "author_url": "https://stats.stackexchange.com/users/247165/christian-hennig", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-04T10:50:37+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677066, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Christian Hennig", "profile_url": "https://stats.stackexchange.com/users/247165/christian-hennig", "user_type": "registered"}, "created_at": "2026-09-04T10:50:37+00:00", "raw_file": "raw/codex_api_v1/64ee278f47b21ead17c9e9fc156835d607f15cff0518af0117a527463a68df8a_1790825256327661600_0.json", "raw_sha256": "18d894000304f6d836d0b21a9f2f35d37c183b3d25e32a897338c6dff012df04", "revision_guid": "CFC09865-5603-48A3-A5A5-6087F1CF7234", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/CFC09865-5603-48A3-A5A5-6087F1CF7234/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Christian Hennig", "profile_url": "https://stats.stackexchange.com/users/247165/christian-hennig", "user_type": "registered"}, "created_at": "2026-09-04T10:56:29+00:00", "raw_file": "raw/codex_api_v1/64ee278f47b21ead17c9e9fc156835d607f15cff0518af0117a527463a68df8a_1790825256327661600_0.json", "raw_sha256": "18d894000304f6d836d0b21a9f2f35d37c183b3d25e32a897338c6dff012df04", "revision_guid": "92520B75-5858-4AF4-BFF0-E3925FDC41F7", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/92520B75-5858-4AF4-BFF0-E3925FDC41F7/view-source"}], "score": 11, "updated_at": "2026-09-04T10:56:29+00:00"}, {"answer_html": "
\n

It should not be possible for those variance terms to be negative.

\n
\n

Note that there is a negative sign. (marked red below)

\n

$${\\displaystyle \\alpha ={k \\over k-1}\\left(1\\color{red}{\\mathbf{-}}{\\sum _{i=1}^{k}\\sigma _{y_{i}}^{2} \\over \\sigma _{X}^{2}}\\right)}$$

\n

The important question is whether we can have

\n

$$\\frac{\\sum_{i=1}^{k}\\sigma_{y_{i}}^2}{ \\sigma_X^2} > 1$$

\n
\n

The minimal value is easy to understand. If all items are fully correlated and have equal variance ($\\forall i : \\sigma_{y_i}^2 = \\sigma_{Y}^2$), then $\\sigma_X^2 = k^2 \\sigma_{Y}^2$. Hence the maximum value of $$1-\\frac{\\sum_{i=1}^{k}\\sigma_{y_{i}}^2}{ \\sigma_X^2} = 1 - \\frac{k \\sigma_Y^2}{k^2 \\sigma_Y^2}$$ is equal to $1-\\frac{1}{k} = \\frac{k-1}{k}$.

\n

(with different but fully correlates variances $\\sigma_{y_i}^2$ the maximum value will be a bit lower. E.g. if $y_1 = 0.5 y_2$, then $\\frac{\\sum_{i=1}^{k}\\sigma_{y_{i}}^2}{ \\sigma_X^2} = 1.25/1.5^2 = 5/9 > 1/2$)

\n
\n

For the maximum value we can get a lot above $1$ and even up to infinite. This is what Christian Hennig explained. His approach can even work with only two negatively correlated variables. Consider the following example

\n
                y_1      y_2      x\n                item 1   item 2   total score\nParticipant A   1        4        5\nParticipant B   2        3        5\nParticipant C   3        2        5\nParticipant D   4        1        5\n
\n

The population variance of the item scores is 1.25, but for the total it is 0

\n", "answer_id": 677068, "answer_text": "It should not be possible for those variance terms to be negative.\n\n\n\n\n\n\n\nNote that there is a negative sign. (marked red below)\n\n\n\n\n$${\\displaystyle \\alpha ={k \\over k-1}\\left(1\\color{red}{\\mathbf{-}}{\\sum _{i=1}^{k}\\sigma _{y_{i}}^{2} \\over \\sigma _{X}^{2}}\\right)}$$\n\n\n\n\nThe important question is whether we can have\n\n\n\n\n$$\\frac{\\sum_{i=1}^{k}\\sigma_{y_{i}}^2}{ \\sigma_X^2} > 1$$\n\n\n\n\n\n\n\nThe minimal value is easy to understand. If all items are fully correlated and have equal variance ($\\forall i : \\sigma_{y_i}^2 = \\sigma_{Y}^2$), then $\\sigma_X^2 = k^2 \\sigma_{Y}^2$. Hence the maximum value of $$1-\\frac{\\sum_{i=1}^{k}\\sigma_{y_{i}}^2}{ \\sigma_X^2} = 1 - \\frac{k \\sigma_Y^2}{k^2 \\sigma_Y^2}$$ is equal to $1-\\frac{1}{k} = \\frac{k-1}{k}$.\n\n\n\n\n(with different but fully correlates variances $\\sigma_{y_i}^2$ the maximum value will be a bit lower. E.g. if $y_1 = 0.5 y_2$, then $\\frac{\\sum_{i=1}^{k}\\sigma_{y_{i}}^2}{ \\sigma_X^2} = 1.25/1.5^2 = 5/9 > 1/2$)\n\n\n\n\n\n\n\nFor the maximum value we can get a lot above $1$ and even up to infinite. This is what Christian Hennig explained. His approach can even work with only two negatively correlated variables. Consider the following example\n\n\n\n\n y_1 y_2 x\n item 1 item 2 total score\nParticipant A 1 4 5\nParticipant B 2 3 5\nParticipant C 3 2 5\nParticipant D 4 1 5\n\n\n\n\n\nThe population variance of the item scores is 1.25, but for the total it is 0", "answer_url": "https://stats.stackexchange.com/a/677068", "author": "Sextus Empiricus", "author_url": "https://stats.stackexchange.com/users/164061/sextus-empiricus", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-04T12:07:06+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677066, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Sextus Empiricus", "profile_url": "https://stats.stackexchange.com/users/164061/sextus-empiricus", "user_type": "registered"}, "created_at": "2026-09-04T12:07:06+00:00", "raw_file": "raw/codex_api_v1/64ee278f47b21ead17c9e9fc156835d607f15cff0518af0117a527463a68df8a_1790825256327661600_0.json", "raw_sha256": "18d894000304f6d836d0b21a9f2f35d37c183b3d25e32a897338c6dff012df04", "revision_guid": "C11330D7-FE09-4007-BED2-7A5FA5F3DC0B", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/C11330D7-FE09-4007-BED2-7A5FA5F3DC0B/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Sextus Empiricus", "profile_url": "https://stats.stackexchange.com/users/164061/sextus-empiricus", "user_type": "registered"}, "created_at": "2026-09-04T12:14:59+00:00", "raw_file": "raw/codex_api_v1/64ee278f47b21ead17c9e9fc156835d607f15cff0518af0117a527463a68df8a_1790825256327661600_0.json", "raw_sha256": "18d894000304f6d836d0b21a9f2f35d37c183b3d25e32a897338c6dff012df04", "revision_guid": "323BC7F4-6304-4932-9B41-BD55AF50F212", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/323BC7F4-6304-4932-9B41-BD55AF50F212/view-source"}], "score": 7, "updated_at": "2026-09-04T12:14:59+00:00"}], "domain": "statistics", "external_links": [], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:03.428408+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/774052c18cd9e8fa951e893347bfa3c1a85e743fc46ec4667572002cadb10cbf_1790825224163423600_0.json", "raw_sha256": "fe4dd06d3de6c0b1bb33ba88aee0ed4284118e01f76a58dcdce220a4946329b2", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Ergative Absolutive", "question_author_url": "https://stats.stackexchange.com/users/516278/ergative-absolutive", "question_author_user_type": "registered", "question_created_at": "2026-09-04T10:12:49+00:00", "question_html": "

I'm trying to get my head around how a negative result from Cronbach's alpha is even mathematically possible. When I look at the formula, it's defined entirely in terms of variances of the individual items (the following from wikipedia):

\n

$$\n{\\displaystyle \\alpha ={k \\over k-1}\\left(1-{\\sum _{i=1}^{k}\\sigma _{y_{i}}^{2} \\over \\sigma _{X}^{2}}\\right)}\n$$

\n

where:

\n\n

It should not be possible for those variance terms to be negative. Variances can't be negative. They're derived from sums of squares, which are always positive, because you square the deviances before summing them. (mathematically, if the summed individual item variances were larger than the variance of the entire data set, then the ratio would be larger than 1, so subtracting that ratio from 1 would be negative. But is that even possible in a data set, that the summed variances of its subparts end up greater than the variance of the whole? That smells fishy to me, although I can't produce a proof that it's impossible.)

\n

However, all the questions I see here about negative Cronbach's alpha have answers to the effect of 'your response scales need to be adjusted', and they often implicate covariances, not variances. Covariances can be negative, sure. But I don't see where covariances feature in the Cronbach's alpha formula.

\n

Can someone please explain, mathematically, how a negative Cronbach's alpha might be calculated based on the formula? Not the real-world situation that can give rise to it -- I understand that conceptually -- but the actual calculation steps that produce it?

\n", "question_id": 677066, "question_license": "CC BY-SA 4.0", "question_score": 7, "question_text": "I'm trying to get my head around how a negative result from Cronbach's alpha is even mathematically possible. When I look at the formula, it's defined entirely in terms of variances of the individual items (the following from wikipedia):\n\n\n\n\n$$\n{\\displaystyle \\alpha ={k \\over k-1}\\left(1-{\\sum _{i=1}^{k}\\sigma _{y_{i}}^{2} \\over \\sigma _{X}^{2}}\\right)}\n$$\n\n\n\n\nwhere:\n\n\n\n\n\n${\\displaystyle k}$ represents the number of \"parts\" (items, test parts, etc.) in the measure;\n\n\n\n\nthe ${\\displaystyle k/(k-1)}$ term causes alpha to be an unbiased estimate of reliability when the parts are parallel or essentially tau equivalent;\n\n\n\n\n${\\displaystyle \\sigma _{y_{i}}^{2}}$ the variance associated with each part i;\n\n\n\n\nand ${\\displaystyle \\sigma _{X}^{2}}$ the observed score variance (the\nvariance associated with the total test scores).\n\n\n\n\n\nIt should not be possible for those variance terms to be negative. Variances can't be negative. They're derived from sums of squares, which are always positive, because you square the deviances before summing them. (mathematically, if the summed individual item variances were larger than the variance of the entire data set, then the ratio would be larger than 1, so subtracting that ratio from 1 would be negative. But is that even possible in a data set, that the summed variances of its subparts end up greater than the variance of the whole? That smells fishy to me, although I can't produce a proof that it's impossible.)\n\n\n\n\nHowever, all the questions I see here about negative Cronbach's alpha have answers to the effect of 'your response scales need to be adjusted', and they often implicate covariances, not variances. Covariances can be negative, sure. But I don't see where covariances feature in the Cronbach's alpha formula.\n\n\n\n\nCan someone please explain, mathematically, how a negative Cronbach's alpha might be calculated based on the formula? Not the real-world situation that can give rise to it -- I understand that conceptually -- but the actual calculation steps that produce it?", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ergative Absolutive", "profile_url": "https://stats.stackexchange.com/users/516278/ergative-absolutive", "user_type": "registered"}, "created_at": "2026-09-04T10:12:49+00:00", "raw_file": "raw/codex_api_v1/64ee278f47b21ead17c9e9fc156835d607f15cff0518af0117a527463a68df8a_1790825256327661600_0.json", "raw_sha256": "18d894000304f6d836d0b21a9f2f35d37c183b3d25e32a897338c6dff012df04", "revision_guid": "23657ED0-0F1D-4E6A-8A86-F2B020D31472", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/23657ED0-0F1D-4E6A-8A86-F2B020D31472/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-09-04T18:13:09+00:00", "raw_file": "raw/codex_api_v1/64ee278f47b21ead17c9e9fc156835d607f15cff0518af0117a527463a68df8a_1790825256327661600_0.json", "raw_sha256": "18d894000304f6d836d0b21a9f2f35d37c183b3d25e32a897338c6dff012df04", "revision_guid": "BCD1B720-C749-4466-9063-A77290447A49", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/BCD1B720-C749-4466-9063-A77290447A49/view-source"}], "source_site": "stats", "source_url": "https://stats.stackexchange.com/questions/677066/cronbachs-alpha-variance-vs-covariance-and-how-are-negative-values-mathemati", "split": "train", "split_group": "b86b633f37a97a115e7f9ffb39a30158c2c1d60a4110ad06762af38037188b3a", "tags": ["cronbachs-alpha"], "thread_id": "stats:677066", "title": "Cronbach's alpha, variance vs. covariance, and how are negative values mathematically possible?"}} {"accepted_status": [false, false, true, false], "candidate_answers": [{"answer_html": "

I think that my colleague was right. However, even Brunner's book does not address this issue, so I wrote the following proof:

\n

Theorem: Suppose that $X_1\\sim X_2+\\delta$, then\n$$p=1/2\\Leftrightarrow \\delta=0.$$

\n

Proof: Set $X_1-X_2=D+\\delta$, then\n$$p=P(X_1<X_2)+\\frac{1}{2}P(X_1=X_2)=P(D<\\delta)+\\frac{1}{2}P(D=\\delta)=F(\\delta),$$\nwhere $F$ is the CDF of $D$. That being said, the Theorem follows from the following Proposition:

\n

Proposition:\nLet $Y_1$ and $Y_2$ be iid, $D:=Y_1-Y_2$ and $F$ the CDF of $D$, i.e.,\n$$\\forall x\\in\\mathbb R:F(x)=P(D<x)+\\frac{1}{2}P(D=x).$$\nThen $F(x)=1/2$ if and only if $x=0$.

\n

Proof: Clearly, $F(0)=1/2$. So suppose that $x\\in\\mathbb R$ and $F(x)=1/2$. We want to show that $x=0$. WLOG, suppose that $0\\leq x$ (indeed, $F(-x)=1-F(x)=1/2$, see the Lemmas further below). Then\n$$0=F(x)-F(0)=P(0<D<x)+\\frac{1}{2}(P(D=0)+P(D=x))$$\nand hence $P(0\\leq D\\leq x)$. By symmetry, $P(-|x|\\leq D\\leq +|x|)=0$. But this is equivalent to $x=0$: Indeed, if $x\\neq 0$, then $|x|>0$ and there must exists an interval $I$ with $|I|=2|x|$ such that $P(Y_i\\in I)>0$. But then\n$$P(-|x|\\leq D\\leq +|x|)=P(|Y_1-Y_2|\\leq 2|x|)\\geq P(Y_1\\in I,Y_2\\in I)=P(Y\\in I)^2>0.$$

\n
\n

Lemma 1: If $Y_1$ and $Y_2$ are iid, then $D:=Y_1-Y_2$ is symmetric, i.e., $D$ and $-D$ have the same distribution: Indeed, this follows from the fact that $(Y_1,Y_2)\\sim (Y_2,Y_1)$.

\n

Lemma 2: Let $X\\sim F$ and $X\\sim -X$, then $\\forall x: F(-x)=1-F(x)$:\n$$F(-x)=P(X<-x)+\\frac{1}{2}P(X=-x)=P(x<X)+\\frac{1}{2}P(X=x)=1-P(X<x)-P(X=x)+\\frac{1}{2}P(X=x)=1-F(x)$$

\n", "answer_id": 677072, "answer_text": "I think that my colleague was right. However, even Brunner's book (https://doi.org/10.1007/978-3-030-02914-2) does not address this issue, so I wrote the following proof:\n\n\n\n\nTheorem: Suppose that $X_1\\sim X_2+\\delta$, then\n$$p=1/2\\Leftrightarrow \\delta=0.$$\n\n\n\n\nProof: Set $X_1-X_2=D+\\delta$, then\n$$p=P(X_10$ and there must exists an interval $I$ with $|I|=2|x|$ such that $P(Y_i\\in I)>0$. But then\n$$P(-|x|\\leq D\\leq +|x|)=P(|Y_1-Y_2|\\leq 2|x|)\\geq P(Y_1\\in I,Y_2\\in I)=P(Y\\in I)^2>0.$$\n\n\n\n\n\n\n\nLemma 1: If $Y_1$ and $Y_2$ are iid, then $D:=Y_1-Y_2$ is symmetric, i.e., $D$ and $-D$ have the same distribution: Indeed, this follows from the fact that $(Y_1,Y_2)\\sim (Y_2,Y_1)$.\n\n\n\n\nLemma 2: Let $X\\sim F$ and $X\\sim -X$, then $\\forall x: F(-x)=1-F(x)$:\n$$F(-x)=P(X<-x)+\\frac{1}{2}P(X=-x)=P(xThe Mann-Whitney U test (MWUt) tests stochastic homogeneity (also sometimes called stochastic equality). The alternative hypothesis being stochastic superiority. After all, Mann & Whitney titled their paper

\n
\n

Mann, H. B., Whitney, D. R. (1947) “On a test of whether one of two\nrandom variables is stochastically larger than the other”

\n
\n

The MWUt is consistent (i.e. “the outcome of the procedure converges to the correct outcome as sample size goes to infinity”) only under the following null hypothesis\n$$p=P(X_1<X_2)+\\frac{1}{2}P(X_1=X_2) = 0.5$$\nWhich can also be written as\n$$P(X_1<X_2) = P(X_2<X_1)$$ (ignoring the “ties”)

\n

That null is true under only 2 scenarios;

\n
    \n
  1. the 2 samples come from the exact same distribution (i.e. $F_1=F_2$); all moments, including mean, are the same, or
  2. \n
  3. the 2 samples come from symmetric, but possibly different, distributions, symmetric around the same median (and hence mean).
  4. \n
\n

These are the only 2 cases where there is no stochastic ordering; otherwise, one distribution is stochastically superior to the other, and the rejection rate will increase with sample size, as it should.\\

\n

So, if you assume that $\\exists \\delta:\\forall x:F_2(x)=F_1(x+\\delta)$, then indeed $\\delta = 0$ and $p=1/2$ are equivalent.

\n

However, this assumption is a very bold assumption, and the MWUt is absolutely not robust to departures from this assumption.\nMoreover, you could get $p=1/2$ w/o a shift model, e.g. in the case of 2 symmetric distributions around the same mean/median (e.g. $N(0,1)$ and $Unif(-1,1)$). You will have $p=1/2$, but you certainly will not have $F_2(x)=F_1(x+\\delta)$.

\n

So, in general, the null hypothesis of the MWUt is not $F_1=F_2$ (it is instead $p=1/2$). It can become $F_1=F_2$ if you can rule out symmetry of at least one of the 2 distributions. And the location shift assumption is so unlikely (and the test not robust to it) as to invalidate any results based on it.

\n

Last, even if the MWUt could be used as a test of $F_1=F_2$, what would you do if you have a significant result? So what if $F_1 \\ne F_2$? Which is the "best", which decision do you make? Whereas knowing which distribution is stochastically superior is useful, and has practical implications (a randomly selected observation from one distribution is more likely than not to be greater than a randomnly selected observation from the other). By contrast, knowing that the 2 distributions are not identical is not actionable. So even if one could find assumptions under which that null was valid, it would be of no practical value...

\n", "answer_id": 677073, "answer_text": "The Mann-Whitney U test (MWUt) tests stochastic homogeneity (also sometimes called stochastic equality). The alternative hypothesis being stochastic superiority. After all, Mann & Whitney titled their paper\n\n\n\n\n\n\n\nMann, H. B., Whitney, D. R. (1947) “On a test of whether one of two\nrandom variables is stochastically larger than the other”\n\n\n\n\n\n\n\nThe MWUt is consistent (i.e. “the outcome of the procedure converges to the correct outcome as sample size goes to infinity (https://en.wikipedia.org/wiki/Consistency_(statistics))”) only under the following null hypothesis\n$$p=P(X_1Yes, that equivalence holds\n

From the definition of $p$ we have:

\n

$$\\begin{align}\np\n&= \\mathbb{P}(X_1<X_2) + \\frac{1}{2} \\cdot \\mathbb{P}(X_1=X_2), \\\\[6pt]\n1-p\n&= \\mathbb{P}(X_1>X_2) + \\frac{1}{2} \\cdot \\mathbb{P}(X_1=X_2). \\\\[6pt]\n\\end{align}$$

\n

Consequently, we have:

\n

$$1-2p = (1-p) - p = \\mathbb{P}(X_1>X_2) - \\mathbb{P}(X_1<X_2),$$

\n

which implies that:

\n

$$p = \\tfrac{1}{2}\n\\quad \\quad \\iff \\quad \\quad \n1-2p=0\n\\quad \\quad \\iff \\quad \\quad \n\\mathbb{P}(X_1>X_2) = \\mathbb{P}(X_1<X_2).$$

\n

Since the distributions of $X_1$ and $X_2$ vary only by a location shift, it is also simple to establish (see below) that:

\n

$$\\delta = 0\n\\quad \\quad \\iff \\quad \\quad \n\\mathbb{P}(X_1>X_2) = \\mathbb{P}(X_1<X_2).$$

\n

Consequently, the equivalence between $p=\\tfrac{1}{2}$ and $\\delta=0$ holds.

\n
\n

Proving the latter equivalence: Since $X_1$ and $X_2$ are independent we have:

\n

$$\\begin{align}\n\\mathbb{P}(X_1 < X_2) \n&= 1- \\int \\limits_0^\\infty F_2(x) \\ dF_1(x) \\\\[6pt]\n&= 1- \\int \\limits_0^\\infty F_2(x) \\ dF_2(x-\\delta) \\\\[6pt]\n&= 1- \\int \\limits_0^\\infty F_2(x+\\delta) \\ dF_2(x), \\\\[6pt]\n\\mathbb{P}(X_1 > X_2) \n&= 1- \\int \\limits_0^\\infty F_1(x) dF_2(x) \\\\[6pt]\n&= 1- \\int \\limits_0^\\infty F_2(x-\\delta) dF_2(x), \\\\[6pt]\n\\end{align}$$

\n

which gives:

\n

$$\\mathbb{P}(X_1>X_2) - \\mathbb{P}(X_1<X_2)\n= \\int \\limits_0^\\infty [ F_2(x-\\delta) - F_2(x+\\delta)] \\ dF_2(x).$$

\n

The integrand is zero when $\\delta=0$ and is non-negative or non-positive if $\\delta \\neq 0$. If $\\delta=0$ then we obtain $\\mathbb{P}(X_1>X_2) = \\mathbb{P}(X_1<X_2)$ directly. If $\\mathbb{P}(X_1>X_2) = \\mathbb{P}(X_1<X_2)$ then the integrand in the above expression must be zero almost surely over the range of integration, which can only occur if $\\delta=0$.

\n", "answer_id": 677074, "answer_text": "Yes, that equivalence holds\n\n\n\n\nFrom the definition of $p$ we have:\n\n\n\n\n$$\\begin{align}\np\n&= \\mathbb{P}(X_1X_2) + \\frac{1}{2} \\cdot \\mathbb{P}(X_1=X_2). \\\\[6pt]\n\\end{align}$$\n\n\n\n\nConsequently, we have:\n\n\n\n\n$$1-2p = (1-p) - p = \\mathbb{P}(X_1>X_2) - \\mathbb{P}(X_1X_2) = \\mathbb{P}(X_1X_2) = \\mathbb{P}(X_1 X_2) \n&= 1- \\int \\limits_0^\\infty F_1(x) dF_2(x) \\\\[6pt]\n&= 1- \\int \\limits_0^\\infty F_2(x-\\delta) dF_2(x), \\\\[6pt]\n\\end{align}$$\n\n\n\n\nwhich gives:\n\n\n\n\n$$\\mathbb{P}(X_1>X_2) - \\mathbb{P}(X_1X_2) = \\mathbb{P}(X_1X_2) = \\mathbb{P}(X_1There are good answers to the main point as the question now stands. Here I will address where restriction to a location-shift alternative (on the observed variable) may make sense, or might not.

\n
    \n
  1. A continuous variable defined over $\\mathbb{R}$. There's no immediate issue there, and I think pure shift alternatives may make sense in some applications (at least as approximate descriptions).

    \n
  2. \n
  3. A continous variable with a lower bound (e.g. a variate with support on $\\mathbb{R}^+$) or with an upper bound, or both. Here the support shifts. For example, if a variate has some lowest possible value then either you must assume only positive shifts are possible or that there is no possibility of any values larger than an allowed left shift can occur (i.e. you need to begin by positing that the actual support of the unshifted variable is different from the stated support). Otherwise you can't make $F$'s correspond in the stated fashion.

    \n

    For most continuous distributions with a bound that are in common use, and also with many real world variables, the idea of a pure location shift doesn't really work - but the Mann-Whitney works fine beyond that case. Indeed they state in the 1947 paper "The test is shown to be consistent with respect to the class of alternatives $f(x)>g(x)$ for every $x$" where here $f$ and $g$ have been defined to be continuous cdfs (side note: $f>g$ means values drawn from $f$ tend to be smaller). It would be consistent for a somewhat broader class of alternatives but I don't want to head off on a side issue just now.

    \n

    For many continuous variables on $\\mathbb{R}^+$ a scale shift alternative would make more sense, and for many variables on a bounded interval, a change of shape is to be expected (if the actual and stated support correspond it's going to be hard to avoid it).

    \n
  4. \n
  5. A discrete random variate with support on a lattice. Here only shifts of multiples of the lattice interval (that also respect any bounds) are possible (unless we also shift the support by $\\delta$, of course, but this rarely makes sense).

    \n
  6. \n
  7. A discrete random variate with support on a countable set that is not on a lattice (e.g. imagine a test where we have applied a square-root transformation to a count). Here it doesn't seem to work at all without changing the support.

    \n
  8. \n
  9. An ordinal variable*. Now we have a problem of even defining an $F$, but let us assume we can define some set of (unknown, not equally-spaced) values or intervals between them on which it has support, where we have then given the unknown values or intervals arbitrary (but order-preserving) labels. This situation has all the difficulties of case 4 but worse - here we can't define a shift of $\\delta$ on the labels that makes sense, and we don't have access to the unknown values they stand for, but if we could solve that, we still have the issue with the support we had in point 4.

    \n
  10. \n
\n
\n

* The original question posited an ordinal variable. It doesn't do so now (to the better, since case 5 is problematic), but I leave discussion of this case in my answer because it seems to be a very common situation for people to use the Wilcoxon-Mann-Whitney test on ordinal responses and then very often talk about (or at least imply at some point) a location shift alternative.

\n", "answer_id": 677076, "answer_text": "There are good answers to the main point as the question now stands. Here I will address where restriction to a location-shift alternative (on the observed variable) may make sense, or might not.\n\n\n\n\n\n\n\nA continuous variable defined over $\\mathbb{R}$. There's no immediate issue there, and I think pure shift alternatives may make sense in some applications (at least as approximate descriptions).\n\n\n\n\n\n\n\n\n\nA continous variable with a lower bound (e.g. a variate with support on $\\mathbb{R}^+$) or with an upper bound, or both. Here the support shifts. For example, if a variate has some lowest possible value then either you must assume only positive shifts are possible or that there is no possibility of any values larger than an allowed left shift can occur (i.e. you need to begin by positing that the actual support of the unshifted variable is different from the stated support). Otherwise you can't make $F$'s correspond in the stated fashion.\n\n\n\n\nFor most continuous distributions with a bound that are in common use, and also with many real world variables, the idea of a pure location shift doesn't really work - but the Mann-Whitney works fine beyond that case. Indeed they state in the 1947 paper \"The test is shown to be consistent with respect to the class of alternatives $f(x)>g(x)$ for every $x$\" where here $f$ and $g$ have been defined to be continuous cdfs (side note: $f>g$ means values drawn from $f$ tend to be smaller). It would be consistent for a somewhat broader class of alternatives but I don't want to head off on a side issue just now.\n\n\n\n\nFor many continuous variables on $\\mathbb{R}^+$ a scale shift alternative would make more sense, and for many variables on a bounded interval, a change of shape is to be expected (if the actual and stated support correspond it's going to be hard to avoid it).\n\n\n\n\n\n\n\n\n\nA discrete random variate with support on a lattice. Here only shifts of multiples of the lattice interval (that also respect any bounds) are possible (unless we also shift the support by $\\delta$, of course, but this rarely makes sense).\n\n\n\n\n\n\n\n\n\nA discrete random variate with support on a countable set that is not on a lattice (e.g. imagine a test where we have applied a square-root transformation to a count). Here it doesn't seem to work at all without changing the support.\n\n\n\n\n\n\n\n\n\nAn ordinal variable*. Now we have a problem of even defining an $F$, but let us assume we can define some set of (unknown, not equally-spaced) values or intervals between them on which it has support, where we have then given the unknown values or intervals arbitrary (but order-preserving) labels. This situation has all the difficulties of case 4 but worse - here we can't define a shift of $\\delta$ on the labels that makes sense, and we don't have access to the unknown values they stand for, but if we could solve that, we still have the issue with the support we had in point 4.\n\n\n\n\n\n\n\n\n\n\n\n* The original question posited an ordinal variable. It doesn't do so now (to the better, since case 5 is problematic), but I leave discussion of this case in my answer because it seems to be a very common situation for people to use the Wilcoxon-Mann-Whitney test on ordinal responses and then very often talk about (or at least imply at some point) a location shift alternative.", "answer_url": "https://stats.stackexchange.com/a/677076", "author": "Glen_b", "author_url": "https://stats.stackexchange.com/users/805/glen-b", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-05T02:08:47+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677071, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-05T02:08:47+00:00", "raw_file": "raw/codex_api_v1/64ee278f47b21ead17c9e9fc156835d607f15cff0518af0117a527463a68df8a_1790825256327661600_0.json", "raw_sha256": "18d894000304f6d836d0b21a9f2f35d37c183b3d25e32a897338c6dff012df04", "revision_guid": "19744E33-32C1-42E6-8B19-EF45E4EFB08C", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/19744E33-32C1-42E6-8B19-EF45E4EFB08C/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-05T02:15:47+00:00", "raw_file": "raw/codex_api_v1/64ee278f47b21ead17c9e9fc156835d607f15cff0518af0117a527463a68df8a_1790825256327661600_0.json", "raw_sha256": "18d894000304f6d836d0b21a9f2f35d37c183b3d25e32a897338c6dff012df04", "revision_guid": "CF826F38-A814-44FE-98C7-7558264B9395", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/CF826F38-A814-44FE-98C7-7558264B9395/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-05T09:13:58+00:00", "raw_file": "raw/codex_api_v1/64ee278f47b21ead17c9e9fc156835d607f15cff0518af0117a527463a68df8a_1790825256327661600_0.json", "raw_sha256": "18d894000304f6d836d0b21a9f2f35d37c183b3d25e32a897338c6dff012df04", "revision_guid": "3504ADB8-E74F-4904-A022-B3D8AF1388A2", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/3504ADB8-E74F-4904-A022-B3D8AF1388A2/view-source"}], "score": 4, "updated_at": "2026-09-05T09:13:58+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "Suppose that $X_1$ and $X_2$ are real-valued random variables and $X_i\\sim F_i$, i.e., $F_i$ is the CDF of $X_i$. Furthermore, assume the Location shift model:\n$$\\exists \\delta:\\forall x:F_2(x)=F_1(x+\\delta)$$\nFinally, consider the probabilistic index\n$$p=P(X_1I think that my colleague was right. However, even Brunner's book does not address this issue, so I wrote the following proof:

\n

Theorem: Suppose that $X_1\\sim X_2+\\delta$, then\n$$p=1/2\\Leftrightarrow \\delta=0.$$

\n

Proof: Set $X_1-X_2=D+\\delta$, then\n$$p=P(X_1<X_2)+\\frac{1}{2}P(X_1=X_2)=P(D<\\delta)+\\frac{1}{2}P(D=\\delta)=F(\\delta),$$\nwhere $F$ is the CDF of $D$. That being said, the Theorem follows from the following Proposition:

\n

Proposition:\nLet $Y_1$ and $Y_2$ be iid, $D:=Y_1-Y_2$ and $F$ the CDF of $D$, i.e.,\n$$\\forall x\\in\\mathbb R:F(x)=P(D<x)+\\frac{1}{2}P(D=x).$$\nThen $F(x)=1/2$ if and only if $x=0$.

\n

Proof: Clearly, $F(0)=1/2$. So suppose that $x\\in\\mathbb R$ and $F(x)=1/2$. We want to show that $x=0$. WLOG, suppose that $0\\leq x$ (indeed, $F(-x)=1-F(x)=1/2$, see the Lemmas further below). Then\n$$0=F(x)-F(0)=P(0<D<x)+\\frac{1}{2}(P(D=0)+P(D=x))$$\nand hence $P(0\\leq D\\leq x)$. By symmetry, $P(-|x|\\leq D\\leq +|x|)=0$. But this is equivalent to $x=0$: Indeed, if $x\\neq 0$, then $|x|>0$ and there must exists an interval $I$ with $|I|=2|x|$ such that $P(Y_i\\in I)>0$. But then\n$$P(-|x|\\leq D\\leq +|x|)=P(|Y_1-Y_2|\\leq 2|x|)\\geq P(Y_1\\in I,Y_2\\in I)=P(Y\\in I)^2>0.$$

\n
\n

Lemma 1: If $Y_1$ and $Y_2$ are iid, then $D:=Y_1-Y_2$ is symmetric, i.e., $D$ and $-D$ have the same distribution: Indeed, this follows from the fact that $(Y_1,Y_2)\\sim (Y_2,Y_1)$.

\n

Lemma 2: Let $X\\sim F$ and $X\\sim -X$, then $\\forall x: F(-x)=1-F(x)$:\n$$F(-x)=P(X<-x)+\\frac{1}{2}P(X=-x)=P(x<X)+\\frac{1}{2}P(X=x)=1-P(X<x)-P(X=x)+\\frac{1}{2}P(X=x)=1-F(x)$$

\n", "answer_id": 677072, "answer_text": "I think that my colleague was right. However, even Brunner's book (https://doi.org/10.1007/978-3-030-02914-2) does not address this issue, so I wrote the following proof:\n\n\n\n\nTheorem: Suppose that $X_1\\sim X_2+\\delta$, then\n$$p=1/2\\Leftrightarrow \\delta=0.$$\n\n\n\n\nProof: Set $X_1-X_2=D+\\delta$, then\n$$p=P(X_10$ and there must exists an interval $I$ with $|I|=2|x|$ such that $P(Y_i\\in I)>0$. But then\n$$P(-|x|\\leq D\\leq +|x|)=P(|Y_1-Y_2|\\leq 2|x|)\\geq P(Y_1\\in I,Y_2\\in I)=P(Y\\in I)^2>0.$$\n\n\n\n\n\n\n\nLemma 1: If $Y_1$ and $Y_2$ are iid, then $D:=Y_1-Y_2$ is symmetric, i.e., $D$ and $-D$ have the same distribution: Indeed, this follows from the fact that $(Y_1,Y_2)\\sim (Y_2,Y_1)$.\n\n\n\n\nLemma 2: Let $X\\sim F$ and $X\\sim -X$, then $\\forall x: F(-x)=1-F(x)$:\n$$F(-x)=P(X<-x)+\\frac{1}{2}P(X=-x)=P(xThe Mann-Whitney U test (MWUt) tests stochastic homogeneity (also sometimes called stochastic equality). The alternative hypothesis being stochastic superiority. After all, Mann & Whitney titled their paper

\n
\n

Mann, H. B., Whitney, D. R. (1947) “On a test of whether one of two\nrandom variables is stochastically larger than the other”

\n
\n

The MWUt is consistent (i.e. “the outcome of the procedure converges to the correct outcome as sample size goes to infinity”) only under the following null hypothesis\n$$p=P(X_1<X_2)+\\frac{1}{2}P(X_1=X_2) = 0.5$$\nWhich can also be written as\n$$P(X_1<X_2) = P(X_2<X_1)$$ (ignoring the “ties”)

\n

That null is true under only 2 scenarios;

\n
    \n
  1. the 2 samples come from the exact same distribution (i.e. $F_1=F_2$); all moments, including mean, are the same, or
  2. \n
  3. the 2 samples come from symmetric, but possibly different, distributions, symmetric around the same median (and hence mean).
  4. \n
\n

These are the only 2 cases where there is no stochastic ordering; otherwise, one distribution is stochastically superior to the other, and the rejection rate will increase with sample size, as it should.\\

\n

So, if you assume that $\\exists \\delta:\\forall x:F_2(x)=F_1(x+\\delta)$, then indeed $\\delta = 0$ and $p=1/2$ are equivalent.

\n

However, this assumption is a very bold assumption, and the MWUt is absolutely not robust to departures from this assumption.\nMoreover, you could get $p=1/2$ w/o a shift model, e.g. in the case of 2 symmetric distributions around the same mean/median (e.g. $N(0,1)$ and $Unif(-1,1)$). You will have $p=1/2$, but you certainly will not have $F_2(x)=F_1(x+\\delta)$.

\n

So, in general, the null hypothesis of the MWUt is not $F_1=F_2$ (it is instead $p=1/2$). It can become $F_1=F_2$ if you can rule out symmetry of at least one of the 2 distributions. And the location shift assumption is so unlikely (and the test not robust to it) as to invalidate any results based on it.

\n

Last, even if the MWUt could be used as a test of $F_1=F_2$, what would you do if you have a significant result? So what if $F_1 \\ne F_2$? Which is the "best", which decision do you make? Whereas knowing which distribution is stochastically superior is useful, and has practical implications (a randomly selected observation from one distribution is more likely than not to be greater than a randomnly selected observation from the other). By contrast, knowing that the 2 distributions are not identical is not actionable. So even if one could find assumptions under which that null was valid, it would be of no practical value...

\n", "answer_id": 677073, "answer_text": "The Mann-Whitney U test (MWUt) tests stochastic homogeneity (also sometimes called stochastic equality). The alternative hypothesis being stochastic superiority. After all, Mann & Whitney titled their paper\n\n\n\n\n\n\n\nMann, H. B., Whitney, D. R. (1947) “On a test of whether one of two\nrandom variables is stochastically larger than the other”\n\n\n\n\n\n\n\nThe MWUt is consistent (i.e. “the outcome of the procedure converges to the correct outcome as sample size goes to infinity (https://en.wikipedia.org/wiki/Consistency_(statistics))”) only under the following null hypothesis\n$$p=P(X_1Yes, that equivalence holds\n

From the definition of $p$ we have:

\n

$$\\begin{align}\np\n&= \\mathbb{P}(X_1<X_2) + \\frac{1}{2} \\cdot \\mathbb{P}(X_1=X_2), \\\\[6pt]\n1-p\n&= \\mathbb{P}(X_1>X_2) + \\frac{1}{2} \\cdot \\mathbb{P}(X_1=X_2). \\\\[6pt]\n\\end{align}$$

\n

Consequently, we have:

\n

$$1-2p = (1-p) - p = \\mathbb{P}(X_1>X_2) - \\mathbb{P}(X_1<X_2),$$

\n

which implies that:

\n

$$p = \\tfrac{1}{2}\n\\quad \\quad \\iff \\quad \\quad \n1-2p=0\n\\quad \\quad \\iff \\quad \\quad \n\\mathbb{P}(X_1>X_2) = \\mathbb{P}(X_1<X_2).$$

\n

Since the distributions of $X_1$ and $X_2$ vary only by a location shift, it is also simple to establish (see below) that:

\n

$$\\delta = 0\n\\quad \\quad \\iff \\quad \\quad \n\\mathbb{P}(X_1>X_2) = \\mathbb{P}(X_1<X_2).$$

\n

Consequently, the equivalence between $p=\\tfrac{1}{2}$ and $\\delta=0$ holds.

\n
\n

Proving the latter equivalence: Since $X_1$ and $X_2$ are independent we have:

\n

$$\\begin{align}\n\\mathbb{P}(X_1 < X_2) \n&= 1- \\int \\limits_0^\\infty F_2(x) \\ dF_1(x) \\\\[6pt]\n&= 1- \\int \\limits_0^\\infty F_2(x) \\ dF_2(x-\\delta) \\\\[6pt]\n&= 1- \\int \\limits_0^\\infty F_2(x+\\delta) \\ dF_2(x), \\\\[6pt]\n\\mathbb{P}(X_1 > X_2) \n&= 1- \\int \\limits_0^\\infty F_1(x) dF_2(x) \\\\[6pt]\n&= 1- \\int \\limits_0^\\infty F_2(x-\\delta) dF_2(x), \\\\[6pt]\n\\end{align}$$

\n

which gives:

\n

$$\\mathbb{P}(X_1>X_2) - \\mathbb{P}(X_1<X_2)\n= \\int \\limits_0^\\infty [ F_2(x-\\delta) - F_2(x+\\delta)] \\ dF_2(x).$$

\n

The integrand is zero when $\\delta=0$ and is non-negative or non-positive if $\\delta \\neq 0$. If $\\delta=0$ then we obtain $\\mathbb{P}(X_1>X_2) = \\mathbb{P}(X_1<X_2)$ directly. If $\\mathbb{P}(X_1>X_2) = \\mathbb{P}(X_1<X_2)$ then the integrand in the above expression must be zero almost surely over the range of integration, which can only occur if $\\delta=0$.

\n", "answer_id": 677074, "answer_text": "Yes, that equivalence holds\n\n\n\n\nFrom the definition of $p$ we have:\n\n\n\n\n$$\\begin{align}\np\n&= \\mathbb{P}(X_1X_2) + \\frac{1}{2} \\cdot \\mathbb{P}(X_1=X_2). \\\\[6pt]\n\\end{align}$$\n\n\n\n\nConsequently, we have:\n\n\n\n\n$$1-2p = (1-p) - p = \\mathbb{P}(X_1>X_2) - \\mathbb{P}(X_1X_2) = \\mathbb{P}(X_1X_2) = \\mathbb{P}(X_1 X_2) \n&= 1- \\int \\limits_0^\\infty F_1(x) dF_2(x) \\\\[6pt]\n&= 1- \\int \\limits_0^\\infty F_2(x-\\delta) dF_2(x), \\\\[6pt]\n\\end{align}$$\n\n\n\n\nwhich gives:\n\n\n\n\n$$\\mathbb{P}(X_1>X_2) - \\mathbb{P}(X_1X_2) = \\mathbb{P}(X_1X_2) = \\mathbb{P}(X_1There are good answers to the main point as the question now stands. Here I will address where restriction to a location-shift alternative (on the observed variable) may make sense, or might not.

\n
    \n
  1. A continuous variable defined over $\\mathbb{R}$. There's no immediate issue there, and I think pure shift alternatives may make sense in some applications (at least as approximate descriptions).

    \n
  2. \n
  3. A continous variable with a lower bound (e.g. a variate with support on $\\mathbb{R}^+$) or with an upper bound, or both. Here the support shifts. For example, if a variate has some lowest possible value then either you must assume only positive shifts are possible or that there is no possibility of any values larger than an allowed left shift can occur (i.e. you need to begin by positing that the actual support of the unshifted variable is different from the stated support). Otherwise you can't make $F$'s correspond in the stated fashion.

    \n

    For most continuous distributions with a bound that are in common use, and also with many real world variables, the idea of a pure location shift doesn't really work - but the Mann-Whitney works fine beyond that case. Indeed they state in the 1947 paper "The test is shown to be consistent with respect to the class of alternatives $f(x)>g(x)$ for every $x$" where here $f$ and $g$ have been defined to be continuous cdfs (side note: $f>g$ means values drawn from $f$ tend to be smaller). It would be consistent for a somewhat broader class of alternatives but I don't want to head off on a side issue just now.

    \n

    For many continuous variables on $\\mathbb{R}^+$ a scale shift alternative would make more sense, and for many variables on a bounded interval, a change of shape is to be expected (if the actual and stated support correspond it's going to be hard to avoid it).

    \n
  4. \n
  5. A discrete random variate with support on a lattice. Here only shifts of multiples of the lattice interval (that also respect any bounds) are possible (unless we also shift the support by $\\delta$, of course, but this rarely makes sense).

    \n
  6. \n
  7. A discrete random variate with support on a countable set that is not on a lattice (e.g. imagine a test where we have applied a square-root transformation to a count). Here it doesn't seem to work at all without changing the support.

    \n
  8. \n
  9. An ordinal variable*. Now we have a problem of even defining an $F$, but let us assume we can define some set of (unknown, not equally-spaced) values or intervals between them on which it has support, where we have then given the unknown values or intervals arbitrary (but order-preserving) labels. This situation has all the difficulties of case 4 but worse - here we can't define a shift of $\\delta$ on the labels that makes sense, and we don't have access to the unknown values they stand for, but if we could solve that, we still have the issue with the support we had in point 4.

    \n
  10. \n
\n
\n

* The original question posited an ordinal variable. It doesn't do so now (to the better, since case 5 is problematic), but I leave discussion of this case in my answer because it seems to be a very common situation for people to use the Wilcoxon-Mann-Whitney test on ordinal responses and then very often talk about (or at least imply at some point) a location shift alternative.

\n", "answer_id": 677076, "answer_text": "There are good answers to the main point as the question now stands. Here I will address where restriction to a location-shift alternative (on the observed variable) may make sense, or might not.\n\n\n\n\n\n\n\nA continuous variable defined over $\\mathbb{R}$. There's no immediate issue there, and I think pure shift alternatives may make sense in some applications (at least as approximate descriptions).\n\n\n\n\n\n\n\n\n\nA continous variable with a lower bound (e.g. a variate with support on $\\mathbb{R}^+$) or with an upper bound, or both. Here the support shifts. For example, if a variate has some lowest possible value then either you must assume only positive shifts are possible or that there is no possibility of any values larger than an allowed left shift can occur (i.e. you need to begin by positing that the actual support of the unshifted variable is different from the stated support). Otherwise you can't make $F$'s correspond in the stated fashion.\n\n\n\n\nFor most continuous distributions with a bound that are in common use, and also with many real world variables, the idea of a pure location shift doesn't really work - but the Mann-Whitney works fine beyond that case. Indeed they state in the 1947 paper \"The test is shown to be consistent with respect to the class of alternatives $f(x)>g(x)$ for every $x$\" where here $f$ and $g$ have been defined to be continuous cdfs (side note: $f>g$ means values drawn from $f$ tend to be smaller). It would be consistent for a somewhat broader class of alternatives but I don't want to head off on a side issue just now.\n\n\n\n\nFor many continuous variables on $\\mathbb{R}^+$ a scale shift alternative would make more sense, and for many variables on a bounded interval, a change of shape is to be expected (if the actual and stated support correspond it's going to be hard to avoid it).\n\n\n\n\n\n\n\n\n\nA discrete random variate with support on a lattice. Here only shifts of multiples of the lattice interval (that also respect any bounds) are possible (unless we also shift the support by $\\delta$, of course, but this rarely makes sense).\n\n\n\n\n\n\n\n\n\nA discrete random variate with support on a countable set that is not on a lattice (e.g. imagine a test where we have applied a square-root transformation to a count). Here it doesn't seem to work at all without changing the support.\n\n\n\n\n\n\n\n\n\nAn ordinal variable*. Now we have a problem of even defining an $F$, but let us assume we can define some set of (unknown, not equally-spaced) values or intervals between them on which it has support, where we have then given the unknown values or intervals arbitrary (but order-preserving) labels. This situation has all the difficulties of case 4 but worse - here we can't define a shift of $\\delta$ on the labels that makes sense, and we don't have access to the unknown values they stand for, but if we could solve that, we still have the issue with the support we had in point 4.\n\n\n\n\n\n\n\n\n\n\n\n* The original question posited an ordinal variable. It doesn't do so now (to the better, since case 5 is problematic), but I leave discussion of this case in my answer because it seems to be a very common situation for people to use the Wilcoxon-Mann-Whitney test on ordinal responses and then very often talk about (or at least imply at some point) a location shift alternative.", "answer_url": "https://stats.stackexchange.com/a/677076", "author": "Glen_b", "author_url": "https://stats.stackexchange.com/users/805/glen-b", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-05T02:08:47+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677071, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-05T02:08:47+00:00", "raw_file": "raw/codex_api_v1/64ee278f47b21ead17c9e9fc156835d607f15cff0518af0117a527463a68df8a_1790825256327661600_0.json", "raw_sha256": "18d894000304f6d836d0b21a9f2f35d37c183b3d25e32a897338c6dff012df04", "revision_guid": "19744E33-32C1-42E6-8B19-EF45E4EFB08C", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/19744E33-32C1-42E6-8B19-EF45E4EFB08C/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-05T02:15:47+00:00", "raw_file": "raw/codex_api_v1/64ee278f47b21ead17c9e9fc156835d607f15cff0518af0117a527463a68df8a_1790825256327661600_0.json", "raw_sha256": "18d894000304f6d836d0b21a9f2f35d37c183b3d25e32a897338c6dff012df04", "revision_guid": "CF826F38-A814-44FE-98C7-7558264B9395", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/CF826F38-A814-44FE-98C7-7558264B9395/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-05T09:13:58+00:00", "raw_file": "raw/codex_api_v1/64ee278f47b21ead17c9e9fc156835d607f15cff0518af0117a527463a68df8a_1790825256327661600_0.json", "raw_sha256": "18d894000304f6d836d0b21a9f2f35d37c183b3d25e32a897338c6dff012df04", "revision_guid": "3504ADB8-E74F-4904-A022-B3D8AF1388A2", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/3504ADB8-E74F-4904-A022-B3D8AF1388A2/view-source"}], "score": 4, "updated_at": "2026-09-05T09:13:58+00:00"}], "domain": "statistics", "external_links": ["https://doi.org/10.1007/978-3-030-02914-2", "https://en.wikipedia.org/wiki/Consistency_(statistics"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:03.428408+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/774052c18cd9e8fa951e893347bfa3c1a85e743fc46ec4667572002cadb10cbf_1790825224163423600_0.json", "raw_sha256": "fe4dd06d3de6c0b1bb33ba88aee0ed4284118e01f76a58dcdce220a4946329b2", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Filippo", "question_author_url": "https://stats.stackexchange.com/users/461971/filippo", "question_author_user_type": "registered", "question_created_at": "2026-09-04T18:49:42+00:00", "question_html": "

Suppose that $X_1$ and $X_2$ are real-valued random variables and $X_i\\sim F_i$, i.e., $F_i$ is the CDF of $X_i$. Furthermore, assume the Location shift model:\n$$\\exists \\delta:\\forall x:F_2(x)=F_1(x+\\delta)$$\nFinally, consider the probabilistic index\n$$p=P(X_1<X_2)+\\frac{1}{2}P(X_1=X_2).$$\nIs it true that $\\delta = 0$ if and only if $p=1/2$?

\n

Context: This question arose while discussing a statistical analysis plan, a collegue wanted to test the hypothesis $H_0:p=1/2$ using the WMW-test, so I pointed that the WMW-test actually tests the hypothesis $H_0:F_1=F_2$. So my colleague conjectured that the hypotheses are equal under the Location shift model.

\n", "question_id": 677071, "question_license": "CC BY-SA 4.0", "question_score": 5, "question_text": "Suppose that $X_1$ and $X_2$ are real-valued random variables and $X_i\\sim F_i$, i.e., $F_i$ is the CDF of $X_i$. Furthermore, assume the Location shift model:\n$$\\exists \\delta:\\forall x:F_2(x)=F_1(x+\\delta)$$\nFinally, consider the probabilistic index\n$$p=P(X_1Everything is dependent on your second C. Even random things like rolling dice (someone has to roll the dice, if there are no humans, no dice) so that seems a bit overdone.

\n

I guess you could argue that every pair of variables is only conditionally independent, and just seek conditions that are very weak, or easy to meet.

\n

Once you do that, you can have interesting discussions about how to measure the weakness of the condition, and then what variables really are independent.

\n

E.g. The last digit of your phone number and the number of letters in your first name.

\n

But you could also discuss pairs of variables that seem independent (at least conditionally) ut really aren't.

\n

Given that you are teaching this, I think discussions are going to be more valuable than just giving examples.

\n", "answer_id": 677113, "answer_text": "Everything is dependent on your second C. Even random things like rolling dice (someone has to roll the dice, if there are no humans, no dice) so that seems a bit overdone.\n\n\n\n\nI guess you could argue that every pair of variables is only conditionally independent, and just seek conditions that are very weak, or easy to meet.\n\n\n\n\nOnce you do that, you can have interesting discussions about how to measure the weakness of the condition, and then what variables really are independent.\n\n\n\n\nE.g. The last digit of your phone number and the number of letters in your first name.\n\n\n\n\nBut you could also discuss pairs of variables that seem independent (at least conditionally) ut really aren't.\n\n\n\n\nGiven that you are teaching this, I think discussions are going to be more valuable than just giving examples.", "answer_url": "https://stats.stackexchange.com/a/677113", "author": "Peter Flom", "author_url": "https://stats.stackexchange.com/users/686/peter-flom", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-09T11:46:26+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677110, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Peter Flom", "profile_url": "https://stats.stackexchange.com/users/686/peter-flom", "user_type": "registered"}, "created_at": "2026-09-09T11:46:26+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "FCBDA039-4581-4D66-8992-B53869AB3A9C", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/FCBDA039-4581-4D66-8992-B53869AB3A9C/view-source"}, {"content_license": null, "contributor": {"display_name": "whuber", "profile_url": "https://stats.stackexchange.com/users/919/whuber", "user_type": "moderator"}, "created_at": "2026-09-24T15:47:50+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "28B8AA75-8BA8-464B-97B6-18FD394C8843", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/28B8AA75-8BA8-464B-97B6-18FD394C8843/view-source"}], "score": 5, "updated_at": "2026-09-09T11:46:26+00:00"}, {"answer_html": "

Coin flips always worked for undergraduate health science majors. They also understand cards. The reason these work well is that they are uncomplicated and easy to apply simple models to (e.g., fair coin gives $P(\\text{Heads}) = \\frac{1}{2}$). More importantly, it's pretty simple to use both to explain the informal and formal versions of independence:

\n
    \n
  • Informal: two events are independent if knowing that one event happened doesn't change the probability of the second event happening.
  • \n
  • Formal: two events are independent if their joint probability, $P(A,B)$ factors into the product of the two marginal probabilities: $P(A)P(B)$.
  • \n
\n

You could even try demonstrating it or by simulation of flips or rolls of die. I think a good demonstration, à la physics class, is as good as any relatable example.

\n

I even think discussing conditional independence can be helpful to explain the concept. That even sets up later discussion where conditional independence is super important: e.g., in controlling for variables in regression or any other analysis with multiple confounding variables.

\n

Finally, I wonder if it is really true that such an event $C$ in your second example truly affects the dependence of $A$ and $B$ in that example. You could even use this as a discussion point:

\n
    \n
  • Given that we know that everything is "dependent" on background conditions in the universe, does knowing that add anything to the way we might show independence of $A = \\text{liking cats}$ and $B = \\text{eating a hot dog on day Y}$? Does the joint probability $P(A,B)$ still factor into $P(A)P(B)$ in this case? It should be fairly easy to come up with numerical examples here, yes?
  • \n
\n", "answer_id": 677116, "answer_text": "Coin flips always worked for undergraduate health science majors. They also understand cards. The reason these work well is that they are uncomplicated and easy to apply simple models to (e.g., fair coin gives $P(\\text{Heads}) = \\frac{1}{2}$). More importantly, it's pretty simple to use both to explain the informal and formal versions of independence:\n\n\n\n\n\nInformal: two events are independent if knowing that one event happened doesn't change the probability of the second event happening.\n\n\n\n\nFormal: two events are independent if their joint probability, $P(A,B)$ factors into the product of the two marginal probabilities: $P(A)P(B)$.\n\n\n\n\n\nYou could even try demonstrating it or by simulation of flips or rolls of die. I think a good demonstration, à la physics class, is as good as any relatable example.\n\n\n\n\nI even think discussing conditional independence can be helpful to explain the concept. That even sets up later discussion where conditional independence is super important: e.g., in controlling for variables in regression or any other analysis with multiple confounding variables.\n\n\n\n\nFinally, I wonder if it is really true that such an event $C$ in your second example truly affects the dependence of $A$ and $B$ in that example. You could even use this as a discussion point:\n\n\n\n\n\nGiven that we know that everything is \"dependent\" on background conditions in the universe, does knowing that add anything to the way we might show independence of $A = \\text{liking cats}$ and $B = \\text{eating a hot dog on day Y}$? Does the joint probability $P(A,B)$ still factor into $P(A)P(B)$ in this case? It should be fairly easy to come up with numerical examples here, yes?", "answer_url": "https://stats.stackexchange.com/a/677116", "author": "Rick Hass", "author_url": "https://stats.stackexchange.com/users/97844/rick-hass", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-09T12:37:01+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677110, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Rick Hass", "profile_url": "https://stats.stackexchange.com/users/97844/rick-hass", "user_type": "registered"}, "created_at": "2026-09-09T12:37:01+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "1C64B9F8-E0B2-427F-B96D-3A8318021628", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/1C64B9F8-E0B2-427F-B96D-3A8318021628/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Rick Hass", "profile_url": "https://stats.stackexchange.com/users/97844/rick-hass", "user_type": "registered"}, "created_at": "2026-09-09T13:55:27+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "22760A03-7CC9-428E-BBC0-5B00B4369DED", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/22760A03-7CC9-428E-BBC0-5B00B4369DED/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Rick Hass", "profile_url": "https://stats.stackexchange.com/users/97844/rick-hass", "user_type": "registered"}, "created_at": "2026-09-09T16:02:03+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "3A14A650-69D7-4AD7-9F34-29E76822560F", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/3A14A650-69D7-4AD7-9F34-29E76822560F/view-source"}, {"content_license": null, "contributor": {"display_name": "whuber", "profile_url": "https://stats.stackexchange.com/users/919/whuber", "user_type": "moderator"}, "created_at": "2026-09-24T15:47:50+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "B9B12584-278F-47C4-8A71-6175AA1870C9", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/B9B12584-278F-47C4-8A71-6175AA1870C9/view-source"}], "score": 4, "updated_at": "2026-09-09T16:02:03+00:00"}, {"answer_html": "

What seems to be tripping you up here is a terminology issue. When scientists try to give names to new abstract concepts, they often, and in all disciplines (not just statistics and probability), hijack words from the common vocabulary, as inventing a new name for every new concept would be impractical (people would not understand what we are saying, and would try to find a common word which, more or less, covers the concept).

\n

This is what happened here with independence. Statisticians use this word to describe a much narrower concept than the customary meaning. Looking up independence statistics in Wikipedia, you obtain the following definition.

\n
\n

Two events are independent, statistically independent, or\nstochastically independent if, informally speaking, the occurrence\nof one does not affect the probability of occurrence of the other or,\nequivalently, does not affect the odds.

\n
\n

Your first counter-example is perfectly valid: many personal traits can be, at least loosely, correlated, based on other factors such as upbringing, education, social status, etc.\nHowever, your second counter-example is off the mark. Factor $C$ does not affect the probability of event $B$ happening. Yes, both events depend on $C$ (if $C$ did not happen, then neither would $A$ or $B$). But once you know that $A$ happened, you know nothing more about whether $B$ will occur, or not, and with which probability. Here, you took the meaning of independence well beyond its meaning in statistics. So, statistically speaking, in your 2nd example, $A$ and $B$ are in fact independent.

\n

And yes, this hijacking of common terms trips us up (and students of statistics) all the time; significance, coverage, likelihood vs. probability, unit, consistent, degrees of freedom -one of my "favorites"-, etc.

\n

So, wrt what independence means in statistics, allow me to quote Inigo Montoya: “I do not think it means what you think it means”.

\n

An example of “perfect” dependence would be a single fair coin flip: if it falls head, then you know, with 100% certainty, what the face is which is facing the ground. A “perfect” independent example would be the flip of 2 fair coins; the fact that one of them fell head does not affect in any way how the 2nd coin will land.

\n

Another example of independence would be drawing a single card from a 52 cards deck. The suit of the first card you draw does not in any way affect the probability of the suit of the 2nd card you draw (iff you draw with replacement!). But if you do not draw with replacement, then that first card will influence (weakly) the probabilities for the suit of the 2nd card. And after you drew the 51st card (w/o replacement), you can predict with absolute certainty the suit of the last card.

\n

The same Wikipedia page gives the following good examples:

\n
\n

The event of getting a 6 the first time a die is rolled and the event of getting a 6 the second\ntime are independent. By contrast, the event of getting a 6 the first time a die is rolled and the\nevent that the sum of the numbers seen on the first and second trial is 8 are not independent.

\n
\n

Now, all these examples assume fair coins, or fair decks of cards. But even then, there still is independence: say the coin flips head 75% of the time, and tail 25%. The fact that it landed head on the 1st toss in no way changes the probabilities of the 2nd toss: they will remain .75/.25, and the first toss did not influence the probabilities of 2nd one.

\n", "answer_id": 677118, "answer_text": "What seems to be tripping you up here is a terminology issue. When scientists try to give names to new abstract concepts, they often, and in all disciplines (not just statistics and probability), hijack words from the common vocabulary, as inventing a new name for every new concept would be impractical (people would not understand what we are saying, and would try to find a common word which, more or less, covers the concept).\n\n\n\n\nThis is what happened here with independence. Statisticians use this word to describe a much narrower concept than the customary meaning. Looking up independence statistics in Wikipedia (https://en.wikipedia.org/wiki/Independence_(probability_theory)), you obtain the following definition.\n\n\n\n\n\n\n\nTwo events are independent, statistically independent, or\nstochastically independent if, informally speaking, the occurrence\nof one does not affect the probability of occurrence of the other or,\nequivalently, does not affect the odds.\n\n\n\n\n\n\n\nYour first counter-example is perfectly valid: many personal traits can be, at least loosely, correlated, based on other factors such as upbringing, education, social status, etc.\nHowever, your second counter-example is off the mark. Factor $C$ does not affect the probability of event $B$ happening. Yes, both events depend on $C$ (if $C$ did not happen, then neither would $A$ or $B$). But once you know that $A$ happened, you know nothing more about whether $B$ will occur, or not, and with which probability. Here, you took the meaning of independence well beyond its meaning in statistics. So, statistically speaking, in your 2nd example, $A$ and $B$ are in fact independent.\n\n\n\n\nAnd yes, this hijacking of common terms trips us up (and students of statistics) all the time; significance, coverage, likelihood vs. probability, unit, consistent, degrees of freedom -one of my \"favorites\"-, etc.\n\n\n\n\nSo, wrt what independence means in statistics, allow me to quote Inigo Montoya: “I do not think it means what you think it means”.\n\n\n\n\nAn example of “perfect” dependence would be a single fair coin flip: if it falls head, then you know, with 100% certainty, what the face is which is facing the ground. A “perfect” independent example would be the flip of 2 fair coins; the fact that one of them fell head does not affect in any way how the 2nd coin will land.\n\n\n\n\nAnother example of independence would be drawing a single card from a 52 cards deck. The suit of the first card you draw does not in any way affect the probability of the suit of the 2nd card you draw (iff you draw with replacement!). But if you do not draw with replacement, then that first card will influence (weakly) the probabilities for the suit of the 2nd card. And after you drew the 51st card (w/o replacement), you can predict with absolute certainty the suit of the last card.\n\n\n\n\nThe same Wikipedia page gives the following good examples:\n\n\n\n\n\n\n\nThe event of getting a 6 the first time a die is rolled and the event of getting a 6 the second\ntime are independent. By contrast, the event of getting a 6 the first time a die is rolled and the\nevent that the sum of the numbers seen on the first and second trial is 8 are not independent.\n\n\n\n\n\n\n\nNow, all these examples assume fair coins, or fair decks of cards. But even then, there still is independence: say the coin flips head 75% of the time, and tail 25%. The fact that it landed head on the 1st toss in no way changes the probabilities of the 2nd toss: they will remain .75/.25, and the first toss did not influence the probabilities of 2nd one.", "answer_url": "https://stats.stackexchange.com/a/677118", "author": "jginestet", "author_url": "https://stats.stackexchange.com/users/380096/jginestet", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-09T15:41:47+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677110, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-09T15:41:47+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "95084292-C973-4128-9914-5B5C589E44C8", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/95084292-C973-4128-9914-5B5C589E44C8/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-09T16:06:44+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "67C3A108-1229-423E-9C9B-BD41CC0D66B5", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/67C3A108-1229-423E-9C9B-BD41CC0D66B5/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-09T16:16:49+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "2785F5A7-398F-4C71-823A-143D526A9493", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/2785F5A7-398F-4C71-823A-143D526A9493/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nick Cox", "profile_url": "https://stats.stackexchange.com/users/22047/nick-cox", "user_type": "registered"}, "created_at": "2026-09-09T16:20:43+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "72508573-D0A1-4718-B981-8955EE7BE70C", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/72508573-D0A1-4718-B981-8955EE7BE70C/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-09T22:15:48+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "9EFB0FB0-DF11-4E9C-B82F-BB9D9118C1A4", "revision_number": 5, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/9EFB0FB0-DF11-4E9C-B82F-BB9D9118C1A4/view-source"}, {"content_license": null, "contributor": {"display_name": "whuber", "profile_url": "https://stats.stackexchange.com/users/919/whuber", "user_type": "moderator"}, "created_at": "2026-09-24T15:47:50+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "981B2887-B856-42CC-B6B6-905DED7C9504", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/981B2887-B856-42CC-B6B6-905DED7C9504/view-source"}], "score": 12, "updated_at": "2026-09-09T22:15:48+00:00"}, {"answer_html": "

The amount of rainfall in a certain place on a day is independent of what day of the week it is. Thursdays aren't rainier/less rainy on average than other days of the week.

\n", "answer_id": 677125, "answer_text": "The amount of rainfall in a certain place on a day is independent of what day of the week it is. Thursdays aren't rainier/less rainy on average than other days of the week.", "answer_url": "https://stats.stackexchange.com/a/677125", "author": "Rosie F", "author_url": "https://stats.stackexchange.com/users/325551/rosie-f", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-10T06:09:47+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677110, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Rosie F", "profile_url": "https://stats.stackexchange.com/users/325551/rosie-f", "user_type": "registered"}, "created_at": "2026-09-10T06:09:47+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "36C5D523-618B-4773-B6DC-6126E002AED3", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/36C5D523-618B-4773-B6DC-6126E002AED3/view-source"}, {"content_license": null, "contributor": {"display_name": "whuber", "profile_url": "https://stats.stackexchange.com/users/919/whuber", "user_type": "moderator"}, "created_at": "2026-09-24T15:47:50+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "D13D5A49-991C-4952-B437-7483D7E92988", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/D13D5A49-991C-4952-B437-7483D7E92988/view-source"}], "score": -1, "updated_at": "2026-09-10T06:09:47+00:00"}, {"answer_html": "

Thich Nhat Hanh says "Everything depends on everything else". I tend to agree with this. Statistical modelling of processes in the world always involves simplification. We model things as independent if we think that "any dependence is probably either so weak as to be irrelevant to what we are interested in" or "so complex that putting together a good model for it is so hard that it isn't worth the hassle" (or both). Given that this is so, rolling a die twice is probably about as good as it gets. Many other things fit the bill, but none of these are examples for being really independent but rather starting points for saying, intuitively we may model these as independent. But then, what could be problems with it, (how) could we model them, and do we think this will help matters?

\n

Note also that we need to rely on some kind of simplification if we want to learn systematically from experience at all, because how can we use observations from the past to learn about the future if whatever happens in the future can depend on all kinds of stuff, observed and unobserved, in all kinds of weird ways that we can neither observe nor control?

\n", "answer_id": 677158, "answer_text": "Thich Nhat Hanh says \"Everything depends on everything else\". I tend to agree with this. Statistical modelling of processes in the world always involves simplification. We model things as independent if we think that \"any dependence is probably either so weak as to be irrelevant to what we are interested in\" or \"so complex that putting together a good model for it is so hard that it isn't worth the hassle\" (or both). Given that this is so, rolling a die twice is probably about as good as it gets. Many other things fit the bill, but none of these are examples for being really independent but rather starting points for saying, intuitively we may model these as independent. But then, what could be problems with it, (how) could we model them, and do we think this will help matters?\n\n\n\n\nNote also that we need to rely on some kind of simplification if we want to learn systematically from experience at all, because how can we use observations from the past to learn about the future if whatever happens in the future can depend on all kinds of stuff, observed and unobserved, in all kinds of weird ways that we can neither observe nor control?", "answer_url": "https://stats.stackexchange.com/a/677158", "author": "Christian Hennig", "author_url": "https://stats.stackexchange.com/users/247165/christian-hennig", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-13T10:23:34+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677110, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Christian Hennig", "profile_url": "https://stats.stackexchange.com/users/247165/christian-hennig", "user_type": "registered"}, "created_at": "2026-09-13T10:23:34+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "05925295-B472-4DA0-A137-B61CAFF1CC1D", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/05925295-B472-4DA0-A137-B61CAFF1CC1D/view-source"}, {"content_license": null, "contributor": {"display_name": "whuber", "profile_url": "https://stats.stackexchange.com/users/919/whuber", "user_type": "moderator"}, "created_at": "2026-09-24T15:47:50+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "FD8F320F-74B7-4835-A873-9DBC84F39764", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/FD8F320F-74B7-4835-A873-9DBC84F39764/view-source"}], "score": 1, "updated_at": "2026-09-13T10:23:34+00:00"}, {"answer_html": "
\n
    \n
  • $A$: Bob liking cats, $B$: Enrique eating a hotdog on Saturday 9/5/2026.\n- $C$: these are both dependent on the human race existing 4 billion years after the Earth's formation
  • \n
\n
\n

This example shows that we can get independence by conditioning on related variables.

\n

In the quoted example, nobody will consider the probability of the event A by including the state space where C can be true or false, or considering where Bob can live in different worlds.

\n

Expressing the probability of Bob liking cats, presupposes that Bob exists and conditions on our world. It is considering the probability that any person called Bob would like cats. E.g. if out of the 1216912 Bob's living in the world, 784110 like cats, then we can say that for any randomly selected Bob, the probability of liking cats is approximately 64%. The issue whether the human race exists doesn't matter.

\n", "answer_id": 677159, "answer_text": "$A$: Bob liking cats, $B$: Enrique eating a hotdog on Saturday 9/5/2026.\n- $C$: these are both dependent on the human race existing 4 billion years after the Earth's formation\n\n\n\n\n\n\n\n\nThis example shows that we can get independence by conditioning on related variables.\n\n\n\n\nIn the quoted example, nobody will consider the probability of the event A by including the state space where C can be true or false, or considering where Bob can live in different worlds.\n\n\n\n\nExpressing the probability of Bob liking cats, presupposes that Bob exists and conditions on our world. It is considering the probability that any person called Bob would like cats. E.g. if out of the 1216912 Bob's living in the world, 784110 like cats, then we can say that for any randomly selected Bob, the probability of liking cats is approximately 64%. The issue whether the human race exists doesn't matter.", "answer_url": "https://stats.stackexchange.com/a/677159", "author": "Sextus Empiricus", "author_url": "https://stats.stackexchange.com/users/164061/sextus-empiricus", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-13T11:23:05+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677110, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Sextus Empiricus", "profile_url": "https://stats.stackexchange.com/users/164061/sextus-empiricus", "user_type": "registered"}, "created_at": "2026-09-13T11:23:05+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "4D4882E8-A3E7-4B18-A2A1-EBCD304BD135", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/4D4882E8-A3E7-4B18-A2A1-EBCD304BD135/view-source"}, {"content_license": null, "contributor": {"display_name": "whuber", "profile_url": "https://stats.stackexchange.com/users/919/whuber", "user_type": "moderator"}, "created_at": "2026-09-24T15:47:50+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "7A0D168D-47D2-4CC6-B1EA-213CEB836C84", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/7A0D168D-47D2-4CC6-B1EA-213CEB836C84/view-source"}], "score": 0, "updated_at": "2026-09-13T11:23:05+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I'm trying to come up with relatable examples to teach the concept of independence/orthogonality of two random variables $A$ and $B$. But my Bayes-Net-rotted brain keeps coming up with scenarios of how the two quantities/RVs could possibly not be independent (usually because of a common factor $C$).\n\n\n\n\nSome ANTI-examples of independence:\n\n\n\n\n\nBob being $A$ (able to jump high) and Bob being $B$ (good at chess).\n\n\n\nif Bob had $C$ (a good childhood with a happy family), then he is more likely to be $A$ and $B$.\n\n\n\n\n\n\n\n\n$A$: Bob liking cats, $B$: Enrique eating a hotdog on Saturday 9/5/2026.\n\n\n\n$C$: these are both dependent on the human race existing 4 billion years after the Earth's formation\n\n\n\n\n\n\n\n\n\nI intuitively understand independence. But I'm trying to come up with a more full-proof method to explain it. Note that the explanation has to be RELATABLE. It's trivial to define mathematically.\n\n\n\n\nAlso, note that I understand that this question may be more philosophical, and less hard stats. I'm just trying to figure out effective analogies to teach the concept of independence/orthogonality.", "record_id": "Scientific-Answer-Ranking:stats:677110", "scores": [5, 4, 12, -1, 1, 0], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

Everything is dependent on your second C. Even random things like rolling dice (someone has to roll the dice, if there are no humans, no dice) so that seems a bit overdone.

\n

I guess you could argue that every pair of variables is only conditionally independent, and just seek conditions that are very weak, or easy to meet.

\n

Once you do that, you can have interesting discussions about how to measure the weakness of the condition, and then what variables really are independent.

\n

E.g. The last digit of your phone number and the number of letters in your first name.

\n

But you could also discuss pairs of variables that seem independent (at least conditionally) ut really aren't.

\n

Given that you are teaching this, I think discussions are going to be more valuable than just giving examples.

\n", "answer_id": 677113, "answer_text": "Everything is dependent on your second C. Even random things like rolling dice (someone has to roll the dice, if there are no humans, no dice) so that seems a bit overdone.\n\n\n\n\nI guess you could argue that every pair of variables is only conditionally independent, and just seek conditions that are very weak, or easy to meet.\n\n\n\n\nOnce you do that, you can have interesting discussions about how to measure the weakness of the condition, and then what variables really are independent.\n\n\n\n\nE.g. The last digit of your phone number and the number of letters in your first name.\n\n\n\n\nBut you could also discuss pairs of variables that seem independent (at least conditionally) ut really aren't.\n\n\n\n\nGiven that you are teaching this, I think discussions are going to be more valuable than just giving examples.", "answer_url": "https://stats.stackexchange.com/a/677113", "author": "Peter Flom", "author_url": "https://stats.stackexchange.com/users/686/peter-flom", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-09T11:46:26+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677110, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Peter Flom", "profile_url": "https://stats.stackexchange.com/users/686/peter-flom", "user_type": "registered"}, "created_at": "2026-09-09T11:46:26+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "FCBDA039-4581-4D66-8992-B53869AB3A9C", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/FCBDA039-4581-4D66-8992-B53869AB3A9C/view-source"}, {"content_license": null, "contributor": {"display_name": "whuber", "profile_url": "https://stats.stackexchange.com/users/919/whuber", "user_type": "moderator"}, "created_at": "2026-09-24T15:47:50+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "28B8AA75-8BA8-464B-97B6-18FD394C8843", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/28B8AA75-8BA8-464B-97B6-18FD394C8843/view-source"}], "score": 5, "updated_at": "2026-09-09T11:46:26+00:00"}, {"answer_html": "

Coin flips always worked for undergraduate health science majors. They also understand cards. The reason these work well is that they are uncomplicated and easy to apply simple models to (e.g., fair coin gives $P(\\text{Heads}) = \\frac{1}{2}$). More importantly, it's pretty simple to use both to explain the informal and formal versions of independence:

\n
    \n
  • Informal: two events are independent if knowing that one event happened doesn't change the probability of the second event happening.
  • \n
  • Formal: two events are independent if their joint probability, $P(A,B)$ factors into the product of the two marginal probabilities: $P(A)P(B)$.
  • \n
\n

You could even try demonstrating it or by simulation of flips or rolls of die. I think a good demonstration, à la physics class, is as good as any relatable example.

\n

I even think discussing conditional independence can be helpful to explain the concept. That even sets up later discussion where conditional independence is super important: e.g., in controlling for variables in regression or any other analysis with multiple confounding variables.

\n

Finally, I wonder if it is really true that such an event $C$ in your second example truly affects the dependence of $A$ and $B$ in that example. You could even use this as a discussion point:

\n
    \n
  • Given that we know that everything is "dependent" on background conditions in the universe, does knowing that add anything to the way we might show independence of $A = \\text{liking cats}$ and $B = \\text{eating a hot dog on day Y}$? Does the joint probability $P(A,B)$ still factor into $P(A)P(B)$ in this case? It should be fairly easy to come up with numerical examples here, yes?
  • \n
\n", "answer_id": 677116, "answer_text": "Coin flips always worked for undergraduate health science majors. They also understand cards. The reason these work well is that they are uncomplicated and easy to apply simple models to (e.g., fair coin gives $P(\\text{Heads}) = \\frac{1}{2}$). More importantly, it's pretty simple to use both to explain the informal and formal versions of independence:\n\n\n\n\n\nInformal: two events are independent if knowing that one event happened doesn't change the probability of the second event happening.\n\n\n\n\nFormal: two events are independent if their joint probability, $P(A,B)$ factors into the product of the two marginal probabilities: $P(A)P(B)$.\n\n\n\n\n\nYou could even try demonstrating it or by simulation of flips or rolls of die. I think a good demonstration, à la physics class, is as good as any relatable example.\n\n\n\n\nI even think discussing conditional independence can be helpful to explain the concept. That even sets up later discussion where conditional independence is super important: e.g., in controlling for variables in regression or any other analysis with multiple confounding variables.\n\n\n\n\nFinally, I wonder if it is really true that such an event $C$ in your second example truly affects the dependence of $A$ and $B$ in that example. You could even use this as a discussion point:\n\n\n\n\n\nGiven that we know that everything is \"dependent\" on background conditions in the universe, does knowing that add anything to the way we might show independence of $A = \\text{liking cats}$ and $B = \\text{eating a hot dog on day Y}$? Does the joint probability $P(A,B)$ still factor into $P(A)P(B)$ in this case? It should be fairly easy to come up with numerical examples here, yes?", "answer_url": "https://stats.stackexchange.com/a/677116", "author": "Rick Hass", "author_url": "https://stats.stackexchange.com/users/97844/rick-hass", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-09T12:37:01+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677110, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Rick Hass", "profile_url": "https://stats.stackexchange.com/users/97844/rick-hass", "user_type": "registered"}, "created_at": "2026-09-09T12:37:01+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "1C64B9F8-E0B2-427F-B96D-3A8318021628", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/1C64B9F8-E0B2-427F-B96D-3A8318021628/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Rick Hass", "profile_url": "https://stats.stackexchange.com/users/97844/rick-hass", "user_type": "registered"}, "created_at": "2026-09-09T13:55:27+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "22760A03-7CC9-428E-BBC0-5B00B4369DED", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/22760A03-7CC9-428E-BBC0-5B00B4369DED/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Rick Hass", "profile_url": "https://stats.stackexchange.com/users/97844/rick-hass", "user_type": "registered"}, "created_at": "2026-09-09T16:02:03+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "3A14A650-69D7-4AD7-9F34-29E76822560F", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/3A14A650-69D7-4AD7-9F34-29E76822560F/view-source"}, {"content_license": null, "contributor": {"display_name": "whuber", "profile_url": "https://stats.stackexchange.com/users/919/whuber", "user_type": "moderator"}, "created_at": "2026-09-24T15:47:50+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "B9B12584-278F-47C4-8A71-6175AA1870C9", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/B9B12584-278F-47C4-8A71-6175AA1870C9/view-source"}], "score": 4, "updated_at": "2026-09-09T16:02:03+00:00"}, {"answer_html": "

What seems to be tripping you up here is a terminology issue. When scientists try to give names to new abstract concepts, they often, and in all disciplines (not just statistics and probability), hijack words from the common vocabulary, as inventing a new name for every new concept would be impractical (people would not understand what we are saying, and would try to find a common word which, more or less, covers the concept).

\n

This is what happened here with independence. Statisticians use this word to describe a much narrower concept than the customary meaning. Looking up independence statistics in Wikipedia, you obtain the following definition.

\n
\n

Two events are independent, statistically independent, or\nstochastically independent if, informally speaking, the occurrence\nof one does not affect the probability of occurrence of the other or,\nequivalently, does not affect the odds.

\n
\n

Your first counter-example is perfectly valid: many personal traits can be, at least loosely, correlated, based on other factors such as upbringing, education, social status, etc.\nHowever, your second counter-example is off the mark. Factor $C$ does not affect the probability of event $B$ happening. Yes, both events depend on $C$ (if $C$ did not happen, then neither would $A$ or $B$). But once you know that $A$ happened, you know nothing more about whether $B$ will occur, or not, and with which probability. Here, you took the meaning of independence well beyond its meaning in statistics. So, statistically speaking, in your 2nd example, $A$ and $B$ are in fact independent.

\n

And yes, this hijacking of common terms trips us up (and students of statistics) all the time; significance, coverage, likelihood vs. probability, unit, consistent, degrees of freedom -one of my "favorites"-, etc.

\n

So, wrt what independence means in statistics, allow me to quote Inigo Montoya: “I do not think it means what you think it means”.

\n

An example of “perfect” dependence would be a single fair coin flip: if it falls head, then you know, with 100% certainty, what the face is which is facing the ground. A “perfect” independent example would be the flip of 2 fair coins; the fact that one of them fell head does not affect in any way how the 2nd coin will land.

\n

Another example of independence would be drawing a single card from a 52 cards deck. The suit of the first card you draw does not in any way affect the probability of the suit of the 2nd card you draw (iff you draw with replacement!). But if you do not draw with replacement, then that first card will influence (weakly) the probabilities for the suit of the 2nd card. And after you drew the 51st card (w/o replacement), you can predict with absolute certainty the suit of the last card.

\n

The same Wikipedia page gives the following good examples:

\n
\n

The event of getting a 6 the first time a die is rolled and the event of getting a 6 the second\ntime are independent. By contrast, the event of getting a 6 the first time a die is rolled and the\nevent that the sum of the numbers seen on the first and second trial is 8 are not independent.

\n
\n

Now, all these examples assume fair coins, or fair decks of cards. But even then, there still is independence: say the coin flips head 75% of the time, and tail 25%. The fact that it landed head on the 1st toss in no way changes the probabilities of the 2nd toss: they will remain .75/.25, and the first toss did not influence the probabilities of 2nd one.

\n", "answer_id": 677118, "answer_text": "What seems to be tripping you up here is a terminology issue. When scientists try to give names to new abstract concepts, they often, and in all disciplines (not just statistics and probability), hijack words from the common vocabulary, as inventing a new name for every new concept would be impractical (people would not understand what we are saying, and would try to find a common word which, more or less, covers the concept).\n\n\n\n\nThis is what happened here with independence. Statisticians use this word to describe a much narrower concept than the customary meaning. Looking up independence statistics in Wikipedia (https://en.wikipedia.org/wiki/Independence_(probability_theory)), you obtain the following definition.\n\n\n\n\n\n\n\nTwo events are independent, statistically independent, or\nstochastically independent if, informally speaking, the occurrence\nof one does not affect the probability of occurrence of the other or,\nequivalently, does not affect the odds.\n\n\n\n\n\n\n\nYour first counter-example is perfectly valid: many personal traits can be, at least loosely, correlated, based on other factors such as upbringing, education, social status, etc.\nHowever, your second counter-example is off the mark. Factor $C$ does not affect the probability of event $B$ happening. Yes, both events depend on $C$ (if $C$ did not happen, then neither would $A$ or $B$). But once you know that $A$ happened, you know nothing more about whether $B$ will occur, or not, and with which probability. Here, you took the meaning of independence well beyond its meaning in statistics. So, statistically speaking, in your 2nd example, $A$ and $B$ are in fact independent.\n\n\n\n\nAnd yes, this hijacking of common terms trips us up (and students of statistics) all the time; significance, coverage, likelihood vs. probability, unit, consistent, degrees of freedom -one of my \"favorites\"-, etc.\n\n\n\n\nSo, wrt what independence means in statistics, allow me to quote Inigo Montoya: “I do not think it means what you think it means”.\n\n\n\n\nAn example of “perfect” dependence would be a single fair coin flip: if it falls head, then you know, with 100% certainty, what the face is which is facing the ground. A “perfect” independent example would be the flip of 2 fair coins; the fact that one of them fell head does not affect in any way how the 2nd coin will land.\n\n\n\n\nAnother example of independence would be drawing a single card from a 52 cards deck. The suit of the first card you draw does not in any way affect the probability of the suit of the 2nd card you draw (iff you draw with replacement!). But if you do not draw with replacement, then that first card will influence (weakly) the probabilities for the suit of the 2nd card. And after you drew the 51st card (w/o replacement), you can predict with absolute certainty the suit of the last card.\n\n\n\n\nThe same Wikipedia page gives the following good examples:\n\n\n\n\n\n\n\nThe event of getting a 6 the first time a die is rolled and the event of getting a 6 the second\ntime are independent. By contrast, the event of getting a 6 the first time a die is rolled and the\nevent that the sum of the numbers seen on the first and second trial is 8 are not independent.\n\n\n\n\n\n\n\nNow, all these examples assume fair coins, or fair decks of cards. But even then, there still is independence: say the coin flips head 75% of the time, and tail 25%. The fact that it landed head on the 1st toss in no way changes the probabilities of the 2nd toss: they will remain .75/.25, and the first toss did not influence the probabilities of 2nd one.", "answer_url": "https://stats.stackexchange.com/a/677118", "author": "jginestet", "author_url": "https://stats.stackexchange.com/users/380096/jginestet", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-09T15:41:47+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677110, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-09T15:41:47+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "95084292-C973-4128-9914-5B5C589E44C8", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/95084292-C973-4128-9914-5B5C589E44C8/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-09T16:06:44+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "67C3A108-1229-423E-9C9B-BD41CC0D66B5", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/67C3A108-1229-423E-9C9B-BD41CC0D66B5/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-09T16:16:49+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "2785F5A7-398F-4C71-823A-143D526A9493", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/2785F5A7-398F-4C71-823A-143D526A9493/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nick Cox", "profile_url": "https://stats.stackexchange.com/users/22047/nick-cox", "user_type": "registered"}, "created_at": "2026-09-09T16:20:43+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "72508573-D0A1-4718-B981-8955EE7BE70C", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/72508573-D0A1-4718-B981-8955EE7BE70C/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-09T22:15:48+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "9EFB0FB0-DF11-4E9C-B82F-BB9D9118C1A4", "revision_number": 5, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/9EFB0FB0-DF11-4E9C-B82F-BB9D9118C1A4/view-source"}, {"content_license": null, "contributor": {"display_name": "whuber", "profile_url": "https://stats.stackexchange.com/users/919/whuber", "user_type": "moderator"}, "created_at": "2026-09-24T15:47:50+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "981B2887-B856-42CC-B6B6-905DED7C9504", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/981B2887-B856-42CC-B6B6-905DED7C9504/view-source"}], "score": 12, "updated_at": "2026-09-09T22:15:48+00:00"}, {"answer_html": "

The amount of rainfall in a certain place on a day is independent of what day of the week it is. Thursdays aren't rainier/less rainy on average than other days of the week.

\n", "answer_id": 677125, "answer_text": "The amount of rainfall in a certain place on a day is independent of what day of the week it is. Thursdays aren't rainier/less rainy on average than other days of the week.", "answer_url": "https://stats.stackexchange.com/a/677125", "author": "Rosie F", "author_url": "https://stats.stackexchange.com/users/325551/rosie-f", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-10T06:09:47+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677110, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Rosie F", "profile_url": "https://stats.stackexchange.com/users/325551/rosie-f", "user_type": "registered"}, "created_at": "2026-09-10T06:09:47+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "36C5D523-618B-4773-B6DC-6126E002AED3", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/36C5D523-618B-4773-B6DC-6126E002AED3/view-source"}, {"content_license": null, "contributor": {"display_name": "whuber", "profile_url": "https://stats.stackexchange.com/users/919/whuber", "user_type": "moderator"}, "created_at": "2026-09-24T15:47:50+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "D13D5A49-991C-4952-B437-7483D7E92988", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/D13D5A49-991C-4952-B437-7483D7E92988/view-source"}], "score": -1, "updated_at": "2026-09-10T06:09:47+00:00"}, {"answer_html": "

Thich Nhat Hanh says "Everything depends on everything else". I tend to agree with this. Statistical modelling of processes in the world always involves simplification. We model things as independent if we think that "any dependence is probably either so weak as to be irrelevant to what we are interested in" or "so complex that putting together a good model for it is so hard that it isn't worth the hassle" (or both). Given that this is so, rolling a die twice is probably about as good as it gets. Many other things fit the bill, but none of these are examples for being really independent but rather starting points for saying, intuitively we may model these as independent. But then, what could be problems with it, (how) could we model them, and do we think this will help matters?

\n

Note also that we need to rely on some kind of simplification if we want to learn systematically from experience at all, because how can we use observations from the past to learn about the future if whatever happens in the future can depend on all kinds of stuff, observed and unobserved, in all kinds of weird ways that we can neither observe nor control?

\n", "answer_id": 677158, "answer_text": "Thich Nhat Hanh says \"Everything depends on everything else\". I tend to agree with this. Statistical modelling of processes in the world always involves simplification. We model things as independent if we think that \"any dependence is probably either so weak as to be irrelevant to what we are interested in\" or \"so complex that putting together a good model for it is so hard that it isn't worth the hassle\" (or both). Given that this is so, rolling a die twice is probably about as good as it gets. Many other things fit the bill, but none of these are examples for being really independent but rather starting points for saying, intuitively we may model these as independent. But then, what could be problems with it, (how) could we model them, and do we think this will help matters?\n\n\n\n\nNote also that we need to rely on some kind of simplification if we want to learn systematically from experience at all, because how can we use observations from the past to learn about the future if whatever happens in the future can depend on all kinds of stuff, observed and unobserved, in all kinds of weird ways that we can neither observe nor control?", "answer_url": "https://stats.stackexchange.com/a/677158", "author": "Christian Hennig", "author_url": "https://stats.stackexchange.com/users/247165/christian-hennig", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-13T10:23:34+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677110, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Christian Hennig", "profile_url": "https://stats.stackexchange.com/users/247165/christian-hennig", "user_type": "registered"}, "created_at": "2026-09-13T10:23:34+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "05925295-B472-4DA0-A137-B61CAFF1CC1D", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/05925295-B472-4DA0-A137-B61CAFF1CC1D/view-source"}, {"content_license": null, "contributor": {"display_name": "whuber", "profile_url": "https://stats.stackexchange.com/users/919/whuber", "user_type": "moderator"}, "created_at": "2026-09-24T15:47:50+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "FD8F320F-74B7-4835-A873-9DBC84F39764", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/FD8F320F-74B7-4835-A873-9DBC84F39764/view-source"}], "score": 1, "updated_at": "2026-09-13T10:23:34+00:00"}, {"answer_html": "
\n
    \n
  • $A$: Bob liking cats, $B$: Enrique eating a hotdog on Saturday 9/5/2026.\n- $C$: these are both dependent on the human race existing 4 billion years after the Earth's formation
  • \n
\n
\n

This example shows that we can get independence by conditioning on related variables.

\n

In the quoted example, nobody will consider the probability of the event A by including the state space where C can be true or false, or considering where Bob can live in different worlds.

\n

Expressing the probability of Bob liking cats, presupposes that Bob exists and conditions on our world. It is considering the probability that any person called Bob would like cats. E.g. if out of the 1216912 Bob's living in the world, 784110 like cats, then we can say that for any randomly selected Bob, the probability of liking cats is approximately 64%. The issue whether the human race exists doesn't matter.

\n", "answer_id": 677159, "answer_text": "$A$: Bob liking cats, $B$: Enrique eating a hotdog on Saturday 9/5/2026.\n- $C$: these are both dependent on the human race existing 4 billion years after the Earth's formation\n\n\n\n\n\n\n\n\nThis example shows that we can get independence by conditioning on related variables.\n\n\n\n\nIn the quoted example, nobody will consider the probability of the event A by including the state space where C can be true or false, or considering where Bob can live in different worlds.\n\n\n\n\nExpressing the probability of Bob liking cats, presupposes that Bob exists and conditions on our world. It is considering the probability that any person called Bob would like cats. E.g. if out of the 1216912 Bob's living in the world, 784110 like cats, then we can say that for any randomly selected Bob, the probability of liking cats is approximately 64%. The issue whether the human race exists doesn't matter.", "answer_url": "https://stats.stackexchange.com/a/677159", "author": "Sextus Empiricus", "author_url": "https://stats.stackexchange.com/users/164061/sextus-empiricus", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-13T11:23:05+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677110, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Sextus Empiricus", "profile_url": "https://stats.stackexchange.com/users/164061/sextus-empiricus", "user_type": "registered"}, "created_at": "2026-09-13T11:23:05+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "4D4882E8-A3E7-4B18-A2A1-EBCD304BD135", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/4D4882E8-A3E7-4B18-A2A1-EBCD304BD135/view-source"}, {"content_license": null, "contributor": {"display_name": "whuber", "profile_url": "https://stats.stackexchange.com/users/919/whuber", "user_type": "moderator"}, "created_at": "2026-09-24T15:47:50+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "7A0D168D-47D2-4CC6-B1EA-213CEB836C84", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/7A0D168D-47D2-4CC6-B1EA-213CEB836C84/view-source"}], "score": 0, "updated_at": "2026-09-13T11:23:05+00:00"}], "domain": "statistics", "external_links": ["https://en.wikipedia.org/wiki/Independence_(probability_theory"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:03.428408+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/774052c18cd9e8fa951e893347bfa3c1a85e743fc46ec4667572002cadb10cbf_1790825224163423600_0.json", "raw_sha256": "fe4dd06d3de6c0b1bb33ba88aee0ed4284118e01f76a58dcdce220a4946329b2", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "chausies", "question_author_url": "https://stats.stackexchange.com/users/106978/chausies", "question_author_user_type": "registered", "question_created_at": "2026-09-09T07:51:56+00:00", "question_html": "

I'm trying to come up with relatable examples to teach the concept of independence/orthogonality of two random variables $A$ and $B$. But my Bayes-Net-rotted brain keeps coming up with scenarios of how the two quantities/RVs could possibly not be independent (usually because of a common factor $C$).

\n

Some ANTI-examples of independence:

\n
    \n
  • Bob being $A$ (able to jump high) and Bob being $B$ (good at chess).\n
      \n
    • if Bob had $C$ (a good childhood with a happy family), then he is more likely to be $A$ and $B$.
    • \n
    \n
  • \n
  • $A$: Bob liking cats, $B$: Enrique eating a hotdog on Saturday 9/5/2026.\n
      \n
    • $C$: these are both dependent on the human race existing 4 billion years after the Earth's formation
    • \n
    \n
  • \n
\n

I intuitively understand independence. But I'm trying to come up with a more full-proof method to explain it. Note that the explanation has to be RELATABLE. It's trivial to define mathematically.

\n

Also, note that I understand that this question may be more philosophical, and less hard stats. I'm just trying to figure out effective analogies to teach the concept of independence/orthogonality.

\n", "question_id": 677110, "question_license": "CC BY-SA 4.0", "question_score": 7, "question_text": "I'm trying to come up with relatable examples to teach the concept of independence/orthogonality of two random variables $A$ and $B$. But my Bayes-Net-rotted brain keeps coming up with scenarios of how the two quantities/RVs could possibly not be independent (usually because of a common factor $C$).\n\n\n\n\nSome ANTI-examples of independence:\n\n\n\n\n\nBob being $A$ (able to jump high) and Bob being $B$ (good at chess).\n\n\n\nif Bob had $C$ (a good childhood with a happy family), then he is more likely to be $A$ and $B$.\n\n\n\n\n\n\n\n\n$A$: Bob liking cats, $B$: Enrique eating a hotdog on Saturday 9/5/2026.\n\n\n\n$C$: these are both dependent on the human race existing 4 billion years after the Earth's formation\n\n\n\n\n\n\n\n\n\nI intuitively understand independence. But I'm trying to come up with a more full-proof method to explain it. Note that the explanation has to be RELATABLE. It's trivial to define mathematically.\n\n\n\n\nAlso, note that I understand that this question may be more philosophical, and less hard stats. I'm just trying to figure out effective analogies to teach the concept of independence/orthogonality.", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "chausies", "profile_url": "https://stats.stackexchange.com/users/106978/chausies", "user_type": "registered"}, "created_at": "2026-09-09T07:51:56+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "09AA6116-10EF-4598-A356-673887E08F9F", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/09AA6116-10EF-4598-A356-673887E08F9F/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "chausies", "profile_url": "https://stats.stackexchange.com/users/106978/chausies", "user_type": "registered"}, "created_at": "2026-09-09T08:09:28+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "E02B00BA-7EB4-4006-B7DC-05AEBD786FB2", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/E02B00BA-7EB4-4006-B7DC-05AEBD786FB2/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nick Cox", "profile_url": "https://stats.stackexchange.com/users/22047/nick-cox", "user_type": "registered"}, "created_at": "2026-09-09T08:38:48+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "A0CC35A7-3551-4E23-987C-D3D75825B0C6", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/A0CC35A7-3551-4E23-987C-D3D75825B0C6/view-source"}, {"content_license": null, "contributor": {"display_name": "kjetil b halvorsen", "profile_url": "https://stats.stackexchange.com/users/11887/kjetil-b-halvorsen", "user_type": "moderator"}, "created_at": "2026-09-09T15:45:42+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "AE89F7AC-F6FF-4169-8238-81C4A28C9D51", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/AE89F7AC-F6FF-4169-8238-81C4A28C9D51/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-09-09T16:02:18+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "328469B4-8DBA-4605-9657-CC3EEC90198E", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/328469B4-8DBA-4605-9657-CC3EEC90198E/view-source"}, {"content_license": null, "contributor": {"display_name": "whuber", "profile_url": "https://stats.stackexchange.com/users/919/whuber", "user_type": "moderator"}, "created_at": "2026-09-24T15:47:50+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "F2BFAA50-7963-4160-AF0B-9FD8DF0FD5A4", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/F2BFAA50-7963-4160-AF0B-9FD8DF0FD5A4/view-source"}], "source_site": "stats", "source_url": "https://stats.stackexchange.com/questions/677110/what-are-some-examples-of-truly-independent-things-that-are-relatable-to-people", "split": "train", "split_group": "37c3b7a374d2a52326d18ea26b83cb670f304c3b4ba0a500893af03f7b915087", "tags": ["independence", "intuition", "bayesian-network", "teaching"], "thread_id": "stats:677110", "title": "What are some examples of truly independent things that are relatable to people?"}} {"accepted_status": [false, true, false], "candidate_answers": [{"answer_html": "

Can you provide a {reprex}? I'm getting a warning when I run your code

\n
df <- structure(list(PreScore = c(16, 23, 17, 24, 22, 27, 20, 18, 21, \n                                  26, 25, 23, 18), PostScore = c(20, 31, 17, 31, 32, 31, 31, 30, \n                                                                 30, 32, 30, 31, 17)), row.names = c(NA, -13L), class = c("tbl_df", \n                                                                                                                          "tbl", "data.frame"))\n\nwilcox.test(df$PostScore, df$PreScore, conf.int = TRUE, paired=TRUE, exact = TRUE)\n#> Warning in wilcox.test.default(df$PostScore, df$PreScore, conf.int = TRUE, :\n#> cannot compute exact p-value with ties\n#> Warning in wilcox.test.default(df$PostScore, df$PreScore, conf.int = TRUE, :\n#> cannot compute exact confidence interval with ties\n#> Warning in wilcox.test.default(df$PostScore, df$PreScore, conf.int = TRUE, :\n#> cannot compute exact p-value with zeroes\n#> Warning in wilcox.test.default(df$PostScore, df$PreScore, conf.int = TRUE, :\n#> cannot compute exact confidence interval with zeroes\n#> \n#>  Wilcoxon signed rank test with continuity correction\n#> \n#> data:  df$PostScore and df$PreScore\n#> V = 77, p-value = 0.00324\n#> alternative hypothesis: true location shift is not equal to 0\n#> 95 percent confidence interval:\n#>  4.500064 9.499992\n#> sample estimates:\n#> (pseudo)median \n#>       7.000049\n
\n

Created on 2026-09-10 with reprex v2.1.1

\n

EDIT: I was using an old version of R. Here is the reprex from using 4.6

\n
(R.version.string)\n#> [1] "R version 4.6.0 (2026-04-24)"\n\ndf <- structure(list(PreScore = c(16, 23, 17, 24, 22, 27, 20, 18, 21, \n                                  26, 25, 23, 18), PostScore = c(20, 31, 17, 31, 32, 31, 31, 30, \n                                                                 30, 32, 30, 31, 17)), row.names = c(NA, -13L), class = c("tbl_df", \n                                                                                                                          "tbl", "data.frame"))\n\nwilcox.test(df$PostScore, df$PreScore, conf.int = TRUE, paired=TRUE, exact = TRUE)\n#> \n#>  Wilcoxon signed rank exact test\n#> \n#> data:  df$PostScore and df$PreScore\n#> V = 88, p-value = 0.0009766\n#> alternative hypothesis: true location shift is not equal to 0\n#> 96.7 percent confidence interval:\n#>  4 9\n#> sample estimates:\n#> (pseudo)median \n#>            6.5\n
\n

Created on 2026-09-11 with reprex v2.1.1

\n

Note, no warning. See J-J-J's comment for an explanation.

\n", "answer_id": 677136, "answer_text": "Can you provide a {reprex} (https://reprex.tidyverse.org/)? I'm getting a warning when I run your code\n\n\n\n\ndf <- structure(list(PreScore = c(16, 23, 17, 24, 22, 27, 20, 18, 21, \n 26, 25, 23, 18), PostScore = c(20, 31, 17, 31, 32, 31, 31, 30, \n 30, 32, 30, 31, 17)), row.names = c(NA, -13L), class = c(\"tbl_df\", \n \"tbl\", \"data.frame\"))\n\nwilcox.test(df$PostScore, df$PreScore, conf.int = TRUE, paired=TRUE, exact = TRUE)\n#> Warning in wilcox.test.default(df$PostScore, df$PreScore, conf.int = TRUE, :\n#> cannot compute exact p-value with ties\n#> Warning in wilcox.test.default(df$PostScore, df$PreScore, conf.int = TRUE, :\n#> cannot compute exact confidence interval with ties\n#> Warning in wilcox.test.default(df$PostScore, df$PreScore, conf.int = TRUE, :\n#> cannot compute exact p-value with zeroes\n#> Warning in wilcox.test.default(df$PostScore, df$PreScore, conf.int = TRUE, :\n#> cannot compute exact confidence interval with zeroes\n#> \n#> Wilcoxon signed rank test with continuity correction\n#> \n#> data: df$PostScore and df$PreScore\n#> V = 77, p-value = 0.00324\n#> alternative hypothesis: true location shift is not equal to 0\n#> 95 percent confidence interval:\n#> 4.500064 9.499992\n#> sample estimates:\n#> (pseudo)median \n#> 7.000049\n\n\n\n\n\nCreated on 2026-09-10 with reprex v2.1.1 (https://reprex.tidyverse.org)\n\n\n\n\nEDIT: I was using an old version of R. Here is the reprex from using 4.6\n\n\n\n\n(R.version.string)\n#> [1] \"R version 4.6.0 (2026-04-24)\"\n\ndf <- structure(list(PreScore = c(16, 23, 17, 24, 22, 27, 20, 18, 21, \n 26, 25, 23, 18), PostScore = c(20, 31, 17, 31, 32, 31, 31, 30, \n 30, 32, 30, 31, 17)), row.names = c(NA, -13L), class = c(\"tbl_df\", \n \"tbl\", \"data.frame\"))\n\nwilcox.test(df$PostScore, df$PreScore, conf.int = TRUE, paired=TRUE, exact = TRUE)\n#> \n#> Wilcoxon signed rank exact test\n#> \n#> data: df$PostScore and df$PreScore\n#> V = 88, p-value = 0.0009766\n#> alternative hypothesis: true location shift is not equal to 0\n#> 96.7 percent confidence interval:\n#> 4 9\n#> sample estimates:\n#> (pseudo)median \n#> 6.5\n\n\n\n\n\nCreated on 2026-09-11 with reprex v2.1.1 (https://reprex.tidyverse.org)\n\n\n\n\nNote, no warning. See J-J-J's comment for an explanation.", "answer_url": "https://stats.stackexchange.com/a/677136", "author": "Demetri Pananos", "author_url": "https://stats.stackexchange.com/users/111259/demetri-pananos", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-11T01:34:59+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677135, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Demetri Pananos", "profile_url": "https://stats.stackexchange.com/users/111259/demetri-pananos", "user_type": "registered"}, "created_at": "2026-09-11T01:34:59+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "3461E410-C604-4E94-BBD3-042259374DDF", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/3461E410-C604-4E94-BBD3-042259374DDF/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Demetri Pananos", "profile_url": "https://stats.stackexchange.com/users/111259/demetri-pananos", "user_type": "registered"}, "created_at": "2026-09-11T17:41:38+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "C692081B-A074-4F0B-985E-9AECEBE88DE5", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/C692081B-A074-4F0B-985E-9AECEBE88DE5/view-source"}], "score": 5, "updated_at": "2026-09-11T17:41:38+00:00"}, {"answer_html": "

You are using R version 4.6.1. Well, since R 4.6.0, from R News:

\n
\n

wilcox.test() can now perform exact (conditional) inference in case\nof ties. Based on contributions by Torsten Hothorn.

\n
\n

Therefore, it seems there's no longer a reason to throw a warning. The wilcox.test() documentation says:

\n
\n

If there are ties, exact inference is performed using the\nconditional/permutation distribution given the observed ranks, using\nan implementation of the Streitberg–Röhmel shift algorithm (Streitberg\nand Röhmel 1986; Streitberg and Röhmel 1987) contributed by Torsten\nHothorn.

\n
\n

[...]

\n
\n

Streitberg B, Röhmel J (1986). “Exact Distributions for Permutation\nand Rank Tests: An Introduction to Some Recently Published\nAlgorithms.” Statistical Software Newsletter, 12(1), 10–17. ISSN\n0173-5896.

\n

Streitberg B, Röhmel J (1987). “Exakte Verteilungen für Rang- und\nRandomisierungstests im allgemeinen c-Stichprobenfall.” EDV in Medizin\nund Biologie, 18(1), 12–19. ISSN 0300-8282.\nhttps://ul.qucosa.de/api/qucosa%3A12624/attachment/ATT-0/.

\n
\n", "answer_id": 677139, "answer_text": "You are using R version 4.6.1. Well, since R 4.6.0, from R News (https://cran.r-project.org/doc/manuals/r-release/NEWS.html):\n\n\n\n\n\n\n\nwilcox.test() can now perform exact (conditional) inference in case\nof ties. Based on contributions by Torsten Hothorn.\n\n\n\n\n\n\n\nTherefore, it seems there's no longer a reason to throw a warning. The wilcox.test() documentation says:\n\n\n\n\n\n\n\nIf there are ties, exact inference is performed using the\nconditional/permutation distribution given the observed ranks, using\nan implementation of the Streitberg–Röhmel shift algorithm (Streitberg\nand Röhmel 1986; Streitberg and Röhmel 1987) contributed by Torsten\nHothorn.\n\n\n\n\n\n\n\n[...]\n\n\n\n\n\n\n\nStreitberg B, Röhmel J (1986). “Exact Distributions for Permutation\nand Rank Tests: An Introduction to Some Recently Published\nAlgorithms.” Statistical Software Newsletter, 12(1), 10–17. ISSN\n0173-5896.\n\n\n\n\nStreitberg B, Röhmel J (1987). “Exakte Verteilungen für Rang- und\nRandomisierungstests im allgemeinen c-Stichprobenfall.” EDV in Medizin\nund Biologie, 18(1), 12–19. ISSN 0300-8282.\nhttps://ul.qucosa.de/api/qucosa%3A12624/attachment/ATT-0/ (https://ul.qucosa.de/api/qucosa%3A12624/attachment/ATT-0/).", "answer_url": "https://stats.stackexchange.com/a/677139", "author": "J-J-J", "author_url": "https://stats.stackexchange.com/users/164936/j-j-j", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-11T07:32:22+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677135, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "J-J-J", "profile_url": "https://stats.stackexchange.com/users/164936/j-j-j", "user_type": "registered"}, "created_at": "2026-09-11T07:32:22+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "23216BD3-49D3-422F-8020-02B7D9CD2B5A", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/23216BD3-49D3-422F-8020-02B7D9CD2B5A/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "J-J-J", "profile_url": "https://stats.stackexchange.com/users/164936/j-j-j", "user_type": "registered"}, "created_at": "2026-09-11T08:09:51+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "CB4779A0-4EA1-4BB0-99F8-7FFB266F646D", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/CB4779A0-4EA1-4BB0-99F8-7FFB266F646D/view-source"}], "score": 16, "updated_at": "2026-09-11T08:09:51+00:00"}, {"answer_html": "

This arguably should at most be a comment as it doesn't attempt to answer the question at all. But I have a graph, and my comment also pertains to many applications of such tests that are likely not very helpful in data analysis. I am presuming that the data are serious from somewhere. If that isn't so, then this reply loses some of its force.

\n

Here is a scatter plot of Post versus Pre. Ties on Pre or Post are naturally shown by vertical or horizontal alignment; ties on both are shown by text 2 rather than text 1 on the graph.

\n

\"enter

\n

Here we range from evident to speculative:

\n
    \n
  1. Integer scores, so ties are more likely than otherwise.

    \n
  2. \n
  3. Is there an upper limit of 32?

    \n
  4. \n
  5. The observations seem to fall into two groups, those whose Post score is quite good, and those whose Post score is about the same as their Pre.

    \n
  6. \n
\n

A Wilcoxon test can't pay direct attention to such details emerging from a very simple graphical analysis. Sure, 11/13 had higher Post, 1 the same, 1 lower. But does the test really help?

\n", "answer_id": 677141, "answer_text": "This arguably should at most be a comment as it doesn't attempt to answer the question at all. But I have a graph, and my comment also pertains to many applications of such tests that are likely not very helpful in data analysis. I am presuming that the data are serious from somewhere. If that isn't so, then this reply loses some of its force.\n\n\n\n\nHere is a scatter plot of Post versus Pre. Ties on Pre or Post are naturally shown by vertical or horizontal alignment; ties on both are shown by text 2 rather than text 1 on the graph.\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/7o9W87he.png] (https://i.sstatic.net/7o9W87he.png)\n\n\n\n\nHere we range from evident to speculative:\n\n\n\n\n\n\n\nInteger scores, so ties are more likely than otherwise.\n\n\n\n\n\n\n\n\n\nIs there an upper limit of 32?\n\n\n\n\n\n\n\n\n\nThe observations seem to fall into two groups, those whose Post score is quite good, and those whose Post score is about the same as their Pre.\n\n\n\n\n\n\n\n\nA Wilcoxon test can't pay direct attention to such details emerging from a very simple graphical analysis. Sure, 11/13 had higher Post, 1 the same, 1 lower. But does the test really help?", "answer_url": "https://stats.stackexchange.com/a/677141", "author": "Nick Cox", "author_url": "https://stats.stackexchange.com/users/22047/nick-cox", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-11T08:47:46+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677135, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nick Cox", "profile_url": "https://stats.stackexchange.com/users/22047/nick-cox", "user_type": "registered"}, "created_at": "2026-09-11T08:47:46+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "F5E781A6-F63A-4F3B-897E-03303213674F", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/F5E781A6-F63A-4F3B-897E-03303213674F/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nick Cox", "profile_url": "https://stats.stackexchange.com/users/22047/nick-cox", "user_type": "registered"}, "created_at": "2026-09-11T09:20:25+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "2F24FDA3-AB03-426F-84C2-A097A0D37730", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/2F24FDA3-AB03-426F-84C2-A097A0D37730/view-source"}], "score": 7, "updated_at": "2026-09-11T09:20:25+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I ran wilcox.test(df$PostScore, df$PreScore, conf.int = TRUE, paired=TRUE, exact = TRUE) on the following data set:\n\n\n\n\ndf <- structure(list(PreScore = c(16, 23, 17, 24, 22, 27, 20, 18, 21, \n26, 25, 23, 18), PostScore = c(20, 31, 17, 31, 32, 31, 31, 30, \n30, 32, 30, 31, 17)), row.names = c(NA, -13L), class = c(\"tbl_df\", \n\"tbl\", \"data.frame\"))\n\n\n\n\n\nAs there are ties in the data I would have expected wilcox.test() to produce a warning. Why is there no warning in this case?\n\n\n\n\nHere is the reprex. I have tested it in an online IDE and obtained the same result as in my environment. I still do not see why ties are not reported.\n\n\n\n\n\nprepost <- structure(\n list(\n PreScore = c(16, 23, 17, 24, 22, 27, 20, 18, 21, 26, 25, 23, 18),\n PostScore = c(20, 31, 17, 31, 32, 31, 31, 30, 30, 32, 30, 31, 17)\n ),\n row.names = c(NA, -13L),\n class = c(\"tbl_df\", \"tbl\", \"data.frame\")\n)\n\nwilcox.test(\n prepost$PostScore,\n prepost$PreScore,\n conf.int = TRUE,\n paired = TRUE,\n exact = TRUE\n)\n#> \n#> Wilcoxon signed rank exact test\n#> \n#> data: prepost$PostScore and prepost$PreScore\n#> V = 88, p-value = 0.0009766\n#> alternative hypothesis: true location shift is not equal to 0\n#> 96.7 percent confidence interval:\n#> 4 9\n#> sample estimates:\n#> (pseudo)median \n#> 6.5\n\nsessionInfo()\n#> R version 4.6.1 (2026-06-24)\n#> Platform: x86_64-pc-linux-gnu\n#> Running under: Garuda Linux\n#> \n#> Matrix products: default\n#> BLAS: /usr/lib/libblas.so.3.12.0 \n#> LAPACK: /usr/lib/liblapack.so.3.12.0 LAPACK version 3.12.0\n#> \n#> locale:\n#> [1] LC_CTYPE=en_SG.UTF-8 LC_NUMERIC=C \n#> [3] LC_TIME=en_SG.UTF-8 LC_COLLATE=en_SG.UTF-8 \n#> [5] LC_MONETARY=en_SG.UTF-8 LC_MESSAGES=en_SG.UTF-8 \n#> [7] LC_PAPER=en_SG.UTF-8 LC_NAME=C \n#> [9] LC_ADDRESS=C LC_TELEPHONE=C \n#> [11] LC_MEASUREMENT=en_SG.UTF-8 LC_IDENTIFICATION=C \n#> \n#> time zone: Asia/Kuala_Lumpur\n#> tzcode source: system (glibc)\n#> \n#> attached base packages:\n#> [1] stats graphics grDevices utils datasets methods base \n#> \n#> loaded via a namespace (and not attached):\n#> [1] digest_0.6.39 fastmap_1.2.0 xfun_0.60 glue_1.8.1 \n#> [5] knitr_1.51 htmltools_0.5.9 rmarkdown_2.32 lifecycle_1.0.5 \n#> [9] cli_3.6.6 reprex_2.1.1 withr_3.0.2 compiler_4.6.1 \n#> [13] rstudioapi_0.19.0 tools_4.6.1 evaluate_1.0.5 yaml_2.3.12 \n#> [17] otel_0.2.0 rlang_1.2.0 fs_2.1.0\n```", "record_id": "Scientific-Answer-Ranking:stats:677135", "scores": [5, 16, 7], "split": "train", "thread": {"accepted_answer_id": 677139, "answers": [{"answer_html": "

Can you provide a {reprex}? I'm getting a warning when I run your code

\n
df <- structure(list(PreScore = c(16, 23, 17, 24, 22, 27, 20, 18, 21, \n                                  26, 25, 23, 18), PostScore = c(20, 31, 17, 31, 32, 31, 31, 30, \n                                                                 30, 32, 30, 31, 17)), row.names = c(NA, -13L), class = c("tbl_df", \n                                                                                                                          "tbl", "data.frame"))\n\nwilcox.test(df$PostScore, df$PreScore, conf.int = TRUE, paired=TRUE, exact = TRUE)\n#> Warning in wilcox.test.default(df$PostScore, df$PreScore, conf.int = TRUE, :\n#> cannot compute exact p-value with ties\n#> Warning in wilcox.test.default(df$PostScore, df$PreScore, conf.int = TRUE, :\n#> cannot compute exact confidence interval with ties\n#> Warning in wilcox.test.default(df$PostScore, df$PreScore, conf.int = TRUE, :\n#> cannot compute exact p-value with zeroes\n#> Warning in wilcox.test.default(df$PostScore, df$PreScore, conf.int = TRUE, :\n#> cannot compute exact confidence interval with zeroes\n#> \n#>  Wilcoxon signed rank test with continuity correction\n#> \n#> data:  df$PostScore and df$PreScore\n#> V = 77, p-value = 0.00324\n#> alternative hypothesis: true location shift is not equal to 0\n#> 95 percent confidence interval:\n#>  4.500064 9.499992\n#> sample estimates:\n#> (pseudo)median \n#>       7.000049\n
\n

Created on 2026-09-10 with reprex v2.1.1

\n

EDIT: I was using an old version of R. Here is the reprex from using 4.6

\n
(R.version.string)\n#> [1] "R version 4.6.0 (2026-04-24)"\n\ndf <- structure(list(PreScore = c(16, 23, 17, 24, 22, 27, 20, 18, 21, \n                                  26, 25, 23, 18), PostScore = c(20, 31, 17, 31, 32, 31, 31, 30, \n                                                                 30, 32, 30, 31, 17)), row.names = c(NA, -13L), class = c("tbl_df", \n                                                                                                                          "tbl", "data.frame"))\n\nwilcox.test(df$PostScore, df$PreScore, conf.int = TRUE, paired=TRUE, exact = TRUE)\n#> \n#>  Wilcoxon signed rank exact test\n#> \n#> data:  df$PostScore and df$PreScore\n#> V = 88, p-value = 0.0009766\n#> alternative hypothesis: true location shift is not equal to 0\n#> 96.7 percent confidence interval:\n#>  4 9\n#> sample estimates:\n#> (pseudo)median \n#>            6.5\n
\n

Created on 2026-09-11 with reprex v2.1.1

\n

Note, no warning. See J-J-J's comment for an explanation.

\n", "answer_id": 677136, "answer_text": "Can you provide a {reprex} (https://reprex.tidyverse.org/)? I'm getting a warning when I run your code\n\n\n\n\ndf <- structure(list(PreScore = c(16, 23, 17, 24, 22, 27, 20, 18, 21, \n 26, 25, 23, 18), PostScore = c(20, 31, 17, 31, 32, 31, 31, 30, \n 30, 32, 30, 31, 17)), row.names = c(NA, -13L), class = c(\"tbl_df\", \n \"tbl\", \"data.frame\"))\n\nwilcox.test(df$PostScore, df$PreScore, conf.int = TRUE, paired=TRUE, exact = TRUE)\n#> Warning in wilcox.test.default(df$PostScore, df$PreScore, conf.int = TRUE, :\n#> cannot compute exact p-value with ties\n#> Warning in wilcox.test.default(df$PostScore, df$PreScore, conf.int = TRUE, :\n#> cannot compute exact confidence interval with ties\n#> Warning in wilcox.test.default(df$PostScore, df$PreScore, conf.int = TRUE, :\n#> cannot compute exact p-value with zeroes\n#> Warning in wilcox.test.default(df$PostScore, df$PreScore, conf.int = TRUE, :\n#> cannot compute exact confidence interval with zeroes\n#> \n#> Wilcoxon signed rank test with continuity correction\n#> \n#> data: df$PostScore and df$PreScore\n#> V = 77, p-value = 0.00324\n#> alternative hypothesis: true location shift is not equal to 0\n#> 95 percent confidence interval:\n#> 4.500064 9.499992\n#> sample estimates:\n#> (pseudo)median \n#> 7.000049\n\n\n\n\n\nCreated on 2026-09-10 with reprex v2.1.1 (https://reprex.tidyverse.org)\n\n\n\n\nEDIT: I was using an old version of R. Here is the reprex from using 4.6\n\n\n\n\n(R.version.string)\n#> [1] \"R version 4.6.0 (2026-04-24)\"\n\ndf <- structure(list(PreScore = c(16, 23, 17, 24, 22, 27, 20, 18, 21, \n 26, 25, 23, 18), PostScore = c(20, 31, 17, 31, 32, 31, 31, 30, \n 30, 32, 30, 31, 17)), row.names = c(NA, -13L), class = c(\"tbl_df\", \n \"tbl\", \"data.frame\"))\n\nwilcox.test(df$PostScore, df$PreScore, conf.int = TRUE, paired=TRUE, exact = TRUE)\n#> \n#> Wilcoxon signed rank exact test\n#> \n#> data: df$PostScore and df$PreScore\n#> V = 88, p-value = 0.0009766\n#> alternative hypothesis: true location shift is not equal to 0\n#> 96.7 percent confidence interval:\n#> 4 9\n#> sample estimates:\n#> (pseudo)median \n#> 6.5\n\n\n\n\n\nCreated on 2026-09-11 with reprex v2.1.1 (https://reprex.tidyverse.org)\n\n\n\n\nNote, no warning. See J-J-J's comment for an explanation.", "answer_url": "https://stats.stackexchange.com/a/677136", "author": "Demetri Pananos", "author_url": "https://stats.stackexchange.com/users/111259/demetri-pananos", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-11T01:34:59+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677135, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Demetri Pananos", "profile_url": "https://stats.stackexchange.com/users/111259/demetri-pananos", "user_type": "registered"}, "created_at": "2026-09-11T01:34:59+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "3461E410-C604-4E94-BBD3-042259374DDF", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/3461E410-C604-4E94-BBD3-042259374DDF/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Demetri Pananos", "profile_url": "https://stats.stackexchange.com/users/111259/demetri-pananos", "user_type": "registered"}, "created_at": "2026-09-11T17:41:38+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "C692081B-A074-4F0B-985E-9AECEBE88DE5", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/C692081B-A074-4F0B-985E-9AECEBE88DE5/view-source"}], "score": 5, "updated_at": "2026-09-11T17:41:38+00:00"}, {"answer_html": "

You are using R version 4.6.1. Well, since R 4.6.0, from R News:

\n
\n

wilcox.test() can now perform exact (conditional) inference in case\nof ties. Based on contributions by Torsten Hothorn.

\n
\n

Therefore, it seems there's no longer a reason to throw a warning. The wilcox.test() documentation says:

\n
\n

If there are ties, exact inference is performed using the\nconditional/permutation distribution given the observed ranks, using\nan implementation of the Streitberg–Röhmel shift algorithm (Streitberg\nand Röhmel 1986; Streitberg and Röhmel 1987) contributed by Torsten\nHothorn.

\n
\n

[...]

\n
\n

Streitberg B, Röhmel J (1986). “Exact Distributions for Permutation\nand Rank Tests: An Introduction to Some Recently Published\nAlgorithms.” Statistical Software Newsletter, 12(1), 10–17. ISSN\n0173-5896.

\n

Streitberg B, Röhmel J (1987). “Exakte Verteilungen für Rang- und\nRandomisierungstests im allgemeinen c-Stichprobenfall.” EDV in Medizin\nund Biologie, 18(1), 12–19. ISSN 0300-8282.\nhttps://ul.qucosa.de/api/qucosa%3A12624/attachment/ATT-0/.

\n
\n", "answer_id": 677139, "answer_text": "You are using R version 4.6.1. Well, since R 4.6.0, from R News (https://cran.r-project.org/doc/manuals/r-release/NEWS.html):\n\n\n\n\n\n\n\nwilcox.test() can now perform exact (conditional) inference in case\nof ties. Based on contributions by Torsten Hothorn.\n\n\n\n\n\n\n\nTherefore, it seems there's no longer a reason to throw a warning. The wilcox.test() documentation says:\n\n\n\n\n\n\n\nIf there are ties, exact inference is performed using the\nconditional/permutation distribution given the observed ranks, using\nan implementation of the Streitberg–Röhmel shift algorithm (Streitberg\nand Röhmel 1986; Streitberg and Röhmel 1987) contributed by Torsten\nHothorn.\n\n\n\n\n\n\n\n[...]\n\n\n\n\n\n\n\nStreitberg B, Röhmel J (1986). “Exact Distributions for Permutation\nand Rank Tests: An Introduction to Some Recently Published\nAlgorithms.” Statistical Software Newsletter, 12(1), 10–17. ISSN\n0173-5896.\n\n\n\n\nStreitberg B, Röhmel J (1987). “Exakte Verteilungen für Rang- und\nRandomisierungstests im allgemeinen c-Stichprobenfall.” EDV in Medizin\nund Biologie, 18(1), 12–19. ISSN 0300-8282.\nhttps://ul.qucosa.de/api/qucosa%3A12624/attachment/ATT-0/ (https://ul.qucosa.de/api/qucosa%3A12624/attachment/ATT-0/).", "answer_url": "https://stats.stackexchange.com/a/677139", "author": "J-J-J", "author_url": "https://stats.stackexchange.com/users/164936/j-j-j", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-11T07:32:22+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677135, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "J-J-J", "profile_url": "https://stats.stackexchange.com/users/164936/j-j-j", "user_type": "registered"}, "created_at": "2026-09-11T07:32:22+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "23216BD3-49D3-422F-8020-02B7D9CD2B5A", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/23216BD3-49D3-422F-8020-02B7D9CD2B5A/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "J-J-J", "profile_url": "https://stats.stackexchange.com/users/164936/j-j-j", "user_type": "registered"}, "created_at": "2026-09-11T08:09:51+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "CB4779A0-4EA1-4BB0-99F8-7FFB266F646D", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/CB4779A0-4EA1-4BB0-99F8-7FFB266F646D/view-source"}], "score": 16, "updated_at": "2026-09-11T08:09:51+00:00"}, {"answer_html": "

This arguably should at most be a comment as it doesn't attempt to answer the question at all. But I have a graph, and my comment also pertains to many applications of such tests that are likely not very helpful in data analysis. I am presuming that the data are serious from somewhere. If that isn't so, then this reply loses some of its force.

\n

Here is a scatter plot of Post versus Pre. Ties on Pre or Post are naturally shown by vertical or horizontal alignment; ties on both are shown by text 2 rather than text 1 on the graph.

\n

\"enter

\n

Here we range from evident to speculative:

\n
    \n
  1. Integer scores, so ties are more likely than otherwise.

    \n
  2. \n
  3. Is there an upper limit of 32?

    \n
  4. \n
  5. The observations seem to fall into two groups, those whose Post score is quite good, and those whose Post score is about the same as their Pre.

    \n
  6. \n
\n

A Wilcoxon test can't pay direct attention to such details emerging from a very simple graphical analysis. Sure, 11/13 had higher Post, 1 the same, 1 lower. But does the test really help?

\n", "answer_id": 677141, "answer_text": "This arguably should at most be a comment as it doesn't attempt to answer the question at all. But I have a graph, and my comment also pertains to many applications of such tests that are likely not very helpful in data analysis. I am presuming that the data are serious from somewhere. If that isn't so, then this reply loses some of its force.\n\n\n\n\nHere is a scatter plot of Post versus Pre. Ties on Pre or Post are naturally shown by vertical or horizontal alignment; ties on both are shown by text 2 rather than text 1 on the graph.\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/7o9W87he.png] (https://i.sstatic.net/7o9W87he.png)\n\n\n\n\nHere we range from evident to speculative:\n\n\n\n\n\n\n\nInteger scores, so ties are more likely than otherwise.\n\n\n\n\n\n\n\n\n\nIs there an upper limit of 32?\n\n\n\n\n\n\n\n\n\nThe observations seem to fall into two groups, those whose Post score is quite good, and those whose Post score is about the same as their Pre.\n\n\n\n\n\n\n\n\nA Wilcoxon test can't pay direct attention to such details emerging from a very simple graphical analysis. Sure, 11/13 had higher Post, 1 the same, 1 lower. But does the test really help?", "answer_url": "https://stats.stackexchange.com/a/677141", "author": "Nick Cox", "author_url": "https://stats.stackexchange.com/users/22047/nick-cox", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-11T08:47:46+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677135, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nick Cox", "profile_url": "https://stats.stackexchange.com/users/22047/nick-cox", "user_type": "registered"}, "created_at": "2026-09-11T08:47:46+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "F5E781A6-F63A-4F3B-897E-03303213674F", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/F5E781A6-F63A-4F3B-897E-03303213674F/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nick Cox", "profile_url": "https://stats.stackexchange.com/users/22047/nick-cox", "user_type": "registered"}, "created_at": "2026-09-11T09:20:25+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "2F24FDA3-AB03-426F-84C2-A097A0D37730", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/2F24FDA3-AB03-426F-84C2-A097A0D37730/view-source"}], "score": 7, "updated_at": "2026-09-11T09:20:25+00:00"}], "domain": "statistics", "external_links": ["https://cran.r-project.org/doc/manuals/r-release/NEWS.html", "https://i.sstatic.net/7o9W87he.png", "https://reprex.tidyverse.org", "https://reprex.tidyverse.org/", "https://ul.qucosa.de/api/qucosa%3A12624/attachment/ATT-0/"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:03.428408+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/774052c18cd9e8fa951e893347bfa3c1a85e743fc46ec4667572002cadb10cbf_1790825224163423600_0.json", "raw_sha256": "fe4dd06d3de6c0b1bb33ba88aee0ed4284118e01f76a58dcdce220a4946329b2", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "DAVID PAUL CAPELLE", "question_author_url": "https://stats.stackexchange.com/users/386267/david-paul-capelle", "question_author_user_type": "registered", "question_created_at": "2026-09-11T01:14:02+00:00", "question_html": "

I ran wilcox.test(df$PostScore, df$PreScore, conf.int = TRUE, paired=TRUE, exact = TRUE) on the following data set:

\n
df <- structure(list(PreScore = c(16, 23, 17, 24, 22, 27, 20, 18, 21, \n26, 25, 23, 18), PostScore = c(20, 31, 17, 31, 32, 31, 31, 30, \n30, 32, 30, 31, 17)), row.names = c(NA, -13L), class = c("tbl_df", \n"tbl", "data.frame"))\n
\n

As there are ties in the data I would have expected wilcox.test() to produce a warning. Why is there no warning in this case?

\n

Here is the reprex. I have tested it in an online IDE and obtained the same result as in my environment. I still do not see why ties are not reported.

\n
\nprepost <- structure(\n  list(\n    PreScore = c(16, 23, 17, 24, 22, 27, 20, 18, 21, 26, 25, 23, 18),\n    PostScore = c(20, 31, 17, 31, 32, 31, 31, 30, 30, 32, 30, 31, 17)\n  ),\n  row.names = c(NA, -13L),\n  class = c("tbl_df", "tbl", "data.frame")\n)\n\nwilcox.test(\n  prepost$PostScore,\n  prepost$PreScore,\n  conf.int = TRUE,\n  paired = TRUE,\n  exact = TRUE\n)\n#> \n#>  Wilcoxon signed rank exact test\n#> \n#> data:  prepost$PostScore and prepost$PreScore\n#> V = 88, p-value = 0.0009766\n#> alternative hypothesis: true location shift is not equal to 0\n#> 96.7 percent confidence interval:\n#>  4 9\n#> sample estimates:\n#> (pseudo)median \n#>            6.5\n\nsessionInfo()\n#> R version 4.6.1 (2026-06-24)\n#> Platform: x86_64-pc-linux-gnu\n#> Running under: Garuda Linux\n#> \n#> Matrix products: default\n#> BLAS:   /usr/lib/libblas.so.3.12.0 \n#> LAPACK: /usr/lib/liblapack.so.3.12.0  LAPACK version 3.12.0\n#> \n#> locale:\n#>  [1] LC_CTYPE=en_SG.UTF-8       LC_NUMERIC=C              \n#>  [3] LC_TIME=en_SG.UTF-8        LC_COLLATE=en_SG.UTF-8    \n#>  [5] LC_MONETARY=en_SG.UTF-8    LC_MESSAGES=en_SG.UTF-8   \n#>  [7] LC_PAPER=en_SG.UTF-8       LC_NAME=C                 \n#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            \n#> [11] LC_MEASUREMENT=en_SG.UTF-8 LC_IDENTIFICATION=C       \n#> \n#> time zone: Asia/Kuala_Lumpur\n#> tzcode source: system (glibc)\n#> \n#> attached base packages:\n#> [1] stats     graphics  grDevices utils     datasets  methods   base     \n#> \n#> loaded via a namespace (and not attached):\n#>  [1] digest_0.6.39     fastmap_1.2.0     xfun_0.60         glue_1.8.1       \n#>  [5] knitr_1.51        htmltools_0.5.9   rmarkdown_2.32    lifecycle_1.0.5  \n#>  [9] cli_3.6.6         reprex_2.1.1      withr_3.0.2       compiler_4.6.1   \n#> [13] rstudioapi_0.19.0 tools_4.6.1       evaluate_1.0.5    yaml_2.3.12      \n#> [17] otel_0.2.0        rlang_1.2.0       fs_2.1.0\n```\n
\n", "question_id": 677135, "question_license": "CC BY-SA 4.0", "question_score": 10, "question_text": "I ran wilcox.test(df$PostScore, df$PreScore, conf.int = TRUE, paired=TRUE, exact = TRUE) on the following data set:\n\n\n\n\ndf <- structure(list(PreScore = c(16, 23, 17, 24, 22, 27, 20, 18, 21, \n26, 25, 23, 18), PostScore = c(20, 31, 17, 31, 32, 31, 31, 30, \n30, 32, 30, 31, 17)), row.names = c(NA, -13L), class = c(\"tbl_df\", \n\"tbl\", \"data.frame\"))\n\n\n\n\n\nAs there are ties in the data I would have expected wilcox.test() to produce a warning. Why is there no warning in this case?\n\n\n\n\nHere is the reprex. I have tested it in an online IDE and obtained the same result as in my environment. I still do not see why ties are not reported.\n\n\n\n\n\nprepost <- structure(\n list(\n PreScore = c(16, 23, 17, 24, 22, 27, 20, 18, 21, 26, 25, 23, 18),\n PostScore = c(20, 31, 17, 31, 32, 31, 31, 30, 30, 32, 30, 31, 17)\n ),\n row.names = c(NA, -13L),\n class = c(\"tbl_df\", \"tbl\", \"data.frame\")\n)\n\nwilcox.test(\n prepost$PostScore,\n prepost$PreScore,\n conf.int = TRUE,\n paired = TRUE,\n exact = TRUE\n)\n#> \n#> Wilcoxon signed rank exact test\n#> \n#> data: prepost$PostScore and prepost$PreScore\n#> V = 88, p-value = 0.0009766\n#> alternative hypothesis: true location shift is not equal to 0\n#> 96.7 percent confidence interval:\n#> 4 9\n#> sample estimates:\n#> (pseudo)median \n#> 6.5\n\nsessionInfo()\n#> R version 4.6.1 (2026-06-24)\n#> Platform: x86_64-pc-linux-gnu\n#> Running under: Garuda Linux\n#> \n#> Matrix products: default\n#> BLAS: /usr/lib/libblas.so.3.12.0 \n#> LAPACK: /usr/lib/liblapack.so.3.12.0 LAPACK version 3.12.0\n#> \n#> locale:\n#> [1] LC_CTYPE=en_SG.UTF-8 LC_NUMERIC=C \n#> [3] LC_TIME=en_SG.UTF-8 LC_COLLATE=en_SG.UTF-8 \n#> [5] LC_MONETARY=en_SG.UTF-8 LC_MESSAGES=en_SG.UTF-8 \n#> [7] LC_PAPER=en_SG.UTF-8 LC_NAME=C \n#> [9] LC_ADDRESS=C LC_TELEPHONE=C \n#> [11] LC_MEASUREMENT=en_SG.UTF-8 LC_IDENTIFICATION=C \n#> \n#> time zone: Asia/Kuala_Lumpur\n#> tzcode source: system (glibc)\n#> \n#> attached base packages:\n#> [1] stats graphics grDevices utils datasets methods base \n#> \n#> loaded via a namespace (and not attached):\n#> [1] digest_0.6.39 fastmap_1.2.0 xfun_0.60 glue_1.8.1 \n#> [5] knitr_1.51 htmltools_0.5.9 rmarkdown_2.32 lifecycle_1.0.5 \n#> [9] cli_3.6.6 reprex_2.1.1 withr_3.0.2 compiler_4.6.1 \n#> [13] rstudioapi_0.19.0 tools_4.6.1 evaluate_1.0.5 yaml_2.3.12 \n#> [17] otel_0.2.0 rlang_1.2.0 fs_2.1.0\n```", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "DAVID PAUL CAPELLE", "profile_url": "https://stats.stackexchange.com/users/386267/david-paul-capelle", "user_type": "registered"}, "created_at": "2026-09-11T01:14:02+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "93652C25-9FE3-4C77-B0E9-CF7DD58DC50A", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/93652C25-9FE3-4C77-B0E9-CF7DD58DC50A/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "DAVID PAUL CAPELLE", "profile_url": "https://stats.stackexchange.com/users/386267/david-paul-capelle", "user_type": "registered"}, "created_at": "2026-09-11T06:13:00+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "C7E16D39-DC10-460F-B943-B7547B90F63D", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/C7E16D39-DC10-460F-B943-B7547B90F63D/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-09-11T09:18:50+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "BC7129B7-4E28-49C0-8308-97D09DE31CA9", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/BC7129B7-4E28-49C0-8308-97D09DE31CA9/view-source"}, {"content_license": null, "contributor": {"display_name": "M--", "profile_url": "https://stats.stackexchange.com/users/154449/m", "user_type": "registered"}, "created_at": "2026-09-13T11:06:51+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "052E2710-AD21-4AFE-992F-D9FB54C17A14", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/052E2710-AD21-4AFE-992F-D9FB54C17A14/view-source"}], "source_site": "stats", "source_url": "https://stats.stackexchange.com/questions/677135/why-does-r-not-warn-about-ties-in-wilcox-test", "split": "train", "split_group": "fb4920dde6ede8f339350f0d34d985d9c1dcf8eb8ac2beea3857cb378c76b04b", "tags": ["r", "ties"], "thread_id": "stats:677135", "title": "Why does R not warn about ties in wilcox.test()"}} {"accepted_status": [false, false], "candidate_answers": [{"answer_html": "

B-splines are designed to be local* (only nearby x-values affect the relevant predictor, and hence the fitted response).

\n

Consequently the predictor columns will be zero out of the local interval (described in terms of the nearby few knots), and hence for small such intervals will be mostly-zero.

\n
\n

* This locality is mathematically and graphically explicit in the wikipedia article, which is worth reading.

\n", "answer_id": 677156, "answer_text": "B-splines are designed to be local* (only nearby x-values affect the relevant predictor, and hence the fitted response).\n\n\n\n\nConsequently the predictor columns will be zero out of the local interval (described in terms of the nearby few knots), and hence for small such intervals will be mostly-zero.\n\n\n\n\n\n\n\n* This locality is mathematically and graphically explicit in the wikipedia article, which is worth reading.", "answer_url": "https://stats.stackexchange.com/a/677156", "author": "Glen_b", "author_url": "https://stats.stackexchange.com/users/805/glen-b", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-13T02:41:43+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677137, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T02:41:43+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "F103E6FE-AD3D-4F47-A179-708950A92E6A", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/F103E6FE-AD3D-4F47-A179-708950A92E6A/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T03:16:34+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "323EB6A5-54C4-485A-910C-C896C850F031", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/323EB6A5-54C4-485A-910C-C896C850F031/view-source"}], "score": 10, "updated_at": "2026-09-13T03:16:34+00:00"}, {"answer_html": "

Amplifying @Glen_b's answer and @whuber's comment: here's the plot of the basis elements (for $-3 \\lt x \\lt 6$), with the ones that are non-zero at $x=1.5$ highlighted:

\n

\"plot

\n
library(splines)\nx_i <- 1.5\nx_all <- seq(-3, 6, length.out = 150)\nbasis_matrix <- splines::bs(x_all,\n                             knots = -2:5, \n                             Boundary.knots = c(-3, 6),\n                             degree = 3)\npos_el <- rep(c(1,2,1), c(3,4,3))\npar(las=1, bty = "l") ## cosmetic\nmatplot(x_all, basis_matrix, type = "l", lty = 3-pos_el, lwd = pos_el)\nabline(v=1.5, lty = 2)\n
\n", "answer_id": 677164, "answer_text": "Amplifying @Glen_b's answer and @whuber's comment: here's the plot of the basis elements (for $-3 \\lt x \\lt 6$), with the ones that are non-zero at $x=1.5$ highlighted:\n\n\n\n\n[image: plot of the basis elements of a spline, with the elements that are non-zero at x=1.5 highlighted (solid, thick lines); source: https://i.sstatic.net/7o5ja3We.png] (https://i.sstatic.net/7o5ja3We.png)\n\n\n\n\nlibrary(splines)\nx_i <- 1.5\nx_all <- seq(-3, 6, length.out = 150)\nbasis_matrix <- splines::bs(x_all,\n knots = -2:5, \n Boundary.knots = c(-3, 6),\n degree = 3)\npos_el <- rep(c(1,2,1), c(3,4,3))\npar(las=1, bty = \"l\") ## cosmetic\nmatplot(x_all, basis_matrix, type = \"l\", lty = 3-pos_el, lwd = pos_el)\nabline(v=1.5, lty = 2)", "answer_url": "https://stats.stackexchange.com/a/677164", "author": "Ben Bolker", "author_url": "https://stats.stackexchange.com/users/2126/ben-bolker", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-13T20:32:49+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677137, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ben Bolker", "profile_url": "https://stats.stackexchange.com/users/2126/ben-bolker", "user_type": "registered"}, "created_at": "2026-09-13T20:32:49+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "EBF57CF7-0E40-482E-A05C-136F42F17A79", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/EBF57CF7-0E40-482E-A05C-136F42F17A79/view-source"}], "score": 6, "updated_at": "2026-09-13T20:32:49+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I've been studying how splines::bs() builds its basis matrix, and I'm trying to fully understand why the returned matrix has so many zero entries.\n\n\n\n\nThe worked example in Ken Koon Wong's blog post \"Understanding Basis Spline (B-spline) By Working Through Cox-deBoor Algorithm\", reproduced below:\n\n\n\n\nlibrary(splines)\nx_i <- 1.5\nbasis_matrix <- splines::bs(x_i,\n knots = c(-2, -1, 0, 1, 2, 3, 4, 5), # interior knots\n Boundary.knots = c(-3, 6), # boundary knots\n degree = 3)\nbasis_matrix\n\n\n\n\n\nResult:\n\n\n\n\n## 1 2 3 4 5 6 7 8 9 10 11\n## [1,] 0 0 0 0.02083333 0.4791667 0.4791667 0.02083333 0 0 0 0\n## attr(,\"degree\")\n## [1] 3\n## attr(,\"knots\")\n## [1] -2 -1 0 1 2 3 4 5\n## attr(,\"Boundary.knots\")\n## [1] -3 6\n## attr(,\"intercept\")\n## [1] FALSE\n## attr(,\"class\")\n## [1] \"bs\" \"basis\" \"matrix\"\n\n\n\n\n\nWong explained:\n\n\n\n\n\n\n\nAwesome!!! We have very similar numbers !!! But why are there so many columns? And they’re filled with zeros, reminds me almost like padding. Apparently this is mainly to ensure no issues when x is very close to boundary knots is my understanding. And the way they add these padding depends on degrees + 1 if you use degree = 3, add 1 to it and that would be how many repeats of the numbers of your boundary knots.\n\n\n\n\n\n\n\nBut why are the number of leading and trailing zeros different?\n\n\n\n\nFrom wiki of De Boor's algorithm,\n\n\n\n\n\n\n\nIt follows from i≥0 that k≥p. Similarly, we see in the recursion that the highest queried knot location is at index k+1+p. This means that any knot interval [tk,tk+1) which is actually used must have at least p additional knots before and after. In a computer program, this is typically achieved by repeating the first and last used knot location p times. For example, for p=3 and real knot locations (0,1,2), one would pad the knot vector to (0,0,0,0,1,2,2,2,2).\n\n\n\n\n\n\n\n{which is actually used must have at least p additional knots before and after}<- Then the number of leading and trailing zeros should be the same? i.e. 3+1 = 4\n\n\n\n\n\n\n\nUpdate:\nAccording to the calculation by Ken Koon Wong,\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/v4LeyMo7.png] (https://i.sstatic.net/v4LeyMo7.png)\n\n\n\n\nThe position of knots should be c(-3,-3,-3,-3,-2, -1, 0, 1, 2,2,2,2)?\nAm I correct?", "record_id": "Scientific-Answer-Ranking:stats:677137", "scores": [10, 6], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

B-splines are designed to be local* (only nearby x-values affect the relevant predictor, and hence the fitted response).

\n

Consequently the predictor columns will be zero out of the local interval (described in terms of the nearby few knots), and hence for small such intervals will be mostly-zero.

\n
\n

* This locality is mathematically and graphically explicit in the wikipedia article, which is worth reading.

\n", "answer_id": 677156, "answer_text": "B-splines are designed to be local* (only nearby x-values affect the relevant predictor, and hence the fitted response).\n\n\n\n\nConsequently the predictor columns will be zero out of the local interval (described in terms of the nearby few knots), and hence for small such intervals will be mostly-zero.\n\n\n\n\n\n\n\n* This locality is mathematically and graphically explicit in the wikipedia article, which is worth reading.", "answer_url": "https://stats.stackexchange.com/a/677156", "author": "Glen_b", "author_url": "https://stats.stackexchange.com/users/805/glen-b", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-13T02:41:43+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677137, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T02:41:43+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "F103E6FE-AD3D-4F47-A179-708950A92E6A", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/F103E6FE-AD3D-4F47-A179-708950A92E6A/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T03:16:34+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "323EB6A5-54C4-485A-910C-C896C850F031", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/323EB6A5-54C4-485A-910C-C896C850F031/view-source"}], "score": 10, "updated_at": "2026-09-13T03:16:34+00:00"}, {"answer_html": "

Amplifying @Glen_b's answer and @whuber's comment: here's the plot of the basis elements (for $-3 \\lt x \\lt 6$), with the ones that are non-zero at $x=1.5$ highlighted:

\n

\"plot

\n
library(splines)\nx_i <- 1.5\nx_all <- seq(-3, 6, length.out = 150)\nbasis_matrix <- splines::bs(x_all,\n                             knots = -2:5, \n                             Boundary.knots = c(-3, 6),\n                             degree = 3)\npos_el <- rep(c(1,2,1), c(3,4,3))\npar(las=1, bty = "l") ## cosmetic\nmatplot(x_all, basis_matrix, type = "l", lty = 3-pos_el, lwd = pos_el)\nabline(v=1.5, lty = 2)\n
\n", "answer_id": 677164, "answer_text": "Amplifying @Glen_b's answer and @whuber's comment: here's the plot of the basis elements (for $-3 \\lt x \\lt 6$), with the ones that are non-zero at $x=1.5$ highlighted:\n\n\n\n\n[image: plot of the basis elements of a spline, with the elements that are non-zero at x=1.5 highlighted (solid, thick lines); source: https://i.sstatic.net/7o5ja3We.png] (https://i.sstatic.net/7o5ja3We.png)\n\n\n\n\nlibrary(splines)\nx_i <- 1.5\nx_all <- seq(-3, 6, length.out = 150)\nbasis_matrix <- splines::bs(x_all,\n knots = -2:5, \n Boundary.knots = c(-3, 6),\n degree = 3)\npos_el <- rep(c(1,2,1), c(3,4,3))\npar(las=1, bty = \"l\") ## cosmetic\nmatplot(x_all, basis_matrix, type = \"l\", lty = 3-pos_el, lwd = pos_el)\nabline(v=1.5, lty = 2)", "answer_url": "https://stats.stackexchange.com/a/677164", "author": "Ben Bolker", "author_url": "https://stats.stackexchange.com/users/2126/ben-bolker", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-13T20:32:49+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677137, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ben Bolker", "profile_url": "https://stats.stackexchange.com/users/2126/ben-bolker", "user_type": "registered"}, "created_at": "2026-09-13T20:32:49+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "EBF57CF7-0E40-482E-A05C-136F42F17A79", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/EBF57CF7-0E40-482E-A05C-136F42F17A79/view-source"}], "score": 6, "updated_at": "2026-09-13T20:32:49+00:00"}], "domain": "statistics", "external_links": ["https://i.sstatic.net/7o5ja3We.png", "https://i.sstatic.net/v4LeyMo7.png"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:03.428408+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/774052c18cd9e8fa951e893347bfa3c1a85e743fc46ec4667572002cadb10cbf_1790825224163423600_0.json", "raw_sha256": "fe4dd06d3de6c0b1bb33ba88aee0ed4284118e01f76a58dcdce220a4946329b2", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "doraemon", "question_author_url": "https://stats.stackexchange.com/users/368723/doraemon", "question_author_user_type": "registered", "question_created_at": "2026-09-11T07:17:25+00:00", "question_html": "

I've been studying how splines::bs() builds its basis matrix, and I'm trying to fully understand why the returned matrix has so many zero entries.

\n

The worked example in Ken Koon Wong's blog post "Understanding Basis Spline (B-spline) By Working Through Cox-deBoor Algorithm", reproduced below:

\n
library(splines)\nx_i <- 1.5\nbasis_matrix <- splines::bs(x_i,\n                             knots = c(-2, -1, 0, 1, 2, 3, 4, 5),  # interior knots\n                             Boundary.knots = c(-3, 6),            # boundary knots\n                             degree = 3)\nbasis_matrix\n
\n

Result:

\n
##      1 2 3          4         5         6          7 8 9 10 11\n## [1,] 0 0 0 0.02083333 0.4791667 0.4791667 0.02083333 0 0  0  0\n## attr(,"degree")\n## [1] 3\n## attr(,"knots")\n## [1] -2 -1  0  1  2  3  4  5\n## attr(,"Boundary.knots")\n## [1] -3  6\n## attr(,"intercept")\n## [1] FALSE\n## attr(,"class")\n## [1] "bs"     "basis"  "matrix"\n
\n

Wong explained:

\n
\n

Awesome!!! We have very similar numbers !!! But why are there so many columns? And they’re filled with zeros, reminds me almost like padding. Apparently this is mainly to ensure no issues when x is very close to boundary knots is my understanding. And the way they add these padding depends on degrees + 1 if you use degree = 3, add 1 to it and that would be how many repeats of the numbers of your boundary knots.

\n
\n

But why are the number of leading and trailing zeros different?

\n

From wiki of De Boor's algorithm,

\n
\n

It follows from i≥0 that k≥p. Similarly, we see in the recursion that the highest queried knot location is at index k+1+p. This means that any knot interval [tk,tk+1) which is actually used must have at least p additional knots before and after. In a computer program, this is typically achieved by repeating the first and last used knot location p times. For example, for p=3 and real knot locations (0,1,2), one would pad the knot vector to (0,0,0,0,1,2,2,2,2).

\n
\n

{which is actually used must have at least p additional knots before and after}<- Then the number of leading and trailing zeros should be the same? i.e. 3+1 = 4

\n
\n

Update:\nAccording to the calculation by Ken Koon Wong,

\n

\"enter

\n

The position of knots should be c(-3,-3,-3,-3,-2, -1, 0, 1, 2,2,2,2)?\nAm I correct?

\n", "question_id": 677137, "question_license": "CC BY-SA 4.0", "question_score": 2, "question_text": "I've been studying how splines::bs() builds its basis matrix, and I'm trying to fully understand why the returned matrix has so many zero entries.\n\n\n\n\nThe worked example in Ken Koon Wong's blog post \"Understanding Basis Spline (B-spline) By Working Through Cox-deBoor Algorithm\", reproduced below:\n\n\n\n\nlibrary(splines)\nx_i <- 1.5\nbasis_matrix <- splines::bs(x_i,\n knots = c(-2, -1, 0, 1, 2, 3, 4, 5), # interior knots\n Boundary.knots = c(-3, 6), # boundary knots\n degree = 3)\nbasis_matrix\n\n\n\n\n\nResult:\n\n\n\n\n## 1 2 3 4 5 6 7 8 9 10 11\n## [1,] 0 0 0 0.02083333 0.4791667 0.4791667 0.02083333 0 0 0 0\n## attr(,\"degree\")\n## [1] 3\n## attr(,\"knots\")\n## [1] -2 -1 0 1 2 3 4 5\n## attr(,\"Boundary.knots\")\n## [1] -3 6\n## attr(,\"intercept\")\n## [1] FALSE\n## attr(,\"class\")\n## [1] \"bs\" \"basis\" \"matrix\"\n\n\n\n\n\nWong explained:\n\n\n\n\n\n\n\nAwesome!!! We have very similar numbers !!! But why are there so many columns? And they’re filled with zeros, reminds me almost like padding. Apparently this is mainly to ensure no issues when x is very close to boundary knots is my understanding. And the way they add these padding depends on degrees + 1 if you use degree = 3, add 1 to it and that would be how many repeats of the numbers of your boundary knots.\n\n\n\n\n\n\n\nBut why are the number of leading and trailing zeros different?\n\n\n\n\nFrom wiki of De Boor's algorithm,\n\n\n\n\n\n\n\nIt follows from i≥0 that k≥p. Similarly, we see in the recursion that the highest queried knot location is at index k+1+p. This means that any knot interval [tk,tk+1) which is actually used must have at least p additional knots before and after. In a computer program, this is typically achieved by repeating the first and last used knot location p times. For example, for p=3 and real knot locations (0,1,2), one would pad the knot vector to (0,0,0,0,1,2,2,2,2).\n\n\n\n\n\n\n\n{which is actually used must have at least p additional knots before and after}<- Then the number of leading and trailing zeros should be the same? i.e. 3+1 = 4\n\n\n\n\n\n\n\nUpdate:\nAccording to the calculation by Ken Koon Wong,\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/v4LeyMo7.png] (https://i.sstatic.net/v4LeyMo7.png)\n\n\n\n\nThe position of knots should be c(-3,-3,-3,-3,-2, -1, 0, 1, 2,2,2,2)?\nAm I correct?", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "doraemon", "profile_url": "https://stats.stackexchange.com/users/368723/doraemon", "user_type": "registered"}, "created_at": "2026-09-11T07:17:25+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "44C9B612-E48F-45D8-A87E-134A15427F2A", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/44C9B612-E48F-45D8-A87E-134A15427F2A/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-09-13T06:50:29+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "7FDC6F64-699C-45D6-AD65-42C2EB6E9601", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/7FDC6F64-699C-45D6-AD65-42C2EB6E9601/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "User1865345", "profile_url": "https://stats.stackexchange.com/users/362671/user1865345", "user_type": "registered"}, "created_at": "2026-09-15T03:24:20+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "26A7DFFA-3772-4615-A75D-4773FFF3DA34", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/26A7DFFA-3772-4615-A75D-4773FFF3DA34/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "doraemon", "profile_url": "https://stats.stackexchange.com/users/368723/doraemon", "user_type": "registered"}, "created_at": "2026-09-18T09:00:22+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "DF8093CD-0CC4-47CA-A76A-429E20D88E33", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/DF8093CD-0CC4-47CA-A76A-429E20D88E33/view-source"}], "source_site": "stats", "source_url": "https://stats.stackexchange.com/questions/677137/why-does-a-cubic-b-spline-basis-matrix-contain-so-many-zero-columns", "split": "train", "split_group": "a3b9bc15521973baeed3260891b4d75567f430c5afd7368e49e8db8c587dd1a5", "tags": ["r", "splines", "mgcv", "gamlss"], "thread_id": "stats:677137", "title": "Why does a cubic B-spline basis matrix contain so many zero columns?"}} {"accepted_status": [false, false], "candidate_answers": [{"answer_html": "

Except for the comparison between mod_disp_constant and mod_disp_background, the p-values you show are based on Wald tests, which hold asymptotically in the limit of large numbers of cases. If you have only "a few observers," I'd first worry about that. Likelihood-ratio tests would be more reliable.

\n

That said, most of those p-values are so small (or so large) that some minor inflation of Type I error wouldn't seem likely to change any "statistical significance" conclusions. If you want to provide more evidence for "significant" results, you could consider some type of resampling test.

\n

I couldn't find that the post about elevated Type I errors specified the glmmTMB version used. I also haven't taken the time to see exactly which types of p-values were collected. I did note that the post seems to indicate elevated Type I error even with homoskedastic data and no dispformula.

\n

In terms of changes with software versions, that post provides code with specified random seeds. You thus could repeat the code with the latest glmmTMB version and see whether the results differ (first with the same seeds, then maybe with different seeds).

\n", "answer_id": 677163, "answer_text": "Except for the comparison between mod_disp_constant and mod_disp_background, the p-values you show are based on Wald tests, which hold asymptotically in the limit of large numbers of cases. If you have only \"a few observers,\" I'd first worry about that. Likelihood-ratio tests would be more reliable.\n\n\n\n\nThat said, most of those p-values are so small (or so large) that some minor inflation of Type I error wouldn't seem likely to change any \"statistical significance\" conclusions. If you want to provide more evidence for \"significant\" results, you could consider some type of resampling test (https://stats.stackexchange.com/a/104746/28500).\n\n\n\n\nI couldn't find that the post about elevated Type I errors (https://lgraz.com/posts/lmm-heteroskedastic/) specified the glmmTMB version used. I also haven't taken the time to see exactly which types of p-values were collected. I did note that the post seems to indicate elevated Type I error even with homoskedastic data and no dispformula (https://lgraz.com/posts/lmm-heteroskedastic/#glmmtmby-trt-1id-1).\n\n\n\n\nIn terms of changes with software versions, that post (https://lgraz.com/posts/lmm-heteroskedastic/) provides code with specified random seeds. You thus could repeat the code with the latest glmmTMB version and see whether the results differ (first with the same seeds, then maybe with different seeds).", "answer_url": "https://stats.stackexchange.com/a/677163", "author": "EdM", "author_url": "https://stats.stackexchange.com/users/28500/edm", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-13T17:48:51+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677147, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "EdM", "profile_url": "https://stats.stackexchange.com/users/28500/edm", "user_type": "registered"}, "created_at": "2026-09-13T17:48:51+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "3B7C67F5-C6E0-49EA-9E1D-9A76F8372905", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/3B7C67F5-C6E0-49EA-9E1D-9A76F8372905/view-source"}], "score": 2, "updated_at": "2026-09-13T17:48:51+00:00"}, {"answer_html": "

The inflated type-1 errors in that example are due to the $p$-values being calculated based on asymptotic ($Z$-score) Wald statistics, rather than using some form of finite-size 'denominator degrees of freedom' correction (between-within/Sattherwaite/Kenward-Roger) to get $p$-values based on Student-$t$ distributions. I redid the analysis with ddf corrections (code here, here), with the following results (the binom.test p column tests whether the type-I error is significantly different from $\\alpha=0.05$, for 5000 simulations).

\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
methodtestType‑I errorbinom.test p
glmmTMB_wald (asymptotic Wald χ², uncorrected — original post's test)anova0.0909e-32
glmmTMB_none (asymptotic LRT, uncorrected)anova0.0683e-8
glmmTMB_satterthwaiteanova0.0520.48
glmmTMB_kenward-rogeranova0.0530.40
lme_varIdentanova0.0520.44
lmerTest (no heteroscedasticity accommodation, baseline)anova0.0550.10
\n

So things look fine as long as you ddf-correct (specify summary(..., ddf = "satterthwaite")); the theory is a little shaky — it was developed for Gaussian models — but it should probably be OK. At the very least, you can compare asymptotic $p$-values (the default) with these results to see whether this is something you should be concerned about.

\n

For what it's worth I'm not sure there's much theory about the sampling distribution of GLM-type models with estimated scale parameters (e.g. Beta) ...

\n

@EdM is also right that with such large $t$-statistics, you probably don't need to worry — if for instance you were mainly concerned with whether $p<0.05$ or not, you would be fine as long as the denominator df was above 3: the two-tailed test for $t=-3.172, \\textrm{df}=3$ is 2*pt(-3.712, df = 3) $\\approx$ 0.03 ...

\n", "answer_id": 677165, "answer_text": "The inflated type-1 errors in that example are due to the $p$-values being calculated based on asymptotic ($Z$-score) Wald statistics, rather than using some form of finite-size 'denominator degrees of freedom' correction (between-within/Sattherwaite/Kenward-Roger) to get $p$-values based on Student-$t$ distributions. I redid the analysis with ddf corrections (code here (https://github.com/glmmTMB/glmmTMB/blob/master/misc/hetero_ddf_sim.R), here (https://github.com/glmmTMB/glmmTMB/blob/master/misc/hetero_ddf_sim_analysis.R)), with the following results (the binom.test p column tests whether the type-I error is significantly different from $\\alpha=0.05$, for 5000 simulations).\n\n\n\n\n\n\n\n\n\nmethod\ntest\nType‑I error\nbinom.test p\n\n\n\n\n\n\n\n\n\tglmmTMB_wald (asymptotic Wald χ², uncorrected — original post's test)\n\tanova\n\t0.090\n\t9e-32\n\n\n\n\n\n\n\tglmmTMB_none (asymptotic LRT, uncorrected)\n\tanova\n\t0.068\n\t3e-8\n\n\n\n\n\n\n\tglmmTMB_satterthwaite\n\tanova\n\t0.052\n\t0.48\n\n\n\n\n\n\n\tglmmTMB_kenward-roger\n\tanova\n\t0.053\n\t0.40\n\n\n\n\n\n\n\tlme_varIdent\n\tanova\n\t0.052\n\t0.44\n\n\n\n\n\n\n\tlmerTest (no heteroscedasticity accommodation, baseline)\n\tanova\n\t0.055\n\t0.10\n\n\n\n\n\n\n\n\n\nSo things look fine as long as you ddf-correct (specify summary(..., ddf = \"satterthwaite\")); the theory is a little shaky — it was developed for Gaussian models — but it should probably be OK. At the very least, you can compare asymptotic $p$-values (the default) with these results to see whether this is something you should be concerned about.\n\n\n\n\nFor what it's worth I'm not sure there's much theory about the sampling distribution of GLM-type models with estimated scale parameters (e.g. Beta) ...\n\n\n\n\n@EdM is also right that with such large $t$-statistics, you probably don't need to worry — if for instance you were mainly concerned with whether $p<0.05$ or not, you would be fine as long as the denominator df was above 3: the two-tailed test for $t=-3.172, \\textrm{df}=3$ is 2*pt(-3.712, df = 3) $\\approx$ 0.03 ...", "answer_url": "https://stats.stackexchange.com/a/677165", "author": "Ben Bolker", "author_url": "https://stats.stackexchange.com/users/2126/ben-bolker", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-13T20:48:08+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677147, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ben Bolker", "profile_url": "https://stats.stackexchange.com/users/2126/ben-bolker", "user_type": "registered"}, "created_at": "2026-09-13T20:48:08+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "EF34FC87-9BFC-4047-982E-58C916319B81", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/EF34FC87-9BFC-4047-982E-58C916319B81/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ben Bolker", "profile_url": "https://stats.stackexchange.com/users/2126/ben-bolker", "user_type": "registered"}, "created_at": "2026-09-14T13:13:51+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "825AC844-EA44-413D-A096-4C2D9BFC6EB4", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/825AC844-EA44-413D-A096-4C2D9BFC6EB4/view-source"}], "score": 2, "updated_at": "2026-09-14T13:13:51+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I need a mixed effects beta regression. I have used glmmTMB with beta distribution, logit link, to assess the relation between hit scores and threshold of a few observers repeated across three backgrounds (a fourth background was used, but it presented the stimuli differently, so I am running a betareg on it instead). Hit scores are proportions in the open interval (0,1), without 0 or 1.\nI read in a previous question that dispformula from glmmTMB inflates Type I error, making the p-values not valid. Does this still hold for the current glmmTMB package version?\n\n\n\n\nQuestion: Varying dispersion parameter (=dispformula) in glmmTMB in R to account for heteroscedasticity that originates from one predictor (https://stats.stackexchange.com/questions/518013/varying-dispersion-parameter-dispformula-in-glmmtmb-in-r-to-account-for-heter)\n\n\n\n\nBlog Post: https://lgraz.com/posts/lmm-heteroskedastic/ (https://lgraz.com/posts/lmm-heteroskedastic/)\n\n\n\n\nCurrent Model output:\n\n\n\n\nmod_disp_constant: hs ~ thr + bd + (1 | obs), zi=~0, disp=~1\nmod_disp_background: hs ~ thr + bd + (1 | obs), zi=~0, disp=~bd\n Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq) \nmod_disp_constant 6 -421.04 -402.63 216.52 -433.04 \nmod_disp_background 8 -437.64 -413.09 226.82 -453.64 20.593 2 3.374e-05 ***\n---\nSignif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1\n df AICc\nmod_disp_constant 6 -420.4919\nmod_disp_background 8 -436.6780\n----------------------------------------------------------------------\n Family: beta ( logit )\nFormula: hs ~ thr + bd + (1 | obs)\nDispersion: ~bd\nData: data_long\n\n\nRandom effects:\n\nConditional model:\n Groups Name Variance Std.Dev.\n obs (Intercept) 0.04374 0.2091 \nNumber of obs: 159, groups: obs, 53\n\nConditional model:\n Estimate Std. Error z value Pr(>|z|) \n(Intercept) 1.30199 0.05762 22.598 < 2e-16 ***\nthd -0.06437 0.00294 -21.899 < 2e-16 ***\nbdG -0.32972 0.05668 -5.817 6e-09 ***\nbdS -0.15651 0.04216 -3.712 0.000206 ***\n---\nSignif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1\n\nDispersion model:\n Estimate Std. Error z value Pr(>|z|) \n(Intercept) 4.0702 0.2139 19.031 < 2e-16 ***\nbdG -0.1452 0.3023 -0.480 0.63113 \nbdS 1.9828 0.7153 2.772 0.00557 ** \n---\nSignif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1", "record_id": "Scientific-Answer-Ranking:stats:677147", "scores": [2, 2], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

Except for the comparison between mod_disp_constant and mod_disp_background, the p-values you show are based on Wald tests, which hold asymptotically in the limit of large numbers of cases. If you have only "a few observers," I'd first worry about that. Likelihood-ratio tests would be more reliable.

\n

That said, most of those p-values are so small (or so large) that some minor inflation of Type I error wouldn't seem likely to change any "statistical significance" conclusions. If you want to provide more evidence for "significant" results, you could consider some type of resampling test.

\n

I couldn't find that the post about elevated Type I errors specified the glmmTMB version used. I also haven't taken the time to see exactly which types of p-values were collected. I did note that the post seems to indicate elevated Type I error even with homoskedastic data and no dispformula.

\n

In terms of changes with software versions, that post provides code with specified random seeds. You thus could repeat the code with the latest glmmTMB version and see whether the results differ (first with the same seeds, then maybe with different seeds).

\n", "answer_id": 677163, "answer_text": "Except for the comparison between mod_disp_constant and mod_disp_background, the p-values you show are based on Wald tests, which hold asymptotically in the limit of large numbers of cases. If you have only \"a few observers,\" I'd first worry about that. Likelihood-ratio tests would be more reliable.\n\n\n\n\nThat said, most of those p-values are so small (or so large) that some minor inflation of Type I error wouldn't seem likely to change any \"statistical significance\" conclusions. If you want to provide more evidence for \"significant\" results, you could consider some type of resampling test (https://stats.stackexchange.com/a/104746/28500).\n\n\n\n\nI couldn't find that the post about elevated Type I errors (https://lgraz.com/posts/lmm-heteroskedastic/) specified the glmmTMB version used. I also haven't taken the time to see exactly which types of p-values were collected. I did note that the post seems to indicate elevated Type I error even with homoskedastic data and no dispformula (https://lgraz.com/posts/lmm-heteroskedastic/#glmmtmby-trt-1id-1).\n\n\n\n\nIn terms of changes with software versions, that post (https://lgraz.com/posts/lmm-heteroskedastic/) provides code with specified random seeds. You thus could repeat the code with the latest glmmTMB version and see whether the results differ (first with the same seeds, then maybe with different seeds).", "answer_url": "https://stats.stackexchange.com/a/677163", "author": "EdM", "author_url": "https://stats.stackexchange.com/users/28500/edm", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-13T17:48:51+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677147, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "EdM", "profile_url": "https://stats.stackexchange.com/users/28500/edm", "user_type": "registered"}, "created_at": "2026-09-13T17:48:51+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "3B7C67F5-C6E0-49EA-9E1D-9A76F8372905", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/3B7C67F5-C6E0-49EA-9E1D-9A76F8372905/view-source"}], "score": 2, "updated_at": "2026-09-13T17:48:51+00:00"}, {"answer_html": "

The inflated type-1 errors in that example are due to the $p$-values being calculated based on asymptotic ($Z$-score) Wald statistics, rather than using some form of finite-size 'denominator degrees of freedom' correction (between-within/Sattherwaite/Kenward-Roger) to get $p$-values based on Student-$t$ distributions. I redid the analysis with ddf corrections (code here, here), with the following results (the binom.test p column tests whether the type-I error is significantly different from $\\alpha=0.05$, for 5000 simulations).

\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
methodtestType‑I errorbinom.test p
glmmTMB_wald (asymptotic Wald χ², uncorrected — original post's test)anova0.0909e-32
glmmTMB_none (asymptotic LRT, uncorrected)anova0.0683e-8
glmmTMB_satterthwaiteanova0.0520.48
glmmTMB_kenward-rogeranova0.0530.40
lme_varIdentanova0.0520.44
lmerTest (no heteroscedasticity accommodation, baseline)anova0.0550.10
\n

So things look fine as long as you ddf-correct (specify summary(..., ddf = "satterthwaite")); the theory is a little shaky — it was developed for Gaussian models — but it should probably be OK. At the very least, you can compare asymptotic $p$-values (the default) with these results to see whether this is something you should be concerned about.

\n

For what it's worth I'm not sure there's much theory about the sampling distribution of GLM-type models with estimated scale parameters (e.g. Beta) ...

\n

@EdM is also right that with such large $t$-statistics, you probably don't need to worry — if for instance you were mainly concerned with whether $p<0.05$ or not, you would be fine as long as the denominator df was above 3: the two-tailed test for $t=-3.172, \\textrm{df}=3$ is 2*pt(-3.712, df = 3) $\\approx$ 0.03 ...

\n", "answer_id": 677165, "answer_text": "The inflated type-1 errors in that example are due to the $p$-values being calculated based on asymptotic ($Z$-score) Wald statistics, rather than using some form of finite-size 'denominator degrees of freedom' correction (between-within/Sattherwaite/Kenward-Roger) to get $p$-values based on Student-$t$ distributions. I redid the analysis with ddf corrections (code here (https://github.com/glmmTMB/glmmTMB/blob/master/misc/hetero_ddf_sim.R), here (https://github.com/glmmTMB/glmmTMB/blob/master/misc/hetero_ddf_sim_analysis.R)), with the following results (the binom.test p column tests whether the type-I error is significantly different from $\\alpha=0.05$, for 5000 simulations).\n\n\n\n\n\n\n\n\n\nmethod\ntest\nType‑I error\nbinom.test p\n\n\n\n\n\n\n\n\n\tglmmTMB_wald (asymptotic Wald χ², uncorrected — original post's test)\n\tanova\n\t0.090\n\t9e-32\n\n\n\n\n\n\n\tglmmTMB_none (asymptotic LRT, uncorrected)\n\tanova\n\t0.068\n\t3e-8\n\n\n\n\n\n\n\tglmmTMB_satterthwaite\n\tanova\n\t0.052\n\t0.48\n\n\n\n\n\n\n\tglmmTMB_kenward-roger\n\tanova\n\t0.053\n\t0.40\n\n\n\n\n\n\n\tlme_varIdent\n\tanova\n\t0.052\n\t0.44\n\n\n\n\n\n\n\tlmerTest (no heteroscedasticity accommodation, baseline)\n\tanova\n\t0.055\n\t0.10\n\n\n\n\n\n\n\n\n\nSo things look fine as long as you ddf-correct (specify summary(..., ddf = \"satterthwaite\")); the theory is a little shaky — it was developed for Gaussian models — but it should probably be OK. At the very least, you can compare asymptotic $p$-values (the default) with these results to see whether this is something you should be concerned about.\n\n\n\n\nFor what it's worth I'm not sure there's much theory about the sampling distribution of GLM-type models with estimated scale parameters (e.g. Beta) ...\n\n\n\n\n@EdM is also right that with such large $t$-statistics, you probably don't need to worry — if for instance you were mainly concerned with whether $p<0.05$ or not, you would be fine as long as the denominator df was above 3: the two-tailed test for $t=-3.172, \\textrm{df}=3$ is 2*pt(-3.712, df = 3) $\\approx$ 0.03 ...", "answer_url": "https://stats.stackexchange.com/a/677165", "author": "Ben Bolker", "author_url": "https://stats.stackexchange.com/users/2126/ben-bolker", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-13T20:48:08+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677147, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ben Bolker", "profile_url": "https://stats.stackexchange.com/users/2126/ben-bolker", "user_type": "registered"}, "created_at": "2026-09-13T20:48:08+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "EF34FC87-9BFC-4047-982E-58C916319B81", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/EF34FC87-9BFC-4047-982E-58C916319B81/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ben Bolker", "profile_url": "https://stats.stackexchange.com/users/2126/ben-bolker", "user_type": "registered"}, "created_at": "2026-09-14T13:13:51+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "825AC844-EA44-413D-A096-4C2D9BFC6EB4", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/825AC844-EA44-413D-A096-4C2D9BFC6EB4/view-source"}], "score": 2, "updated_at": "2026-09-14T13:13:51+00:00"}], "domain": "statistics", "external_links": ["https://github.com/glmmTMB/glmmTMB/blob/master/misc/hetero_ddf_sim.R", "https://github.com/glmmTMB/glmmTMB/blob/master/misc/hetero_ddf_sim_analysis.R", "https://lgraz.com/posts/lmm-heteroskedastic/", "https://lgraz.com/posts/lmm-heteroskedastic/#glmmtmby-trt-1id-1"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:03.428408+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/774052c18cd9e8fa951e893347bfa3c1a85e743fc46ec4667572002cadb10cbf_1790825224163423600_0.json", "raw_sha256": "fe4dd06d3de6c0b1bb33ba88aee0ed4284118e01f76a58dcdce220a4946329b2", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Dodo", "question_author_url": "https://stats.stackexchange.com/users/516003/dodo", "question_author_user_type": "registered", "question_created_at": "2026-09-12T01:15:13+00:00", "question_html": "

I need a mixed effects beta regression. I have used glmmTMB with beta distribution, logit link, to assess the relation between hit scores and threshold of a few observers repeated across three backgrounds (a fourth background was used, but it presented the stimuli differently, so I am running a betareg on it instead). Hit scores are proportions in the open interval (0,1), without 0 or 1.\nI read in a previous question that dispformula from glmmTMB inflates Type I error, making the p-values not valid. Does this still hold for the current glmmTMB package version?

\n

Question: Varying dispersion parameter (=dispformula) in glmmTMB in R to account for heteroscedasticity that originates from one predictor

\n

Blog Post: https://lgraz.com/posts/lmm-heteroskedastic/

\n

Current Model output:

\n
mod_disp_constant: hs ~ thr + bd + (1 | obs), zi=~0, disp=~1\nmod_disp_background: hs ~ thr + bd + (1 | obs), zi=~0, disp=~bd\n                    Df     AIC     BIC logLik deviance  Chisq Chi Df Pr(>Chisq)    \nmod_disp_constant    6 -421.04 -402.63 216.52  -433.04                             \nmod_disp_background  8 -437.64 -413.09 226.82  -453.64 20.593      2  3.374e-05 ***\n---\nSignif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1\n                    df      AICc\nmod_disp_constant    6 -420.4919\nmod_disp_background  8 -436.6780\n----------------------------------------------------------------------\n Family: beta  ( logit )\nFormula:          hs ~ thr + bd + (1 | obs)\nDispersion:                ~bd\nData: data_long\n\n\nRandom effects:\n\nConditional model:\n Groups Name        Variance Std.Dev.\n obs    (Intercept) 0.04374  0.2091  \nNumber of obs: 159, groups:  obs, 53\n\nConditional model:\n                    Estimate Std. Error z value Pr(>|z|)    \n(Intercept)          1.30199    0.05762  22.598  < 2e-16 ***\nthd                 -0.06437    0.00294 -21.899  < 2e-16 ***\nbdG                 -0.32972    0.05668  -5.817    6e-09 ***\nbdS                 -0.15651    0.04216  -3.712 0.000206 ***\n---\nSignif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1\n\nDispersion model:\n                    Estimate Std. Error z value Pr(>|z|)    \n(Intercept)           4.0702     0.2139  19.031  < 2e-16 ***\nbdG                   -0.1452     0.3023  -0.480  0.63113    \nbdS                   1.9828     0.7153   2.772  0.00557 ** \n---\nSignif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1\n
\n", "question_id": 677147, "question_license": "CC BY-SA 4.0", "question_score": 3, "question_text": "I need a mixed effects beta regression. I have used glmmTMB with beta distribution, logit link, to assess the relation between hit scores and threshold of a few observers repeated across three backgrounds (a fourth background was used, but it presented the stimuli differently, so I am running a betareg on it instead). Hit scores are proportions in the open interval (0,1), without 0 or 1.\nI read in a previous question that dispformula from glmmTMB inflates Type I error, making the p-values not valid. Does this still hold for the current glmmTMB package version?\n\n\n\n\nQuestion: Varying dispersion parameter (=dispformula) in glmmTMB in R to account for heteroscedasticity that originates from one predictor (https://stats.stackexchange.com/questions/518013/varying-dispersion-parameter-dispformula-in-glmmtmb-in-r-to-account-for-heter)\n\n\n\n\nBlog Post: https://lgraz.com/posts/lmm-heteroskedastic/ (https://lgraz.com/posts/lmm-heteroskedastic/)\n\n\n\n\nCurrent Model output:\n\n\n\n\nmod_disp_constant: hs ~ thr + bd + (1 | obs), zi=~0, disp=~1\nmod_disp_background: hs ~ thr + bd + (1 | obs), zi=~0, disp=~bd\n Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq) \nmod_disp_constant 6 -421.04 -402.63 216.52 -433.04 \nmod_disp_background 8 -437.64 -413.09 226.82 -453.64 20.593 2 3.374e-05 ***\n---\nSignif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1\n df AICc\nmod_disp_constant 6 -420.4919\nmod_disp_background 8 -436.6780\n----------------------------------------------------------------------\n Family: beta ( logit )\nFormula: hs ~ thr + bd + (1 | obs)\nDispersion: ~bd\nData: data_long\n\n\nRandom effects:\n\nConditional model:\n Groups Name Variance Std.Dev.\n obs (Intercept) 0.04374 0.2091 \nNumber of obs: 159, groups: obs, 53\n\nConditional model:\n Estimate Std. Error z value Pr(>|z|) \n(Intercept) 1.30199 0.05762 22.598 < 2e-16 ***\nthd -0.06437 0.00294 -21.899 < 2e-16 ***\nbdG -0.32972 0.05668 -5.817 6e-09 ***\nbdS -0.15651 0.04216 -3.712 0.000206 ***\n---\nSignif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1\n\nDispersion model:\n Estimate Std. Error z value Pr(>|z|) \n(Intercept) 4.0702 0.2139 19.031 < 2e-16 ***\nbdG -0.1452 0.3023 -0.480 0.63113 \nbdS 1.9828 0.7153 2.772 0.00557 ** \n---\nSignif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Dodo", "profile_url": "https://stats.stackexchange.com/users/516003/dodo", "user_type": "registered"}, "created_at": "2026-09-12T01:15:13+00:00", "raw_file": "raw/codex_api_v1/3f959895a29b33d83894e5370d82e1c0cf87f20ac57fa423ebc923738357c657_1790825253957066500_0.json", "raw_sha256": "ddd8808039e410ca99f97e2a7f12c307f046c4e5c3e184683bc12f816e6f49fc", "revision_guid": "6B585FAD-32F7-4AB7-8609-8A14FD5C6F8A", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/6B585FAD-32F7-4AB7-8609-8A14FD5C6F8A/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Lukas Lohse", "profile_url": "https://stats.stackexchange.com/users/341520/lukas-lohse", "user_type": "registered"}, "created_at": "2026-09-12T16:14:36+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "C41A8C0D-BD77-4EB7-849E-FEBEFC1EFBE3", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/C41A8C0D-BD77-4EB7-849E-FEBEFC1EFBE3/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Dodo", "profile_url": "https://stats.stackexchange.com/users/516003/dodo", "user_type": "registered"}, "created_at": "2026-09-12T17:07:05+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "DE7C429C-8ACF-4C04-86D2-C436353A28D0", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/DE7C429C-8ACF-4C04-86D2-C436353A28D0/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-09-14T01:21:02+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "CC727907-664B-41EC-A824-0AEB29F60F2C", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/CC727907-664B-41EC-A824-0AEB29F60F2C/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Dodo", "profile_url": "https://stats.stackexchange.com/users/516003/dodo", "user_type": "registered"}, "created_at": "2026-09-18T15:29:25+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "8B78E92E-9DD1-49AD-B92C-A0DE26764BD4", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/8B78E92E-9DD1-49AD-B92C-A0DE26764BD4/view-source"}], "source_site": "stats", "source_url": "https://stats.stackexchange.com/questions/677147/glmmtmb-with-beta-distribution-for-repeated-measures-with-varying-dispersion-a", "split": "train", "split_group": "1a195428e2f8363aa23e4bda45d98eecf5f10465c2148748aa9c5fb17c0c0370", "tags": ["beta-distribution", "glmmtmb", "dispersion"], "thread_id": "stats:677147", "title": "glmmTMB with beta distribution for repeated measures with varying dispersion - Are p-values from dispersion model unreliable?"}} {"accepted_status": [false, false, false], "candidate_answers": [{"answer_html": "

I presume that you are interested in comparing medians of paired data, and that somehow you felt that your data was not “normal enough” to warrant a paired t-test? Hence your choice to use a Wilcoxon-signed-Rank test (WSRt).

\n

The first issue is that the WSRt is not a test of the median (I assume this is what you thought)! I know most textbooks, and stats classes, present it as a test of the median. This is a sad commentary on the state of statistical education. The WSRt is a test of the pseudomedian, aka Hodges-Lehman estimator.
\nTake your 2 samples, compute the paired differences, then compute all possible paired averages $(\\frac {(x_i + x_j)} {2} \\text{ ,} i \\le j)$, then compute the median of these paired averages.
\nNow, if you want to explain to your audience what the pseudomedian is, why it matters, and what the intuition behind it is, feel free...\nAnd yes, under some very strict conditions (namely, symmetry), the pseudomedian will coincide with the median, and, for that matter, with the mean; so, you may as well call it a test of the mean.
\nHowever, the WSRt is not robust (at all!) to departures from symmetry. So much so that, if you reject the null, you will never know if it is because the pseudomedian was different from $0$, or because the paired differences’ distribution is not symmetric, or both...In fact, the WSRT can be used as a pretty good test of symmetry (comparing to the observed median).

\n

The fact that you ran some tests for symmetry does not ensure "exact" symmetry. It just fails to reject it... But uinless the p-value of these tests is $1$, there is some non-symmetry, which means that the pseudomedian no longer coincide with the median, and hence that you can no longer draw conclusions about the medians...

\n

The further irony is that if the paired differences are symmetric, then the CLT will ensure convergence of the sampling distribution of the mean, with very reasonable sample sizes (e.g. ~ 20). See e.g. here for a nice simulation, starting with a very non-normal, but symmetric, bimodal distribution. So under that symmetry assumption, you might as well have used a paired t-test (which has more power...).

\n

I am in fact curious about why you did not use a paired t-test? If it is because some of your 4 marginal distributions were not normally distributed, that would be incorrect. The only distribution which matters is that of the paired differences (which is often normal “enough”, when the 2 “parent” distributions are skewed). Moreover, depending on your sample sizes (?), and specific non-normality of the paired differences (did you run a normality test?), the CLT could come to your rescue and allow you to use a paired t-test.

\n

And if you truly wanted to test medians, w/o any consideration to lack (or not) of normality, then you can use a Sign test (available for paired data, and which is basically a binomial test).

\n

So in the end, I can not see any good reason why you (or other researchers) would ever want to use a WSRt, unless they (and their audience) truly care about the pseudomedian...

\n", "answer_id": 677153, "answer_text": "I presume that you are interested in comparing medians of paired data, and that somehow you felt that your data was not “normal enough” to warrant a paired t-test? Hence your choice to use a Wilcoxon-signed-Rank test (WSRt).\n\n\n\n\nThe first issue is that the WSRt is not a test of the median (I assume this is what you thought)! I know most textbooks, and stats classes, present it as a test of the median. This is a sad commentary on the state of statistical education. The WSRt is a test of the pseudomedian (https://en.wikipedia.org/wiki/Pseudomedian), aka Hodges-Lehman estimator (https://en.wikipedia.org/wiki/Hodges%E2%80%93Lehmann_estimator).\n\nTake your 2 samples, compute the paired differences, then compute all possible paired averages $(\\frac {(x_i + x_j)} {2} \\text{ ,} i \\le j)$, then compute the median of these paired averages.\n\nNow, if you want to explain to your audience what the pseudomedian is, why it matters, and what the intuition behind it is, feel free...\nAnd yes, under some very strict conditions (namely, symmetry), the pseudomedian will coincide with the median, and, for that matter, with the mean; so, you may as well call it a test of the mean.\n\nHowever, the WSRt is not robust (at all!) to departures from symmetry. So much so that, if you reject the null, you will never know if it is because the pseudomedian was different from $0$, or because the paired differences’ distribution is not symmetric, or both...In fact, the WSRT can be used as a pretty good test of symmetry (comparing to the observed median).\n\n\n\n\nThe fact that you ran some tests for symmetry does not ensure \"exact\" symmetry. It just fails to reject it... But uinless the p-value of these tests is $1$, there is some non-symmetry, which means that the pseudomedian no longer coincide with the median, and hence that you can no longer draw conclusions about the medians...\n\n\n\n\nThe further irony is that if the paired differences are symmetric, then the CLT will ensure convergence of the sampling distribution of the mean, with very reasonable sample sizes (e.g. ~ 20). See e.g. here (https://statistical-engineering.com/clt-summary/clt-bimodal-distribution/) for a nice simulation, starting with a very non-normal, but symmetric, bimodal distribution. So under that symmetry assumption, you might as well have used a paired t-test (which has more power...).\n\n\n\n\nI am in fact curious about why you did not use a paired t-test? If it is because some of your 4 marginal distributions were not normally distributed, that would be incorrect. The only distribution which matters is that of the paired differences (which is often normal “enough”, when the 2 “parent” distributions are skewed). Moreover, depending on your sample sizes (?), and specific non-normality of the paired differences (did you run a normality test?), the CLT could come to your rescue and allow you to use a paired t-test.\n\n\n\n\nAnd if you truly wanted to test medians, w/o any consideration to lack (or not) of normality, then you can use a Sign test (https://en.wikipedia.org/wiki/Sign_test) (available for paired data, and which is basically a binomial test).\n\n\n\n\nSo in the end, I can not see any good reason why you (or other researchers) would ever want to use a WSRt, unless they (and their audience) truly care about the pseudomedian...", "answer_url": "https://stats.stackexchange.com/a/677153", "author": "jginestet", "author_url": "https://stats.stackexchange.com/users/380096/jginestet", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-12T23:18:59+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677151, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-12T23:18:59+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "3C2DE467-9902-4F8B-A1EE-C1E5683A293D", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/3C2DE467-9902-4F8B-A1EE-C1E5683A293D/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-12T23:26:54+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "05A3FC9C-D387-42EC-8A32-229030F8C23F", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/05A3FC9C-D387-42EC-8A32-229030F8C23F/view-source"}], "score": 2, "updated_at": "2026-09-12T23:26:54+00:00"}, {"answer_html": "

When we speak of the assumptions of a test, people typically mean the assumptions used to derive the null distribution of the test statistic. If the relevant assumptions hold, that should lead to rejection rates which don't exceed the desired significance level when $H_0$ is true.

\n

For the signed rank test, the distribution-related assumption you're looking for (given, at least for paired data, the set of ranks assigned to the absolute differences) with which you can derive the null distribution of the test statistic would be exchangeability of within-pair labels (so under $H_0$, if $+$ and $-$ signs on the differences are flipped to the opposite sign, the distribution of differences would be unaffected).

\n

Symmetry of differences and independence across differences should be sufficient for distribution-related assumptions under $H_0$ (giving the required exchangeability), albeit this is slightly more than necessary.

\n

One fairly natural way this symmetry would be expected to occur is if the bivariate distribution for pair-members was itself exchangeable, so that for any given pair, say pair $i$, the bivariate distribution of $(Y_{i,1},Y_{i,2})$ would be the same as for $(Y_{i,2},Y_{i,1})$. That is, interchanging the within-pair labels makes no difference. For example: if initial assignment of label 1 and 2 was random, and some treatment was applied to the second pair-members that did nothing at all, you should expect to see such exchangeability of within-pair labels.

\n

One of several problems with the widespread practice of only trying to look at the data you're using in the test (let alone using a formal test) to decide if an assumption — such as symmetry — applies is that the null is very likely not actually true in the population-process your data are drawn from, and that assumption might not be required under the alternative for the test to work well. In this case, symmetry under the alternative is not required for the signed rank test to function correctly. Consequently, the data at hand might not be particularly relevant to an assumption about a counterfactual circumstance.

\n

An example where you could expect symmetry might well apply under $H_0$ but not to apply under $H_1$ is when the original pairs of variables have support on a bounded interval, although there are many more cases where you should reasonably anticipate that scale or shape may change across pairs under the alternative (resulting in loss of symmetry of differences under the alternative, without any harm to significance level). I would not usually be inclined to expect symmetry under the alternative to be the case with these kinds of angular values, for example, although it might not be easy to detect in very small samples.

\n

For example, imagine (in that above treatment scenario) that under a completely absent treatment effect the measured responses of both pair members both have some skewed distribution on positive values but were independent conditional on the pair-index $i$ (independence is stronger than needed here, but simplifies description). The differences would be symmetric about 0, and the null distribution in such a scenario will be as derived. Further, let us say that an effective treatment increases the score by some percentage (with some noise), let's say on average by 15%. Then pair differences will not be symmetric in general but the test still works perfectly well - under this alternative, the test statistic will have larger ('treated $-$ untreated') difference values than under the null, and further, larger absolute differences (and so their ranks) will tend to be more associated with positive signs. If you are under the second scenario you would in larger samples frequently reject symmetry of differences in the data, but that asymmetry is not relevant to when the assumption would need to hold for the test to work.

\n
\n

There are other reasons why you should be wary of the practice of trying to use the sample you're testing to consider assumptions even when they should also apply under the alternative, and why testing them presents some additional concerns. I will discuss a few of the issues.

\n

First, you should not expect assumed models to be perfect descriptions — they are convenient approximations. In practice they almost never hold exactly. The relevant question, then, is not "is this assumption true?" (very likely not) but "is the potential impact of its failure large enough to matter?". That's an issue of a kind of effect size, rather than significance, and tests of assumptions don't answer it. They will miss potentially important effects at small sample sizes (like yours) and will find what you already know to be the case (that the assumption was not exactly true) at large sample size, even if the impact on the properties of the original test was minuscule, leading you to be more relaxed about large effects with small samples and to avoid using a test because of a small effect with a large sample.

\n

Second, there is the fact that the properties of the signed rank test were not derived for the actual testing procedure you're applying: (i) check assumptions on these data, then (ii) conditionally on the outcome of that, either use the original test you had in mind, or do something else. Applying the originally planned test (such as the signed rank test) to such filtered data will no longer have the nominal properties. In short, significance levels and p-values will be different from what they were claimed to be.

\n

(I may add more issues in a later edit).

\n

You may gain the impression that I am suggesting assumptions should be ignored. On the contrary, I believe they require a deal more effort, not less. They need very careful and thoughtful consideration, but with proper care about what is being assumed about which things when, in the context of their potential impact on inference. To consider reasonableness and potential kinds and degree of violation of assumptions, I'd more often be looking at things like expert knowledge, other data, models/theory of the mechanics, including what makes sense for the alternative, and careful consideration of the behaviour of the test under required assumptions each of (i) the null (in particular, available significance levels) and (ii) the alternative (power curves at potential choices of significance level) and violations of them (seeing potential impact on those properties, for example via simulation studies).

\n

At that stage, if it turns out that some properties may be substantively affected by potential violations of assumptions, you're in a position to consider other, more robust analyses (or, given that this consideration occurs before data collection, at study design time) perhaps even different variables or different protocols.

\n

Post hoc examination of assumptions would still be useful as a way of seeing whether the kinds and degrees of violations considered were sufficient, which - if they were not - might then throw doubt on the conclusions (hence the need for care and thoughtful consideration of them).

\n
\n

Assumptions aside, I'd tend to worry a good deal about power here, especially if you're doing multiple testing correction. Effect sizes would likely need to be quite substantial under such conditions. What were your effect sizes of interest at study design stage, and what sample sizes would be needed to reliably detect them?

\n

Is there a particular reason you chose this test? I'd have expected that in relation to variables like these, there should already have been a decent body of work collecting distributional information sufficient to formulate reasonable distributional models - albeit with such small sample sizes I'd be inclined to add some further protection on the significance level if possible (such as using a likelihood ratio type statistic as the basis of a permutation test, perhaps).

\n", "answer_id": 677154, "answer_text": "When we speak of the assumptions of a test, people typically mean the assumptions used to derive the null distribution of the test statistic. If the relevant assumptions hold, that should lead to rejection rates which don't exceed the desired significance level when $H_0$ is true.\n\n\n\n\nFor the signed rank test, the distribution-related assumption you're looking for (given, at least for paired data, the set of ranks assigned to the absolute differences) with which you can derive the null distribution of the test statistic would be exchangeability of within-pair labels (so under $H_0$, if $+$ and $-$ signs on the differences are flipped to the opposite sign, the distribution of differences would be unaffected).\n\n\n\n\nSymmetry of differences and independence across differences should be sufficient for distribution-related assumptions under $H_0$ (giving the required exchangeability), albeit this is slightly more than necessary.\n\n\n\n\nOne fairly natural way this symmetry would be expected to occur is if the bivariate distribution for pair-members was itself exchangeable, so that for any given pair, say pair $i$, the bivariate distribution of $(Y_{i,1},Y_{i,2})$ would be the same as for $(Y_{i,2},Y_{i,1})$. That is, interchanging the within-pair labels makes no difference. For example: if initial assignment of label 1 and 2 was random, and some treatment was applied to the second pair-members that did nothing at all, you should expect to see such exchangeability of within-pair labels.\n\n\n\n\nOne of several problems with the widespread practice of only trying to look at the data you're using in the test (let alone using a formal test) to decide if an assumption — such as symmetry — applies is that the null is very likely not actually true in the population-process your data are drawn from, and that assumption might not be required under the alternative for the test to work well. In this case, symmetry under the alternative is not required for the signed rank test to function correctly. Consequently, the data at hand might not be particularly relevant to an assumption about a counterfactual circumstance.\n\n\n\n\nAn example where you could expect symmetry might well apply under $H_0$ but not to apply under $H_1$ is when the original pairs of variables have support on a bounded interval, although there are many more cases where you should reasonably anticipate that scale or shape may change across pairs under the alternative (resulting in loss of symmetry of differences under the alternative, without any harm to significance level). I would not usually be inclined to expect symmetry under the alternative to be the case with these kinds of angular values, for example, although it might not be easy to detect in very small samples.\n\n\n\n\nFor example, imagine (in that above treatment scenario) that under a completely absent treatment effect the measured responses of both pair members both have some skewed distribution on positive values but were independent conditional on the pair-index $i$ (independence is stronger than needed here, but simplifies description). The differences would be symmetric about 0, and the null distribution in such a scenario will be as derived. Further, let us say that an effective treatment increases the score by some percentage (with some noise), let's say on average by 15%. Then pair differences will not be symmetric in general but the test still works perfectly well - under this alternative, the test statistic will have larger ('treated $-$ untreated') difference values than under the null, and further, larger absolute differences (and so their ranks) will tend to be more associated with positive signs. If you are under the second scenario you would in larger samples frequently reject symmetry of differences in the data, but that asymmetry is not relevant to when the assumption would need to hold for the test to work.\n\n\n\n\n\n\n\nThere are other reasons why you should be wary of the practice of trying to use the sample you're testing to consider assumptions even when they should also apply under the alternative, and why testing them presents some additional concerns. I will discuss a few of the issues.\n\n\n\n\nFirst, you should not expect assumed models to be perfect descriptions — they are convenient approximations. In practice they almost never hold exactly. The relevant question, then, is not \"is this assumption true?\" (very likely not) but \"is the potential impact of its failure large enough to matter?\". That's an issue of a kind of effect size, rather than significance, and tests of assumptions don't answer it. They will miss potentially important effects at small sample sizes (like yours) and will find what you already know to be the case (that the assumption was not exactly true) at large sample size, even if the impact on the properties of the original test was minuscule, leading you to be more relaxed about large effects with small samples and to avoid using a test because of a small effect with a large sample.\n\n\n\n\nSecond, there is the fact that the properties of the signed rank test were not derived for the actual testing procedure you're applying: (i) check assumptions on these data, then (ii) conditionally on the outcome of that, either use the original test you had in mind, or do something else. Applying the originally planned test (such as the signed rank test) to such filtered data will no longer have the nominal properties. In short, significance levels and p-values will be different from what they were claimed to be.\n\n\n\n\n(I may add more issues in a later edit).\n\n\n\n\nYou may gain the impression that I am suggesting assumptions should be ignored. On the contrary, I believe they require a deal more effort, not less. They need very careful and thoughtful consideration, but with proper care about what is being assumed about which things when, in the context of their potential impact on inference. To consider reasonableness and potential kinds and degree of violation of assumptions, I'd more often be looking at things like expert knowledge, other data, models/theory of the mechanics, including what makes sense for the alternative, and careful consideration of the behaviour of the test under required assumptions each of (i) the null (in particular, available significance levels) and (ii) the alternative (power curves at potential choices of significance level) and violations of them (seeing potential impact on those properties, for example via simulation studies).\n\n\n\n\nAt that stage, if it turns out that some properties may be substantively affected by potential violations of assumptions, you're in a position to consider other, more robust analyses (or, given that this consideration occurs before data collection, at study design time) perhaps even different variables or different protocols.\n\n\n\n\nPost hoc examination of assumptions would still be useful as a way of seeing whether the kinds and degrees of violations considered were sufficient, which - if they were not - might then throw doubt on the conclusions (hence the need for care and thoughtful consideration of them).\n\n\n\n\n\n\n\nAssumptions aside, I'd tend to worry a good deal about power here, especially if you're doing multiple testing correction. Effect sizes would likely need to be quite substantial under such conditions. What were your effect sizes of interest at study design stage, and what sample sizes would be needed to reliably detect them?\n\n\n\n\nIs there a particular reason you chose this test? I'd have expected that in relation to variables like these, there should already have been a decent body of work collecting distributional information sufficient to formulate reasonable distributional models - albeit with such small sample sizes I'd be inclined to add some further protection on the significance level if possible (such as using a likelihood ratio type statistic as the basis of a permutation test, perhaps).", "answer_url": "https://stats.stackexchange.com/a/677154", "author": "Glen_b", "author_url": "https://stats.stackexchange.com/users/805/glen-b", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-12T23:43:30+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677151, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-12T23:43:30+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "62F12774-D8F8-4C82-9461-0081EA3B7680", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/62F12774-D8F8-4C82-9461-0081EA3B7680/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-12T23:50:43+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "23E95A83-7587-40AD-990D-E45001144F34", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/23E95A83-7587-40AD-990D-E45001144F34/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T00:01:28+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "894E8962-A0A1-4552-94AA-FB8358333C6F", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/894E8962-A0A1-4552-94AA-FB8358333C6F/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T00:13:51+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "DC825BD9-24E3-4E05-9A2F-F8E8251C3738", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/DC825BD9-24E3-4E05-9A2F-F8E8251C3738/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T00:20:22+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "A32BE78F-A0A6-410A-B159-F03158F18817", "revision_number": 5, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/A32BE78F-A0A6-410A-B159-F03158F18817/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T00:59:43+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "A633813B-2768-4A48-A63B-259C6FD3575A", "revision_number": 6, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/A633813B-2768-4A48-A63B-259C6FD3575A/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T01:06:57+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "7BE0590E-5BEE-462F-80F5-56379C6713FC", "revision_number": 7, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/7BE0590E-5BEE-462F-80F5-56379C6713FC/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T01:29:01+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "0007ADE3-CBEE-4726-95D9-D1189607D258", "revision_number": 8, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/0007ADE3-CBEE-4726-95D9-D1189607D258/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T01:39:01+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "E13B98B9-3EFE-4971-8B4B-9B3A61073C6C", "revision_number": 9, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/E13B98B9-3EFE-4971-8B4B-9B3A61073C6C/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T01:44:18+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "CB56B979-81DB-4905-8209-F8457366027B", "revision_number": 10, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/CB56B979-81DB-4905-8209-F8457366027B/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T07:33:41+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "9774D478-72F8-4E04-86F1-C604C00BF2D6", "revision_number": 11, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/9774D478-72F8-4E04-86F1-C604C00BF2D6/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T23:26:32+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "7BAB854F-462C-49BB-85A2-0D8E40A6D942", "revision_number": 12, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/7BAB854F-462C-49BB-85A2-0D8E40A6D942/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-14T04:27:44+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "150B68AD-1C1F-45FE-B721-E0451567395E", "revision_number": 13, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/150B68AD-1C1F-45FE-B721-E0451567395E/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-15T10:27:52+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "B6854EBE-3BF4-4571-BFB2-9C476D2160F0", "revision_number": 14, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/B6854EBE-3BF4-4571-BFB2-9C476D2160F0/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nick Cox", "profile_url": "https://stats.stackexchange.com/users/22047/nick-cox", "user_type": "registered"}, "created_at": "2026-09-15T15:01:34+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "E99122AD-481E-4371-BF94-D061728520D9", "revision_number": 15, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/E99122AD-481E-4371-BF94-D061728520D9/view-source"}], "score": 4, "updated_at": "2026-09-15T15:01:34+00:00"}, {"answer_html": "

The signed-rank test, as said by others, requires a symmetry assumption. Also it is not invariant to transformations of the variable. For those reasons I consider the signed-rank test as obsolete and always use Kornbrot's rank difference test as exemplified here.

\n

Regarding assumptions of the Wilcoxon test (original and rank difference version) it doesn't assume anything in terms of giving the right answer about which group has better outcomes. But for Wilcoxon to have optimum power, the proportional odds assumption must hold.

\n", "answer_id": 677160, "answer_text": "The signed-rank test, as said by others, requires a symmetry assumption. Also it is not invariant to transformations of the variable. For those reasons I consider the signed-rank test as obsolete and always use Kornbrot's rank difference test as exemplified here (https://hbiostat.org/bbr/nonpar).\n\n\n\n\nRegarding assumptions of the Wilcoxon test (original and rank difference version) it doesn't assume anything in terms of giving the right answer about which group has better outcomes. But for Wilcoxon to have optimum power, the proportional odds assumption must hold (https://fharrell.com/post/powilcoxon).", "answer_url": "https://stats.stackexchange.com/a/677160", "author": "Frank Harrell", "author_url": "https://stats.stackexchange.com/users/4253/frank-harrell", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-13T13:03:32+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677151, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Frank Harrell", "profile_url": "https://stats.stackexchange.com/users/4253/frank-harrell", "user_type": "registered"}, "created_at": "2026-09-13T13:03:32+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "4F4DF722-93BC-48C5-921A-5B46CA5F5750", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/4F4DF722-93BC-48C5-921A-5B46CA5F5750/view-source"}], "score": 4, "updated_at": "2026-09-13T13:03:32+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "We are trying to ensure that we satisfy the assumptions for Wilcoxon. We have the 15 healthy subjects doing basic movements using sensors and markers, with and without compensation i.e. mimicking unhealthy subjects. For example, they do a movement A (shoulder adduction/abduction) with and without any hiking of the shoulder.\n\n\n\n\nWe simply want to show that we properly detect (forced) compensation\n\n\n\n\nOur data point for ith subject is X_i= ROM_with compensation minus ROM_without compensation. So I think we do have independence.\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/wMwItQY8.png] (https://i.sstatic.net/wMwItQY8.png)\n\n\n\n\nFor the symmetry assumption, the data points were ordered around their median as required by the test by having a p-value bigger than 0.05.\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/AqvWf28J.png] (https://i.sstatic.net/AqvWf28J.png)", "record_id": "Scientific-Answer-Ranking:stats:677151", "scores": [2, 4, 4], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

I presume that you are interested in comparing medians of paired data, and that somehow you felt that your data was not “normal enough” to warrant a paired t-test? Hence your choice to use a Wilcoxon-signed-Rank test (WSRt).

\n

The first issue is that the WSRt is not a test of the median (I assume this is what you thought)! I know most textbooks, and stats classes, present it as a test of the median. This is a sad commentary on the state of statistical education. The WSRt is a test of the pseudomedian, aka Hodges-Lehman estimator.
\nTake your 2 samples, compute the paired differences, then compute all possible paired averages $(\\frac {(x_i + x_j)} {2} \\text{ ,} i \\le j)$, then compute the median of these paired averages.
\nNow, if you want to explain to your audience what the pseudomedian is, why it matters, and what the intuition behind it is, feel free...\nAnd yes, under some very strict conditions (namely, symmetry), the pseudomedian will coincide with the median, and, for that matter, with the mean; so, you may as well call it a test of the mean.
\nHowever, the WSRt is not robust (at all!) to departures from symmetry. So much so that, if you reject the null, you will never know if it is because the pseudomedian was different from $0$, or because the paired differences’ distribution is not symmetric, or both...In fact, the WSRT can be used as a pretty good test of symmetry (comparing to the observed median).

\n

The fact that you ran some tests for symmetry does not ensure "exact" symmetry. It just fails to reject it... But uinless the p-value of these tests is $1$, there is some non-symmetry, which means that the pseudomedian no longer coincide with the median, and hence that you can no longer draw conclusions about the medians...

\n

The further irony is that if the paired differences are symmetric, then the CLT will ensure convergence of the sampling distribution of the mean, with very reasonable sample sizes (e.g. ~ 20). See e.g. here for a nice simulation, starting with a very non-normal, but symmetric, bimodal distribution. So under that symmetry assumption, you might as well have used a paired t-test (which has more power...).

\n

I am in fact curious about why you did not use a paired t-test? If it is because some of your 4 marginal distributions were not normally distributed, that would be incorrect. The only distribution which matters is that of the paired differences (which is often normal “enough”, when the 2 “parent” distributions are skewed). Moreover, depending on your sample sizes (?), and specific non-normality of the paired differences (did you run a normality test?), the CLT could come to your rescue and allow you to use a paired t-test.

\n

And if you truly wanted to test medians, w/o any consideration to lack (or not) of normality, then you can use a Sign test (available for paired data, and which is basically a binomial test).

\n

So in the end, I can not see any good reason why you (or other researchers) would ever want to use a WSRt, unless they (and their audience) truly care about the pseudomedian...

\n", "answer_id": 677153, "answer_text": "I presume that you are interested in comparing medians of paired data, and that somehow you felt that your data was not “normal enough” to warrant a paired t-test? Hence your choice to use a Wilcoxon-signed-Rank test (WSRt).\n\n\n\n\nThe first issue is that the WSRt is not a test of the median (I assume this is what you thought)! I know most textbooks, and stats classes, present it as a test of the median. This is a sad commentary on the state of statistical education. The WSRt is a test of the pseudomedian (https://en.wikipedia.org/wiki/Pseudomedian), aka Hodges-Lehman estimator (https://en.wikipedia.org/wiki/Hodges%E2%80%93Lehmann_estimator).\n\nTake your 2 samples, compute the paired differences, then compute all possible paired averages $(\\frac {(x_i + x_j)} {2} \\text{ ,} i \\le j)$, then compute the median of these paired averages.\n\nNow, if you want to explain to your audience what the pseudomedian is, why it matters, and what the intuition behind it is, feel free...\nAnd yes, under some very strict conditions (namely, symmetry), the pseudomedian will coincide with the median, and, for that matter, with the mean; so, you may as well call it a test of the mean.\n\nHowever, the WSRt is not robust (at all!) to departures from symmetry. So much so that, if you reject the null, you will never know if it is because the pseudomedian was different from $0$, or because the paired differences’ distribution is not symmetric, or both...In fact, the WSRT can be used as a pretty good test of symmetry (comparing to the observed median).\n\n\n\n\nThe fact that you ran some tests for symmetry does not ensure \"exact\" symmetry. It just fails to reject it... But uinless the p-value of these tests is $1$, there is some non-symmetry, which means that the pseudomedian no longer coincide with the median, and hence that you can no longer draw conclusions about the medians...\n\n\n\n\nThe further irony is that if the paired differences are symmetric, then the CLT will ensure convergence of the sampling distribution of the mean, with very reasonable sample sizes (e.g. ~ 20). See e.g. here (https://statistical-engineering.com/clt-summary/clt-bimodal-distribution/) for a nice simulation, starting with a very non-normal, but symmetric, bimodal distribution. So under that symmetry assumption, you might as well have used a paired t-test (which has more power...).\n\n\n\n\nI am in fact curious about why you did not use a paired t-test? If it is because some of your 4 marginal distributions were not normally distributed, that would be incorrect. The only distribution which matters is that of the paired differences (which is often normal “enough”, when the 2 “parent” distributions are skewed). Moreover, depending on your sample sizes (?), and specific non-normality of the paired differences (did you run a normality test?), the CLT could come to your rescue and allow you to use a paired t-test.\n\n\n\n\nAnd if you truly wanted to test medians, w/o any consideration to lack (or not) of normality, then you can use a Sign test (https://en.wikipedia.org/wiki/Sign_test) (available for paired data, and which is basically a binomial test).\n\n\n\n\nSo in the end, I can not see any good reason why you (or other researchers) would ever want to use a WSRt, unless they (and their audience) truly care about the pseudomedian...", "answer_url": "https://stats.stackexchange.com/a/677153", "author": "jginestet", "author_url": "https://stats.stackexchange.com/users/380096/jginestet", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-12T23:18:59+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677151, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-12T23:18:59+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "3C2DE467-9902-4F8B-A1EE-C1E5683A293D", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/3C2DE467-9902-4F8B-A1EE-C1E5683A293D/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-12T23:26:54+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "05A3FC9C-D387-42EC-8A32-229030F8C23F", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/05A3FC9C-D387-42EC-8A32-229030F8C23F/view-source"}], "score": 2, "updated_at": "2026-09-12T23:26:54+00:00"}, {"answer_html": "

When we speak of the assumptions of a test, people typically mean the assumptions used to derive the null distribution of the test statistic. If the relevant assumptions hold, that should lead to rejection rates which don't exceed the desired significance level when $H_0$ is true.

\n

For the signed rank test, the distribution-related assumption you're looking for (given, at least for paired data, the set of ranks assigned to the absolute differences) with which you can derive the null distribution of the test statistic would be exchangeability of within-pair labels (so under $H_0$, if $+$ and $-$ signs on the differences are flipped to the opposite sign, the distribution of differences would be unaffected).

\n

Symmetry of differences and independence across differences should be sufficient for distribution-related assumptions under $H_0$ (giving the required exchangeability), albeit this is slightly more than necessary.

\n

One fairly natural way this symmetry would be expected to occur is if the bivariate distribution for pair-members was itself exchangeable, so that for any given pair, say pair $i$, the bivariate distribution of $(Y_{i,1},Y_{i,2})$ would be the same as for $(Y_{i,2},Y_{i,1})$. That is, interchanging the within-pair labels makes no difference. For example: if initial assignment of label 1 and 2 was random, and some treatment was applied to the second pair-members that did nothing at all, you should expect to see such exchangeability of within-pair labels.

\n

One of several problems with the widespread practice of only trying to look at the data you're using in the test (let alone using a formal test) to decide if an assumption — such as symmetry — applies is that the null is very likely not actually true in the population-process your data are drawn from, and that assumption might not be required under the alternative for the test to work well. In this case, symmetry under the alternative is not required for the signed rank test to function correctly. Consequently, the data at hand might not be particularly relevant to an assumption about a counterfactual circumstance.

\n

An example where you could expect symmetry might well apply under $H_0$ but not to apply under $H_1$ is when the original pairs of variables have support on a bounded interval, although there are many more cases where you should reasonably anticipate that scale or shape may change across pairs under the alternative (resulting in loss of symmetry of differences under the alternative, without any harm to significance level). I would not usually be inclined to expect symmetry under the alternative to be the case with these kinds of angular values, for example, although it might not be easy to detect in very small samples.

\n

For example, imagine (in that above treatment scenario) that under a completely absent treatment effect the measured responses of both pair members both have some skewed distribution on positive values but were independent conditional on the pair-index $i$ (independence is stronger than needed here, but simplifies description). The differences would be symmetric about 0, and the null distribution in such a scenario will be as derived. Further, let us say that an effective treatment increases the score by some percentage (with some noise), let's say on average by 15%. Then pair differences will not be symmetric in general but the test still works perfectly well - under this alternative, the test statistic will have larger ('treated $-$ untreated') difference values than under the null, and further, larger absolute differences (and so their ranks) will tend to be more associated with positive signs. If you are under the second scenario you would in larger samples frequently reject symmetry of differences in the data, but that asymmetry is not relevant to when the assumption would need to hold for the test to work.

\n
\n

There are other reasons why you should be wary of the practice of trying to use the sample you're testing to consider assumptions even when they should also apply under the alternative, and why testing them presents some additional concerns. I will discuss a few of the issues.

\n

First, you should not expect assumed models to be perfect descriptions — they are convenient approximations. In practice they almost never hold exactly. The relevant question, then, is not "is this assumption true?" (very likely not) but "is the potential impact of its failure large enough to matter?". That's an issue of a kind of effect size, rather than significance, and tests of assumptions don't answer it. They will miss potentially important effects at small sample sizes (like yours) and will find what you already know to be the case (that the assumption was not exactly true) at large sample size, even if the impact on the properties of the original test was minuscule, leading you to be more relaxed about large effects with small samples and to avoid using a test because of a small effect with a large sample.

\n

Second, there is the fact that the properties of the signed rank test were not derived for the actual testing procedure you're applying: (i) check assumptions on these data, then (ii) conditionally on the outcome of that, either use the original test you had in mind, or do something else. Applying the originally planned test (such as the signed rank test) to such filtered data will no longer have the nominal properties. In short, significance levels and p-values will be different from what they were claimed to be.

\n

(I may add more issues in a later edit).

\n

You may gain the impression that I am suggesting assumptions should be ignored. On the contrary, I believe they require a deal more effort, not less. They need very careful and thoughtful consideration, but with proper care about what is being assumed about which things when, in the context of their potential impact on inference. To consider reasonableness and potential kinds and degree of violation of assumptions, I'd more often be looking at things like expert knowledge, other data, models/theory of the mechanics, including what makes sense for the alternative, and careful consideration of the behaviour of the test under required assumptions each of (i) the null (in particular, available significance levels) and (ii) the alternative (power curves at potential choices of significance level) and violations of them (seeing potential impact on those properties, for example via simulation studies).

\n

At that stage, if it turns out that some properties may be substantively affected by potential violations of assumptions, you're in a position to consider other, more robust analyses (or, given that this consideration occurs before data collection, at study design time) perhaps even different variables or different protocols.

\n

Post hoc examination of assumptions would still be useful as a way of seeing whether the kinds and degrees of violations considered were sufficient, which - if they were not - might then throw doubt on the conclusions (hence the need for care and thoughtful consideration of them).

\n
\n

Assumptions aside, I'd tend to worry a good deal about power here, especially if you're doing multiple testing correction. Effect sizes would likely need to be quite substantial under such conditions. What were your effect sizes of interest at study design stage, and what sample sizes would be needed to reliably detect them?

\n

Is there a particular reason you chose this test? I'd have expected that in relation to variables like these, there should already have been a decent body of work collecting distributional information sufficient to formulate reasonable distributional models - albeit with such small sample sizes I'd be inclined to add some further protection on the significance level if possible (such as using a likelihood ratio type statistic as the basis of a permutation test, perhaps).

\n", "answer_id": 677154, "answer_text": "When we speak of the assumptions of a test, people typically mean the assumptions used to derive the null distribution of the test statistic. If the relevant assumptions hold, that should lead to rejection rates which don't exceed the desired significance level when $H_0$ is true.\n\n\n\n\nFor the signed rank test, the distribution-related assumption you're looking for (given, at least for paired data, the set of ranks assigned to the absolute differences) with which you can derive the null distribution of the test statistic would be exchangeability of within-pair labels (so under $H_0$, if $+$ and $-$ signs on the differences are flipped to the opposite sign, the distribution of differences would be unaffected).\n\n\n\n\nSymmetry of differences and independence across differences should be sufficient for distribution-related assumptions under $H_0$ (giving the required exchangeability), albeit this is slightly more than necessary.\n\n\n\n\nOne fairly natural way this symmetry would be expected to occur is if the bivariate distribution for pair-members was itself exchangeable, so that for any given pair, say pair $i$, the bivariate distribution of $(Y_{i,1},Y_{i,2})$ would be the same as for $(Y_{i,2},Y_{i,1})$. That is, interchanging the within-pair labels makes no difference. For example: if initial assignment of label 1 and 2 was random, and some treatment was applied to the second pair-members that did nothing at all, you should expect to see such exchangeability of within-pair labels.\n\n\n\n\nOne of several problems with the widespread practice of only trying to look at the data you're using in the test (let alone using a formal test) to decide if an assumption — such as symmetry — applies is that the null is very likely not actually true in the population-process your data are drawn from, and that assumption might not be required under the alternative for the test to work well. In this case, symmetry under the alternative is not required for the signed rank test to function correctly. Consequently, the data at hand might not be particularly relevant to an assumption about a counterfactual circumstance.\n\n\n\n\nAn example where you could expect symmetry might well apply under $H_0$ but not to apply under $H_1$ is when the original pairs of variables have support on a bounded interval, although there are many more cases where you should reasonably anticipate that scale or shape may change across pairs under the alternative (resulting in loss of symmetry of differences under the alternative, without any harm to significance level). I would not usually be inclined to expect symmetry under the alternative to be the case with these kinds of angular values, for example, although it might not be easy to detect in very small samples.\n\n\n\n\nFor example, imagine (in that above treatment scenario) that under a completely absent treatment effect the measured responses of both pair members both have some skewed distribution on positive values but were independent conditional on the pair-index $i$ (independence is stronger than needed here, but simplifies description). The differences would be symmetric about 0, and the null distribution in such a scenario will be as derived. Further, let us say that an effective treatment increases the score by some percentage (with some noise), let's say on average by 15%. Then pair differences will not be symmetric in general but the test still works perfectly well - under this alternative, the test statistic will have larger ('treated $-$ untreated') difference values than under the null, and further, larger absolute differences (and so their ranks) will tend to be more associated with positive signs. If you are under the second scenario you would in larger samples frequently reject symmetry of differences in the data, but that asymmetry is not relevant to when the assumption would need to hold for the test to work.\n\n\n\n\n\n\n\nThere are other reasons why you should be wary of the practice of trying to use the sample you're testing to consider assumptions even when they should also apply under the alternative, and why testing them presents some additional concerns. I will discuss a few of the issues.\n\n\n\n\nFirst, you should not expect assumed models to be perfect descriptions — they are convenient approximations. In practice they almost never hold exactly. The relevant question, then, is not \"is this assumption true?\" (very likely not) but \"is the potential impact of its failure large enough to matter?\". That's an issue of a kind of effect size, rather than significance, and tests of assumptions don't answer it. They will miss potentially important effects at small sample sizes (like yours) and will find what you already know to be the case (that the assumption was not exactly true) at large sample size, even if the impact on the properties of the original test was minuscule, leading you to be more relaxed about large effects with small samples and to avoid using a test because of a small effect with a large sample.\n\n\n\n\nSecond, there is the fact that the properties of the signed rank test were not derived for the actual testing procedure you're applying: (i) check assumptions on these data, then (ii) conditionally on the outcome of that, either use the original test you had in mind, or do something else. Applying the originally planned test (such as the signed rank test) to such filtered data will no longer have the nominal properties. In short, significance levels and p-values will be different from what they were claimed to be.\n\n\n\n\n(I may add more issues in a later edit).\n\n\n\n\nYou may gain the impression that I am suggesting assumptions should be ignored. On the contrary, I believe they require a deal more effort, not less. They need very careful and thoughtful consideration, but with proper care about what is being assumed about which things when, in the context of their potential impact on inference. To consider reasonableness and potential kinds and degree of violation of assumptions, I'd more often be looking at things like expert knowledge, other data, models/theory of the mechanics, including what makes sense for the alternative, and careful consideration of the behaviour of the test under required assumptions each of (i) the null (in particular, available significance levels) and (ii) the alternative (power curves at potential choices of significance level) and violations of them (seeing potential impact on those properties, for example via simulation studies).\n\n\n\n\nAt that stage, if it turns out that some properties may be substantively affected by potential violations of assumptions, you're in a position to consider other, more robust analyses (or, given that this consideration occurs before data collection, at study design time) perhaps even different variables or different protocols.\n\n\n\n\nPost hoc examination of assumptions would still be useful as a way of seeing whether the kinds and degrees of violations considered were sufficient, which - if they were not - might then throw doubt on the conclusions (hence the need for care and thoughtful consideration of them).\n\n\n\n\n\n\n\nAssumptions aside, I'd tend to worry a good deal about power here, especially if you're doing multiple testing correction. Effect sizes would likely need to be quite substantial under such conditions. What were your effect sizes of interest at study design stage, and what sample sizes would be needed to reliably detect them?\n\n\n\n\nIs there a particular reason you chose this test? I'd have expected that in relation to variables like these, there should already have been a decent body of work collecting distributional information sufficient to formulate reasonable distributional models - albeit with such small sample sizes I'd be inclined to add some further protection on the significance level if possible (such as using a likelihood ratio type statistic as the basis of a permutation test, perhaps).", "answer_url": "https://stats.stackexchange.com/a/677154", "author": "Glen_b", "author_url": "https://stats.stackexchange.com/users/805/glen-b", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-12T23:43:30+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:06.169765+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/9155f81b0f1dac4b0f83fad58469033af46ad34ee8d731e569d063b41b3df6b6_1790825226563497500_0.json", "raw_sha256": "cbac4b1b24e2159f1c17ea9902eaf89a0a5260344e6dba6f75790ba955f0d04b", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677151, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-12T23:43:30+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "62F12774-D8F8-4C82-9461-0081EA3B7680", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/62F12774-D8F8-4C82-9461-0081EA3B7680/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-12T23:50:43+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "23E95A83-7587-40AD-990D-E45001144F34", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/23E95A83-7587-40AD-990D-E45001144F34/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T00:01:28+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "894E8962-A0A1-4552-94AA-FB8358333C6F", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/894E8962-A0A1-4552-94AA-FB8358333C6F/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T00:13:51+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "DC825BD9-24E3-4E05-9A2F-F8E8251C3738", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/DC825BD9-24E3-4E05-9A2F-F8E8251C3738/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T00:20:22+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "A32BE78F-A0A6-410A-B159-F03158F18817", "revision_number": 5, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/A32BE78F-A0A6-410A-B159-F03158F18817/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T00:59:43+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "A633813B-2768-4A48-A63B-259C6FD3575A", "revision_number": 6, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/A633813B-2768-4A48-A63B-259C6FD3575A/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T01:06:57+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "7BE0590E-5BEE-462F-80F5-56379C6713FC", "revision_number": 7, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/7BE0590E-5BEE-462F-80F5-56379C6713FC/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T01:29:01+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "0007ADE3-CBEE-4726-95D9-D1189607D258", "revision_number": 8, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/0007ADE3-CBEE-4726-95D9-D1189607D258/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T01:39:01+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "E13B98B9-3EFE-4971-8B4B-9B3A61073C6C", "revision_number": 9, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/E13B98B9-3EFE-4971-8B4B-9B3A61073C6C/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T01:44:18+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "CB56B979-81DB-4905-8209-F8457366027B", "revision_number": 10, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/CB56B979-81DB-4905-8209-F8457366027B/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T07:33:41+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "9774D478-72F8-4E04-86F1-C604C00BF2D6", "revision_number": 11, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/9774D478-72F8-4E04-86F1-C604C00BF2D6/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-13T23:26:32+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "7BAB854F-462C-49BB-85A2-0D8E40A6D942", "revision_number": 12, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/7BAB854F-462C-49BB-85A2-0D8E40A6D942/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-14T04:27:44+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "150B68AD-1C1F-45FE-B721-E0451567395E", "revision_number": 13, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/150B68AD-1C1F-45FE-B721-E0451567395E/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Glen_b", "profile_url": "https://stats.stackexchange.com/users/805/glen-b", "user_type": "registered"}, "created_at": "2026-09-15T10:27:52+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "B6854EBE-3BF4-4571-BFB2-9C476D2160F0", "revision_number": 14, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/B6854EBE-3BF4-4571-BFB2-9C476D2160F0/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nick Cox", "profile_url": "https://stats.stackexchange.com/users/22047/nick-cox", "user_type": "registered"}, "created_at": "2026-09-15T15:01:34+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "E99122AD-481E-4371-BF94-D061728520D9", "revision_number": 15, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/E99122AD-481E-4371-BF94-D061728520D9/view-source"}], "score": 4, "updated_at": "2026-09-15T15:01:34+00:00"}, {"answer_html": "

The signed-rank test, as said by others, requires a symmetry assumption. Also it is not invariant to transformations of the variable. For those reasons I consider the signed-rank test as obsolete and always use Kornbrot's rank difference test as exemplified here.

\n

Regarding assumptions of the Wilcoxon test (original and rank difference version) it doesn't assume anything in terms of giving the right answer about which group has better outcomes. But for Wilcoxon to have optimum power, the proportional odds assumption must hold.

\n", "answer_id": 677160, "answer_text": "The signed-rank test, as said by others, requires a symmetry assumption. Also it is not invariant to transformations of the variable. For those reasons I consider the signed-rank test as obsolete and always use Kornbrot's rank difference test as exemplified here (https://hbiostat.org/bbr/nonpar).\n\n\n\n\nRegarding assumptions of the Wilcoxon test (original and rank difference version) it doesn't assume anything in terms of giving the right answer about which group has better outcomes. But for Wilcoxon to have optimum power, the proportional odds assumption must hold (https://fharrell.com/post/powilcoxon).", "answer_url": "https://stats.stackexchange.com/a/677160", "author": "Frank Harrell", "author_url": "https://stats.stackexchange.com/users/4253/frank-harrell", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-13T13:03:32+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677151, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Frank Harrell", "profile_url": "https://stats.stackexchange.com/users/4253/frank-harrell", "user_type": "registered"}, "created_at": "2026-09-13T13:03:32+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "4F4DF722-93BC-48C5-921A-5B46CA5F5750", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/4F4DF722-93BC-48C5-921A-5B46CA5F5750/view-source"}], "score": 4, "updated_at": "2026-09-13T13:03:32+00:00"}], "domain": "statistics", "external_links": ["https://en.wikipedia.org/wiki/Hodges%E2%80%93Lehmann_estimator", "https://en.wikipedia.org/wiki/Pseudomedian", "https://en.wikipedia.org/wiki/Sign_test", "https://fharrell.com/post/powilcoxon", "https://hbiostat.org/bbr/nonpar", "https://i.sstatic.net/AqvWf28J.png", "https://i.sstatic.net/wMwItQY8.png", "https://statistical-engineering.com/clt-summary/clt-bimodal-distribution/"], "medical_sensitive": true, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:03.428408+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/774052c18cd9e8fa951e893347bfa3c1a85e743fc46ec4667572002cadb10cbf_1790825224163423600_0.json", "raw_sha256": "fe4dd06d3de6c0b1bb33ba88aee0ed4284118e01f76a58dcdce220a4946329b2", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Thomas Kojar", "question_author_url": "https://stats.stackexchange.com/users/66533/thomas-kojar", "question_author_user_type": "registered", "question_created_at": "2026-09-12T19:45:10+00:00", "question_html": "

We are trying to ensure that we satisfy the assumptions for Wilcoxon. We have the 15 healthy subjects doing basic movements using sensors and markers, with and without compensation i.e. mimicking unhealthy subjects. For example, they do a movement A (shoulder adduction/abduction) with and without any hiking of the shoulder.

\n

We simply want to show that we properly detect (forced) compensation

\n

Our data point for ith subject is X_i= ROM_with compensation minus ROM_without compensation. So I think we do have independence.

\n

\"enter

\n

For the symmetry assumption, the data points were ordered around their median as required by the test by having a p-value bigger than 0.05.

\n

\"enter

\n", "question_id": 677151, "question_license": "CC BY-SA 4.0", "question_score": 1, "question_text": "We are trying to ensure that we satisfy the assumptions for Wilcoxon. We have the 15 healthy subjects doing basic movements using sensors and markers, with and without compensation i.e. mimicking unhealthy subjects. For example, they do a movement A (shoulder adduction/abduction) with and without any hiking of the shoulder.\n\n\n\n\nWe simply want to show that we properly detect (forced) compensation\n\n\n\n\nOur data point for ith subject is X_i= ROM_with compensation minus ROM_without compensation. So I think we do have independence.\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/wMwItQY8.png] (https://i.sstatic.net/wMwItQY8.png)\n\n\n\n\nFor the symmetry assumption, the data points were ordered around their median as required by the test by having a p-value bigger than 0.05.\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/AqvWf28J.png] (https://i.sstatic.net/AqvWf28J.png)", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Thomas Kojar", "profile_url": "https://stats.stackexchange.com/users/66533/thomas-kojar", "user_type": "registered"}, "created_at": "2026-09-12T19:45:10+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "C6F0AF68-DF30-4C89-B624-2608F0C7F39A", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/C6F0AF68-DF30-4C89-B624-2608F0C7F39A/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-09-14T10:21:19+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "BB53ACFD-4DF9-4BCE-AF37-983C54CF95BC", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/BB53ACFD-4DF9-4BCE-AF37-983C54CF95BC/view-source"}], "source_site": "stats", "source_url": "https://stats.stackexchange.com/questions/677151/wilcoxon-test-assumptions", "split": "train", "split_group": "4607dc17a6b552ad0cbb77305f2d9dbb6a85532ce9c286c2669c4d9f80252ccf", "tags": ["wilcoxon-signed-rank", "bonferroni"], "thread_id": "stats:677151", "title": "Wilcoxon test assumptions"}} {"accepted_status": [false, false, false], "candidate_answers": [{"answer_html": "

(i) Yes, I think that you are over-thinking it. If you plot the data with a logarithmic scale for the fluorescence density you will very likely find that the does-response relationship is sufficiently clear that no statistical analysis is going to be needed. If you want to test the hypothesis that the drug can increase antibody binding then a clear dose-response relationship should be enough evidence to accept the biological hypothesis even without any test of a statistical hypothesis.

\n

(ii) On the other hand, you might want to characterise the relationship between drug concentration and effect, and the usual ways to do that also involve a dose-response relationship by way of finding the range of the effect (i.e. maximal effect of a maximally- or supramaximally-effective concentration of the drug) and the EC50 which is the concentration of the drug needed to elicit a half-maximal response. Those things are typically done by way of fitting a curve through the data. For those things your range of tested concentrations and number of replications might be a bit limited, but plot the curve and see how it looks before deciding on how to proceed (with a new experiment, perhaps).

\n

(iii) Yes, if there is a bad mismatch between the statistical model's version of population distribution and the real data distribution then there can be problems, particularly with small sample size. Using the logarithm of the fluorescence density as your measures is, in a way, taking the distribution into account. (There are many situations where a log-transform of biological data makes things clearer and is, at least arguably, 'natural'. See here: When are Log scales appropriate?)

\n", "answer_id": 677172, "answer_text": "(i) Yes, I think that you are over-thinking it. If you plot the data with a logarithmic scale for the fluorescence density you will very likely find that the does-response relationship is sufficiently clear that no statistical analysis is going to be needed. If you want to test the hypothesis that the drug can increase antibody binding then a clear dose-response relationship should be enough evidence to accept the biological hypothesis even without any test of a statistical hypothesis.\n\n\n\n\n(ii) On the other hand, you might want to characterise the relationship between drug concentration and effect, and the usual ways to do that also involve a dose-response relationship by way of finding the range of the effect (i.e. maximal effect of a maximally- or supramaximally-effective concentration of the drug) and the EC50 which is the concentration of the drug needed to elicit a half-maximal response. Those things are typically done by way of fitting a curve through the data. For those things your range of tested concentrations and number of replications might be a bit limited, but plot the curve and see how it looks before deciding on how to proceed (with a new experiment, perhaps).\n\n\n\n\n(iii) Yes, if there is a bad mismatch between the statistical model's version of population distribution and the real data distribution then there can be problems, particularly with small sample size. Using the logarithm of the fluorescence density as your measures is, in a way, taking the distribution into account. (There are many situations where a log-transform of biological data makes things clearer and is, at least arguably, 'natural'. See here: When are Log scales appropriate? (https://stats.stackexchange.com/questions/27951/when-are-log-scales-appropriate))", "answer_url": "https://stats.stackexchange.com/a/677172", "author": "Michael Lew", "author_url": "https://stats.stackexchange.com/users/1679/michael-lew", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-14T20:58:17+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677168, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Michael Lew", "profile_url": "https://stats.stackexchange.com/users/1679/michael-lew", "user_type": "registered"}, "created_at": "2026-09-14T20:58:17+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "0B9C87FB-0EF7-4AD3-A586-F7D58D0D2F8B", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/0B9C87FB-0EF7-4AD3-A586-F7D58D0D2F8B/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nick Cox", "profile_url": "https://stats.stackexchange.com/users/22047/nick-cox", "user_type": "registered"}, "created_at": "2026-09-23T09:14:30+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "CFD4CAE3-2F50-4849-84A1-861C28109C75", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/CFD4CAE3-2F50-4849-84A1-861C28109C75/view-source"}], "score": 5, "updated_at": "2026-09-23T09:14:30+00:00"}, {"answer_html": "

I do think you have way more than 3 replicates. Each cell you observed is an independent observation: yes, they may come from the same preparation/flask/dish/??, but they are different cells, which while prepared under the same conditions, are nevertheless different and independent observations. Thus, you in fact have a very large sample size.

\n

Your scenario is that of a 2-way Anova. You have 2 categorical factors: the drug concentration, and the source of the cells. And you observed every combination of these 2 factors, and have a lot (“thousands”) of observations for each of these combinations. You could also describe your scenario as a full factorial design (same engine under the hood. And that engine is a regression).
\nNow, for a 2-way Anova/factorial design, it is the residuals which need to be “not too non-normal”. Will that be the case with your data? Hard to tell from the plots, but it is often the case that marginal distributions which appear quite skewed end up giving you normal-ish residuals: you can find such examples here on CV, or here.

\n

Now, this ANOVA may tell you that the culture to culture variability has more effect than the drug concentration... And that would be a problem as you could not generalize your findings. But if the drug is mainly responsible for the effect, then you have something...

\n

But what if your residuals are also very non-normal?

\n

There were some suggestions for you to use the log of your response (fluorescence intensity). I am not (at all?) convinced that it would be a good idea. For one, what you are interested in (binding ability of antibodies) is strictly linear with the fluorescence intensity: twice the binding results in twice the observed fluorescence intensity. So using the log does not correspond to any biological or physical property of the phenomenon you are investigating. In addition, if you observe (or fail to observe) a statistically significant difference on the log of the intensity, it absolutely does not mean that you would have had the same significant (or not) result on the original intensity (because a log transformation compresses the data, hence reduces the differences, but also reduces the variability. Hence, you can not extrapolate a result on the logs to a result on the original data).
\nNote also that running some regression (e.g. mixed effects) would have the same issue with non-normal residuals (for the p-values of your regression to be valid, the residuals here too need to be “normal-ish”).

\n

Now, depending on what you will do with the results of your analysis, you could simply use the IOTT (Inter Ocular Trauma Test) (see here: when the answer hits you between the eyes. It should be clear that one preparation (HO163) behaves radically differently from the other 2. And it may be that this is all you need to make your decision?

\n

If the IOTT does not serve your purpose, you can then fall back on non-parametric tests. Again, with the large sample sizes you have, you should have good power.
\nOne could use a Kruskal-Wallis test (KWt). You could compare all possible combinations to each others, or some subset. But the KWt has a few flaws: one is that it requires homoscedasticity of the marginal distributions, and that does not look at all to be your case (heteroscedasticity leads to Type I error inflation). It also suffers from being affected by circularity (the KWt tests for stochastic superiority, and that property is not transitive: see this paper for an excellent discussion).
\nSo I would rather use a series of Mann-Whitney U tests (MWUt): a series (as opposed to all possible comparisons) to reduce the effect of multiple comparisons corrections (MCC), and because you are mostly interested in the comparison to the control situation. Note that the MWUt also has issues with heteroscedasticity, but it has a version, the Brunner-Munzel test (BMt) which does not require homoscedasticity (see this paper).
\nYou could also use a median test: it supports comparing multiple samples, and makes no distributional (or other such) assumption (it is basically a binomial test). Again, with your large sample sizes, it should have good power. Use the median test as an omnibus test, and then make only the paired comparisons you are truly interested in (to reduce the impact of the MCC).

\n

Just to be safe, let me point out that the various tests I mentioned here test different nulls: 2-way Anova tests equality of the means, MWUt and KWt test stochastic homogeneity, and the median test tests equality of the medians (and the IOTT tests your visual acuity?). So you will need to formulate your conclusions accordingly.

\n", "answer_id": 677197, "answer_text": "I do think you have way more than 3 replicates. Each cell you observed is an independent observation: yes, they may come from the same preparation/flask/dish/??, but they are different cells, which while prepared under the same conditions, are nevertheless different and independent observations. Thus, you in fact have a very large sample size.\n\n\n\n\nYour scenario is that of a 2-way Anova. You have 2 categorical factors: the drug concentration, and the source of the cells. And you observed every combination of these 2 factors, and have a lot (“thousands”) of observations for each of these combinations. You could also describe your scenario as a full factorial design (same engine under the hood. And that engine is a regression).\n\nNow, for a 2-way Anova/factorial design, it is the residuals which need to be “not too non-normal”. Will that be the case with your data? Hard to tell from the plots, but it is often the case that marginal distributions which appear quite skewed end up giving you normal-ish residuals: you can find such examples here on CV (https://stats.stackexchange.com/a/33320/380096), or here (https://www.youtube.com/watch?v=1ft8v7PlNKQ).\n\n\n\n\nNow, this ANOVA may tell you that the culture to culture variability has more effect than the drug concentration... And that would be a problem as you could not generalize your findings. But if the drug is mainly responsible for the effect, then you have something...\n\n\n\n\nBut what if your residuals are also very non-normal?\n\n\n\n\nThere were some suggestions for you to use the log of your response (fluorescence intensity). I am not (at all?) convinced that it would be a good idea. For one, what you are interested in (binding ability of antibodies) is strictly linear with the fluorescence intensity: twice the binding results in twice the observed fluorescence intensity. So using the log does not correspond to any biological or physical property of the phenomenon you are investigating. In addition, if you observe (or fail to observe) a statistically significant difference on the log of the intensity, it absolutely does not mean that you would have had the same significant (or not) result on the original intensity (because a log transformation compresses the data, hence reduces the differences, but also reduces the variability. Hence, you can not extrapolate a result on the logs to a result on the original data).\n\nNote also that running some regression (e.g. mixed effects) would have the same issue with non-normal residuals (for the p-values of your regression to be valid, the residuals here too need to be “normal-ish”).\n\n\n\n\nNow, depending on what you will do with the results of your analysis, you could simply use the IOTT (Inter Ocular Trauma Test) (see here (https://www.r-bloggers.com/2016/11/inter-ocular-trauma-test/): when the answer hits you between the eyes. It should be clear that one preparation (HO163) behaves radically differently from the other 2. And it may be that this is all you need to make your decision?\n\n\n\n\nIf the IOTT does not serve your purpose, you can then fall back on non-parametric tests. Again, with the large sample sizes you have, you should have good power. \n\nOne could use a Kruskal-Wallis test (KWt). You could compare all possible combinations to each others, or some subset. But the KWt has a few flaws: one is that it requires homoscedasticity of the marginal distributions, and that does not look at all to be your case (heteroscedasticity leads to Type I error inflation). It also suffers from being affected by circularity (the KWt tests for stochastic superiority, and that property is not transitive: see this paper (https://www.semanticscholar.org/paper/Kruskal%E2%80%93Wallis%2C-Multiple-Comparisons-and-Efron-Dice-Brown-Hettmansperger/6d6866ffb4ad03cef4c46a044ab096c498d09567) for an excellent discussion).\n\nSo I would rather use a series of Mann-Whitney U tests (MWUt): a series (as opposed to all possible comparisons) to reduce the effect of multiple comparisons corrections (MCC), and because you are mostly interested in the comparison to the control situation. Note that the MWUt also has issues with heteroscedasticity, but it has a version, the Brunner-Munzel test (BMt) which does not require homoscedasticity (see this paper (https://journals.sagepub.com/doi/full/10.1177/2515245921999602)).\n\nYou could also use a median test (https://en.wikipedia.org/wiki/Median_test): it supports comparing multiple samples, and makes no distributional (or other such) assumption (it is basically a binomial test). Again, with your large sample sizes, it should have good power. Use the median test as an omnibus test, and then make only the paired comparisons you are truly interested in (to reduce the impact of the MCC).\n\n\n\n\nJust to be safe, let me point out that the various tests I mentioned here test different nulls: 2-way Anova tests equality of the means, MWUt and KWt test stochastic homogeneity, and the median test tests equality of the medians (and the IOTT tests your visual acuity?). So you will need to formulate your conclusions accordingly.", "answer_url": "https://stats.stackexchange.com/a/677197", "author": "jginestet", "author_url": "https://stats.stackexchange.com/users/380096/jginestet", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-17T20:11:08+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677168, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-17T20:11:08+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "0598B5D3-6667-41E6-AD00-022541F50453", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/0598B5D3-6667-41E6-AD00-022541F50453/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-18T22:54:22+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "6D155F63-4414-4C5B-86F7-B3F496416B99", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/6D155F63-4414-4C5B-86F7-B3F496416B99/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-18T23:11:40+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "31636490-35B8-4E12-AE63-2EB28805B1F8", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/31636490-35B8-4E12-AE63-2EB28805B1F8/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-18T23:26:40+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "FDBE9BC2-7381-46F3-9F5B-0A074D4850E5", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/FDBE9BC2-7381-46F3-9F5B-0A074D4850E5/view-source"}], "score": 0, "updated_at": "2026-09-18T23:26:40+00:00"}, {"answer_html": "

The answer from @MichaelLew (+1) nicely gets to the main points. Here are a few extra thoughts that are more than can fit into comments.

\n

First, single-cell fluorescence data typically are log transformed before analysis. Even in the range where fluorescence intensity is proportional to the number of fluorescent molecules, a cellular protein that is labeled with a fluorescent marker often has something close to a log-normal distribution among the individual cells. See, for example, the Wikipedia entry on transformations of flow cytometry data. Your data seem consistent with such a distribution.

\n

Second, "correct" practice would treat your situation as having 3 biological replicates with many technical replicates each. See the Technical Perspective in Molecular Biology of the Cell by D.A., T.D., and K.S. Pollard. A possible exception would be if the distribution among cells was of primary interest, but even then you would need biological replicates to convince your audience of your conclusions (and, I hope, yourself).

\n

Third, there are at least three major ways to handle highly skewed outcome data that have something close to a log-normal distribution.

\n
    \n
  • Do a log transformation and model the means of the log-transformed values. That seems to be the favorite among cellular and molecular biologists. As the simplest to explain to your audience, it would be my choice provided that the transformation led to reasonably symmetric distributions of the observations within each batch/treatment combination.

    \n
  • \n
  • Fit a generalized linear model with a logarithmic link function. That models the logs of the mean values instead.

    \n
  • \n
  • Use ordinal regression, which you can think of as an extension of "Kruskal-Wallis or similar" that can accommodate multiple predictors in regression models. That trades off assumptions about the distribution of outcome values for an assumption about how predictors are associated with increasing ranks of outcome values. Frank Harrell provides extensive resources for that approach. I have used it for single-cell fluorescence data, although I don't think it has come into frequent current use in cellular/molecular biology. I'd suggest learning more about its possibilities, as it can be applied widely.

    \n
  • \n
\n

Fourth, a mixed model is one way to handle a combination of biological and technical replicates. Your suggestion of a (1|cell) random-effect term, however, is not correct in your situation. Think of the "random effects" as the groups within which the observations are clustered. With only one observation per cell, those groups would be the 3 batches (perhaps also the images within the batches). A (1|cell) term would be correct if you had multiple observations over time on the same cells.

\n

The problem is that mixed models typically aren't recommended with fewer than 6-10 groups. You only have 3 batches of fungi. One might instead use a fixed-effect term for the batches, if you want to build a model of the individual observations that takes batch-to-batch differences into account.

\n

Finally, there are several tool sets for post-modeling comparisons of all against all or of each treatment against control. I find the emmeans package to be comprehensive and well documented. As @MichaelLew notes, you should document the dose-response curve.

\n", "answer_id": 677209, "answer_text": "The answer from @MichaelLew (+1) nicely gets to the main points. Here are a few extra thoughts that are more than can fit into comments.\n\n\n\n\nFirst, single-cell fluorescence data typically are log transformed before analysis. Even in the range where fluorescence intensity is proportional to the number of fluorescent molecules, a cellular protein that is labeled with a fluorescent marker often has something close to a log-normal distribution among the individual cells. See, for example, the Wikipedia entry on transformations of flow cytometry data (https://en.wikipedia.org/wiki/Flow_cytometry_bioinformatics#Transformation). Your data seem consistent with such a distribution.\n\n\n\n\nSecond, \"correct\" practice would treat your situation as having 3 biological replicates with many technical replicates each. See the Technical Perspective in Molecular Biology of the Cell (https://doi.org/10.1091/mbc.E15-02-0076) by D.A., T.D., and K.S. Pollard. A possible exception would be if the distribution among cells was of primary interest, but even then you would need biological replicates to convince your audience of your conclusions (and, I hope, yourself).\n\n\n\n\nThird, there are at least three major ways to handle highly skewed outcome data that have something close to a log-normal distribution.\n\n\n\n\n\n\n\nDo a log transformation and model the means of the log-transformed values. That seems to be the favorite among cellular and molecular biologists. As the simplest to explain to your audience, it would be my choice provided that the transformation led to reasonably symmetric distributions of the observations within each batch/treatment combination.\n\n\n\n\n\n\n\n\n\nFit a generalized linear model (https://stats.stackexchange.com/tags/generalized-linear-model/info) with a logarithmic link function. That models the logs of the mean values instead.\n\n\n\n\n\n\n\n\n\nUse ordinal regression (https://en.wikipedia.org/wiki/Ordinal_regression), which you can think of as an extension of \"Kruskal-Wallis or similar\" that can accommodate multiple predictors in regression models. That trades off assumptions about the distribution of outcome values for an assumption about how predictors are associated with increasing ranks of outcome values. Frank Harrell provides extensive resources (https://www.fharrell.com/post/rpo/) for that approach. I have used it for single-cell fluorescence data, although I don't think it has come into frequent current use in cellular/molecular biology. I'd suggest learning more about its possibilities, as it can be applied widely.\n\n\n\n\n\n\n\n\nFourth, a mixed model is one way to handle a combination of biological and technical replicates. Your suggestion of a (1|cell) random-effect term, however, is not correct in your situation. Think of the \"random effects\" as the groups within which the observations are clustered. With only one observation per cell, those groups would be the 3 batches (perhaps also the images within the batches). A (1|cell) term would be correct if you had multiple observations over time on the same cells.\n\n\n\n\nThe problem is that mixed models typically aren't recommended with fewer than 6-10 groups (https://stats.stackexchange.com/q/37647/28500). You only have 3 batches of fungi. One might instead use a fixed-effect term for the batches, if you want to build a model of the individual observations that takes batch-to-batch differences into account.\n\n\n\n\nFinally, there are several tool sets for post-modeling comparisons of all against all or of each treatment against control. I find the emmeans package (https://cran.r-project.org/package=emmeans) to be comprehensive and well documented. As @MichaelLew notes, you should document the dose-response curve.", "answer_url": "https://stats.stackexchange.com/a/677209", "author": "EdM", "author_url": "https://stats.stackexchange.com/users/28500/edm", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-18T15:52:12+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677168, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "EdM", "profile_url": "https://stats.stackexchange.com/users/28500/edm", "user_type": "registered"}, "created_at": "2026-09-18T15:52:12+00:00", "raw_file": "raw/codex_api_v1/13b5f879587b71b34c0837bee317816dcd540d0ad5983f88cf56c19d10104c79_1790825261079646600_0.json", "raw_sha256": "0a63637f2455a28a1e691dd3090d34ef9975e6c8bdc2c5c883414d7215eb5972", "revision_guid": "7BF0827F-A834-4B61-87FF-BAC0D253DA34", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/7BF0827F-A834-4B61-87FF-BAC0D253DA34/view-source"}], "score": 3, "updated_at": "2026-09-18T15:52:12+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I have performed experiments where I am looking at how treating a fungus with an antifungal drug alters the binding of antibodies through fluorescent microscopy. I captured 4-6 images per conditions, in biological triplicate reps (and thus my n = 3), and performed single-cell analysis to quantify the fluorescence intensity of each cell. For each rep, cells analysed fall in the thousands.\n\n\n\n\nI’ve provided an example graph to show the sort of data I’m looking at. Here, as drug concentration increases, we get a trend of increased intensity ≈ increased binding. The statistical analysis is where I am struggling.\n\n\n\n\nWith only 3 reps (and from the visual distribution of the data) I believe normality assumptions can be thrown out the window so I believe I’ll need to do a non-parametric in some capacity. I also think that the random variation that arises on a cell-cell basis needs to be accounted for; whilst in the plot I’ve shown the means for each biorep, I don't think comparing the means in this case is an appropriate way to analyse the population, given the spread of the data?\n\n\n\n\nI'm working in R for the purpose of this work. The closest I’ve come to what I ‘should’ do is a mixed-effects model, whereby the model would look something like:\nIntensity ~ drug concentration + (1│cell)\n\n\n\n\nHowever, I am not sure exactly if this is an appropriate approach in this instance. Questions I have:\n\n\n\n\ni) Am I over-thinking this and I simply need to just do a Kruskal-wallis or similar?\n\n\n\n\nii) Whilst I’m mostly interested in comparing with control (0 drug), comparing between all is also\ninteresting; how would I approach this for any of the possible options?\n\n\n\n\niii) Is trying to account for the distribution actually required?\n\n\n\n\n[image: ; source: https://i.sstatic.net/zOGT7c65.png] (https://i.sstatic.net/zOGT7c65.png)\n\n\n\n\n\n\n\n\n\n\nEDIT 22/09/26\n\n\n\n\nI've looked at log of the data, and just providing an example here for those interested. I do think you would argue in this instance that the difference is clear, and whilst I would probably be happy with that I am certain my supervisor would at least want some statistical analysis that may suggest significant statistically speaking.\n\n\n\n\n(For those interested, we have seen a level of biological significance of the changes we are seeing here, so whether it actually matters if there is a 'statistical' significance is probably by-the-by. Nonetheless, big boss likes seeing a p value :/ )\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/opGUh8A4.png] (https://i.sstatic.net/opGUh8A4.png)", "record_id": "Scientific-Answer-Ranking:stats:677168", "scores": [5, 0, 3], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

(i) Yes, I think that you are over-thinking it. If you plot the data with a logarithmic scale for the fluorescence density you will very likely find that the does-response relationship is sufficiently clear that no statistical analysis is going to be needed. If you want to test the hypothesis that the drug can increase antibody binding then a clear dose-response relationship should be enough evidence to accept the biological hypothesis even without any test of a statistical hypothesis.

\n

(ii) On the other hand, you might want to characterise the relationship between drug concentration and effect, and the usual ways to do that also involve a dose-response relationship by way of finding the range of the effect (i.e. maximal effect of a maximally- or supramaximally-effective concentration of the drug) and the EC50 which is the concentration of the drug needed to elicit a half-maximal response. Those things are typically done by way of fitting a curve through the data. For those things your range of tested concentrations and number of replications might be a bit limited, but plot the curve and see how it looks before deciding on how to proceed (with a new experiment, perhaps).

\n

(iii) Yes, if there is a bad mismatch between the statistical model's version of population distribution and the real data distribution then there can be problems, particularly with small sample size. Using the logarithm of the fluorescence density as your measures is, in a way, taking the distribution into account. (There are many situations where a log-transform of biological data makes things clearer and is, at least arguably, 'natural'. See here: When are Log scales appropriate?)

\n", "answer_id": 677172, "answer_text": "(i) Yes, I think that you are over-thinking it. If you plot the data with a logarithmic scale for the fluorescence density you will very likely find that the does-response relationship is sufficiently clear that no statistical analysis is going to be needed. If you want to test the hypothesis that the drug can increase antibody binding then a clear dose-response relationship should be enough evidence to accept the biological hypothesis even without any test of a statistical hypothesis.\n\n\n\n\n(ii) On the other hand, you might want to characterise the relationship between drug concentration and effect, and the usual ways to do that also involve a dose-response relationship by way of finding the range of the effect (i.e. maximal effect of a maximally- or supramaximally-effective concentration of the drug) and the EC50 which is the concentration of the drug needed to elicit a half-maximal response. Those things are typically done by way of fitting a curve through the data. For those things your range of tested concentrations and number of replications might be a bit limited, but plot the curve and see how it looks before deciding on how to proceed (with a new experiment, perhaps).\n\n\n\n\n(iii) Yes, if there is a bad mismatch between the statistical model's version of population distribution and the real data distribution then there can be problems, particularly with small sample size. Using the logarithm of the fluorescence density as your measures is, in a way, taking the distribution into account. (There are many situations where a log-transform of biological data makes things clearer and is, at least arguably, 'natural'. See here: When are Log scales appropriate? (https://stats.stackexchange.com/questions/27951/when-are-log-scales-appropriate))", "answer_url": "https://stats.stackexchange.com/a/677172", "author": "Michael Lew", "author_url": "https://stats.stackexchange.com/users/1679/michael-lew", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-14T20:58:17+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677168, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Michael Lew", "profile_url": "https://stats.stackexchange.com/users/1679/michael-lew", "user_type": "registered"}, "created_at": "2026-09-14T20:58:17+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "0B9C87FB-0EF7-4AD3-A586-F7D58D0D2F8B", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/0B9C87FB-0EF7-4AD3-A586-F7D58D0D2F8B/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nick Cox", "profile_url": "https://stats.stackexchange.com/users/22047/nick-cox", "user_type": "registered"}, "created_at": "2026-09-23T09:14:30+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "CFD4CAE3-2F50-4849-84A1-861C28109C75", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/CFD4CAE3-2F50-4849-84A1-861C28109C75/view-source"}], "score": 5, "updated_at": "2026-09-23T09:14:30+00:00"}, {"answer_html": "

I do think you have way more than 3 replicates. Each cell you observed is an independent observation: yes, they may come from the same preparation/flask/dish/??, but they are different cells, which while prepared under the same conditions, are nevertheless different and independent observations. Thus, you in fact have a very large sample size.

\n

Your scenario is that of a 2-way Anova. You have 2 categorical factors: the drug concentration, and the source of the cells. And you observed every combination of these 2 factors, and have a lot (“thousands”) of observations for each of these combinations. You could also describe your scenario as a full factorial design (same engine under the hood. And that engine is a regression).
\nNow, for a 2-way Anova/factorial design, it is the residuals which need to be “not too non-normal”. Will that be the case with your data? Hard to tell from the plots, but it is often the case that marginal distributions which appear quite skewed end up giving you normal-ish residuals: you can find such examples here on CV, or here.

\n

Now, this ANOVA may tell you that the culture to culture variability has more effect than the drug concentration... And that would be a problem as you could not generalize your findings. But if the drug is mainly responsible for the effect, then you have something...

\n

But what if your residuals are also very non-normal?

\n

There were some suggestions for you to use the log of your response (fluorescence intensity). I am not (at all?) convinced that it would be a good idea. For one, what you are interested in (binding ability of antibodies) is strictly linear with the fluorescence intensity: twice the binding results in twice the observed fluorescence intensity. So using the log does not correspond to any biological or physical property of the phenomenon you are investigating. In addition, if you observe (or fail to observe) a statistically significant difference on the log of the intensity, it absolutely does not mean that you would have had the same significant (or not) result on the original intensity (because a log transformation compresses the data, hence reduces the differences, but also reduces the variability. Hence, you can not extrapolate a result on the logs to a result on the original data).
\nNote also that running some regression (e.g. mixed effects) would have the same issue with non-normal residuals (for the p-values of your regression to be valid, the residuals here too need to be “normal-ish”).

\n

Now, depending on what you will do with the results of your analysis, you could simply use the IOTT (Inter Ocular Trauma Test) (see here: when the answer hits you between the eyes. It should be clear that one preparation (HO163) behaves radically differently from the other 2. And it may be that this is all you need to make your decision?

\n

If the IOTT does not serve your purpose, you can then fall back on non-parametric tests. Again, with the large sample sizes you have, you should have good power.
\nOne could use a Kruskal-Wallis test (KWt). You could compare all possible combinations to each others, or some subset. But the KWt has a few flaws: one is that it requires homoscedasticity of the marginal distributions, and that does not look at all to be your case (heteroscedasticity leads to Type I error inflation). It also suffers from being affected by circularity (the KWt tests for stochastic superiority, and that property is not transitive: see this paper for an excellent discussion).
\nSo I would rather use a series of Mann-Whitney U tests (MWUt): a series (as opposed to all possible comparisons) to reduce the effect of multiple comparisons corrections (MCC), and because you are mostly interested in the comparison to the control situation. Note that the MWUt also has issues with heteroscedasticity, but it has a version, the Brunner-Munzel test (BMt) which does not require homoscedasticity (see this paper).
\nYou could also use a median test: it supports comparing multiple samples, and makes no distributional (or other such) assumption (it is basically a binomial test). Again, with your large sample sizes, it should have good power. Use the median test as an omnibus test, and then make only the paired comparisons you are truly interested in (to reduce the impact of the MCC).

\n

Just to be safe, let me point out that the various tests I mentioned here test different nulls: 2-way Anova tests equality of the means, MWUt and KWt test stochastic homogeneity, and the median test tests equality of the medians (and the IOTT tests your visual acuity?). So you will need to formulate your conclusions accordingly.

\n", "answer_id": 677197, "answer_text": "I do think you have way more than 3 replicates. Each cell you observed is an independent observation: yes, they may come from the same preparation/flask/dish/??, but they are different cells, which while prepared under the same conditions, are nevertheless different and independent observations. Thus, you in fact have a very large sample size.\n\n\n\n\nYour scenario is that of a 2-way Anova. You have 2 categorical factors: the drug concentration, and the source of the cells. And you observed every combination of these 2 factors, and have a lot (“thousands”) of observations for each of these combinations. You could also describe your scenario as a full factorial design (same engine under the hood. And that engine is a regression).\n\nNow, for a 2-way Anova/factorial design, it is the residuals which need to be “not too non-normal”. Will that be the case with your data? Hard to tell from the plots, but it is often the case that marginal distributions which appear quite skewed end up giving you normal-ish residuals: you can find such examples here on CV (https://stats.stackexchange.com/a/33320/380096), or here (https://www.youtube.com/watch?v=1ft8v7PlNKQ).\n\n\n\n\nNow, this ANOVA may tell you that the culture to culture variability has more effect than the drug concentration... And that would be a problem as you could not generalize your findings. But if the drug is mainly responsible for the effect, then you have something...\n\n\n\n\nBut what if your residuals are also very non-normal?\n\n\n\n\nThere were some suggestions for you to use the log of your response (fluorescence intensity). I am not (at all?) convinced that it would be a good idea. For one, what you are interested in (binding ability of antibodies) is strictly linear with the fluorescence intensity: twice the binding results in twice the observed fluorescence intensity. So using the log does not correspond to any biological or physical property of the phenomenon you are investigating. In addition, if you observe (or fail to observe) a statistically significant difference on the log of the intensity, it absolutely does not mean that you would have had the same significant (or not) result on the original intensity (because a log transformation compresses the data, hence reduces the differences, but also reduces the variability. Hence, you can not extrapolate a result on the logs to a result on the original data).\n\nNote also that running some regression (e.g. mixed effects) would have the same issue with non-normal residuals (for the p-values of your regression to be valid, the residuals here too need to be “normal-ish”).\n\n\n\n\nNow, depending on what you will do with the results of your analysis, you could simply use the IOTT (Inter Ocular Trauma Test) (see here (https://www.r-bloggers.com/2016/11/inter-ocular-trauma-test/): when the answer hits you between the eyes. It should be clear that one preparation (HO163) behaves radically differently from the other 2. And it may be that this is all you need to make your decision?\n\n\n\n\nIf the IOTT does not serve your purpose, you can then fall back on non-parametric tests. Again, with the large sample sizes you have, you should have good power. \n\nOne could use a Kruskal-Wallis test (KWt). You could compare all possible combinations to each others, or some subset. But the KWt has a few flaws: one is that it requires homoscedasticity of the marginal distributions, and that does not look at all to be your case (heteroscedasticity leads to Type I error inflation). It also suffers from being affected by circularity (the KWt tests for stochastic superiority, and that property is not transitive: see this paper (https://www.semanticscholar.org/paper/Kruskal%E2%80%93Wallis%2C-Multiple-Comparisons-and-Efron-Dice-Brown-Hettmansperger/6d6866ffb4ad03cef4c46a044ab096c498d09567) for an excellent discussion).\n\nSo I would rather use a series of Mann-Whitney U tests (MWUt): a series (as opposed to all possible comparisons) to reduce the effect of multiple comparisons corrections (MCC), and because you are mostly interested in the comparison to the control situation. Note that the MWUt also has issues with heteroscedasticity, but it has a version, the Brunner-Munzel test (BMt) which does not require homoscedasticity (see this paper (https://journals.sagepub.com/doi/full/10.1177/2515245921999602)).\n\nYou could also use a median test (https://en.wikipedia.org/wiki/Median_test): it supports comparing multiple samples, and makes no distributional (or other such) assumption (it is basically a binomial test). Again, with your large sample sizes, it should have good power. Use the median test as an omnibus test, and then make only the paired comparisons you are truly interested in (to reduce the impact of the MCC).\n\n\n\n\nJust to be safe, let me point out that the various tests I mentioned here test different nulls: 2-way Anova tests equality of the means, MWUt and KWt test stochastic homogeneity, and the median test tests equality of the medians (and the IOTT tests your visual acuity?). So you will need to formulate your conclusions accordingly.", "answer_url": "https://stats.stackexchange.com/a/677197", "author": "jginestet", "author_url": "https://stats.stackexchange.com/users/380096/jginestet", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-17T20:11:08+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677168, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-17T20:11:08+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "0598B5D3-6667-41E6-AD00-022541F50453", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/0598B5D3-6667-41E6-AD00-022541F50453/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-18T22:54:22+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "6D155F63-4414-4C5B-86F7-B3F496416B99", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/6D155F63-4414-4C5B-86F7-B3F496416B99/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-18T23:11:40+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "31636490-35B8-4E12-AE63-2EB28805B1F8", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/31636490-35B8-4E12-AE63-2EB28805B1F8/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-18T23:26:40+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "FDBE9BC2-7381-46F3-9F5B-0A074D4850E5", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/FDBE9BC2-7381-46F3-9F5B-0A074D4850E5/view-source"}], "score": 0, "updated_at": "2026-09-18T23:26:40+00:00"}, {"answer_html": "

The answer from @MichaelLew (+1) nicely gets to the main points. Here are a few extra thoughts that are more than can fit into comments.

\n

First, single-cell fluorescence data typically are log transformed before analysis. Even in the range where fluorescence intensity is proportional to the number of fluorescent molecules, a cellular protein that is labeled with a fluorescent marker often has something close to a log-normal distribution among the individual cells. See, for example, the Wikipedia entry on transformations of flow cytometry data. Your data seem consistent with such a distribution.

\n

Second, "correct" practice would treat your situation as having 3 biological replicates with many technical replicates each. See the Technical Perspective in Molecular Biology of the Cell by D.A., T.D., and K.S. Pollard. A possible exception would be if the distribution among cells was of primary interest, but even then you would need biological replicates to convince your audience of your conclusions (and, I hope, yourself).

\n

Third, there are at least three major ways to handle highly skewed outcome data that have something close to a log-normal distribution.

\n
    \n
  • Do a log transformation and model the means of the log-transformed values. That seems to be the favorite among cellular and molecular biologists. As the simplest to explain to your audience, it would be my choice provided that the transformation led to reasonably symmetric distributions of the observations within each batch/treatment combination.

    \n
  • \n
  • Fit a generalized linear model with a logarithmic link function. That models the logs of the mean values instead.

    \n
  • \n
  • Use ordinal regression, which you can think of as an extension of "Kruskal-Wallis or similar" that can accommodate multiple predictors in regression models. That trades off assumptions about the distribution of outcome values for an assumption about how predictors are associated with increasing ranks of outcome values. Frank Harrell provides extensive resources for that approach. I have used it for single-cell fluorescence data, although I don't think it has come into frequent current use in cellular/molecular biology. I'd suggest learning more about its possibilities, as it can be applied widely.

    \n
  • \n
\n

Fourth, a mixed model is one way to handle a combination of biological and technical replicates. Your suggestion of a (1|cell) random-effect term, however, is not correct in your situation. Think of the "random effects" as the groups within which the observations are clustered. With only one observation per cell, those groups would be the 3 batches (perhaps also the images within the batches). A (1|cell) term would be correct if you had multiple observations over time on the same cells.

\n

The problem is that mixed models typically aren't recommended with fewer than 6-10 groups. You only have 3 batches of fungi. One might instead use a fixed-effect term for the batches, if you want to build a model of the individual observations that takes batch-to-batch differences into account.

\n

Finally, there are several tool sets for post-modeling comparisons of all against all or of each treatment against control. I find the emmeans package to be comprehensive and well documented. As @MichaelLew notes, you should document the dose-response curve.

\n", "answer_id": 677209, "answer_text": "The answer from @MichaelLew (+1) nicely gets to the main points. Here are a few extra thoughts that are more than can fit into comments.\n\n\n\n\nFirst, single-cell fluorescence data typically are log transformed before analysis. Even in the range where fluorescence intensity is proportional to the number of fluorescent molecules, a cellular protein that is labeled with a fluorescent marker often has something close to a log-normal distribution among the individual cells. See, for example, the Wikipedia entry on transformations of flow cytometry data (https://en.wikipedia.org/wiki/Flow_cytometry_bioinformatics#Transformation). Your data seem consistent with such a distribution.\n\n\n\n\nSecond, \"correct\" practice would treat your situation as having 3 biological replicates with many technical replicates each. See the Technical Perspective in Molecular Biology of the Cell (https://doi.org/10.1091/mbc.E15-02-0076) by D.A., T.D., and K.S. Pollard. A possible exception would be if the distribution among cells was of primary interest, but even then you would need biological replicates to convince your audience of your conclusions (and, I hope, yourself).\n\n\n\n\nThird, there are at least three major ways to handle highly skewed outcome data that have something close to a log-normal distribution.\n\n\n\n\n\n\n\nDo a log transformation and model the means of the log-transformed values. That seems to be the favorite among cellular and molecular biologists. As the simplest to explain to your audience, it would be my choice provided that the transformation led to reasonably symmetric distributions of the observations within each batch/treatment combination.\n\n\n\n\n\n\n\n\n\nFit a generalized linear model (https://stats.stackexchange.com/tags/generalized-linear-model/info) with a logarithmic link function. That models the logs of the mean values instead.\n\n\n\n\n\n\n\n\n\nUse ordinal regression (https://en.wikipedia.org/wiki/Ordinal_regression), which you can think of as an extension of \"Kruskal-Wallis or similar\" that can accommodate multiple predictors in regression models. That trades off assumptions about the distribution of outcome values for an assumption about how predictors are associated with increasing ranks of outcome values. Frank Harrell provides extensive resources (https://www.fharrell.com/post/rpo/) for that approach. I have used it for single-cell fluorescence data, although I don't think it has come into frequent current use in cellular/molecular biology. I'd suggest learning more about its possibilities, as it can be applied widely.\n\n\n\n\n\n\n\n\nFourth, a mixed model is one way to handle a combination of biological and technical replicates. Your suggestion of a (1|cell) random-effect term, however, is not correct in your situation. Think of the \"random effects\" as the groups within which the observations are clustered. With only one observation per cell, those groups would be the 3 batches (perhaps also the images within the batches). A (1|cell) term would be correct if you had multiple observations over time on the same cells.\n\n\n\n\nThe problem is that mixed models typically aren't recommended with fewer than 6-10 groups (https://stats.stackexchange.com/q/37647/28500). You only have 3 batches of fungi. One might instead use a fixed-effect term for the batches, if you want to build a model of the individual observations that takes batch-to-batch differences into account.\n\n\n\n\nFinally, there are several tool sets for post-modeling comparisons of all against all or of each treatment against control. I find the emmeans package (https://cran.r-project.org/package=emmeans) to be comprehensive and well documented. As @MichaelLew notes, you should document the dose-response curve.", "answer_url": "https://stats.stackexchange.com/a/677209", "author": "EdM", "author_url": "https://stats.stackexchange.com/users/28500/edm", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-18T15:52:12+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677168, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "EdM", "profile_url": "https://stats.stackexchange.com/users/28500/edm", "user_type": "registered"}, "created_at": "2026-09-18T15:52:12+00:00", "raw_file": "raw/codex_api_v1/13b5f879587b71b34c0837bee317816dcd540d0ad5983f88cf56c19d10104c79_1790825261079646600_0.json", "raw_sha256": "0a63637f2455a28a1e691dd3090d34ef9975e6c8bdc2c5c883414d7215eb5972", "revision_guid": "7BF0827F-A834-4B61-87FF-BAC0D253DA34", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/7BF0827F-A834-4B61-87FF-BAC0D253DA34/view-source"}], "score": 3, "updated_at": "2026-09-18T15:52:12+00:00"}], "domain": "statistics", "external_links": ["https://cran.r-project.org/package=emmeans", "https://doi.org/10.1091/mbc.E15-02-0076", "https://en.wikipedia.org/wiki/Flow_cytometry_bioinformatics#Transformation", "https://en.wikipedia.org/wiki/Median_test", "https://en.wikipedia.org/wiki/Ordinal_regression", "https://i.sstatic.net/opGUh8A4.png", "https://i.sstatic.net/zOGT7c65.png", "https://journals.sagepub.com/doi/full/10.1177/2515245921999602", "https://www.fharrell.com/post/rpo/", "https://www.r-bloggers.com/2016/11/inter-ocular-trauma-test/", "https://www.semanticscholar.org/paper/Kruskal%E2%80%93Wallis%2C-Multiple-Comparisons-and-Efron-Dice-Brown-Hettmansperger/6d6866ffb4ad03cef4c46a044ab096c498d09567", "https://www.youtube.com/watch?v=1ft8v7PlNKQ"], "medical_sensitive": true, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:03.428408+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/774052c18cd9e8fa951e893347bfa3c1a85e743fc46ec4667572002cadb10cbf_1790825224163423600_0.json", "raw_sha256": "fe4dd06d3de6c0b1bb33ba88aee0ed4284118e01f76a58dcdce220a4946329b2", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Harry Osborne", "question_author_url": "https://stats.stackexchange.com/users/516650/harry-osborne", "question_author_user_type": "registered", "question_created_at": "2026-09-14T14:31:44+00:00", "question_html": "

I have performed experiments where I am looking at how treating a fungus with an antifungal drug alters the binding of antibodies through fluorescent microscopy. I captured 4-6 images per conditions, in biological triplicate reps (and thus my n = 3), and performed single-cell analysis to quantify the fluorescence intensity of each cell. For each rep, cells analysed fall in the thousands.

\n

I’ve provided an example graph to show the sort of data I’m looking at. Here, as drug concentration increases, we get a trend of increased intensity ≈ increased binding. The statistical analysis is where I am struggling.

\n

With only 3 reps (and from the visual distribution of the data) I believe normality assumptions can be thrown out the window so I believe I’ll need to do a non-parametric in some capacity. I also think that the random variation that arises on a cell-cell basis needs to be accounted for; whilst in the plot I’ve shown the means for each biorep, I don't think comparing the means in this case is an appropriate way to analyse the population, given the spread of the data?

\n

I'm working in R for the purpose of this work. The closest I’ve come to what I ‘should’ do is a mixed-effects model, whereby the model would look something like:\nIntensity ~ drug concentration + (1│cell)

\n

However, I am not sure exactly if this is an appropriate approach in this instance. Questions I have:

\n

i) Am I over-thinking this and I simply need to just do a Kruskal-wallis or similar?

\n

ii) Whilst I’m mostly interested in comparing with control (0 drug), comparing between all is also\ninteresting; how would I approach this for any of the possible options?

\n

iii) Is trying to account for the distribution actually required?

\n

\"\"

\n
\n
\n

EDIT 22/09/26

\n

I've looked at log of the data, and just providing an example here for those interested. I do think you would argue in this instance that the difference is clear, and whilst I would probably be happy with that I am certain my supervisor would at least want some statistical analysis that may suggest significant statistically speaking.

\n

(For those interested, we have seen a level of biological significance of the changes we are seeing here, so whether it actually matters if there is a 'statistical' significance is probably by-the-by. Nonetheless, big boss likes seeing a p value :/ )

\n

\"enter

\n", "question_id": 677168, "question_license": "CC BY-SA 4.0", "question_score": 2, "question_text": "I have performed experiments where I am looking at how treating a fungus with an antifungal drug alters the binding of antibodies through fluorescent microscopy. I captured 4-6 images per conditions, in biological triplicate reps (and thus my n = 3), and performed single-cell analysis to quantify the fluorescence intensity of each cell. For each rep, cells analysed fall in the thousands.\n\n\n\n\nI’ve provided an example graph to show the sort of data I’m looking at. Here, as drug concentration increases, we get a trend of increased intensity ≈ increased binding. The statistical analysis is where I am struggling.\n\n\n\n\nWith only 3 reps (and from the visual distribution of the data) I believe normality assumptions can be thrown out the window so I believe I’ll need to do a non-parametric in some capacity. I also think that the random variation that arises on a cell-cell basis needs to be accounted for; whilst in the plot I’ve shown the means for each biorep, I don't think comparing the means in this case is an appropriate way to analyse the population, given the spread of the data?\n\n\n\n\nI'm working in R for the purpose of this work. The closest I’ve come to what I ‘should’ do is a mixed-effects model, whereby the model would look something like:\nIntensity ~ drug concentration + (1│cell)\n\n\n\n\nHowever, I am not sure exactly if this is an appropriate approach in this instance. Questions I have:\n\n\n\n\ni) Am I over-thinking this and I simply need to just do a Kruskal-wallis or similar?\n\n\n\n\nii) Whilst I’m mostly interested in comparing with control (0 drug), comparing between all is also\ninteresting; how would I approach this for any of the possible options?\n\n\n\n\niii) Is trying to account for the distribution actually required?\n\n\n\n\n[image: ; source: https://i.sstatic.net/zOGT7c65.png] (https://i.sstatic.net/zOGT7c65.png)\n\n\n\n\n\n\n\n\n\n\nEDIT 22/09/26\n\n\n\n\nI've looked at log of the data, and just providing an example here for those interested. I do think you would argue in this instance that the difference is clear, and whilst I would probably be happy with that I am certain my supervisor would at least want some statistical analysis that may suggest significant statistically speaking.\n\n\n\n\n(For those interested, we have seen a level of biological significance of the changes we are seeing here, so whether it actually matters if there is a 'statistical' significance is probably by-the-by. Nonetheless, big boss likes seeing a p value :/ )\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/opGUh8A4.png] (https://i.sstatic.net/opGUh8A4.png)", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Harry Osborne", "profile_url": "https://stats.stackexchange.com/users/516650/harry-osborne", "user_type": "registered"}, "created_at": "2026-09-14T14:31:44+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "B4E4E7F4-7071-4893-9E17-31B7D6D44405", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/B4E4E7F4-7071-4893-9E17-31B7D6D44405/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-09-14T22:36:45+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "5DA0A189-D1E8-4476-8C1D-0A3B8A85C459", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/5DA0A189-D1E8-4476-8C1D-0A3B8A85C459/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Harry Osborne", "profile_url": "https://stats.stackexchange.com/users/516650/harry-osborne", "user_type": "registered"}, "created_at": "2026-09-22T12:26:16+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "ADB1C3A2-04F4-4A1A-BDAC-63D8A2B7BDCC", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/ADB1C3A2-04F4-4A1A-BDAC-63D8A2B7BDCC/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nick Cox", "profile_url": "https://stats.stackexchange.com/users/22047/nick-cox", "user_type": "registered"}, "created_at": "2026-09-23T09:12:01+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "0532E1B5-F622-4E59-A1BE-2C6BD4A2C6DF", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/0532E1B5-F622-4E59-A1BE-2C6BD4A2C6DF/view-source"}], "source_site": "stats", "source_url": "https://stats.stackexchange.com/questions/677168/performing-correct-statistical-analysis-on-fluorescent-intensity-data", "split": "train", "split_group": "aeee5d56c55539be690a9261cf07b23e2a6dc49ccc231769c30fea65b2b2a5d9", "tags": ["r", "mixed-model", "statistical-significance", "normality-assumption"], "thread_id": "stats:677168", "title": "Performing 'correct' statistical analysis on fluorescent intensity data"}} {"accepted_status": [false, false], "candidate_answers": [{"answer_html": "

First: That is much too simple a rule. A better rule of thumb is one regressor for every ten observations, so if you have a really big data set, you could use more variables without overfitting.

\n

Second, it does matter whether your outcome is categorical. For categorical outcomes, a common rule of thumb is 10 observations in the least common category for each regressor. This can be much more restrictive, if some categories are rare.

\n

Third, overfitting is not the only problem. When you have many variables, it can be hard to interpret the model. Mathematically, it's straightforward: You're controlling for all the other variables. But what that means, substantively, can be tricky.

\n

Fourth, with a lot of regressors, collinearity is often a problem, at least if you want to interpret the model (it doesn't affect prediction).

\n

Finally, choosing a good model is a huge subject, with many threads here. Browse the model-selection tag for lots of material.

\n", "answer_id": 677170, "answer_text": "First: That is much too simple a rule. A better rule of thumb is one regressor for every ten observations, so if you have a really big data set, you could use more variables without overfitting.\n\n\n\n\nSecond, it does matter whether your outcome is categorical. For categorical outcomes, a common rule of thumb is 10 observations in the least common category for each regressor. This can be much more restrictive, if some categories are rare.\n\n\n\n\nThird, overfitting is not the only problem. When you have many variables, it can be hard to interpret the model. Mathematically, it's straightforward: You're controlling for all the other variables. But what that means, substantively, can be tricky.\n\n\n\n\nFourth, with a lot of regressors, collinearity is often a problem, at least if you want to interpret the model (it doesn't affect prediction).\n\n\n\n\nFinally, choosing a good model is a huge subject, with many threads here. Browse the model-selection tag for lots of material.", "answer_url": "https://stats.stackexchange.com/a/677170", "author": "Peter Flom", "author_url": "https://stats.stackexchange.com/users/686/peter-flom", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-14T19:41:01+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677169, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Peter Flom", "profile_url": "https://stats.stackexchange.com/users/686/peter-flom", "user_type": "registered"}, "created_at": "2026-09-14T19:41:01+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "24267A3D-EFFC-4C8A-BBD5-56E85D075DAA", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/24267A3D-EFFC-4C8A-BBD5-56E85D075DAA/view-source"}], "score": 9, "updated_at": "2026-09-14T19:41:01+00:00"}, {"answer_html": "

You should try one or more kinds of regularizers: e.g. Ridge Regression (L2 penalty on the coefficients) or Lasso Regression (L1 penalties on the coefficients); or some of both together. Playing with the regularization penalties essentially converts your question to a model selection problem. Fit as many things as you like, and the Lasso will zero out the coefficients for the less relevant ones. The more data you have, the more coefficients it makes sense to keep, or the smaller penalties you can use and still get meaningful results. If reducing your penalties a little changes your coefficients much, you should go the other way.

\n", "answer_id": 677198, "answer_text": "You should try one or more kinds of regularizers: e.g. Ridge Regression (L2 penalty on the coefficients) or Lasso Regression (L1 penalties on the coefficients); or some of both together. Playing with the regularization penalties essentially converts your question to a model selection problem. Fit as many things as you like, and the Lasso will zero out the coefficients for the less relevant ones. The more data you have, the more coefficients it makes sense to keep, or the smaller penalties you can use and still get meaningful results. If reducing your penalties a little changes your coefficients much, you should go the other way.", "answer_url": "https://stats.stackexchange.com/a/677198", "author": "Richard Lyon", "author_url": "https://stats.stackexchange.com/users/516789/richard-lyon", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-17T23:10:31+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677169, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Richard Lyon", "profile_url": "https://stats.stackexchange.com/users/516789/richard-lyon", "user_type": "registered"}, "created_at": "2026-09-17T23:10:31+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "725FFA89-6A2B-4A9F-8AA5-26CA4C77EAC1", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/725FFA89-6A2B-4A9F-8AA5-26CA4C77EAC1/view-source"}], "score": 2, "updated_at": "2026-09-17T23:10:31+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "In my intro to biostats classes I was taught that one shouldn’t adjust for more than 10 variables in a regression model because it would overfit the data. However, what if you were working with a dataset that has for instance 50 variables and around 40 of them are variables that you would adjust for, how would you prevent overfitting?\n\n\n\n\nWould it be okay to adjust for more than 10 variables in the same model?\n\n\n\n\nI would greatly appreciate an easy to understand answer.\n\n\n\n\nMy outcome is either categorical or continuous but I don’t think it matters for the explanation I need.", "record_id": "Scientific-Answer-Ranking:stats:677169", "scores": [9, 2], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

First: That is much too simple a rule. A better rule of thumb is one regressor for every ten observations, so if you have a really big data set, you could use more variables without overfitting.

\n

Second, it does matter whether your outcome is categorical. For categorical outcomes, a common rule of thumb is 10 observations in the least common category for each regressor. This can be much more restrictive, if some categories are rare.

\n

Third, overfitting is not the only problem. When you have many variables, it can be hard to interpret the model. Mathematically, it's straightforward: You're controlling for all the other variables. But what that means, substantively, can be tricky.

\n

Fourth, with a lot of regressors, collinearity is often a problem, at least if you want to interpret the model (it doesn't affect prediction).

\n

Finally, choosing a good model is a huge subject, with many threads here. Browse the model-selection tag for lots of material.

\n", "answer_id": 677170, "answer_text": "First: That is much too simple a rule. A better rule of thumb is one regressor for every ten observations, so if you have a really big data set, you could use more variables without overfitting.\n\n\n\n\nSecond, it does matter whether your outcome is categorical. For categorical outcomes, a common rule of thumb is 10 observations in the least common category for each regressor. This can be much more restrictive, if some categories are rare.\n\n\n\n\nThird, overfitting is not the only problem. When you have many variables, it can be hard to interpret the model. Mathematically, it's straightforward: You're controlling for all the other variables. But what that means, substantively, can be tricky.\n\n\n\n\nFourth, with a lot of regressors, collinearity is often a problem, at least if you want to interpret the model (it doesn't affect prediction).\n\n\n\n\nFinally, choosing a good model is a huge subject, with many threads here. Browse the model-selection tag for lots of material.", "answer_url": "https://stats.stackexchange.com/a/677170", "author": "Peter Flom", "author_url": "https://stats.stackexchange.com/users/686/peter-flom", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-14T19:41:01+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677169, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Peter Flom", "profile_url": "https://stats.stackexchange.com/users/686/peter-flom", "user_type": "registered"}, "created_at": "2026-09-14T19:41:01+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "24267A3D-EFFC-4C8A-BBD5-56E85D075DAA", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/24267A3D-EFFC-4C8A-BBD5-56E85D075DAA/view-source"}], "score": 9, "updated_at": "2026-09-14T19:41:01+00:00"}, {"answer_html": "

You should try one or more kinds of regularizers: e.g. Ridge Regression (L2 penalty on the coefficients) or Lasso Regression (L1 penalties on the coefficients); or some of both together. Playing with the regularization penalties essentially converts your question to a model selection problem. Fit as many things as you like, and the Lasso will zero out the coefficients for the less relevant ones. The more data you have, the more coefficients it makes sense to keep, or the smaller penalties you can use and still get meaningful results. If reducing your penalties a little changes your coefficients much, you should go the other way.

\n", "answer_id": 677198, "answer_text": "You should try one or more kinds of regularizers: e.g. Ridge Regression (L2 penalty on the coefficients) or Lasso Regression (L1 penalties on the coefficients); or some of both together. Playing with the regularization penalties essentially converts your question to a model selection problem. Fit as many things as you like, and the Lasso will zero out the coefficients for the less relevant ones. The more data you have, the more coefficients it makes sense to keep, or the smaller penalties you can use and still get meaningful results. If reducing your penalties a little changes your coefficients much, you should go the other way.", "answer_url": "https://stats.stackexchange.com/a/677198", "author": "Richard Lyon", "author_url": "https://stats.stackexchange.com/users/516789/richard-lyon", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-17T23:10:31+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677169, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Richard Lyon", "profile_url": "https://stats.stackexchange.com/users/516789/richard-lyon", "user_type": "registered"}, "created_at": "2026-09-17T23:10:31+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "725FFA89-6A2B-4A9F-8AA5-26CA4C77EAC1", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/725FFA89-6A2B-4A9F-8AA5-26CA4C77EAC1/view-source"}], "score": 2, "updated_at": "2026-09-17T23:10:31+00:00"}], "domain": "statistics", "external_links": [], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:03.428408+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/774052c18cd9e8fa951e893347bfa3c1a85e743fc46ec4667572002cadb10cbf_1790825224163423600_0.json", "raw_sha256": "fe4dd06d3de6c0b1bb33ba88aee0ed4284118e01f76a58dcdce220a4946329b2", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "ineedhelp", "question_author_url": "https://stats.stackexchange.com/users/328519/ineedhelp", "question_author_user_type": "registered", "question_created_at": "2026-09-14T19:13:21+00:00", "question_html": "

In my intro to biostats classes I was taught that one shouldn’t adjust for more than 10 variables in a regression model because it would overfit the data. However, what if you were working with a dataset that has for instance 50 variables and around 40 of them are variables that you would adjust for, how would you prevent overfitting?

\n

Would it be okay to adjust for more than 10 variables in the same model?

\n

I would greatly appreciate an easy to understand answer.

\n

My outcome is either categorical or continuous but I don’t think it matters for the explanation I need.

\n", "question_id": 677169, "question_license": "CC BY-SA 4.0", "question_score": 5, "question_text": "In my intro to biostats classes I was taught that one shouldn’t adjust for more than 10 variables in a regression model because it would overfit the data. However, what if you were working with a dataset that has for instance 50 variables and around 40 of them are variables that you would adjust for, how would you prevent overfitting?\n\n\n\n\nWould it be okay to adjust for more than 10 variables in the same model?\n\n\n\n\nI would greatly appreciate an easy to understand answer.\n\n\n\n\nMy outcome is either categorical or continuous but I don’t think it matters for the explanation I need.", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "ineedhelp", "profile_url": "https://stats.stackexchange.com/users/328519/ineedhelp", "user_type": "registered"}, "created_at": "2026-09-14T19:13:21+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "2972E220-ADB4-4C69-843D-CFAFF417E7A3", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/2972E220-ADB4-4C69-843D-CFAFF417E7A3/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-09-15T03:21:56+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "7F9A7C91-F9E9-41BB-B0D1-513212A717A8", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/7F9A7C91-F9E9-41BB-B0D1-513212A717A8/view-source"}, {"content_license": null, "contributor": {"display_name": "Richard Hardy", "profile_url": "https://stats.stackexchange.com/users/53690/richard-hardy", "user_type": "registered"}, "created_at": "2026-09-16T19:18:53+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "A5EF3AEF-D5BC-422F-926A-4E678B350FE2", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/A5EF3AEF-D5BC-422F-926A-4E678B350FE2/view-source"}], "source_site": "stats", "source_url": "https://stats.stackexchange.com/questions/677169/how-do-you-prevent-overfitting-regression-models-when-you-adjust-for-more-than-1", "split": "train", "split_group": "be6f130d0b7c65dde44fa26090c83898d7df6a37fcfdcdcf2607652ac5c87a3b", "tags": ["regression", "multiple-regression", "overfitting", "high-dimensional"], "thread_id": "stats:677169", "title": "How do you prevent overfitting regression models when you adjust for more than 10 variables?"}} {"accepted_status": [false, false, false], "candidate_answers": [{"answer_html": "

Some of the comments could be answers, and are good answers. But, if you want completely non-technical, I'd use an example.

\n

Suppose you go on a diet to lose weight. You weigh yourself every day and get values say (in pounds):

\n

160 159 160 159 158 157 158 157 156

\n

Looks like you've lost a few pounds! What if we ignore the time series element?

\n

Then we have no idea if we have lost or gained weight.

\n

I think that's understandable by pretty much anyone - no calculations needed.

\n", "answer_id": 677187, "answer_text": "Some of the comments could be answers, and are good answers. But, if you want completely non-technical, I'd use an example.\n\n\n\n\nSuppose you go on a diet to lose weight. You weigh yourself every day and get values say (in pounds):\n\n\n\n\n160 159 160 159 158 157 158 157 156\n\n\n\n\nLooks like you've lost a few pounds! What if we ignore the time series element?\n\n\n\n\nThen we have no idea if we have lost or gained weight.\n\n\n\n\nI think that's understandable by pretty much anyone - no calculations needed.", "answer_url": "https://stats.stackexchange.com/a/677187", "author": "Peter Flom", "author_url": "https://stats.stackexchange.com/users/686/peter-flom", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-17T12:22:20+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677186, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Peter Flom", "profile_url": "https://stats.stackexchange.com/users/686/peter-flom", "user_type": "registered"}, "created_at": "2026-09-17T12:22:20+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "AD7F8377-51C8-4D08-9CFF-2966F61EF20D", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/AD7F8377-51C8-4D08-9CFF-2966F61EF20D/view-source"}], "score": 12, "updated_at": "2026-09-17T12:22:20+00:00"}, {"answer_html": "

Ask them, if they are more impressed if I forecast a slow-down in sales for the next year (in orange) based on what I know (the blue dots) in scenario A or B.\n\"Two

\n

If I ignore that it's a time-series and "forecast" using data including that from the future of what I'm forecasting, I'm treating a time series as any other random variable. Most people will understand that this is kind of cheating / not the problem they want to solve. In scenario B, I only get to use the sales in the past, most people will agree that this makes more sense.

\n", "answer_id": 677188, "answer_text": "Ask them, if they are more impressed if I forecast a slow-down in sales for the next year (in orange) based on what I know (the blue dots) in scenario A or B.\n[image: Two scenarios for forecasting sale, in A we know future sales, too, in B only the sales in the past; source: https://i.sstatic.net/Z4d1Pytm.png] (https://i.sstatic.net/Z4d1Pytm.png)\n\n\n\n\nIf I ignore that it's a time-series and \"forecast\" using data including that from the future of what I'm forecasting, I'm treating a time series as any other random variable. Most people will understand that this is kind of cheating / not the problem they want to solve. In scenario B, I only get to use the sales in the past, most people will agree that this makes more sense.", "answer_url": "https://stats.stackexchange.com/a/677188", "author": "Björn", "author_url": "https://stats.stackexchange.com/users/86652/bj%c3%b6rn", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-17T12:57:18+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677186, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Björn", "profile_url": "https://stats.stackexchange.com/users/86652/bj%c3%b6rn", "user_type": "registered"}, "created_at": "2026-09-17T12:57:18+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "02F3E722-3DF0-4226-B17B-0477A480D8AE", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/02F3E722-3DF0-4226-B17B-0477A480D8AE/view-source"}], "score": 5, "updated_at": "2026-09-17T12:57:18+00:00"}, {"answer_html": "

Let's say you measure the height of a river at a particular point for 5 days and get the values:

\n

6.5 ft, 6.2ft, 6.1 ft, 6.7 ft, 6.1 ft.

\n

Then I asked you to predict what the height would be on day 6. If you answer "probably a bit more than 6 feet" that makes sense...because you are intuitively assuming that the height on day 6 will be VERY SIMILAR to the height on previous days.

\n

But that is just another way of saying that we assume that the height at a given day is strongly correlated with its height on previous days. But if that's true, then the value cannot be completely "random" (or more specifically "independent") in the way that two random people selected for participation in a political poll are assumed to be.

\n

This matters if you want to do any sort of quantitative analysis, say looking at whether the height of the river is related to some other changing trend, like the crop yield of a nearby field. Most statistical models, like regression analysis, assume that the variables you are comparing are NOT correlated with previous values in this way, and if you try to use those methods on these sorts of data they could very well give you the wrong answer.

\n

In the most egregious case a regression analysis might even tell you two trends are strongly correlated even when they have NOTHING to do with each other, and this problem gets WORSE the more data you have! This happens when both series are what we call a "random walk" - where tomorrow's value is just today's value plus or minus some random variation.

\n

To prevent this sort of thing from happening, it is important to identify the characteristics of a time series before you start analyzing it: how dependent is each value on the ones before it? Is there some overall upward or downward trend? Is there a cyclical seasonal variation that repeats over some interval? Once you have figured this stuff out, you can transform the values you are analyzing so that they can be analyzed correctly.

\n", "answer_id": 677189, "answer_text": "Let's say you measure the height of a river at a particular point for 5 days and get the values:\n\n\n\n\n6.5 ft, 6.2ft, 6.1 ft, 6.7 ft, 6.1 ft.\n\n\n\n\nThen I asked you to predict what the height would be on day 6. If you answer \"probably a bit more than 6 feet\" that makes sense...because you are intuitively assuming that the height on day 6 will be VERY SIMILAR to the height on previous days.\n\n\n\n\nBut that is just another way of saying that we assume that the height at a given day is strongly correlated with its height on previous days. But if that's true, then the value cannot be completely \"random\" (or more specifically \"independent\") in the way that two random people selected for participation in a political poll are assumed to be.\n\n\n\n\nThis matters if you want to do any sort of quantitative analysis, say looking at whether the height of the river is related to some other changing trend, like the crop yield of a nearby field. Most statistical models, like regression analysis, assume that the variables you are comparing are NOT correlated with previous values in this way, and if you try to use those methods on these sorts of data they could very well give you the wrong answer.\n\n\n\n\nIn the most egregious case a regression analysis might even tell you two trends are strongly correlated even when they have NOTHING to do with each other, and this problem gets WORSE the more data you have! This happens when both series are what we call a \"random walk\" - where tomorrow's value is just today's value plus or minus some random variation.\n\n\n\n\nTo prevent this sort of thing from happening, it is important to identify the characteristics of a time series before you start analyzing it: how dependent is each value on the ones before it? Is there some overall upward or downward trend? Is there a cyclical seasonal variation that repeats over some interval? Once you have figured this stuff out, you can transform the values you are analyzing so that they can be analyzed correctly.", "answer_url": "https://stats.stackexchange.com/a/677189", "author": "Graham Wright", "author_url": "https://stats.stackexchange.com/users/291159/graham-wright", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-17T13:01:38+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677186, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Graham Wright", "profile_url": "https://stats.stackexchange.com/users/291159/graham-wright", "user_type": "registered"}, "created_at": "2026-09-17T13:01:38+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "7126F2E7-BCD0-4B9D-9F22-F3D7402743A5", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/7126F2E7-BCD0-4B9D-9F22-F3D7402743A5/view-source"}], "score": 7, "updated_at": "2026-09-17T13:01:38+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I work in a field (hydrology) where many practitioners (and others) treat time series as though they were a series of random variables - that is, they ignore the structure in the series and have little understanding of why it is important. Of course I know why there is a difference and what the consequences are, but most of the explanations of that I can find are mathematical - or at least mathematical enough that they are incomprehensible to non-mathematically minded people.\n\n\n\n\nSo, what are the simplest explanations of the difference that would be accessible to non-mathematicians and would make it immediately obvious that they need to be treated differently?\n\n\n\n\nI am looking for a way to be able to explain this to a lay-person and so any ideas would be much appreciated.", "record_id": "Scientific-Answer-Ranking:stats:677186", "scores": [12, 5, 7], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

Some of the comments could be answers, and are good answers. But, if you want completely non-technical, I'd use an example.

\n

Suppose you go on a diet to lose weight. You weigh yourself every day and get values say (in pounds):

\n

160 159 160 159 158 157 158 157 156

\n

Looks like you've lost a few pounds! What if we ignore the time series element?

\n

Then we have no idea if we have lost or gained weight.

\n

I think that's understandable by pretty much anyone - no calculations needed.

\n", "answer_id": 677187, "answer_text": "Some of the comments could be answers, and are good answers. But, if you want completely non-technical, I'd use an example.\n\n\n\n\nSuppose you go on a diet to lose weight. You weigh yourself every day and get values say (in pounds):\n\n\n\n\n160 159 160 159 158 157 158 157 156\n\n\n\n\nLooks like you've lost a few pounds! What if we ignore the time series element?\n\n\n\n\nThen we have no idea if we have lost or gained weight.\n\n\n\n\nI think that's understandable by pretty much anyone - no calculations needed.", "answer_url": "https://stats.stackexchange.com/a/677187", "author": "Peter Flom", "author_url": "https://stats.stackexchange.com/users/686/peter-flom", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-17T12:22:20+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677186, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Peter Flom", "profile_url": "https://stats.stackexchange.com/users/686/peter-flom", "user_type": "registered"}, "created_at": "2026-09-17T12:22:20+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "AD7F8377-51C8-4D08-9CFF-2966F61EF20D", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/AD7F8377-51C8-4D08-9CFF-2966F61EF20D/view-source"}], "score": 12, "updated_at": "2026-09-17T12:22:20+00:00"}, {"answer_html": "

Ask them, if they are more impressed if I forecast a slow-down in sales for the next year (in orange) based on what I know (the blue dots) in scenario A or B.\n\"Two

\n

If I ignore that it's a time-series and "forecast" using data including that from the future of what I'm forecasting, I'm treating a time series as any other random variable. Most people will understand that this is kind of cheating / not the problem they want to solve. In scenario B, I only get to use the sales in the past, most people will agree that this makes more sense.

\n", "answer_id": 677188, "answer_text": "Ask them, if they are more impressed if I forecast a slow-down in sales for the next year (in orange) based on what I know (the blue dots) in scenario A or B.\n[image: Two scenarios for forecasting sale, in A we know future sales, too, in B only the sales in the past; source: https://i.sstatic.net/Z4d1Pytm.png] (https://i.sstatic.net/Z4d1Pytm.png)\n\n\n\n\nIf I ignore that it's a time-series and \"forecast\" using data including that from the future of what I'm forecasting, I'm treating a time series as any other random variable. Most people will understand that this is kind of cheating / not the problem they want to solve. In scenario B, I only get to use the sales in the past, most people will agree that this makes more sense.", "answer_url": "https://stats.stackexchange.com/a/677188", "author": "Björn", "author_url": "https://stats.stackexchange.com/users/86652/bj%c3%b6rn", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-17T12:57:18+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677186, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Björn", "profile_url": "https://stats.stackexchange.com/users/86652/bj%c3%b6rn", "user_type": "registered"}, "created_at": "2026-09-17T12:57:18+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "02F3E722-3DF0-4226-B17B-0477A480D8AE", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/02F3E722-3DF0-4226-B17B-0477A480D8AE/view-source"}], "score": 5, "updated_at": "2026-09-17T12:57:18+00:00"}, {"answer_html": "

Let's say you measure the height of a river at a particular point for 5 days and get the values:

\n

6.5 ft, 6.2ft, 6.1 ft, 6.7 ft, 6.1 ft.

\n

Then I asked you to predict what the height would be on day 6. If you answer "probably a bit more than 6 feet" that makes sense...because you are intuitively assuming that the height on day 6 will be VERY SIMILAR to the height on previous days.

\n

But that is just another way of saying that we assume that the height at a given day is strongly correlated with its height on previous days. But if that's true, then the value cannot be completely "random" (or more specifically "independent") in the way that two random people selected for participation in a political poll are assumed to be.

\n

This matters if you want to do any sort of quantitative analysis, say looking at whether the height of the river is related to some other changing trend, like the crop yield of a nearby field. Most statistical models, like regression analysis, assume that the variables you are comparing are NOT correlated with previous values in this way, and if you try to use those methods on these sorts of data they could very well give you the wrong answer.

\n

In the most egregious case a regression analysis might even tell you two trends are strongly correlated even when they have NOTHING to do with each other, and this problem gets WORSE the more data you have! This happens when both series are what we call a "random walk" - where tomorrow's value is just today's value plus or minus some random variation.

\n

To prevent this sort of thing from happening, it is important to identify the characteristics of a time series before you start analyzing it: how dependent is each value on the ones before it? Is there some overall upward or downward trend? Is there a cyclical seasonal variation that repeats over some interval? Once you have figured this stuff out, you can transform the values you are analyzing so that they can be analyzed correctly.

\n", "answer_id": 677189, "answer_text": "Let's say you measure the height of a river at a particular point for 5 days and get the values:\n\n\n\n\n6.5 ft, 6.2ft, 6.1 ft, 6.7 ft, 6.1 ft.\n\n\n\n\nThen I asked you to predict what the height would be on day 6. If you answer \"probably a bit more than 6 feet\" that makes sense...because you are intuitively assuming that the height on day 6 will be VERY SIMILAR to the height on previous days.\n\n\n\n\nBut that is just another way of saying that we assume that the height at a given day is strongly correlated with its height on previous days. But if that's true, then the value cannot be completely \"random\" (or more specifically \"independent\") in the way that two random people selected for participation in a political poll are assumed to be.\n\n\n\n\nThis matters if you want to do any sort of quantitative analysis, say looking at whether the height of the river is related to some other changing trend, like the crop yield of a nearby field. Most statistical models, like regression analysis, assume that the variables you are comparing are NOT correlated with previous values in this way, and if you try to use those methods on these sorts of data they could very well give you the wrong answer.\n\n\n\n\nIn the most egregious case a regression analysis might even tell you two trends are strongly correlated even when they have NOTHING to do with each other, and this problem gets WORSE the more data you have! This happens when both series are what we call a \"random walk\" - where tomorrow's value is just today's value plus or minus some random variation.\n\n\n\n\nTo prevent this sort of thing from happening, it is important to identify the characteristics of a time series before you start analyzing it: how dependent is each value on the ones before it? Is there some overall upward or downward trend? Is there a cyclical seasonal variation that repeats over some interval? Once you have figured this stuff out, you can transform the values you are analyzing so that they can be analyzed correctly.", "answer_url": "https://stats.stackexchange.com/a/677189", "author": "Graham Wright", "author_url": "https://stats.stackexchange.com/users/291159/graham-wright", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-17T13:01:38+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677186, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Graham Wright", "profile_url": "https://stats.stackexchange.com/users/291159/graham-wright", "user_type": "registered"}, "created_at": "2026-09-17T13:01:38+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "7126F2E7-BCD0-4B9D-9F22-F3D7402743A5", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/7126F2E7-BCD0-4B9D-9F22-F3D7402743A5/view-source"}], "score": 7, "updated_at": "2026-09-17T13:01:38+00:00"}], "domain": "statistics", "external_links": ["https://i.sstatic.net/Z4d1Pytm.png"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:03.428408+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/774052c18cd9e8fa951e893347bfa3c1a85e743fc46ec4667572002cadb10cbf_1790825224163423600_0.json", "raw_sha256": "fe4dd06d3de6c0b1bb33ba88aee0ed4284118e01f76a58dcdce220a4946329b2", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "hydrologist", "question_author_url": "https://stats.stackexchange.com/users/21167/hydrologist", "question_author_user_type": "registered", "question_created_at": "2026-09-17T07:42:41+00:00", "question_html": "

I work in a field (hydrology) where many practitioners (and others) treat time series as though they were a series of random variables - that is, they ignore the structure in the series and have little understanding of why it is important. Of course I know why there is a difference and what the consequences are, but most of the explanations of that I can find are mathematical - or at least mathematical enough that they are incomprehensible to non-mathematically minded people.

\n

So, what are the simplest explanations of the difference that would be accessible to non-mathematicians and would make it immediately obvious that they need to be treated differently?

\n

I am looking for a way to be able to explain this to a lay-person and so any ideas would be much appreciated.

\n", "question_id": 677186, "question_license": "CC BY-SA 4.0", "question_score": 5, "question_text": "I work in a field (hydrology) where many practitioners (and others) treat time series as though they were a series of random variables - that is, they ignore the structure in the series and have little understanding of why it is important. Of course I know why there is a difference and what the consequences are, but most of the explanations of that I can find are mathematical - or at least mathematical enough that they are incomprehensible to non-mathematically minded people.\n\n\n\n\nSo, what are the simplest explanations of the difference that would be accessible to non-mathematicians and would make it immediately obvious that they need to be treated differently?\n\n\n\n\nI am looking for a way to be able to explain this to a lay-person and so any ideas would be much appreciated.", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "hydrologist", "profile_url": "https://stats.stackexchange.com/users/21167/hydrologist", "user_type": "registered"}, "created_at": "2026-09-17T07:42:41+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "C69CE7BA-AF0E-4293-B341-D468AABCDAE2", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/C69CE7BA-AF0E-4293-B341-D468AABCDAE2/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-09-17T15:54:01+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "FF23831A-1DEA-41EC-812E-FF18BFA375F9", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/FF23831A-1DEA-41EC-812E-FF18BFA375F9/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "hydrologist", "profile_url": "https://stats.stackexchange.com/users/21167/hydrologist", "user_type": "registered"}, "created_at": "2026-09-18T09:06:15+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "64F3D18E-D094-414A-B349-447B0185577D", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/64F3D18E-D094-414A-B349-447B0185577D/view-source"}], "source_site": "stats", "source_url": "https://stats.stackexchange.com/questions/677186/why-is-a-time-series-different-from-a-set-of-random-variables", "split": "train", "split_group": "d15a453ac15794d24e0854041879a6d11e5869b41249eb87348e9bc1b4de3d8f", "tags": ["time-series", "random-variable", "communication"], "thread_id": "stats:677186", "title": "Why is a time series different from a set of random variables?"}} {"accepted_status": [false, true], "candidate_answers": [{"answer_html": "

First of all, there should be an assortment of threads on this site that can help you with partial / semipartial correlation coefficients vis a vis multiple regression. This might be a good place to start: https://stats.stackexchange.com/a/76819/97844. In general, you can search questions tagged correlation.

\n

Unfortunately, I don't think you'll be able to derive the raw product-moment (Pearson) correlation between $Y$ and $X_1$ from that information. Though you can write down the equation in several different ways (depending upon how the computation is carried out), you're going to need the actual data points. For example, computing from a sample, the computational formula that I used to teach to my undergrad students is:

\n

$$\nr_{xy}={\\frac {\\sum _{i}x_{i}y_{i}-n{\\bar {x}}{\\bar {y}}}{{\\sqrt {\\sum _{i}x_{i}^{2}-n{\\bar {x}}^{2}}}~{\\sqrt {\\sum _{i}y_{i}^{2}-n{\\bar {y}}^{2}}}}}\n$$

\n

So at the very least, in addition to the means ($\\bar{x}$ and $\\bar{y}$) you'd need the actual products between each $x$ and $y$ for all pairs. The denominators are the square roots of the individual $SS$ for each variable, which you might be able to work out from descriptive statistics, but again, unless you have the actual data-points, computing the numerator will be impossible.

\n

In addition, it's not clear of what use the raw correlation would be, especially if the (linear) relationship between $X_2$ and $Y$ is notable. Think of it this way, looking at the data in a two dimensional space (just $X_1$ and $Y$) can be misleading in the sense that the multiple regression model is a model of the data in a higher-dimensional space. In that space, the original linear relationship may look much different because now, a second dimension is at play, and, intuitively, you're looking at the data through a completely different lens. If the two variables are independent, then this extra complexity won't alter the raw correlation, but the main reason we use multiple regression is because we often deal with two variables that are correlated, or with an $X$ and $Y$ that have a marginal correlation, but are conditionally independent.

\n

So the bottom line is that I don't know that I would recommend trying to do what you want to do.

\n", "answer_id": 677195, "answer_text": "First of all, there should be an assortment of threads on this site that can help you with partial / semipartial correlation coefficients vis a vis multiple regression. This might be a good place to start: https://stats.stackexchange.com/a/76819/97844 (https://stats.stackexchange.com/a/76819/97844). In general, you can search questions tagged correlation (/questions/tagged/correlation).\n\n\n\n\nUnfortunately, I don't think you'll be able to derive the raw product-moment (Pearson) correlation between $Y$ and $X_1$ from that information. Though you can write down the equation in several different ways (https://en.wikipedia.org/wiki/Pearson_correlation_coefficient#Definition) (depending upon how the computation is carried out), you're going to need the actual data points. For example, computing from a sample, the computational formula that I used to teach to my undergrad students is:\n\n\n\n\n$$\nr_{xy}={\\frac {\\sum _{i}x_{i}y_{i}-n{\\bar {x}}{\\bar {y}}}{{\\sqrt {\\sum _{i}x_{i}^{2}-n{\\bar {x}}^{2}}}~{\\sqrt {\\sum _{i}y_{i}^{2}-n{\\bar {y}}^{2}}}}}\n$$\n\n\n\n\nSo at the very least, in addition to the means ($\\bar{x}$ and $\\bar{y}$) you'd need the actual products between each $x$ and $y$ for all pairs. The denominators are the square roots of the individual $SS$ for each variable, which you might be able to work out from descriptive statistics, but again, unless you have the actual data-points, computing the numerator will be impossible.\n\n\n\n\nIn addition, it's not clear of what use the raw correlation would be, especially if the (linear) relationship between $X_2$ and $Y$ is notable. Think of it this way, looking at the data in a two dimensional space (just $X_1$ and $Y$) can be misleading in the sense that the multiple regression model is a model of the data in a higher-dimensional space. In that space, the original linear relationship may look much different because now, a second dimension is at play, and, intuitively, you're looking at the data through a completely different lens. If the two variables are independent, then this extra complexity won't alter the raw correlation, but the main reason we use multiple regression is because we often deal with two variables that are correlated, or with an $X$ and $Y$ that have a marginal correlation, but are conditionally independent.\n\n\n\n\nSo the bottom line is that I don't know that I would recommend trying to do what you want to do.", "answer_url": "https://stats.stackexchange.com/a/677195", "author": "Rick Hass", "author_url": "https://stats.stackexchange.com/users/97844/rick-hass", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-17T19:33:22+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677193, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Rick Hass", "profile_url": "https://stats.stackexchange.com/users/97844/rick-hass", "user_type": "registered"}, "created_at": "2026-09-17T19:33:22+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "8823AFBC-99DE-491B-909B-E1B60CC0F1BD", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/8823AFBC-99DE-491B-909B-E1B60CC0F1BD/view-source"}], "score": 6, "updated_at": "2026-09-17T19:33:22+00:00"}, {"answer_html": "

I don't think you can recover the bivariate correlation $r(y,x_1)$ from the unstandardized coefficients, unless I am missing something.

\n

We can get the standardized $\\beta$s:

\n

$$\\beta_1^* = b_1 \\cdot \\frac{SD_{x1}}{SD_y}$$

\n

The we have:

\n

$$\\begin{pmatrix} 1 & r_{12} \\\\ r_{12} & 1 \\end{pmatrix} \\begin{pmatrix} \\beta_1^* \\\\ \\beta_2^* \\end{pmatrix} = \\begin{pmatrix} r_{y1} \\\\ r_{y2} \\end{pmatrix}$$

\n

If we solve this for $r_{y1}$:

\n

$$r_{y1} = \\beta_1^* + \\beta_2^* r_{12}$$

\n

We have $\\beta_1^*$ and $\\beta_2^*$ but not $r_{12}$, so the system is underdetermined. Without $r_{12}$ we cannot recover $r_{y1}$.

\n

You can recover coefficient of determination $R^2$:

\n

$$R^2 = \\beta_1^* r_{y1} + \\beta_2^* r_{y2}$$

\n

and if the paper reports $R^2$, that gives us one additional equation but with two unknowns ($r_{y1}$ and $r_{y2}$).

\n

If the paper describes the predictors as weakly correlated, we can assume $r_{12} \\approx 0$ getting $r_{y1} \\approx \\beta_1^*$, but you cannot recover the exact value without additional information.

\n", "answer_id": 677196, "answer_text": "I don't think you can recover the bivariate correlation $r(y,x_1)$ from the unstandardized coefficients, unless I am missing something.\n\n\n\n\nWe can get the standardized $\\beta$s:\n\n\n\n\n$$\\beta_1^* = b_1 \\cdot \\frac{SD_{x1}}{SD_y}$$\n\n\n\n\nThe we have:\n\n\n\n\n$$\\begin{pmatrix} 1 & r_{12} \\\\ r_{12} & 1 \\end{pmatrix} \\begin{pmatrix} \\beta_1^* \\\\ \\beta_2^* \\end{pmatrix} = \\begin{pmatrix} r_{y1} \\\\ r_{y2} \\end{pmatrix}$$\n\n\n\n\nIf we solve this for $r_{y1}$:\n\n\n\n\n$$r_{y1} = \\beta_1^* + \\beta_2^* r_{12}$$\n\n\n\n\nWe have $\\beta_1^*$ and $\\beta_2^*$ but not $r_{12}$, so the system is underdetermined. Without $r_{12}$ we cannot recover $r_{y1}$.\n\n\n\n\nYou can recover coefficient of determination $R^2$:\n\n\n\n\n$$R^2 = \\beta_1^* r_{y1} + \\beta_2^* r_{y2}$$\n\n\n\n\nand if the paper reports $R^2$, that gives us one additional equation but with two unknowns ($r_{y1}$ and $r_{y2}$).\n\n\n\n\nIf the paper describes the predictors as weakly correlated, we can assume $r_{12} \\approx 0$ getting $r_{y1} \\approx \\beta_1^*$, but you cannot recover the exact value without additional information.", "answer_url": "https://stats.stackexchange.com/a/677196", "author": "M--", "author_url": "https://stats.stackexchange.com/users/154449/m", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-17T19:43:31+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677193, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "M--", "profile_url": "https://stats.stackexchange.com/users/154449/m", "user_type": "registered"}, "created_at": "2026-09-17T19:43:31+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "B08F8332-9826-45E3-8DC8-649B4E616404", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/B08F8332-9826-45E3-8DC8-649B4E616404/view-source"}], "score": 8, "updated_at": "2026-09-17T19:43:31+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I am trying to derive (or at least estimate) the correlation coefficient from a paper that only reports the multivariate betas.\n\n\n\n\nFor example I have the equation $y \\sim b_1x_1 + b_2x_2$. I would like to know the correlation coefficient $r$ between $y$ and $x_1$.\n\n\n\n\nUnfortunately the paper does not report the correlation between $x_1$ and $x_2$ or $y$ and $x_2$, but does report the means and standard deviations.\n\n\n\n\nI was reading that the standardized beta is similar to the semi-partial correlation coefficient but am having trouble moving forward from there.", "record_id": "Scientific-Answer-Ranking:stats:677193", "scores": [6, 8], "split": "train", "thread": {"accepted_answer_id": 677196, "answers": [{"answer_html": "

First of all, there should be an assortment of threads on this site that can help you with partial / semipartial correlation coefficients vis a vis multiple regression. This might be a good place to start: https://stats.stackexchange.com/a/76819/97844. In general, you can search questions tagged correlation.

\n

Unfortunately, I don't think you'll be able to derive the raw product-moment (Pearson) correlation between $Y$ and $X_1$ from that information. Though you can write down the equation in several different ways (depending upon how the computation is carried out), you're going to need the actual data points. For example, computing from a sample, the computational formula that I used to teach to my undergrad students is:

\n

$$\nr_{xy}={\\frac {\\sum _{i}x_{i}y_{i}-n{\\bar {x}}{\\bar {y}}}{{\\sqrt {\\sum _{i}x_{i}^{2}-n{\\bar {x}}^{2}}}~{\\sqrt {\\sum _{i}y_{i}^{2}-n{\\bar {y}}^{2}}}}}\n$$

\n

So at the very least, in addition to the means ($\\bar{x}$ and $\\bar{y}$) you'd need the actual products between each $x$ and $y$ for all pairs. The denominators are the square roots of the individual $SS$ for each variable, which you might be able to work out from descriptive statistics, but again, unless you have the actual data-points, computing the numerator will be impossible.

\n

In addition, it's not clear of what use the raw correlation would be, especially if the (linear) relationship between $X_2$ and $Y$ is notable. Think of it this way, looking at the data in a two dimensional space (just $X_1$ and $Y$) can be misleading in the sense that the multiple regression model is a model of the data in a higher-dimensional space. In that space, the original linear relationship may look much different because now, a second dimension is at play, and, intuitively, you're looking at the data through a completely different lens. If the two variables are independent, then this extra complexity won't alter the raw correlation, but the main reason we use multiple regression is because we often deal with two variables that are correlated, or with an $X$ and $Y$ that have a marginal correlation, but are conditionally independent.

\n

So the bottom line is that I don't know that I would recommend trying to do what you want to do.

\n", "answer_id": 677195, "answer_text": "First of all, there should be an assortment of threads on this site that can help you with partial / semipartial correlation coefficients vis a vis multiple regression. This might be a good place to start: https://stats.stackexchange.com/a/76819/97844 (https://stats.stackexchange.com/a/76819/97844). In general, you can search questions tagged correlation (/questions/tagged/correlation).\n\n\n\n\nUnfortunately, I don't think you'll be able to derive the raw product-moment (Pearson) correlation between $Y$ and $X_1$ from that information. Though you can write down the equation in several different ways (https://en.wikipedia.org/wiki/Pearson_correlation_coefficient#Definition) (depending upon how the computation is carried out), you're going to need the actual data points. For example, computing from a sample, the computational formula that I used to teach to my undergrad students is:\n\n\n\n\n$$\nr_{xy}={\\frac {\\sum _{i}x_{i}y_{i}-n{\\bar {x}}{\\bar {y}}}{{\\sqrt {\\sum _{i}x_{i}^{2}-n{\\bar {x}}^{2}}}~{\\sqrt {\\sum _{i}y_{i}^{2}-n{\\bar {y}}^{2}}}}}\n$$\n\n\n\n\nSo at the very least, in addition to the means ($\\bar{x}$ and $\\bar{y}$) you'd need the actual products between each $x$ and $y$ for all pairs. The denominators are the square roots of the individual $SS$ for each variable, which you might be able to work out from descriptive statistics, but again, unless you have the actual data-points, computing the numerator will be impossible.\n\n\n\n\nIn addition, it's not clear of what use the raw correlation would be, especially if the (linear) relationship between $X_2$ and $Y$ is notable. Think of it this way, looking at the data in a two dimensional space (just $X_1$ and $Y$) can be misleading in the sense that the multiple regression model is a model of the data in a higher-dimensional space. In that space, the original linear relationship may look much different because now, a second dimension is at play, and, intuitively, you're looking at the data through a completely different lens. If the two variables are independent, then this extra complexity won't alter the raw correlation, but the main reason we use multiple regression is because we often deal with two variables that are correlated, or with an $X$ and $Y$ that have a marginal correlation, but are conditionally independent.\n\n\n\n\nSo the bottom line is that I don't know that I would recommend trying to do what you want to do.", "answer_url": "https://stats.stackexchange.com/a/677195", "author": "Rick Hass", "author_url": "https://stats.stackexchange.com/users/97844/rick-hass", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-17T19:33:22+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677193, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Rick Hass", "profile_url": "https://stats.stackexchange.com/users/97844/rick-hass", "user_type": "registered"}, "created_at": "2026-09-17T19:33:22+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "8823AFBC-99DE-491B-909B-E1B60CC0F1BD", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/8823AFBC-99DE-491B-909B-E1B60CC0F1BD/view-source"}], "score": 6, "updated_at": "2026-09-17T19:33:22+00:00"}, {"answer_html": "

I don't think you can recover the bivariate correlation $r(y,x_1)$ from the unstandardized coefficients, unless I am missing something.

\n

We can get the standardized $\\beta$s:

\n

$$\\beta_1^* = b_1 \\cdot \\frac{SD_{x1}}{SD_y}$$

\n

The we have:

\n

$$\\begin{pmatrix} 1 & r_{12} \\\\ r_{12} & 1 \\end{pmatrix} \\begin{pmatrix} \\beta_1^* \\\\ \\beta_2^* \\end{pmatrix} = \\begin{pmatrix} r_{y1} \\\\ r_{y2} \\end{pmatrix}$$

\n

If we solve this for $r_{y1}$:

\n

$$r_{y1} = \\beta_1^* + \\beta_2^* r_{12}$$

\n

We have $\\beta_1^*$ and $\\beta_2^*$ but not $r_{12}$, so the system is underdetermined. Without $r_{12}$ we cannot recover $r_{y1}$.

\n

You can recover coefficient of determination $R^2$:

\n

$$R^2 = \\beta_1^* r_{y1} + \\beta_2^* r_{y2}$$

\n

and if the paper reports $R^2$, that gives us one additional equation but with two unknowns ($r_{y1}$ and $r_{y2}$).

\n

If the paper describes the predictors as weakly correlated, we can assume $r_{12} \\approx 0$ getting $r_{y1} \\approx \\beta_1^*$, but you cannot recover the exact value without additional information.

\n", "answer_id": 677196, "answer_text": "I don't think you can recover the bivariate correlation $r(y,x_1)$ from the unstandardized coefficients, unless I am missing something.\n\n\n\n\nWe can get the standardized $\\beta$s:\n\n\n\n\n$$\\beta_1^* = b_1 \\cdot \\frac{SD_{x1}}{SD_y}$$\n\n\n\n\nThe we have:\n\n\n\n\n$$\\begin{pmatrix} 1 & r_{12} \\\\ r_{12} & 1 \\end{pmatrix} \\begin{pmatrix} \\beta_1^* \\\\ \\beta_2^* \\end{pmatrix} = \\begin{pmatrix} r_{y1} \\\\ r_{y2} \\end{pmatrix}$$\n\n\n\n\nIf we solve this for $r_{y1}$:\n\n\n\n\n$$r_{y1} = \\beta_1^* + \\beta_2^* r_{12}$$\n\n\n\n\nWe have $\\beta_1^*$ and $\\beta_2^*$ but not $r_{12}$, so the system is underdetermined. Without $r_{12}$ we cannot recover $r_{y1}$.\n\n\n\n\nYou can recover coefficient of determination $R^2$:\n\n\n\n\n$$R^2 = \\beta_1^* r_{y1} + \\beta_2^* r_{y2}$$\n\n\n\n\nand if the paper reports $R^2$, that gives us one additional equation but with two unknowns ($r_{y1}$ and $r_{y2}$).\n\n\n\n\nIf the paper describes the predictors as weakly correlated, we can assume $r_{12} \\approx 0$ getting $r_{y1} \\approx \\beta_1^*$, but you cannot recover the exact value without additional information.", "answer_url": "https://stats.stackexchange.com/a/677196", "author": "M--", "author_url": "https://stats.stackexchange.com/users/154449/m", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-17T19:43:31+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677193, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "M--", "profile_url": "https://stats.stackexchange.com/users/154449/m", "user_type": "registered"}, "created_at": "2026-09-17T19:43:31+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "B08F8332-9826-45E3-8DC8-649B4E616404", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/B08F8332-9826-45E3-8DC8-649B4E616404/view-source"}], "score": 8, "updated_at": "2026-09-17T19:43:31+00:00"}], "domain": "statistics", "external_links": ["https://en.wikipedia.org/wiki/Pearson_correlation_coefficient#Definition"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:03.428408+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/774052c18cd9e8fa951e893347bfa3c1a85e743fc46ec4667572002cadb10cbf_1790825224163423600_0.json", "raw_sha256": "fe4dd06d3de6c0b1bb33ba88aee0ed4284118e01f76a58dcdce220a4946329b2", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Hank Lin", "question_author_url": "https://stats.stackexchange.com/users/212964/hank-lin", "question_author_user_type": "registered", "question_created_at": "2026-09-17T18:51:23+00:00", "question_html": "

I am trying to derive (or at least estimate) the correlation coefficient from a paper that only reports the multivariate betas.

\n

For example I have the equation $y \\sim b_1x_1 + b_2x_2$. I would like to know the correlation coefficient $r$ between $y$ and $x_1$.

\n

Unfortunately the paper does not report the correlation between $x_1$ and $x_2$ or $y$ and $x_2$, but does report the means and standard deviations.

\n

I was reading that the standardized beta is similar to the semi-partial correlation coefficient but am having trouble moving forward from there.

\n", "question_id": 677193, "question_license": "CC BY-SA 4.0", "question_score": 6, "question_text": "I am trying to derive (or at least estimate) the correlation coefficient from a paper that only reports the multivariate betas.\n\n\n\n\nFor example I have the equation $y \\sim b_1x_1 + b_2x_2$. I would like to know the correlation coefficient $r$ between $y$ and $x_1$.\n\n\n\n\nUnfortunately the paper does not report the correlation between $x_1$ and $x_2$ or $y$ and $x_2$, but does report the means and standard deviations.\n\n\n\n\nI was reading that the standardized beta is similar to the semi-partial correlation coefficient but am having trouble moving forward from there.", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Hank Lin", "profile_url": "https://stats.stackexchange.com/users/212964/hank-lin", "user_type": "registered"}, "created_at": "2026-09-17T18:51:23+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "53C26E13-7399-4761-9402-23DBDAE89FF5", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/53C26E13-7399-4761-9402-23DBDAE89FF5/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "M--", "profile_url": "https://stats.stackexchange.com/users/154449/m", "user_type": "registered"}, "created_at": "2026-09-17T19:28:12+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "D07E9DCC-2B9A-4798-BD2D-1CB9AB439808", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/D07E9DCC-2B9A-4798-BD2D-1CB9AB439808/view-source"}, {"content_license": null, "contributor": {"display_name": "kjetil b halvorsen", "profile_url": "https://stats.stackexchange.com/users/11887/kjetil-b-halvorsen", "user_type": "moderator"}, "created_at": "2026-09-17T19:42:47+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "2EFF21D0-AFBC-4342-8F34-6916D092B853", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/2EFF21D0-AFBC-4342-8F34-6916D092B853/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-09-18T02:54:36+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "2BBD8FE2-9891-411D-93B2-B1EAD3DA4F49", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/2BBD8FE2-9891-411D-93B2-B1EAD3DA4F49/view-source"}], "source_site": "stats", "source_url": "https://stats.stackexchange.com/questions/677193/how-to-derive-the-correlation-coefficient-from-the-coefficients-in-multiple-line", "split": "train", "split_group": "7abcadccd1907fa3e7584381c8e2d8ce78f6a7c5184e86eeda5e0c027d51780a", "tags": ["correlation", "multiple-regression", "partial-correlation"], "thread_id": "stats:677193", "title": "How to derive the correlation coefficient from the coefficients in multiple linear regression?"}} {"accepted_status": [false, false], "candidate_answers": [{"answer_html": "

If the ratio of the means is not equal to about 100:36, then the ratings are probably not simply different scalings of the same underlying distribution. And if the ratio of means is the same as 100:36, you probably wouldn't be asking, and anyway you still can't be sure of much else. You need to know more about the data. For example, maybe you know these are counts of positive answers to 100 or 36 questions. Or something else that would let you make some approximate assumptions like how much of the variance within a score can be attribute to test noise. Sounds like you have an impossible task, unless you can convert both datasets back to a model of an underlying distribution. But if you just plot histograms of the data, maybe you can make a graphic comparison that makes it obvious if the spreads are very different, or makes it clear that they're not very different, without having to make a hard decision based on standard deviations.

\n

If you just want an answer to the original question of "which makes more sense", I'd say divide by the means. But then wouldn't some kind of comparison of means be a better thing to go after?

\n", "answer_id": 677200, "answer_text": "If the ratio of the means is not equal to about 100:36, then the ratings are probably not simply different scalings of the same underlying distribution. And if the ratio of means is the same as 100:36, you probably wouldn't be asking, and anyway you still can't be sure of much else. You need to know more about the data. For example, maybe you know these are counts of positive answers to 100 or 36 questions. Or something else that would let you make some approximate assumptions like how much of the variance within a score can be attribute to test noise. Sounds like you have an impossible task, unless you can convert both datasets back to a model of an underlying distribution. But if you just plot histograms of the data, maybe you can make a graphic comparison that makes it obvious if the spreads are very different, or makes it clear that they're not very different, without having to make a hard decision based on standard deviations.\n\n\n\n\nIf you just want an answer to the original question of \"which makes more sense\", I'd say divide by the means. But then wouldn't some kind of comparison of means be a better thing to go after?", "answer_url": "https://stats.stackexchange.com/a/677200", "author": "Richard Lyon", "author_url": "https://stats.stackexchange.com/users/516789/richard-lyon", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-18T02:11:37+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677194, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Richard Lyon", "profile_url": "https://stats.stackexchange.com/users/516789/richard-lyon", "user_type": "registered"}, "created_at": "2026-09-18T02:11:37+00:00", "raw_file": "raw/codex_api_v1/13b5f879587b71b34c0837bee317816dcd540d0ad5983f88cf56c19d10104c79_1790825261079646600_0.json", "raw_sha256": "0a63637f2455a28a1e691dd3090d34ef9975e6c8bdc2c5c883414d7215eb5972", "revision_guid": "98536AC1-331C-41B5-919F-C5CA68DA8CF4", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/98536AC1-331C-41B5-919F-C5CA68DA8CF4/view-source"}], "score": 5, "updated_at": "2026-09-18T02:11:37+00:00"}, {"answer_html": "

The "classic" way to compare the variability of 2 sets of measurements taken on different scales is to use the CV (Coefficient of Variation (Variability), which is nothing more than $\\frac {sd} {\\bar x}$). There are even statistical tests for comparing CVs (e.g. Forkman's Test), which (obviously?) have attached assumptions.

\n

Now this works great for say, comparing the variability of highway lengths in kilometers with the variability of city street lengths taken in meters. Or even the variability of bus lengths, taken in feet, with the variability of motorcycle lengths, taken in inches (because the CV is unitless). But it will not work for comparing temperatures taken in degrees Celsius with temperatures taken in degrees Fahrenheit, or kelvin (because it is not only the scale which has changed, it is also the location, the meaning of $0$).

\n

Note that the CV is useful when the mean and sd are somehow independent parameters of the underlying distribution. E.g., for exponentially distributed data, the CV is always equal to 1 (?!). In cases when they are not independent, then directly comparing the parameters (e.g. $\\lambda$ for exponentials) makes more sense (or proportions for counts, etc...).

\n

In all the above examples, we are comparing apples with apples, just measured on different scales (with same origin).
\nIt is absolutely not clear that this is your case: you may be trying to compare apples with oranges. Do the two scales really measure the same thing? They may both say "patient satisfaction", but what "instrument(s?)" are they using? If the instruments are different (most likely?), then does comparing them even make sense? Would comparing kilometers of highway to kelvin temperatures make sense?
\nAlso, what does 100 mean? A single score on a Visual Analog Scale (VAS)? Or a sum of an unknown number of Likert scores? Or ??? What is 36? A count of positive answers on 36 questions? A sum of a different unknown number of Likert scores? Or ?? And does $0$ mean the same in the two cases? For the sum of Likert scores, there is not even a 0 (Likert scores are typically 1-5). So the 2 scales may not even have a $0$, or the same $0$. How about the questions? Were they the exact same, just scored differently, or were they different?
\nLast such scores beg the question of whether the mean and sd are even meaningful statistics: on the VAS, or counts, they would/could be. On a sum of Likert scores, many (myself included) would argue that they are not.

\n

So, while technically you could compare the CVs, w/o much more details about the 2 sets of measurements (which are in the 2 papers: maybe provide links to these 2 papers?), it is very hard to say whether this comparison would be useful.

\n", "answer_id": 677216, "answer_text": "The \"classic\" way to compare the variability of 2 sets of measurements taken on different scales is to use the CV (Coefficient of Variation (Variability), which is nothing more than $\\frac {sd} {\\bar x}$). There are even statistical tests for comparing CVs (e.g. Forkman's Test), which (obviously?) have attached assumptions.\n\n\n\n\nNow this works great for say, comparing the variability of highway lengths in kilometers with the variability of city street lengths taken in meters. Or even the variability of bus lengths, taken in feet, with the variability of motorcycle lengths, taken in inches (because the CV is unitless). But it will not work for comparing temperatures taken in degrees Celsius with temperatures taken in degrees Fahrenheit, or kelvin (because it is not only the scale which has changed, it is also the location, the meaning of $0$).\n\n\n\n\nNote that the CV is useful when the mean and sd are somehow independent parameters of the underlying distribution. E.g., for exponentially distributed data, the CV is always equal to 1 (?!). In cases when they are not independent, then directly comparing the parameters (e.g. $\\lambda$ for exponentials) makes more sense (or proportions for counts, etc...).\n\n\n\n\nIn all the above examples, we are comparing apples with apples, just measured on different scales (with same origin).\n\nIt is absolutely not clear that this is your case: you may be trying to compare apples with oranges. Do the two scales really measure the same thing? They may both say \"patient satisfaction\", but what \"instrument(s?)\" are they using? If the instruments are different (most likely?), then does comparing them even make sense? Would comparing kilometers of highway to kelvin temperatures make sense?\n\nAlso, what does 100 mean? A single score on a Visual Analog Scale (VAS)? Or a sum of an unknown number of Likert scores? Or ??? What is 36? A count of positive answers on 36 questions? A sum of a different unknown number of Likert scores? Or ?? And does $0$ mean the same in the two cases? For the sum of Likert scores, there is not even a 0 (Likert scores are typically 1-5). So the 2 scales may not even have a $0$, or the same $0$. How about the questions? Were they the exact same, just scored differently, or were they different?\n\nLast such scores beg the question of whether the mean and sd are even meaningful statistics: on the VAS, or counts, they would/could be. On a sum of Likert scores, many (myself included) would argue that they are not.\n\n\n\n\nSo, while technically you could compare the CVs, w/o much more details about the 2 sets of measurements (which are in the 2 papers: maybe provide links to these 2 papers?), it is very hard to say whether this comparison would be useful.", "answer_url": "https://stats.stackexchange.com/a/677216", "author": "jginestet", "author_url": "https://stats.stackexchange.com/users/380096/jginestet", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-19T17:06:39+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677194, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-19T17:06:39+00:00", "raw_file": "raw/codex_api_v1/13b5f879587b71b34c0837bee317816dcd540d0ad5983f88cf56c19d10104c79_1790825261079646600_0.json", "raw_sha256": "0a63637f2455a28a1e691dd3090d34ef9975e6c8bdc2c5c883414d7215eb5972", "revision_guid": "DCF750BD-C31C-4D23-B59A-8F1B46106E82", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/DCF750BD-C31C-4D23-B59A-8F1B46106E82/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-19T17:12:27+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "76BA20A6-0C8C-4C0D-9DBC-8DD8CE8823AF", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/76BA20A6-0C8C-4C0D-9DBC-8DD8CE8823AF/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nick Cox", "profile_url": "https://stats.stackexchange.com/users/22047/nick-cox", "user_type": "registered"}, "created_at": "2026-09-19T18:03:25+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "D1BF2DDF-7230-4CA9-919F-8A5E8FCE31DD", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/D1BF2DDF-7230-4CA9-919F-8A5E8FCE31DD/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-19T20:16:52+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "D6767CF1-3AA2-465D-8C60-05A8D265C6CB", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/D6767CF1-3AA2-465D-8C60-05A8D265C6CB/view-source"}], "score": 4, "updated_at": "2026-09-19T20:16:52+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I am trying to compare the standard deviations of two samples which measure patient satisfaction on different scales. Scale 1 has a potential range from 0 to 100. Scale 2 has a potential range from 0 to 36.\n\n\n\n\nIf SD1 = A and SD2 = B, does it make sense to compare them by dividing by the potential range? Ie A / 100 vs B / 36?\n\n\n\n\nI was also reading about the coefficient of variation where instead you divide by the mean. I am not sure which makes more sense in my case.", "record_id": "Scientific-Answer-Ranking:stats:677194", "scores": [5, 4], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

If the ratio of the means is not equal to about 100:36, then the ratings are probably not simply different scalings of the same underlying distribution. And if the ratio of means is the same as 100:36, you probably wouldn't be asking, and anyway you still can't be sure of much else. You need to know more about the data. For example, maybe you know these are counts of positive answers to 100 or 36 questions. Or something else that would let you make some approximate assumptions like how much of the variance within a score can be attribute to test noise. Sounds like you have an impossible task, unless you can convert both datasets back to a model of an underlying distribution. But if you just plot histograms of the data, maybe you can make a graphic comparison that makes it obvious if the spreads are very different, or makes it clear that they're not very different, without having to make a hard decision based on standard deviations.

\n

If you just want an answer to the original question of "which makes more sense", I'd say divide by the means. But then wouldn't some kind of comparison of means be a better thing to go after?

\n", "answer_id": 677200, "answer_text": "If the ratio of the means is not equal to about 100:36, then the ratings are probably not simply different scalings of the same underlying distribution. And if the ratio of means is the same as 100:36, you probably wouldn't be asking, and anyway you still can't be sure of much else. You need to know more about the data. For example, maybe you know these are counts of positive answers to 100 or 36 questions. Or something else that would let you make some approximate assumptions like how much of the variance within a score can be attribute to test noise. Sounds like you have an impossible task, unless you can convert both datasets back to a model of an underlying distribution. But if you just plot histograms of the data, maybe you can make a graphic comparison that makes it obvious if the spreads are very different, or makes it clear that they're not very different, without having to make a hard decision based on standard deviations.\n\n\n\n\nIf you just want an answer to the original question of \"which makes more sense\", I'd say divide by the means. But then wouldn't some kind of comparison of means be a better thing to go after?", "answer_url": "https://stats.stackexchange.com/a/677200", "author": "Richard Lyon", "author_url": "https://stats.stackexchange.com/users/516789/richard-lyon", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-18T02:11:37+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677194, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Richard Lyon", "profile_url": "https://stats.stackexchange.com/users/516789/richard-lyon", "user_type": "registered"}, "created_at": "2026-09-18T02:11:37+00:00", "raw_file": "raw/codex_api_v1/13b5f879587b71b34c0837bee317816dcd540d0ad5983f88cf56c19d10104c79_1790825261079646600_0.json", "raw_sha256": "0a63637f2455a28a1e691dd3090d34ef9975e6c8bdc2c5c883414d7215eb5972", "revision_guid": "98536AC1-331C-41B5-919F-C5CA68DA8CF4", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/98536AC1-331C-41B5-919F-C5CA68DA8CF4/view-source"}], "score": 5, "updated_at": "2026-09-18T02:11:37+00:00"}, {"answer_html": "

The "classic" way to compare the variability of 2 sets of measurements taken on different scales is to use the CV (Coefficient of Variation (Variability), which is nothing more than $\\frac {sd} {\\bar x}$). There are even statistical tests for comparing CVs (e.g. Forkman's Test), which (obviously?) have attached assumptions.

\n

Now this works great for say, comparing the variability of highway lengths in kilometers with the variability of city street lengths taken in meters. Or even the variability of bus lengths, taken in feet, with the variability of motorcycle lengths, taken in inches (because the CV is unitless). But it will not work for comparing temperatures taken in degrees Celsius with temperatures taken in degrees Fahrenheit, or kelvin (because it is not only the scale which has changed, it is also the location, the meaning of $0$).

\n

Note that the CV is useful when the mean and sd are somehow independent parameters of the underlying distribution. E.g., for exponentially distributed data, the CV is always equal to 1 (?!). In cases when they are not independent, then directly comparing the parameters (e.g. $\\lambda$ for exponentials) makes more sense (or proportions for counts, etc...).

\n

In all the above examples, we are comparing apples with apples, just measured on different scales (with same origin).
\nIt is absolutely not clear that this is your case: you may be trying to compare apples with oranges. Do the two scales really measure the same thing? They may both say "patient satisfaction", but what "instrument(s?)" are they using? If the instruments are different (most likely?), then does comparing them even make sense? Would comparing kilometers of highway to kelvin temperatures make sense?
\nAlso, what does 100 mean? A single score on a Visual Analog Scale (VAS)? Or a sum of an unknown number of Likert scores? Or ??? What is 36? A count of positive answers on 36 questions? A sum of a different unknown number of Likert scores? Or ?? And does $0$ mean the same in the two cases? For the sum of Likert scores, there is not even a 0 (Likert scores are typically 1-5). So the 2 scales may not even have a $0$, or the same $0$. How about the questions? Were they the exact same, just scored differently, or were they different?
\nLast such scores beg the question of whether the mean and sd are even meaningful statistics: on the VAS, or counts, they would/could be. On a sum of Likert scores, many (myself included) would argue that they are not.

\n

So, while technically you could compare the CVs, w/o much more details about the 2 sets of measurements (which are in the 2 papers: maybe provide links to these 2 papers?), it is very hard to say whether this comparison would be useful.

\n", "answer_id": 677216, "answer_text": "The \"classic\" way to compare the variability of 2 sets of measurements taken on different scales is to use the CV (Coefficient of Variation (Variability), which is nothing more than $\\frac {sd} {\\bar x}$). There are even statistical tests for comparing CVs (e.g. Forkman's Test), which (obviously?) have attached assumptions.\n\n\n\n\nNow this works great for say, comparing the variability of highway lengths in kilometers with the variability of city street lengths taken in meters. Or even the variability of bus lengths, taken in feet, with the variability of motorcycle lengths, taken in inches (because the CV is unitless). But it will not work for comparing temperatures taken in degrees Celsius with temperatures taken in degrees Fahrenheit, or kelvin (because it is not only the scale which has changed, it is also the location, the meaning of $0$).\n\n\n\n\nNote that the CV is useful when the mean and sd are somehow independent parameters of the underlying distribution. E.g., for exponentially distributed data, the CV is always equal to 1 (?!). In cases when they are not independent, then directly comparing the parameters (e.g. $\\lambda$ for exponentials) makes more sense (or proportions for counts, etc...).\n\n\n\n\nIn all the above examples, we are comparing apples with apples, just measured on different scales (with same origin).\n\nIt is absolutely not clear that this is your case: you may be trying to compare apples with oranges. Do the two scales really measure the same thing? They may both say \"patient satisfaction\", but what \"instrument(s?)\" are they using? If the instruments are different (most likely?), then does comparing them even make sense? Would comparing kilometers of highway to kelvin temperatures make sense?\n\nAlso, what does 100 mean? A single score on a Visual Analog Scale (VAS)? Or a sum of an unknown number of Likert scores? Or ??? What is 36? A count of positive answers on 36 questions? A sum of a different unknown number of Likert scores? Or ?? And does $0$ mean the same in the two cases? For the sum of Likert scores, there is not even a 0 (Likert scores are typically 1-5). So the 2 scales may not even have a $0$, or the same $0$. How about the questions? Were they the exact same, just scored differently, or were they different?\n\nLast such scores beg the question of whether the mean and sd are even meaningful statistics: on the VAS, or counts, they would/could be. On a sum of Likert scores, many (myself included) would argue that they are not.\n\n\n\n\nSo, while technically you could compare the CVs, w/o much more details about the 2 sets of measurements (which are in the 2 papers: maybe provide links to these 2 papers?), it is very hard to say whether this comparison would be useful.", "answer_url": "https://stats.stackexchange.com/a/677216", "author": "jginestet", "author_url": "https://stats.stackexchange.com/users/380096/jginestet", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-19T17:06:39+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677194, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-19T17:06:39+00:00", "raw_file": "raw/codex_api_v1/13b5f879587b71b34c0837bee317816dcd540d0ad5983f88cf56c19d10104c79_1790825261079646600_0.json", "raw_sha256": "0a63637f2455a28a1e691dd3090d34ef9975e6c8bdc2c5c883414d7215eb5972", "revision_guid": "DCF750BD-C31C-4D23-B59A-8F1B46106E82", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/DCF750BD-C31C-4D23-B59A-8F1B46106E82/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-19T17:12:27+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "76BA20A6-0C8C-4C0D-9DBC-8DD8CE8823AF", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/76BA20A6-0C8C-4C0D-9DBC-8DD8CE8823AF/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nick Cox", "profile_url": "https://stats.stackexchange.com/users/22047/nick-cox", "user_type": "registered"}, "created_at": "2026-09-19T18:03:25+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "D1BF2DDF-7230-4CA9-919F-8A5E8FCE31DD", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/D1BF2DDF-7230-4CA9-919F-8A5E8FCE31DD/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jginestet", "profile_url": "https://stats.stackexchange.com/users/380096/jginestet", "user_type": "registered"}, "created_at": "2026-09-19T20:16:52+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "D6767CF1-3AA2-465D-8C60-05A8D265C6CB", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/D6767CF1-3AA2-465D-8C60-05A8D265C6CB/view-source"}], "score": 4, "updated_at": "2026-09-19T20:16:52+00:00"}], "domain": "statistics", "external_links": [], "medical_sensitive": true, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:03.428408+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/774052c18cd9e8fa951e893347bfa3c1a85e743fc46ec4667572002cadb10cbf_1790825224163423600_0.json", "raw_sha256": "fe4dd06d3de6c0b1bb33ba88aee0ed4284118e01f76a58dcdce220a4946329b2", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Hank Lin", "question_author_url": "https://stats.stackexchange.com/users/212964/hank-lin", "question_author_user_type": "registered", "question_created_at": "2026-09-17T19:04:14+00:00", "question_html": "

I am trying to compare the standard deviations of two samples which measure patient satisfaction on different scales. Scale 1 has a potential range from 0 to 100. Scale 2 has a potential range from 0 to 36.

\n

If SD1 = A and SD2 = B, does it make sense to compare them by dividing by the potential range? Ie A / 100 vs B / 36?

\n

I was also reading about the coefficient of variation where instead you divide by the mean. I am not sure which makes more sense in my case.

\n", "question_id": 677194, "question_license": "CC BY-SA 4.0", "question_score": 2, "question_text": "I am trying to compare the standard deviations of two samples which measure patient satisfaction on different scales. Scale 1 has a potential range from 0 to 100. Scale 2 has a potential range from 0 to 36.\n\n\n\n\nIf SD1 = A and SD2 = B, does it make sense to compare them by dividing by the potential range? Ie A / 100 vs B / 36?\n\n\n\n\nI was also reading about the coefficient of variation where instead you divide by the mean. I am not sure which makes more sense in my case.", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Hank Lin", "profile_url": "https://stats.stackexchange.com/users/212964/hank-lin", "user_type": "registered"}, "created_at": "2026-09-17T19:04:14+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "B2BF101C-A5BE-4BCE-8874-6B809733F1CF", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/B2BF101C-A5BE-4BCE-8874-6B809733F1CF/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-09-19T17:11:03+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "27996B34-EADF-4303-B130-F62799122E1A", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/27996B34-EADF-4303-B130-F62799122E1A/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nick Cox", "profile_url": "https://stats.stackexchange.com/users/22047/nick-cox", "user_type": "registered"}, "created_at": "2026-09-19T17:59:01+00:00", "raw_file": "raw/codex_api_v1/59f98009db0ac38325a869c60e3993040b07f5fbd07014051415831400b70d25_1790825251781774200_0.json", "raw_sha256": "2876465103b1eeb5d593dd46b1ec52a862c1da72f8e4767e5f8ee70ff0564119", "revision_guid": "B50CFBC8-7D87-460C-ACAD-13D57C24247E", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/B50CFBC8-7D87-460C-ACAD-13D57C24247E/view-source"}], "source_site": "stats", "source_url": "https://stats.stackexchange.com/questions/677194/how-to-compare-spread-dispersion-from-two-samples-using-different-scales", "split": "train", "split_group": "6f04b02c4e3cc9d9b275af91f8e3dc20a0f7d53110d9a2d38af14010668464ab", "tags": ["standard-deviation", "scales", "coefficient-of-variation"], "thread_id": "stats:677194", "title": "How to compare spread/dispersion from two samples using different scales?"}} {"accepted_status": [true, false], "candidate_answers": [{"answer_html": "

No you can not estimate the $\\theta_i$ variance for $k = 1$. The relevant concept is the beta-binomial distribution(https://en.wikipedia.org/wiki/Beta-binomial_distribution). Now we are keeping $\\mu$ fixed and just consider $\\alpha + \\beta$ as a variable then for very large $\\alpha + \\beta$ this basically just the binomial distribution while if it's close to $0$ you end up with basically a Bernoulli-distribution over $\\{0, k\\}$. Of course for $k = 1$ those two are the same thing so there's no way to distinguish any $\\alpha + \\beta$ as long as they have same $\\mu$.

\n

Here's a plot in R:

\n
library(extraDistr)\npars <- exp(seq(-10, 10, length.out = 10))\nmu <- 0.6\nk <- 10\ny <- 0:k\n\nplot(y, dbinom(y, prob = mu, size = k), type = "b", \n     col = "red", lwd = 4, ylim = c(0, mu), main = paste0("k = ", k))\nfor(par in pars){\n  points(y, dbbinom(y, alpha = mu*par, beta = (1-mu)* par, size = k), type = "b")\n}\n\nk <- 1\ny <- 0:k\n\nplot(y, dbinom(y, prob = mu, size = k), type = "b", \n     col = "red", lwd = 4, ylim = c(0, mu), main = paste0("k = ", k))\nfor(par in pars){\n  points(y, dbbinom(y, alpha = mu*par, beta = (1-mu)* par, size = k), type = "b")\n}\n\n
\n

\"plot\n\"plot

\n", "answer_id": 677231, "answer_text": "No you can not estimate the $\\theta_i$ variance for $k = 1$. The relevant concept is the beta-binomial distribution(https://en.wikipedia.org/wiki/Beta-binomial_distribution (https://en.wikipedia.org/wiki/Beta-binomial_distribution)). Now we are keeping $\\mu$ fixed and just consider $\\alpha + \\beta$ as a variable then for very large $\\alpha + \\beta$ this basically just the binomial distribution while if it's close to $0$ you end up with basically a Bernoulli-distribution over $\\{0, k\\}$. Of course for $k = 1$ those two are the same thing so there's no way to distinguish any $\\alpha + \\beta$ as long as they have same $\\mu$.\n\n\n\n\nHere's a plot in R:\n\n\n\n\nlibrary(extraDistr)\npars <- exp(seq(-10, 10, length.out = 10))\nmu <- 0.6\nk <- 10\ny <- 0:k\n\nplot(y, dbinom(y, prob = mu, size = k), type = \"b\", \n col = \"red\", lwd = 4, ylim = c(0, mu), main = paste0(\"k = \", k))\nfor(par in pars){\n points(y, dbbinom(y, alpha = mu*par, beta = (1-mu)* par, size = k), type = \"b\")\n}\n\nk <- 1\ny <- 0:k\n\nplot(y, dbinom(y, prob = mu, size = k), type = \"b\", \n col = \"red\", lwd = 4, ylim = c(0, mu), main = paste0(\"k = \", k))\nfor(par in pars){\n points(y, dbbinom(y, alpha = mu*par, beta = (1-mu)* par, size = k), type = \"b\")\n}\n\n\n\n\n\n\n[image: plot k = 10 from R-Code, one extrem being just 0.4 at 0 and 0.6 at 10, the other fits the binomial; source: https://i.sstatic.net/cWGh2esg.png] (https://i.sstatic.net/cWGh2esg.png)\n[image: plot k = 1 from R-Code, just the same line from 0.4 to 0.6; source: https://i.sstatic.net/BHmL9Quz.png] (https://i.sstatic.net/BHmL9Quz.png)", "answer_url": "https://stats.stackexchange.com/a/677231", "author": "Lukas Lohse", "author_url": "https://stats.stackexchange.com/users/341520/lukas-lohse", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-21T21:48:52+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677226, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Lukas Lohse", "profile_url": "https://stats.stackexchange.com/users/341520/lukas-lohse", "user_type": "registered"}, "created_at": "2026-09-21T21:48:52+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "315A6811-DCF0-437C-A1D7-8721F8646961", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/315A6811-DCF0-437C-A1D7-8721F8646961/view-source"}], "score": 2, "updated_at": "2026-09-21T21:48:52+00:00"}, {"answer_html": "

After thinking about this, I think I know how to do this. When $k=1$, it is possible to estimate the population mean but it is impossible to estimate the variance of the population.

\n

However, it is possible to estimate the variance of the mean estimator at $k=1$.

\n

Let each unit have $\\theta_i \\overset{iid}{\\sim} \\text{Beta}(\\alpha,\\beta)$ with density $f(\\theta)$. Each unit is observed once ($k=1$), so $y_i \\mid \\theta_i \\sim \\text{Bernoulli}(\\theta_i)$:

\n
    \n
  • $\\mu = E[\\theta_i]$ — population mean (the target) and is $\\mu = \\frac{\\alpha}{\\alpha+\\beta}$
  • \n
\n
    \n
  • $\\tau^2 = \\operatorname{Var}(\\theta_i)$ — population variance and is = $\\tau^2 = \\frac{\\mu(1-\\mu)}{\\alpha+\\beta+1}$
  • \n
\n
    \n
  • $\\sigma_y^2 = \\operatorname{Var}(y_i)$
  • \n
\n

For a single unit, the Bernoulli distribution:\n$$P(y\\mid\\theta) = \\theta^{y}(1-\\theta)^{1-y}.$$

\n

To marginalize the distribution:

\n

$$P(y_i=1) = \\int_0^1 \\theta\\, f(\\theta)\\,d\\theta = E[\\theta_i] = \\mu$$\n$$\\qquad P(y_i=0) = \\int_0^1 (1-\\theta)\\, f(\\theta)\\,d\\theta = 1-\\mu.$$

\n

$$y_i \\sim \\text{Bernoulli}(\\mu) = P(y_i = y) = \\mu^{y}(1-\\mu)^{1-y}$$

\n

The iid assumption makes it easy to extend this to $n$ machines:

\n

$$P(y_1,\\dots,y_n \\mid \\theta_1,\\dots,\\theta_n) = \\prod_{i=1}^n \\theta_i^{y_i}(1-\\theta_i)^{1-y_i}.$$

\n

$$P(y_1,\\dots,y_n) = \\int\\!\\!\\cdots\\!\\!\\int \\prod_{i=1}^n \\Big[\\theta_i^{y_i}(1-\\theta_i)^{1-y_i} f(\\theta_i)\\Big]\\, d\\theta_1\\cdots d\\theta_n.$$

\n

$$P(y_1,\\dots,y_n) = \\int_0^1 \\theta_1^{y_1}(1-\\theta_1)^{1-y_1}f(\\theta_1)\\,d\\theta_1 \\times \\cdots \\times \\int_0^1 \\theta_n^{y_n}(1-\\theta_n)^{1-y_n}f(\\theta_n)\\,d\\theta_n.$$

\n

$$P(y_1,\\dots,y_n) = \\prod_{i=1}^n \\mu^{y_i}(1-\\mu)^{1-y_i} \\quad\\Longrightarrow\\quad y_1,\\dots,y_n \\overset{iid}{\\sim} \\text{Bernoulli}(\\mu).$$

\n

Next, we can see $\\bar y$ is unbiased:

\n

$$E[y_i\\mid\\theta_i] = 1\\cdot\\theta_i + 0\\cdot(1-\\theta_i) = \\theta_i$$\n$$E[y_i] = E\\big[\\,E[y_i\\mid\\theta_i]\\,\\big] = E[\\theta_i] = \\mu.$$\n$$E[\\bar y] = \\frac1n\\sum_{i=1}^n E[y_i] = \\frac1n\\cdot n\\mu = \\mu$$

\n

Now for the variance:

\n

$$\\sigma_y^2 = \\text{Var}(y_i) = \\underbrace{E[\\text{Var}(y_i\\mid\\theta_i)]}_{\\text{within}} + \\underbrace{\\text{Var}(E[y_i\\mid\\theta_i])}_{\\text{between}} = E[\\theta_i(1-\\theta_i)] + \\tau^2.$$

\n

$$\\tau^2 = E[\\theta_i^2] - \\mu^2$$\n$$\\sigma_y^2 = \\big(\\mu - E[\\theta_i^2]\\big) + \\big(E[\\theta_i^2] - \\mu^2\\big) = \\mu(1-\\mu).$$

\n

For variance of the mean (0 covariance):

\n

$$\\text{Var}(\\bar y) = \\frac{1}{n^2}\\sum_{i=1}^n \\text{Var}(y_i) = \\frac{1}{n^2}\\cdot n\\sigma_y^2 = \\frac{\\sigma_y^2}{n} = \\frac{\\mu(1-\\mu)}{n}.$$

\n

Finally, we can see that $S^2$ is unbiased for $\\sigma_y^2$.

\n

The sample variance is:\n$$S^2 = \\frac{1}{n-1}\\sum_{i=1}^n (y_i-\\bar y)^2.$$

\n
    \n
  • $\\bar y = \\frac1n\\sum_i y_i$ means $\\sum_i y_i = n\\bar y$.
  • \n
  • A constant $\\mu$ summed $n$ times is $n\\mu$.
  • \n
\n

$$\\sum_{i=1}^n (y_i-\\mu) = \\sum_i y_i - n\\mu = n\\bar y - n\\mu = n(\\bar y-\\mu).$$

\n
    \n
  • $y_i - \\bar y = (y_i-\\mu) - (\\bar y-\\mu)$:\n$$\\sum_i (y_i-\\bar y)^2 = \\sum_i (y_i-\\mu)^2 \\;-\\; 2(\\bar y-\\mu)\\underbrace{\\sum_i (y_i-\\mu)}_{=\\,n(\\bar y-\\mu)} \\;+\\; n(\\bar y-\\mu)^2.$$
  • \n
\n

$$\\sum_i (y_i-\\bar y)^2 = \\sum_i (y_i-\\mu)^2 - n(\\bar y-\\mu)^2.$$

\n
    \n
  • $E[(y_i-\\mu)^2] = \\sigma_y^2$
  • \n
  • $E[(\\bar y-\\mu)^2] = \\text{Var}(\\bar y) = \\sigma_y^2/n$
  • \n
\n

Therefore\n$$E\\Big[\\sum_i (y_i-\\bar y)^2\\Big] = n\\sigma_y^2 - n\\cdot\\frac{\\sigma_y^2}{n} = (n-1)\\sigma_y^2 \\quad\\Longrightarrow\\quad E[S^2] = \\sigma_y^2$$

\n

For 0/1 data, $y_i^2 = y_i$, and $S^2$ simplifies to $\\dfrac{n}{n-1}\\,\\bar y(1-\\bar y)$.

\n

So it seems that at $k=1$, we can estimate the population mean and variance of the mean estimator.

\n", "answer_id": 677265, "answer_text": "After thinking about this, I think I know how to do this. When $k=1$, it is possible to estimate the population mean but it is impossible to estimate the variance of the population.\n\n\n\n\nHowever, it is possible to estimate the variance of the mean estimator at $k=1$.\n\n\n\n\nLet each unit have $\\theta_i \\overset{iid}{\\sim} \\text{Beta}(\\alpha,\\beta)$ with density $f(\\theta)$. Each unit is observed once ($k=1$), so $y_i \\mid \\theta_i \\sim \\text{Bernoulli}(\\theta_i)$:\n\n\n\n\n\n$\\mu = E[\\theta_i]$ — population mean (the target) and is $\\mu = \\frac{\\alpha}{\\alpha+\\beta}$\n\n\n\n\n\n\n$\\tau^2 = \\operatorname{Var}(\\theta_i)$ — population variance and is = $\\tau^2 = \\frac{\\mu(1-\\mu)}{\\alpha+\\beta+1}$\n\n\n\n\n\n\n$\\sigma_y^2 = \\operatorname{Var}(y_i)$\n\n\n\n\n\nFor a single unit, the Bernoulli distribution:\n$$P(y\\mid\\theta) = \\theta^{y}(1-\\theta)^{1-y}.$$\n\n\n\n\nTo marginalize the distribution:\n\n\n\n\n$$P(y_i=1) = \\int_0^1 \\theta\\, f(\\theta)\\,d\\theta = E[\\theta_i] = \\mu$$\n$$\\qquad P(y_i=0) = \\int_0^1 (1-\\theta)\\, f(\\theta)\\,d\\theta = 1-\\mu.$$\n\n\n\n\n$$y_i \\sim \\text{Bernoulli}(\\mu) = P(y_i = y) = \\mu^{y}(1-\\mu)^{1-y}$$\n\n\n\n\nThe iid assumption makes it easy to extend this to $n$ machines:\n\n\n\n\n$$P(y_1,\\dots,y_n \\mid \\theta_1,\\dots,\\theta_n) = \\prod_{i=1}^n \\theta_i^{y_i}(1-\\theta_i)^{1-y_i}.$$\n\n\n\n\n$$P(y_1,\\dots,y_n) = \\int\\!\\!\\cdots\\!\\!\\int \\prod_{i=1}^n \\Big[\\theta_i^{y_i}(1-\\theta_i)^{1-y_i} f(\\theta_i)\\Big]\\, d\\theta_1\\cdots d\\theta_n.$$\n\n\n\n\n$$P(y_1,\\dots,y_n) = \\int_0^1 \\theta_1^{y_1}(1-\\theta_1)^{1-y_1}f(\\theta_1)\\,d\\theta_1 \\times \\cdots \\times \\int_0^1 \\theta_n^{y_n}(1-\\theta_n)^{1-y_n}f(\\theta_n)\\,d\\theta_n.$$\n\n\n\n\n$$P(y_1,\\dots,y_n) = \\prod_{i=1}^n \\mu^{y_i}(1-\\mu)^{1-y_i} \\quad\\Longrightarrow\\quad y_1,\\dots,y_n \\overset{iid}{\\sim} \\text{Bernoulli}(\\mu).$$\n\n\n\n\nNext, we can see $\\bar y$ is unbiased:\n\n\n\n\n$$E[y_i\\mid\\theta_i] = 1\\cdot\\theta_i + 0\\cdot(1-\\theta_i) = \\theta_i$$\n$$E[y_i] = E\\big[\\,E[y_i\\mid\\theta_i]\\,\\big] = E[\\theta_i] = \\mu.$$\n$$E[\\bar y] = \\frac1n\\sum_{i=1}^n E[y_i] = \\frac1n\\cdot n\\mu = \\mu$$\n\n\n\n\nNow for the variance:\n\n\n\n\n$$\\sigma_y^2 = \\text{Var}(y_i) = \\underbrace{E[\\text{Var}(y_i\\mid\\theta_i)]}_{\\text{within}} + \\underbrace{\\text{Var}(E[y_i\\mid\\theta_i])}_{\\text{between}} = E[\\theta_i(1-\\theta_i)] + \\tau^2.$$\n\n\n\n\n$$\\tau^2 = E[\\theta_i^2] - \\mu^2$$\n$$\\sigma_y^2 = \\big(\\mu - E[\\theta_i^2]\\big) + \\big(E[\\theta_i^2] - \\mu^2\\big) = \\mu(1-\\mu).$$\n\n\n\n\nFor variance of the mean (0 covariance):\n\n\n\n\n$$\\text{Var}(\\bar y) = \\frac{1}{n^2}\\sum_{i=1}^n \\text{Var}(y_i) = \\frac{1}{n^2}\\cdot n\\sigma_y^2 = \\frac{\\sigma_y^2}{n} = \\frac{\\mu(1-\\mu)}{n}.$$\n\n\n\n\nFinally, we can see that $S^2$ is unbiased for $\\sigma_y^2$.\n\n\n\n\nThe sample variance is:\n$$S^2 = \\frac{1}{n-1}\\sum_{i=1}^n (y_i-\\bar y)^2.$$\n\n\n\n\n\n$\\bar y = \\frac1n\\sum_i y_i$ means $\\sum_i y_i = n\\bar y$.\n\n\n\n\nA constant $\\mu$ summed $n$ times is $n\\mu$.\n\n\n\n\n\n$$\\sum_{i=1}^n (y_i-\\mu) = \\sum_i y_i - n\\mu = n\\bar y - n\\mu = n(\\bar y-\\mu).$$\n\n\n\n\n\n$y_i - \\bar y = (y_i-\\mu) - (\\bar y-\\mu)$:\n$$\\sum_i (y_i-\\bar y)^2 = \\sum_i (y_i-\\mu)^2 \\;-\\; 2(\\bar y-\\mu)\\underbrace{\\sum_i (y_i-\\mu)}_{=\\,n(\\bar y-\\mu)} \\;+\\; n(\\bar y-\\mu)^2.$$\n\n\n\n\n\n$$\\sum_i (y_i-\\bar y)^2 = \\sum_i (y_i-\\mu)^2 - n(\\bar y-\\mu)^2.$$\n\n\n\n\n\n$E[(y_i-\\mu)^2] = \\sigma_y^2$\n\n\n\n\n$E[(\\bar y-\\mu)^2] = \\text{Var}(\\bar y) = \\sigma_y^2/n$\n\n\n\n\n\nTherefore\n$$E\\Big[\\sum_i (y_i-\\bar y)^2\\Big] = n\\sigma_y^2 - n\\cdot\\frac{\\sigma_y^2}{n} = (n-1)\\sigma_y^2 \\quad\\Longrightarrow\\quad E[S^2] = \\sigma_y^2$$\n\n\n\n\nFor 0/1 data, $y_i^2 = y_i$, and $S^2$ simplifies to $\\dfrac{n}{n-1}\\,\\bar y(1-\\bar y)$.\n\n\n\n\nSo it seems that at $k=1$, we can estimate the population mean and variance of the mean estimator.", "answer_url": "https://stats.stackexchange.com/a/677265", "author": "adamkostanov", "author_url": "https://stats.stackexchange.com/users/512554/adamkostanov", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-25T17:44:30+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677226, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "adamkostanov", "profile_url": "https://stats.stackexchange.com/users/512554/adamkostanov", "user_type": "registered"}, "created_at": "2026-09-25T17:44:30+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "A2509D36-CE80-4C0F-BA28-5077E22D040B", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/A2509D36-CE80-4C0F-BA28-5077E22D040B/view-source"}], "score": 0, "updated_at": "2026-09-25T17:44:30+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "Here is a hierarchical data generating process:\n\n\n\n\n\n\n\n(Population) Layer 1: $$\\theta_i \\overset{\\text{iid}}{\\sim} \\text{Beta}(\\alpha,\\ \\beta), \\qquad i = 1, \\dots, n$$\n\n\n\n\n(Individual) Layer 2: $$y_{ij} \\mid \\theta_i \\overset{\\text{iid}}{\\sim} \\text{Bernoulli}(\\theta_i), \\qquad j = 1, \\dots, k$$\n\n\n\n\n\n\n\nThere are two cases - Case 1 is where you sample 1 observation per subject and Case 2 where you sample multiple observations per subject:\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/wine4qeY.png] (https://i.sstatic.net/wine4qeY.png)\n\n\n\n\nI am only interested in estimating the population level mean and variance. Can this still be done in Case 1?\n\n\n\n\nI am guessing that there will be no problems doing this for Case 2. For Case 1, I am guessing there won't be any problems for estimating the population level mean, but I am not sure if the population level variance can still be estimated since we do not observe variation at the individual level (regardless of whether moments are used or MLE).\n\n\n\n\n\n\n\nset.seed(42)\nn <- 20\nk <- 10\nalpha <- 3\nbeta <- 2 \nmu <- alpha / (alpha + beta) \n\nsubjects <- factor(paste(\"Subject\", 1:n), levels = paste(\"Subject\", n:1))\n\n# one theta (true probability) per subject \ntheta <- numeric(n)\nfor (i in 1:n) {\n theta[i] <- rbeta(1, alpha, beta)\n}\n\n# Case 1 \ncase1 <- numeric(n)\nfor (i in 1:n) {\n case1[i] <- rbinom(1, 1, theta[i]) \n}\n\n# Case 2 \ncase2 <- matrix(NA, nrow = k, ncol = n) \nfor (i in 1:n) {\n for (j in 1:k) {\n case2[j, i] <- rbinom(1, 1, theta[i])\n }\n}\n\nd1 <- data.frame(subject = subjects, true = theta, meas = case1)\nd2 <- data.frame(subject = rep(subjects, each = k),\n true = rep(theta, each = k),\n meas = as.vector(case2))\nred2 <- data.frame(subject = subjects, true = theta)", "record_id": "Scientific-Answer-Ranking:stats:677226", "scores": [2, 0], "split": "train", "thread": {"accepted_answer_id": 677231, "answers": [{"answer_html": "

No you can not estimate the $\\theta_i$ variance for $k = 1$. The relevant concept is the beta-binomial distribution(https://en.wikipedia.org/wiki/Beta-binomial_distribution). Now we are keeping $\\mu$ fixed and just consider $\\alpha + \\beta$ as a variable then for very large $\\alpha + \\beta$ this basically just the binomial distribution while if it's close to $0$ you end up with basically a Bernoulli-distribution over $\\{0, k\\}$. Of course for $k = 1$ those two are the same thing so there's no way to distinguish any $\\alpha + \\beta$ as long as they have same $\\mu$.

\n

Here's a plot in R:

\n
library(extraDistr)\npars <- exp(seq(-10, 10, length.out = 10))\nmu <- 0.6\nk <- 10\ny <- 0:k\n\nplot(y, dbinom(y, prob = mu, size = k), type = "b", \n     col = "red", lwd = 4, ylim = c(0, mu), main = paste0("k = ", k))\nfor(par in pars){\n  points(y, dbbinom(y, alpha = mu*par, beta = (1-mu)* par, size = k), type = "b")\n}\n\nk <- 1\ny <- 0:k\n\nplot(y, dbinom(y, prob = mu, size = k), type = "b", \n     col = "red", lwd = 4, ylim = c(0, mu), main = paste0("k = ", k))\nfor(par in pars){\n  points(y, dbbinom(y, alpha = mu*par, beta = (1-mu)* par, size = k), type = "b")\n}\n\n
\n

\"plot\n\"plot

\n", "answer_id": 677231, "answer_text": "No you can not estimate the $\\theta_i$ variance for $k = 1$. The relevant concept is the beta-binomial distribution(https://en.wikipedia.org/wiki/Beta-binomial_distribution (https://en.wikipedia.org/wiki/Beta-binomial_distribution)). Now we are keeping $\\mu$ fixed and just consider $\\alpha + \\beta$ as a variable then for very large $\\alpha + \\beta$ this basically just the binomial distribution while if it's close to $0$ you end up with basically a Bernoulli-distribution over $\\{0, k\\}$. Of course for $k = 1$ those two are the same thing so there's no way to distinguish any $\\alpha + \\beta$ as long as they have same $\\mu$.\n\n\n\n\nHere's a plot in R:\n\n\n\n\nlibrary(extraDistr)\npars <- exp(seq(-10, 10, length.out = 10))\nmu <- 0.6\nk <- 10\ny <- 0:k\n\nplot(y, dbinom(y, prob = mu, size = k), type = \"b\", \n col = \"red\", lwd = 4, ylim = c(0, mu), main = paste0(\"k = \", k))\nfor(par in pars){\n points(y, dbbinom(y, alpha = mu*par, beta = (1-mu)* par, size = k), type = \"b\")\n}\n\nk <- 1\ny <- 0:k\n\nplot(y, dbinom(y, prob = mu, size = k), type = \"b\", \n col = \"red\", lwd = 4, ylim = c(0, mu), main = paste0(\"k = \", k))\nfor(par in pars){\n points(y, dbbinom(y, alpha = mu*par, beta = (1-mu)* par, size = k), type = \"b\")\n}\n\n\n\n\n\n\n[image: plot k = 10 from R-Code, one extrem being just 0.4 at 0 and 0.6 at 10, the other fits the binomial; source: https://i.sstatic.net/cWGh2esg.png] (https://i.sstatic.net/cWGh2esg.png)\n[image: plot k = 1 from R-Code, just the same line from 0.4 to 0.6; source: https://i.sstatic.net/BHmL9Quz.png] (https://i.sstatic.net/BHmL9Quz.png)", "answer_url": "https://stats.stackexchange.com/a/677231", "author": "Lukas Lohse", "author_url": "https://stats.stackexchange.com/users/341520/lukas-lohse", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-21T21:48:52+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677226, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Lukas Lohse", "profile_url": "https://stats.stackexchange.com/users/341520/lukas-lohse", "user_type": "registered"}, "created_at": "2026-09-21T21:48:52+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "315A6811-DCF0-437C-A1D7-8721F8646961", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/315A6811-DCF0-437C-A1D7-8721F8646961/view-source"}], "score": 2, "updated_at": "2026-09-21T21:48:52+00:00"}, {"answer_html": "

After thinking about this, I think I know how to do this. When $k=1$, it is possible to estimate the population mean but it is impossible to estimate the variance of the population.

\n

However, it is possible to estimate the variance of the mean estimator at $k=1$.

\n

Let each unit have $\\theta_i \\overset{iid}{\\sim} \\text{Beta}(\\alpha,\\beta)$ with density $f(\\theta)$. Each unit is observed once ($k=1$), so $y_i \\mid \\theta_i \\sim \\text{Bernoulli}(\\theta_i)$:

\n
    \n
  • $\\mu = E[\\theta_i]$ — population mean (the target) and is $\\mu = \\frac{\\alpha}{\\alpha+\\beta}$
  • \n
\n
    \n
  • $\\tau^2 = \\operatorname{Var}(\\theta_i)$ — population variance and is = $\\tau^2 = \\frac{\\mu(1-\\mu)}{\\alpha+\\beta+1}$
  • \n
\n
    \n
  • $\\sigma_y^2 = \\operatorname{Var}(y_i)$
  • \n
\n

For a single unit, the Bernoulli distribution:\n$$P(y\\mid\\theta) = \\theta^{y}(1-\\theta)^{1-y}.$$

\n

To marginalize the distribution:

\n

$$P(y_i=1) = \\int_0^1 \\theta\\, f(\\theta)\\,d\\theta = E[\\theta_i] = \\mu$$\n$$\\qquad P(y_i=0) = \\int_0^1 (1-\\theta)\\, f(\\theta)\\,d\\theta = 1-\\mu.$$

\n

$$y_i \\sim \\text{Bernoulli}(\\mu) = P(y_i = y) = \\mu^{y}(1-\\mu)^{1-y}$$

\n

The iid assumption makes it easy to extend this to $n$ machines:

\n

$$P(y_1,\\dots,y_n \\mid \\theta_1,\\dots,\\theta_n) = \\prod_{i=1}^n \\theta_i^{y_i}(1-\\theta_i)^{1-y_i}.$$

\n

$$P(y_1,\\dots,y_n) = \\int\\!\\!\\cdots\\!\\!\\int \\prod_{i=1}^n \\Big[\\theta_i^{y_i}(1-\\theta_i)^{1-y_i} f(\\theta_i)\\Big]\\, d\\theta_1\\cdots d\\theta_n.$$

\n

$$P(y_1,\\dots,y_n) = \\int_0^1 \\theta_1^{y_1}(1-\\theta_1)^{1-y_1}f(\\theta_1)\\,d\\theta_1 \\times \\cdots \\times \\int_0^1 \\theta_n^{y_n}(1-\\theta_n)^{1-y_n}f(\\theta_n)\\,d\\theta_n.$$

\n

$$P(y_1,\\dots,y_n) = \\prod_{i=1}^n \\mu^{y_i}(1-\\mu)^{1-y_i} \\quad\\Longrightarrow\\quad y_1,\\dots,y_n \\overset{iid}{\\sim} \\text{Bernoulli}(\\mu).$$

\n

Next, we can see $\\bar y$ is unbiased:

\n

$$E[y_i\\mid\\theta_i] = 1\\cdot\\theta_i + 0\\cdot(1-\\theta_i) = \\theta_i$$\n$$E[y_i] = E\\big[\\,E[y_i\\mid\\theta_i]\\,\\big] = E[\\theta_i] = \\mu.$$\n$$E[\\bar y] = \\frac1n\\sum_{i=1}^n E[y_i] = \\frac1n\\cdot n\\mu = \\mu$$

\n

Now for the variance:

\n

$$\\sigma_y^2 = \\text{Var}(y_i) = \\underbrace{E[\\text{Var}(y_i\\mid\\theta_i)]}_{\\text{within}} + \\underbrace{\\text{Var}(E[y_i\\mid\\theta_i])}_{\\text{between}} = E[\\theta_i(1-\\theta_i)] + \\tau^2.$$

\n

$$\\tau^2 = E[\\theta_i^2] - \\mu^2$$\n$$\\sigma_y^2 = \\big(\\mu - E[\\theta_i^2]\\big) + \\big(E[\\theta_i^2] - \\mu^2\\big) = \\mu(1-\\mu).$$

\n

For variance of the mean (0 covariance):

\n

$$\\text{Var}(\\bar y) = \\frac{1}{n^2}\\sum_{i=1}^n \\text{Var}(y_i) = \\frac{1}{n^2}\\cdot n\\sigma_y^2 = \\frac{\\sigma_y^2}{n} = \\frac{\\mu(1-\\mu)}{n}.$$

\n

Finally, we can see that $S^2$ is unbiased for $\\sigma_y^2$.

\n

The sample variance is:\n$$S^2 = \\frac{1}{n-1}\\sum_{i=1}^n (y_i-\\bar y)^2.$$

\n
    \n
  • $\\bar y = \\frac1n\\sum_i y_i$ means $\\sum_i y_i = n\\bar y$.
  • \n
  • A constant $\\mu$ summed $n$ times is $n\\mu$.
  • \n
\n

$$\\sum_{i=1}^n (y_i-\\mu) = \\sum_i y_i - n\\mu = n\\bar y - n\\mu = n(\\bar y-\\mu).$$

\n
    \n
  • $y_i - \\bar y = (y_i-\\mu) - (\\bar y-\\mu)$:\n$$\\sum_i (y_i-\\bar y)^2 = \\sum_i (y_i-\\mu)^2 \\;-\\; 2(\\bar y-\\mu)\\underbrace{\\sum_i (y_i-\\mu)}_{=\\,n(\\bar y-\\mu)} \\;+\\; n(\\bar y-\\mu)^2.$$
  • \n
\n

$$\\sum_i (y_i-\\bar y)^2 = \\sum_i (y_i-\\mu)^2 - n(\\bar y-\\mu)^2.$$

\n
    \n
  • $E[(y_i-\\mu)^2] = \\sigma_y^2$
  • \n
  • $E[(\\bar y-\\mu)^2] = \\text{Var}(\\bar y) = \\sigma_y^2/n$
  • \n
\n

Therefore\n$$E\\Big[\\sum_i (y_i-\\bar y)^2\\Big] = n\\sigma_y^2 - n\\cdot\\frac{\\sigma_y^2}{n} = (n-1)\\sigma_y^2 \\quad\\Longrightarrow\\quad E[S^2] = \\sigma_y^2$$

\n

For 0/1 data, $y_i^2 = y_i$, and $S^2$ simplifies to $\\dfrac{n}{n-1}\\,\\bar y(1-\\bar y)$.

\n

So it seems that at $k=1$, we can estimate the population mean and variance of the mean estimator.

\n", "answer_id": 677265, "answer_text": "After thinking about this, I think I know how to do this. When $k=1$, it is possible to estimate the population mean but it is impossible to estimate the variance of the population.\n\n\n\n\nHowever, it is possible to estimate the variance of the mean estimator at $k=1$.\n\n\n\n\nLet each unit have $\\theta_i \\overset{iid}{\\sim} \\text{Beta}(\\alpha,\\beta)$ with density $f(\\theta)$. Each unit is observed once ($k=1$), so $y_i \\mid \\theta_i \\sim \\text{Bernoulli}(\\theta_i)$:\n\n\n\n\n\n$\\mu = E[\\theta_i]$ — population mean (the target) and is $\\mu = \\frac{\\alpha}{\\alpha+\\beta}$\n\n\n\n\n\n\n$\\tau^2 = \\operatorname{Var}(\\theta_i)$ — population variance and is = $\\tau^2 = \\frac{\\mu(1-\\mu)}{\\alpha+\\beta+1}$\n\n\n\n\n\n\n$\\sigma_y^2 = \\operatorname{Var}(y_i)$\n\n\n\n\n\nFor a single unit, the Bernoulli distribution:\n$$P(y\\mid\\theta) = \\theta^{y}(1-\\theta)^{1-y}.$$\n\n\n\n\nTo marginalize the distribution:\n\n\n\n\n$$P(y_i=1) = \\int_0^1 \\theta\\, f(\\theta)\\,d\\theta = E[\\theta_i] = \\mu$$\n$$\\qquad P(y_i=0) = \\int_0^1 (1-\\theta)\\, f(\\theta)\\,d\\theta = 1-\\mu.$$\n\n\n\n\n$$y_i \\sim \\text{Bernoulli}(\\mu) = P(y_i = y) = \\mu^{y}(1-\\mu)^{1-y}$$\n\n\n\n\nThe iid assumption makes it easy to extend this to $n$ machines:\n\n\n\n\n$$P(y_1,\\dots,y_n \\mid \\theta_1,\\dots,\\theta_n) = \\prod_{i=1}^n \\theta_i^{y_i}(1-\\theta_i)^{1-y_i}.$$\n\n\n\n\n$$P(y_1,\\dots,y_n) = \\int\\!\\!\\cdots\\!\\!\\int \\prod_{i=1}^n \\Big[\\theta_i^{y_i}(1-\\theta_i)^{1-y_i} f(\\theta_i)\\Big]\\, d\\theta_1\\cdots d\\theta_n.$$\n\n\n\n\n$$P(y_1,\\dots,y_n) = \\int_0^1 \\theta_1^{y_1}(1-\\theta_1)^{1-y_1}f(\\theta_1)\\,d\\theta_1 \\times \\cdots \\times \\int_0^1 \\theta_n^{y_n}(1-\\theta_n)^{1-y_n}f(\\theta_n)\\,d\\theta_n.$$\n\n\n\n\n$$P(y_1,\\dots,y_n) = \\prod_{i=1}^n \\mu^{y_i}(1-\\mu)^{1-y_i} \\quad\\Longrightarrow\\quad y_1,\\dots,y_n \\overset{iid}{\\sim} \\text{Bernoulli}(\\mu).$$\n\n\n\n\nNext, we can see $\\bar y$ is unbiased:\n\n\n\n\n$$E[y_i\\mid\\theta_i] = 1\\cdot\\theta_i + 0\\cdot(1-\\theta_i) = \\theta_i$$\n$$E[y_i] = E\\big[\\,E[y_i\\mid\\theta_i]\\,\\big] = E[\\theta_i] = \\mu.$$\n$$E[\\bar y] = \\frac1n\\sum_{i=1}^n E[y_i] = \\frac1n\\cdot n\\mu = \\mu$$\n\n\n\n\nNow for the variance:\n\n\n\n\n$$\\sigma_y^2 = \\text{Var}(y_i) = \\underbrace{E[\\text{Var}(y_i\\mid\\theta_i)]}_{\\text{within}} + \\underbrace{\\text{Var}(E[y_i\\mid\\theta_i])}_{\\text{between}} = E[\\theta_i(1-\\theta_i)] + \\tau^2.$$\n\n\n\n\n$$\\tau^2 = E[\\theta_i^2] - \\mu^2$$\n$$\\sigma_y^2 = \\big(\\mu - E[\\theta_i^2]\\big) + \\big(E[\\theta_i^2] - \\mu^2\\big) = \\mu(1-\\mu).$$\n\n\n\n\nFor variance of the mean (0 covariance):\n\n\n\n\n$$\\text{Var}(\\bar y) = \\frac{1}{n^2}\\sum_{i=1}^n \\text{Var}(y_i) = \\frac{1}{n^2}\\cdot n\\sigma_y^2 = \\frac{\\sigma_y^2}{n} = \\frac{\\mu(1-\\mu)}{n}.$$\n\n\n\n\nFinally, we can see that $S^2$ is unbiased for $\\sigma_y^2$.\n\n\n\n\nThe sample variance is:\n$$S^2 = \\frac{1}{n-1}\\sum_{i=1}^n (y_i-\\bar y)^2.$$\n\n\n\n\n\n$\\bar y = \\frac1n\\sum_i y_i$ means $\\sum_i y_i = n\\bar y$.\n\n\n\n\nA constant $\\mu$ summed $n$ times is $n\\mu$.\n\n\n\n\n\n$$\\sum_{i=1}^n (y_i-\\mu) = \\sum_i y_i - n\\mu = n\\bar y - n\\mu = n(\\bar y-\\mu).$$\n\n\n\n\n\n$y_i - \\bar y = (y_i-\\mu) - (\\bar y-\\mu)$:\n$$\\sum_i (y_i-\\bar y)^2 = \\sum_i (y_i-\\mu)^2 \\;-\\; 2(\\bar y-\\mu)\\underbrace{\\sum_i (y_i-\\mu)}_{=\\,n(\\bar y-\\mu)} \\;+\\; n(\\bar y-\\mu)^2.$$\n\n\n\n\n\n$$\\sum_i (y_i-\\bar y)^2 = \\sum_i (y_i-\\mu)^2 - n(\\bar y-\\mu)^2.$$\n\n\n\n\n\n$E[(y_i-\\mu)^2] = \\sigma_y^2$\n\n\n\n\n$E[(\\bar y-\\mu)^2] = \\text{Var}(\\bar y) = \\sigma_y^2/n$\n\n\n\n\n\nTherefore\n$$E\\Big[\\sum_i (y_i-\\bar y)^2\\Big] = n\\sigma_y^2 - n\\cdot\\frac{\\sigma_y^2}{n} = (n-1)\\sigma_y^2 \\quad\\Longrightarrow\\quad E[S^2] = \\sigma_y^2$$\n\n\n\n\nFor 0/1 data, $y_i^2 = y_i$, and $S^2$ simplifies to $\\dfrac{n}{n-1}\\,\\bar y(1-\\bar y)$.\n\n\n\n\nSo it seems that at $k=1$, we can estimate the population mean and variance of the mean estimator.", "answer_url": "https://stats.stackexchange.com/a/677265", "author": "adamkostanov", "author_url": "https://stats.stackexchange.com/users/512554/adamkostanov", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-25T17:44:30+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677226, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "adamkostanov", "profile_url": "https://stats.stackexchange.com/users/512554/adamkostanov", "user_type": "registered"}, "created_at": "2026-09-25T17:44:30+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "A2509D36-CE80-4C0F-BA28-5077E22D040B", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/A2509D36-CE80-4C0F-BA28-5077E22D040B/view-source"}], "score": 0, "updated_at": "2026-09-25T17:44:30+00:00"}], "domain": "statistics", "external_links": ["https://en.wikipedia.org/wiki/Beta-binomial_distribution", "https://i.sstatic.net/BHmL9Quz.png", "https://i.sstatic.net/cWGh2esg.png", "https://i.sstatic.net/wine4qeY.png"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:03.428408+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/774052c18cd9e8fa951e893347bfa3c1a85e743fc46ec4667572002cadb10cbf_1790825224163423600_0.json", "raw_sha256": "fe4dd06d3de6c0b1bb33ba88aee0ed4284118e01f76a58dcdce220a4946329b2", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "adamkostanov", "question_author_url": "https://stats.stackexchange.com/users/512554/adamkostanov", "question_author_user_type": "registered", "question_created_at": "2026-09-21T00:41:19+00:00", "question_html": "

Here is a hierarchical data generating process:

\n
\n

(Population) Layer 1: $$\\theta_i \\overset{\\text{iid}}{\\sim} \\text{Beta}(\\alpha,\\ \\beta), \\qquad i = 1, \\dots, n$$

\n

(Individual) Layer 2: $$y_{ij} \\mid \\theta_i \\overset{\\text{iid}}{\\sim} \\text{Bernoulli}(\\theta_i), \\qquad j = 1, \\dots, k$$

\n
\n

There are two cases - Case 1 is where you sample 1 observation per subject and Case 2 where you sample multiple observations per subject:

\n

\"enter

\n

I am only interested in estimating the population level mean and variance. Can this still be done in Case 1?

\n

I am guessing that there will be no problems doing this for Case 2. For Case 1, I am guessing there won't be any problems for estimating the population level mean, but I am not sure if the population level variance can still be estimated since we do not observe variation at the individual level (regardless of whether moments are used or MLE).

\n
\n
set.seed(42)\nn <- 20\nk <- 10\nalpha <- 3\nbeta <- 2                \nmu <- alpha / (alpha + beta)          \n\nsubjects <- factor(paste("Subject", 1:n), levels = paste("Subject", n:1))\n\n# one theta (true probability) per subject \ntheta <- numeric(n)\nfor (i in 1:n) {\n    theta[i] <- rbeta(1, alpha, beta)\n}\n\n# Case 1 \ncase1 <- numeric(n)\nfor (i in 1:n) {\n    case1[i] <- rbinom(1, 1, theta[i])       \n}\n\n# Case 2 \ncase2 <- matrix(NA, nrow = k, ncol = n)    \nfor (i in 1:n) {\n    for (j in 1:k) {\n        case2[j, i] <- rbinom(1, 1, theta[i])\n    }\n}\n\nd1 <- data.frame(subject = subjects, true = theta, meas = case1)\nd2 <- data.frame(subject = rep(subjects, each = k),\n                 true    = rep(theta, each = k),\n                 meas    = as.vector(case2))\nred2 <- data.frame(subject = subjects, true = theta)\n
\n", "question_id": 677226, "question_license": "CC BY-SA 4.0", "question_score": 2, "question_text": "Here is a hierarchical data generating process:\n\n\n\n\n\n\n\n(Population) Layer 1: $$\\theta_i \\overset{\\text{iid}}{\\sim} \\text{Beta}(\\alpha,\\ \\beta), \\qquad i = 1, \\dots, n$$\n\n\n\n\n(Individual) Layer 2: $$y_{ij} \\mid \\theta_i \\overset{\\text{iid}}{\\sim} \\text{Bernoulli}(\\theta_i), \\qquad j = 1, \\dots, k$$\n\n\n\n\n\n\n\nThere are two cases - Case 1 is where you sample 1 observation per subject and Case 2 where you sample multiple observations per subject:\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/wine4qeY.png] (https://i.sstatic.net/wine4qeY.png)\n\n\n\n\nI am only interested in estimating the population level mean and variance. Can this still be done in Case 1?\n\n\n\n\nI am guessing that there will be no problems doing this for Case 2. For Case 1, I am guessing there won't be any problems for estimating the population level mean, but I am not sure if the population level variance can still be estimated since we do not observe variation at the individual level (regardless of whether moments are used or MLE).\n\n\n\n\n\n\n\nset.seed(42)\nn <- 20\nk <- 10\nalpha <- 3\nbeta <- 2 \nmu <- alpha / (alpha + beta) \n\nsubjects <- factor(paste(\"Subject\", 1:n), levels = paste(\"Subject\", n:1))\n\n# one theta (true probability) per subject \ntheta <- numeric(n)\nfor (i in 1:n) {\n theta[i] <- rbeta(1, alpha, beta)\n}\n\n# Case 1 \ncase1 <- numeric(n)\nfor (i in 1:n) {\n case1[i] <- rbinom(1, 1, theta[i]) \n}\n\n# Case 2 \ncase2 <- matrix(NA, nrow = k, ncol = n) \nfor (i in 1:n) {\n for (j in 1:k) {\n case2[j, i] <- rbinom(1, 1, theta[i])\n }\n}\n\nd1 <- data.frame(subject = subjects, true = theta, meas = case1)\nd2 <- data.frame(subject = rep(subjects, each = k),\n true = rep(theta, each = k),\n meas = as.vector(case2))\nred2 <- data.frame(subject = subjects, true = theta)", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "adamkostanov", "profile_url": "https://stats.stackexchange.com/users/512554/adamkostanov", "user_type": "registered"}, "created_at": "2026-09-21T00:41:19+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "C1F4E2FF-471E-47A5-928D-F6B0A4681FF3", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/C1F4E2FF-471E-47A5-928D-F6B0A4681FF3/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "kjetil b halvorsen", "profile_url": "https://stats.stackexchange.com/users/11887/kjetil-b-halvorsen", "user_type": "moderator"}, "created_at": "2026-09-21T04:23:57+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "19D572A4-437C-42C9-8FEE-FD0F08D0BE8B", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/19D572A4-437C-42C9-8FEE-FD0F08D0BE8B/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "adamkostanov", "profile_url": "https://stats.stackexchange.com/users/512554/adamkostanov", "user_type": "registered"}, "created_at": "2026-09-21T04:41:49+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "AD8437EA-1725-4DAB-8174-F56009F767F0", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/AD8437EA-1725-4DAB-8174-F56009F767F0/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-09-22T01:12:54+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "75227B37-0244-4E58-846B-06B8FB1C54FF", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/75227B37-0244-4E58-846B-06B8FB1C54FF/view-source"}], "source_site": "stats", "source_url": "https://stats.stackexchange.com/questions/677226/is-variance-still-estimable-when-you-observe-a-single-observation-per-subject", "split": "train", "split_group": "9dd25a7f286d352daa4453c364e35088a292dc3acf798487781b158dd5e6996b", "tags": ["probability", "sampling", "estimation", "mean"], "thread_id": "stats:677226", "title": "Is variance still estimable when you observe a single observation per subject?"}} {"accepted_status": [false, true], "candidate_answers": [{"answer_html": "

I would not go through mean and variance here. Your model for data generation is based on $\\alpha$ and $\\beta$ right? So why not work with them? Your population variable $\\theta$, as per your model is beta-distirbuted, so why not work with beta-likelihood? The problem is that sample variance and sample mean of a beta-distributed variable set, such as $\\{\\theta_i\\}$, are not independent variables, so you should not estimate them independently of each other.

\n

If I had a sample $\\{y_{ij}\\}$ I would estimate it like this:

\n
    \n
  1. Have variables $u$, $v$, and take $\\frac{\\alpha}{\\alpha+\\beta}=expit\\left(u\\right)=\\frac{1}{1+\\exp\\left(-u\\right)}$, $\\alpha=softplus(v)=\\log\\left(1+\\exp(v)\\right)$
  2. \n
  3. $\\sum_{j}y_{ij}=y_i\\sim BetaBinomial\\left(k, \\alpha,\\beta\\right)$
  4. \n
\n

Optimise jointly $u,v$ (maximum likelihood).

\n

So your sample size calculation would be a wrap-around for this procedure, i.e. select, $n, k$ etc. It may be slower, but not too slow with your numbers. But it will be giving correct estimates even when $\\theta$ is close to the edges for the given variance (and thus cannot be treated as normal).

\n
\n

If you want to stick to variance and mean, you should be honest with yourself and state $\\theta_i \\sim Normal\\left(\\mu,\\sigma^2\\right)$. If you get reasonable numbers, good, if not then you know your approximation is not suitable

\n", "answer_id": 677267, "answer_text": "I would not go through mean and variance here. Your model for data generation is based on $\\alpha$ and $\\beta$ right? So why not work with them? Your population variable $\\theta$, as per your model is beta-distirbuted, so why not work with beta-likelihood? The problem is that sample variance and sample mean of a beta-distributed variable set, such as $\\{\\theta_i\\}$, are not independent variables, so you should not estimate them independently of each other.\n\n\n\n\nIf I had a sample $\\{y_{ij}\\}$ I would estimate it like this:\n\n\n\n\n\nHave variables $u$, $v$, and take $\\frac{\\alpha}{\\alpha+\\beta}=expit\\left(u\\right)=\\frac{1}{1+\\exp\\left(-u\\right)}$, $\\alpha=softplus(v)=\\log\\left(1+\\exp(v)\\right)$\n\n\n\n\n$\\sum_{j}y_{ij}=y_i\\sim BetaBinomial\\left(k, \\alpha,\\beta\\right)$\n\n\n\n\n\nOptimise jointly $u,v$ (maximum likelihood).\n\n\n\n\nSo your sample size calculation would be a wrap-around for this procedure, i.e. select, $n, k$ etc. It may be slower, but not too slow with your numbers. But it will be giving correct estimates even when $\\theta$ is close to the edges for the given variance (and thus cannot be treated as normal).\n\n\n\n\n\n\n\nIf you want to stick to variance and mean, you should be honest with yourself and state $\\theta_i \\sim Normal\\left(\\mu,\\sigma^2\\right)$. If you get reasonable numbers, good, if not then you know your approximation is not suitable", "answer_url": "https://stats.stackexchange.com/a/677267", "author": "Cryo", "author_url": "https://stats.stackexchange.com/users/275239/cryo", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-26T12:24:08+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677266, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Cryo", "profile_url": "https://stats.stackexchange.com/users/275239/cryo", "user_type": "registered"}, "created_at": "2026-09-26T12:24:08+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "D52BEFB1-287A-4A8F-B3B4-FF67FD14E1AD", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/D52BEFB1-287A-4A8F-B3B4-FF67FD14E1AD/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Cryo", "profile_url": "https://stats.stackexchange.com/users/275239/cryo", "user_type": "registered"}, "created_at": "2026-09-26T12:33:54+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "24348886-EE3F-4779-9F2E-6DF7895E9D85", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/24348886-EE3F-4779-9F2E-6DF7895E9D85/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "User1865345", "profile_url": "https://stats.stackexchange.com/users/362671/user1865345", "user_type": "registered"}, "created_at": "2026-09-26T13:34:16+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "57B9D992-5586-4BC1-9973-DD3482A5AA98", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/57B9D992-5586-4BC1-9973-DD3482A5AA98/view-source"}], "score": 5, "updated_at": "2026-09-26T13:34:16+00:00"}, {"answer_html": "

I think you can find the mean and variance of $\\bar y$ analytically. Clearly $\\mathbb E[\\bar y]=\\frac{\\alpha}{\\alpha+\\beta}$ and, using the law of total variance $$\\operatorname{Var}(\\bar y) = \\frac{\\alpha \\beta}{nk(\\alpha+\\beta)^2} \\frac{\\alpha+\\beta+n}{\\alpha+\\beta+1} = \\frac{1}{nk}E[\\bar y]\\left(1-E[\\bar y]\\right) \\frac{\\alpha+\\beta+k}{\\alpha+\\beta+1}.$$

\n

Since $\\alpha\\ge 0, \\beta\\ge 0, 0 \\le E[\\bar y]\\le 1$, you can then say $$\\operatorname{Var}(\\bar y) \\le \\frac{1}{n}E[\\bar y]\\left(1-E[\\bar y]\\right) \\le \\frac1{4n}.$$

\n

For given $nk$, you will minimise $\\operatorname{Var}(\\bar y)$ when $k$ is as small as possible, i.e. when $k=1$ and $n=nk$, at which point $\\operatorname{Var}(\\bar y) = \\frac{\\alpha \\beta}{n(\\alpha+\\beta)^2}= \\frac{1}{n}E[\\bar y]\\left(1-E[\\bar y]\\right)$, again bounded above by $\\frac1{4n}$. As discussed on your previous question, having $k=1$ would make it impossible to estimate $\\alpha$ and $\\beta$ separately.

\n

So using $k=1$ together with $n$ large enough to make $\\frac1{4n}$ small enough to meet your needs as an upper bound for $\\operatorname{Var}(\\bar y)$ should work well.

\n
\n

Here is an illustrative simulation in R confirming these (with minor simulation noise) for $\\alpha=2$, $\\beta=3$ and $nk=12$

\n
yhatsim <- function(alpha, beta, n, k){\n  thetai <- rbeta(n, alpha, beta)\n  sum(rbinom(n, k, thetai)) / (n * k) \n  }\nyhat <- function(alpha, beta, n, k, cases=10^6){\n  simyhat <- replicate(cases, yhatsim(alpha, beta, n, k))\n  c(simulatedmean=mean(simyhat), \n    expectedmean=alpha/(alpha+beta), \n    simulatedvar=var(simyhat),\n    expectedvar=alpha*beta/(alpha+beta)^2*(alpha+beta+k)/(alpha+beta+1)/(n*k))\n  }\n\n\nset.seed(2026)\n\nyhat(alpha=2, beta=3, n=12, k=1)\n# simulatedmean  expectedmean  simulatedvar   expectedvar \n#     0.4000867     0.4000000     0.0199709     0.0200000 \n\nyhat(alpha=2, beta=3, n=6, k=2)\n# simulatedmean  expectedmean  simulatedvar   expectedvar \n#    0.39994625    0.40000000    0.02330732    0.02333333 \n\nyhat(alpha=2, beta=3, n=4, k=3)\n# simulatedmean  expectedmean  simulatedvar   expectedvar \n#   0.40013683    0.40000000    0.02668078    0.02666667 \n\nyhat(alpha=2, beta=3, n=3, k=4)\n# simulatedmean  expectedmean  simulatedvar   expectedvar \n#    0.39973175    0.40000000    0.03001747    0.03000000 \n\nyhat(alpha=2, beta=3, n=2, k=6)\n# simulatedmean  expectedmean  simulatedvar   expectedvar \n#    0.40039333    0.40000000    0.03666519    0.03666667 \n\nyhat(alpha=2, beta=3, n=1, k=12)\n# simulatedmean  expectedmean  simulatedvar   expectedvar \n#    0.39992283    0.40000000    0.05659828    0.05666667 \n
\n", "answer_id": 677268, "answer_text": "I think you can find the mean and variance of $\\bar y$ analytically. Clearly $\\mathbb E[\\bar y]=\\frac{\\alpha}{\\alpha+\\beta}$ and, using the law of total variance $$\\operatorname{Var}(\\bar y) = \\frac{\\alpha \\beta}{nk(\\alpha+\\beta)^2} \\frac{\\alpha+\\beta+n}{\\alpha+\\beta+1} = \\frac{1}{nk}E[\\bar y]\\left(1-E[\\bar y]\\right) \\frac{\\alpha+\\beta+k}{\\alpha+\\beta+1}.$$\n\n\n\n\nSince $\\alpha\\ge 0, \\beta\\ge 0, 0 \\le E[\\bar y]\\le 1$, you can then say $$\\operatorname{Var}(\\bar y) \\le \\frac{1}{n}E[\\bar y]\\left(1-E[\\bar y]\\right) \\le \\frac1{4n}.$$\n\n\n\n\nFor given $nk$, you will minimise $\\operatorname{Var}(\\bar y)$ when $k$ is as small as possible, i.e. when $k=1$ and $n=nk$, at which point $\\operatorname{Var}(\\bar y) = \\frac{\\alpha \\beta}{n(\\alpha+\\beta)^2}= \\frac{1}{n}E[\\bar y]\\left(1-E[\\bar y]\\right)$, again bounded above by $\\frac1{4n}$. As discussed on your previous question (https://stats.stackexchange.com/q/677226/2958), having $k=1$ would make it impossible to estimate $\\alpha$ and $\\beta$ separately.\n\n\n\n\nSo using $k=1$ together with $n$ large enough to make $\\frac1{4n}$ small enough to meet your needs as an upper bound for $\\operatorname{Var}(\\bar y)$ should work well.\n\n\n\n\n\n\n\nHere is an illustrative simulation in R confirming these (with minor simulation noise) for $\\alpha=2$, $\\beta=3$ and $nk=12$\n\n\n\n\nyhatsim <- function(alpha, beta, n, k){\n thetai <- rbeta(n, alpha, beta)\n sum(rbinom(n, k, thetai)) / (n * k) \n }\nyhat <- function(alpha, beta, n, k, cases=10^6){\n simyhat <- replicate(cases, yhatsim(alpha, beta, n, k))\n c(simulatedmean=mean(simyhat), \n expectedmean=alpha/(alpha+beta), \n simulatedvar=var(simyhat),\n expectedvar=alpha*beta/(alpha+beta)^2*(alpha+beta+k)/(alpha+beta+1)/(n*k))\n }\n\n\nset.seed(2026)\n\nyhat(alpha=2, beta=3, n=12, k=1)\n# simulatedmean expectedmean simulatedvar expectedvar \n# 0.4000867 0.4000000 0.0199709 0.0200000 \n\nyhat(alpha=2, beta=3, n=6, k=2)\n# simulatedmean expectedmean simulatedvar expectedvar \n# 0.39994625 0.40000000 0.02330732 0.02333333 \n\nyhat(alpha=2, beta=3, n=4, k=3)\n# simulatedmean expectedmean simulatedvar expectedvar \n# 0.40013683 0.40000000 0.02668078 0.02666667 \n\nyhat(alpha=2, beta=3, n=3, k=4)\n# simulatedmean expectedmean simulatedvar expectedvar \n# 0.39973175 0.40000000 0.03001747 0.03000000 \n\nyhat(alpha=2, beta=3, n=2, k=6)\n# simulatedmean expectedmean simulatedvar expectedvar \n# 0.40039333 0.40000000 0.03666519 0.03666667 \n\nyhat(alpha=2, beta=3, n=1, k=12)\n# simulatedmean expectedmean simulatedvar expectedvar \n# 0.39992283 0.40000000 0.05659828 0.05666667", "answer_url": "https://stats.stackexchange.com/a/677268", "author": "Henry", "author_url": "https://stats.stackexchange.com/users/2958/henry", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-26T14:10:23+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677266, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Henry", "profile_url": "https://stats.stackexchange.com/users/2958/henry", "user_type": "registered"}, "created_at": "2026-09-26T14:10:23+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "C96EACA9-97B0-4929-B972-DA5D20ED4759", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/C96EACA9-97B0-4929-B972-DA5D20ED4759/view-source"}], "score": 4, "updated_at": "2026-09-26T14:10:23+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "Here is a hierarchical data generating process (DGP):\n\n\n\n\n\n\n\n(Population) Layer 1: $$\\theta_i \\overset{\\text{iid}}{\\sim} \\text{Beta}(\\alpha,\\ \\beta), \\qquad i = 1, \\dots, n$$\n\n\n\n\n(Individual) Layer 2: $$y_{ij} \\mid \\theta_i \\overset{\\text{iid}}{\\sim} \\text{Bernoulli}(\\theta_i), \\qquad j = 1, \\dots, k$$\n\n\n\n\n\n\n\n$$\\mu = E[\\theta_i], \\qquad \\tau^2 = \\operatorname{Var}(\\theta_i)$$\n\n\n\n\nUsing a sample, my purpose is only to estimate the mean and the variance of the mean estimator. I want to know what values of $n$ and $k$ I should select to get good results (I know this hugely subjective) such that $nk$ is minimized (assume that increasing $n$ by 1 costs the same as increase $k$ by 1).\n\n\n\n\nAfter doing some research, it seems the best way to handle this question is by a simulation study. Assuming $\\alpha,\\ \\beta$ are known, I could sample from the DGP for different combinations of $n$ and $k$ and record the average length of the confidence intervals and average coverage rate at each combination. Since the mean estimator is unbiased regardless of the choice in $n$ or $k$, I could use average CI length and average coverage rate to make sure I am not getting a misleadingly good coverage rate at the expense of a large CI.\n\n\n\n\nHere is how I plan to do this in R (I wrote the code to focus on readability instead of speed - I use a moment based estimator and consider different true combinations of parameters):\n\n\n\n\nset.seed(2026)\n\nmu_vals <- c(0.01, 0.05, 0.15, 0.25, 0.35, 0.45, 0.55, 0.65, 0.75, 0.85, 0.95, 0.99)\nn_var <- 10\nn_vals <- c(5, 15, 30, 50, 100, 200)\nk_vals <- c(1, 2, 3, 4, 5, 6)\nR <- 2000\nconf <- 0.95\n\nscenarios <- data.frame()\n\nfor (mu in mu_vals) {\n max_var <- mu * (1 - mu)\n for (v in 1:n_var) {\n tau2 <- (v / (n_var + 1)) * max_var\n scenarios <- rbind(scenarios, data.frame(mu = mu, tau2 = tau2))\n }\n}\n\n\ncalc_mean <- function(ybar_i) {\n mean(ybar_i)\n}\n\ncalc_var_of_mean <- function(ybar_i) {\n n <- length(ybar_i)\n var(ybar_i) / n\n}\n\ncalc_coverage <- function(lower, upper, mu) {\n mean(lower <= mu & mu <= upper)\n}\n\ncalc_avg_ci_length <- function(lower, upper) {\n mean(upper - lower)\n}\n\nresults <- data.frame()\n\nfor (s in 1:nrow(scenarios)) {\n\n mu <- scenarios$mu[s]\n tau2 <- scenarios$tau2[s]\n\n alpha_plus_beta <- mu * (1 - mu) / tau2 - 1\n alpha <- mu * alpha_plus_beta\n beta <- (1 - mu) * alpha_plus_beta\n\n cat(sprintf(\"Scenario %d of %d: mu = %.2f, tau2 = %.4f\\n\",\n s, nrow(scenarios), mu, tau2))\n\n for (n in n_vals) {\n for (k in k_vals) {\n\n estimates <- numeric(R)\n var_estimates <- numeric(R)\n lower <- numeric(R)\n upper <- numeric(R)\n\n t_crit <- qt(1 - (1 - conf) / 2, df = n - 1)\n\n for (r in 1:R) {\n\n theta <- rbeta(n, alpha, beta)\n\n ybar_i <- numeric(n)\n for (i in 1:n) {\n y <- rbinom(k, size = 1, prob = theta[i])\n ybar_i[i] <- mean(y)\n }\n\n est <- calc_mean(ybar_i)\n v_est <- calc_var_of_mean(ybar_i)\n\n estimates[r] <- est\n var_estimates[r] <- v_est\n lower[r] <- est - t_crit * sqrt(v_est)\n upper[r] <- est + t_crit * sqrt(v_est)\n }\n\n true_var_of_mean <- (tau2 + (mu * (1 - mu) - tau2) / k) / n\n\n results <- rbind(results, data.frame(\n mu = mu,\n tau2 = tau2,\n n = n,\n k = k,\n avg_estimate = mean(estimates),\n true_var_of_mean = true_var_of_mean,\n sim_var_of_mean = var(estimates),\n avg_est_var_of_mean = mean(var_estimates),\n coverage = calc_coverage(lower, upper, mu),\n avg_ci_length = calc_avg_ci_length(lower, upper)\n ))\n }\n }\n}\n\n\n\n\n\nWhen visualized, the results look like this (direct upload was not working - however it seems to show that when $n$ and $k$ are both large, for many cases, we get high coverage and smaller CI lengths on average): https://imgur.com/a/tgHbtLz (https://imgur.com/a/tgHbtLz)\n\n\n\n\nThe tricky part now is to try and guess what the true value of $\\alpha,\\ \\beta$ might be. If I can get some knowledge of this beforehand (e.g. possible range), I could try to determine what $n,k$ to use if I want average CI length and average coverage rate to be within certain ranges.\n\n\n\n\nI am looking for feedback on my methodology. Should I have done this a different way?", "record_id": "Scientific-Answer-Ranking:stats:677266", "scores": [5, 4], "split": "train", "thread": {"accepted_answer_id": 677268, "answers": [{"answer_html": "

I would not go through mean and variance here. Your model for data generation is based on $\\alpha$ and $\\beta$ right? So why not work with them? Your population variable $\\theta$, as per your model is beta-distirbuted, so why not work with beta-likelihood? The problem is that sample variance and sample mean of a beta-distributed variable set, such as $\\{\\theta_i\\}$, are not independent variables, so you should not estimate them independently of each other.

\n

If I had a sample $\\{y_{ij}\\}$ I would estimate it like this:

\n
    \n
  1. Have variables $u$, $v$, and take $\\frac{\\alpha}{\\alpha+\\beta}=expit\\left(u\\right)=\\frac{1}{1+\\exp\\left(-u\\right)}$, $\\alpha=softplus(v)=\\log\\left(1+\\exp(v)\\right)$
  2. \n
  3. $\\sum_{j}y_{ij}=y_i\\sim BetaBinomial\\left(k, \\alpha,\\beta\\right)$
  4. \n
\n

Optimise jointly $u,v$ (maximum likelihood).

\n

So your sample size calculation would be a wrap-around for this procedure, i.e. select, $n, k$ etc. It may be slower, but not too slow with your numbers. But it will be giving correct estimates even when $\\theta$ is close to the edges for the given variance (and thus cannot be treated as normal).

\n
\n

If you want to stick to variance and mean, you should be honest with yourself and state $\\theta_i \\sim Normal\\left(\\mu,\\sigma^2\\right)$. If you get reasonable numbers, good, if not then you know your approximation is not suitable

\n", "answer_id": 677267, "answer_text": "I would not go through mean and variance here. Your model for data generation is based on $\\alpha$ and $\\beta$ right? So why not work with them? Your population variable $\\theta$, as per your model is beta-distirbuted, so why not work with beta-likelihood? The problem is that sample variance and sample mean of a beta-distributed variable set, such as $\\{\\theta_i\\}$, are not independent variables, so you should not estimate them independently of each other.\n\n\n\n\nIf I had a sample $\\{y_{ij}\\}$ I would estimate it like this:\n\n\n\n\n\nHave variables $u$, $v$, and take $\\frac{\\alpha}{\\alpha+\\beta}=expit\\left(u\\right)=\\frac{1}{1+\\exp\\left(-u\\right)}$, $\\alpha=softplus(v)=\\log\\left(1+\\exp(v)\\right)$\n\n\n\n\n$\\sum_{j}y_{ij}=y_i\\sim BetaBinomial\\left(k, \\alpha,\\beta\\right)$\n\n\n\n\n\nOptimise jointly $u,v$ (maximum likelihood).\n\n\n\n\nSo your sample size calculation would be a wrap-around for this procedure, i.e. select, $n, k$ etc. It may be slower, but not too slow with your numbers. But it will be giving correct estimates even when $\\theta$ is close to the edges for the given variance (and thus cannot be treated as normal).\n\n\n\n\n\n\n\nIf you want to stick to variance and mean, you should be honest with yourself and state $\\theta_i \\sim Normal\\left(\\mu,\\sigma^2\\right)$. If you get reasonable numbers, good, if not then you know your approximation is not suitable", "answer_url": "https://stats.stackexchange.com/a/677267", "author": "Cryo", "author_url": "https://stats.stackexchange.com/users/275239/cryo", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-26T12:24:08+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677266, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Cryo", "profile_url": "https://stats.stackexchange.com/users/275239/cryo", "user_type": "registered"}, "created_at": "2026-09-26T12:24:08+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "D52BEFB1-287A-4A8F-B3B4-FF67FD14E1AD", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/D52BEFB1-287A-4A8F-B3B4-FF67FD14E1AD/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Cryo", "profile_url": "https://stats.stackexchange.com/users/275239/cryo", "user_type": "registered"}, "created_at": "2026-09-26T12:33:54+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "24348886-EE3F-4779-9F2E-6DF7895E9D85", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/24348886-EE3F-4779-9F2E-6DF7895E9D85/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "User1865345", "profile_url": "https://stats.stackexchange.com/users/362671/user1865345", "user_type": "registered"}, "created_at": "2026-09-26T13:34:16+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "57B9D992-5586-4BC1-9973-DD3482A5AA98", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/57B9D992-5586-4BC1-9973-DD3482A5AA98/view-source"}], "score": 5, "updated_at": "2026-09-26T13:34:16+00:00"}, {"answer_html": "

I think you can find the mean and variance of $\\bar y$ analytically. Clearly $\\mathbb E[\\bar y]=\\frac{\\alpha}{\\alpha+\\beta}$ and, using the law of total variance $$\\operatorname{Var}(\\bar y) = \\frac{\\alpha \\beta}{nk(\\alpha+\\beta)^2} \\frac{\\alpha+\\beta+n}{\\alpha+\\beta+1} = \\frac{1}{nk}E[\\bar y]\\left(1-E[\\bar y]\\right) \\frac{\\alpha+\\beta+k}{\\alpha+\\beta+1}.$$

\n

Since $\\alpha\\ge 0, \\beta\\ge 0, 0 \\le E[\\bar y]\\le 1$, you can then say $$\\operatorname{Var}(\\bar y) \\le \\frac{1}{n}E[\\bar y]\\left(1-E[\\bar y]\\right) \\le \\frac1{4n}.$$

\n

For given $nk$, you will minimise $\\operatorname{Var}(\\bar y)$ when $k$ is as small as possible, i.e. when $k=1$ and $n=nk$, at which point $\\operatorname{Var}(\\bar y) = \\frac{\\alpha \\beta}{n(\\alpha+\\beta)^2}= \\frac{1}{n}E[\\bar y]\\left(1-E[\\bar y]\\right)$, again bounded above by $\\frac1{4n}$. As discussed on your previous question, having $k=1$ would make it impossible to estimate $\\alpha$ and $\\beta$ separately.

\n

So using $k=1$ together with $n$ large enough to make $\\frac1{4n}$ small enough to meet your needs as an upper bound for $\\operatorname{Var}(\\bar y)$ should work well.

\n
\n

Here is an illustrative simulation in R confirming these (with minor simulation noise) for $\\alpha=2$, $\\beta=3$ and $nk=12$

\n
yhatsim <- function(alpha, beta, n, k){\n  thetai <- rbeta(n, alpha, beta)\n  sum(rbinom(n, k, thetai)) / (n * k) \n  }\nyhat <- function(alpha, beta, n, k, cases=10^6){\n  simyhat <- replicate(cases, yhatsim(alpha, beta, n, k))\n  c(simulatedmean=mean(simyhat), \n    expectedmean=alpha/(alpha+beta), \n    simulatedvar=var(simyhat),\n    expectedvar=alpha*beta/(alpha+beta)^2*(alpha+beta+k)/(alpha+beta+1)/(n*k))\n  }\n\n\nset.seed(2026)\n\nyhat(alpha=2, beta=3, n=12, k=1)\n# simulatedmean  expectedmean  simulatedvar   expectedvar \n#     0.4000867     0.4000000     0.0199709     0.0200000 \n\nyhat(alpha=2, beta=3, n=6, k=2)\n# simulatedmean  expectedmean  simulatedvar   expectedvar \n#    0.39994625    0.40000000    0.02330732    0.02333333 \n\nyhat(alpha=2, beta=3, n=4, k=3)\n# simulatedmean  expectedmean  simulatedvar   expectedvar \n#   0.40013683    0.40000000    0.02668078    0.02666667 \n\nyhat(alpha=2, beta=3, n=3, k=4)\n# simulatedmean  expectedmean  simulatedvar   expectedvar \n#    0.39973175    0.40000000    0.03001747    0.03000000 \n\nyhat(alpha=2, beta=3, n=2, k=6)\n# simulatedmean  expectedmean  simulatedvar   expectedvar \n#    0.40039333    0.40000000    0.03666519    0.03666667 \n\nyhat(alpha=2, beta=3, n=1, k=12)\n# simulatedmean  expectedmean  simulatedvar   expectedvar \n#    0.39992283    0.40000000    0.05659828    0.05666667 \n
\n", "answer_id": 677268, "answer_text": "I think you can find the mean and variance of $\\bar y$ analytically. Clearly $\\mathbb E[\\bar y]=\\frac{\\alpha}{\\alpha+\\beta}$ and, using the law of total variance $$\\operatorname{Var}(\\bar y) = \\frac{\\alpha \\beta}{nk(\\alpha+\\beta)^2} \\frac{\\alpha+\\beta+n}{\\alpha+\\beta+1} = \\frac{1}{nk}E[\\bar y]\\left(1-E[\\bar y]\\right) \\frac{\\alpha+\\beta+k}{\\alpha+\\beta+1}.$$\n\n\n\n\nSince $\\alpha\\ge 0, \\beta\\ge 0, 0 \\le E[\\bar y]\\le 1$, you can then say $$\\operatorname{Var}(\\bar y) \\le \\frac{1}{n}E[\\bar y]\\left(1-E[\\bar y]\\right) \\le \\frac1{4n}.$$\n\n\n\n\nFor given $nk$, you will minimise $\\operatorname{Var}(\\bar y)$ when $k$ is as small as possible, i.e. when $k=1$ and $n=nk$, at which point $\\operatorname{Var}(\\bar y) = \\frac{\\alpha \\beta}{n(\\alpha+\\beta)^2}= \\frac{1}{n}E[\\bar y]\\left(1-E[\\bar y]\\right)$, again bounded above by $\\frac1{4n}$. As discussed on your previous question (https://stats.stackexchange.com/q/677226/2958), having $k=1$ would make it impossible to estimate $\\alpha$ and $\\beta$ separately.\n\n\n\n\nSo using $k=1$ together with $n$ large enough to make $\\frac1{4n}$ small enough to meet your needs as an upper bound for $\\operatorname{Var}(\\bar y)$ should work well.\n\n\n\n\n\n\n\nHere is an illustrative simulation in R confirming these (with minor simulation noise) for $\\alpha=2$, $\\beta=3$ and $nk=12$\n\n\n\n\nyhatsim <- function(alpha, beta, n, k){\n thetai <- rbeta(n, alpha, beta)\n sum(rbinom(n, k, thetai)) / (n * k) \n }\nyhat <- function(alpha, beta, n, k, cases=10^6){\n simyhat <- replicate(cases, yhatsim(alpha, beta, n, k))\n c(simulatedmean=mean(simyhat), \n expectedmean=alpha/(alpha+beta), \n simulatedvar=var(simyhat),\n expectedvar=alpha*beta/(alpha+beta)^2*(alpha+beta+k)/(alpha+beta+1)/(n*k))\n }\n\n\nset.seed(2026)\n\nyhat(alpha=2, beta=3, n=12, k=1)\n# simulatedmean expectedmean simulatedvar expectedvar \n# 0.4000867 0.4000000 0.0199709 0.0200000 \n\nyhat(alpha=2, beta=3, n=6, k=2)\n# simulatedmean expectedmean simulatedvar expectedvar \n# 0.39994625 0.40000000 0.02330732 0.02333333 \n\nyhat(alpha=2, beta=3, n=4, k=3)\n# simulatedmean expectedmean simulatedvar expectedvar \n# 0.40013683 0.40000000 0.02668078 0.02666667 \n\nyhat(alpha=2, beta=3, n=3, k=4)\n# simulatedmean expectedmean simulatedvar expectedvar \n# 0.39973175 0.40000000 0.03001747 0.03000000 \n\nyhat(alpha=2, beta=3, n=2, k=6)\n# simulatedmean expectedmean simulatedvar expectedvar \n# 0.40039333 0.40000000 0.03666519 0.03666667 \n\nyhat(alpha=2, beta=3, n=1, k=12)\n# simulatedmean expectedmean simulatedvar expectedvar \n# 0.39992283 0.40000000 0.05659828 0.05666667", "answer_url": "https://stats.stackexchange.com/a/677268", "author": "Henry", "author_url": "https://stats.stackexchange.com/users/2958/henry", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-26T14:10:23+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677266, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Henry", "profile_url": "https://stats.stackexchange.com/users/2958/henry", "user_type": "registered"}, "created_at": "2026-09-26T14:10:23+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "C96EACA9-97B0-4929-B972-DA5D20ED4759", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/C96EACA9-97B0-4929-B972-DA5D20ED4759/view-source"}], "score": 4, "updated_at": "2026-09-26T14:10:23+00:00"}], "domain": "statistics", "external_links": ["https://imgur.com/a/tgHbtLz"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:03.428408+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/774052c18cd9e8fa951e893347bfa3c1a85e743fc46ec4667572002cadb10cbf_1790825224163423600_0.json", "raw_sha256": "fe4dd06d3de6c0b1bb33ba88aee0ed4284118e01f76a58dcdce220a4946329b2", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "adamkostanov", "question_author_url": "https://stats.stackexchange.com/users/512554/adamkostanov", "question_author_user_type": "registered", "question_created_at": "2026-09-25T19:59:10+00:00", "question_html": "

Here is a hierarchical data generating process (DGP):

\n
\n

(Population) Layer 1: $$\\theta_i \\overset{\\text{iid}}{\\sim} \\text{Beta}(\\alpha,\\ \\beta), \\qquad i = 1, \\dots, n$$

\n

(Individual) Layer 2: $$y_{ij} \\mid \\theta_i \\overset{\\text{iid}}{\\sim} \\text{Bernoulli}(\\theta_i), \\qquad j = 1, \\dots, k$$

\n
\n

$$\\mu = E[\\theta_i], \\qquad \\tau^2 = \\operatorname{Var}(\\theta_i)$$

\n

Using a sample, my purpose is only to estimate the mean and the variance of the mean estimator. I want to know what values of $n$ and $k$ I should select to get good results (I know this hugely subjective) such that $nk$ is minimized (assume that increasing $n$ by 1 costs the same as increase $k$ by 1).

\n

After doing some research, it seems the best way to handle this question is by a simulation study. Assuming $\\alpha,\\ \\beta$ are known, I could sample from the DGP for different combinations of $n$ and $k$ and record the average length of the confidence intervals and average coverage rate at each combination. Since the mean estimator is unbiased regardless of the choice in $n$ or $k$, I could use average CI length and average coverage rate to make sure I am not getting a misleadingly good coverage rate at the expense of a large CI.

\n

Here is how I plan to do this in R (I wrote the code to focus on readability instead of speed - I use a moment based estimator and consider different true combinations of parameters):

\n
set.seed(2026)\n\nmu_vals <- c(0.01, 0.05, 0.15, 0.25, 0.35, 0.45, 0.55, 0.65, 0.75, 0.85, 0.95, 0.99)\nn_var   <- 10\nn_vals  <- c(5, 15, 30, 50, 100, 200)\nk_vals  <- c(1, 2, 3, 4, 5, 6)\nR       <- 2000\nconf    <- 0.95\n\nscenarios <- data.frame()\n\nfor (mu in mu_vals) {\n  max_var <- mu * (1 - mu)\n  for (v in 1:n_var) {\n    tau2 <- (v / (n_var + 1)) * max_var\n    scenarios <- rbind(scenarios, data.frame(mu = mu, tau2 = tau2))\n  }\n}\n\n\ncalc_mean <- function(ybar_i) {\n  mean(ybar_i)\n}\n\ncalc_var_of_mean <- function(ybar_i) {\n  n <- length(ybar_i)\n  var(ybar_i) / n\n}\n\ncalc_coverage <- function(lower, upper, mu) {\n  mean(lower <= mu & mu <= upper)\n}\n\ncalc_avg_ci_length <- function(lower, upper) {\n  mean(upper - lower)\n}\n\nresults <- data.frame()\n\nfor (s in 1:nrow(scenarios)) {\n\n  mu   <- scenarios$mu[s]\n  tau2 <- scenarios$tau2[s]\n\n  alpha_plus_beta <- mu * (1 - mu) / tau2 - 1\n  alpha <- mu * alpha_plus_beta\n  beta  <- (1 - mu) * alpha_plus_beta\n\n  cat(sprintf("Scenario %d of %d: mu = %.2f, tau2 = %.4f\\n",\n              s, nrow(scenarios), mu, tau2))\n\n  for (n in n_vals) {\n    for (k in k_vals) {\n\n      estimates     <- numeric(R)\n      var_estimates <- numeric(R)\n      lower         <- numeric(R)\n      upper         <- numeric(R)\n\n      t_crit <- qt(1 - (1 - conf) / 2, df = n - 1)\n\n      for (r in 1:R) {\n\n        theta <- rbeta(n, alpha, beta)\n\n        ybar_i <- numeric(n)\n        for (i in 1:n) {\n          y <- rbinom(k, size = 1, prob = theta[i])\n          ybar_i[i] <- mean(y)\n        }\n\n        est   <- calc_mean(ybar_i)\n        v_est <- calc_var_of_mean(ybar_i)\n\n        estimates[r]     <- est\n        var_estimates[r] <- v_est\n        lower[r]         <- est - t_crit * sqrt(v_est)\n        upper[r]         <- est + t_crit * sqrt(v_est)\n      }\n\n      true_var_of_mean <- (tau2 + (mu * (1 - mu) - tau2) / k) / n\n\n      results <- rbind(results, data.frame(\n        mu                  = mu,\n        tau2                = tau2,\n        n                   = n,\n        k                   = k,\n        avg_estimate        = mean(estimates),\n        true_var_of_mean    = true_var_of_mean,\n        sim_var_of_mean     = var(estimates),\n        avg_est_var_of_mean = mean(var_estimates),\n        coverage            = calc_coverage(lower, upper, mu),\n        avg_ci_length       = calc_avg_ci_length(lower, upper)\n      ))\n    }\n  }\n}\n
\n

When visualized, the results look like this (direct upload was not working - however it seems to show that when $n$ and $k$ are both large, for many cases, we get high coverage and smaller CI lengths on average): https://imgur.com/a/tgHbtLz

\n

The tricky part now is to try and guess what the true value of $\\alpha,\\ \\beta$ might be. If I can get some knowledge of this beforehand (e.g. possible range), I could try to determine what $n,k$ to use if I want average CI length and average coverage rate to be within certain ranges.

\n

I am looking for feedback on my methodology. Should I have done this a different way?

\n", "question_id": 677266, "question_license": "CC BY-SA 4.0", "question_score": 6, "question_text": "Here is a hierarchical data generating process (DGP):\n\n\n\n\n\n\n\n(Population) Layer 1: $$\\theta_i \\overset{\\text{iid}}{\\sim} \\text{Beta}(\\alpha,\\ \\beta), \\qquad i = 1, \\dots, n$$\n\n\n\n\n(Individual) Layer 2: $$y_{ij} \\mid \\theta_i \\overset{\\text{iid}}{\\sim} \\text{Bernoulli}(\\theta_i), \\qquad j = 1, \\dots, k$$\n\n\n\n\n\n\n\n$$\\mu = E[\\theta_i], \\qquad \\tau^2 = \\operatorname{Var}(\\theta_i)$$\n\n\n\n\nUsing a sample, my purpose is only to estimate the mean and the variance of the mean estimator. I want to know what values of $n$ and $k$ I should select to get good results (I know this hugely subjective) such that $nk$ is minimized (assume that increasing $n$ by 1 costs the same as increase $k$ by 1).\n\n\n\n\nAfter doing some research, it seems the best way to handle this question is by a simulation study. Assuming $\\alpha,\\ \\beta$ are known, I could sample from the DGP for different combinations of $n$ and $k$ and record the average length of the confidence intervals and average coverage rate at each combination. Since the mean estimator is unbiased regardless of the choice in $n$ or $k$, I could use average CI length and average coverage rate to make sure I am not getting a misleadingly good coverage rate at the expense of a large CI.\n\n\n\n\nHere is how I plan to do this in R (I wrote the code to focus on readability instead of speed - I use a moment based estimator and consider different true combinations of parameters):\n\n\n\n\nset.seed(2026)\n\nmu_vals <- c(0.01, 0.05, 0.15, 0.25, 0.35, 0.45, 0.55, 0.65, 0.75, 0.85, 0.95, 0.99)\nn_var <- 10\nn_vals <- c(5, 15, 30, 50, 100, 200)\nk_vals <- c(1, 2, 3, 4, 5, 6)\nR <- 2000\nconf <- 0.95\n\nscenarios <- data.frame()\n\nfor (mu in mu_vals) {\n max_var <- mu * (1 - mu)\n for (v in 1:n_var) {\n tau2 <- (v / (n_var + 1)) * max_var\n scenarios <- rbind(scenarios, data.frame(mu = mu, tau2 = tau2))\n }\n}\n\n\ncalc_mean <- function(ybar_i) {\n mean(ybar_i)\n}\n\ncalc_var_of_mean <- function(ybar_i) {\n n <- length(ybar_i)\n var(ybar_i) / n\n}\n\ncalc_coverage <- function(lower, upper, mu) {\n mean(lower <= mu & mu <= upper)\n}\n\ncalc_avg_ci_length <- function(lower, upper) {\n mean(upper - lower)\n}\n\nresults <- data.frame()\n\nfor (s in 1:nrow(scenarios)) {\n\n mu <- scenarios$mu[s]\n tau2 <- scenarios$tau2[s]\n\n alpha_plus_beta <- mu * (1 - mu) / tau2 - 1\n alpha <- mu * alpha_plus_beta\n beta <- (1 - mu) * alpha_plus_beta\n\n cat(sprintf(\"Scenario %d of %d: mu = %.2f, tau2 = %.4f\\n\",\n s, nrow(scenarios), mu, tau2))\n\n for (n in n_vals) {\n for (k in k_vals) {\n\n estimates <- numeric(R)\n var_estimates <- numeric(R)\n lower <- numeric(R)\n upper <- numeric(R)\n\n t_crit <- qt(1 - (1 - conf) / 2, df = n - 1)\n\n for (r in 1:R) {\n\n theta <- rbeta(n, alpha, beta)\n\n ybar_i <- numeric(n)\n for (i in 1:n) {\n y <- rbinom(k, size = 1, prob = theta[i])\n ybar_i[i] <- mean(y)\n }\n\n est <- calc_mean(ybar_i)\n v_est <- calc_var_of_mean(ybar_i)\n\n estimates[r] <- est\n var_estimates[r] <- v_est\n lower[r] <- est - t_crit * sqrt(v_est)\n upper[r] <- est + t_crit * sqrt(v_est)\n }\n\n true_var_of_mean <- (tau2 + (mu * (1 - mu) - tau2) / k) / n\n\n results <- rbind(results, data.frame(\n mu = mu,\n tau2 = tau2,\n n = n,\n k = k,\n avg_estimate = mean(estimates),\n true_var_of_mean = true_var_of_mean,\n sim_var_of_mean = var(estimates),\n avg_est_var_of_mean = mean(var_estimates),\n coverage = calc_coverage(lower, upper, mu),\n avg_ci_length = calc_avg_ci_length(lower, upper)\n ))\n }\n }\n}\n\n\n\n\n\nWhen visualized, the results look like this (direct upload was not working - however it seems to show that when $n$ and $k$ are both large, for many cases, we get high coverage and smaller CI lengths on average): https://imgur.com/a/tgHbtLz (https://imgur.com/a/tgHbtLz)\n\n\n\n\nThe tricky part now is to try and guess what the true value of $\\alpha,\\ \\beta$ might be. If I can get some knowledge of this beforehand (e.g. possible range), I could try to determine what $n,k$ to use if I want average CI length and average coverage rate to be within certain ranges.\n\n\n\n\nI am looking for feedback on my methodology. Should I have done this a different way?", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "adamkostanov", "profile_url": "https://stats.stackexchange.com/users/512554/adamkostanov", "user_type": "registered"}, "created_at": "2026-09-25T19:59:10+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "BDACA524-F3A6-491A-880E-A6871C920AE2", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/BDACA524-F3A6-491A-880E-A6871C920AE2/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "adamkostanov", "profile_url": "https://stats.stackexchange.com/users/512554/adamkostanov", "user_type": "registered"}, "created_at": "2026-09-25T20:06:02+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "AD0D55CA-D20D-43CE-AF14-F3B414CC07CC", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/AD0D55CA-D20D-43CE-AF14-F3B414CC07CC/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-09-26T14:16:51+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "33D7D8BE-907F-442F-B2B0-F7C572555835", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/33D7D8BE-907F-442F-B2B0-F7C572555835/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "adamkostanov", "profile_url": "https://stats.stackexchange.com/users/512554/adamkostanov", "user_type": "registered"}, "created_at": "2026-09-26T17:38:27+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "CAC7EE3C-CE9C-4299-BF6B-07246FC0E1C1", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/CAC7EE3C-CE9C-4299-BF6B-07246FC0E1C1/view-source"}], "source_site": "stats", "source_url": "https://stats.stackexchange.com/questions/677266/how-to-set-up-a-simulation-study", "split": "train", "split_group": "21d3364431200c413f5adef6742bd9555e0cb33cda58781dfab79e3d31d1b7fb", "tags": ["r", "sampling", "estimation"], "thread_id": "stats:677266", "title": "How to set up a simulation study?"}} {"accepted_status": [false, false], "candidate_answers": [{"answer_html": "

If the true effects are indeed homogeneous, then you will lose some efficiency by using a random-effects model, because tau^2 will be estimated to be larger than 0 in roughly 50% of the cases (hopefully not by much, but still). Of course, using the model a priori then makes a rather strong assumption, but this may be justified when the studies are very similar to begin with.

\n

However, when I teach meta-analysis, I essentially just discuss the common-effect model didactically as a stepping stone to the random-effects model. There is, however, also the fixed-effects model, which (when using weighted estimation) is fitted in the exact same way as the common-effect model, but it has a completely different interpretation and does not assume homogeneity, that is, it estimates the (weighted) average of the true effects of the $k$ studies included in a meta-analysis (i.e., it provides a conditional inference about the set of studies included in the meta-analysis). See here for further details.

\n", "answer_id": 677290, "answer_text": "If the true effects are indeed homogeneous, then you will lose some efficiency by using a random-effects model, because tau^2 will be estimated to be larger than 0 in roughly 50% of the cases (hopefully not by much, but still). Of course, using the model a priori then makes a rather strong assumption, but this may be justified when the studies are very similar to begin with.\n\n\n\n\nHowever, when I teach meta-analysis, I essentially just discuss the common-effect model didactically as a stepping stone to the random-effects model. There is, however, also the fixed-effects model, which (when using weighted estimation) is fitted in the exact same way as the common-effect model, but it has a completely different interpretation and does not assume homogeneity, that is, it estimates the (weighted) average of the true effects of the $k$ studies included in a meta-analysis (i.e., it provides a conditional inference about the set of studies included in the meta-analysis). See here (https://wviechtb.github.io/metafor/reference/misc-models.html) for further details.", "answer_url": "https://stats.stackexchange.com/a/677290", "author": "Wolfgang", "author_url": "https://stats.stackexchange.com/users/1934/wolfgang", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-28T09:54:12+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677279, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Wolfgang", "profile_url": "https://stats.stackexchange.com/users/1934/wolfgang", "user_type": "registered"}, "created_at": "2026-09-28T09:54:12+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "D79D5DD2-C98E-49F5-936B-70DC0A9ABB30", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/D79D5DD2-C98E-49F5-936B-70DC0A9ABB30/view-source"}], "score": 4, "updated_at": "2026-09-28T09:54:12+00:00"}, {"answer_html": "

There's a number of reasons and plus points for a fixed effects model. Firstly, purely didactically for teaching purpsoes, it's mathematically straightforward and it sometimes is easiest to build your intuition starting simple before adding further complexity. However, there's also good points for it in actual practice.

\n

Even when there is heterogeneity, it still provides a valid and more powerful test for whether there is a treatment effect, at all. Of course, when it's the correct model and there is just no or only not very meaningful treatment effect heterogeneity, the fixed effects model will be more efficient in terms of other things (like RMSE of the estimated treatment effect, much narrower confidence interval despite nominal coverage etc.). Where exactly the line is where it performs better is hard to say (of course you could answer that through simulation.

\n

Plus, unless you go Bayesian, it's really hard to do anything sensible in a random effects model with very few studies (good luck estimation a between trial variability from 2 or 3 studies).

\n

And let's be honest people are also very inconsistent about what they do with random effects models. E.g. what do most people seem to estimate? The inference about the mean of the random effects distribution, instead of the predictive distribution for an new unseen study. And all of that is assuming the variability between studies is a random thing that could go either way when we move to actual clinical practice, for which we are giving recommendations. In specific situations it could well be clear that it's not random. In fact, very little usually is done to explain between study variability when in fact design or study population features might very well explain differences...

\n", "answer_id": 677292, "answer_text": "There's a number of reasons and plus points for a fixed effects model. Firstly, purely didactically for teaching purpsoes, it's mathematically straightforward and it sometimes is easiest to build your intuition starting simple before adding further complexity. However, there's also good points for it in actual practice.\n\n\n\n\nEven when there is heterogeneity, it still provides a valid and more powerful test for whether there is a treatment effect, at all. Of course, when it's the correct model and there is just no or only not very meaningful treatment effect heterogeneity, the fixed effects model will be more efficient in terms of other things (like RMSE of the estimated treatment effect, much narrower confidence interval despite nominal coverage etc.). Where exactly the line is where it performs better is hard to say (of course you could answer that through simulation.\n\n\n\n\nPlus, unless you go Bayesian, it's really hard to do anything sensible in a random effects model with very few studies (good luck estimation a between trial variability from 2 or 3 studies).\n\n\n\n\nAnd let's be honest people are also very inconsistent about what they do with random effects models. E.g. what do most people seem to estimate? The inference about the mean of the random effects distribution, instead of the predictive distribution for an new unseen study. And all of that is assuming the variability between studies is a random thing that could go either way when we move to actual clinical practice, for which we are giving recommendations. In specific situations it could well be clear that it's not random. In fact, very little usually is done to explain between study variability when in fact design or study population features might very well explain differences...", "answer_url": "https://stats.stackexchange.com/a/677292", "author": "Björn", "author_url": "https://stats.stackexchange.com/users/86652/bj%c3%b6rn", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-28T17:36:50+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677279, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Björn", "profile_url": "https://stats.stackexchange.com/users/86652/bj%c3%b6rn", "user_type": "registered"}, "created_at": "2026-09-28T17:36:50+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "CCB64628-E88B-4456-94DC-CB2F955D77AE", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/CCB64628-E88B-4456-94DC-CB2F955D77AE/view-source"}], "score": 3, "updated_at": "2026-09-28T17:36:50+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "Reading the texts on this it really starts to feel like the common-effects model is some historical artifact and for some reason it is seen as a baseline that you must mentally argue against. Really to me it is starting to feel like a completely inferior model. I know roughly of the different arguments for and against the two models, and the concern that using the Q statistic to determine heterogeneity is dubious. But isn't the biggest concern: What is the point of using the common-effect model, when the random-effects reduces to common in case of no heterogeneity? Beyond a toy model is the assumption even defensible anyway? Even if the true heterogeneity was tiny, it is not zero in practice. Or is the point that we want to force it to be zero because we have strong reasons to believe so? Reading some texts it seems like authors are short of saying we should NEVER use it, and are only discussing it because some people still seem to use it.\n\n\n\n\nMy point is: Why is “common effect versus random effects” presented as a substantive modeling fork in the first place, rather than common effect being treated as a degenerate special case or a diagnostic/reference calculation?\n\n\n\n\nWhat am I missing? Or is the point simply that the common-effect model or i guess then plural effects, is to be used in say subgroup analysis?", "record_id": "Scientific-Answer-Ranking:stats:677279", "scores": [4, 3], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

If the true effects are indeed homogeneous, then you will lose some efficiency by using a random-effects model, because tau^2 will be estimated to be larger than 0 in roughly 50% of the cases (hopefully not by much, but still). Of course, using the model a priori then makes a rather strong assumption, but this may be justified when the studies are very similar to begin with.

\n

However, when I teach meta-analysis, I essentially just discuss the common-effect model didactically as a stepping stone to the random-effects model. There is, however, also the fixed-effects model, which (when using weighted estimation) is fitted in the exact same way as the common-effect model, but it has a completely different interpretation and does not assume homogeneity, that is, it estimates the (weighted) average of the true effects of the $k$ studies included in a meta-analysis (i.e., it provides a conditional inference about the set of studies included in the meta-analysis). See here for further details.

\n", "answer_id": 677290, "answer_text": "If the true effects are indeed homogeneous, then you will lose some efficiency by using a random-effects model, because tau^2 will be estimated to be larger than 0 in roughly 50% of the cases (hopefully not by much, but still). Of course, using the model a priori then makes a rather strong assumption, but this may be justified when the studies are very similar to begin with.\n\n\n\n\nHowever, when I teach meta-analysis, I essentially just discuss the common-effect model didactically as a stepping stone to the random-effects model. There is, however, also the fixed-effects model, which (when using weighted estimation) is fitted in the exact same way as the common-effect model, but it has a completely different interpretation and does not assume homogeneity, that is, it estimates the (weighted) average of the true effects of the $k$ studies included in a meta-analysis (i.e., it provides a conditional inference about the set of studies included in the meta-analysis). See here (https://wviechtb.github.io/metafor/reference/misc-models.html) for further details.", "answer_url": "https://stats.stackexchange.com/a/677290", "author": "Wolfgang", "author_url": "https://stats.stackexchange.com/users/1934/wolfgang", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-28T09:54:12+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677279, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Wolfgang", "profile_url": "https://stats.stackexchange.com/users/1934/wolfgang", "user_type": "registered"}, "created_at": "2026-09-28T09:54:12+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "D79D5DD2-C98E-49F5-936B-70DC0A9ABB30", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/D79D5DD2-C98E-49F5-936B-70DC0A9ABB30/view-source"}], "score": 4, "updated_at": "2026-09-28T09:54:12+00:00"}, {"answer_html": "

There's a number of reasons and plus points for a fixed effects model. Firstly, purely didactically for teaching purpsoes, it's mathematically straightforward and it sometimes is easiest to build your intuition starting simple before adding further complexity. However, there's also good points for it in actual practice.

\n

Even when there is heterogeneity, it still provides a valid and more powerful test for whether there is a treatment effect, at all. Of course, when it's the correct model and there is just no or only not very meaningful treatment effect heterogeneity, the fixed effects model will be more efficient in terms of other things (like RMSE of the estimated treatment effect, much narrower confidence interval despite nominal coverage etc.). Where exactly the line is where it performs better is hard to say (of course you could answer that through simulation.

\n

Plus, unless you go Bayesian, it's really hard to do anything sensible in a random effects model with very few studies (good luck estimation a between trial variability from 2 or 3 studies).

\n

And let's be honest people are also very inconsistent about what they do with random effects models. E.g. what do most people seem to estimate? The inference about the mean of the random effects distribution, instead of the predictive distribution for an new unseen study. And all of that is assuming the variability between studies is a random thing that could go either way when we move to actual clinical practice, for which we are giving recommendations. In specific situations it could well be clear that it's not random. In fact, very little usually is done to explain between study variability when in fact design or study population features might very well explain differences...

\n", "answer_id": 677292, "answer_text": "There's a number of reasons and plus points for a fixed effects model. Firstly, purely didactically for teaching purpsoes, it's mathematically straightforward and it sometimes is easiest to build your intuition starting simple before adding further complexity. However, there's also good points for it in actual practice.\n\n\n\n\nEven when there is heterogeneity, it still provides a valid and more powerful test for whether there is a treatment effect, at all. Of course, when it's the correct model and there is just no or only not very meaningful treatment effect heterogeneity, the fixed effects model will be more efficient in terms of other things (like RMSE of the estimated treatment effect, much narrower confidence interval despite nominal coverage etc.). Where exactly the line is where it performs better is hard to say (of course you could answer that through simulation.\n\n\n\n\nPlus, unless you go Bayesian, it's really hard to do anything sensible in a random effects model with very few studies (good luck estimation a between trial variability from 2 or 3 studies).\n\n\n\n\nAnd let's be honest people are also very inconsistent about what they do with random effects models. E.g. what do most people seem to estimate? The inference about the mean of the random effects distribution, instead of the predictive distribution for an new unseen study. And all of that is assuming the variability between studies is a random thing that could go either way when we move to actual clinical practice, for which we are giving recommendations. In specific situations it could well be clear that it's not random. In fact, very little usually is done to explain between study variability when in fact design or study population features might very well explain differences...", "answer_url": "https://stats.stackexchange.com/a/677292", "author": "Björn", "author_url": "https://stats.stackexchange.com/users/86652/bj%c3%b6rn", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-09-28T17:36:50+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:08.569053+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/ba8a114171cbec551f0a7f4b9f04e95c559131a62357d51e159434d4acc7183d_1790825228829630100_0.json", "raw_sha256": "a03822ca860dd0b0fb0cc402754ae4cdbaad51d18873dfd19aed56ffe1cf7ec8", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/677298;677295;677280;677279;677278;677275;677269;677266;677262;677256;677245;677243;677242;677226;677225;677217;677211;677201;677194;677193;677186;677183;677179;677177;677171;677169;677168;677151;677149;677147;677137;677135;677131;677129;677115;677110;677109;677101;677099;677098;677096;677095;677094;677085;677083;677079;677078;677075;677071;677066;677065;677062;677058;677045;677041;677035;677033;677023;677021;676999;676997;676991;676982;676981;676979;676977;676975;676971;676966;676961;676958;676956;676952;676947;676945;676937;676935;676933;676924;676922;676899;676898;676893;676889;676888;676879;676874;676873;676870;676867;676865;676858;676855;676850;676842;676832;676830;676824;676823;676821/answers?filter=withbody&order=asc&page=2&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 677279, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Björn", "profile_url": "https://stats.stackexchange.com/users/86652/bj%c3%b6rn", "user_type": "registered"}, "created_at": "2026-09-28T17:36:50+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "CCB64628-E88B-4456-94DC-CB2F955D77AE", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/CCB64628-E88B-4456-94DC-CB2F955D77AE/view-source"}], "score": 3, "updated_at": "2026-09-28T17:36:50+00:00"}], "domain": "statistics", "external_links": ["https://wviechtb.github.io/metafor/reference/misc-models.html"], "medical_sensitive": true, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:27:03.428408+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/774052c18cd9e8fa951e893347bfa3c1a85e743fc46ec4667572002cadb10cbf_1790825224163423600_0.json", "raw_sha256": "fe4dd06d3de6c0b1bb33ba88aee0ed4284118e01f76a58dcdce220a4946329b2", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=stats&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "anonim123", "question_author_url": "https://stats.stackexchange.com/users/512047/anonim123", "question_author_user_type": "registered", "question_created_at": "2026-09-27T13:43:00+00:00", "question_html": "

Reading the texts on this it really starts to feel like the common-effects model is some historical artifact and for some reason it is seen as a baseline that you must mentally argue against. Really to me it is starting to feel like a completely inferior model. I know roughly of the different arguments for and against the two models, and the concern that using the Q statistic to determine heterogeneity is dubious. But isn't the biggest concern: What is the point of using the common-effect model, when the random-effects reduces to common in case of no heterogeneity? Beyond a toy model is the assumption even defensible anyway? Even if the true heterogeneity was tiny, it is not zero in practice. Or is the point that we want to force it to be zero because we have strong reasons to believe so? Reading some texts it seems like authors are short of saying we should NEVER use it, and are only discussing it because some people still seem to use it.

\n

My point is: Why is “common effect versus random effects” presented as a substantive modeling fork in the first place, rather than common effect being treated as a degenerate special case or a diagnostic/reference calculation?

\n

What am I missing? Or is the point simply that the common-effect model or i guess then plural effects, is to be used in say subgroup analysis?

\n", "question_id": 677279, "question_license": "CC BY-SA 4.0", "question_score": 3, "question_text": "Reading the texts on this it really starts to feel like the common-effects model is some historical artifact and for some reason it is seen as a baseline that you must mentally argue against. Really to me it is starting to feel like a completely inferior model. I know roughly of the different arguments for and against the two models, and the concern that using the Q statistic to determine heterogeneity is dubious. But isn't the biggest concern: What is the point of using the common-effect model, when the random-effects reduces to common in case of no heterogeneity? Beyond a toy model is the assumption even defensible anyway? Even if the true heterogeneity was tiny, it is not zero in practice. Or is the point that we want to force it to be zero because we have strong reasons to believe so? Reading some texts it seems like authors are short of saying we should NEVER use it, and are only discussing it because some people still seem to use it.\n\n\n\n\nMy point is: Why is “common effect versus random effects” presented as a substantive modeling fork in the first place, rather than common effect being treated as a degenerate special case or a diagnostic/reference calculation?\n\n\n\n\nWhat am I missing? Or is the point simply that the common-effect model or i guess then plural effects, is to be used in say subgroup analysis?", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "anonim123", "profile_url": "https://stats.stackexchange.com/users/512047/anonim123", "user_type": "registered"}, "created_at": "2026-09-27T13:43:00+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "2F37521C-BD6B-4510-8AEC-C188AF431BE9", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/2F37521C-BD6B-4510-8AEC-C188AF431BE9/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "anonim123", "profile_url": "https://stats.stackexchange.com/users/512047/anonim123", "user_type": "registered"}, "created_at": "2026-09-27T13:50:31+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "F8AB1D75-8A0F-4AED-AD19-4921506BC4B7", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://stats.stackexchange.com/revisions/F8AB1D75-8A0F-4AED-AD19-4921506BC4B7/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-09-28T14:33:29+00:00", "raw_file": "raw/codex_api_v1/ab5f4cd7f0a10bde5970354a9b213efcc81e232042487437e8579705d4ca6a20_1790825258916612700_0.json", "raw_sha256": "4cf167c399d03b9ae013b65260fcb4e38139c42cfc70aba4807f070550c1768e", "revision_guid": "ED90A7B7-7815-4F25-A07B-31AD428A4141", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://stats.stackexchange.com/revisions/ED90A7B7-7815-4F25-A07B-31AD428A4141/view-source"}], "source_site": "stats", "source_url": "https://stats.stackexchange.com/questions/677279/what-is-even-the-point-of-the-common-effect-model-in-meta-analysis", "split": "train", "split_group": "c009a6840531627dc515fd773db2da4f7b2549a912a539c7078b96e80dba858c", "tags": ["meta-analysis"], "thread_id": "stats:677279", "title": "What is even the point of the common-effect model in meta-analysis?"}} {"accepted_status": [true, false], "candidate_answers": [{"answer_html": "

The problem is two-dimensional because it is posed on a two-dimensional manifold. Software such as deal.II (disclaimer: I'm one of the authors of this software) have no problem with solving PDEs on a manifold, making it essentially the same as if you had a flat domain. The discretization will look exactly the same, and you get a matrix that has the same properties and that consequently can be solved with the same methods.

\n", "answer_id": 45203, "answer_text": "The problem is two-dimensional because it is posed on a two-dimensional manifold. Software such as deal.II (disclaimer: I'm one of the authors of this software) have no problem with solving PDEs on a manifold, making it essentially the same as if you had a flat domain. The discretization will look exactly the same, and you get a matrix that has the same properties and that consequently can be solved with the same methods.", "answer_url": "https://scicomp.stackexchange.com/a/45203", "author": "Wolfgang Bangerth", "author_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-08-03T23:31:39+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45200, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Wolfgang Bangerth", "profile_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "user_type": "registered"}, "created_at": "2025-08-03T23:31:39+00:00", "raw_file": "raw/codex_api_v1/8b02bbba3a1a1a633af4866e7fea0bd6789190b52c4b8380b0538b5c670e7131_1790825346551636200_0.json", "raw_sha256": "33050439b68e1f78cef06bf4c2ce07c0ec45a5fdf656fa1a9efd04691108f5e0", "revision_guid": "018E2F6B-212A-4D8F-A1E5-3F3882056126", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/018E2F6B-212A-4D8F-A1E5-3F3882056126/view-source"}], "score": 5, "updated_at": "2025-08-03T23:31:39+00:00"}, {"answer_html": "

The generalization of the Laplace operator on curved surfaces is called Laplace-Beltrami operator.

\n

When working with surfaces embedded in 3D space, you're essentially dealing with a 2D problem with added geometric complexity. The discretization yields an operator matrix similar to the 2D case, but the surface geometry introduces additional challenges. The surface curvature will affect the condition number and can make it harder(comparatively) to solve. The same solvers will likely work. Preconditioning will help.

\n", "answer_id": 45206, "answer_text": "The generalization of the Laplace operator on curved surfaces is called Laplace-Beltrami operator (https://en.wikipedia.org/wiki/Laplace%E2%80%93Beltrami_operator).\n\n\n\n\nWhen working with surfaces embedded in 3D space, you're essentially dealing with a 2D problem with added geometric complexity. The discretization yields an operator matrix similar to the 2D case, but the surface geometry introduces additional challenges. The surface curvature will affect the condition number and can make it harder(comparatively) to solve. The same solvers will likely work. Preconditioning will help.", "answer_url": "https://scicomp.stackexchange.com/a/45206", "author": "Abhilash Reddy M", "author_url": "https://scicomp.stackexchange.com/users/16934/abhilash-reddy-m", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-08-04T13:57:28+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45200, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Abhilash Reddy M", "profile_url": "https://scicomp.stackexchange.com/users/16934/abhilash-reddy-m", "user_type": "registered"}, "created_at": "2025-08-04T13:57:28+00:00", "raw_file": "raw/codex_api_v1/8b02bbba3a1a1a633af4866e7fea0bd6789190b52c4b8380b0538b5c670e7131_1790825346551636200_0.json", "raw_sha256": "33050439b68e1f78cef06bf4c2ce07c0ec45a5fdf656fa1a9efd04691108f5e0", "revision_guid": "AB2BEF21-CDE1-4978-95DB-DD3D903D2B83", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/AB2BEF21-CDE1-4978-95DB-DD3D903D2B83/view-source"}], "score": 3, "updated_at": "2025-08-04T13:57:28+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I've meshed the following thin plate with a wavy topography below\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/MIJjgTpB.png] (https://i.sstatic.net/MIJjgTpB.png)\n\n\n\n\nAssume the plate has no thickness, it's effectively like a sheet of paper. I want to solve Poisson's Equation\n\n\n\n\n$$\\Delta u = -f \\\\ u|_{\\textbf{x}\\in \\partial \\Omega} = g$$\n\n\n\n\non this plate. In order to do so, there are a couple things that I need to know:\n\n\n\n\n\n\n\nWould the Laplacian for this problem be 2D or 3D? The plate undulates in the z-direction, so I'd assume it would be 3D, but I'm not sure.\n\n\n\n\n\n\n\n\n\nFor this particular problem, would this require any special solver or would any standard solver like LU factorization work? If any solver works, is there one that would work best for problems with topography?\n\n\n\n\n\n\n\n\nTo help contextualize 1, I'm using Fenicsx to approximate the solution, and the package requires identifying the correct variational/weak form of the PDE, and that requires that I know the correct original form of the PDE. 2 relates to the solver that I would have the package use.", "record_id": "Scientific-Answer-Ranking:scicomp:45200", "scores": [5, 3], "split": "train", "thread": {"accepted_answer_id": 45203, "answers": [{"answer_html": "

The problem is two-dimensional because it is posed on a two-dimensional manifold. Software such as deal.II (disclaimer: I'm one of the authors of this software) have no problem with solving PDEs on a manifold, making it essentially the same as if you had a flat domain. The discretization will look exactly the same, and you get a matrix that has the same properties and that consequently can be solved with the same methods.

\n", "answer_id": 45203, "answer_text": "The problem is two-dimensional because it is posed on a two-dimensional manifold. Software such as deal.II (disclaimer: I'm one of the authors of this software) have no problem with solving PDEs on a manifold, making it essentially the same as if you had a flat domain. The discretization will look exactly the same, and you get a matrix that has the same properties and that consequently can be solved with the same methods.", "answer_url": "https://scicomp.stackexchange.com/a/45203", "author": "Wolfgang Bangerth", "author_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-08-03T23:31:39+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45200, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Wolfgang Bangerth", "profile_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "user_type": "registered"}, "created_at": "2025-08-03T23:31:39+00:00", "raw_file": "raw/codex_api_v1/8b02bbba3a1a1a633af4866e7fea0bd6789190b52c4b8380b0538b5c670e7131_1790825346551636200_0.json", "raw_sha256": "33050439b68e1f78cef06bf4c2ce07c0ec45a5fdf656fa1a9efd04691108f5e0", "revision_guid": "018E2F6B-212A-4D8F-A1E5-3F3882056126", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/018E2F6B-212A-4D8F-A1E5-3F3882056126/view-source"}], "score": 5, "updated_at": "2025-08-03T23:31:39+00:00"}, {"answer_html": "

The generalization of the Laplace operator on curved surfaces is called Laplace-Beltrami operator.

\n

When working with surfaces embedded in 3D space, you're essentially dealing with a 2D problem with added geometric complexity. The discretization yields an operator matrix similar to the 2D case, but the surface geometry introduces additional challenges. The surface curvature will affect the condition number and can make it harder(comparatively) to solve. The same solvers will likely work. Preconditioning will help.

\n", "answer_id": 45206, "answer_text": "The generalization of the Laplace operator on curved surfaces is called Laplace-Beltrami operator (https://en.wikipedia.org/wiki/Laplace%E2%80%93Beltrami_operator).\n\n\n\n\nWhen working with surfaces embedded in 3D space, you're essentially dealing with a 2D problem with added geometric complexity. The discretization yields an operator matrix similar to the 2D case, but the surface geometry introduces additional challenges. The surface curvature will affect the condition number and can make it harder(comparatively) to solve. The same solvers will likely work. Preconditioning will help.", "answer_url": "https://scicomp.stackexchange.com/a/45206", "author": "Abhilash Reddy M", "author_url": "https://scicomp.stackexchange.com/users/16934/abhilash-reddy-m", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-08-04T13:57:28+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45200, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Abhilash Reddy M", "profile_url": "https://scicomp.stackexchange.com/users/16934/abhilash-reddy-m", "user_type": "registered"}, "created_at": "2025-08-04T13:57:28+00:00", "raw_file": "raw/codex_api_v1/8b02bbba3a1a1a633af4866e7fea0bd6789190b52c4b8380b0538b5c670e7131_1790825346551636200_0.json", "raw_sha256": "33050439b68e1f78cef06bf4c2ce07c0ec45a5fdf656fa1a9efd04691108f5e0", "revision_guid": "AB2BEF21-CDE1-4978-95DB-DD3D903D2B83", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/AB2BEF21-CDE1-4978-95DB-DD3D903D2B83/view-source"}], "score": 3, "updated_at": "2025-08-04T13:57:28+00:00"}], "domain": "computational_science", "external_links": ["https://en.wikipedia.org/wiki/Laplace%E2%80%93Beltrami_operator", "https://i.sstatic.net/MIJjgTpB.png"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:44.584971+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/272744bcc95b58699f7df6e6979b288bb8b00a80ab9c7982dbe170a6d0b63584_1790825325025901700_0.json", "raw_sha256": "27a81850a40920682c29ada76a2b55e80340a5c82764a3e9dde8a9c2ba23db4e", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Researcher R", "question_author_url": "https://scicomp.stackexchange.com/users/53321/researcher-r", "question_author_user_type": "registered", "question_created_at": "2025-08-02T22:25:43+00:00", "question_html": "

I've meshed the following thin plate with a wavy topography below

\n

\"enter

\n

Assume the plate has no thickness, it's effectively like a sheet of paper. I want to solve Poisson's Equation

\n

$$\\Delta u = -f \\\\ u|_{\\textbf{x}\\in \\partial \\Omega} = g$$

\n

on this plate. In order to do so, there are a couple things that I need to know:

\n
    \n
  1. Would the Laplacian for this problem be 2D or 3D? The plate undulates in the z-direction, so I'd assume it would be 3D, but I'm not sure.

    \n
  2. \n
  3. For this particular problem, would this require any special solver or would any standard solver like LU factorization work? If any solver works, is there one that would work best for problems with topography?

    \n
  4. \n
\n

To help contextualize 1, I'm using Fenicsx to approximate the solution, and the package requires identifying the correct variational/weak form of the PDE, and that requires that I know the correct original form of the PDE. 2 relates to the solver that I would have the package use.

\n", "question_id": 45200, "question_license": "CC BY-SA 4.0", "question_score": 2, "question_text": "I've meshed the following thin plate with a wavy topography below\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/MIJjgTpB.png] (https://i.sstatic.net/MIJjgTpB.png)\n\n\n\n\nAssume the plate has no thickness, it's effectively like a sheet of paper. I want to solve Poisson's Equation\n\n\n\n\n$$\\Delta u = -f \\\\ u|_{\\textbf{x}\\in \\partial \\Omega} = g$$\n\n\n\n\non this plate. In order to do so, there are a couple things that I need to know:\n\n\n\n\n\n\n\nWould the Laplacian for this problem be 2D or 3D? The plate undulates in the z-direction, so I'd assume it would be 3D, but I'm not sure.\n\n\n\n\n\n\n\n\n\nFor this particular problem, would this require any special solver or would any standard solver like LU factorization work? If any solver works, is there one that would work best for problems with topography?\n\n\n\n\n\n\n\n\nTo help contextualize 1, I'm using Fenicsx to approximate the solution, and the package requires identifying the correct variational/weak form of the PDE, and that requires that I know the correct original form of the PDE. 2 relates to the solver that I would have the package use.", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Researcher R", "profile_url": "https://scicomp.stackexchange.com/users/53321/researcher-r", "user_type": "registered"}, "created_at": "2025-08-02T22:25:43+00:00", "raw_file": "raw/codex_api_v1/8b02bbba3a1a1a633af4866e7fea0bd6789190b52c4b8380b0538b5c670e7131_1790825346551636200_0.json", "raw_sha256": "33050439b68e1f78cef06bf4c2ce07c0ec45a5fdf656fa1a9efd04691108f5e0", "revision_guid": "D756C7A0-4BE4-4E82-BC24-CE48DB6E4EFF", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/D756C7A0-4BE4-4E82-BC24-CE48DB6E4EFF/view-source"}], "source_site": "scicomp", "source_url": "https://scicomp.stackexchange.com/questions/45200/what-would-be-the-correct-form-of-the-pde-for-a-plate-with-topography", "split": "train", "split_group": "46c99311c5586d1c0f29b408f570f584ef24fd1d96b53817af94811eb84818ab", "tags": ["finite-element", "mesh", "laplacian", "poisson-equation"], "thread_id": "scicomp:45200", "title": "What would be the correct form of the PDE for a plate with topography?"}} {"accepted_status": [false, false], "candidate_answers": [{"answer_html": "

As a Krylov method, MINRES searches for the solution in the span of $\\{b, Ab, A^2b, \\dots, A^kb\\}$. So, if your vector $w$ is orthogonal to that span, MINRES effectively won't "see" the exceptional eigenvalue. And because the matrix is symmetric and $w$ is an eigenvector, if $b$ is orthogonal to $w$, then the entire Krylov subspace will also be orthogonal to $w$ (at least in exact arithmetic). Because $w$ is known, we can easily orthogonalize $b$ against it.

\n

So, we get the following algorithm. There are two caveats. First, I'm assuming $w$ is chosen so that $||w||_2 = 1$; if not, divide it by $||w||_2$. Second, it needs the eigenvalue, $\\lambda$, that corresponds to $w$. If you don't know it a priori, it can easily be computed as $\\lambda = ||Aw||_2 / ||w||_2$.

\n
    \n
  1. $\\alpha = w^T b$
  2. \n
  3. $b_0 = b - \\alpha w$
  4. \n
  5. Solve $Ax_0 = b_0$ for $x_0$ with your existing solver.
  6. \n
  7. $x = x_0 + \\frac{\\alpha}{\\lambda} w$
  8. \n
\n

Technically, in the finite-precision of real computers, round-off error will introduce a small component of $w$ into the Krylov subspace. However, this will be negligible in practice, particularly given the size of your $\\lambda$ compared to the other eigenvalues.

\n", "answer_id": 45209, "answer_text": "As a Krylov method, MINRES searches for the solution in the span of $\\{b, Ab, A^2b, \\dots, A^kb\\}$. So, if your vector $w$ is orthogonal to that span, MINRES effectively won't \"see\" the exceptional eigenvalue. And because the matrix is symmetric and $w$ is an eigenvector, if $b$ is orthogonal to $w$, then the entire Krylov subspace will also be orthogonal to $w$ (at least in exact arithmetic). Because $w$ is known, we can easily orthogonalize $b$ against it.\n\n\n\n\nSo, we get the following algorithm. There are two caveats. First, I'm assuming $w$ is chosen so that $||w||_2 = 1$; if not, divide it by $||w||_2$. Second, it needs the eigenvalue, $\\lambda$, that corresponds to $w$. If you don't know it a priori, it can easily be computed as $\\lambda = ||Aw||_2 / ||w||_2$.\n\n\n\n\n\n$\\alpha = w^T b$\n\n\n\n\n$b_0 = b - \\alpha w$\n\n\n\n\nSolve $Ax_0 = b_0$ for $x_0$ with your existing solver.\n\n\n\n\n$x = x_0 + \\frac{\\alpha}{\\lambda} w$\n\n\n\n\n\nTechnically, in the finite-precision of real computers, round-off error will introduce a small component of $w$ into the Krylov subspace. However, this will be negligible in practice, particularly given the size of your $\\lambda$ compared to the other eigenvalues.", "answer_url": "https://scicomp.stackexchange.com/a/45209", "author": "Neil Lindquist", "author_url": "https://scicomp.stackexchange.com/users/32895/neil-lindquist", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-08-09T00:23:23+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45208, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Neil Lindquist", "profile_url": "https://scicomp.stackexchange.com/users/32895/neil-lindquist", "user_type": "registered"}, "created_at": "2025-08-09T00:23:23+00:00", "raw_file": "raw/codex_api_v1/8b02bbba3a1a1a633af4866e7fea0bd6789190b52c4b8380b0538b5c670e7131_1790825346551636200_0.json", "raw_sha256": "33050439b68e1f78cef06bf4c2ce07c0ec45a5fdf656fa1a9efd04691108f5e0", "revision_guid": "FB6B81BC-3965-4AB2-9D6C-BEED3CEAF1A9", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/FB6B81BC-3965-4AB2-9D6C-BEED3CEAF1A9/view-source"}], "score": 8, "updated_at": "2025-08-09T00:23:23+00:00"}, {"answer_html": "

Building on @Neil Lindquist's mostly correct answer:

\n

Let's say that $w$ is the eigenvector that corresponds to the problematic eigenvalue $\\lambda$. I'll assume for simplicity that $w$ is normalized. Then let's define the projector\n$$\n P= I-ww^T\n$$\nonto the subspace that's orthogonal to $w$. You can now consider the matrix\n$$\n \\tilde A = P^T A P\n$$\nwhich is symmetric (like $A$) and which has the eigenvalue $\\lambda$ replaced by zero. You can then solve the problem\n$$\n \\tilde A \\tilde x = Pb\n$$\nand in a final step compute\n$$\n x = \\tilde x + \\frac{1}{\\lambda}ww^Tb\n$$\nwhere the correction on the right hand side is the solution of the problem on the one-dimensional subspace spanned by $w$. This generally works for iterative solvers even though $\\tilde A$ is a singular matrix with a zero eigenvalue.

\n

If you don't like this approach, you can of course instead solve\n$$\n (\\tilde A + ww^T) \\tilde x = Pb\n$$\nwhich has the exact same solution because $Pb$ is orthogonal to the subspace, and the addition $ww^T$ makes sure that the matrix on the left side is invertible (it has a unit eigenvalue instead of $\\lambda$).

\n

Preconditioners for $A$ will typically also be good preconditioners for $\\tilde A$ or $\\tilde A + ww^T$.

\n", "answer_id": 45210, "answer_text": "Building on @Neil Lindquist's mostly correct answer:\n\n\n\n\nLet's say that $w$ is the eigenvector that corresponds to the problematic eigenvalue $\\lambda$. I'll assume for simplicity that $w$ is normalized. Then let's define the projector\n$$\n P= I-ww^T\n$$\nonto the subspace that's orthogonal to $w$. You can now consider the matrix\n$$\n \\tilde A = P^T A P\n$$\nwhich is symmetric (like $A$) and which has the eigenvalue $\\lambda$ replaced by zero. You can then solve the problem\n$$\n \\tilde A \\tilde x = Pb\n$$\nand in a final step compute\n$$\n x = \\tilde x + \\frac{1}{\\lambda}ww^Tb\n$$\nwhere the correction on the right hand side is the solution of the problem on the one-dimensional subspace spanned by $w$. This generally works for iterative solvers even though $\\tilde A$ is a singular matrix with a zero eigenvalue.\n\n\n\n\nIf you don't like this approach, you can of course instead solve\n$$\n (\\tilde A + ww^T) \\tilde x = Pb\n$$\nwhich has the exact same solution because $Pb$ is orthogonal to the subspace, and the addition $ww^T$ makes sure that the matrix on the left side is invertible (it has a unit eigenvalue instead of $\\lambda$).\n\n\n\n\nPreconditioners for $A$ will typically also be good preconditioners for $\\tilde A$ or $\\tilde A + ww^T$.", "answer_url": "https://scicomp.stackexchange.com/a/45210", "author": "Wolfgang Bangerth", "author_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-08-11T00:29:17+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45208, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Wolfgang Bangerth", "profile_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "user_type": "registered"}, "created_at": "2025-08-11T00:29:17+00:00", "raw_file": "raw/codex_api_v1/8b02bbba3a1a1a633af4866e7fea0bd6789190b52c4b8380b0538b5c670e7131_1790825346551636200_0.json", "raw_sha256": "33050439b68e1f78cef06bf4c2ce07c0ec45a5fdf656fa1a9efd04691108f5e0", "revision_guid": "4F11087E-A90D-48D9-9EDE-F5E700BB5D6A", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/4F11087E-A90D-48D9-9EDE-F5E700BB5D6A/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Wolfgang Bangerth", "profile_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "user_type": "registered"}, "created_at": "2025-08-11T03:47:41+00:00", "raw_file": "raw/codex_api_v1/8b02bbba3a1a1a633af4866e7fea0bd6789190b52c4b8380b0538b5c670e7131_1790825346551636200_0.json", "raw_sha256": "33050439b68e1f78cef06bf4c2ce07c0ec45a5fdf656fa1a9efd04691108f5e0", "revision_guid": "A9AE96A8-1BEA-43C8-B884-6FB4A2E44B39", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/A9AE96A8-1BEA-43C8-B884-6FB4A2E44B39/view-source"}], "score": 4, "updated_at": "2025-08-11T03:47:41+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I have a fairly general question, which I don't think depend a lot on my particular application.\n\n\n\n\nConsider a linear system $Ax = b$ that I would like to solve with preconditioned MinRes. Call the preconditioner $P$.\n\n\n\n\nI am currently in the following situation:\n\n\n\n\n\n\n\nthe spectrum of the preconditioned system $P^{-1}A$ is very well clustered towards $1$, except only 1 eigenvalue which (depending on some parameters of the problem) is either close to $0$, or very large (around 50). Convergence of (preconditioned) MinRes is acceptable, but that outlier is clearly spoiling the quality of my solver.\n\n\n\n\n\n\n\n\n\nI can even know the subspace associated with this small eigenvalue, which is spanned by a vector $w$.\n\n\n\n\n\n\n\n\nMy question is then: are there approaches that can be applied in such a case to improve the convergence of my Krylov method? If so, I would like to change my solver to accomodate this. I am currently using an external library for my MinRes (and other iterative solvers), so implementation effort at the end of the day will also play a role!\n\n\n\n\nOf course, references are very welcome as well!", "record_id": "Scientific-Answer-Ranking:scicomp:45208", "scores": [8, 4], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

As a Krylov method, MINRES searches for the solution in the span of $\\{b, Ab, A^2b, \\dots, A^kb\\}$. So, if your vector $w$ is orthogonal to that span, MINRES effectively won't "see" the exceptional eigenvalue. And because the matrix is symmetric and $w$ is an eigenvector, if $b$ is orthogonal to $w$, then the entire Krylov subspace will also be orthogonal to $w$ (at least in exact arithmetic). Because $w$ is known, we can easily orthogonalize $b$ against it.

\n

So, we get the following algorithm. There are two caveats. First, I'm assuming $w$ is chosen so that $||w||_2 = 1$; if not, divide it by $||w||_2$. Second, it needs the eigenvalue, $\\lambda$, that corresponds to $w$. If you don't know it a priori, it can easily be computed as $\\lambda = ||Aw||_2 / ||w||_2$.

\n
    \n
  1. $\\alpha = w^T b$
  2. \n
  3. $b_0 = b - \\alpha w$
  4. \n
  5. Solve $Ax_0 = b_0$ for $x_0$ with your existing solver.
  6. \n
  7. $x = x_0 + \\frac{\\alpha}{\\lambda} w$
  8. \n
\n

Technically, in the finite-precision of real computers, round-off error will introduce a small component of $w$ into the Krylov subspace. However, this will be negligible in practice, particularly given the size of your $\\lambda$ compared to the other eigenvalues.

\n", "answer_id": 45209, "answer_text": "As a Krylov method, MINRES searches for the solution in the span of $\\{b, Ab, A^2b, \\dots, A^kb\\}$. So, if your vector $w$ is orthogonal to that span, MINRES effectively won't \"see\" the exceptional eigenvalue. And because the matrix is symmetric and $w$ is an eigenvector, if $b$ is orthogonal to $w$, then the entire Krylov subspace will also be orthogonal to $w$ (at least in exact arithmetic). Because $w$ is known, we can easily orthogonalize $b$ against it.\n\n\n\n\nSo, we get the following algorithm. There are two caveats. First, I'm assuming $w$ is chosen so that $||w||_2 = 1$; if not, divide it by $||w||_2$. Second, it needs the eigenvalue, $\\lambda$, that corresponds to $w$. If you don't know it a priori, it can easily be computed as $\\lambda = ||Aw||_2 / ||w||_2$.\n\n\n\n\n\n$\\alpha = w^T b$\n\n\n\n\n$b_0 = b - \\alpha w$\n\n\n\n\nSolve $Ax_0 = b_0$ for $x_0$ with your existing solver.\n\n\n\n\n$x = x_0 + \\frac{\\alpha}{\\lambda} w$\n\n\n\n\n\nTechnically, in the finite-precision of real computers, round-off error will introduce a small component of $w$ into the Krylov subspace. However, this will be negligible in practice, particularly given the size of your $\\lambda$ compared to the other eigenvalues.", "answer_url": "https://scicomp.stackexchange.com/a/45209", "author": "Neil Lindquist", "author_url": "https://scicomp.stackexchange.com/users/32895/neil-lindquist", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-08-09T00:23:23+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45208, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Neil Lindquist", "profile_url": "https://scicomp.stackexchange.com/users/32895/neil-lindquist", "user_type": "registered"}, "created_at": "2025-08-09T00:23:23+00:00", "raw_file": "raw/codex_api_v1/8b02bbba3a1a1a633af4866e7fea0bd6789190b52c4b8380b0538b5c670e7131_1790825346551636200_0.json", "raw_sha256": "33050439b68e1f78cef06bf4c2ce07c0ec45a5fdf656fa1a9efd04691108f5e0", "revision_guid": "FB6B81BC-3965-4AB2-9D6C-BEED3CEAF1A9", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/FB6B81BC-3965-4AB2-9D6C-BEED3CEAF1A9/view-source"}], "score": 8, "updated_at": "2025-08-09T00:23:23+00:00"}, {"answer_html": "

Building on @Neil Lindquist's mostly correct answer:

\n

Let's say that $w$ is the eigenvector that corresponds to the problematic eigenvalue $\\lambda$. I'll assume for simplicity that $w$ is normalized. Then let's define the projector\n$$\n P= I-ww^T\n$$\nonto the subspace that's orthogonal to $w$. You can now consider the matrix\n$$\n \\tilde A = P^T A P\n$$\nwhich is symmetric (like $A$) and which has the eigenvalue $\\lambda$ replaced by zero. You can then solve the problem\n$$\n \\tilde A \\tilde x = Pb\n$$\nand in a final step compute\n$$\n x = \\tilde x + \\frac{1}{\\lambda}ww^Tb\n$$\nwhere the correction on the right hand side is the solution of the problem on the one-dimensional subspace spanned by $w$. This generally works for iterative solvers even though $\\tilde A$ is a singular matrix with a zero eigenvalue.

\n

If you don't like this approach, you can of course instead solve\n$$\n (\\tilde A + ww^T) \\tilde x = Pb\n$$\nwhich has the exact same solution because $Pb$ is orthogonal to the subspace, and the addition $ww^T$ makes sure that the matrix on the left side is invertible (it has a unit eigenvalue instead of $\\lambda$).

\n

Preconditioners for $A$ will typically also be good preconditioners for $\\tilde A$ or $\\tilde A + ww^T$.

\n", "answer_id": 45210, "answer_text": "Building on @Neil Lindquist's mostly correct answer:\n\n\n\n\nLet's say that $w$ is the eigenvector that corresponds to the problematic eigenvalue $\\lambda$. I'll assume for simplicity that $w$ is normalized. Then let's define the projector\n$$\n P= I-ww^T\n$$\nonto the subspace that's orthogonal to $w$. You can now consider the matrix\n$$\n \\tilde A = P^T A P\n$$\nwhich is symmetric (like $A$) and which has the eigenvalue $\\lambda$ replaced by zero. You can then solve the problem\n$$\n \\tilde A \\tilde x = Pb\n$$\nand in a final step compute\n$$\n x = \\tilde x + \\frac{1}{\\lambda}ww^Tb\n$$\nwhere the correction on the right hand side is the solution of the problem on the one-dimensional subspace spanned by $w$. This generally works for iterative solvers even though $\\tilde A$ is a singular matrix with a zero eigenvalue.\n\n\n\n\nIf you don't like this approach, you can of course instead solve\n$$\n (\\tilde A + ww^T) \\tilde x = Pb\n$$\nwhich has the exact same solution because $Pb$ is orthogonal to the subspace, and the addition $ww^T$ makes sure that the matrix on the left side is invertible (it has a unit eigenvalue instead of $\\lambda$).\n\n\n\n\nPreconditioners for $A$ will typically also be good preconditioners for $\\tilde A$ or $\\tilde A + ww^T$.", "answer_url": "https://scicomp.stackexchange.com/a/45210", "author": "Wolfgang Bangerth", "author_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-08-11T00:29:17+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45208, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Wolfgang Bangerth", "profile_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "user_type": "registered"}, "created_at": "2025-08-11T00:29:17+00:00", "raw_file": "raw/codex_api_v1/8b02bbba3a1a1a633af4866e7fea0bd6789190b52c4b8380b0538b5c670e7131_1790825346551636200_0.json", "raw_sha256": "33050439b68e1f78cef06bf4c2ce07c0ec45a5fdf656fa1a9efd04691108f5e0", "revision_guid": "4F11087E-A90D-48D9-9EDE-F5E700BB5D6A", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/4F11087E-A90D-48D9-9EDE-F5E700BB5D6A/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Wolfgang Bangerth", "profile_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "user_type": "registered"}, "created_at": "2025-08-11T03:47:41+00:00", "raw_file": "raw/codex_api_v1/8b02bbba3a1a1a633af4866e7fea0bd6789190b52c4b8380b0538b5c670e7131_1790825346551636200_0.json", "raw_sha256": "33050439b68e1f78cef06bf4c2ce07c0ec45a5fdf656fa1a9efd04691108f5e0", "revision_guid": "A9AE96A8-1BEA-43C8-B884-6FB4A2E44B39", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/A9AE96A8-1BEA-43C8-B884-6FB4A2E44B39/view-source"}], "score": 4, "updated_at": "2025-08-11T03:47:41+00:00"}], "domain": "computational_science", "external_links": [], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:44.584971+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/272744bcc95b58699f7df6e6979b288bb8b00a80ab9c7982dbe170a6d0b63584_1790825325025901700_0.json", "raw_sha256": "27a81850a40920682c29ada76a2b55e80340a5c82764a3e9dde8a9c2ba23db4e", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "FEGirl", "question_author_url": "https://scicomp.stackexchange.com/users/33120/fegirl", "question_author_user_type": "registered", "question_created_at": "2025-08-08T19:05:26+00:00", "question_html": "

I have a fairly general question, which I don't think depend a lot on my particular application.

\n

Consider a linear system $Ax = b$ that I would like to solve with preconditioned MinRes. Call the preconditioner $P$.

\n

I am currently in the following situation:

\n
    \n
  • the spectrum of the preconditioned system $P^{-1}A$ is very well clustered towards $1$, except only 1 eigenvalue which (depending on some parameters of the problem) is either close to $0$, or very large (around 50). Convergence of (preconditioned) MinRes is acceptable, but that outlier is clearly spoiling the quality of my solver.

    \n
  • \n
  • I can even know the subspace associated with this small eigenvalue, which is spanned by a vector $w$.

    \n
  • \n
\n

My question is then: are there approaches that can be applied in such a case to improve the convergence of my Krylov method? If so, I would like to change my solver to accomodate this. I am currently using an external library for my MinRes (and other iterative solvers), so implementation effort at the end of the day will also play a role!

\n

Of course, references are very welcome as well!

\n", "question_id": 45208, "question_license": "CC BY-SA 4.0", "question_score": 7, "question_text": "I have a fairly general question, which I don't think depend a lot on my particular application.\n\n\n\n\nConsider a linear system $Ax = b$ that I would like to solve with preconditioned MinRes. Call the preconditioner $P$.\n\n\n\n\nI am currently in the following situation:\n\n\n\n\n\n\n\nthe spectrum of the preconditioned system $P^{-1}A$ is very well clustered towards $1$, except only 1 eigenvalue which (depending on some parameters of the problem) is either close to $0$, or very large (around 50). Convergence of (preconditioned) MinRes is acceptable, but that outlier is clearly spoiling the quality of my solver.\n\n\n\n\n\n\n\n\n\nI can even know the subspace associated with this small eigenvalue, which is spanned by a vector $w$.\n\n\n\n\n\n\n\n\nMy question is then: are there approaches that can be applied in such a case to improve the convergence of my Krylov method? If so, I would like to change my solver to accomodate this. I am currently using an external library for my MinRes (and other iterative solvers), so implementation effort at the end of the day will also play a role!\n\n\n\n\nOf course, references are very welcome as well!", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "FEGirl", "profile_url": "https://scicomp.stackexchange.com/users/33120/fegirl", "user_type": "registered"}, "created_at": "2025-08-08T19:05:26+00:00", "raw_file": "raw/codex_api_v1/8b02bbba3a1a1a633af4866e7fea0bd6789190b52c4b8380b0538b5c670e7131_1790825346551636200_0.json", "raw_sha256": "33050439b68e1f78cef06bf4c2ce07c0ec45a5fdf656fa1a9efd04691108f5e0", "revision_guid": "043D6E31-261C-4B0F-B5FE-50FC1D3CA2A0", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/043D6E31-261C-4B0F-B5FE-50FC1D3CA2A0/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2025-08-09T03:11:36+00:00", "raw_file": "raw/codex_api_v1/8b02bbba3a1a1a633af4866e7fea0bd6789190b52c4b8380b0538b5c670e7131_1790825346551636200_0.json", "raw_sha256": "33050439b68e1f78cef06bf4c2ce07c0ec45a5fdf656fa1a9efd04691108f5e0", "revision_guid": "34EFFF41-AB42-4483-B89E-13A7626891B3", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://scicomp.stackexchange.com/revisions/34EFFF41-AB42-4483-B89E-13A7626891B3/view-source"}], "source_site": "scicomp", "source_url": "https://scicomp.stackexchange.com/questions/45208/solving-linear-systems-with-a-clustered-spectrum-except-for-1-eigenvalue", "split": "train", "split_group": "5a658fe523f96eed9bf67d191ca026c73b51b45174ad2c46671a13fff6182527", "tags": ["finite-element", "iterative-method", "preconditioning", "krylov-method"], "thread_id": "scicomp:45208", "title": "Solving linear systems with a clustered spectrum except for 1 eigenvalue"}} {"accepted_status": [true, false], "candidate_answers": [{"answer_html": "

You are right that many physical phenomena we do computer simulations for are chaotic. There are two aspects that make such simulations meaningful:

\n
    \n
  • Chaotic systems have a time scale over which small perturbations (due to inexactly known initial conditions, or due to numerical round-off) grow to a magnitude that simulation results become meaningless. For example, for weather forecasts, that time scale is about ten days. After those ten days, no simulation can be meaningful because we don't know the initial conditions exactly, and so any inaccuracy due to these initial conditions grows to the size of large storms over this time scale. There is nothing you can do about that -- it's a property of the physical system, not of the numerical simulation. But before those ten days, simulations are meaningful, with the error dominated by initial condition knowledge and the fact that simulators do not correctly represent the physics of the real world; floating point accuracy is not a substantial source of error with double precision accuracy.

    \n
  • \n
  • For long-term simulations beyond the chaotic time scale, you cannot expect to be accurate in a "pointwise sense" (i.e., "what is the temperature going to be at this point at that time in the future"). But that doesn't mean that you can't correctly predict statistical quantities, such as the average temperature years in the future, or rainfall patterns ("how much rain does this region get over the course of a year" as opposed to "how much rain does Fort Collins, CO get on July 31 2035"). In fact, even chaotic systems oftentimes have statistical quantities that vary slowly and predictably, and these quantities can be extracted from simulations in a meaningful way.

    \n
  • \n
\n", "answer_id": 45248, "answer_text": "You are right that many physical phenomena we do computer simulations for are chaotic. There are two aspects that make such simulations meaningful:\n\n\n\n\n\n\n\nChaotic systems have a time scale over which small perturbations (due to inexactly known initial conditions, or due to numerical round-off) grow to a magnitude that simulation results become meaningless. For example, for weather forecasts, that time scale is about ten days. After those ten days, no simulation can be meaningful because we don't know the initial conditions exactly, and so any inaccuracy due to these initial conditions grows to the size of large storms over this time scale. There is nothing you can do about that -- it's a property of the physical system, not of the numerical simulation. But before those ten days, simulations are meaningful, with the error dominated by initial condition knowledge and the fact that simulators do not correctly represent the physics of the real world; floating point accuracy is not a substantial source of error with double precision accuracy.\n\n\n\n\n\n\n\n\n\nFor long-term simulations beyond the chaotic time scale, you cannot expect to be accurate in a \"pointwise sense\" (i.e., \"what is the temperature going to be at this point at that time in the future\"). But that doesn't mean that you can't correctly predict statistical quantities, such as the average temperature years in the future, or rainfall patterns (\"how much rain does this region get over the course of a year\" as opposed to \"how much rain does Fort Collins, CO get on July 31 2035\"). In fact, even chaotic systems oftentimes have statistical quantities that vary slowly and predictably, and these quantities can be extracted from simulations in a meaningful way.", "answer_url": "https://scicomp.stackexchange.com/a/45248", "author": "Wolfgang Bangerth", "author_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-10-05T18:43:01+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45247, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Wolfgang Bangerth", "profile_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "user_type": "registered"}, "created_at": "2025-10-05T18:43:01+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "C430C224-EB80-4404-ACA2-1C94B45AC662", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/C430C224-EB80-4404-ACA2-1C94B45AC662/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Wolfgang Bangerth", "profile_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "user_type": "registered"}, "created_at": "2025-10-05T20:44:17+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "40DBEF62-FFB5-4662-B702-E7A529C17CE1", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/40DBEF62-FFB5-4662-B702-E7A529C17CE1/view-source"}], "score": 8, "updated_at": "2025-10-05T20:44:17+00:00"}, {"answer_html": "

This issue (sensitivity to rounding errors in chaotic systems) can be approached by locally straightening the trajectory over very short time intervals. The idea is to adjust the solution (using a geometric transformation) so that it becomes locally linear. The fluctuations due to rounding errors are then largely absorbed by this linearisation, and they do not amplify exponentially over the interval.

\n

We have tested this idea on the Lorenz system with intervals of about Δt = 0.001. The accuracy achieved (compared to a high‑precision reference solution) is of the order of 10⁻⁷, suggesting that the method could complement classical techniques (data assimilation, ensemble methods) for short‑term predictions.

\n

Of course, this does not remove the butterfly effect, but it might help to push back the useful prediction horizon.

\n", "answer_id": 45456, "answer_text": "This issue (sensitivity to rounding errors in chaotic systems) can be approached by locally straightening the trajectory over very short time intervals. The idea is to adjust the solution (using a geometric transformation) so that it becomes locally linear. The fluctuations due to rounding errors are then largely absorbed by this linearisation, and they do not amplify exponentially over the interval.\n\n\n\n\nWe have tested this idea on the Lorenz system with intervals of about Δt = 0.001. The accuracy achieved (compared to a high‑precision reference solution) is of the order of 10⁻⁷, suggesting that the method could complement classical techniques (data assimilation, ensemble methods) for short‑term predictions.\n\n\n\n\nOf course, this does not remove the butterfly effect, but it might help to push back the useful prediction horizon.", "answer_url": "https://scicomp.stackexchange.com/a/45456", "author": "fethi gaouer", "author_url": "https://scicomp.stackexchange.com/users/56574/fethi-gaouer", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-05-19T09:42:46+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45247, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "fethi gaouer", "profile_url": "https://scicomp.stackexchange.com/users/56574/fethi-gaouer", "user_type": "registered"}, "created_at": "2026-05-19T09:42:46+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "62F5E516-724E-4995-980B-3961A5E335EF", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/62F5E516-724E-4995-980B-3961A5E335EF/view-source"}], "score": -1, "updated_at": "2026-05-19T09:42:46+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "Chaotic systems like weather models are extremely sensitive to initial conditions, and computers can only store finite precision. What algorithms or statistical techniques are used to keep results meaningful when tiny floating-point errors could cause huge divergence over time?", "record_id": "Scientific-Answer-Ranking:scicomp:45247", "scores": [8, -1], "split": "train", "thread": {"accepted_answer_id": 45248, "answers": [{"answer_html": "

You are right that many physical phenomena we do computer simulations for are chaotic. There are two aspects that make such simulations meaningful:

\n
    \n
  • Chaotic systems have a time scale over which small perturbations (due to inexactly known initial conditions, or due to numerical round-off) grow to a magnitude that simulation results become meaningless. For example, for weather forecasts, that time scale is about ten days. After those ten days, no simulation can be meaningful because we don't know the initial conditions exactly, and so any inaccuracy due to these initial conditions grows to the size of large storms over this time scale. There is nothing you can do about that -- it's a property of the physical system, not of the numerical simulation. But before those ten days, simulations are meaningful, with the error dominated by initial condition knowledge and the fact that simulators do not correctly represent the physics of the real world; floating point accuracy is not a substantial source of error with double precision accuracy.

    \n
  • \n
  • For long-term simulations beyond the chaotic time scale, you cannot expect to be accurate in a "pointwise sense" (i.e., "what is the temperature going to be at this point at that time in the future"). But that doesn't mean that you can't correctly predict statistical quantities, such as the average temperature years in the future, or rainfall patterns ("how much rain does this region get over the course of a year" as opposed to "how much rain does Fort Collins, CO get on July 31 2035"). In fact, even chaotic systems oftentimes have statistical quantities that vary slowly and predictably, and these quantities can be extracted from simulations in a meaningful way.

    \n
  • \n
\n", "answer_id": 45248, "answer_text": "You are right that many physical phenomena we do computer simulations for are chaotic. There are two aspects that make such simulations meaningful:\n\n\n\n\n\n\n\nChaotic systems have a time scale over which small perturbations (due to inexactly known initial conditions, or due to numerical round-off) grow to a magnitude that simulation results become meaningless. For example, for weather forecasts, that time scale is about ten days. After those ten days, no simulation can be meaningful because we don't know the initial conditions exactly, and so any inaccuracy due to these initial conditions grows to the size of large storms over this time scale. There is nothing you can do about that -- it's a property of the physical system, not of the numerical simulation. But before those ten days, simulations are meaningful, with the error dominated by initial condition knowledge and the fact that simulators do not correctly represent the physics of the real world; floating point accuracy is not a substantial source of error with double precision accuracy.\n\n\n\n\n\n\n\n\n\nFor long-term simulations beyond the chaotic time scale, you cannot expect to be accurate in a \"pointwise sense\" (i.e., \"what is the temperature going to be at this point at that time in the future\"). But that doesn't mean that you can't correctly predict statistical quantities, such as the average temperature years in the future, or rainfall patterns (\"how much rain does this region get over the course of a year\" as opposed to \"how much rain does Fort Collins, CO get on July 31 2035\"). In fact, even chaotic systems oftentimes have statistical quantities that vary slowly and predictably, and these quantities can be extracted from simulations in a meaningful way.", "answer_url": "https://scicomp.stackexchange.com/a/45248", "author": "Wolfgang Bangerth", "author_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-10-05T18:43:01+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45247, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Wolfgang Bangerth", "profile_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "user_type": "registered"}, "created_at": "2025-10-05T18:43:01+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "C430C224-EB80-4404-ACA2-1C94B45AC662", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/C430C224-EB80-4404-ACA2-1C94B45AC662/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Wolfgang Bangerth", "profile_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "user_type": "registered"}, "created_at": "2025-10-05T20:44:17+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "40DBEF62-FFB5-4662-B702-E7A529C17CE1", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/40DBEF62-FFB5-4662-B702-E7A529C17CE1/view-source"}], "score": 8, "updated_at": "2025-10-05T20:44:17+00:00"}, {"answer_html": "

This issue (sensitivity to rounding errors in chaotic systems) can be approached by locally straightening the trajectory over very short time intervals. The idea is to adjust the solution (using a geometric transformation) so that it becomes locally linear. The fluctuations due to rounding errors are then largely absorbed by this linearisation, and they do not amplify exponentially over the interval.

\n

We have tested this idea on the Lorenz system with intervals of about Δt = 0.001. The accuracy achieved (compared to a high‑precision reference solution) is of the order of 10⁻⁷, suggesting that the method could complement classical techniques (data assimilation, ensemble methods) for short‑term predictions.

\n

Of course, this does not remove the butterfly effect, but it might help to push back the useful prediction horizon.

\n", "answer_id": 45456, "answer_text": "This issue (sensitivity to rounding errors in chaotic systems) can be approached by locally straightening the trajectory over very short time intervals. The idea is to adjust the solution (using a geometric transformation) so that it becomes locally linear. The fluctuations due to rounding errors are then largely absorbed by this linearisation, and they do not amplify exponentially over the interval.\n\n\n\n\nWe have tested this idea on the Lorenz system with intervals of about Δt = 0.001. The accuracy achieved (compared to a high‑precision reference solution) is of the order of 10⁻⁷, suggesting that the method could complement classical techniques (data assimilation, ensemble methods) for short‑term predictions.\n\n\n\n\nOf course, this does not remove the butterfly effect, but it might help to push back the useful prediction horizon.", "answer_url": "https://scicomp.stackexchange.com/a/45456", "author": "fethi gaouer", "author_url": "https://scicomp.stackexchange.com/users/56574/fethi-gaouer", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-05-19T09:42:46+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45247, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "fethi gaouer", "profile_url": "https://scicomp.stackexchange.com/users/56574/fethi-gaouer", "user_type": "registered"}, "created_at": "2026-05-19T09:42:46+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "62F5E516-724E-4995-980B-3961A5E335EF", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/62F5E516-724E-4995-980B-3961A5E335EF/view-source"}], "score": -1, "updated_at": "2026-05-19T09:42:46+00:00"}], "domain": "computational_science", "external_links": [], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:44.584971+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/272744bcc95b58699f7df6e6979b288bb8b00a80ab9c7982dbe170a6d0b63584_1790825325025901700_0.json", "raw_sha256": "27a81850a40920682c29ada76a2b55e80340a5c82764a3e9dde8a9c2ba23db4e", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Anushka_Grace Chattopadhyay", "question_author_url": "https://scicomp.stackexchange.com/users/54728/anushka-grace-chattopadhyay", "question_author_user_type": "registered", "question_created_at": "2025-10-04T17:58:36+00:00", "question_html": "

Chaotic systems like weather models are extremely sensitive to initial conditions, and computers can only store finite precision. What algorithms or statistical techniques are used to keep results meaningful when tiny floating-point errors could cause huge divergence over time?

\n", "question_id": 45247, "question_license": "CC BY-SA 4.0", "question_score": 5, "question_text": "Chaotic systems like weather models are extremely sensitive to initial conditions, and computers can only store finite precision. What algorithms or statistical techniques are used to keep results meaningful when tiny floating-point errors could cause huge divergence over time?", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Anushka_Grace Chattopadhyay", "profile_url": "https://scicomp.stackexchange.com/users/54728/anushka-grace-chattopadhyay", "user_type": "registered"}, "created_at": "2025-10-04T17:58:36+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "ACA4A1A8-03EF-49FC-B954-989CEA350948", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/ACA4A1A8-03EF-49FC-B954-989CEA350948/view-source"}], "source_site": "scicomp", "source_url": "https://scicomp.stackexchange.com/questions/45247/how-do-large-scale-simulations-maintain-numerical-stability-when-chaotic-systems", "split": "train", "split_group": "27aa60c0e86c0eac2907e69e3f8d5d12cc89119a7e14573cb4be7206d3f29925", "tags": ["numerics", "simulation", "precision"], "thread_id": "scicomp:45247", "title": "How do large-scale simulations maintain numerical stability when chaotic systems amplify rounding errors?"}} {"accepted_status": [false, false, false, true], "candidate_answers": [{"answer_html": "

It's probably easier to not expand early and use the chain rule:

\n

$$\n\\frac{d}{dt}(m_0 \\gamma(v) v) = F\\\\\nm_0 (\\gamma(v) + \\frac{d\\gamma(v)}{dv}v ) \\frac{dv}{dt} = F\\\\\n\\frac{dv}{dt} = \\frac{F}{m_0 (\\gamma(v) + \\frac{d\\gamma(v)}{dv}v) }\n$$

\n

which gives you a nonlinear equation for the acceleration, which scipy's solve_ivp be able to deal with on its own. For the RHS code you simply use the current value for $v$.

\n", "answer_id": 45254, "answer_text": "It's probably easier to not expand early and use the chain rule:\n\n\n\n\n$$\n\\frac{d}{dt}(m_0 \\gamma(v) v) = F\\\\\nm_0 (\\gamma(v) + \\frac{d\\gamma(v)}{dv}v ) \\frac{dv}{dt} = F\\\\\n\\frac{dv}{dt} = \\frac{F}{m_0 (\\gamma(v) + \\frac{d\\gamma(v)}{dv}v) }\n$$\n\n\n\n\nwhich gives you a nonlinear equation for the acceleration, which scipy's solve_ivp be able to deal with on its own. For the RHS code you simply use the current value for $v$.", "answer_url": "https://scicomp.stackexchange.com/a/45254", "author": "niemc", "author_url": "https://scicomp.stackexchange.com/users/50632/niemc", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-10-13T23:46:28+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45253, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "niemc", "profile_url": "https://scicomp.stackexchange.com/users/50632/niemc", "user_type": "registered"}, "created_at": "2025-10-13T23:46:28+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "6D9083C7-0A09-4008-9BE4-6481D18C83B4", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/6D9083C7-0A09-4008-9BE4-6481D18C83B4/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "niemc", "profile_url": "https://scicomp.stackexchange.com/users/50632/niemc", "user_type": "registered"}, "created_at": "2025-10-14T00:10:54+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "EBB70393-5B5F-4BAC-B038-A044F80AD6E1", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/EBB70393-5B5F-4BAC-B038-A044F80AD6E1/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "niemc", "profile_url": "https://scicomp.stackexchange.com/users/50632/niemc", "user_type": "registered"}, "created_at": "2025-10-16T23:45:45+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "5C0C8B70-212D-4CFA-8CBB-2A1C7098DCE4", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/5C0C8B70-212D-4CFA-8CBB-2A1C7098DCE4/view-source"}], "score": 2, "updated_at": "2025-10-16T23:45:45+00:00"}, {"answer_html": "

The right approach -- mathematically and physically -- is to treat the momentum as the independent variable, and the velocity as the dependent one. Then you get equations that look as follows:\n$$\n \\frac{d\\mathbf p}{dt} = q(\\mathbf v(\\mathbf p) \\times B + \\mathbf E),\\\\\n \\frac{d\\mathbf x}{dt} = \\mathbf v(\\mathbf p),\n$$\nwhere now you have to express the velocity $\\mathbf v$ as a function of the momentum $\\mathbf p$. In general, this requires you to solve a nonlinear equation, but since you're only interested in the first order correction, you can just consider the first two Taylor expansion terms of $v(p)$ (the linear and quadratic term in $p$). You only have to consider the magnitudes $v,p$ of the vector velocity and momentum because they are collinear vectors.

\n", "answer_id": 45255, "answer_text": "The right approach -- mathematically and physically -- is to treat the momentum as the independent variable, and the velocity as the dependent one. Then you get equations that look as follows:\n$$\n \\frac{d\\mathbf p}{dt} = q(\\mathbf v(\\mathbf p) \\times B + \\mathbf E),\\\\\n \\frac{d\\mathbf x}{dt} = \\mathbf v(\\mathbf p),\n$$\nwhere now you have to express the velocity $\\mathbf v$ as a function of the momentum $\\mathbf p$. In general, this requires you to solve a nonlinear equation, but since you're only interested in the first order correction, you can just consider the first two Taylor expansion terms of $v(p)$ (the linear and quadratic term in $p$). You only have to consider the magnitudes $v,p$ of the vector velocity and momentum because they are collinear vectors.", "answer_url": "https://scicomp.stackexchange.com/a/45255", "author": "Wolfgang Bangerth", "author_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-10-14T00:52:29+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45253, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Wolfgang Bangerth", "profile_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "user_type": "registered"}, "created_at": "2025-10-14T00:52:29+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "39F4AB36-6991-40FB-B7CD-62FC9BCB5AEC", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/39F4AB36-6991-40FB-B7CD-62FC9BCB5AEC/view-source"}], "score": 4, "updated_at": "2025-10-14T00:52:29+00:00"}, {"answer_html": "

Making the approximation

\n

$$\n\\frac{1}{\\sqrt{1 - v^2/c^2}} \\approx\n1 + v^2/(2 c^2) =: \\gamma(v), \\qquad v^2 = \\mathbf{v} \\cdot \\mathbf{v}\n$$

\n

Applying chain rule your momentum equation is

\n

$$\n\\left( m_0 \\gamma(v) I + \\frac{m_0}{c^2} \\mathbf{v} \\mathbf{v}^\\top \\right) \\frac{d \\mathbf{v}}{d t} = \\mathbf{F}\n$$

\n

You have a 3 x 3 matrix $M(\\mathbf{v})$ on the left which is positive definite. So you get

\n

$$\n\\frac{d \\mathbf{v}}{d t} = M^{-1}(\\mathbf{v}) \\mathbf{F}(\\mathbf{v}), \\qquad\n\\frac{d \\mathbf{x}}{d t} = \\mathbf{v}\n$$

\n

If you do not make the approximation, then working with momentum $\\mathbf{p}$ is better as suggested in the other answers.

\n", "answer_id": 45256, "answer_text": "Making the approximation\n\n\n\n\n$$\n\\frac{1}{\\sqrt{1 - v^2/c^2}} \\approx\n1 + v^2/(2 c^2) =: \\gamma(v), \\qquad v^2 = \\mathbf{v} \\cdot \\mathbf{v}\n$$\n\n\n\n\nApplying chain rule your momentum equation is\n\n\n\n\n$$\n\\left( m_0 \\gamma(v) I + \\frac{m_0}{c^2} \\mathbf{v} \\mathbf{v}^\\top \\right) \\frac{d \\mathbf{v}}{d t} = \\mathbf{F}\n$$\n\n\n\n\nYou have a 3 x 3 matrix $M(\\mathbf{v})$ on the left which is positive definite. So you get\n\n\n\n\n$$\n\\frac{d \\mathbf{v}}{d t} = M^{-1}(\\mathbf{v}) \\mathbf{F}(\\mathbf{v}), \\qquad\n\\frac{d \\mathbf{x}}{d t} = \\mathbf{v}\n$$\n\n\n\n\nIf you do not make the approximation, then working with momentum $\\mathbf{p}$ is better as suggested in the other answers.", "answer_url": "https://scicomp.stackexchange.com/a/45256", "author": "cfdlab", "author_url": "https://scicomp.stackexchange.com/users/3970/cfdlab", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-10-14T05:07:43+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45253, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "cfdlab", "profile_url": "https://scicomp.stackexchange.com/users/3970/cfdlab", "user_type": "registered"}, "created_at": "2025-10-14T05:07:43+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "CA3059C5-98DC-4FDC-833F-25854E2FDE29", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/CA3059C5-98DC-4FDC-833F-25854E2FDE29/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "cfdlab", "profile_url": "https://scicomp.stackexchange.com/users/3970/cfdlab", "user_type": "registered"}, "created_at": "2025-10-17T04:40:21+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "98D07E14-937C-4C9E-96C1-27226883B70F", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/98D07E14-937C-4C9E-96C1-27226883B70F/view-source"}], "score": 5, "updated_at": "2025-10-17T04:40:21+00:00"}, {"answer_html": "

If you expand the derivative of $\\mathbf{p}$ you get\n$$\n\\frac{d\\mathbf{p}}{dt}\n= \\frac{d}{dt}\\left( m_0 \\gamma(\\mathbf{v}) \\mathbf{v} \\right)\n= m_0 \\left( \\gamma(\\mathbf{v}) \\frac{d\\mathbf{v}}{dt} + \\frac{d\\gamma(\\mathbf{v})}{dt} \\mathbf{v} \\right)\n= m_0 \\left( \\gamma(\\mathbf{v}) \\mathbf{a} + \\gamma(\\mathbf{v})^3 \\frac{\\mathbf{v}\\cdot\\mathbf{a}}{c^2} \\mathbf{v} \\right),\n$$\nwhere $\\mathbf{a}$ is the acceleration.

\n

As you can see, $\\mathbf{a}$ is multiplied by $\\mathbf{v}$ which makes it difficult, even impossible, to extract $\\mathbf{a}.$

\n

A better approach is probably to do as Wolfgang Bangerth suggests: use $\\mathbf{p}$ directly instead of trying to extract $\\mathbf{v}$. Your equations will then be\n$$\n\\begin{align}\n\\frac{d\\mathbf{p}}{dt} &= q(\\mathbf{v}\\times\\mathbf{B}+\\mathbf{E})\\\\\n\\frac{d\\mathbf{x}}{dt} &= \\mathbf{v}\n\\end{align}\n$$\nwhere $\\mathbf{v}$ is calculated from $\\mathbf{p}$ using\n$$\n\\mathbf{v} = \\frac{\\mathbf{p}}{\\sqrt{m_0^2 + \\mathbf{p}^2/c^2}}.\n$$

\n", "answer_id": 45259, "answer_text": "If you expand the derivative of $\\mathbf{p}$ you get\n$$\n\\frac{d\\mathbf{p}}{dt}\n= \\frac{d}{dt}\\left( m_0 \\gamma(\\mathbf{v}) \\mathbf{v} \\right)\n= m_0 \\left( \\gamma(\\mathbf{v}) \\frac{d\\mathbf{v}}{dt} + \\frac{d\\gamma(\\mathbf{v})}{dt} \\mathbf{v} \\right)\n= m_0 \\left( \\gamma(\\mathbf{v}) \\mathbf{a} + \\gamma(\\mathbf{v})^3 \\frac{\\mathbf{v}\\cdot\\mathbf{a}}{c^2} \\mathbf{v} \\right),\n$$\nwhere $\\mathbf{a}$ is the acceleration.\n\n\n\n\nAs you can see, $\\mathbf{a}$ is multiplied by $\\mathbf{v}$ which makes it difficult, even impossible, to extract $\\mathbf{a}.$\n\n\n\n\nA better approach is probably to do as Wolfgang Bangerth suggests: use $\\mathbf{p}$ directly instead of trying to extract $\\mathbf{v}$. Your equations will then be\n$$\n\\begin{align}\n\\frac{d\\mathbf{p}}{dt} &= q(\\mathbf{v}\\times\\mathbf{B}+\\mathbf{E})\\\\\n\\frac{d\\mathbf{x}}{dt} &= \\mathbf{v}\n\\end{align}\n$$\nwhere $\\mathbf{v}$ is calculated from $\\mathbf{p}$ using\n$$\n\\mathbf{v} = \\frac{\\mathbf{p}}{\\sqrt{m_0^2 + \\mathbf{p}^2/c^2}}.\n$$", "answer_url": "https://scicomp.stackexchange.com/a/45259", "author": "md2perpe", "author_url": "https://scicomp.stackexchange.com/users/54871/md2perpe", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-10-16T18:51:23+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45253, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "md2perpe", "profile_url": "https://scicomp.stackexchange.com/users/54871/md2perpe", "user_type": "registered"}, "created_at": "2025-10-16T18:51:23+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "A2317B6A-F5CA-4E61-975F-0AB5F92F0034", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/A2317B6A-F5CA-4E61-975F-0AB5F92F0034/view-source"}], "score": 3, "updated_at": "2025-10-16T18:51:23+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I'm numerically integrating electron trajectories through a combination of static electric and magnetic fields.\n\n\n\n\nThe classical equations of motion are trivial, but since kinetic energy may reach 20 keV ($\\gamma$ ~ 1.04) I want to include special relativity, at least including the first velocity-dependent term in an expansion.\n\n\n\n\nSince the electric fields accelerate/decelerate the particles, $\\gamma(v)$ is time-dependent.\n\n\n\n\nI believe that I should replace\n\n\n\n\n$$ m \\mathbf{a} = \\mathbf{F}$$\n\n\n\n\nwith\n\n\n\n\n$$ d\\mathbf{p}/dt = \\mathbf{F}$$\n\n\n\n\nand\n\n\n\n\n$$ \\mathbf{p} = m_0 \\gamma(v) \\mathbf{v}$$\n\n\n\n\nwhere $\\mathbf{v}$ is the velocity in my lab frame, leading to\n\n\n\n\n$$d \\ (m_0 \\gamma(v) \\mathbf{v}) \\ / \\ dt = q(\\mathbf{v} \\times \\mathbf{B} + \\mathbf{E})$$\n\n\n\n\nwhere $\\mathbf{B}, \\mathbf{E}$ are the static fields in my lab frame.\n\n\n\n\nTaking the first term in the expansion of $\\gamma(v)$, I get\n\n\n\n\n$$d \\ \\left(m_0 \\left(1 + \\frac{v^2}{2c^2} \\right) \\mathbf{v} \\right) \\ / \\ dt = q(\\mathbf{v} \\times \\mathbf{B} + \\mathbf{E}).$$\n\n\n\n\nBut here I get stuck. I've always numerically integrated the simple pair of first order equations\n\n\n\n\n$$d\\mathbf{v}/dt = \\mathbf{a}(\\mathbf{x})$$\n$$d\\mathbf{x}/dt = \\mathbf{v}$$\n\n\n\n\nand pluged those into SciPy's solve_ivp (https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.solve_ivp.html) for example.\n\n\n\n\nBut now, I don't know how to deal with the new $\\frac{v^2}{2c^2} \\mathbf{v}$ term.\n\n\n\n\nMy goal is to obtain $\\mathbf{x}(t)$ and $\\mathbf{v}(t)$ numerically, at least approximately correcting for special relativity, but I'm stuck at this point.", "record_id": "Scientific-Answer-Ranking:scicomp:45253", "scores": [2, 4, 5, 3], "split": "train", "thread": {"accepted_answer_id": 45259, "answers": [{"answer_html": "

It's probably easier to not expand early and use the chain rule:

\n

$$\n\\frac{d}{dt}(m_0 \\gamma(v) v) = F\\\\\nm_0 (\\gamma(v) + \\frac{d\\gamma(v)}{dv}v ) \\frac{dv}{dt} = F\\\\\n\\frac{dv}{dt} = \\frac{F}{m_0 (\\gamma(v) + \\frac{d\\gamma(v)}{dv}v) }\n$$

\n

which gives you a nonlinear equation for the acceleration, which scipy's solve_ivp be able to deal with on its own. For the RHS code you simply use the current value for $v$.

\n", "answer_id": 45254, "answer_text": "It's probably easier to not expand early and use the chain rule:\n\n\n\n\n$$\n\\frac{d}{dt}(m_0 \\gamma(v) v) = F\\\\\nm_0 (\\gamma(v) + \\frac{d\\gamma(v)}{dv}v ) \\frac{dv}{dt} = F\\\\\n\\frac{dv}{dt} = \\frac{F}{m_0 (\\gamma(v) + \\frac{d\\gamma(v)}{dv}v) }\n$$\n\n\n\n\nwhich gives you a nonlinear equation for the acceleration, which scipy's solve_ivp be able to deal with on its own. For the RHS code you simply use the current value for $v$.", "answer_url": "https://scicomp.stackexchange.com/a/45254", "author": "niemc", "author_url": "https://scicomp.stackexchange.com/users/50632/niemc", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-10-13T23:46:28+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45253, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "niemc", "profile_url": "https://scicomp.stackexchange.com/users/50632/niemc", "user_type": "registered"}, "created_at": "2025-10-13T23:46:28+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "6D9083C7-0A09-4008-9BE4-6481D18C83B4", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/6D9083C7-0A09-4008-9BE4-6481D18C83B4/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "niemc", "profile_url": "https://scicomp.stackexchange.com/users/50632/niemc", "user_type": "registered"}, "created_at": "2025-10-14T00:10:54+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "EBB70393-5B5F-4BAC-B038-A044F80AD6E1", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/EBB70393-5B5F-4BAC-B038-A044F80AD6E1/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "niemc", "profile_url": "https://scicomp.stackexchange.com/users/50632/niemc", "user_type": "registered"}, "created_at": "2025-10-16T23:45:45+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "5C0C8B70-212D-4CFA-8CBB-2A1C7098DCE4", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/5C0C8B70-212D-4CFA-8CBB-2A1C7098DCE4/view-source"}], "score": 2, "updated_at": "2025-10-16T23:45:45+00:00"}, {"answer_html": "

The right approach -- mathematically and physically -- is to treat the momentum as the independent variable, and the velocity as the dependent one. Then you get equations that look as follows:\n$$\n \\frac{d\\mathbf p}{dt} = q(\\mathbf v(\\mathbf p) \\times B + \\mathbf E),\\\\\n \\frac{d\\mathbf x}{dt} = \\mathbf v(\\mathbf p),\n$$\nwhere now you have to express the velocity $\\mathbf v$ as a function of the momentum $\\mathbf p$. In general, this requires you to solve a nonlinear equation, but since you're only interested in the first order correction, you can just consider the first two Taylor expansion terms of $v(p)$ (the linear and quadratic term in $p$). You only have to consider the magnitudes $v,p$ of the vector velocity and momentum because they are collinear vectors.

\n", "answer_id": 45255, "answer_text": "The right approach -- mathematically and physically -- is to treat the momentum as the independent variable, and the velocity as the dependent one. Then you get equations that look as follows:\n$$\n \\frac{d\\mathbf p}{dt} = q(\\mathbf v(\\mathbf p) \\times B + \\mathbf E),\\\\\n \\frac{d\\mathbf x}{dt} = \\mathbf v(\\mathbf p),\n$$\nwhere now you have to express the velocity $\\mathbf v$ as a function of the momentum $\\mathbf p$. In general, this requires you to solve a nonlinear equation, but since you're only interested in the first order correction, you can just consider the first two Taylor expansion terms of $v(p)$ (the linear and quadratic term in $p$). You only have to consider the magnitudes $v,p$ of the vector velocity and momentum because they are collinear vectors.", "answer_url": "https://scicomp.stackexchange.com/a/45255", "author": "Wolfgang Bangerth", "author_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-10-14T00:52:29+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45253, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Wolfgang Bangerth", "profile_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "user_type": "registered"}, "created_at": "2025-10-14T00:52:29+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "39F4AB36-6991-40FB-B7CD-62FC9BCB5AEC", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/39F4AB36-6991-40FB-B7CD-62FC9BCB5AEC/view-source"}], "score": 4, "updated_at": "2025-10-14T00:52:29+00:00"}, {"answer_html": "

Making the approximation

\n

$$\n\\frac{1}{\\sqrt{1 - v^2/c^2}} \\approx\n1 + v^2/(2 c^2) =: \\gamma(v), \\qquad v^2 = \\mathbf{v} \\cdot \\mathbf{v}\n$$

\n

Applying chain rule your momentum equation is

\n

$$\n\\left( m_0 \\gamma(v) I + \\frac{m_0}{c^2} \\mathbf{v} \\mathbf{v}^\\top \\right) \\frac{d \\mathbf{v}}{d t} = \\mathbf{F}\n$$

\n

You have a 3 x 3 matrix $M(\\mathbf{v})$ on the left which is positive definite. So you get

\n

$$\n\\frac{d \\mathbf{v}}{d t} = M^{-1}(\\mathbf{v}) \\mathbf{F}(\\mathbf{v}), \\qquad\n\\frac{d \\mathbf{x}}{d t} = \\mathbf{v}\n$$

\n

If you do not make the approximation, then working with momentum $\\mathbf{p}$ is better as suggested in the other answers.

\n", "answer_id": 45256, "answer_text": "Making the approximation\n\n\n\n\n$$\n\\frac{1}{\\sqrt{1 - v^2/c^2}} \\approx\n1 + v^2/(2 c^2) =: \\gamma(v), \\qquad v^2 = \\mathbf{v} \\cdot \\mathbf{v}\n$$\n\n\n\n\nApplying chain rule your momentum equation is\n\n\n\n\n$$\n\\left( m_0 \\gamma(v) I + \\frac{m_0}{c^2} \\mathbf{v} \\mathbf{v}^\\top \\right) \\frac{d \\mathbf{v}}{d t} = \\mathbf{F}\n$$\n\n\n\n\nYou have a 3 x 3 matrix $M(\\mathbf{v})$ on the left which is positive definite. So you get\n\n\n\n\n$$\n\\frac{d \\mathbf{v}}{d t} = M^{-1}(\\mathbf{v}) \\mathbf{F}(\\mathbf{v}), \\qquad\n\\frac{d \\mathbf{x}}{d t} = \\mathbf{v}\n$$\n\n\n\n\nIf you do not make the approximation, then working with momentum $\\mathbf{p}$ is better as suggested in the other answers.", "answer_url": "https://scicomp.stackexchange.com/a/45256", "author": "cfdlab", "author_url": "https://scicomp.stackexchange.com/users/3970/cfdlab", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-10-14T05:07:43+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45253, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "cfdlab", "profile_url": "https://scicomp.stackexchange.com/users/3970/cfdlab", "user_type": "registered"}, "created_at": "2025-10-14T05:07:43+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "CA3059C5-98DC-4FDC-833F-25854E2FDE29", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/CA3059C5-98DC-4FDC-833F-25854E2FDE29/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "cfdlab", "profile_url": "https://scicomp.stackexchange.com/users/3970/cfdlab", "user_type": "registered"}, "created_at": "2025-10-17T04:40:21+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "98D07E14-937C-4C9E-96C1-27226883B70F", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/98D07E14-937C-4C9E-96C1-27226883B70F/view-source"}], "score": 5, "updated_at": "2025-10-17T04:40:21+00:00"}, {"answer_html": "

If you expand the derivative of $\\mathbf{p}$ you get\n$$\n\\frac{d\\mathbf{p}}{dt}\n= \\frac{d}{dt}\\left( m_0 \\gamma(\\mathbf{v}) \\mathbf{v} \\right)\n= m_0 \\left( \\gamma(\\mathbf{v}) \\frac{d\\mathbf{v}}{dt} + \\frac{d\\gamma(\\mathbf{v})}{dt} \\mathbf{v} \\right)\n= m_0 \\left( \\gamma(\\mathbf{v}) \\mathbf{a} + \\gamma(\\mathbf{v})^3 \\frac{\\mathbf{v}\\cdot\\mathbf{a}}{c^2} \\mathbf{v} \\right),\n$$\nwhere $\\mathbf{a}$ is the acceleration.

\n

As you can see, $\\mathbf{a}$ is multiplied by $\\mathbf{v}$ which makes it difficult, even impossible, to extract $\\mathbf{a}.$

\n

A better approach is probably to do as Wolfgang Bangerth suggests: use $\\mathbf{p}$ directly instead of trying to extract $\\mathbf{v}$. Your equations will then be\n$$\n\\begin{align}\n\\frac{d\\mathbf{p}}{dt} &= q(\\mathbf{v}\\times\\mathbf{B}+\\mathbf{E})\\\\\n\\frac{d\\mathbf{x}}{dt} &= \\mathbf{v}\n\\end{align}\n$$\nwhere $\\mathbf{v}$ is calculated from $\\mathbf{p}$ using\n$$\n\\mathbf{v} = \\frac{\\mathbf{p}}{\\sqrt{m_0^2 + \\mathbf{p}^2/c^2}}.\n$$

\n", "answer_id": 45259, "answer_text": "If you expand the derivative of $\\mathbf{p}$ you get\n$$\n\\frac{d\\mathbf{p}}{dt}\n= \\frac{d}{dt}\\left( m_0 \\gamma(\\mathbf{v}) \\mathbf{v} \\right)\n= m_0 \\left( \\gamma(\\mathbf{v}) \\frac{d\\mathbf{v}}{dt} + \\frac{d\\gamma(\\mathbf{v})}{dt} \\mathbf{v} \\right)\n= m_0 \\left( \\gamma(\\mathbf{v}) \\mathbf{a} + \\gamma(\\mathbf{v})^3 \\frac{\\mathbf{v}\\cdot\\mathbf{a}}{c^2} \\mathbf{v} \\right),\n$$\nwhere $\\mathbf{a}$ is the acceleration.\n\n\n\n\nAs you can see, $\\mathbf{a}$ is multiplied by $\\mathbf{v}$ which makes it difficult, even impossible, to extract $\\mathbf{a}.$\n\n\n\n\nA better approach is probably to do as Wolfgang Bangerth suggests: use $\\mathbf{p}$ directly instead of trying to extract $\\mathbf{v}$. Your equations will then be\n$$\n\\begin{align}\n\\frac{d\\mathbf{p}}{dt} &= q(\\mathbf{v}\\times\\mathbf{B}+\\mathbf{E})\\\\\n\\frac{d\\mathbf{x}}{dt} &= \\mathbf{v}\n\\end{align}\n$$\nwhere $\\mathbf{v}$ is calculated from $\\mathbf{p}$ using\n$$\n\\mathbf{v} = \\frac{\\mathbf{p}}{\\sqrt{m_0^2 + \\mathbf{p}^2/c^2}}.\n$$", "answer_url": "https://scicomp.stackexchange.com/a/45259", "author": "md2perpe", "author_url": "https://scicomp.stackexchange.com/users/54871/md2perpe", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-10-16T18:51:23+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45253, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "md2perpe", "profile_url": "https://scicomp.stackexchange.com/users/54871/md2perpe", "user_type": "registered"}, "created_at": "2025-10-16T18:51:23+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "A2317B6A-F5CA-4E61-975F-0AB5F92F0034", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/A2317B6A-F5CA-4E61-975F-0AB5F92F0034/view-source"}], "score": 3, "updated_at": "2025-10-16T18:51:23+00:00"}], "domain": "computational_science", "external_links": ["https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.solve_ivp.html"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:44.584971+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/272744bcc95b58699f7df6e6979b288bb8b00a80ab9c7982dbe170a6d0b63584_1790825325025901700_0.json", "raw_sha256": "27a81850a40920682c29ada76a2b55e80340a5c82764a3e9dde8a9c2ba23db4e", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "uhoh", "question_author_url": "https://scicomp.stackexchange.com/users/17869/uhoh", "question_author_user_type": "registered", "question_created_at": "2025-10-13T22:17:47+00:00", "question_html": "

I'm numerically integrating electron trajectories through a combination of static electric and magnetic fields.

\n

The classical equations of motion are trivial, but since kinetic energy may reach 20 keV ($\\gamma$ ~ 1.04) I want to include special relativity, at least including the first velocity-dependent term in an expansion.

\n

Since the electric fields accelerate/decelerate the particles, $\\gamma(v)$ is time-dependent.

\n

I believe that I should replace

\n

$$ m \\mathbf{a} = \\mathbf{F}$$

\n

with

\n

$$ d\\mathbf{p}/dt = \\mathbf{F}$$

\n

and

\n

$$ \\mathbf{p} = m_0 \\gamma(v) \\mathbf{v}$$

\n

where $\\mathbf{v}$ is the velocity in my lab frame, leading to

\n

$$d \\ (m_0 \\gamma(v) \\mathbf{v}) \\ / \\ dt = q(\\mathbf{v} \\times \\mathbf{B} + \\mathbf{E})$$

\n

where $\\mathbf{B}, \\mathbf{E}$ are the static fields in my lab frame.

\n

Taking the first term in the expansion of $\\gamma(v)$, I get

\n

$$d \\ \\left(m_0 \\left(1 + \\frac{v^2}{2c^2} \\right) \\mathbf{v} \\right) \\ / \\ dt = q(\\mathbf{v} \\times \\mathbf{B} + \\mathbf{E}).$$

\n

But here I get stuck. I've always numerically integrated the simple pair of first order equations

\n

$$d\\mathbf{v}/dt = \\mathbf{a}(\\mathbf{x})$$\n$$d\\mathbf{x}/dt = \\mathbf{v}$$

\n

and pluged those into SciPy's solve_ivp for example.

\n

But now, I don't know how to deal with the new $\\frac{v^2}{2c^2} \\mathbf{v}$ term.

\n

My goal is to obtain $\\mathbf{x}(t)$ and $\\mathbf{v}(t)$ numerically, at least approximately correcting for special relativity, but I'm stuck at this point.

\n", "question_id": 45253, "question_license": "CC BY-SA 4.0", "question_score": 2, "question_text": "I'm numerically integrating electron trajectories through a combination of static electric and magnetic fields.\n\n\n\n\nThe classical equations of motion are trivial, but since kinetic energy may reach 20 keV ($\\gamma$ ~ 1.04) I want to include special relativity, at least including the first velocity-dependent term in an expansion.\n\n\n\n\nSince the electric fields accelerate/decelerate the particles, $\\gamma(v)$ is time-dependent.\n\n\n\n\nI believe that I should replace\n\n\n\n\n$$ m \\mathbf{a} = \\mathbf{F}$$\n\n\n\n\nwith\n\n\n\n\n$$ d\\mathbf{p}/dt = \\mathbf{F}$$\n\n\n\n\nand\n\n\n\n\n$$ \\mathbf{p} = m_0 \\gamma(v) \\mathbf{v}$$\n\n\n\n\nwhere $\\mathbf{v}$ is the velocity in my lab frame, leading to\n\n\n\n\n$$d \\ (m_0 \\gamma(v) \\mathbf{v}) \\ / \\ dt = q(\\mathbf{v} \\times \\mathbf{B} + \\mathbf{E})$$\n\n\n\n\nwhere $\\mathbf{B}, \\mathbf{E}$ are the static fields in my lab frame.\n\n\n\n\nTaking the first term in the expansion of $\\gamma(v)$, I get\n\n\n\n\n$$d \\ \\left(m_0 \\left(1 + \\frac{v^2}{2c^2} \\right) \\mathbf{v} \\right) \\ / \\ dt = q(\\mathbf{v} \\times \\mathbf{B} + \\mathbf{E}).$$\n\n\n\n\nBut here I get stuck. I've always numerically integrated the simple pair of first order equations\n\n\n\n\n$$d\\mathbf{v}/dt = \\mathbf{a}(\\mathbf{x})$$\n$$d\\mathbf{x}/dt = \\mathbf{v}$$\n\n\n\n\nand pluged those into SciPy's solve_ivp (https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.solve_ivp.html) for example.\n\n\n\n\nBut now, I don't know how to deal with the new $\\frac{v^2}{2c^2} \\mathbf{v}$ term.\n\n\n\n\nMy goal is to obtain $\\mathbf{x}(t)$ and $\\mathbf{v}(t)$ numerically, at least approximately correcting for special relativity, but I'm stuck at this point.", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "uhoh", "profile_url": "https://scicomp.stackexchange.com/users/17869/uhoh", "user_type": "registered"}, "created_at": "2025-10-13T22:17:47+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "B2278C13-546D-4C39-9B8C-DD2C4816D5FB", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/B2278C13-546D-4C39-9B8C-DD2C4816D5FB/view-source"}, {"content_license": null, "contributor": {"display_name": "uhoh", "profile_url": "https://scicomp.stackexchange.com/users/17869/uhoh", "user_type": "registered"}, "created_at": "2025-10-13T22:23:19+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "EAA9F0AF-E8FC-45AD-B178-00E2F07C219B", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/EAA9F0AF-E8FC-45AD-B178-00E2F07C219B/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "uhoh", "profile_url": "https://scicomp.stackexchange.com/users/17869/uhoh", "user_type": "registered"}, "created_at": "2025-10-13T22:54:09+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "4FB87F18-96D3-4DB7-A65C-EA303600D17C", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/4FB87F18-96D3-4DB7-A65C-EA303600D17C/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2025-10-14T06:27:37+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "D59FE4E7-AF4C-4ED1-ABE8-72669B86E76C", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://scicomp.stackexchange.com/revisions/D59FE4E7-AF4C-4ED1-ABE8-72669B86E76C/view-source"}], "source_site": "scicomp", "source_url": "https://scicomp.stackexchange.com/questions/45253/relativistic-correction-when-integrating-equations-of-motion-for-charged-particl", "split": "train", "split_group": "3528f12bce49e647d30cf687bd8292f1e3bbc8a02b72c9120876d3f66b737c74", "tags": ["differential-equations", "time-integration", "mathematica"], "thread_id": "scicomp:45253", "title": "Relativistic correction when integrating equations of motion for charged particles in static electromagnetic fields?"}} {"accepted_status": [true, false], "candidate_answers": [{"answer_html": "

Most interior point solvers for LP have an option to switch over to a simplex method. The basic solution provided in this way might meet your requirements, but you won’t have this option if you’re solving more general convex optimization problems.

\n

There are some methods for SOCP and SDP that keep complementarity throughout the sequence of solutions, but these will give you solutions that are only approximate with respect to the linear equality constraints.

\n", "answer_id": 45308, "answer_text": "Most interior point solvers for LP have an option to switch over to a simplex method. The basic solution provided in this way might meet your requirements, but you won’t have this option if you’re solving more general convex optimization problems.\n\n\n\n\nThere are some methods for SOCP and SDP that keep complementarity throughout the sequence of solutions, but these will give you solutions that are only approximate with respect to the linear equality constraints.", "answer_url": "https://scicomp.stackexchange.com/a/45308", "author": "Brian Borchers", "author_url": "https://scicomp.stackexchange.com/users/2150/brian-borchers", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-12-06T21:16:49+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45305, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Brian Borchers", "profile_url": "https://scicomp.stackexchange.com/users/2150/brian-borchers", "user_type": "registered"}, "created_at": "2025-12-06T21:16:49+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "D7085FB5-4F36-410C-8A5F-D4BC9D62D0D4", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/D7085FB5-4F36-410C-8A5F-D4BC9D62D0D4/view-source"}], "score": 4, "updated_at": "2025-12-06T21:16:49+00:00"}, {"answer_html": "

Someone already answered about how to obtain exact complementarity. I would like to point out that you would never obtain an iteration that satisfies complementarity exactly with an interior point method for LP, even if you set $\\tau=0$ at the final iteration as you mentioned.

\n

During the interior point iterations, you take steps to update $x_i\\rightarrow x_i+\\alpha\\Delta x_i$ and $s_i\\rightarrow s_i+\\alpha\\Delta s_i$. The stepsize $\\alpha$ is chosen to be as large as possible, without violating the non-negativity constraints. This means that there is a specific component $x_i$ (or $s_i$) for which $x_i+\\alpha\\Delta x_i$ is exactly zero. In general, you would scale down the value of $\\alpha$ slightly, so that all components are strictly positive and you can proceed with another iteration. Even if you decide to use the full stepsize though, you would obtain that only one component $x_i$ (or only a small subset of components) is exactly zero. It's extremely unlikely to end up in a situation where the same value of $\\alpha$ sends all (nonbasic) components of $x$ and (basic) components of $s$ to zero.

\n

Practical interior point methods for LP switch to a simplex-like strategy called crossover to recover a vertex solution.

\n", "answer_id": 45320, "answer_text": "Someone already answered about how to obtain exact complementarity. I would like to point out that you would never obtain an iteration that satisfies complementarity exactly with an interior point method for LP, even if you set $\\tau=0$ at the final iteration as you mentioned.\n\n\n\n\nDuring the interior point iterations, you take steps to update $x_i\\rightarrow x_i+\\alpha\\Delta x_i$ and $s_i\\rightarrow s_i+\\alpha\\Delta s_i$. The stepsize $\\alpha$ is chosen to be as large as possible, without violating the non-negativity constraints. This means that there is a specific component $x_i$ (or $s_i$) for which $x_i+\\alpha\\Delta x_i$ is exactly zero. In general, you would scale down the value of $\\alpha$ slightly, so that all components are strictly positive and you can proceed with another iteration. Even if you decide to use the full stepsize though, you would obtain that only one component $x_i$ (or only a small subset of components) is exactly zero. It's extremely unlikely to end up in a situation where the same value of $\\alpha$ sends all (nonbasic) components of $x$ and (basic) components of $s$ to zero.\n\n\n\n\nPractical interior point methods for LP switch to a simplex-like strategy called crossover to recover a vertex solution.", "answer_url": "https://scicomp.stackexchange.com/a/45320", "author": "filikat", "author_url": "https://scicomp.stackexchange.com/users/49357/filikat", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-12-22T13:06:19+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45305, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "filikat", "profile_url": "https://scicomp.stackexchange.com/users/49357/filikat", "user_type": "registered"}, "created_at": "2025-12-22T13:06:19+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "F887CD71-51F2-47CB-B15D-D4B6646399F4", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/F887CD71-51F2-47CB-B15D-D4B6646399F4/view-source"}], "score": 3, "updated_at": "2025-12-22T13:06:19+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "Suppose I'm solving a linear program\n$$\\begin{align}\n& \\min c^*x \\;: \\\\\n& \\quad Ax = b, x \\ge 0.\n\\end{align}$$\nIf I use an interior point method, we introduce a set of Lagrange multipliers $y$ for the equality constraint and slack variables $s \\ge 0$ for the inequality constraint.\nThe KKT conditions include the complementarity condition\n$$x_is_i = 0$$\nfor each $i$.\nAn interior point method relaxes this to\n$$x_is_i = \\tau.$$\nThe theory of interior point methods tells you that as you reduce $\\tau$ to 0, you get a sequence $x(\\tau)$ of candidate solutions that converge to the true value from inside the feasible region.\n\n\n\n\nWhat do you do if it's important to obtain a final answer that satisfies the true complementarity condition with $\\tau = 0$?\nFor the application I'm interested in, the perturbation $x_is_i = \\tau$ even for small $\\tau$ is undesirable given the way $x$ and $s$ will be used afterwards -- I really want $x_is_i = 0$.\nI'd imagine the solution is as simple as using an interior point method until the solution has almost converged and then doing one final Newton step with $\\tau = 0$.\nBut I haven't seen this discussed anywhere.\n\n\n\n\nI mention linear programming as an example.\nYou could ask the same question about more general convex programming, or linear/nonlinear complementarity problems.", "record_id": "Scientific-Answer-Ranking:scicomp:45305", "scores": [4, 3], "split": "train", "thread": {"accepted_answer_id": 45308, "answers": [{"answer_html": "

Most interior point solvers for LP have an option to switch over to a simplex method. The basic solution provided in this way might meet your requirements, but you won’t have this option if you’re solving more general convex optimization problems.

\n

There are some methods for SOCP and SDP that keep complementarity throughout the sequence of solutions, but these will give you solutions that are only approximate with respect to the linear equality constraints.

\n", "answer_id": 45308, "answer_text": "Most interior point solvers for LP have an option to switch over to a simplex method. The basic solution provided in this way might meet your requirements, but you won’t have this option if you’re solving more general convex optimization problems.\n\n\n\n\nThere are some methods for SOCP and SDP that keep complementarity throughout the sequence of solutions, but these will give you solutions that are only approximate with respect to the linear equality constraints.", "answer_url": "https://scicomp.stackexchange.com/a/45308", "author": "Brian Borchers", "author_url": "https://scicomp.stackexchange.com/users/2150/brian-borchers", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-12-06T21:16:49+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45305, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Brian Borchers", "profile_url": "https://scicomp.stackexchange.com/users/2150/brian-borchers", "user_type": "registered"}, "created_at": "2025-12-06T21:16:49+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "D7085FB5-4F36-410C-8A5F-D4BC9D62D0D4", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/D7085FB5-4F36-410C-8A5F-D4BC9D62D0D4/view-source"}], "score": 4, "updated_at": "2025-12-06T21:16:49+00:00"}, {"answer_html": "

Someone already answered about how to obtain exact complementarity. I would like to point out that you would never obtain an iteration that satisfies complementarity exactly with an interior point method for LP, even if you set $\\tau=0$ at the final iteration as you mentioned.

\n

During the interior point iterations, you take steps to update $x_i\\rightarrow x_i+\\alpha\\Delta x_i$ and $s_i\\rightarrow s_i+\\alpha\\Delta s_i$. The stepsize $\\alpha$ is chosen to be as large as possible, without violating the non-negativity constraints. This means that there is a specific component $x_i$ (or $s_i$) for which $x_i+\\alpha\\Delta x_i$ is exactly zero. In general, you would scale down the value of $\\alpha$ slightly, so that all components are strictly positive and you can proceed with another iteration. Even if you decide to use the full stepsize though, you would obtain that only one component $x_i$ (or only a small subset of components) is exactly zero. It's extremely unlikely to end up in a situation where the same value of $\\alpha$ sends all (nonbasic) components of $x$ and (basic) components of $s$ to zero.

\n

Practical interior point methods for LP switch to a simplex-like strategy called crossover to recover a vertex solution.

\n", "answer_id": 45320, "answer_text": "Someone already answered about how to obtain exact complementarity. I would like to point out that you would never obtain an iteration that satisfies complementarity exactly with an interior point method for LP, even if you set $\\tau=0$ at the final iteration as you mentioned.\n\n\n\n\nDuring the interior point iterations, you take steps to update $x_i\\rightarrow x_i+\\alpha\\Delta x_i$ and $s_i\\rightarrow s_i+\\alpha\\Delta s_i$. The stepsize $\\alpha$ is chosen to be as large as possible, without violating the non-negativity constraints. This means that there is a specific component $x_i$ (or $s_i$) for which $x_i+\\alpha\\Delta x_i$ is exactly zero. In general, you would scale down the value of $\\alpha$ slightly, so that all components are strictly positive and you can proceed with another iteration. Even if you decide to use the full stepsize though, you would obtain that only one component $x_i$ (or only a small subset of components) is exactly zero. It's extremely unlikely to end up in a situation where the same value of $\\alpha$ sends all (nonbasic) components of $x$ and (basic) components of $s$ to zero.\n\n\n\n\nPractical interior point methods for LP switch to a simplex-like strategy called crossover to recover a vertex solution.", "answer_url": "https://scicomp.stackexchange.com/a/45320", "author": "filikat", "author_url": "https://scicomp.stackexchange.com/users/49357/filikat", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-12-22T13:06:19+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45305, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "filikat", "profile_url": "https://scicomp.stackexchange.com/users/49357/filikat", "user_type": "registered"}, "created_at": "2025-12-22T13:06:19+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "F887CD71-51F2-47CB-B15D-D4B6646399F4", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/F887CD71-51F2-47CB-B15D-D4B6646399F4/view-source"}], "score": 3, "updated_at": "2025-12-22T13:06:19+00:00"}], "domain": "computational_science", "external_links": [], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:44.584971+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/272744bcc95b58699f7df6e6979b288bb8b00a80ab9c7982dbe170a6d0b63584_1790825325025901700_0.json", "raw_sha256": "27a81850a40920682c29ada76a2b55e80340a5c82764a3e9dde8a9c2ba23db4e", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Daniel Shapero", "question_author_url": "https://scicomp.stackexchange.com/users/3481/daniel-shapero", "question_author_user_type": "registered", "question_created_at": "2025-12-03T18:04:17+00:00", "question_html": "

Suppose I'm solving a linear program\n$$\\begin{align}\n& \\min c^*x \\;: \\\\\n& \\quad Ax = b, x \\ge 0.\n\\end{align}$$\nIf I use an interior point method, we introduce a set of Lagrange multipliers $y$ for the equality constraint and slack variables $s \\ge 0$ for the inequality constraint.\nThe KKT conditions include the complementarity condition\n$$x_is_i = 0$$\nfor each $i$.\nAn interior point method relaxes this to\n$$x_is_i = \\tau.$$\nThe theory of interior point methods tells you that as you reduce $\\tau$ to 0, you get a sequence $x(\\tau)$ of candidate solutions that converge to the true value from inside the feasible region.

\n

What do you do if it's important to obtain a final answer that satisfies the true complementarity condition with $\\tau = 0$?\nFor the application I'm interested in, the perturbation $x_is_i = \\tau$ even for small $\\tau$ is undesirable given the way $x$ and $s$ will be used afterwards -- I really want $x_is_i = 0$.\nI'd imagine the solution is as simple as using an interior point method until the solution has almost converged and then doing one final Newton step with $\\tau = 0$.\nBut I haven't seen this discussed anywhere.

\n

I mention linear programming as an example.\nYou could ask the same question about more general convex programming, or linear/nonlinear complementarity problems.

\n", "question_id": 45305, "question_license": "CC BY-SA 4.0", "question_score": 1, "question_text": "Suppose I'm solving a linear program\n$$\\begin{align}\n& \\min c^*x \\;: \\\\\n& \\quad Ax = b, x \\ge 0.\n\\end{align}$$\nIf I use an interior point method, we introduce a set of Lagrange multipliers $y$ for the equality constraint and slack variables $s \\ge 0$ for the inequality constraint.\nThe KKT conditions include the complementarity condition\n$$x_is_i = 0$$\nfor each $i$.\nAn interior point method relaxes this to\n$$x_is_i = \\tau.$$\nThe theory of interior point methods tells you that as you reduce $\\tau$ to 0, you get a sequence $x(\\tau)$ of candidate solutions that converge to the true value from inside the feasible region.\n\n\n\n\nWhat do you do if it's important to obtain a final answer that satisfies the true complementarity condition with $\\tau = 0$?\nFor the application I'm interested in, the perturbation $x_is_i = \\tau$ even for small $\\tau$ is undesirable given the way $x$ and $s$ will be used afterwards -- I really want $x_is_i = 0$.\nI'd imagine the solution is as simple as using an interior point method until the solution has almost converged and then doing one final Newton step with $\\tau = 0$.\nBut I haven't seen this discussed anywhere.\n\n\n\n\nI mention linear programming as an example.\nYou could ask the same question about more general convex programming, or linear/nonlinear complementarity problems.", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Daniel Shapero", "profile_url": "https://scicomp.stackexchange.com/users/3481/daniel-shapero", "user_type": "registered"}, "created_at": "2025-12-03T18:04:17+00:00", "raw_file": "raw/codex_api_v1/932c57dde4e92dfe2af05c19643e98b6494a44cb31534e6703e92349c4e07eb4_1790825333093747000_0.json", "raw_sha256": "646e25c86dbb0c4df1ebe365442e733a253ac993340d2ed18168bbf783f75cac", "revision_guid": "5ADF0628-2B6E-4DF7-AC70-5DD29FF081BC", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/5ADF0628-2B6E-4DF7-AC70-5DD29FF081BC/view-source"}], "source_site": "scicomp", "source_url": "https://scicomp.stackexchange.com/questions/45305/recovering-complementarity-from-interior-point-method", "split": "train", "split_group": "9a1b6445c5795caf5bf6413ca5fad9ea60d5d9e850b89aae0da8d9948f783c81", "tags": ["convex-optimization", "nonlinear-programming", "linear-programming", "interior-point-method"], "thread_id": "scicomp:45305", "title": "recovering complementarity from interior point method"}} {"accepted_status": [true, false, false], "candidate_answers": [{"answer_html": "

The NN does not know anything about the qualitative properties of the equations. If these properties are important to you, then you should include them in your loss function.

\n

This is not part of your question, but I'll comment on it anyway: In general, I am not convinced PINNs are at all able to compete against traditional discretization methods. Moreover, the PINN community has done a poor job at providing fair assessments. I always recommend students take a look at: Weak baselines and reporting biases lead to overoptimism in machine learning for fluid-related partial differential equations.

\n", "answer_id": 45327, "answer_text": "The NN does not know anything about the qualitative properties of the equations. If these properties are important to you, then you should include them in your loss function.\n\n\n\n\nThis is not part of your question, but I'll comment on it anyway: In general, I am not convinced PINNs are at all able to compete against traditional discretization methods. Moreover, the PINN community has done a poor job at providing fair assessments. I always recommend students take a look at: Weak baselines and reporting biases lead to overoptimism in machine learning for fluid-related partial differential equations (https://arxiv.org/abs/2407.07218).", "answer_url": "https://scicomp.stackexchange.com/a/45327", "author": "Wolfgang Bangerth", "author_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-01-03T02:46:44+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45326, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Wolfgang Bangerth", "profile_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "user_type": "registered"}, "created_at": "2026-01-03T02:46:44+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "12F5FACA-F2F7-4BE5-BAC4-F6A8236BA147", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/12F5FACA-F2F7-4BE5-BAC4-F6A8236BA147/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Royi", "profile_url": "https://scicomp.stackexchange.com/users/7951/royi", "user_type": "registered"}, "created_at": "2026-01-23T14:37:58+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "B49E063C-3F0D-471B-956C-B179F2F73567", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/B49E063C-3F0D-471B-956C-B179F2F73567/view-source"}], "score": 10, "updated_at": "2026-01-23T14:37:58+00:00"}, {"answer_html": "

I am not an expert on neural nets. The size of the net you state strikes me as odd. You state that it has 4 layers with 80 degrees of freedom each, while the problem you try to solve has 30^3 degrees of freedom.

\n

In classical discretizations you have to evaluate the derivatives at each cell in your grid by combining the values of adjacent cells. This is true for essentially all discretizations in one way or another (FV, FEM, DG).

\n

This gives you a baseline of how much computation you would have to do to get to reasonable results, and even these have known errors.

\n

I don't know if the precision of the solutions you are showing are at all surprising given the number of degrees of freedom of your net.

\n", "answer_id": 45328, "answer_text": "I am not an expert on neural nets. The size of the net you state strikes me as odd. You state that it has 4 layers with 80 degrees of freedom each, while the problem you try to solve has 30^3 degrees of freedom.\n\n\n\n\nIn classical discretizations you have to evaluate the derivatives at each cell in your grid by combining the values of adjacent cells. This is true for essentially all discretizations in one way or another (FV, FEM, DG).\n\n\n\n\nThis gives you a baseline of how much computation you would have to do to get to reasonable results, and even these have known errors.\n\n\n\n\nI don't know if the precision of the solutions you are showing are at all surprising given the number of degrees of freedom of your net.", "answer_url": "https://scicomp.stackexchange.com/a/45328", "author": "MPIchael", "author_url": "https://scicomp.stackexchange.com/users/28636/mpichael", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-01-05T07:08:57+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45326, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "MPIchael", "profile_url": "https://scicomp.stackexchange.com/users/28636/mpichael", "user_type": "registered"}, "created_at": "2026-01-05T07:08:57+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "E5705B06-7DAC-4324-A752-C8064C49BB6C", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/E5705B06-7DAC-4324-A752-C8064C49BB6C/view-source"}], "score": 3, "updated_at": "2026-01-05T07:08:57+00:00"}, {"answer_html": "

Your distortion is learned memory/anisotropy from BC + sampling—make the boundary a controllable memory channel and rebalance collocation near the source.

\n", "answer_id": 45348, "answer_text": "Your distortion is learned memory/anisotropy from BC + sampling—make the boundary a controllable memory channel and rebalance collocation near the source.", "answer_url": "https://scicomp.stackexchange.com/a/45348", "author": "Donte Lightfoot", "author_url": "https://scicomp.stackexchange.com/users/56387/donte-lightfoot", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-01-22T23:46:46+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45326, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Donte Lightfoot", "profile_url": "https://scicomp.stackexchange.com/users/56387/donte-lightfoot", "user_type": "registered"}, "created_at": "2026-01-22T23:46:46+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "790DF00C-3B67-42CD-A314-653CD46193C9", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/790DF00C-3B67-42CD-A314-653CD46193C9/view-source"}], "score": 2, "updated_at": "2026-01-22T23:46:46+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I am implementing a Physics-Informed Neural Network (PINN) in PyTorch to solve the 2D acoustic wave equation with a point source. The model trains and converges in terms of loss, and the solution propagates outward from the source, but the resulting wavefronts are not clean circular waves. Instead, they appear distorted, anisotropic, or noisy.\n\n\n\n\nI would like to understand what is wrong or suboptimal in my setup (PDE formulation, boundary conditions, sampling strategy, network architecture, etc.) and what changes are required to obtain physically correct circular wavefronts.\n\n\n\n\n[image: output GIF; source: https://i.sstatic.net/9QczcfVK.gif] (https://i.sstatic.net/9QczcfVK.gif)\n\n\n\n\nTraining details:\n• Training set:\n• Interior collocation points: uniform tensor-product grid in (x,y,t) with 30^3 = 27000 points\n• Boundary points: all four spatial boundaries sampled over time with 30^2 points per boundary\n• Loss curves (residual, IC, BC):\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/IMsKTvWk.png] (https://i.sstatic.net/IMsKTvWk.png)\n\n\n\n\n$\\frac{\\partial^2 u}{\\partial t^2} - c^2 (\\partial_{xx} u + \\partial_{yy} u) = f(x,y,t)$\n\n\n\n\nwhere:\n\n\n\n\n\n(c = 1)\n\n\n\n\n(f(x,y,t)) is a Gaussian spatial source with sinusoidal time dependence\n\n\n\n\n\nInitial conditions:\n\n\n\n\n\n(u(x,y,0) = 0)\n\n\n\n\n$\\partial_t u(x,y,0) = 0$\n\n\n\n\n\nBoundary conditions:\n\n\n\n\n\nFirst-order absorbing (Sommerfeld):\n\n\n\n\n\n$\\partial_t u + c\\,\\partial_n u = 0$\n\n\n\n\n\nThe wavefronts don't make much sense\n\n\n\n\n\nclass PINN(nn.Module):\n def __init__(self, num_hidden, dim_hidden, act=torch.sin):\n super().__init__()\n self.layer_in = nn.Linear(3, dim_hidden)\n self.layer_out = nn.Linear(dim_hidden, 1)\n self.middle_layers = nn.ModuleList([\n nn.Linear(dim_hidden, dim_hidden)\n for _ in range(num_hidden - 1)\n ])\n self.act = act\n\n def forward(self, x, y, t):\n z = torch.cat([x, y, t], dim=1)\n z = self.act(self.layer_in(z))\n for layer in self.middle_layers:\n z = self.act(layer(z))\n return self.layer_out(z)\n\n\n\n\n\ndef df(output, input, order=1):\n v = output\n for _ in range(order):\n v = torch.autograd.grad(\n v, input,\n grad_outputs=torch.ones_like(input),\n create_graph=True,\n retain_graph=True\n )[0]\n return v\n\n\ndef dfdt(pinn, x, y, t, order=1):\n return df(pinn(x, y, t), t, order)\n\n\ndef dfdx(pinn, x, y, t, order=1):\n return df(pinn(x, y, t), x, order)\n\n\ndef dfdy(pinn, x, y, t, order=1):\n return df(pinn(x, y, t), y, order)\n\n\n\n\n\nclass Loss:\n def residual_loss(self, pinn):\n # Wave equation residual\n return ...\n\n def initial_loss(self, pinn):\n # u(x,y,0)=0 and du/dt(x,y,0)=0\n return ...\n\n def boundary_loss(self, pinn):\n # Absorbing (Sommerfeld) BC\n # dudt + c * du/dn = 0\n return ...\n\n\n\n\n\ndef train_model(pinn, loss_fn):\n # Adam phase\n # LBFGS phase\n return pinn\n\n\n\n\n\ndef create_wave_animation(pinn):\n # Evaluate PINN on grid and animate\n pass\n\n\n\n\n\n\n\n\nNetwork: fully-connected MLP, 4 hidden layers, 80 neurons per layer\n\n\n\n\n\n\n\n\n\nActivation: sin\n\n\n\n\n\n\n\n\n\nTraining:\n\n\n\n\n\nAdam optimizer (20k epochs)\n\n\n\n\nLBFGS refinement\n\n\n\n\n\n\n\n\n\n\nCollocation points:\n\n\n\n\n\nUniform tensor-product grid in (x, y, t)\n\n\n\n\n\n\n\n\n\n\nBoundary conditions:\n\n\n\n\n\nImplemented via additional loss terms using autograd\n\n\n\n\n\n\n\n\n\n\nVisualization:\n\n\n\n\n\nPINN evaluated on a dense grid and animated with Matplotlib\n\n\n\n\n\n\n\n\n\nI expect to see symmetric circular wavefronts expanding from the source, similar to finite-difference or spectral solutions of the 2D wave equation.\n\n\n\n\nAny insight into numerical, architectural, or formulation issues would be greatly appreciated.", "record_id": "Scientific-Answer-Ranking:scicomp:45326", "scores": [10, 3, 2], "split": "train", "thread": {"accepted_answer_id": 45327, "answers": [{"answer_html": "

The NN does not know anything about the qualitative properties of the equations. If these properties are important to you, then you should include them in your loss function.

\n

This is not part of your question, but I'll comment on it anyway: In general, I am not convinced PINNs are at all able to compete against traditional discretization methods. Moreover, the PINN community has done a poor job at providing fair assessments. I always recommend students take a look at: Weak baselines and reporting biases lead to overoptimism in machine learning for fluid-related partial differential equations.

\n", "answer_id": 45327, "answer_text": "The NN does not know anything about the qualitative properties of the equations. If these properties are important to you, then you should include them in your loss function.\n\n\n\n\nThis is not part of your question, but I'll comment on it anyway: In general, I am not convinced PINNs are at all able to compete against traditional discretization methods. Moreover, the PINN community has done a poor job at providing fair assessments. I always recommend students take a look at: Weak baselines and reporting biases lead to overoptimism in machine learning for fluid-related partial differential equations (https://arxiv.org/abs/2407.07218).", "answer_url": "https://scicomp.stackexchange.com/a/45327", "author": "Wolfgang Bangerth", "author_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-01-03T02:46:44+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45326, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Wolfgang Bangerth", "profile_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "user_type": "registered"}, "created_at": "2026-01-03T02:46:44+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "12F5FACA-F2F7-4BE5-BAC4-F6A8236BA147", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/12F5FACA-F2F7-4BE5-BAC4-F6A8236BA147/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Royi", "profile_url": "https://scicomp.stackexchange.com/users/7951/royi", "user_type": "registered"}, "created_at": "2026-01-23T14:37:58+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "B49E063C-3F0D-471B-956C-B179F2F73567", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/B49E063C-3F0D-471B-956C-B179F2F73567/view-source"}], "score": 10, "updated_at": "2026-01-23T14:37:58+00:00"}, {"answer_html": "

I am not an expert on neural nets. The size of the net you state strikes me as odd. You state that it has 4 layers with 80 degrees of freedom each, while the problem you try to solve has 30^3 degrees of freedom.

\n

In classical discretizations you have to evaluate the derivatives at each cell in your grid by combining the values of adjacent cells. This is true for essentially all discretizations in one way or another (FV, FEM, DG).

\n

This gives you a baseline of how much computation you would have to do to get to reasonable results, and even these have known errors.

\n

I don't know if the precision of the solutions you are showing are at all surprising given the number of degrees of freedom of your net.

\n", "answer_id": 45328, "answer_text": "I am not an expert on neural nets. The size of the net you state strikes me as odd. You state that it has 4 layers with 80 degrees of freedom each, while the problem you try to solve has 30^3 degrees of freedom.\n\n\n\n\nIn classical discretizations you have to evaluate the derivatives at each cell in your grid by combining the values of adjacent cells. This is true for essentially all discretizations in one way or another (FV, FEM, DG).\n\n\n\n\nThis gives you a baseline of how much computation you would have to do to get to reasonable results, and even these have known errors.\n\n\n\n\nI don't know if the precision of the solutions you are showing are at all surprising given the number of degrees of freedom of your net.", "answer_url": "https://scicomp.stackexchange.com/a/45328", "author": "MPIchael", "author_url": "https://scicomp.stackexchange.com/users/28636/mpichael", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-01-05T07:08:57+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45326, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "MPIchael", "profile_url": "https://scicomp.stackexchange.com/users/28636/mpichael", "user_type": "registered"}, "created_at": "2026-01-05T07:08:57+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "E5705B06-7DAC-4324-A752-C8064C49BB6C", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/E5705B06-7DAC-4324-A752-C8064C49BB6C/view-source"}], "score": 3, "updated_at": "2026-01-05T07:08:57+00:00"}, {"answer_html": "

Your distortion is learned memory/anisotropy from BC + sampling—make the boundary a controllable memory channel and rebalance collocation near the source.

\n", "answer_id": 45348, "answer_text": "Your distortion is learned memory/anisotropy from BC + sampling—make the boundary a controllable memory channel and rebalance collocation near the source.", "answer_url": "https://scicomp.stackexchange.com/a/45348", "author": "Donte Lightfoot", "author_url": "https://scicomp.stackexchange.com/users/56387/donte-lightfoot", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-01-22T23:46:46+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45326, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Donte Lightfoot", "profile_url": "https://scicomp.stackexchange.com/users/56387/donte-lightfoot", "user_type": "registered"}, "created_at": "2026-01-22T23:46:46+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "790DF00C-3B67-42CD-A314-653CD46193C9", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/790DF00C-3B67-42CD-A314-653CD46193C9/view-source"}], "score": 2, "updated_at": "2026-01-22T23:46:46+00:00"}], "domain": "computational_science", "external_links": ["https://arxiv.org/abs/2407.07218", "https://i.sstatic.net/9QczcfVK.gif", "https://i.sstatic.net/IMsKTvWk.png"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:44.584971+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/272744bcc95b58699f7df6e6979b288bb8b00a80ab9c7982dbe170a6d0b63584_1790825325025901700_0.json", "raw_sha256": "27a81850a40920682c29ada76a2b55e80340a5c82764a3e9dde8a9c2ba23db4e", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Anwesh Saha", "question_author_url": "https://scicomp.stackexchange.com/users/56260/anwesh-saha", "question_author_user_type": "registered", "question_created_at": "2026-01-01T19:29:53+00:00", "question_html": "

I am implementing a Physics-Informed Neural Network (PINN) in PyTorch to solve the 2D acoustic wave equation with a point source. The model trains and converges in terms of loss, and the solution propagates outward from the source, but the resulting wavefronts are not clean circular waves. Instead, they appear distorted, anisotropic, or noisy.

\n

I would like to understand what is wrong or suboptimal in my setup (PDE formulation, boundary conditions, sampling strategy, network architecture, etc.) and what changes are required to obtain physically correct circular wavefronts.

\n

\"output

\n

Training details:\n• Training set:\n• Interior collocation points: uniform tensor-product grid in (x,y,t) with 30^3 = 27000 points\n• Boundary points: all four spatial boundaries sampled over time with 30^2 points per boundary\n• Loss curves (residual, IC, BC):

\n

\"enter

\n

$\\frac{\\partial^2 u}{\\partial t^2} - c^2 (\\partial_{xx} u + \\partial_{yy} u) = f(x,y,t)$

\n

where:

\n
    \n
  • (c = 1)
  • \n
  • (f(x,y,t)) is a Gaussian spatial source with sinusoidal time dependence
  • \n
\n

Initial conditions:

\n
    \n
  • (u(x,y,0) = 0)
  • \n
  • $\\partial_t u(x,y,0) = 0$
  • \n
\n

Boundary conditions:

\n
    \n
  • First-order absorbing (Sommerfeld):
  • \n
\n

$\\partial_t u + c\\,\\partial_n u = 0$

\n
    \n
  • The wavefronts don't make much sense
  • \n
\n
class PINN(nn.Module):\n    def __init__(self, num_hidden, dim_hidden, act=torch.sin):\n        super().__init__()\n        self.layer_in = nn.Linear(3, dim_hidden)\n        self.layer_out = nn.Linear(dim_hidden, 1)\n        self.middle_layers = nn.ModuleList([\n            nn.Linear(dim_hidden, dim_hidden)\n            for _ in range(num_hidden - 1)\n        ])\n        self.act = act\n\n    def forward(self, x, y, t):\n        z = torch.cat([x, y, t], dim=1)\n        z = self.act(self.layer_in(z))\n        for layer in self.middle_layers:\n            z = self.act(layer(z))\n        return self.layer_out(z)\n
\n
def df(output, input, order=1):\n    v = output\n    for _ in range(order):\n        v = torch.autograd.grad(\n            v, input,\n            grad_outputs=torch.ones_like(input),\n            create_graph=True,\n            retain_graph=True\n        )[0]\n    return v\n\n\ndef dfdt(pinn, x, y, t, order=1):\n    return df(pinn(x, y, t), t, order)\n\n\ndef dfdx(pinn, x, y, t, order=1):\n    return df(pinn(x, y, t), x, order)\n\n\ndef dfdy(pinn, x, y, t, order=1):\n    return df(pinn(x, y, t), y, order)\n
\n
class Loss:\n    def residual_loss(self, pinn):\n        # Wave equation residual\n        return ...\n\n    def initial_loss(self, pinn):\n        # u(x,y,0)=0 and du/dt(x,y,0)=0\n        return ...\n\n    def boundary_loss(self, pinn):\n        # Absorbing (Sommerfeld) BC\n        # dudt + c * du/dn = 0\n        return ...\n
\n
def train_model(pinn, loss_fn):\n    # Adam phase\n    # LBFGS phase\n    return pinn\n
\n
def create_wave_animation(pinn):\n    # Evaluate PINN on grid and animate\n    pass\n
\n
    \n
  • Network: fully-connected MLP, 4 hidden layers, 80 neurons per layer

    \n
  • \n
  • Activation: sin

    \n
  • \n
  • Training:

    \n
      \n
    • Adam optimizer (20k epochs)
    • \n
    • LBFGS refinement
    • \n
    \n
  • \n
  • Collocation points:

    \n
      \n
    • Uniform tensor-product grid in (x, y, t)
    • \n
    \n
  • \n
  • Boundary conditions:

    \n
      \n
    • Implemented via additional loss terms using autograd
    • \n
    \n
  • \n
  • Visualization:

    \n
      \n
    • PINN evaluated on a dense grid and animated with Matplotlib
    • \n
    \n
  • \n
\n

I expect to see symmetric circular wavefronts expanding from the source, similar to finite-difference or spectral solutions of the 2D wave equation.

\n

Any insight into numerical, architectural, or formulation issues would be greatly appreciated.

\n", "question_id": 45326, "question_license": "CC BY-SA 4.0", "question_score": 3, "question_text": "I am implementing a Physics-Informed Neural Network (PINN) in PyTorch to solve the 2D acoustic wave equation with a point source. The model trains and converges in terms of loss, and the solution propagates outward from the source, but the resulting wavefronts are not clean circular waves. Instead, they appear distorted, anisotropic, or noisy.\n\n\n\n\nI would like to understand what is wrong or suboptimal in my setup (PDE formulation, boundary conditions, sampling strategy, network architecture, etc.) and what changes are required to obtain physically correct circular wavefronts.\n\n\n\n\n[image: output GIF; source: https://i.sstatic.net/9QczcfVK.gif] (https://i.sstatic.net/9QczcfVK.gif)\n\n\n\n\nTraining details:\n• Training set:\n• Interior collocation points: uniform tensor-product grid in (x,y,t) with 30^3 = 27000 points\n• Boundary points: all four spatial boundaries sampled over time with 30^2 points per boundary\n• Loss curves (residual, IC, BC):\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/IMsKTvWk.png] (https://i.sstatic.net/IMsKTvWk.png)\n\n\n\n\n$\\frac{\\partial^2 u}{\\partial t^2} - c^2 (\\partial_{xx} u + \\partial_{yy} u) = f(x,y,t)$\n\n\n\n\nwhere:\n\n\n\n\n\n(c = 1)\n\n\n\n\n(f(x,y,t)) is a Gaussian spatial source with sinusoidal time dependence\n\n\n\n\n\nInitial conditions:\n\n\n\n\n\n(u(x,y,0) = 0)\n\n\n\n\n$\\partial_t u(x,y,0) = 0$\n\n\n\n\n\nBoundary conditions:\n\n\n\n\n\nFirst-order absorbing (Sommerfeld):\n\n\n\n\n\n$\\partial_t u + c\\,\\partial_n u = 0$\n\n\n\n\n\nThe wavefronts don't make much sense\n\n\n\n\n\nclass PINN(nn.Module):\n def __init__(self, num_hidden, dim_hidden, act=torch.sin):\n super().__init__()\n self.layer_in = nn.Linear(3, dim_hidden)\n self.layer_out = nn.Linear(dim_hidden, 1)\n self.middle_layers = nn.ModuleList([\n nn.Linear(dim_hidden, dim_hidden)\n for _ in range(num_hidden - 1)\n ])\n self.act = act\n\n def forward(self, x, y, t):\n z = torch.cat([x, y, t], dim=1)\n z = self.act(self.layer_in(z))\n for layer in self.middle_layers:\n z = self.act(layer(z))\n return self.layer_out(z)\n\n\n\n\n\ndef df(output, input, order=1):\n v = output\n for _ in range(order):\n v = torch.autograd.grad(\n v, input,\n grad_outputs=torch.ones_like(input),\n create_graph=True,\n retain_graph=True\n )[0]\n return v\n\n\ndef dfdt(pinn, x, y, t, order=1):\n return df(pinn(x, y, t), t, order)\n\n\ndef dfdx(pinn, x, y, t, order=1):\n return df(pinn(x, y, t), x, order)\n\n\ndef dfdy(pinn, x, y, t, order=1):\n return df(pinn(x, y, t), y, order)\n\n\n\n\n\nclass Loss:\n def residual_loss(self, pinn):\n # Wave equation residual\n return ...\n\n def initial_loss(self, pinn):\n # u(x,y,0)=0 and du/dt(x,y,0)=0\n return ...\n\n def boundary_loss(self, pinn):\n # Absorbing (Sommerfeld) BC\n # dudt + c * du/dn = 0\n return ...\n\n\n\n\n\ndef train_model(pinn, loss_fn):\n # Adam phase\n # LBFGS phase\n return pinn\n\n\n\n\n\ndef create_wave_animation(pinn):\n # Evaluate PINN on grid and animate\n pass\n\n\n\n\n\n\n\n\nNetwork: fully-connected MLP, 4 hidden layers, 80 neurons per layer\n\n\n\n\n\n\n\n\n\nActivation: sin\n\n\n\n\n\n\n\n\n\nTraining:\n\n\n\n\n\nAdam optimizer (20k epochs)\n\n\n\n\nLBFGS refinement\n\n\n\n\n\n\n\n\n\n\nCollocation points:\n\n\n\n\n\nUniform tensor-product grid in (x, y, t)\n\n\n\n\n\n\n\n\n\n\nBoundary conditions:\n\n\n\n\n\nImplemented via additional loss terms using autograd\n\n\n\n\n\n\n\n\n\n\nVisualization:\n\n\n\n\n\nPINN evaluated on a dense grid and animated with Matplotlib\n\n\n\n\n\n\n\n\n\nI expect to see symmetric circular wavefronts expanding from the source, similar to finite-difference or spectral solutions of the 2D wave equation.\n\n\n\n\nAny insight into numerical, architectural, or formulation issues would be greatly appreciated.", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Anwesh Saha", "profile_url": "https://scicomp.stackexchange.com/users/56260/anwesh-saha", "user_type": "registered"}, "created_at": "2026-01-01T19:29:53+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "48F1548B-237A-4E64-9D2B-23708297897F", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/48F1548B-237A-4E64-9D2B-23708297897F/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Reinderien", "profile_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "user_type": "registered"}, "created_at": "2026-01-02T05:44:50+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "F9E6ED4E-E272-4959-AB38-6016CEED48E6", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/F9E6ED4E-E272-4959-AB38-6016CEED48E6/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Anwesh Saha", "profile_url": "https://scicomp.stackexchange.com/users/56260/anwesh-saha", "user_type": "registered"}, "created_at": "2026-01-02T05:49:23+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "D31A0254-33EE-4DC9-BC16-D05905CA3663", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/D31A0254-33EE-4DC9-BC16-D05905CA3663/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Anwesh Saha", "profile_url": "https://scicomp.stackexchange.com/users/56260/anwesh-saha", "user_type": "registered"}, "created_at": "2026-01-02T06:00:26+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "C90C675C-FD01-4F7F-8343-47D3A101E2AF", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/C90C675C-FD01-4F7F-8343-47D3A101E2AF/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-01-03T11:41:26+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "C6534CC8-3DAF-4FF7-918C-DDE4C08B9232", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://scicomp.stackexchange.com/revisions/C6534CC8-3DAF-4FF7-918C-DDE4C08B9232/view-source"}], "source_site": "scicomp", "source_url": "https://scicomp.stackexchange.com/questions/45326/physics-informed-neural-network-for-2d-wave-equation-produces-non-circular-dis", "split": "train", "split_group": "45c7425e154db27f580935b67401becade107a292d53c7f95ef776a2eb87be1b", "tags": ["fluid-dynamics", "computational-physics", "machine-learning", "physics-informed-neural-networks"], "thread_id": "scicomp:45326", "title": "Physics-Informed Neural Network for 2D Wave Equation Produces Non-Circular / Distorted Wavefronts"}} {"accepted_status": [false, false, false, false], "candidate_answers": [{"answer_html": "
\n

monothonic

\n
\n

I'm sure you meant monotonic.

\n
\n

I am looking for a fast way to solve the problem

\n
\n

Are you actually? I think if you were, you would use something off-the-shelf. "Simple iterative" and "fast" don't particularly jive, here. Let's take a random stab at remodelling your problem to meet some of your criteria:

\n
    \n
  • Linear, not quadratic
  • \n
  • No manual iteration per se
  • \n
  • Enforce inter-reference monotonicity through simple linear constraints
  • \n
  • Model cost as being absolute error plus absolute second-order differential, the latter receiving your $\\lambda$ weight
  • \n
\n

A traditional LP would express the problem thus. Define the following decision vectors:

\n
    \n
  • $z \\in \\mathbb R^n$, the fit points
  • \n
  • $z_p \\in \\mathbb R^n$, $z_p \\ge 0$, positive-clipped fit error
  • \n
  • $z_n \\in \\mathbb R^n$, $z_n \\ge 0$, negative-clipped fit error
  • \n
  • $d_p \\in \\mathbb R^{n-2}$, $d_p \\ge 0$, positive-clipped second-order differentials
  • \n
  • $d_n \\in \\mathbb R^{n-2}$, $d_n \\ge 0$, negative-clipped second-order differentials
  • \n
\n

Find

\n

$$ \\min_z z_p + z_n + \\lambda ( d_p + d_n ) $$

\n

given the following constraints:

\n

$$ z_p \\ge z - y $$\n$$ z_n \\ge y - z $$\n$$ d_p \\ge \\frac {\\partial^2 z} {\\partial i^2} $$\n$$ d_n \\ge -\\frac {\\partial^2 z} {\\partial i^2} $$\n$ (z_{i+1} - z_i) \\text{sgn}( y_1 - y_0 ) \\ge 0 $ for every index $i$ between every anchor point $y_0$, $y_1$

\n

$ \\frac {\\partial^2 z} {\\partial i^2} $ discretised by:\n$$ \\begin{bmatrix}\n1 & -2 & 1 \\\\\n & 1 & -2 & 1 \\\\\n & & & & \\ddots\n\\end{bmatrix} z $$

\n

The problem is very sparse, and I trust that essentially no LP solvers would have any difficulty with it. HiGHS completes it quickly.

\n
import matplotlib.pyplot as plt\nimport numpy as np\nimport scipy.sparse as sp\nfrom scipy.optimize import milp, LinearConstraint\n\n\ndef sample_data(rand: np.random.Generator, n: int = 1501) -> tuple[\n    np.ndarray, np.ndarray, np.ndarray,\n]:\n    x = np.linspace(start=0, stop=10, num=n)\n    y = rand.uniform(low=-0.1, high=0.1, size=x.size).cumsum()\n    iref = np.array((2, 6, 9))*(n//10)\n    return x, y, iref\n\n\ndef cost(n: int, nd: int, smoothing: float) -> np.ndarray:\n    return np.concatenate((\n        np.zeros(n),   # z does not incur a cost directly\n        np.ones(2*n),  # zerr cost\n        np.full(2*nd, fill_value=smoothing),\n    ))\n\n\ndef bounds(iref: np.ndarray, n: int, nd: int, y: np.ndarray) -> np.ndarray:\n    lbound, ubound = bounds = np.zeros((2, 3*n + 2*nd))\n    lbound[:n] = -np.inf\n    ubound[:] = np.inf\n\n    iprev = iref[:-1]\n    inext = iref[1:]\n    pprev = y[iprev]\n    pnext = y[inext]\n    pfloor = np.minimum(pprev, pnext)\n    pceil = np.maximum(pprev, pnext)\n\n    for i0, i1, plo, phi in zip(iprev, inext, pfloor, pceil):\n        lbound[i0] = y[i0]\n        ubound[i0] = y[i0]\n        inner = slice(i0 + 1, i1)\n        lbound[inner] = plo\n        ubound[inner] = phi\n    lbound[iref[-1]] = y[iref[-1]]\n    ubound[iref[-1]] = y[iref[-1]]\n\n    return bounds\n\n\ndef zerror_constraints(n: int, nd: int, y: np.ndarray) -> tuple[LinearConstraint, ...]:\n    # zep >= z - y:  z - zep <= y\n    # zen >= y - z:  z + zen >= y\n    eye = sp.eye_array(n)\n    zero = sp.csc_array((n, n))\n    zerond = sp.csc_array((n, 2*nd))\n    pos = LinearConstraint(\n        A=sp.hstack((eye, -eye, zero, zerond), format='csc'), ub=y)\n    neg = LinearConstraint(\n        A=sp.hstack((eye, zero, eye, zerond), format='csc'), lb=y)\n    return pos, neg\n\n\ndef d2_constraints(n: int, nd: int) -> tuple[LinearConstraint, ...]:\n    # d2z/dt2 = z[i+2] - 2z[i+1] + z[i]\n    # d2p >=  d2z/dt2: -z[i] + 2z[i+1] - z[i+2] +0 +0 + d2p >= 0\n    # d2n >= -d2z/dt2:  z[i] - 2z[i+1] + z[i+2] +0 +0 +   0 + d2n >= 0\n    data = np.broadcast_to(\n        np.array(([1], [-2], [1]), dtype=np.float32),  # don't bother with /dt**2\n        shape=(3, n))\n    offsets = np.array((0, 1, 2), dtype=np.int32)\n    kernel = sp.dia_array((data, offsets), shape=(nd, n))\n    err_zero = sp.csc_array((nd, 2*n))\n    eye = sp.eye_array(nd)\n    zero = sp.csc_array((nd, nd))\n    pos = LinearConstraint(\n        A=sp.hstack((-kernel, err_zero, eye, zero), format='csc'), lb=0)\n    neg = LinearConstraint(\n        A=sp.hstack(( kernel, err_zero, zero, eye), format='csc'), lb=0)\n    return pos, neg\n\n\ndef monotone_constraints(n: int, nd: int, y: np.ndarray, iref: np.ndarray) -> tuple[LinearConstraint, ...]:\n    iprev = iref[:-1]\n    inext = iref[1:]\n    yprev = y[iprev]\n    ynext = y[inext]\n    blocks = []\n\n    for i0, i1, y0, y1 in zip(iprev, inext, yprev, ynext):\n        sign = np.sign(y1 - y0)\n        if sign == 0:\n            continue  # the entire segment will already have lower and upper bounds equal to each other\n        block = sp.eye_array(\n            m=i1 - i0, n=3*n + 2*nd, k=i0 + 1,\n        ) - sp.eye_array(\n            m=i1 - i0, n=3*n + 2*nd, k=i0)\n        blocks.append(sign*block)\n    constraint = LinearConstraint(A=sp.vstack(blocks, format='csc'), lb=0)\n    return constraint,\n\n\ndef solve(y: np.ndarray, iref: np.ndarray, smoothing: float = 1.) -> tuple[\n    np.ndarray, tuple[LinearConstraint, ...],\n]:\n    '''\n    Variables:\n        z, continuous unbounded (outside of ref points)\n        zep, continuous, >= 0, >= z-y\n        zen, continuous, >= 0, >= y-z\n        d2p, n-2, continuous, >= 0, >= d2z/dt2\n        d2n, n-2, continuous, >= 0, >= -d2z/dt2\n    '''\n    n = y.size\n    nd = n - 2\n    constraints = (\n        zerror_constraints(n, nd, y) + d2_constraints(n, nd) + monotone_constraints(n, nd, y, iref)\n    )\n\n    result = milp(\n        c=cost(n, nd, smoothing), integrality=0, bounds=bounds(iref, n, nd, y),\n        constraints=constraints,\n    )\n    if not result.success:\n        raise result.message\n    z, zep, zen, d2p, d2n = np.split(result.x, (n, 2*n, 3*n, 3*n+nd))\n    return z, constraints\n\n\ndef demo() -> None:\n    rand = np.random.default_rng(seed=0)\n    x, y, iref = sample_data(rand, n=801)\n\n    fig, ax = plt.subplots()\n    ax.plot(x, y, label='orig')\n    ax.scatter(x[iref], y[iref], color='red', label='ref point')\n\n    for smoothing in (0.5, 3):\n        z, constraints = solve(y, iref, smoothing)\n        ax.plot(x, z, label=f'smooth={smoothing}')\n    ax.legend()\n\n    sparsity = sp.vstack([c.A for c in constraints]).sign().toarray()\n    fig, ax = plt.subplots()\n    ax.set_title(f'Constraint sparsity, n={y.size}')\n    ax.imshow(sparsity)\n\n    plt.show()\n\n\nif __name__ == '__main__':\n    demo()\n
\n

Here we see that the solution does exactly what we tell it to:

\n

\"example

\n

Outside of the reference points, monotonicity is not enforced so the smoothed curve follows the input curve. Within the reference points, monotonicity is preserved, and the solver does its best to balance smoothing and fitting; a finer-scale depiction of this behaviour:

\n

\"smoothing\"

\n

The sparsity pattern for the problem looks like this (size reduced for visibility):

\n

\"sparsity\"

\n

Though the performance will vary based on hardware and dataset content and size, for n=1501 I see execution times of ~80 ms.

\n", "answer_id": 45335, "answer_text": "monothonic\n\n\n\n\n\n\n\nI'm sure you meant monotonic.\n\n\n\n\n\n\n\nI am looking for a fast way to solve the problem\n\n\n\n\n\n\n\nAre you actually? I think if you were, you would use something off-the-shelf. \"Simple iterative\" and \"fast\" don't particularly jive, here. Let's take a random stab at remodelling your problem to meet some of your criteria:\n\n\n\n\n\nLinear, not quadratic\n\n\n\n\nNo manual iteration per se\n\n\n\n\nEnforce inter-reference monotonicity through simple linear constraints\n\n\n\n\nModel cost as being absolute error plus absolute second-order differential, the latter receiving your $\\lambda$ weight\n\n\n\n\n\nA traditional LP would express the problem thus. Define the following decision vectors:\n\n\n\n\n\n$z \\in \\mathbb R^n$, the fit points\n\n\n\n\n$z_p \\in \\mathbb R^n$, $z_p \\ge 0$, positive-clipped fit error\n\n\n\n\n$z_n \\in \\mathbb R^n$, $z_n \\ge 0$, negative-clipped fit error\n\n\n\n\n$d_p \\in \\mathbb R^{n-2}$, $d_p \\ge 0$, positive-clipped second-order differentials\n\n\n\n\n$d_n \\in \\mathbb R^{n-2}$, $d_n \\ge 0$, negative-clipped second-order differentials\n\n\n\n\n\nFind\n\n\n\n\n$$ \\min_z z_p + z_n + \\lambda ( d_p + d_n ) $$\n\n\n\n\ngiven the following constraints:\n\n\n\n\n$$ z_p \\ge z - y $$\n$$ z_n \\ge y - z $$\n$$ d_p \\ge \\frac {\\partial^2 z} {\\partial i^2} $$\n$$ d_n \\ge -\\frac {\\partial^2 z} {\\partial i^2} $$\n$ (z_{i+1} - z_i) \\text{sgn}( y_1 - y_0 ) \\ge 0 $ for every index $i$ between every anchor point $y_0$, $y_1$\n\n\n\n\n$ \\frac {\\partial^2 z} {\\partial i^2} $ discretised by:\n$$ \\begin{bmatrix}\n1 & -2 & 1 \\\\\n & 1 & -2 & 1 \\\\\n & & & & \\ddots\n\\end{bmatrix} z $$\n\n\n\n\nThe problem is very sparse, and I trust that essentially no LP solvers would have any difficulty with it. HiGHS completes it quickly.\n\n\n\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport scipy.sparse as sp\nfrom scipy.optimize import milp, LinearConstraint\n\n\ndef sample_data(rand: np.random.Generator, n: int = 1501) -> tuple[\n np.ndarray, np.ndarray, np.ndarray,\n]:\n x = np.linspace(start=0, stop=10, num=n)\n y = rand.uniform(low=-0.1, high=0.1, size=x.size).cumsum()\n iref = np.array((2, 6, 9))*(n//10)\n return x, y, iref\n\n\ndef cost(n: int, nd: int, smoothing: float) -> np.ndarray:\n return np.concatenate((\n np.zeros(n), # z does not incur a cost directly\n np.ones(2*n), # zerr cost\n np.full(2*nd, fill_value=smoothing),\n ))\n\n\ndef bounds(iref: np.ndarray, n: int, nd: int, y: np.ndarray) -> np.ndarray:\n lbound, ubound = bounds = np.zeros((2, 3*n + 2*nd))\n lbound[:n] = -np.inf\n ubound[:] = np.inf\n\n iprev = iref[:-1]\n inext = iref[1:]\n pprev = y[iprev]\n pnext = y[inext]\n pfloor = np.minimum(pprev, pnext)\n pceil = np.maximum(pprev, pnext)\n\n for i0, i1, plo, phi in zip(iprev, inext, pfloor, pceil):\n lbound[i0] = y[i0]\n ubound[i0] = y[i0]\n inner = slice(i0 + 1, i1)\n lbound[inner] = plo\n ubound[inner] = phi\n lbound[iref[-1]] = y[iref[-1]]\n ubound[iref[-1]] = y[iref[-1]]\n\n return bounds\n\n\ndef zerror_constraints(n: int, nd: int, y: np.ndarray) -> tuple[LinearConstraint, ...]:\n # zep >= z - y: z - zep <= y\n # zen >= y - z: z + zen >= y\n eye = sp.eye_array(n)\n zero = sp.csc_array((n, n))\n zerond = sp.csc_array((n, 2*nd))\n pos = LinearConstraint(\n A=sp.hstack((eye, -eye, zero, zerond), format='csc'), ub=y)\n neg = LinearConstraint(\n A=sp.hstack((eye, zero, eye, zerond), format='csc'), lb=y)\n return pos, neg\n\n\ndef d2_constraints(n: int, nd: int) -> tuple[LinearConstraint, ...]:\n # d2z/dt2 = z[i+2] - 2z[i+1] + z[i]\n # d2p >= d2z/dt2: -z[i] + 2z[i+1] - z[i+2] +0 +0 + d2p >= 0\n # d2n >= -d2z/dt2: z[i] - 2z[i+1] + z[i+2] +0 +0 + 0 + d2n >= 0\n data = np.broadcast_to(\n np.array(([1], [-2], [1]), dtype=np.float32), # don't bother with /dt**2\n shape=(3, n))\n offsets = np.array((0, 1, 2), dtype=np.int32)\n kernel = sp.dia_array((data, offsets), shape=(nd, n))\n err_zero = sp.csc_array((nd, 2*n))\n eye = sp.eye_array(nd)\n zero = sp.csc_array((nd, nd))\n pos = LinearConstraint(\n A=sp.hstack((-kernel, err_zero, eye, zero), format='csc'), lb=0)\n neg = LinearConstraint(\n A=sp.hstack(( kernel, err_zero, zero, eye), format='csc'), lb=0)\n return pos, neg\n\n\ndef monotone_constraints(n: int, nd: int, y: np.ndarray, iref: np.ndarray) -> tuple[LinearConstraint, ...]:\n iprev = iref[:-1]\n inext = iref[1:]\n yprev = y[iprev]\n ynext = y[inext]\n blocks = []\n\n for i0, i1, y0, y1 in zip(iprev, inext, yprev, ynext):\n sign = np.sign(y1 - y0)\n if sign == 0:\n continue # the entire segment will already have lower and upper bounds equal to each other\n block = sp.eye_array(\n m=i1 - i0, n=3*n + 2*nd, k=i0 + 1,\n ) - sp.eye_array(\n m=i1 - i0, n=3*n + 2*nd, k=i0)\n blocks.append(sign*block)\n constraint = LinearConstraint(A=sp.vstack(blocks, format='csc'), lb=0)\n return constraint,\n\n\ndef solve(y: np.ndarray, iref: np.ndarray, smoothing: float = 1.) -> tuple[\n np.ndarray, tuple[LinearConstraint, ...],\n]:\n '''\n Variables:\n z, continuous unbounded (outside of ref points)\n zep, continuous, >= 0, >= z-y\n zen, continuous, >= 0, >= y-z\n d2p, n-2, continuous, >= 0, >= d2z/dt2\n d2n, n-2, continuous, >= 0, >= -d2z/dt2\n '''\n n = y.size\n nd = n - 2\n constraints = (\n zerror_constraints(n, nd, y) + d2_constraints(n, nd) + monotone_constraints(n, nd, y, iref)\n )\n\n result = milp(\n c=cost(n, nd, smoothing), integrality=0, bounds=bounds(iref, n, nd, y),\n constraints=constraints,\n )\n if not result.success:\n raise result.message\n z, zep, zen, d2p, d2n = np.split(result.x, (n, 2*n, 3*n, 3*n+nd))\n return z, constraints\n\n\ndef demo() -> None:\n rand = np.random.default_rng(seed=0)\n x, y, iref = sample_data(rand, n=801)\n\n fig, ax = plt.subplots()\n ax.plot(x, y, label='orig')\n ax.scatter(x[iref], y[iref], color='red', label='ref point')\n\n for smoothing in (0.5, 3):\n z, constraints = solve(y, iref, smoothing)\n ax.plot(x, z, label=f'smooth={smoothing}')\n ax.legend()\n\n sparsity = sp.vstack([c.A for c in constraints]).sign().toarray()\n fig, ax = plt.subplots()\n ax.set_title(f'Constraint sparsity, n={y.size}')\n ax.imshow(sparsity)\n\n plt.show()\n\n\nif __name__ == '__main__':\n demo()\n\n\n\n\n\nHere we see that the solution does exactly what we tell it to:\n\n\n\n\n[image: example solution; source: https://i.sstatic.net/oTyX0oWA.png] (https://i.sstatic.net/oTyX0oWA.png)\n\n\n\n\nOutside of the reference points, monotonicity is not enforced so the smoothed curve follows the input curve. Within the reference points, monotonicity is preserved, and the solver does its best to balance smoothing and fitting; a finer-scale depiction of this behaviour:\n\n\n\n\n[image: smoothing; source: https://i.sstatic.net/cW1t1avg.png] (https://i.sstatic.net/cW1t1avg.png)\n\n\n\n\nThe sparsity pattern for the problem looks like this (size reduced for visibility):\n\n\n\n\n[image: sparsity; source: https://i.sstatic.net/UmVF5qyE.png] (https://i.sstatic.net/UmVF5qyE.png)\n\n\n\n\nThough the performance will vary based on hardware and dataset content and size, for n=1501 I see execution times of ~80 ms.", "answer_url": "https://scicomp.stackexchange.com/a/45335", "author": "Reinderien", "author_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-01-10T07:56:42+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45334, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Reinderien", "profile_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "user_type": "registered"}, "created_at": "2026-01-10T07:56:42+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "49224026-A98C-4DFC-B187-28324764F758", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/49224026-A98C-4DFC-B187-28324764F758/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Reinderien", "profile_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "user_type": "registered"}, "created_at": "2026-01-10T15:16:37+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "0462867C-327F-469E-957B-1FE451F4CE5C", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/0462867C-327F-469E-957B-1FE451F4CE5C/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Reinderien", "profile_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "user_type": "registered"}, "created_at": "2026-01-10T20:00:35+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "302EF20B-4729-4185-A059-5377ED4B7555", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/302EF20B-4729-4185-A059-5377ED4B7555/view-source"}], "score": 3, "updated_at": "2026-01-10T20:00:35+00:00"}, {"answer_html": "

I managed to create a prototype solver based on ADMM in MATLAB:

\n
function [ vX, isConv ] = SplineQPSmooth( vY, mD, paramLambda, vI, mA, sParams )\n\narguments(Input)\n    vY (:, 1) {mustBeNumeric, mustBeFinite, mustBeReal}\n    mD (:, :) {mustBeNumeric, mustBeFinite, mustBeReal}\n    paramLambda (1, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBeNonnegative}\n    vI (:, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBeInteger}\n    mA (:, :) {mustBeNumeric, mustBeFinite, mustBeReal}\n    sParams.paramRho (1, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBePositive} = 1.0\n    sParams.numIter (1, 1) {mustBeNumeric, mustBeFinite, mustBeInteger, mustBePositive} = 5000\n    sParams.epsAbs (1, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBePositive} = 1e-5\n    sParams.epsRel (1, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBePositive} = 1e-5\n    sParams.convInterval (1, 1) {mustBeNumeric, mustBeFinite, mustBeInteger, mustBePositive} = 25\n    sParams.paramTau (1, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBePositive} = 10\nend\n\narguments(Output)\n    vX (:, 1) {mustBeNumeric, mustBeFinite, mustBeReal}\n    isConv (1, 1) {mustBeA(isConv, 'logical')}\nend\n\nnumSamples = length(vY);\nnumEq      = length(vI);\nnumInEq    = size(mA, 1);\n\n% Quadratic Terms\nmQ = sparse(eye(numSamples)) + paramLambda * (mD' * mD);\nvQ = -vY;\n\n% Equality Constraints\nmE = sparse(1:numEq, vI, 1, numEq, numSamples);\nvD = vY(vI);\n\nparamRho     = sParams.paramRho;\nparamRhoInv  = inv(paramRho);\nnumIter      = sParams.numIter;\nepsAbs       = sParams.epsAbs;\nepsRel       = sParams.epsRel;\nconvInterval = sParams.convInterval;\nparamTau     = sParams.paramTau;\n\n% ADMM Variables\nvX  = vY;                %<! Optimization variable\nvS  = zeros(numInEq, 1); %<! Slack variable for inequality\nvS1 = zeros(numInEq, 1); %<! Preious iteration buffer\nvMu = zeros(numInEq, 1); %<! Dual variable for inequality\nvNu = zeros(numEq, 1);   %<! Dual variabe for equality\n\n% Factorize the KKT System\n% (Q + rho * A' * A + rho * E' * E) * z = r\nmK = mQ + paramRho * (mA.' * mA) + paramRho * (mE.' * mE);\nsK = decomposition(mK, 'chol', 'CheckCondition', false);\n\nisConv     = false;\nupdatedRho = false;\n\nfor ii = 1:numIter\n    vS1(:) = vS; %<! Previous iteration\n\n    % Solve the Linear System\n    vR = -vQ - mA.' * (paramRho * vS + vMu) + mE.' * (paramRho * vD - vNu); %<! Right hand vector\n    vX = sK \\ vR;\n\n    % Proximal / Projection Step\n    % s = -A * z with s >= 0\n    vS = max(0, -(mA * vX + paramRhoInv * vMu));\n\n    % Update Dual Variables\n    vMu = vMu + paramRho * (mA * vX + vS);\n    vNu = vNu + paramRho * (mE * vX - vD);\n\n    % Check Convergence\n    if mod(ii, convInterval) == 0\n        primRes = norm(mA * vX + vS, 'inf');\n        dualRes = norm(paramRho * mA' * (vS - vS1), 'inf');\n        if ((primRes < epsAbs) && (dualRes < epsAbs))\n            isConv = true;\n            break;\n        end\n\n        % Adpat `paramRho`\n        resRatio = primRes / dualRes;\n        % fprintf('Primal Residual: %0.7f, Dual Residual: %0.7f\\n', primRes, dualRes);\n        % fprintf('Residual Ratio: %0.2f, ρ = %0.3f\\n', resRatio, paramRho);\n        if (resRatio > paramTau) || (inv(resRatio) > paramTau)\n            updatedRho = true;\n        else\n            updatedRho = false;\n        end\n        if updatedRho\n            paramRho = paramRho * sqrt(resRatio);\n            paramRho = clip(paramRho, 1e-5, 1e5);\n            paramRhoInv  = inv(paramRho);\n            mK = mQ + paramRho * (mA.' * mA) + paramRho * (mE.' * mE);\n            sK = decomposition(mK, 'chol', 'CheckCondition', false);\n        end\n    end\n\nend\n\nend\n
\n

I has convergence check and adaptation of the ADMM's step size parameter $\\rho$.
\nI will add mathematical formulation and a memory optimized version using Julia.

\n

On MATLAB with this naive code I could beat quadprog() by 30% with the same output:

\n

\"enter

\n\n", "answer_id": 45337, "answer_text": "I managed to create a prototype solver based on ADMM in MATLAB:\n\n\n\n\nfunction [ vX, isConv ] = SplineQPSmooth( vY, mD, paramLambda, vI, mA, sParams )\n\narguments(Input)\n vY (:, 1) {mustBeNumeric, mustBeFinite, mustBeReal}\n mD (:, :) {mustBeNumeric, mustBeFinite, mustBeReal}\n paramLambda (1, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBeNonnegative}\n vI (:, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBeInteger}\n mA (:, :) {mustBeNumeric, mustBeFinite, mustBeReal}\n sParams.paramRho (1, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBePositive} = 1.0\n sParams.numIter (1, 1) {mustBeNumeric, mustBeFinite, mustBeInteger, mustBePositive} = 5000\n sParams.epsAbs (1, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBePositive} = 1e-5\n sParams.epsRel (1, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBePositive} = 1e-5\n sParams.convInterval (1, 1) {mustBeNumeric, mustBeFinite, mustBeInteger, mustBePositive} = 25\n sParams.paramTau (1, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBePositive} = 10\nend\n\narguments(Output)\n vX (:, 1) {mustBeNumeric, mustBeFinite, mustBeReal}\n isConv (1, 1) {mustBeA(isConv, 'logical')}\nend\n\nnumSamples = length(vY);\nnumEq = length(vI);\nnumInEq = size(mA, 1);\n\n% Quadratic Terms\nmQ = sparse(eye(numSamples)) + paramLambda * (mD' * mD);\nvQ = -vY;\n\n% Equality Constraints\nmE = sparse(1:numEq, vI, 1, numEq, numSamples);\nvD = vY(vI);\n\nparamRho = sParams.paramRho;\nparamRhoInv = inv(paramRho);\nnumIter = sParams.numIter;\nepsAbs = sParams.epsAbs;\nepsRel = sParams.epsRel;\nconvInterval = sParams.convInterval;\nparamTau = sParams.paramTau;\n\n% ADMM Variables\nvX = vY; %= 0\n vS = max(0, -(mA * vX + paramRhoInv * vMu));\n\n % Update Dual Variables\n vMu = vMu + paramRho * (mA * vX + vS);\n vNu = vNu + paramRho * (mE * vX - vD);\n\n % Check Convergence\n if mod(ii, convInterval) == 0\n primRes = norm(mA * vX + vS, 'inf');\n dualRes = norm(paramRho * mA' * (vS - vS1), 'inf');\n if ((primRes < epsAbs) && (dualRes < epsAbs))\n isConv = true;\n break;\n end\n\n % Adpat `paramRho`\n resRatio = primRes / dualRes;\n % fprintf('Primal Residual: %0.7f, Dual Residual: %0.7f\\n', primRes, dualRes);\n % fprintf('Residual Ratio: %0.2f, ρ = %0.3f\\n', resRatio, paramRho);\n if (resRatio > paramTau) || (inv(resRatio) > paramTau)\n updatedRho = true;\n else\n updatedRho = false;\n end\n if updatedRho\n paramRho = paramRho * sqrt(resRatio);\n paramRho = clip(paramRho, 1e-5, 1e5);\n paramRhoInv = inv(paramRho);\n mK = mQ + paramRho * (mA.' * mA) + paramRho * (mE.' * mE);\n sK = decomposition(mK, 'chol', 'CheckCondition', false);\n end\n end\n\nend\n\nend\n\n\n\n\n\nI has convergence check and adaptation of the ADMM's step size parameter $\\rho$.\n\nI will add mathematical formulation and a memory optimized version using Julia.\n\n\n\n\nOn MATLAB with this naive code I could beat quadprog() by 30% with the same output:\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/VC8uzUSt.png] (https://i.sstatic.net/VC8uzUSt.png)", "answer_url": "https://scicomp.stackexchange.com/a/45337", "author": "Royi", "author_url": "https://scicomp.stackexchange.com/users/7951/royi", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-01-10T16:53:59+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45334, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Royi", "profile_url": "https://scicomp.stackexchange.com/users/7951/royi", "user_type": "registered"}, "created_at": "2026-01-10T16:53:59+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "62C943AA-9B1D-4A55-BEE1-9F975532FF13", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/62C943AA-9B1D-4A55-BEE1-9F975532FF13/view-source"}], "score": 0, "updated_at": "2026-01-10T16:53:59+00:00"}, {"answer_html": "

I produced an ADMM based solver which I found very efficient.

\n

The problem is given by:

\n

$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{x} } & \\quad & \\frac{1}{2} \\left\\| \\boldsymbol{x} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\frac{\\lambda}{2} {\\left\\| \\boldsymbol{D}^{m} \\boldsymbol{x} \\right\\|}_{2}^{2} \\\\\n\\text{subject to} & \\quad & {x}_{i} = {y}_{i} \\; \\forall i \\in \\mathcal{I} \\\\\n& \\quad & \\boldsymbol{A} \\boldsymbol{x} \\leq \\boldsymbol{0} \\\\\n\\end{alignat*}\n$$

\n

I will use $\\boldsymbol{D} = \\boldsymbol{D}^{m}$ to simplify notations.
\nThe equality constraints can be turned into matrix form and the problem becomes:

\n

$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{x} } & \\quad & \\frac{1}{2} \\left\\| \\boldsymbol{x} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\frac{\\lambda}{2} {\\left\\| \\boldsymbol{D} \\boldsymbol{x} \\right\\|}_{2}^{2} \\\\\n\\text{subject to} & \\quad & \\boldsymbol{E} \\boldsymbol{x} = \\boldsymbol{d} \\\\\n& \\quad & \\boldsymbol{A} \\boldsymbol{x} \\leq \\boldsymbol{0} \\\\\n\\end{alignat*}\n$$

\n

The trick to utilize the ADMM framework is to introduce a slack variable to handle the inequality constraint:

\n

$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{x} } & \\quad & \\frac{1}{2} \\left\\| \\boldsymbol{x} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\frac{\\lambda}{2} {\\left\\| \\boldsymbol{D} \\boldsymbol{x} \\right\\|}_{2}^{2} \\\\\n\\text{subject to} & \\quad & \\boldsymbol{E} \\boldsymbol{x} = \\boldsymbol{d} \\\\\n& \\quad & \\boldsymbol{A} \\boldsymbol{x} + \\boldsymbol{s} = \\boldsymbol{0} \\\\\n& \\quad & \\boldsymbol{s} \\geq \\boldsymbol{0} \\\\\n\\end{alignat*}\n$$

\n

The equality constraints are introduced by the Augmented Lagrangian:

\n

$$\n{\\ell}_{\\rho} \\left( \\boldsymbol{x}, \\boldsymbol{s}, \\boldsymbol{\\mu}, \\boldsymbol{\\nu} \\right) = \\frac{1}{2} \\left\\| \\boldsymbol{x} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\frac{\\lambda}{2} {\\left\\| \\boldsymbol{D} \\boldsymbol{x} \\right\\|}_{2}^{2} + \\frac{\\rho}{2} {\\left\\| \\boldsymbol{A} \\boldsymbol{x} + \\boldsymbol{s} + {\\rho}^{-1} \\boldsymbol{\\mu} \\right\\|}_{2}^{2} + \\frac{\\rho}{2} {\\left\\| \\boldsymbol{E} \\boldsymbol{x} - \\boldsymbol{d} + {\\rho}^{-1} \\boldsymbol{\\nu} \\right\\|}_{2}^{2} + {I}_{\\mathbb{R}_{+}} \\left( \\boldsymbol{s} \\right)\n$$

\n

The steps to solve:

\n
    \n
  • Primal Update (Solve Linear System): $\\boldsymbol{x}^{ \\left( k + 1 \\right)} = {\\left( \\boldsymbol{I} + \\lambda \\boldsymbol{D}^{\\top} \\boldsymbol{D} + \\rho \\boldsymbol{A}^{\\top} \\boldsymbol{A} + \\rho\\boldsymbol{E}^{\\top} \\boldsymbol{E} \\right)}^{-1} \\left( \\boldsymbol{y} - \\boldsymbol{A}^{\\top} \\left( \\rho \\boldsymbol{s}^{\\left( k \\right)} + \\boldsymbol{\\mu}^{\\left( k \\right)} \\right) + \\boldsymbol{E}^{\\top} \\left( \\rho \\boldsymbol{d} - \\boldsymbol{\\nu}^{\\left( k \\right)} \\right) \\right)$.
  • \n
  • Slack Update (Non Negative LS): $\\boldsymbol{s}^{ \\left( k + 1 \\right)} = \\max \\left( \\boldsymbol{0}, - \\boldsymbol{A} \\boldsymbol{x}^{\\left( k + 1 \\right)} - {\\rho}^{-1} \\boldsymbol{\\mu}^{\\left( k \\right)} \\right)$.
  • \n
  • Dual Update (Gradient Ascent) for $\\boldsymbol{\\mu}$: $\\boldsymbol{\\mu}^{\\left( k + 1 \\right)} = \\boldsymbol{\\mu}^{\\left( k \\right)} + \\rho \\left( \\boldsymbol{A} \\boldsymbol{x}^{\\left( k + 1 \\right)} + \\boldsymbol{s}^{\\left( k + 1 \\right)} \\right)$.
  • \n
  • Dual Update (Gradient Ascent) for $\\boldsymbol{\\nu}$: $\\boldsymbol{\\nu}^{\\left( k + 1 \\right)} = \\boldsymbol{\\nu}^{\\left( k \\right)} + \\rho \\left( \\boldsymbol{E} \\boldsymbol{x}^{\\left( k + 1 \\right)} - \\boldsymbol{d} \\right)$.
  • \n
\n

The stopping condition is when both residuals are below a threshold:

\n
    \n
  • Primal Residual: ${r}^{\\left( k \\right)} = {\\left\\| \\boldsymbol{A} \\boldsymbol{x}^{\\left( k \\right)} + \\boldsymbol{s}^{\\left( k \\right)} \\right\\|}_{\\infty}$.
  • \n
  • Dual Residual (OSQP Style): ${s}^{\\left( k \\right)} = {\\left\\| \\rho \\boldsymbol{A} \\left( \\boldsymbol{s}^{\\left( k \\right)} - \\boldsymbol{s}^{\\left( k - 1 \\right)} \\right) \\right\\|}_{\\infty}$.
  • \n
\n

The use of the infinity norm decouples the dimension of the problem from the thresholds.

\n

I also used OSQP style update of the $\\rho$ parameter to accelerate convergence: ${\\rho}^{\\left( k \\right)} = {\\rho}^{\\left( k - 1 \\right)} \\sqrt{ \\frac{ {r}^{\\left( k \\right)} }{ {s}^{\\left( k \\right)} } }$.

\n

I implemented all in Julia and compared to the ECOS / SCS solvers wrapped by Convex.jl.

\n

\"enter

\n

Run Times:

\n
    \n
  • ECOS
  • \n
\n
BenchmarkTools.Trial: 1227 samples with 1 evaluation per sample.\n Range (min … max):  3.412 ms …  18.615 ms  ┊ GC (min … max): 0.00% … 60.46%\n Time  (median):     3.807 ms               ┊ GC (median):    0.00%\n Time  (mean ± σ):   4.061 ms ± 859.845 μs  ┊ GC (mean ± σ):  1.67% ±  5.36%\n\n   ▅█▇▄▃ ▁\n  ▄████████▇▆▇▅▆▅▅▄▄▃▃▃▃▄▃▄▄▄▃▃▃▃▃▃▂▂▂▂▃▃▂▂▂▃▂▂▂▂▂▂▂▂▂▂▂▂▁▂▂▂ ▃\n  3.41 ms         Histogram: frequency by time        6.54 ms <\n\n Memory estimate: 806.21 KiB, allocs estimate: 7886.\n
\n
    \n
  • SCS
  • \n
\n
BenchmarkTools.Trial: 98 samples with 1 evaluation per sample.\n Range (min … max):  49.280 ms …  53.704 ms  ┊ GC (min … max): 0.00% … 0.00%\n Time  (median):     50.892 ms               ┊ GC (median):    0.00%\n Time  (mean ± σ):   51.055 ms ± 918.217 μs  ┊ GC (mean ± σ):  0.00% ± 0.00%\n\n       ▁        ▃ ▁▁▁█ █▃ ▁ ▃ ▁   ▆   ▁           ▁\n  ▄▁▁▇▁█▁▁▄▄▇▄▄▇█▇████▇██▄█▇█▄█▄▁▄█▄▇▇█▁▇▄▄▄▄▁▇▇▄▄█▄▁▄▄▁▄▁▁▁▁▇ ▁\n  49.3 ms         Histogram: frequency by time         53.2 ms <\n\n Memory estimate: 694.24 KiB, allocs estimate: 7998.\n
\n
    \n
  • ADMM (My code):
  • \n
\n
BenchmarkTools.Trial: 7569 samples with 1 evaluation per sample.\n Range (min … max):  447.700 μs …  23.329 ms  ┊ GC (min … max): 0.00% … 70.82%\n Time  (median):     651.300 μs               ┊ GC (median):    0.00%\n Time  (mean ± σ):   656.690 μs ± 412.333 μs  ┊ GC (mean ± σ):  1.30% ±  2.26%\n\n   ▁▄▄▁            ▁▃▅▅▆▆█▇▇▆▅▄▂▁▁\n  ▃████▆▄▃▂▂▂▂▂▁▂▃▅███████████████▇▆▆▄▅▄▄▄▃▃▂▂▂▂▂▂▂▂▂▁▁▂▁▁▁▁▁▁▁ ▄\n  448 μs           Histogram: frequency by time          970 μs <\n\n Memory estimate: 874.89 KiB, allocs estimate: 1089.\n
\n

The ADMM method is an order of magnitude faster than the generic solvers.
\nIt can be greatly improved as it designed for arbitrary matrix $\\boldsymbol{E}$. It can be farther optimized for the case of equality.

\n
\n

The code is available on my StackExchange Code GitHub Repository (Look at the ComputationalScience\\Q45334 folder).

\n", "answer_id": 45341, "answer_text": "I produced an ADMM based solver which I found very efficient.\n\n\n\n\nThe problem is given by:\n\n\n\n\n$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{x} } & \\quad & \\frac{1}{2} \\left\\| \\boldsymbol{x} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\frac{\\lambda}{2} {\\left\\| \\boldsymbol{D}^{m} \\boldsymbol{x} \\right\\|}_{2}^{2} \\\\\n\\text{subject to} & \\quad & {x}_{i} = {y}_{i} \\; \\forall i \\in \\mathcal{I} \\\\\n& \\quad & \\boldsymbol{A} \\boldsymbol{x} \\leq \\boldsymbol{0} \\\\\n\\end{alignat*}\n$$\n\n\n\n\nI will use $\\boldsymbol{D} = \\boldsymbol{D}^{m}$ to simplify notations.\n\nThe equality constraints can be turned into matrix form and the problem becomes:\n\n\n\n\n$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{x} } & \\quad & \\frac{1}{2} \\left\\| \\boldsymbol{x} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\frac{\\lambda}{2} {\\left\\| \\boldsymbol{D} \\boldsymbol{x} \\right\\|}_{2}^{2} \\\\\n\\text{subject to} & \\quad & \\boldsymbol{E} \\boldsymbol{x} = \\boldsymbol{d} \\\\\n& \\quad & \\boldsymbol{A} \\boldsymbol{x} \\leq \\boldsymbol{0} \\\\\n\\end{alignat*}\n$$\n\n\n\n\nThe trick to utilize the ADMM framework is to introduce a slack variable to handle the inequality constraint:\n\n\n\n\n$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{x} } & \\quad & \\frac{1}{2} \\left\\| \\boldsymbol{x} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\frac{\\lambda}{2} {\\left\\| \\boldsymbol{D} \\boldsymbol{x} \\right\\|}_{2}^{2} \\\\\n\\text{subject to} & \\quad & \\boldsymbol{E} \\boldsymbol{x} = \\boldsymbol{d} \\\\\n& \\quad & \\boldsymbol{A} \\boldsymbol{x} + \\boldsymbol{s} = \\boldsymbol{0} \\\\\n& \\quad & \\boldsymbol{s} \\geq \\boldsymbol{0} \\\\\n\\end{alignat*}\n$$\n\n\n\n\nThe equality constraints are introduced by the Augmented Lagrangian:\n\n\n\n\n$$\n{\\ell}_{\\rho} \\left( \\boldsymbol{x}, \\boldsymbol{s}, \\boldsymbol{\\mu}, \\boldsymbol{\\nu} \\right) = \\frac{1}{2} \\left\\| \\boldsymbol{x} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\frac{\\lambda}{2} {\\left\\| \\boldsymbol{D} \\boldsymbol{x} \\right\\|}_{2}^{2} + \\frac{\\rho}{2} {\\left\\| \\boldsymbol{A} \\boldsymbol{x} + \\boldsymbol{s} + {\\rho}^{-1} \\boldsymbol{\\mu} \\right\\|}_{2}^{2} + \\frac{\\rho}{2} {\\left\\| \\boldsymbol{E} \\boldsymbol{x} - \\boldsymbol{d} + {\\rho}^{-1} \\boldsymbol{\\nu} \\right\\|}_{2}^{2} + {I}_{\\mathbb{R}_{+}} \\left( \\boldsymbol{s} \\right)\n$$\n\n\n\n\nThe steps to solve:\n\n\n\n\n\nPrimal Update (Solve Linear System): $\\boldsymbol{x}^{ \\left( k + 1 \\right)} = {\\left( \\boldsymbol{I} + \\lambda \\boldsymbol{D}^{\\top} \\boldsymbol{D} + \\rho \\boldsymbol{A}^{\\top} \\boldsymbol{A} + \\rho\\boldsymbol{E}^{\\top} \\boldsymbol{E} \\right)}^{-1} \\left( \\boldsymbol{y} - \\boldsymbol{A}^{\\top} \\left( \\rho \\boldsymbol{s}^{\\left( k \\right)} + \\boldsymbol{\\mu}^{\\left( k \\right)} \\right) + \\boldsymbol{E}^{\\top} \\left( \\rho \\boldsymbol{d} - \\boldsymbol{\\nu}^{\\left( k \\right)} \\right) \\right)$.\n\n\n\n\nSlack Update (Non Negative LS): $\\boldsymbol{s}^{ \\left( k + 1 \\right)} = \\max \\left( \\boldsymbol{0}, - \\boldsymbol{A} \\boldsymbol{x}^{\\left( k + 1 \\right)} - {\\rho}^{-1} \\boldsymbol{\\mu}^{\\left( k \\right)} \\right)$.\n\n\n\n\nDual Update (Gradient Ascent) for $\\boldsymbol{\\mu}$: $\\boldsymbol{\\mu}^{\\left( k + 1 \\right)} = \\boldsymbol{\\mu}^{\\left( k \\right)} + \\rho \\left( \\boldsymbol{A} \\boldsymbol{x}^{\\left( k + 1 \\right)} + \\boldsymbol{s}^{\\left( k + 1 \\right)} \\right)$.\n\n\n\n\nDual Update (Gradient Ascent) for $\\boldsymbol{\\nu}$: $\\boldsymbol{\\nu}^{\\left( k + 1 \\right)} = \\boldsymbol{\\nu}^{\\left( k \\right)} + \\rho \\left( \\boldsymbol{E} \\boldsymbol{x}^{\\left( k + 1 \\right)} - \\boldsymbol{d} \\right)$.\n\n\n\n\n\nThe stopping condition is when both residuals are below a threshold:\n\n\n\n\n\nPrimal Residual: ${r}^{\\left( k \\right)} = {\\left\\| \\boldsymbol{A} \\boldsymbol{x}^{\\left( k \\right)} + \\boldsymbol{s}^{\\left( k \\right)} \\right\\|}_{\\infty}$.\n\n\n\n\nDual Residual (OSQP Style): ${s}^{\\left( k \\right)} = {\\left\\| \\rho \\boldsymbol{A} \\left( \\boldsymbol{s}^{\\left( k \\right)} - \\boldsymbol{s}^{\\left( k - 1 \\right)} \\right) \\right\\|}_{\\infty}$.\n\n\n\n\n\nThe use of the infinity norm decouples the dimension of the problem from the thresholds.\n\n\n\n\nI also used OSQP style update of the $\\rho$ parameter to accelerate convergence: ${\\rho}^{\\left( k \\right)} = {\\rho}^{\\left( k - 1 \\right)} \\sqrt{ \\frac{ {r}^{\\left( k \\right)} }{ {s}^{\\left( k \\right)} } }$.\n\n\n\n\nI implemented all in Julia and compared to the ECOS (https://github.com/embotech/ecos) / SCS (https://github.com/cvxgrp/scs) solvers wrapped by Convex.jl (https://github.com/jump-dev/Convex.jl).\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/f5YcjFm6.png] (https://i.sstatic.net/f5YcjFm6.png)\n\n\n\n\nRun Times:\n\n\n\n\n\nECOS\n\n\n\n\n\nBenchmarkTools.Trial: 1227 samples with 1 evaluation per sample.\n Range (min … max): 3.412 ms … 18.615 ms ┊ GC (min … max): 0.00% … 60.46%\n Time (median): 3.807 ms ┊ GC (median): 0.00%\n Time (mean ± σ): 4.061 ms ± 859.845 μs ┊ GC (mean ± σ): 1.67% ± 5.36%\n\n ▅█▇▄▃ ▁\n ▄████████▇▆▇▅▆▅▅▄▄▃▃▃▃▄▃▄▄▄▃▃▃▃▃▃▂▂▂▂▃▃▂▂▂▃▂▂▂▂▂▂▂▂▂▂▂▂▁▂▂▂ ▃\n 3.41 ms Histogram: frequency by time 6.54 ms <\n\n Memory estimate: 806.21 KiB, allocs estimate: 7886.\n\n\n\n\n\n\nSCS\n\n\n\n\n\nBenchmarkTools.Trial: 98 samples with 1 evaluation per sample.\n Range (min … max): 49.280 ms … 53.704 ms ┊ GC (min … max): 0.00% … 0.00%\n Time (median): 50.892 ms ┊ GC (median): 0.00%\n Time (mean ± σ): 51.055 ms ± 918.217 μs ┊ GC (mean ± σ): 0.00% ± 0.00%\n\n ▁ ▃ ▁▁▁█ █▃ ▁ ▃ ▁ ▆ ▁ ▁\n ▄▁▁▇▁█▁▁▄▄▇▄▄▇█▇████▇██▄█▇█▄█▄▁▄█▄▇▇█▁▇▄▄▄▄▁▇▇▄▄█▄▁▄▄▁▄▁▁▁▁▇ ▁\n 49.3 ms Histogram: frequency by time 53.2 ms <\n\n Memory estimate: 694.24 KiB, allocs estimate: 7998.\n\n\n\n\n\n\nADMM (My code):\n\n\n\n\n\nBenchmarkTools.Trial: 7569 samples with 1 evaluation per sample.\n Range (min … max): 447.700 μs … 23.329 ms ┊ GC (min … max): 0.00% … 70.82%\n Time (median): 651.300 μs ┊ GC (median): 0.00%\n Time (mean ± σ): 656.690 μs ± 412.333 μs ┊ GC (mean ± σ): 1.30% ± 2.26%\n\n ▁▄▄▁ ▁▃▅▅▆▆█▇▇▆▅▄▂▁▁\n ▃████▆▄▃▂▂▂▂▂▁▂▃▅███████████████▇▆▆▄▅▄▄▄▃▃▂▂▂▂▂▂▂▂▂▁▁▂▁▁▁▁▁▁▁ ▄\n 448 μs Histogram: frequency by time 970 μs <\n\n Memory estimate: 874.89 KiB, allocs estimate: 1089.\n\n\n\n\n\nThe ADMM method is an order of magnitude faster than the generic solvers.\n\nIt can be greatly improved as it designed for arbitrary matrix $\\boldsymbol{E}$. It can be farther optimized for the case of equality.\n\n\n\n\n\n\n\nThe code is available on my StackExchange Code GitHub Repository (https://github.com/RoyiAvital/StackExchangeCodes) (Look at the ComputationalScience\\Q45334 folder).", "answer_url": "https://scicomp.stackexchange.com/a/45341", "author": "Royi", "author_url": "https://scicomp.stackexchange.com/users/7951/royi", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-01-17T09:49:49+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45334, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Royi", "profile_url": "https://scicomp.stackexchange.com/users/7951/royi", "user_type": "registered"}, "created_at": "2026-01-17T09:49:49+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "00755B30-2CCE-4266-8BA0-1A21879D0A39", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/00755B30-2CCE-4266-8BA0-1A21879D0A39/view-source"}], "score": 2, "updated_at": "2026-01-17T09:49:49+00:00"}, {"answer_html": "

Another formulation take advantage of the equality constraint to make the problem formulation smaller.

\n

The problem is given by:

\n

$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{x} } & \\quad & \\frac{1}{2} \\left\\| \\boldsymbol{x} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\frac{\\lambda}{2} {\\left\\| \\boldsymbol{D} \\boldsymbol{x} \\right\\|}_{2}^{2} \\\\\n\\text{subject to} & \\quad & {x}_{i} = {y}_{i} \\; \\forall i \\in \\mathcal{I} \\\\\n& \\quad & \\boldsymbol{A} \\boldsymbol{x} \\leq \\boldsymbol{0} \\\\\n\\end{alignat*}\n$$

\n

Let $\\mathcal{J} = \\left\\{ 1, 2, \\ldots, n \\right\\} \\setminus \\mathcal{I}$ then define:

\n

$$ \\boldsymbol{x} = \\begin{bmatrix} \\boldsymbol{x}_{\\mathcal{J}} \\\\ \\boldsymbol{x}_{\\mathcal{I}} \\end{bmatrix}, \\; \\boldsymbol{A} = \\begin{bmatrix} \\boldsymbol{A}_{\\mathcal{J}} && \\boldsymbol{A}_{\\mathcal{I}} \\end{bmatrix}, \\boldsymbol{D} = \\begin{bmatrix} \\boldsymbol{D}_{\\mathcal{J}} && \\boldsymbol{D}_{\\mathcal{I}} \\end{bmatrix}$$

\n

Then the above can be formulated as:

\n

$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{x}_{\\mathcal{J}} } & \\quad & \\frac{1}{2} \\boldsymbol{x}_{\\mathcal{J}}^{\\top} \\boldsymbol{P} \\boldsymbol{x}_{\\mathcal{J}} + \\boldsymbol{q}^{\\top} \\boldsymbol{x}_{\\mathcal{J}} \\\\\n\\text{subject to} & \\quad & \\boldsymbol{A}_{\\mathcal{J}} \\boldsymbol{x}_{\\mathcal{J}} \\leq \\boldsymbol{b} \\\\\n\\end{alignat*}\n$$

\n

Where $\\boldsymbol{P} = \\boldsymbol{I} + \\lambda \\boldsymbol{D}_{\\mathcal{J}}^{\\top} \\boldsymbol{D}_{\\mathcal{J}}, \\; \\boldsymbol{q} = - \\boldsymbol{y}_{\\mathcal{J}} + \\lambda \\boldsymbol{D}_{\\mathcal{J}}^{\\top} \\boldsymbol{D}_{\\mathcal{I}} \\boldsymbol{y}_{\\mathcal{I}}, \\; \\boldsymbol{b} = \\boldsymbol{A}_{\\mathcal{I}} \\boldsymbol{y}_{\\mathcal{I}}$.

\n

This formulation reduces the number of constraints to handle.
\nThe inequality is treated by introducing a slack variable $\\boldsymbol{s} \\geq \\boldsymbol{0}$ such that $\\boldsymbol{A}_{\\mathcal{J}} \\boldsymbol{x}_{\\mathcal{J}} + \\boldsymbol{s} = \\boldsymbol{b}$.

\n

The Augmented Lagrangian (Scaled form) is given by:

\n

$$\n{\\ell}_{\\rho} \\left( \\boldsymbol{x}_{\\mathcal{J}}, \\boldsymbol{s}, \\boldsymbol{\\mu} \\right) = \\frac{1}{2} \\boldsymbol{x}_{\\mathcal{J}}^{\\top} \\boldsymbol{P} \\boldsymbol{x}_{\\mathcal{J}} + \\boldsymbol{q}^{\\top} \\boldsymbol{x}_{\\mathcal{J}} + \\frac{\\rho}{2} {\\left\\| \\boldsymbol{A}_{\\mathcal{J}} \\boldsymbol{x}_{\\mathcal{J}} + \\boldsymbol{s} - \\boldsymbol{b} + \\boldsymbol{\\mu} \\right\\|}_{2}^{2} + {I}_{\\mathbb{R}_{+}} \\left( \\boldsymbol{s} \\right)\n$$

\n

The steps to solve:

\n
    \n
  • Primal Update (Solve Linear System): $\\boldsymbol{x}_{\\mathcal{J}}^{\\left( k + 1 \\right)} = {\\left( \\boldsymbol{P} + \\rho \\boldsymbol{A}_{\\mathcal{J}}^{\\top} \\boldsymbol{A}_{\\mathcal{J}} \\right)}^{-1} \\left( - \\boldsymbol{q} + \\rho \\boldsymbol{A}_{\\mathcal{J}} \\left( \\boldsymbol{b} - \\boldsymbol{s}^{\\left( k \\right)} - \\boldsymbol{\\mu}^{\\left( k \\right)} \\right) \\right)$.
  • \n
  • Slack Update (Non Negative LS / Projection): $\\boldsymbol{s}^{\\left( k + 1 \\right)} = \\max \\left(\\boldsymbol{0}, \\boldsymbol{b} - \\boldsymbol{A}_{\\mathcal{J}} \\boldsymbol{x}_{\\mathcal{J}}^{\\left( k + 1 \\right)} - \\boldsymbol{\\mu}^{\\left( k \\right)} \\right)$.
  • \n
  • Dual Update (Gradient Ascent): $\\boldsymbol{\\mu}^{\\left( k + 1 \\right)} = \\boldsymbol{\\mu}^{\\left( k \\right)} + \\left( \\boldsymbol{A}_{\\mathcal{J}} \\boldsymbol{x}_{\\mathcal{J}}^{\\left( k + 1 \\right)} + \\boldsymbol{s}^{\\left( k + 1 \\right)} - \\boldsymbol{b} \\right)$.
  • \n
\n

The rest is similar to above with the needed adjustments for the residuals calculations.

\n

This implementation reduced another 40 [Micro Sec] of the run time.

\n", "answer_id": 45342, "answer_text": "Another formulation take advantage of the equality constraint to make the problem formulation smaller.\n\n\n\n\nThe problem is given by:\n\n\n\n\n$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{x} } & \\quad & \\frac{1}{2} \\left\\| \\boldsymbol{x} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\frac{\\lambda}{2} {\\left\\| \\boldsymbol{D} \\boldsymbol{x} \\right\\|}_{2}^{2} \\\\\n\\text{subject to} & \\quad & {x}_{i} = {y}_{i} \\; \\forall i \\in \\mathcal{I} \\\\\n& \\quad & \\boldsymbol{A} \\boldsymbol{x} \\leq \\boldsymbol{0} \\\\\n\\end{alignat*}\n$$\n\n\n\n\nLet $\\mathcal{J} = \\left\\{ 1, 2, \\ldots, n \\right\\} \\setminus \\mathcal{I}$ then define:\n\n\n\n\n$$ \\boldsymbol{x} = \\begin{bmatrix} \\boldsymbol{x}_{\\mathcal{J}} \\\\ \\boldsymbol{x}_{\\mathcal{I}} \\end{bmatrix}, \\; \\boldsymbol{A} = \\begin{bmatrix} \\boldsymbol{A}_{\\mathcal{J}} && \\boldsymbol{A}_{\\mathcal{I}} \\end{bmatrix}, \\boldsymbol{D} = \\begin{bmatrix} \\boldsymbol{D}_{\\mathcal{J}} && \\boldsymbol{D}_{\\mathcal{I}} \\end{bmatrix}$$\n\n\n\n\nThen the above can be formulated as:\n\n\n\n\n$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{x}_{\\mathcal{J}} } & \\quad & \\frac{1}{2} \\boldsymbol{x}_{\\mathcal{J}}^{\\top} \\boldsymbol{P} \\boldsymbol{x}_{\\mathcal{J}} + \\boldsymbol{q}^{\\top} \\boldsymbol{x}_{\\mathcal{J}} \\\\\n\\text{subject to} & \\quad & \\boldsymbol{A}_{\\mathcal{J}} \\boldsymbol{x}_{\\mathcal{J}} \\leq \\boldsymbol{b} \\\\\n\\end{alignat*}\n$$\n\n\n\n\nWhere $\\boldsymbol{P} = \\boldsymbol{I} + \\lambda \\boldsymbol{D}_{\\mathcal{J}}^{\\top} \\boldsymbol{D}_{\\mathcal{J}}, \\; \\boldsymbol{q} = - \\boldsymbol{y}_{\\mathcal{J}} + \\lambda \\boldsymbol{D}_{\\mathcal{J}}^{\\top} \\boldsymbol{D}_{\\mathcal{I}} \\boldsymbol{y}_{\\mathcal{I}}, \\; \\boldsymbol{b} = \\boldsymbol{A}_{\\mathcal{I}} \\boldsymbol{y}_{\\mathcal{I}}$.\n\n\n\n\nThis formulation reduces the number of constraints to handle.\n\nThe inequality is treated by introducing a slack variable $\\boldsymbol{s} \\geq \\boldsymbol{0}$ such that $\\boldsymbol{A}_{\\mathcal{J}} \\boldsymbol{x}_{\\mathcal{J}} + \\boldsymbol{s} = \\boldsymbol{b}$.\n\n\n\n\nThe Augmented Lagrangian (Scaled form) is given by:\n\n\n\n\n$$\n{\\ell}_{\\rho} \\left( \\boldsymbol{x}_{\\mathcal{J}}, \\boldsymbol{s}, \\boldsymbol{\\mu} \\right) = \\frac{1}{2} \\boldsymbol{x}_{\\mathcal{J}}^{\\top} \\boldsymbol{P} \\boldsymbol{x}_{\\mathcal{J}} + \\boldsymbol{q}^{\\top} \\boldsymbol{x}_{\\mathcal{J}} + \\frac{\\rho}{2} {\\left\\| \\boldsymbol{A}_{\\mathcal{J}} \\boldsymbol{x}_{\\mathcal{J}} + \\boldsymbol{s} - \\boldsymbol{b} + \\boldsymbol{\\mu} \\right\\|}_{2}^{2} + {I}_{\\mathbb{R}_{+}} \\left( \\boldsymbol{s} \\right)\n$$\n\n\n\n\nThe steps to solve:\n\n\n\n\n\nPrimal Update (Solve Linear System): $\\boldsymbol{x}_{\\mathcal{J}}^{\\left( k + 1 \\right)} = {\\left( \\boldsymbol{P} + \\rho \\boldsymbol{A}_{\\mathcal{J}}^{\\top} \\boldsymbol{A}_{\\mathcal{J}} \\right)}^{-1} \\left( - \\boldsymbol{q} + \\rho \\boldsymbol{A}_{\\mathcal{J}} \\left( \\boldsymbol{b} - \\boldsymbol{s}^{\\left( k \\right)} - \\boldsymbol{\\mu}^{\\left( k \\right)} \\right) \\right)$.\n\n\n\n\nSlack Update (Non Negative LS / Projection): $\\boldsymbol{s}^{\\left( k + 1 \\right)} = \\max \\left(\\boldsymbol{0}, \\boldsymbol{b} - \\boldsymbol{A}_{\\mathcal{J}} \\boldsymbol{x}_{\\mathcal{J}}^{\\left( k + 1 \\right)} - \\boldsymbol{\\mu}^{\\left( k \\right)} \\right)$.\n\n\n\n\nDual Update (Gradient Ascent): $\\boldsymbol{\\mu}^{\\left( k + 1 \\right)} = \\boldsymbol{\\mu}^{\\left( k \\right)} + \\left( \\boldsymbol{A}_{\\mathcal{J}} \\boldsymbol{x}_{\\mathcal{J}}^{\\left( k + 1 \\right)} + \\boldsymbol{s}^{\\left( k + 1 \\right)} - \\boldsymbol{b} \\right)$.\n\n\n\n\n\nThe rest is similar to above with the needed adjustments for the residuals calculations.\n\n\n\n\nThis implementation reduced another 40 [Micro Sec] of the run time.", "answer_url": "https://scicomp.stackexchange.com/a/45342", "author": "Royi", "author_url": "https://scicomp.stackexchange.com/users/7951/royi", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-01-17T12:18:23+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45334, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Royi", "profile_url": "https://scicomp.stackexchange.com/users/7951/royi", "user_type": "registered"}, "created_at": "2026-01-17T12:18:23+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "9FE8A84D-E3F5-41A7-B296-8A0BBB5EB8BB", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/9FE8A84D-E3F5-41A7-B296-8A0BBB5EB8BB/view-source"}], "score": 1, "updated_at": "2026-01-17T12:18:23+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "Let a 1D curve defined by $\\left\\{ {y}_{1}, {y}_{2}, \\ldots, {y}_{n} \\right\\}$ sampled on a uniform grid.\n\n\n\n\nI want to smooth the curve with the following properties:\n\n\n\n\n\nThe result, $\\left\\{ {z}_{1}, {z}_{2}, \\ldots {z}_{n} \\right\\}$ should be smooth like Spline based method.\n\n\n\n\nFor a set of indices $\\mathcal{I}$ the smoothed curve must go through the reference point, namely ${z}_{i} = {y}_{i} \\; \\forall i \\in \\mathcal{I}$.\n\n\n\n\nThe smoothed values between 2 reference points must be monotonic.\n\n\n\n\n\nI came up with the following model:\n\n\n\n\n$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{z} } & \\quad & \\frac{1}{2} \\left\\| \\boldsymbol{z} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\lambda {\\left\\| \\boldsymbol{D}^{m} \\boldsymbol{z} \\right\\|}_{2}^{2} \\\\\n\\text{subject to} & \\quad & {z}_{i} = {y}_{i} \\; \\forall i \\in \\mathcal{I} \\\\\n& \\quad & \\boldsymbol{A} \\boldsymbol{z} \\leq \\boldsymbol{0} \\\\\n\\end{alignat*}\n$$\n\n\n\n\nWhere $\\boldsymbol{D}^{m}$ is the $m$ -th derivative operator.\n\n\n\n\nI am looking for a fast way to solve the problem for the case of 50-1500 samples.\n\n\n\n\nI rather not use black box Quadratic Programming solvers but design a simple to implement iterative method.", "record_id": "Scientific-Answer-Ranking:scicomp:45334", "scores": [3, 0, 2, 1], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "
\n

monothonic

\n
\n

I'm sure you meant monotonic.

\n
\n

I am looking for a fast way to solve the problem

\n
\n

Are you actually? I think if you were, you would use something off-the-shelf. "Simple iterative" and "fast" don't particularly jive, here. Let's take a random stab at remodelling your problem to meet some of your criteria:

\n
    \n
  • Linear, not quadratic
  • \n
  • No manual iteration per se
  • \n
  • Enforce inter-reference monotonicity through simple linear constraints
  • \n
  • Model cost as being absolute error plus absolute second-order differential, the latter receiving your $\\lambda$ weight
  • \n
\n

A traditional LP would express the problem thus. Define the following decision vectors:

\n
    \n
  • $z \\in \\mathbb R^n$, the fit points
  • \n
  • $z_p \\in \\mathbb R^n$, $z_p \\ge 0$, positive-clipped fit error
  • \n
  • $z_n \\in \\mathbb R^n$, $z_n \\ge 0$, negative-clipped fit error
  • \n
  • $d_p \\in \\mathbb R^{n-2}$, $d_p \\ge 0$, positive-clipped second-order differentials
  • \n
  • $d_n \\in \\mathbb R^{n-2}$, $d_n \\ge 0$, negative-clipped second-order differentials
  • \n
\n

Find

\n

$$ \\min_z z_p + z_n + \\lambda ( d_p + d_n ) $$

\n

given the following constraints:

\n

$$ z_p \\ge z - y $$\n$$ z_n \\ge y - z $$\n$$ d_p \\ge \\frac {\\partial^2 z} {\\partial i^2} $$\n$$ d_n \\ge -\\frac {\\partial^2 z} {\\partial i^2} $$\n$ (z_{i+1} - z_i) \\text{sgn}( y_1 - y_0 ) \\ge 0 $ for every index $i$ between every anchor point $y_0$, $y_1$

\n

$ \\frac {\\partial^2 z} {\\partial i^2} $ discretised by:\n$$ \\begin{bmatrix}\n1 & -2 & 1 \\\\\n & 1 & -2 & 1 \\\\\n & & & & \\ddots\n\\end{bmatrix} z $$

\n

The problem is very sparse, and I trust that essentially no LP solvers would have any difficulty with it. HiGHS completes it quickly.

\n
import matplotlib.pyplot as plt\nimport numpy as np\nimport scipy.sparse as sp\nfrom scipy.optimize import milp, LinearConstraint\n\n\ndef sample_data(rand: np.random.Generator, n: int = 1501) -> tuple[\n    np.ndarray, np.ndarray, np.ndarray,\n]:\n    x = np.linspace(start=0, stop=10, num=n)\n    y = rand.uniform(low=-0.1, high=0.1, size=x.size).cumsum()\n    iref = np.array((2, 6, 9))*(n//10)\n    return x, y, iref\n\n\ndef cost(n: int, nd: int, smoothing: float) -> np.ndarray:\n    return np.concatenate((\n        np.zeros(n),   # z does not incur a cost directly\n        np.ones(2*n),  # zerr cost\n        np.full(2*nd, fill_value=smoothing),\n    ))\n\n\ndef bounds(iref: np.ndarray, n: int, nd: int, y: np.ndarray) -> np.ndarray:\n    lbound, ubound = bounds = np.zeros((2, 3*n + 2*nd))\n    lbound[:n] = -np.inf\n    ubound[:] = np.inf\n\n    iprev = iref[:-1]\n    inext = iref[1:]\n    pprev = y[iprev]\n    pnext = y[inext]\n    pfloor = np.minimum(pprev, pnext)\n    pceil = np.maximum(pprev, pnext)\n\n    for i0, i1, plo, phi in zip(iprev, inext, pfloor, pceil):\n        lbound[i0] = y[i0]\n        ubound[i0] = y[i0]\n        inner = slice(i0 + 1, i1)\n        lbound[inner] = plo\n        ubound[inner] = phi\n    lbound[iref[-1]] = y[iref[-1]]\n    ubound[iref[-1]] = y[iref[-1]]\n\n    return bounds\n\n\ndef zerror_constraints(n: int, nd: int, y: np.ndarray) -> tuple[LinearConstraint, ...]:\n    # zep >= z - y:  z - zep <= y\n    # zen >= y - z:  z + zen >= y\n    eye = sp.eye_array(n)\n    zero = sp.csc_array((n, n))\n    zerond = sp.csc_array((n, 2*nd))\n    pos = LinearConstraint(\n        A=sp.hstack((eye, -eye, zero, zerond), format='csc'), ub=y)\n    neg = LinearConstraint(\n        A=sp.hstack((eye, zero, eye, zerond), format='csc'), lb=y)\n    return pos, neg\n\n\ndef d2_constraints(n: int, nd: int) -> tuple[LinearConstraint, ...]:\n    # d2z/dt2 = z[i+2] - 2z[i+1] + z[i]\n    # d2p >=  d2z/dt2: -z[i] + 2z[i+1] - z[i+2] +0 +0 + d2p >= 0\n    # d2n >= -d2z/dt2:  z[i] - 2z[i+1] + z[i+2] +0 +0 +   0 + d2n >= 0\n    data = np.broadcast_to(\n        np.array(([1], [-2], [1]), dtype=np.float32),  # don't bother with /dt**2\n        shape=(3, n))\n    offsets = np.array((0, 1, 2), dtype=np.int32)\n    kernel = sp.dia_array((data, offsets), shape=(nd, n))\n    err_zero = sp.csc_array((nd, 2*n))\n    eye = sp.eye_array(nd)\n    zero = sp.csc_array((nd, nd))\n    pos = LinearConstraint(\n        A=sp.hstack((-kernel, err_zero, eye, zero), format='csc'), lb=0)\n    neg = LinearConstraint(\n        A=sp.hstack(( kernel, err_zero, zero, eye), format='csc'), lb=0)\n    return pos, neg\n\n\ndef monotone_constraints(n: int, nd: int, y: np.ndarray, iref: np.ndarray) -> tuple[LinearConstraint, ...]:\n    iprev = iref[:-1]\n    inext = iref[1:]\n    yprev = y[iprev]\n    ynext = y[inext]\n    blocks = []\n\n    for i0, i1, y0, y1 in zip(iprev, inext, yprev, ynext):\n        sign = np.sign(y1 - y0)\n        if sign == 0:\n            continue  # the entire segment will already have lower and upper bounds equal to each other\n        block = sp.eye_array(\n            m=i1 - i0, n=3*n + 2*nd, k=i0 + 1,\n        ) - sp.eye_array(\n            m=i1 - i0, n=3*n + 2*nd, k=i0)\n        blocks.append(sign*block)\n    constraint = LinearConstraint(A=sp.vstack(blocks, format='csc'), lb=0)\n    return constraint,\n\n\ndef solve(y: np.ndarray, iref: np.ndarray, smoothing: float = 1.) -> tuple[\n    np.ndarray, tuple[LinearConstraint, ...],\n]:\n    '''\n    Variables:\n        z, continuous unbounded (outside of ref points)\n        zep, continuous, >= 0, >= z-y\n        zen, continuous, >= 0, >= y-z\n        d2p, n-2, continuous, >= 0, >= d2z/dt2\n        d2n, n-2, continuous, >= 0, >= -d2z/dt2\n    '''\n    n = y.size\n    nd = n - 2\n    constraints = (\n        zerror_constraints(n, nd, y) + d2_constraints(n, nd) + monotone_constraints(n, nd, y, iref)\n    )\n\n    result = milp(\n        c=cost(n, nd, smoothing), integrality=0, bounds=bounds(iref, n, nd, y),\n        constraints=constraints,\n    )\n    if not result.success:\n        raise result.message\n    z, zep, zen, d2p, d2n = np.split(result.x, (n, 2*n, 3*n, 3*n+nd))\n    return z, constraints\n\n\ndef demo() -> None:\n    rand = np.random.default_rng(seed=0)\n    x, y, iref = sample_data(rand, n=801)\n\n    fig, ax = plt.subplots()\n    ax.plot(x, y, label='orig')\n    ax.scatter(x[iref], y[iref], color='red', label='ref point')\n\n    for smoothing in (0.5, 3):\n        z, constraints = solve(y, iref, smoothing)\n        ax.plot(x, z, label=f'smooth={smoothing}')\n    ax.legend()\n\n    sparsity = sp.vstack([c.A for c in constraints]).sign().toarray()\n    fig, ax = plt.subplots()\n    ax.set_title(f'Constraint sparsity, n={y.size}')\n    ax.imshow(sparsity)\n\n    plt.show()\n\n\nif __name__ == '__main__':\n    demo()\n
\n

Here we see that the solution does exactly what we tell it to:

\n

\"example

\n

Outside of the reference points, monotonicity is not enforced so the smoothed curve follows the input curve. Within the reference points, monotonicity is preserved, and the solver does its best to balance smoothing and fitting; a finer-scale depiction of this behaviour:

\n

\"smoothing\"

\n

The sparsity pattern for the problem looks like this (size reduced for visibility):

\n

\"sparsity\"

\n

Though the performance will vary based on hardware and dataset content and size, for n=1501 I see execution times of ~80 ms.

\n", "answer_id": 45335, "answer_text": "monothonic\n\n\n\n\n\n\n\nI'm sure you meant monotonic.\n\n\n\n\n\n\n\nI am looking for a fast way to solve the problem\n\n\n\n\n\n\n\nAre you actually? I think if you were, you would use something off-the-shelf. \"Simple iterative\" and \"fast\" don't particularly jive, here. Let's take a random stab at remodelling your problem to meet some of your criteria:\n\n\n\n\n\nLinear, not quadratic\n\n\n\n\nNo manual iteration per se\n\n\n\n\nEnforce inter-reference monotonicity through simple linear constraints\n\n\n\n\nModel cost as being absolute error plus absolute second-order differential, the latter receiving your $\\lambda$ weight\n\n\n\n\n\nA traditional LP would express the problem thus. Define the following decision vectors:\n\n\n\n\n\n$z \\in \\mathbb R^n$, the fit points\n\n\n\n\n$z_p \\in \\mathbb R^n$, $z_p \\ge 0$, positive-clipped fit error\n\n\n\n\n$z_n \\in \\mathbb R^n$, $z_n \\ge 0$, negative-clipped fit error\n\n\n\n\n$d_p \\in \\mathbb R^{n-2}$, $d_p \\ge 0$, positive-clipped second-order differentials\n\n\n\n\n$d_n \\in \\mathbb R^{n-2}$, $d_n \\ge 0$, negative-clipped second-order differentials\n\n\n\n\n\nFind\n\n\n\n\n$$ \\min_z z_p + z_n + \\lambda ( d_p + d_n ) $$\n\n\n\n\ngiven the following constraints:\n\n\n\n\n$$ z_p \\ge z - y $$\n$$ z_n \\ge y - z $$\n$$ d_p \\ge \\frac {\\partial^2 z} {\\partial i^2} $$\n$$ d_n \\ge -\\frac {\\partial^2 z} {\\partial i^2} $$\n$ (z_{i+1} - z_i) \\text{sgn}( y_1 - y_0 ) \\ge 0 $ for every index $i$ between every anchor point $y_0$, $y_1$\n\n\n\n\n$ \\frac {\\partial^2 z} {\\partial i^2} $ discretised by:\n$$ \\begin{bmatrix}\n1 & -2 & 1 \\\\\n & 1 & -2 & 1 \\\\\n & & & & \\ddots\n\\end{bmatrix} z $$\n\n\n\n\nThe problem is very sparse, and I trust that essentially no LP solvers would have any difficulty with it. HiGHS completes it quickly.\n\n\n\n\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport scipy.sparse as sp\nfrom scipy.optimize import milp, LinearConstraint\n\n\ndef sample_data(rand: np.random.Generator, n: int = 1501) -> tuple[\n np.ndarray, np.ndarray, np.ndarray,\n]:\n x = np.linspace(start=0, stop=10, num=n)\n y = rand.uniform(low=-0.1, high=0.1, size=x.size).cumsum()\n iref = np.array((2, 6, 9))*(n//10)\n return x, y, iref\n\n\ndef cost(n: int, nd: int, smoothing: float) -> np.ndarray:\n return np.concatenate((\n np.zeros(n), # z does not incur a cost directly\n np.ones(2*n), # zerr cost\n np.full(2*nd, fill_value=smoothing),\n ))\n\n\ndef bounds(iref: np.ndarray, n: int, nd: int, y: np.ndarray) -> np.ndarray:\n lbound, ubound = bounds = np.zeros((2, 3*n + 2*nd))\n lbound[:n] = -np.inf\n ubound[:] = np.inf\n\n iprev = iref[:-1]\n inext = iref[1:]\n pprev = y[iprev]\n pnext = y[inext]\n pfloor = np.minimum(pprev, pnext)\n pceil = np.maximum(pprev, pnext)\n\n for i0, i1, plo, phi in zip(iprev, inext, pfloor, pceil):\n lbound[i0] = y[i0]\n ubound[i0] = y[i0]\n inner = slice(i0 + 1, i1)\n lbound[inner] = plo\n ubound[inner] = phi\n lbound[iref[-1]] = y[iref[-1]]\n ubound[iref[-1]] = y[iref[-1]]\n\n return bounds\n\n\ndef zerror_constraints(n: int, nd: int, y: np.ndarray) -> tuple[LinearConstraint, ...]:\n # zep >= z - y: z - zep <= y\n # zen >= y - z: z + zen >= y\n eye = sp.eye_array(n)\n zero = sp.csc_array((n, n))\n zerond = sp.csc_array((n, 2*nd))\n pos = LinearConstraint(\n A=sp.hstack((eye, -eye, zero, zerond), format='csc'), ub=y)\n neg = LinearConstraint(\n A=sp.hstack((eye, zero, eye, zerond), format='csc'), lb=y)\n return pos, neg\n\n\ndef d2_constraints(n: int, nd: int) -> tuple[LinearConstraint, ...]:\n # d2z/dt2 = z[i+2] - 2z[i+1] + z[i]\n # d2p >= d2z/dt2: -z[i] + 2z[i+1] - z[i+2] +0 +0 + d2p >= 0\n # d2n >= -d2z/dt2: z[i] - 2z[i+1] + z[i+2] +0 +0 + 0 + d2n >= 0\n data = np.broadcast_to(\n np.array(([1], [-2], [1]), dtype=np.float32), # don't bother with /dt**2\n shape=(3, n))\n offsets = np.array((0, 1, 2), dtype=np.int32)\n kernel = sp.dia_array((data, offsets), shape=(nd, n))\n err_zero = sp.csc_array((nd, 2*n))\n eye = sp.eye_array(nd)\n zero = sp.csc_array((nd, nd))\n pos = LinearConstraint(\n A=sp.hstack((-kernel, err_zero, eye, zero), format='csc'), lb=0)\n neg = LinearConstraint(\n A=sp.hstack(( kernel, err_zero, zero, eye), format='csc'), lb=0)\n return pos, neg\n\n\ndef monotone_constraints(n: int, nd: int, y: np.ndarray, iref: np.ndarray) -> tuple[LinearConstraint, ...]:\n iprev = iref[:-1]\n inext = iref[1:]\n yprev = y[iprev]\n ynext = y[inext]\n blocks = []\n\n for i0, i1, y0, y1 in zip(iprev, inext, yprev, ynext):\n sign = np.sign(y1 - y0)\n if sign == 0:\n continue # the entire segment will already have lower and upper bounds equal to each other\n block = sp.eye_array(\n m=i1 - i0, n=3*n + 2*nd, k=i0 + 1,\n ) - sp.eye_array(\n m=i1 - i0, n=3*n + 2*nd, k=i0)\n blocks.append(sign*block)\n constraint = LinearConstraint(A=sp.vstack(blocks, format='csc'), lb=0)\n return constraint,\n\n\ndef solve(y: np.ndarray, iref: np.ndarray, smoothing: float = 1.) -> tuple[\n np.ndarray, tuple[LinearConstraint, ...],\n]:\n '''\n Variables:\n z, continuous unbounded (outside of ref points)\n zep, continuous, >= 0, >= z-y\n zen, continuous, >= 0, >= y-z\n d2p, n-2, continuous, >= 0, >= d2z/dt2\n d2n, n-2, continuous, >= 0, >= -d2z/dt2\n '''\n n = y.size\n nd = n - 2\n constraints = (\n zerror_constraints(n, nd, y) + d2_constraints(n, nd) + monotone_constraints(n, nd, y, iref)\n )\n\n result = milp(\n c=cost(n, nd, smoothing), integrality=0, bounds=bounds(iref, n, nd, y),\n constraints=constraints,\n )\n if not result.success:\n raise result.message\n z, zep, zen, d2p, d2n = np.split(result.x, (n, 2*n, 3*n, 3*n+nd))\n return z, constraints\n\n\ndef demo() -> None:\n rand = np.random.default_rng(seed=0)\n x, y, iref = sample_data(rand, n=801)\n\n fig, ax = plt.subplots()\n ax.plot(x, y, label='orig')\n ax.scatter(x[iref], y[iref], color='red', label='ref point')\n\n for smoothing in (0.5, 3):\n z, constraints = solve(y, iref, smoothing)\n ax.plot(x, z, label=f'smooth={smoothing}')\n ax.legend()\n\n sparsity = sp.vstack([c.A for c in constraints]).sign().toarray()\n fig, ax = plt.subplots()\n ax.set_title(f'Constraint sparsity, n={y.size}')\n ax.imshow(sparsity)\n\n plt.show()\n\n\nif __name__ == '__main__':\n demo()\n\n\n\n\n\nHere we see that the solution does exactly what we tell it to:\n\n\n\n\n[image: example solution; source: https://i.sstatic.net/oTyX0oWA.png] (https://i.sstatic.net/oTyX0oWA.png)\n\n\n\n\nOutside of the reference points, monotonicity is not enforced so the smoothed curve follows the input curve. Within the reference points, monotonicity is preserved, and the solver does its best to balance smoothing and fitting; a finer-scale depiction of this behaviour:\n\n\n\n\n[image: smoothing; source: https://i.sstatic.net/cW1t1avg.png] (https://i.sstatic.net/cW1t1avg.png)\n\n\n\n\nThe sparsity pattern for the problem looks like this (size reduced for visibility):\n\n\n\n\n[image: sparsity; source: https://i.sstatic.net/UmVF5qyE.png] (https://i.sstatic.net/UmVF5qyE.png)\n\n\n\n\nThough the performance will vary based on hardware and dataset content and size, for n=1501 I see execution times of ~80 ms.", "answer_url": "https://scicomp.stackexchange.com/a/45335", "author": "Reinderien", "author_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-01-10T07:56:42+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45334, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Reinderien", "profile_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "user_type": "registered"}, "created_at": "2026-01-10T07:56:42+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "49224026-A98C-4DFC-B187-28324764F758", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/49224026-A98C-4DFC-B187-28324764F758/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Reinderien", "profile_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "user_type": "registered"}, "created_at": "2026-01-10T15:16:37+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "0462867C-327F-469E-957B-1FE451F4CE5C", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/0462867C-327F-469E-957B-1FE451F4CE5C/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Reinderien", "profile_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "user_type": "registered"}, "created_at": "2026-01-10T20:00:35+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "302EF20B-4729-4185-A059-5377ED4B7555", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/302EF20B-4729-4185-A059-5377ED4B7555/view-source"}], "score": 3, "updated_at": "2026-01-10T20:00:35+00:00"}, {"answer_html": "

I managed to create a prototype solver based on ADMM in MATLAB:

\n
function [ vX, isConv ] = SplineQPSmooth( vY, mD, paramLambda, vI, mA, sParams )\n\narguments(Input)\n    vY (:, 1) {mustBeNumeric, mustBeFinite, mustBeReal}\n    mD (:, :) {mustBeNumeric, mustBeFinite, mustBeReal}\n    paramLambda (1, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBeNonnegative}\n    vI (:, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBeInteger}\n    mA (:, :) {mustBeNumeric, mustBeFinite, mustBeReal}\n    sParams.paramRho (1, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBePositive} = 1.0\n    sParams.numIter (1, 1) {mustBeNumeric, mustBeFinite, mustBeInteger, mustBePositive} = 5000\n    sParams.epsAbs (1, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBePositive} = 1e-5\n    sParams.epsRel (1, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBePositive} = 1e-5\n    sParams.convInterval (1, 1) {mustBeNumeric, mustBeFinite, mustBeInteger, mustBePositive} = 25\n    sParams.paramTau (1, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBePositive} = 10\nend\n\narguments(Output)\n    vX (:, 1) {mustBeNumeric, mustBeFinite, mustBeReal}\n    isConv (1, 1) {mustBeA(isConv, 'logical')}\nend\n\nnumSamples = length(vY);\nnumEq      = length(vI);\nnumInEq    = size(mA, 1);\n\n% Quadratic Terms\nmQ = sparse(eye(numSamples)) + paramLambda * (mD' * mD);\nvQ = -vY;\n\n% Equality Constraints\nmE = sparse(1:numEq, vI, 1, numEq, numSamples);\nvD = vY(vI);\n\nparamRho     = sParams.paramRho;\nparamRhoInv  = inv(paramRho);\nnumIter      = sParams.numIter;\nepsAbs       = sParams.epsAbs;\nepsRel       = sParams.epsRel;\nconvInterval = sParams.convInterval;\nparamTau     = sParams.paramTau;\n\n% ADMM Variables\nvX  = vY;                %<! Optimization variable\nvS  = zeros(numInEq, 1); %<! Slack variable for inequality\nvS1 = zeros(numInEq, 1); %<! Preious iteration buffer\nvMu = zeros(numInEq, 1); %<! Dual variable for inequality\nvNu = zeros(numEq, 1);   %<! Dual variabe for equality\n\n% Factorize the KKT System\n% (Q + rho * A' * A + rho * E' * E) * z = r\nmK = mQ + paramRho * (mA.' * mA) + paramRho * (mE.' * mE);\nsK = decomposition(mK, 'chol', 'CheckCondition', false);\n\nisConv     = false;\nupdatedRho = false;\n\nfor ii = 1:numIter\n    vS1(:) = vS; %<! Previous iteration\n\n    % Solve the Linear System\n    vR = -vQ - mA.' * (paramRho * vS + vMu) + mE.' * (paramRho * vD - vNu); %<! Right hand vector\n    vX = sK \\ vR;\n\n    % Proximal / Projection Step\n    % s = -A * z with s >= 0\n    vS = max(0, -(mA * vX + paramRhoInv * vMu));\n\n    % Update Dual Variables\n    vMu = vMu + paramRho * (mA * vX + vS);\n    vNu = vNu + paramRho * (mE * vX - vD);\n\n    % Check Convergence\n    if mod(ii, convInterval) == 0\n        primRes = norm(mA * vX + vS, 'inf');\n        dualRes = norm(paramRho * mA' * (vS - vS1), 'inf');\n        if ((primRes < epsAbs) && (dualRes < epsAbs))\n            isConv = true;\n            break;\n        end\n\n        % Adpat `paramRho`\n        resRatio = primRes / dualRes;\n        % fprintf('Primal Residual: %0.7f, Dual Residual: %0.7f\\n', primRes, dualRes);\n        % fprintf('Residual Ratio: %0.2f, ρ = %0.3f\\n', resRatio, paramRho);\n        if (resRatio > paramTau) || (inv(resRatio) > paramTau)\n            updatedRho = true;\n        else\n            updatedRho = false;\n        end\n        if updatedRho\n            paramRho = paramRho * sqrt(resRatio);\n            paramRho = clip(paramRho, 1e-5, 1e5);\n            paramRhoInv  = inv(paramRho);\n            mK = mQ + paramRho * (mA.' * mA) + paramRho * (mE.' * mE);\n            sK = decomposition(mK, 'chol', 'CheckCondition', false);\n        end\n    end\n\nend\n\nend\n
\n

I has convergence check and adaptation of the ADMM's step size parameter $\\rho$.
\nI will add mathematical formulation and a memory optimized version using Julia.

\n

On MATLAB with this naive code I could beat quadprog() by 30% with the same output:

\n

\"enter

\n\n", "answer_id": 45337, "answer_text": "I managed to create a prototype solver based on ADMM in MATLAB:\n\n\n\n\nfunction [ vX, isConv ] = SplineQPSmooth( vY, mD, paramLambda, vI, mA, sParams )\n\narguments(Input)\n vY (:, 1) {mustBeNumeric, mustBeFinite, mustBeReal}\n mD (:, :) {mustBeNumeric, mustBeFinite, mustBeReal}\n paramLambda (1, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBeNonnegative}\n vI (:, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBeInteger}\n mA (:, :) {mustBeNumeric, mustBeFinite, mustBeReal}\n sParams.paramRho (1, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBePositive} = 1.0\n sParams.numIter (1, 1) {mustBeNumeric, mustBeFinite, mustBeInteger, mustBePositive} = 5000\n sParams.epsAbs (1, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBePositive} = 1e-5\n sParams.epsRel (1, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBePositive} = 1e-5\n sParams.convInterval (1, 1) {mustBeNumeric, mustBeFinite, mustBeInteger, mustBePositive} = 25\n sParams.paramTau (1, 1) {mustBeNumeric, mustBeFinite, mustBeReal, mustBePositive} = 10\nend\n\narguments(Output)\n vX (:, 1) {mustBeNumeric, mustBeFinite, mustBeReal}\n isConv (1, 1) {mustBeA(isConv, 'logical')}\nend\n\nnumSamples = length(vY);\nnumEq = length(vI);\nnumInEq = size(mA, 1);\n\n% Quadratic Terms\nmQ = sparse(eye(numSamples)) + paramLambda * (mD' * mD);\nvQ = -vY;\n\n% Equality Constraints\nmE = sparse(1:numEq, vI, 1, numEq, numSamples);\nvD = vY(vI);\n\nparamRho = sParams.paramRho;\nparamRhoInv = inv(paramRho);\nnumIter = sParams.numIter;\nepsAbs = sParams.epsAbs;\nepsRel = sParams.epsRel;\nconvInterval = sParams.convInterval;\nparamTau = sParams.paramTau;\n\n% ADMM Variables\nvX = vY; %= 0\n vS = max(0, -(mA * vX + paramRhoInv * vMu));\n\n % Update Dual Variables\n vMu = vMu + paramRho * (mA * vX + vS);\n vNu = vNu + paramRho * (mE * vX - vD);\n\n % Check Convergence\n if mod(ii, convInterval) == 0\n primRes = norm(mA * vX + vS, 'inf');\n dualRes = norm(paramRho * mA' * (vS - vS1), 'inf');\n if ((primRes < epsAbs) && (dualRes < epsAbs))\n isConv = true;\n break;\n end\n\n % Adpat `paramRho`\n resRatio = primRes / dualRes;\n % fprintf('Primal Residual: %0.7f, Dual Residual: %0.7f\\n', primRes, dualRes);\n % fprintf('Residual Ratio: %0.2f, ρ = %0.3f\\n', resRatio, paramRho);\n if (resRatio > paramTau) || (inv(resRatio) > paramTau)\n updatedRho = true;\n else\n updatedRho = false;\n end\n if updatedRho\n paramRho = paramRho * sqrt(resRatio);\n paramRho = clip(paramRho, 1e-5, 1e5);\n paramRhoInv = inv(paramRho);\n mK = mQ + paramRho * (mA.' * mA) + paramRho * (mE.' * mE);\n sK = decomposition(mK, 'chol', 'CheckCondition', false);\n end\n end\n\nend\n\nend\n\n\n\n\n\nI has convergence check and adaptation of the ADMM's step size parameter $\\rho$.\n\nI will add mathematical formulation and a memory optimized version using Julia.\n\n\n\n\nOn MATLAB with this naive code I could beat quadprog() by 30% with the same output:\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/VC8uzUSt.png] (https://i.sstatic.net/VC8uzUSt.png)", "answer_url": "https://scicomp.stackexchange.com/a/45337", "author": "Royi", "author_url": "https://scicomp.stackexchange.com/users/7951/royi", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-01-10T16:53:59+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45334, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Royi", "profile_url": "https://scicomp.stackexchange.com/users/7951/royi", "user_type": "registered"}, "created_at": "2026-01-10T16:53:59+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "62C943AA-9B1D-4A55-BEE1-9F975532FF13", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/62C943AA-9B1D-4A55-BEE1-9F975532FF13/view-source"}], "score": 0, "updated_at": "2026-01-10T16:53:59+00:00"}, {"answer_html": "

I produced an ADMM based solver which I found very efficient.

\n

The problem is given by:

\n

$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{x} } & \\quad & \\frac{1}{2} \\left\\| \\boldsymbol{x} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\frac{\\lambda}{2} {\\left\\| \\boldsymbol{D}^{m} \\boldsymbol{x} \\right\\|}_{2}^{2} \\\\\n\\text{subject to} & \\quad & {x}_{i} = {y}_{i} \\; \\forall i \\in \\mathcal{I} \\\\\n& \\quad & \\boldsymbol{A} \\boldsymbol{x} \\leq \\boldsymbol{0} \\\\\n\\end{alignat*}\n$$

\n

I will use $\\boldsymbol{D} = \\boldsymbol{D}^{m}$ to simplify notations.
\nThe equality constraints can be turned into matrix form and the problem becomes:

\n

$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{x} } & \\quad & \\frac{1}{2} \\left\\| \\boldsymbol{x} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\frac{\\lambda}{2} {\\left\\| \\boldsymbol{D} \\boldsymbol{x} \\right\\|}_{2}^{2} \\\\\n\\text{subject to} & \\quad & \\boldsymbol{E} \\boldsymbol{x} = \\boldsymbol{d} \\\\\n& \\quad & \\boldsymbol{A} \\boldsymbol{x} \\leq \\boldsymbol{0} \\\\\n\\end{alignat*}\n$$

\n

The trick to utilize the ADMM framework is to introduce a slack variable to handle the inequality constraint:

\n

$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{x} } & \\quad & \\frac{1}{2} \\left\\| \\boldsymbol{x} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\frac{\\lambda}{2} {\\left\\| \\boldsymbol{D} \\boldsymbol{x} \\right\\|}_{2}^{2} \\\\\n\\text{subject to} & \\quad & \\boldsymbol{E} \\boldsymbol{x} = \\boldsymbol{d} \\\\\n& \\quad & \\boldsymbol{A} \\boldsymbol{x} + \\boldsymbol{s} = \\boldsymbol{0} \\\\\n& \\quad & \\boldsymbol{s} \\geq \\boldsymbol{0} \\\\\n\\end{alignat*}\n$$

\n

The equality constraints are introduced by the Augmented Lagrangian:

\n

$$\n{\\ell}_{\\rho} \\left( \\boldsymbol{x}, \\boldsymbol{s}, \\boldsymbol{\\mu}, \\boldsymbol{\\nu} \\right) = \\frac{1}{2} \\left\\| \\boldsymbol{x} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\frac{\\lambda}{2} {\\left\\| \\boldsymbol{D} \\boldsymbol{x} \\right\\|}_{2}^{2} + \\frac{\\rho}{2} {\\left\\| \\boldsymbol{A} \\boldsymbol{x} + \\boldsymbol{s} + {\\rho}^{-1} \\boldsymbol{\\mu} \\right\\|}_{2}^{2} + \\frac{\\rho}{2} {\\left\\| \\boldsymbol{E} \\boldsymbol{x} - \\boldsymbol{d} + {\\rho}^{-1} \\boldsymbol{\\nu} \\right\\|}_{2}^{2} + {I}_{\\mathbb{R}_{+}} \\left( \\boldsymbol{s} \\right)\n$$

\n

The steps to solve:

\n
    \n
  • Primal Update (Solve Linear System): $\\boldsymbol{x}^{ \\left( k + 1 \\right)} = {\\left( \\boldsymbol{I} + \\lambda \\boldsymbol{D}^{\\top} \\boldsymbol{D} + \\rho \\boldsymbol{A}^{\\top} \\boldsymbol{A} + \\rho\\boldsymbol{E}^{\\top} \\boldsymbol{E} \\right)}^{-1} \\left( \\boldsymbol{y} - \\boldsymbol{A}^{\\top} \\left( \\rho \\boldsymbol{s}^{\\left( k \\right)} + \\boldsymbol{\\mu}^{\\left( k \\right)} \\right) + \\boldsymbol{E}^{\\top} \\left( \\rho \\boldsymbol{d} - \\boldsymbol{\\nu}^{\\left( k \\right)} \\right) \\right)$.
  • \n
  • Slack Update (Non Negative LS): $\\boldsymbol{s}^{ \\left( k + 1 \\right)} = \\max \\left( \\boldsymbol{0}, - \\boldsymbol{A} \\boldsymbol{x}^{\\left( k + 1 \\right)} - {\\rho}^{-1} \\boldsymbol{\\mu}^{\\left( k \\right)} \\right)$.
  • \n
  • Dual Update (Gradient Ascent) for $\\boldsymbol{\\mu}$: $\\boldsymbol{\\mu}^{\\left( k + 1 \\right)} = \\boldsymbol{\\mu}^{\\left( k \\right)} + \\rho \\left( \\boldsymbol{A} \\boldsymbol{x}^{\\left( k + 1 \\right)} + \\boldsymbol{s}^{\\left( k + 1 \\right)} \\right)$.
  • \n
  • Dual Update (Gradient Ascent) for $\\boldsymbol{\\nu}$: $\\boldsymbol{\\nu}^{\\left( k + 1 \\right)} = \\boldsymbol{\\nu}^{\\left( k \\right)} + \\rho \\left( \\boldsymbol{E} \\boldsymbol{x}^{\\left( k + 1 \\right)} - \\boldsymbol{d} \\right)$.
  • \n
\n

The stopping condition is when both residuals are below a threshold:

\n
    \n
  • Primal Residual: ${r}^{\\left( k \\right)} = {\\left\\| \\boldsymbol{A} \\boldsymbol{x}^{\\left( k \\right)} + \\boldsymbol{s}^{\\left( k \\right)} \\right\\|}_{\\infty}$.
  • \n
  • Dual Residual (OSQP Style): ${s}^{\\left( k \\right)} = {\\left\\| \\rho \\boldsymbol{A} \\left( \\boldsymbol{s}^{\\left( k \\right)} - \\boldsymbol{s}^{\\left( k - 1 \\right)} \\right) \\right\\|}_{\\infty}$.
  • \n
\n

The use of the infinity norm decouples the dimension of the problem from the thresholds.

\n

I also used OSQP style update of the $\\rho$ parameter to accelerate convergence: ${\\rho}^{\\left( k \\right)} = {\\rho}^{\\left( k - 1 \\right)} \\sqrt{ \\frac{ {r}^{\\left( k \\right)} }{ {s}^{\\left( k \\right)} } }$.

\n

I implemented all in Julia and compared to the ECOS / SCS solvers wrapped by Convex.jl.

\n

\"enter

\n

Run Times:

\n
    \n
  • ECOS
  • \n
\n
BenchmarkTools.Trial: 1227 samples with 1 evaluation per sample.\n Range (min … max):  3.412 ms …  18.615 ms  ┊ GC (min … max): 0.00% … 60.46%\n Time  (median):     3.807 ms               ┊ GC (median):    0.00%\n Time  (mean ± σ):   4.061 ms ± 859.845 μs  ┊ GC (mean ± σ):  1.67% ±  5.36%\n\n   ▅█▇▄▃ ▁\n  ▄████████▇▆▇▅▆▅▅▄▄▃▃▃▃▄▃▄▄▄▃▃▃▃▃▃▂▂▂▂▃▃▂▂▂▃▂▂▂▂▂▂▂▂▂▂▂▂▁▂▂▂ ▃\n  3.41 ms         Histogram: frequency by time        6.54 ms <\n\n Memory estimate: 806.21 KiB, allocs estimate: 7886.\n
\n
    \n
  • SCS
  • \n
\n
BenchmarkTools.Trial: 98 samples with 1 evaluation per sample.\n Range (min … max):  49.280 ms …  53.704 ms  ┊ GC (min … max): 0.00% … 0.00%\n Time  (median):     50.892 ms               ┊ GC (median):    0.00%\n Time  (mean ± σ):   51.055 ms ± 918.217 μs  ┊ GC (mean ± σ):  0.00% ± 0.00%\n\n       ▁        ▃ ▁▁▁█ █▃ ▁ ▃ ▁   ▆   ▁           ▁\n  ▄▁▁▇▁█▁▁▄▄▇▄▄▇█▇████▇██▄█▇█▄█▄▁▄█▄▇▇█▁▇▄▄▄▄▁▇▇▄▄█▄▁▄▄▁▄▁▁▁▁▇ ▁\n  49.3 ms         Histogram: frequency by time         53.2 ms <\n\n Memory estimate: 694.24 KiB, allocs estimate: 7998.\n
\n
    \n
  • ADMM (My code):
  • \n
\n
BenchmarkTools.Trial: 7569 samples with 1 evaluation per sample.\n Range (min … max):  447.700 μs …  23.329 ms  ┊ GC (min … max): 0.00% … 70.82%\n Time  (median):     651.300 μs               ┊ GC (median):    0.00%\n Time  (mean ± σ):   656.690 μs ± 412.333 μs  ┊ GC (mean ± σ):  1.30% ±  2.26%\n\n   ▁▄▄▁            ▁▃▅▅▆▆█▇▇▆▅▄▂▁▁\n  ▃████▆▄▃▂▂▂▂▂▁▂▃▅███████████████▇▆▆▄▅▄▄▄▃▃▂▂▂▂▂▂▂▂▂▁▁▂▁▁▁▁▁▁▁ ▄\n  448 μs           Histogram: frequency by time          970 μs <\n\n Memory estimate: 874.89 KiB, allocs estimate: 1089.\n
\n

The ADMM method is an order of magnitude faster than the generic solvers.
\nIt can be greatly improved as it designed for arbitrary matrix $\\boldsymbol{E}$. It can be farther optimized for the case of equality.

\n
\n

The code is available on my StackExchange Code GitHub Repository (Look at the ComputationalScience\\Q45334 folder).

\n", "answer_id": 45341, "answer_text": "I produced an ADMM based solver which I found very efficient.\n\n\n\n\nThe problem is given by:\n\n\n\n\n$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{x} } & \\quad & \\frac{1}{2} \\left\\| \\boldsymbol{x} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\frac{\\lambda}{2} {\\left\\| \\boldsymbol{D}^{m} \\boldsymbol{x} \\right\\|}_{2}^{2} \\\\\n\\text{subject to} & \\quad & {x}_{i} = {y}_{i} \\; \\forall i \\in \\mathcal{I} \\\\\n& \\quad & \\boldsymbol{A} \\boldsymbol{x} \\leq \\boldsymbol{0} \\\\\n\\end{alignat*}\n$$\n\n\n\n\nI will use $\\boldsymbol{D} = \\boldsymbol{D}^{m}$ to simplify notations.\n\nThe equality constraints can be turned into matrix form and the problem becomes:\n\n\n\n\n$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{x} } & \\quad & \\frac{1}{2} \\left\\| \\boldsymbol{x} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\frac{\\lambda}{2} {\\left\\| \\boldsymbol{D} \\boldsymbol{x} \\right\\|}_{2}^{2} \\\\\n\\text{subject to} & \\quad & \\boldsymbol{E} \\boldsymbol{x} = \\boldsymbol{d} \\\\\n& \\quad & \\boldsymbol{A} \\boldsymbol{x} \\leq \\boldsymbol{0} \\\\\n\\end{alignat*}\n$$\n\n\n\n\nThe trick to utilize the ADMM framework is to introduce a slack variable to handle the inequality constraint:\n\n\n\n\n$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{x} } & \\quad & \\frac{1}{2} \\left\\| \\boldsymbol{x} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\frac{\\lambda}{2} {\\left\\| \\boldsymbol{D} \\boldsymbol{x} \\right\\|}_{2}^{2} \\\\\n\\text{subject to} & \\quad & \\boldsymbol{E} \\boldsymbol{x} = \\boldsymbol{d} \\\\\n& \\quad & \\boldsymbol{A} \\boldsymbol{x} + \\boldsymbol{s} = \\boldsymbol{0} \\\\\n& \\quad & \\boldsymbol{s} \\geq \\boldsymbol{0} \\\\\n\\end{alignat*}\n$$\n\n\n\n\nThe equality constraints are introduced by the Augmented Lagrangian:\n\n\n\n\n$$\n{\\ell}_{\\rho} \\left( \\boldsymbol{x}, \\boldsymbol{s}, \\boldsymbol{\\mu}, \\boldsymbol{\\nu} \\right) = \\frac{1}{2} \\left\\| \\boldsymbol{x} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\frac{\\lambda}{2} {\\left\\| \\boldsymbol{D} \\boldsymbol{x} \\right\\|}_{2}^{2} + \\frac{\\rho}{2} {\\left\\| \\boldsymbol{A} \\boldsymbol{x} + \\boldsymbol{s} + {\\rho}^{-1} \\boldsymbol{\\mu} \\right\\|}_{2}^{2} + \\frac{\\rho}{2} {\\left\\| \\boldsymbol{E} \\boldsymbol{x} - \\boldsymbol{d} + {\\rho}^{-1} \\boldsymbol{\\nu} \\right\\|}_{2}^{2} + {I}_{\\mathbb{R}_{+}} \\left( \\boldsymbol{s} \\right)\n$$\n\n\n\n\nThe steps to solve:\n\n\n\n\n\nPrimal Update (Solve Linear System): $\\boldsymbol{x}^{ \\left( k + 1 \\right)} = {\\left( \\boldsymbol{I} + \\lambda \\boldsymbol{D}^{\\top} \\boldsymbol{D} + \\rho \\boldsymbol{A}^{\\top} \\boldsymbol{A} + \\rho\\boldsymbol{E}^{\\top} \\boldsymbol{E} \\right)}^{-1} \\left( \\boldsymbol{y} - \\boldsymbol{A}^{\\top} \\left( \\rho \\boldsymbol{s}^{\\left( k \\right)} + \\boldsymbol{\\mu}^{\\left( k \\right)} \\right) + \\boldsymbol{E}^{\\top} \\left( \\rho \\boldsymbol{d} - \\boldsymbol{\\nu}^{\\left( k \\right)} \\right) \\right)$.\n\n\n\n\nSlack Update (Non Negative LS): $\\boldsymbol{s}^{ \\left( k + 1 \\right)} = \\max \\left( \\boldsymbol{0}, - \\boldsymbol{A} \\boldsymbol{x}^{\\left( k + 1 \\right)} - {\\rho}^{-1} \\boldsymbol{\\mu}^{\\left( k \\right)} \\right)$.\n\n\n\n\nDual Update (Gradient Ascent) for $\\boldsymbol{\\mu}$: $\\boldsymbol{\\mu}^{\\left( k + 1 \\right)} = \\boldsymbol{\\mu}^{\\left( k \\right)} + \\rho \\left( \\boldsymbol{A} \\boldsymbol{x}^{\\left( k + 1 \\right)} + \\boldsymbol{s}^{\\left( k + 1 \\right)} \\right)$.\n\n\n\n\nDual Update (Gradient Ascent) for $\\boldsymbol{\\nu}$: $\\boldsymbol{\\nu}^{\\left( k + 1 \\right)} = \\boldsymbol{\\nu}^{\\left( k \\right)} + \\rho \\left( \\boldsymbol{E} \\boldsymbol{x}^{\\left( k + 1 \\right)} - \\boldsymbol{d} \\right)$.\n\n\n\n\n\nThe stopping condition is when both residuals are below a threshold:\n\n\n\n\n\nPrimal Residual: ${r}^{\\left( k \\right)} = {\\left\\| \\boldsymbol{A} \\boldsymbol{x}^{\\left( k \\right)} + \\boldsymbol{s}^{\\left( k \\right)} \\right\\|}_{\\infty}$.\n\n\n\n\nDual Residual (OSQP Style): ${s}^{\\left( k \\right)} = {\\left\\| \\rho \\boldsymbol{A} \\left( \\boldsymbol{s}^{\\left( k \\right)} - \\boldsymbol{s}^{\\left( k - 1 \\right)} \\right) \\right\\|}_{\\infty}$.\n\n\n\n\n\nThe use of the infinity norm decouples the dimension of the problem from the thresholds.\n\n\n\n\nI also used OSQP style update of the $\\rho$ parameter to accelerate convergence: ${\\rho}^{\\left( k \\right)} = {\\rho}^{\\left( k - 1 \\right)} \\sqrt{ \\frac{ {r}^{\\left( k \\right)} }{ {s}^{\\left( k \\right)} } }$.\n\n\n\n\nI implemented all in Julia and compared to the ECOS (https://github.com/embotech/ecos) / SCS (https://github.com/cvxgrp/scs) solvers wrapped by Convex.jl (https://github.com/jump-dev/Convex.jl).\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/f5YcjFm6.png] (https://i.sstatic.net/f5YcjFm6.png)\n\n\n\n\nRun Times:\n\n\n\n\n\nECOS\n\n\n\n\n\nBenchmarkTools.Trial: 1227 samples with 1 evaluation per sample.\n Range (min … max): 3.412 ms … 18.615 ms ┊ GC (min … max): 0.00% … 60.46%\n Time (median): 3.807 ms ┊ GC (median): 0.00%\n Time (mean ± σ): 4.061 ms ± 859.845 μs ┊ GC (mean ± σ): 1.67% ± 5.36%\n\n ▅█▇▄▃ ▁\n ▄████████▇▆▇▅▆▅▅▄▄▃▃▃▃▄▃▄▄▄▃▃▃▃▃▃▂▂▂▂▃▃▂▂▂▃▂▂▂▂▂▂▂▂▂▂▂▂▁▂▂▂ ▃\n 3.41 ms Histogram: frequency by time 6.54 ms <\n\n Memory estimate: 806.21 KiB, allocs estimate: 7886.\n\n\n\n\n\n\nSCS\n\n\n\n\n\nBenchmarkTools.Trial: 98 samples with 1 evaluation per sample.\n Range (min … max): 49.280 ms … 53.704 ms ┊ GC (min … max): 0.00% … 0.00%\n Time (median): 50.892 ms ┊ GC (median): 0.00%\n Time (mean ± σ): 51.055 ms ± 918.217 μs ┊ GC (mean ± σ): 0.00% ± 0.00%\n\n ▁ ▃ ▁▁▁█ █▃ ▁ ▃ ▁ ▆ ▁ ▁\n ▄▁▁▇▁█▁▁▄▄▇▄▄▇█▇████▇██▄█▇█▄█▄▁▄█▄▇▇█▁▇▄▄▄▄▁▇▇▄▄█▄▁▄▄▁▄▁▁▁▁▇ ▁\n 49.3 ms Histogram: frequency by time 53.2 ms <\n\n Memory estimate: 694.24 KiB, allocs estimate: 7998.\n\n\n\n\n\n\nADMM (My code):\n\n\n\n\n\nBenchmarkTools.Trial: 7569 samples with 1 evaluation per sample.\n Range (min … max): 447.700 μs … 23.329 ms ┊ GC (min … max): 0.00% … 70.82%\n Time (median): 651.300 μs ┊ GC (median): 0.00%\n Time (mean ± σ): 656.690 μs ± 412.333 μs ┊ GC (mean ± σ): 1.30% ± 2.26%\n\n ▁▄▄▁ ▁▃▅▅▆▆█▇▇▆▅▄▂▁▁\n ▃████▆▄▃▂▂▂▂▂▁▂▃▅███████████████▇▆▆▄▅▄▄▄▃▃▂▂▂▂▂▂▂▂▂▁▁▂▁▁▁▁▁▁▁ ▄\n 448 μs Histogram: frequency by time 970 μs <\n\n Memory estimate: 874.89 KiB, allocs estimate: 1089.\n\n\n\n\n\nThe ADMM method is an order of magnitude faster than the generic solvers.\n\nIt can be greatly improved as it designed for arbitrary matrix $\\boldsymbol{E}$. It can be farther optimized for the case of equality.\n\n\n\n\n\n\n\nThe code is available on my StackExchange Code GitHub Repository (https://github.com/RoyiAvital/StackExchangeCodes) (Look at the ComputationalScience\\Q45334 folder).", "answer_url": "https://scicomp.stackexchange.com/a/45341", "author": "Royi", "author_url": "https://scicomp.stackexchange.com/users/7951/royi", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-01-17T09:49:49+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45334, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Royi", "profile_url": "https://scicomp.stackexchange.com/users/7951/royi", "user_type": "registered"}, "created_at": "2026-01-17T09:49:49+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "00755B30-2CCE-4266-8BA0-1A21879D0A39", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/00755B30-2CCE-4266-8BA0-1A21879D0A39/view-source"}], "score": 2, "updated_at": "2026-01-17T09:49:49+00:00"}, {"answer_html": "

Another formulation take advantage of the equality constraint to make the problem formulation smaller.

\n

The problem is given by:

\n

$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{x} } & \\quad & \\frac{1}{2} \\left\\| \\boldsymbol{x} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\frac{\\lambda}{2} {\\left\\| \\boldsymbol{D} \\boldsymbol{x} \\right\\|}_{2}^{2} \\\\\n\\text{subject to} & \\quad & {x}_{i} = {y}_{i} \\; \\forall i \\in \\mathcal{I} \\\\\n& \\quad & \\boldsymbol{A} \\boldsymbol{x} \\leq \\boldsymbol{0} \\\\\n\\end{alignat*}\n$$

\n

Let $\\mathcal{J} = \\left\\{ 1, 2, \\ldots, n \\right\\} \\setminus \\mathcal{I}$ then define:

\n

$$ \\boldsymbol{x} = \\begin{bmatrix} \\boldsymbol{x}_{\\mathcal{J}} \\\\ \\boldsymbol{x}_{\\mathcal{I}} \\end{bmatrix}, \\; \\boldsymbol{A} = \\begin{bmatrix} \\boldsymbol{A}_{\\mathcal{J}} && \\boldsymbol{A}_{\\mathcal{I}} \\end{bmatrix}, \\boldsymbol{D} = \\begin{bmatrix} \\boldsymbol{D}_{\\mathcal{J}} && \\boldsymbol{D}_{\\mathcal{I}} \\end{bmatrix}$$

\n

Then the above can be formulated as:

\n

$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{x}_{\\mathcal{J}} } & \\quad & \\frac{1}{2} \\boldsymbol{x}_{\\mathcal{J}}^{\\top} \\boldsymbol{P} \\boldsymbol{x}_{\\mathcal{J}} + \\boldsymbol{q}^{\\top} \\boldsymbol{x}_{\\mathcal{J}} \\\\\n\\text{subject to} & \\quad & \\boldsymbol{A}_{\\mathcal{J}} \\boldsymbol{x}_{\\mathcal{J}} \\leq \\boldsymbol{b} \\\\\n\\end{alignat*}\n$$

\n

Where $\\boldsymbol{P} = \\boldsymbol{I} + \\lambda \\boldsymbol{D}_{\\mathcal{J}}^{\\top} \\boldsymbol{D}_{\\mathcal{J}}, \\; \\boldsymbol{q} = - \\boldsymbol{y}_{\\mathcal{J}} + \\lambda \\boldsymbol{D}_{\\mathcal{J}}^{\\top} \\boldsymbol{D}_{\\mathcal{I}} \\boldsymbol{y}_{\\mathcal{I}}, \\; \\boldsymbol{b} = \\boldsymbol{A}_{\\mathcal{I}} \\boldsymbol{y}_{\\mathcal{I}}$.

\n

This formulation reduces the number of constraints to handle.
\nThe inequality is treated by introducing a slack variable $\\boldsymbol{s} \\geq \\boldsymbol{0}$ such that $\\boldsymbol{A}_{\\mathcal{J}} \\boldsymbol{x}_{\\mathcal{J}} + \\boldsymbol{s} = \\boldsymbol{b}$.

\n

The Augmented Lagrangian (Scaled form) is given by:

\n

$$\n{\\ell}_{\\rho} \\left( \\boldsymbol{x}_{\\mathcal{J}}, \\boldsymbol{s}, \\boldsymbol{\\mu} \\right) = \\frac{1}{2} \\boldsymbol{x}_{\\mathcal{J}}^{\\top} \\boldsymbol{P} \\boldsymbol{x}_{\\mathcal{J}} + \\boldsymbol{q}^{\\top} \\boldsymbol{x}_{\\mathcal{J}} + \\frac{\\rho}{2} {\\left\\| \\boldsymbol{A}_{\\mathcal{J}} \\boldsymbol{x}_{\\mathcal{J}} + \\boldsymbol{s} - \\boldsymbol{b} + \\boldsymbol{\\mu} \\right\\|}_{2}^{2} + {I}_{\\mathbb{R}_{+}} \\left( \\boldsymbol{s} \\right)\n$$

\n

The steps to solve:

\n
    \n
  • Primal Update (Solve Linear System): $\\boldsymbol{x}_{\\mathcal{J}}^{\\left( k + 1 \\right)} = {\\left( \\boldsymbol{P} + \\rho \\boldsymbol{A}_{\\mathcal{J}}^{\\top} \\boldsymbol{A}_{\\mathcal{J}} \\right)}^{-1} \\left( - \\boldsymbol{q} + \\rho \\boldsymbol{A}_{\\mathcal{J}} \\left( \\boldsymbol{b} - \\boldsymbol{s}^{\\left( k \\right)} - \\boldsymbol{\\mu}^{\\left( k \\right)} \\right) \\right)$.
  • \n
  • Slack Update (Non Negative LS / Projection): $\\boldsymbol{s}^{\\left( k + 1 \\right)} = \\max \\left(\\boldsymbol{0}, \\boldsymbol{b} - \\boldsymbol{A}_{\\mathcal{J}} \\boldsymbol{x}_{\\mathcal{J}}^{\\left( k + 1 \\right)} - \\boldsymbol{\\mu}^{\\left( k \\right)} \\right)$.
  • \n
  • Dual Update (Gradient Ascent): $\\boldsymbol{\\mu}^{\\left( k + 1 \\right)} = \\boldsymbol{\\mu}^{\\left( k \\right)} + \\left( \\boldsymbol{A}_{\\mathcal{J}} \\boldsymbol{x}_{\\mathcal{J}}^{\\left( k + 1 \\right)} + \\boldsymbol{s}^{\\left( k + 1 \\right)} - \\boldsymbol{b} \\right)$.
  • \n
\n

The rest is similar to above with the needed adjustments for the residuals calculations.

\n

This implementation reduced another 40 [Micro Sec] of the run time.

\n", "answer_id": 45342, "answer_text": "Another formulation take advantage of the equality constraint to make the problem formulation smaller.\n\n\n\n\nThe problem is given by:\n\n\n\n\n$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{x} } & \\quad & \\frac{1}{2} \\left\\| \\boldsymbol{x} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\frac{\\lambda}{2} {\\left\\| \\boldsymbol{D} \\boldsymbol{x} \\right\\|}_{2}^{2} \\\\\n\\text{subject to} & \\quad & {x}_{i} = {y}_{i} \\; \\forall i \\in \\mathcal{I} \\\\\n& \\quad & \\boldsymbol{A} \\boldsymbol{x} \\leq \\boldsymbol{0} \\\\\n\\end{alignat*}\n$$\n\n\n\n\nLet $\\mathcal{J} = \\left\\{ 1, 2, \\ldots, n \\right\\} \\setminus \\mathcal{I}$ then define:\n\n\n\n\n$$ \\boldsymbol{x} = \\begin{bmatrix} \\boldsymbol{x}_{\\mathcal{J}} \\\\ \\boldsymbol{x}_{\\mathcal{I}} \\end{bmatrix}, \\; \\boldsymbol{A} = \\begin{bmatrix} \\boldsymbol{A}_{\\mathcal{J}} && \\boldsymbol{A}_{\\mathcal{I}} \\end{bmatrix}, \\boldsymbol{D} = \\begin{bmatrix} \\boldsymbol{D}_{\\mathcal{J}} && \\boldsymbol{D}_{\\mathcal{I}} \\end{bmatrix}$$\n\n\n\n\nThen the above can be formulated as:\n\n\n\n\n$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{x}_{\\mathcal{J}} } & \\quad & \\frac{1}{2} \\boldsymbol{x}_{\\mathcal{J}}^{\\top} \\boldsymbol{P} \\boldsymbol{x}_{\\mathcal{J}} + \\boldsymbol{q}^{\\top} \\boldsymbol{x}_{\\mathcal{J}} \\\\\n\\text{subject to} & \\quad & \\boldsymbol{A}_{\\mathcal{J}} \\boldsymbol{x}_{\\mathcal{J}} \\leq \\boldsymbol{b} \\\\\n\\end{alignat*}\n$$\n\n\n\n\nWhere $\\boldsymbol{P} = \\boldsymbol{I} + \\lambda \\boldsymbol{D}_{\\mathcal{J}}^{\\top} \\boldsymbol{D}_{\\mathcal{J}}, \\; \\boldsymbol{q} = - \\boldsymbol{y}_{\\mathcal{J}} + \\lambda \\boldsymbol{D}_{\\mathcal{J}}^{\\top} \\boldsymbol{D}_{\\mathcal{I}} \\boldsymbol{y}_{\\mathcal{I}}, \\; \\boldsymbol{b} = \\boldsymbol{A}_{\\mathcal{I}} \\boldsymbol{y}_{\\mathcal{I}}$.\n\n\n\n\nThis formulation reduces the number of constraints to handle.\n\nThe inequality is treated by introducing a slack variable $\\boldsymbol{s} \\geq \\boldsymbol{0}$ such that $\\boldsymbol{A}_{\\mathcal{J}} \\boldsymbol{x}_{\\mathcal{J}} + \\boldsymbol{s} = \\boldsymbol{b}$.\n\n\n\n\nThe Augmented Lagrangian (Scaled form) is given by:\n\n\n\n\n$$\n{\\ell}_{\\rho} \\left( \\boldsymbol{x}_{\\mathcal{J}}, \\boldsymbol{s}, \\boldsymbol{\\mu} \\right) = \\frac{1}{2} \\boldsymbol{x}_{\\mathcal{J}}^{\\top} \\boldsymbol{P} \\boldsymbol{x}_{\\mathcal{J}} + \\boldsymbol{q}^{\\top} \\boldsymbol{x}_{\\mathcal{J}} + \\frac{\\rho}{2} {\\left\\| \\boldsymbol{A}_{\\mathcal{J}} \\boldsymbol{x}_{\\mathcal{J}} + \\boldsymbol{s} - \\boldsymbol{b} + \\boldsymbol{\\mu} \\right\\|}_{2}^{2} + {I}_{\\mathbb{R}_{+}} \\left( \\boldsymbol{s} \\right)\n$$\n\n\n\n\nThe steps to solve:\n\n\n\n\n\nPrimal Update (Solve Linear System): $\\boldsymbol{x}_{\\mathcal{J}}^{\\left( k + 1 \\right)} = {\\left( \\boldsymbol{P} + \\rho \\boldsymbol{A}_{\\mathcal{J}}^{\\top} \\boldsymbol{A}_{\\mathcal{J}} \\right)}^{-1} \\left( - \\boldsymbol{q} + \\rho \\boldsymbol{A}_{\\mathcal{J}} \\left( \\boldsymbol{b} - \\boldsymbol{s}^{\\left( k \\right)} - \\boldsymbol{\\mu}^{\\left( k \\right)} \\right) \\right)$.\n\n\n\n\nSlack Update (Non Negative LS / Projection): $\\boldsymbol{s}^{\\left( k + 1 \\right)} = \\max \\left(\\boldsymbol{0}, \\boldsymbol{b} - \\boldsymbol{A}_{\\mathcal{J}} \\boldsymbol{x}_{\\mathcal{J}}^{\\left( k + 1 \\right)} - \\boldsymbol{\\mu}^{\\left( k \\right)} \\right)$.\n\n\n\n\nDual Update (Gradient Ascent): $\\boldsymbol{\\mu}^{\\left( k + 1 \\right)} = \\boldsymbol{\\mu}^{\\left( k \\right)} + \\left( \\boldsymbol{A}_{\\mathcal{J}} \\boldsymbol{x}_{\\mathcal{J}}^{\\left( k + 1 \\right)} + \\boldsymbol{s}^{\\left( k + 1 \\right)} - \\boldsymbol{b} \\right)$.\n\n\n\n\n\nThe rest is similar to above with the needed adjustments for the residuals calculations.\n\n\n\n\nThis implementation reduced another 40 [Micro Sec] of the run time.", "answer_url": "https://scicomp.stackexchange.com/a/45342", "author": "Royi", "author_url": "https://scicomp.stackexchange.com/users/7951/royi", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-01-17T12:18:23+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45334, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Royi", "profile_url": "https://scicomp.stackexchange.com/users/7951/royi", "user_type": "registered"}, "created_at": "2026-01-17T12:18:23+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "9FE8A84D-E3F5-41A7-B296-8A0BBB5EB8BB", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/9FE8A84D-E3F5-41A7-B296-8A0BBB5EB8BB/view-source"}], "score": 1, "updated_at": "2026-01-17T12:18:23+00:00"}], "domain": "computational_science", "external_links": ["https://github.com/RoyiAvital/StackExchangeCodes", "https://github.com/cvxgrp/scs", "https://github.com/embotech/ecos", "https://github.com/jump-dev/Convex.jl", "https://i.sstatic.net/UmVF5qyE.png", "https://i.sstatic.net/VC8uzUSt.png", "https://i.sstatic.net/cW1t1avg.png", "https://i.sstatic.net/f5YcjFm6.png", "https://i.sstatic.net/oTyX0oWA.png"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:44.584971+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/272744bcc95b58699f7df6e6979b288bb8b00a80ab9c7982dbe170a6d0b63584_1790825325025901700_0.json", "raw_sha256": "27a81850a40920682c29ada76a2b55e80340a5c82764a3e9dde8a9c2ba23db4e", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Royi", "question_author_url": "https://scicomp.stackexchange.com/users/7951/royi", "question_author_user_type": "registered", "question_created_at": "2026-01-09T11:12:06+00:00", "question_html": "

Let a 1D curve defined by $\\left\\{ {y}_{1}, {y}_{2}, \\ldots, {y}_{n} \\right\\}$ sampled on a uniform grid.

\n

I want to smooth the curve with the following properties:

\n
    \n
  1. The result, $\\left\\{ {z}_{1}, {z}_{2}, \\ldots {z}_{n} \\right\\}$ should be smooth like Spline based method.
  2. \n
  3. For a set of indices $\\mathcal{I}$ the smoothed curve must go through the reference point, namely ${z}_{i} = {y}_{i} \\; \\forall i \\in \\mathcal{I}$.
  4. \n
  5. The smoothed values between 2 reference points must be monotonic.
  6. \n
\n

I came up with the following model:

\n

$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{z} } & \\quad & \\frac{1}{2} \\left\\| \\boldsymbol{z} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\lambda {\\left\\| \\boldsymbol{D}^{m} \\boldsymbol{z} \\right\\|}_{2}^{2} \\\\\n\\text{subject to} & \\quad & {z}_{i} = {y}_{i} \\; \\forall i \\in \\mathcal{I} \\\\\n& \\quad & \\boldsymbol{A} \\boldsymbol{z} \\leq \\boldsymbol{0} \\\\\n\\end{alignat*}\n$$

\n

Where $\\boldsymbol{D}^{m}$ is the $m$ -th derivative operator.

\n

I am looking for a fast way to solve the problem for the case of 50-1500 samples.

\n

I rather not use black box Quadratic Programming solvers but design a simple to implement iterative method.

\n", "question_id": 45334, "question_license": "CC BY-SA 4.0", "question_score": 4, "question_text": "Let a 1D curve defined by $\\left\\{ {y}_{1}, {y}_{2}, \\ldots, {y}_{n} \\right\\}$ sampled on a uniform grid.\n\n\n\n\nI want to smooth the curve with the following properties:\n\n\n\n\n\nThe result, $\\left\\{ {z}_{1}, {z}_{2}, \\ldots {z}_{n} \\right\\}$ should be smooth like Spline based method.\n\n\n\n\nFor a set of indices $\\mathcal{I}$ the smoothed curve must go through the reference point, namely ${z}_{i} = {y}_{i} \\; \\forall i \\in \\mathcal{I}$.\n\n\n\n\nThe smoothed values between 2 reference points must be monotonic.\n\n\n\n\n\nI came up with the following model:\n\n\n\n\n$$\n\\begin{alignat*}{3}\n\\arg \\min_{ \\boldsymbol{z} } & \\quad & \\frac{1}{2} \\left\\| \\boldsymbol{z} - \\boldsymbol{y} \\right\\|_{2}^{2} + \\lambda {\\left\\| \\boldsymbol{D}^{m} \\boldsymbol{z} \\right\\|}_{2}^{2} \\\\\n\\text{subject to} & \\quad & {z}_{i} = {y}_{i} \\; \\forall i \\in \\mathcal{I} \\\\\n& \\quad & \\boldsymbol{A} \\boldsymbol{z} \\leq \\boldsymbol{0} \\\\\n\\end{alignat*}\n$$\n\n\n\n\nWhere $\\boldsymbol{D}^{m}$ is the $m$ -th derivative operator.\n\n\n\n\nI am looking for a fast way to solve the problem for the case of 50-1500 samples.\n\n\n\n\nI rather not use black box Quadratic Programming solvers but design a simple to implement iterative method.", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Royi", "profile_url": "https://scicomp.stackexchange.com/users/7951/royi", "user_type": "registered"}, "created_at": "2026-01-09T11:12:06+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "47824E2B-27A9-4037-A643-E3F6522A8C95", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/47824E2B-27A9-4037-A643-E3F6522A8C95/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Royi", "profile_url": "https://scicomp.stackexchange.com/users/7951/royi", "user_type": "registered"}, "created_at": "2026-01-09T11:26:36+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "DD8F78BB-E8A8-4203-A2E1-CBE9167BB83E", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/DD8F78BB-E8A8-4203-A2E1-CBE9167BB83E/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Royi", "profile_url": "https://scicomp.stackexchange.com/users/7951/royi", "user_type": "registered"}, "created_at": "2026-01-10T07:58:10+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "2599F6AB-3F4E-455C-9665-0A36994C9F01", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/2599F6AB-3F4E-455C-9665-0A36994C9F01/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-01-10T17:02:45+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "DE676BCF-D21E-4A19-B947-DB9D0FD71DA6", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://scicomp.stackexchange.com/revisions/DE676BCF-D21E-4A19-B947-DB9D0FD71DA6/view-source"}], "source_site": "scicomp", "source_url": "https://scicomp.stackexchange.com/questions/45334/solving-regularized-least-squares-with-linear-equality-and-linear-inequality-con", "split": "train", "split_group": "f136ae78b6249a1eba9450dcaebaadcc09a41c6eb57a74d9f7e7aba798cd242d", "tags": ["linear-algebra", "optimization", "constrained-optimization", "convex-optimization", "curve-fitting"], "thread_id": "scicomp:45334", "title": "Solving Regularized Least Squares with Linear Equality and Linear Inequality Constraints for Curve Smoothing"}} {"accepted_status": [true, false], "candidate_answers": [{"answer_html": "

One such certificate would be a complete basis of eigenvectors for $A$. Obviously the size of that would be $O(n^2)$.

\n

Assuming all the eigenvalues are distinct, verification would only be needed to multiply each eigenvector by $A$ and check that the appropriate positive eigenvalue multiple (which could be included in the certificate for convenience) obtains. If $A$ has only $\\alpha$ nonzero entries per row, then $Av$ computes at a cost of $O(\\alpha n)$ per vector, for a total verification cost of $O(\\alpha n^2)$.

\n

Something needs to be said about the case that eigenvalues are not distinct, in that $n$ distinct eigenvectors might not provide a complete basis. (If the eigenvalues are distinct, the eigenvectors will be orthogonal and therefore linearly independent.)

\n

To cover that case, we would present the eigenvector basis in order of the increasing eigenvalues and in any group of equal eigenvalues, perform a column reduction among the eigenvalues sharing a common eigenvalue so that their linear independence can be checked by scanning that group of eigenvalues for leading nonzero entries. This scan needs not more than $kn$ operations for a group of $k$ eigenvectors sharing a common eigenvalue, and doing these scans for all basis vectors would need at most $n^2$ comparisons (since the block sizes $k$ sum to $n$).

\n", "answer_id": 45373, "answer_text": "One such certificate would be a complete basis of eigenvectors for $A$. Obviously the size of that would be $O(n^2)$.\n\n\n\n\nAssuming all the eigenvalues are distinct, verification would only be needed to multiply each eigenvector by $A$ and check that the appropriate positive eigenvalue multiple (which could be included in the certificate for convenience) obtains. If $A$ has only $\\alpha$ nonzero entries per row, then $Av$ computes at a cost of $O(\\alpha n)$ per vector, for a total verification cost of $O(\\alpha n^2)$.\n\n\n\n\nSomething needs to be said about the case that eigenvalues are not distinct, in that $n$ distinct eigenvectors might not provide a complete basis. (If the eigenvalues are distinct, the eigenvectors will be orthogonal and therefore linearly independent.)\n\n\n\n\nTo cover that case, we would present the eigenvector basis in order of the increasing eigenvalues and in any group of equal eigenvalues, perform a column reduction among the eigenvalues sharing a common eigenvalue so that their linear independence can be checked by scanning that group of eigenvalues for leading nonzero entries. This scan needs not more than $kn$ operations for a group of $k$ eigenvectors sharing a common eigenvalue, and doing these scans for all basis vectors would need at most $n^2$ comparisons (since the block sizes $k$ sum to $n$).", "answer_url": "https://scicomp.stackexchange.com/a/45373", "author": "hardmath", "author_url": "https://scicomp.stackexchange.com/users/651/hardmath", "author_user_type": "moderator", "content_license": "CC BY-SA 4.0", "created_at": "2026-02-14T05:17:51+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45365, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "hardmath", "profile_url": "https://scicomp.stackexchange.com/users/651/hardmath", "user_type": "moderator"}, "created_at": "2026-02-14T05:17:51+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "0423C78D-1A2E-4A63-8C37-0836DFBF8471", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/0423C78D-1A2E-4A63-8C37-0836DFBF8471/view-source"}], "score": 5, "updated_at": "2026-02-14T05:17:51+00:00"}, {"answer_html": "

davidad had a nice suggestion on Twitter found via Gemini. I'll describe the exact arithmetic version here, and I've also formalised a version in approximate integer arithmetic and used it to prove that a particular 16-regular 65536-node pseudorandom graph is a good spectral expander.

\n

Theorem. Let $A, Z \\in \\mathbb{R}^{n \\times n}$ s.t. $A$ is symmetric, $Z$ is an upper triangular matrix with positive diagonal, and $AZ$ is lower triangular with positive diagonal. Then $A$ is positive definite.

\n

Proof: $A = (AZ)Z^{-1}$ is an $LU$-factorisation of $A$ where both factors have positive diagonal. Thus, every leading principle minor of $A$ is positive, and $A$ is positive definite by Sylvester’s criterion.

\n

$Z$ can be computed in $O(n^3)$-time by taking an $LDL^T$ factorisation of $A$ and inverting $L^T$. For AKS purposes, we do that computation in Rust, scale up and round to integers, then use an approximation-aware version of the theorem to compute $AZ$ in $O(\\alpha n^2)$ time in Lean to certify that our matrix is positive definite.

\n", "answer_id": 45400, "answer_text": "davidad had a nice suggestion on Twitter (https://x.com/davidad/status/2022316806094913669) found via Gemini. I'll describe the exact arithmetic version here, and I've also formalised a version in approximate integer arithmetic (https://github.com/girving/aks?tab=readme-ov-file#alternative-path-zig-zag-product-with-certified-base-expander) and used it to prove that a particular 16-regular 65536-node pseudorandom graph (https://github.com/girving/aks/blob/main/Random/Concrete/Random65536.lean) is a good spectral expander.\n\n\n\n\nTheorem. Let $A, Z \\in \\mathbb{R}^{n \\times n}$ s.t. $A$ is symmetric, $Z$ is an upper triangular matrix with positive diagonal, and $AZ$ is lower triangular with positive diagonal. Then $A$ is positive definite.\n\n\n\n\nProof: $A = (AZ)Z^{-1}$ is an $LU$-factorisation of $A$ where both factors have positive diagonal. Thus, every leading principle minor of $A$ is positive, and $A$ is positive definite by Sylvester’s criterion (https://en.wikipedia.org/wiki/Sylvester%27s_criterion).\n\n\n\n\n$Z$ can be computed in $O(n^3)$-time by taking an $LDL^T$ factorisation of $A$ and inverting $L^T$. For AKS purposes (https://github.com/girving/aks?tab=readme-ov-file#alternative-path-zig-zag-product-with-certified-base-expander), we do that computation in Rust, scale up and round to integers, then use an approximation-aware version of the theorem to compute $AZ$ in $O(\\alpha n^2)$ time in Lean to certify that our matrix is positive definite.", "answer_url": "https://scicomp.stackexchange.com/a/45400", "author": "Geoffrey Irving", "author_url": "https://scicomp.stackexchange.com/users/447/geoffrey-irving", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-03-08T14:38:26+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45365, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Geoffrey Irving", "profile_url": "https://scicomp.stackexchange.com/users/447/geoffrey-irving", "user_type": "registered"}, "created_at": "2026-03-08T14:38:26+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "C2916C95-6525-425D-95F8-013BE89C6FE8", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/C2916C95-6525-425D-95F8-013BE89C6FE8/view-source"}, {"content_license": null, "contributor": {"display_name": "Geoffrey Irving", "profile_url": "https://scicomp.stackexchange.com/users/447/geoffrey-irving", "user_type": "registered"}, "created_at": "2026-03-08T14:38:26+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "EF757A2A-32DC-420E-B2D9-9A80067BEEF4", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://scicomp.stackexchange.com/revisions/EF757A2A-32DC-420E-B2D9-9A80067BEEF4/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Geoffrey Irving", "profile_url": "https://scicomp.stackexchange.com/users/447/geoffrey-irving", "user_type": "registered"}, "created_at": "2026-03-08T15:18:06+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "A2E955D9-336B-42C0-91D8-2291CF8B5C88", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/A2E955D9-336B-42C0-91D8-2291CF8B5C88/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Geoffrey Irving", "profile_url": "https://scicomp.stackexchange.com/users/447/geoffrey-irving", "user_type": "registered"}, "created_at": "2026-03-08T15:52:28+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "D7AD102B-0743-4767-BC0A-889EBE63C005", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/D7AD102B-0743-4767-BC0A-889EBE63C005/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Geoffrey Irving", "profile_url": "https://scicomp.stackexchange.com/users/447/geoffrey-irving", "user_type": "registered"}, "created_at": "2026-03-08T16:06:15+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "378EEA75-B926-4694-8E28-8A9054C4AD0B", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/378EEA75-B926-4694-8E28-8A9054C4AD0B/view-source"}], "score": 3, "updated_at": "2026-03-08T16:06:15+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I have an $n \\times n$ sparse, symmetric matrix $A$ with an average of $\\alpha$ nonzeros per row, so that $\\operatorname{nnz}(A) = \\alpha n$. Is it possible to generate an $O(n^2)$-size certificate that the matrix is positive definite, that can be checked in $O(\\alpha^2 n^2)$ time or similar? E.g., I can do it in $O(n^3)$ time using Cholesky factorization as the certificate, but then naively I can’t take advantage of the sparsity of $A$.\n\n\n\n\nUnfortunately $A$ has very little structure and is very far from diagonally dominant (it comes from a random graph), so only certificates that exist for all SPD $A$ are likely to work.\n\n\n\n\nMotivation: My specific $A = \\pm M + aJ + b$ where $M$ is the adjacency matrix of a $d$-regular graph, $aJ$ kills off the top eigenvalue of $M$ ($J$ is the all-one matrix), and $b$ is chosen so that $A$ is just barely positive definite. This is for certifying that the graph has a large spectral gap.", "record_id": "Scientific-Answer-Ranking:scicomp:45365", "scores": [5, 3], "split": "train", "thread": {"accepted_answer_id": 45373, "answers": [{"answer_html": "

One such certificate would be a complete basis of eigenvectors for $A$. Obviously the size of that would be $O(n^2)$.

\n

Assuming all the eigenvalues are distinct, verification would only be needed to multiply each eigenvector by $A$ and check that the appropriate positive eigenvalue multiple (which could be included in the certificate for convenience) obtains. If $A$ has only $\\alpha$ nonzero entries per row, then $Av$ computes at a cost of $O(\\alpha n)$ per vector, for a total verification cost of $O(\\alpha n^2)$.

\n

Something needs to be said about the case that eigenvalues are not distinct, in that $n$ distinct eigenvectors might not provide a complete basis. (If the eigenvalues are distinct, the eigenvectors will be orthogonal and therefore linearly independent.)

\n

To cover that case, we would present the eigenvector basis in order of the increasing eigenvalues and in any group of equal eigenvalues, perform a column reduction among the eigenvalues sharing a common eigenvalue so that their linear independence can be checked by scanning that group of eigenvalues for leading nonzero entries. This scan needs not more than $kn$ operations for a group of $k$ eigenvectors sharing a common eigenvalue, and doing these scans for all basis vectors would need at most $n^2$ comparisons (since the block sizes $k$ sum to $n$).

\n", "answer_id": 45373, "answer_text": "One such certificate would be a complete basis of eigenvectors for $A$. Obviously the size of that would be $O(n^2)$.\n\n\n\n\nAssuming all the eigenvalues are distinct, verification would only be needed to multiply each eigenvector by $A$ and check that the appropriate positive eigenvalue multiple (which could be included in the certificate for convenience) obtains. If $A$ has only $\\alpha$ nonzero entries per row, then $Av$ computes at a cost of $O(\\alpha n)$ per vector, for a total verification cost of $O(\\alpha n^2)$.\n\n\n\n\nSomething needs to be said about the case that eigenvalues are not distinct, in that $n$ distinct eigenvectors might not provide a complete basis. (If the eigenvalues are distinct, the eigenvectors will be orthogonal and therefore linearly independent.)\n\n\n\n\nTo cover that case, we would present the eigenvector basis in order of the increasing eigenvalues and in any group of equal eigenvalues, perform a column reduction among the eigenvalues sharing a common eigenvalue so that their linear independence can be checked by scanning that group of eigenvalues for leading nonzero entries. This scan needs not more than $kn$ operations for a group of $k$ eigenvectors sharing a common eigenvalue, and doing these scans for all basis vectors would need at most $n^2$ comparisons (since the block sizes $k$ sum to $n$).", "answer_url": "https://scicomp.stackexchange.com/a/45373", "author": "hardmath", "author_url": "https://scicomp.stackexchange.com/users/651/hardmath", "author_user_type": "moderator", "content_license": "CC BY-SA 4.0", "created_at": "2026-02-14T05:17:51+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45365, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "hardmath", "profile_url": "https://scicomp.stackexchange.com/users/651/hardmath", "user_type": "moderator"}, "created_at": "2026-02-14T05:17:51+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "0423C78D-1A2E-4A63-8C37-0836DFBF8471", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/0423C78D-1A2E-4A63-8C37-0836DFBF8471/view-source"}], "score": 5, "updated_at": "2026-02-14T05:17:51+00:00"}, {"answer_html": "

davidad had a nice suggestion on Twitter found via Gemini. I'll describe the exact arithmetic version here, and I've also formalised a version in approximate integer arithmetic and used it to prove that a particular 16-regular 65536-node pseudorandom graph is a good spectral expander.

\n

Theorem. Let $A, Z \\in \\mathbb{R}^{n \\times n}$ s.t. $A$ is symmetric, $Z$ is an upper triangular matrix with positive diagonal, and $AZ$ is lower triangular with positive diagonal. Then $A$ is positive definite.

\n

Proof: $A = (AZ)Z^{-1}$ is an $LU$-factorisation of $A$ where both factors have positive diagonal. Thus, every leading principle minor of $A$ is positive, and $A$ is positive definite by Sylvester’s criterion.

\n

$Z$ can be computed in $O(n^3)$-time by taking an $LDL^T$ factorisation of $A$ and inverting $L^T$. For AKS purposes, we do that computation in Rust, scale up and round to integers, then use an approximation-aware version of the theorem to compute $AZ$ in $O(\\alpha n^2)$ time in Lean to certify that our matrix is positive definite.

\n", "answer_id": 45400, "answer_text": "davidad had a nice suggestion on Twitter (https://x.com/davidad/status/2022316806094913669) found via Gemini. I'll describe the exact arithmetic version here, and I've also formalised a version in approximate integer arithmetic (https://github.com/girving/aks?tab=readme-ov-file#alternative-path-zig-zag-product-with-certified-base-expander) and used it to prove that a particular 16-regular 65536-node pseudorandom graph (https://github.com/girving/aks/blob/main/Random/Concrete/Random65536.lean) is a good spectral expander.\n\n\n\n\nTheorem. Let $A, Z \\in \\mathbb{R}^{n \\times n}$ s.t. $A$ is symmetric, $Z$ is an upper triangular matrix with positive diagonal, and $AZ$ is lower triangular with positive diagonal. Then $A$ is positive definite.\n\n\n\n\nProof: $A = (AZ)Z^{-1}$ is an $LU$-factorisation of $A$ where both factors have positive diagonal. Thus, every leading principle minor of $A$ is positive, and $A$ is positive definite by Sylvester’s criterion (https://en.wikipedia.org/wiki/Sylvester%27s_criterion).\n\n\n\n\n$Z$ can be computed in $O(n^3)$-time by taking an $LDL^T$ factorisation of $A$ and inverting $L^T$. For AKS purposes (https://github.com/girving/aks?tab=readme-ov-file#alternative-path-zig-zag-product-with-certified-base-expander), we do that computation in Rust, scale up and round to integers, then use an approximation-aware version of the theorem to compute $AZ$ in $O(\\alpha n^2)$ time in Lean to certify that our matrix is positive definite.", "answer_url": "https://scicomp.stackexchange.com/a/45400", "author": "Geoffrey Irving", "author_url": "https://scicomp.stackexchange.com/users/447/geoffrey-irving", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-03-08T14:38:26+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45365, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Geoffrey Irving", "profile_url": "https://scicomp.stackexchange.com/users/447/geoffrey-irving", "user_type": "registered"}, "created_at": "2026-03-08T14:38:26+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "C2916C95-6525-425D-95F8-013BE89C6FE8", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/C2916C95-6525-425D-95F8-013BE89C6FE8/view-source"}, {"content_license": null, "contributor": {"display_name": "Geoffrey Irving", "profile_url": "https://scicomp.stackexchange.com/users/447/geoffrey-irving", "user_type": "registered"}, "created_at": "2026-03-08T14:38:26+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "EF757A2A-32DC-420E-B2D9-9A80067BEEF4", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://scicomp.stackexchange.com/revisions/EF757A2A-32DC-420E-B2D9-9A80067BEEF4/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Geoffrey Irving", "profile_url": "https://scicomp.stackexchange.com/users/447/geoffrey-irving", "user_type": "registered"}, "created_at": "2026-03-08T15:18:06+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "A2E955D9-336B-42C0-91D8-2291CF8B5C88", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/A2E955D9-336B-42C0-91D8-2291CF8B5C88/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Geoffrey Irving", "profile_url": "https://scicomp.stackexchange.com/users/447/geoffrey-irving", "user_type": "registered"}, "created_at": "2026-03-08T15:52:28+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "D7AD102B-0743-4767-BC0A-889EBE63C005", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/D7AD102B-0743-4767-BC0A-889EBE63C005/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Geoffrey Irving", "profile_url": "https://scicomp.stackexchange.com/users/447/geoffrey-irving", "user_type": "registered"}, "created_at": "2026-03-08T16:06:15+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "378EEA75-B926-4694-8E28-8A9054C4AD0B", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/378EEA75-B926-4694-8E28-8A9054C4AD0B/view-source"}], "score": 3, "updated_at": "2026-03-08T16:06:15+00:00"}], "domain": "computational_science", "external_links": ["https://en.wikipedia.org/wiki/Sylvester%27s_criterion", "https://github.com/girving/aks/blob/main/Random/Concrete/Random65536.lean", "https://github.com/girving/aks?tab=readme-ov-file#alternative-path-zig-zag-product-with-certified-base-expander", "https://x.com/davidad/status/2022316806094913669"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:44.584971+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/272744bcc95b58699f7df6e6979b288bb8b00a80ab9c7982dbe170a6d0b63584_1790825325025901700_0.json", "raw_sha256": "27a81850a40920682c29ada76a2b55e80340a5c82764a3e9dde8a9c2ba23db4e", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Geoffrey Irving", "question_author_url": "https://scicomp.stackexchange.com/users/447/geoffrey-irving", "question_author_user_type": "registered", "question_created_at": "2026-02-12T10:13:30+00:00", "question_html": "

I have an $n \\times n$ sparse, symmetric matrix $A$ with an average of $\\alpha$ nonzeros per row, so that $\\operatorname{nnz}(A) = \\alpha n$. Is it possible to generate an $O(n^2)$-size certificate that the matrix is positive definite, that can be checked in $O(\\alpha^2 n^2)$ time or similar? E.g., I can do it in $O(n^3)$ time using Cholesky factorization as the certificate, but then naively I can’t take advantage of the sparsity of $A$.

\n

Unfortunately $A$ has very little structure and is very far from diagonally dominant (it comes from a random graph), so only certificates that exist for all SPD $A$ are likely to work.

\n

Motivation: My specific $A = \\pm M + aJ + b$ where $M$ is the adjacency matrix of a $d$-regular graph, $aJ$ kills off the top eigenvalue of $M$ ($J$ is the all-one matrix), and $b$ is chosen so that $A$ is just barely positive definite. This is for certifying that the graph has a large spectral gap.

\n", "question_id": 45365, "question_license": "CC BY-SA 4.0", "question_score": 7, "question_text": "I have an $n \\times n$ sparse, symmetric matrix $A$ with an average of $\\alpha$ nonzeros per row, so that $\\operatorname{nnz}(A) = \\alpha n$. Is it possible to generate an $O(n^2)$-size certificate that the matrix is positive definite, that can be checked in $O(\\alpha^2 n^2)$ time or similar? E.g., I can do it in $O(n^3)$ time using Cholesky factorization as the certificate, but then naively I can’t take advantage of the sparsity of $A$.\n\n\n\n\nUnfortunately $A$ has very little structure and is very far from diagonally dominant (it comes from a random graph), so only certificates that exist for all SPD $A$ are likely to work.\n\n\n\n\nMotivation: My specific $A = \\pm M + aJ + b$ where $M$ is the adjacency matrix of a $d$-regular graph, $aJ$ kills off the top eigenvalue of $M$ ($J$ is the all-one matrix), and $b$ is chosen so that $A$ is just barely positive definite. This is for certifying that the graph has a large spectral gap.", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Geoffrey Irving", "profile_url": "https://scicomp.stackexchange.com/users/447/geoffrey-irving", "user_type": "registered"}, "created_at": "2026-02-12T10:13:30+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "BB5AB317-3634-4CE7-87B5-DDDBF1C474D6", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/BB5AB317-3634-4CE7-87B5-DDDBF1C474D6/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Geoffrey Irving", "profile_url": "https://scicomp.stackexchange.com/users/447/geoffrey-irving", "user_type": "registered"}, "created_at": "2026-02-12T10:21:53+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "0CF8E6F6-C781-4535-B331-C82123174D20", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/0CF8E6F6-C781-4535-B331-C82123174D20/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Geoffrey Irving", "profile_url": "https://scicomp.stackexchange.com/users/447/geoffrey-irving", "user_type": "registered"}, "created_at": "2026-02-12T20:10:10+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "6349FD69-F5C2-4D7A-A0A1-BA6C94C5F3DE", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/6349FD69-F5C2-4D7A-A0A1-BA6C94C5F3DE/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Geoffrey Irving", "profile_url": "https://scicomp.stackexchange.com/users/447/geoffrey-irving", "user_type": "registered"}, "created_at": "2026-02-14T08:02:37+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "96A24ECC-0E3F-4132-A897-18D17A174978", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/96A24ECC-0E3F-4132-A897-18D17A174978/view-source"}], "source_site": "scicomp", "source_url": "https://scicomp.stackexchange.com/questions/45365/certificate-for-strict-positive-definiteness-of-a-sparse-matrix", "split": "train", "split_group": "fde0820e3f7821b6665ada5b318c8fbb395dff7fdf0078b7e0d7ad6c57b8f17c", "tags": ["linear-algebra"], "thread_id": "scicomp:45365", "title": "Certificate for strict positive definiteness of a sparse matrix"}} {"accepted_status": [false, false], "candidate_answers": [{"answer_html": "

In the end, a Crank-Nicolson (CN) scheme is a way to resolve a differential operator, be it space or time. You can call a first order backward finite difference "backward Euler" as in the time integration scheme, but that doesn't necessarily help people get what you mean.

\n

Since the picture suggests a two-dimensional Poisson equation, CN is used to interpret one spatial dimension (y) as a "time" dimension. You can thus say that you have a semi-discretized version of your PDE (10) since you have discretized away the "spatial" derivatives. Then you apply any ODE method to (10). This sequence of steps --- discretize derivatives in all dimension but one and then apply some ODE method to the remaining derivative --- is called the method of lines. It's completely independent of whatever method you use for the final ODE.

\n

Whether that kind of reinterpretation is sensible and whether it's applied correctly here is another question. A more "normal" application of CN to solving a Poisson equation would be the method of false transients, pretending it is time dependent but solving to steady state:\n\\begin{align}\nu_t + \\nabla^2 u = f\n\\end{align}\nwith $u_t$ the time derivative of $u$.\nIn that case you can (again) apply any semi-discretization to the Laplace operator to get back to one continuous derivative and then apply any ODE method (e.g. CN) to solve until your pseudo-time evolution becomes small enough.

\n

You should also link whatever article it is you are confused about; there may be additional relevant details. This article may be related as essentially they also discretize one spatial dimension first, then transform from second to first order, and finally (effectively) use an exponential integrator for solving the remaining dimension.

\n", "answer_id": 45370, "answer_text": "In the end, a Crank-Nicolson (CN) scheme is a way to resolve a differential operator, be it space or time. You can call a first order backward finite difference \"backward Euler\" as in the time integration scheme, but that doesn't necessarily help people get what you mean.\n\n\n\n\nSince the picture suggests a two-dimensional Poisson equation, CN is used to interpret one spatial dimension (y) as a \"time\" dimension. You can thus say that you have a semi-discretized version of your PDE (10) since you have discretized away the \"spatial\" derivatives. Then you apply any ODE method to (10). This sequence of steps --- discretize derivatives in all dimension but one and then apply some ODE method to the remaining derivative --- is called the method of lines. It's completely independent of whatever method you use for the final ODE.\n\n\n\n\nWhether that kind of reinterpretation is sensible and whether it's applied correctly here is another question. A more \"normal\" application of CN to solving a Poisson equation would be the method of false transients, pretending it is time dependent but solving to steady state:\n\\begin{align}\nu_t + \\nabla^2 u = f\n\\end{align}\nwith $u_t$ the time derivative of $u$.\nIn that case you can (again) apply any semi-discretization to the Laplace operator to get back to one continuous derivative and then apply any ODE method (e.g. CN) to solve until your pseudo-time evolution becomes small enough.\n\n\n\n\nYou should also link whatever article it is you are confused about; there may be additional relevant details. This article (https://www.sciencedirect.com/science/article/abs/pii/S0009250903005748?via%3Dihub) may be related as essentially they also discretize one spatial dimension first, then transform from second to first order, and finally (effectively) use an exponential integrator for solving the remaining dimension.", "answer_url": "https://scicomp.stackexchange.com/a/45370", "author": "niemc", "author_url": "https://scicomp.stackexchange.com/users/50632/niemc", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-02-12T23:59:15+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45369, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "niemc", "profile_url": "https://scicomp.stackexchange.com/users/50632/niemc", "user_type": "registered"}, "created_at": "2026-02-12T23:59:15+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "5DF2B93F-B6BB-4006-98C6-F3A03D6016D2", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/5DF2B93F-B6BB-4006-98C6-F3A03D6016D2/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "niemc", "profile_url": "https://scicomp.stackexchange.com/users/50632/niemc", "user_type": "registered"}, "created_at": "2026-02-13T00:17:13+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "26AD9D5F-8E17-4B20-A8BA-5F642E19D96C", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/26AD9D5F-8E17-4B20-A8BA-5F642E19D96C/view-source"}], "score": 3, "updated_at": "2026-02-13T00:17:13+00:00"}, {"answer_html": "

Method of lines refers to solving numerically a PDE by first applying a space discretisation scheme to the all the space derivatives, and then applying a time discretisation schemes on the resulting set of ODEs.

\n

Crank-Nicolson is in itself a second-order time scheme, however it originated for the heat equation, hence was often used in conjunction with the second-order finite difference scheme in for the space derivative in the heat equation.

\n

Space-time schemes, on the other hand, involve combined space and time discretisations, where specific terms involving both the space and time discretizations sizes may appear. I am more familiar with them for convection equation, see e.g. the Lax-Wendroff scheme.

\n", "answer_id": 45372, "answer_text": "Method of lines refers to solving numerically a PDE by first applying a space discretisation scheme to the all the space derivatives, and then applying a time discretisation schemes on the resulting set of ODEs.\n\n\n\n\nCrank-Nicolson is in itself a second-order time scheme, however it originated for the heat equation, hence was often used in conjunction with the second-order finite difference scheme in for the space derivative in the heat equation.\n\n\n\n\nSpace-time schemes, on the other hand, involve combined space and time discretisations, where specific terms involving both the space and time discretizations sizes may appear. I am more familiar with them for convection equation, see e.g. the Lax-Wendroff scheme.", "answer_url": "https://scicomp.stackexchange.com/a/45372", "author": "Laurent90", "author_url": "https://scicomp.stackexchange.com/users/37494/laurent90", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-02-13T06:11:05+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45369, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Laurent90", "profile_url": "https://scicomp.stackexchange.com/users/37494/laurent90", "user_type": "registered"}, "created_at": "2026-02-13T06:11:05+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "ABB7A01A-F37F-4189-8B31-F68836CD5CC3", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/ABB7A01A-F37F-4189-8B31-F68836CD5CC3/view-source"}], "score": 2, "updated_at": "2026-02-13T06:11:05+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I would like to ask whether the Crank-Nicolson Method can be used to approximate derivatives for PDE that doesn't involve time variable, because i've been reading this article that solves Poisson equation using Method of Lines with CN. It also confuses me, where as shown in the picture, why do they apply CN method on the equation and after that stated that they applied MOL approximation on the original equation? Does it mean that applying the CN = MOL approximation? Or is this just a language problem? bcs english is not my 1st language and the article seems to have a few grammatical error too.\n\n\n\n\nIf anyone could help,it would be great, thankyou!\n\n\n\n\nLink to paper. (https://doi.org/10.28919/cpr-pajm/3-24)\n\n\n\n\n[image: Here's The Picture!; source: https://i.sstatic.net/AJzDZgG8.png] (https://i.sstatic.net/AJzDZgG8.png)", "record_id": "Scientific-Answer-Ranking:scicomp:45369", "scores": [3, 2], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

In the end, a Crank-Nicolson (CN) scheme is a way to resolve a differential operator, be it space or time. You can call a first order backward finite difference "backward Euler" as in the time integration scheme, but that doesn't necessarily help people get what you mean.

\n

Since the picture suggests a two-dimensional Poisson equation, CN is used to interpret one spatial dimension (y) as a "time" dimension. You can thus say that you have a semi-discretized version of your PDE (10) since you have discretized away the "spatial" derivatives. Then you apply any ODE method to (10). This sequence of steps --- discretize derivatives in all dimension but one and then apply some ODE method to the remaining derivative --- is called the method of lines. It's completely independent of whatever method you use for the final ODE.

\n

Whether that kind of reinterpretation is sensible and whether it's applied correctly here is another question. A more "normal" application of CN to solving a Poisson equation would be the method of false transients, pretending it is time dependent but solving to steady state:\n\\begin{align}\nu_t + \\nabla^2 u = f\n\\end{align}\nwith $u_t$ the time derivative of $u$.\nIn that case you can (again) apply any semi-discretization to the Laplace operator to get back to one continuous derivative and then apply any ODE method (e.g. CN) to solve until your pseudo-time evolution becomes small enough.

\n

You should also link whatever article it is you are confused about; there may be additional relevant details. This article may be related as essentially they also discretize one spatial dimension first, then transform from second to first order, and finally (effectively) use an exponential integrator for solving the remaining dimension.

\n", "answer_id": 45370, "answer_text": "In the end, a Crank-Nicolson (CN) scheme is a way to resolve a differential operator, be it space or time. You can call a first order backward finite difference \"backward Euler\" as in the time integration scheme, but that doesn't necessarily help people get what you mean.\n\n\n\n\nSince the picture suggests a two-dimensional Poisson equation, CN is used to interpret one spatial dimension (y) as a \"time\" dimension. You can thus say that you have a semi-discretized version of your PDE (10) since you have discretized away the \"spatial\" derivatives. Then you apply any ODE method to (10). This sequence of steps --- discretize derivatives in all dimension but one and then apply some ODE method to the remaining derivative --- is called the method of lines. It's completely independent of whatever method you use for the final ODE.\n\n\n\n\nWhether that kind of reinterpretation is sensible and whether it's applied correctly here is another question. A more \"normal\" application of CN to solving a Poisson equation would be the method of false transients, pretending it is time dependent but solving to steady state:\n\\begin{align}\nu_t + \\nabla^2 u = f\n\\end{align}\nwith $u_t$ the time derivative of $u$.\nIn that case you can (again) apply any semi-discretization to the Laplace operator to get back to one continuous derivative and then apply any ODE method (e.g. CN) to solve until your pseudo-time evolution becomes small enough.\n\n\n\n\nYou should also link whatever article it is you are confused about; there may be additional relevant details. This article (https://www.sciencedirect.com/science/article/abs/pii/S0009250903005748?via%3Dihub) may be related as essentially they also discretize one spatial dimension first, then transform from second to first order, and finally (effectively) use an exponential integrator for solving the remaining dimension.", "answer_url": "https://scicomp.stackexchange.com/a/45370", "author": "niemc", "author_url": "https://scicomp.stackexchange.com/users/50632/niemc", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-02-12T23:59:15+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45369, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "niemc", "profile_url": "https://scicomp.stackexchange.com/users/50632/niemc", "user_type": "registered"}, "created_at": "2026-02-12T23:59:15+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "5DF2B93F-B6BB-4006-98C6-F3A03D6016D2", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/5DF2B93F-B6BB-4006-98C6-F3A03D6016D2/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "niemc", "profile_url": "https://scicomp.stackexchange.com/users/50632/niemc", "user_type": "registered"}, "created_at": "2026-02-13T00:17:13+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "26AD9D5F-8E17-4B20-A8BA-5F642E19D96C", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/26AD9D5F-8E17-4B20-A8BA-5F642E19D96C/view-source"}], "score": 3, "updated_at": "2026-02-13T00:17:13+00:00"}, {"answer_html": "

Method of lines refers to solving numerically a PDE by first applying a space discretisation scheme to the all the space derivatives, and then applying a time discretisation schemes on the resulting set of ODEs.

\n

Crank-Nicolson is in itself a second-order time scheme, however it originated for the heat equation, hence was often used in conjunction with the second-order finite difference scheme in for the space derivative in the heat equation.

\n

Space-time schemes, on the other hand, involve combined space and time discretisations, where specific terms involving both the space and time discretizations sizes may appear. I am more familiar with them for convection equation, see e.g. the Lax-Wendroff scheme.

\n", "answer_id": 45372, "answer_text": "Method of lines refers to solving numerically a PDE by first applying a space discretisation scheme to the all the space derivatives, and then applying a time discretisation schemes on the resulting set of ODEs.\n\n\n\n\nCrank-Nicolson is in itself a second-order time scheme, however it originated for the heat equation, hence was often used in conjunction with the second-order finite difference scheme in for the space derivative in the heat equation.\n\n\n\n\nSpace-time schemes, on the other hand, involve combined space and time discretisations, where specific terms involving both the space and time discretizations sizes may appear. I am more familiar with them for convection equation, see e.g. the Lax-Wendroff scheme.", "answer_url": "https://scicomp.stackexchange.com/a/45372", "author": "Laurent90", "author_url": "https://scicomp.stackexchange.com/users/37494/laurent90", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-02-13T06:11:05+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45369, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Laurent90", "profile_url": "https://scicomp.stackexchange.com/users/37494/laurent90", "user_type": "registered"}, "created_at": "2026-02-13T06:11:05+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "ABB7A01A-F37F-4189-8B31-F68836CD5CC3", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/ABB7A01A-F37F-4189-8B31-F68836CD5CC3/view-source"}], "score": 2, "updated_at": "2026-02-13T06:11:05+00:00"}], "domain": "computational_science", "external_links": ["https://doi.org/10.28919/cpr-pajm/3-24", "https://i.sstatic.net/AJzDZgG8.png", "https://www.sciencedirect.com/science/article/abs/pii/S0009250903005748?via%3Dihub"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:44.584971+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/272744bcc95b58699f7df6e6979b288bb8b00a80ab9c7982dbe170a6d0b63584_1790825325025901700_0.json", "raw_sha256": "27a81850a40920682c29ada76a2b55e80340a5c82764a3e9dde8a9c2ba23db4e", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "TalkingAngela8_8", "question_author_url": "https://scicomp.stackexchange.com/users/56498/talkingangela8-8", "question_author_user_type": "registered", "question_created_at": "2026-02-12T21:28:41+00:00", "question_html": "

I would like to ask whether the Crank-Nicolson Method can be used to approximate derivatives for PDE that doesn't involve time variable, because i've been reading this article that solves Poisson equation using Method of Lines with CN. It also confuses me, where as shown in the picture, why do they apply CN method on the equation and after that stated that they applied MOL approximation on the original equation? Does it mean that applying the CN = MOL approximation? Or is this just a language problem? bcs english is not my 1st language and the article seems to have a few grammatical error too.

\n

If anyone could help,it would be great, thankyou!

\n

Link to paper.

\n

\"Here's

\n", "question_id": 45369, "question_license": "CC BY-SA 4.0", "question_score": 1, "question_text": "I would like to ask whether the Crank-Nicolson Method can be used to approximate derivatives for PDE that doesn't involve time variable, because i've been reading this article that solves Poisson equation using Method of Lines with CN. It also confuses me, where as shown in the picture, why do they apply CN method on the equation and after that stated that they applied MOL approximation on the original equation? Does it mean that applying the CN = MOL approximation? Or is this just a language problem? bcs english is not my 1st language and the article seems to have a few grammatical error too.\n\n\n\n\nIf anyone could help,it would be great, thankyou!\n\n\n\n\nLink to paper. (https://doi.org/10.28919/cpr-pajm/3-24)\n\n\n\n\n[image: Here's The Picture!; source: https://i.sstatic.net/AJzDZgG8.png] (https://i.sstatic.net/AJzDZgG8.png)", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "TalkingAngela8_8", "profile_url": "https://scicomp.stackexchange.com/users/56498/talkingangela8-8", "user_type": "registered"}, "created_at": "2026-02-12T21:28:41+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "BC7B27A5-1C44-4582-A321-68F027BFF4BE", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/BC7B27A5-1C44-4582-A321-68F027BFF4BE/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "TalkingAngela8_8", "profile_url": "https://scicomp.stackexchange.com/users/56498/talkingangela8-8", "user_type": "registered"}, "created_at": "2026-02-12T22:21:35+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "16F0760F-C863-4ED1-A66B-E03D50752E45", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/16F0760F-C863-4ED1-A66B-E03D50752E45/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "TalkingAngela8_8", "profile_url": "https://scicomp.stackexchange.com/users/56498/talkingangela8-8", "user_type": "registered"}, "created_at": "2026-02-12T22:22:41+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "865DFA1F-0225-4BA9-B066-9119E418BE38", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/865DFA1F-0225-4BA9-B066-9119E418BE38/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "niemc", "profile_url": "https://scicomp.stackexchange.com/users/50632/niemc", "user_type": "registered"}, "created_at": "2026-02-18T01:20:52+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "F226B0E0-D620-4B4B-AEBA-28F71A6AAC17", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/F226B0E0-D620-4B4B-AEBA-28F71A6AAC17/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Vladimir F Героям слава", "profile_url": "https://scicomp.stackexchange.com/users/1244/vladimir-f-%d0%93%d0%b5%d1%80%d0%be%d1%8f%d0%bc-%d1%81%d0%bb%d0%b0%d0%b2%d0%b0", "user_type": "registered"}, "created_at": "2026-03-24T13:40:00+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "A20FCAD1-4AE6-4577-A2E7-481176806EF8", "revision_number": 5, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/A20FCAD1-4AE6-4577-A2E7-481176806EF8/view-source"}], "source_site": "scicomp", "source_url": "https://scicomp.stackexchange.com/questions/45369/crank-nicolson-method-and-method-of-lines", "split": "train", "split_group": "e26be2615247e2db441f05a66de93f1aaacb9c9c0fe96222161846a6af438c78", "tags": ["finite-difference", "computational-physics", "crank-nicolson", "method-of-lines"], "thread_id": "scicomp:45369", "title": "Crank-Nicolson Method and Method of Lines"}} {"accepted_status": [false, false, false, false], "candidate_answers": [{"answer_html": "

It is possible you already do these things, but here are my two cents:

\n

Turbulence and chemical reactions will make your flow field quite chaotic and it is near impossible to see what is going on when seeing these directly. My approach would be to mostly visualize and inspect time-averaged properties of the flow and reactions, and then reduce the analysis to the 3D region of interest. In these large simulations a lot of flops are used for the environment while the interesting things happen in very small regions of space!

\n

Have you visualized these properties (or similar) at the points of interest ?

\n
    \n
  • average pressure variations + fourier analysis for frequency (->mechanical stress / vibration)
  • \n
  • average reaction/burn quota (chemical abrasion / heat)
  • \n
  • local maxima of average reaction/burn rate (is combustion happening where you want it to?)
  • \n
  • local maxima of surface forces on liquid/solid barrier (->are these where they should be?)
  • \n
  • local maxima of body forces in solids (->are these where they should be? Breaking points?)
  • \n
  • temperature gradients in materials (->mechanical stresses during warmup/cool down phases)
  • \n
\n", "answer_id": 45381, "answer_text": "It is possible you already do these things, but here are my two cents:\n\n\n\n\nTurbulence and chemical reactions will make your flow field quite chaotic and it is near impossible to see what is going on when seeing these directly. My approach would be to mostly visualize and inspect time-averaged properties of the flow and reactions, and then reduce the analysis to the 3D region of interest. In these large simulations a lot of flops are used for the environment while the interesting things happen in very small regions of space!\n\n\n\n\nHave you visualized these properties (or similar) at the points of interest ?\n\n\n\n\n\naverage pressure variations + fourier analysis for frequency (->mechanical stress / vibration)\n\n\n\n\naverage reaction/burn quota (chemical abrasion / heat)\n\n\n\n\nlocal maxima of average reaction/burn rate (is combustion happening where you want it to?)\n\n\n\n\nlocal maxima of surface forces on liquid/solid barrier (->are these where they should be?)\n\n\n\n\nlocal maxima of body forces in solids (->are these where they should be? Breaking points?)\n\n\n\n\ntemperature gradients in materials (->mechanical stresses during warmup/cool down phases)", "answer_url": "https://scicomp.stackexchange.com/a/45381", "author": "MPIchael", "author_url": "https://scicomp.stackexchange.com/users/28636/mpichael", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-02-23T09:17:33+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45380, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "MPIchael", "profile_url": "https://scicomp.stackexchange.com/users/28636/mpichael", "user_type": "registered"}, "created_at": "2026-02-23T09:17:33+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "A390A97B-8963-4F78-8F19-69468721F677", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/A390A97B-8963-4F78-8F19-69468721F677/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "MPIchael", "profile_url": "https://scicomp.stackexchange.com/users/28636/mpichael", "user_type": "registered"}, "created_at": "2026-02-23T12:18:03+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "CF210130-4810-4182-8CD1-0F94A63A78BD", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/CF210130-4810-4182-8CD1-0F94A63A78BD/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "MPIchael", "profile_url": "https://scicomp.stackexchange.com/users/28636/mpichael", "user_type": "registered"}, "created_at": "2026-02-23T12:34:30+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "35A837B0-574C-4D9B-99F3-3C6252D9C148", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/35A837B0-574C-4D9B-99F3-3C6252D9C148/view-source"}], "score": 4, "updated_at": "2026-02-23T12:34:30+00:00"}, {"answer_html": "

I think in order to 'see' results more clearly, you need to ask people who can 'see' already. Ask them to review your simulation results, and you will see them spotting things that you missed. After a while of doing this, you will improve. Recently, I presented results I was confident about to a senior colleague, and he spotted an error that showed me that my imposition of BCs was incorrect. I won't be making that error again.

\n", "answer_id": 45383, "answer_text": "I think in order to 'see' results more clearly, you need to ask people who can 'see' already. Ask them to review your simulation results, and you will see them spotting things that you missed. After a while of doing this, you will improve. Recently, I presented results I was confident about to a senior colleague, and he spotted an error that showed me that my imposition of BCs was incorrect. I won't be making that error again.", "answer_url": "https://scicomp.stackexchange.com/a/45383", "author": "NNN", "author_url": "https://scicomp.stackexchange.com/users/36539/nnn", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-02-23T11:03:19+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45380, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "NNN", "profile_url": "https://scicomp.stackexchange.com/users/36539/nnn", "user_type": "registered"}, "created_at": "2026-02-23T11:03:19+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "05ED0C9F-389C-4F87-8FB8-94FC47A5B359", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/05ED0C9F-389C-4F87-8FB8-94FC47A5B359/view-source"}], "score": 2, "updated_at": "2026-02-23T11:03:19+00:00"}, {"answer_html": "

To analyze why one geometry performs better than another one, you may want to get a better understanding of where total pressure losses are being generated. In simple terms, these losses arise primarily from viscous effects in boundary layers and especially flow separation and secondary flow. The book Internal Flow: Concepts and Applications by Greitzer et al. discusses various losses in considerable detail.

\n

Your CFD package should allow you to visualise the total pressure. In addition, it may offer options to identify regions with flow separation and secondary flow. The CFD community has for many years worked on the automated extraction of such regions, see especially the work by Bob Haimes at MIT, Using residence time for the extraction of recirculation regions and Automated Extraction of Secondary Flow Features. If your visualisation package does not offer these options, you may be able to write a user-defined function and call it from your package.

\n", "answer_id": 45384, "answer_text": "To analyze why one geometry performs better than another one, you may want to get a better understanding of where total pressure losses are being generated. In simple terms, these losses arise primarily from viscous effects in boundary layers and especially flow separation and secondary flow. The book Internal Flow: Concepts and Applications (https://www.cambridge.org/core/books/internal-flow/14285A6FF068386CF4A1EBBA835319DE) by Greitzer et al. discusses various losses in considerable detail.\n\n\n\n\nYour CFD package should allow you to visualise the total pressure. In addition, it may offer options to identify regions with flow separation and secondary flow. The CFD community has for many years worked on the automated extraction of such regions, see especially the work by Bob Haimes at MIT, Using residence time for the extraction of recirculation regions (https://arc.aiaa.org/doi/10.2514/6.1999-3291) and Automated Extraction of Secondary Flow Features (https://arc.aiaa.org/doi/10.2514/6.2005-1152). If your visualisation package does not offer these options, you may be able to write a user-defined function and call it from your package.", "answer_url": "https://scicomp.stackexchange.com/a/45384", "author": "Brian Zatapatique", "author_url": "https://scicomp.stackexchange.com/users/1792/brian-zatapatique", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-02-24T06:18:36+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45380, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Brian Zatapatique", "profile_url": "https://scicomp.stackexchange.com/users/1792/brian-zatapatique", "user_type": "registered"}, "created_at": "2026-02-24T06:18:36+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "48288EA0-3EAA-44FF-ACBD-344164177956", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/48288EA0-3EAA-44FF-ACBD-344164177956/view-source"}], "score": 3, "updated_at": "2026-02-24T06:18:36+00:00"}, {"answer_html": "

The approach that I have used a few times with considerable success is reconstruction of individual terms of the underlying partial differential equations from the simulations. This is achieved by using the simulated time history $f(\\vec{x},t)$ to calculate the spatial and temporal derivatives. Subsequently, one can establish the dominant terms in the equations. This technique often simplifies the construction of a reduced model and helps developing physical interpretation of the results.

\n", "answer_id": 45385, "answer_text": "The approach that I have used a few times with considerable success is reconstruction of individual terms of the underlying partial differential equations from the simulations. This is achieved by using the simulated time history $f(\\vec{x},t)$ to calculate the spatial and temporal derivatives. Subsequently, one can establish the dominant terms in the equations. This technique often simplifies the construction of a reduced model and helps developing physical interpretation of the results.", "answer_url": "https://scicomp.stackexchange.com/a/45385", "author": "Maxim Umansky", "author_url": "https://scicomp.stackexchange.com/users/4325/maxim-umansky", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-02-24T16:58:31+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45380, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Maxim Umansky", "profile_url": "https://scicomp.stackexchange.com/users/4325/maxim-umansky", "user_type": "registered"}, "created_at": "2026-02-24T16:58:31+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "183FE1E3-6551-4C57-9000-6B526DCDD5D8", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/183FE1E3-6551-4C57-9000-6B526DCDD5D8/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Maxim Umansky", "profile_url": "https://scicomp.stackexchange.com/users/4325/maxim-umansky", "user_type": "registered"}, "created_at": "2026-02-24T17:46:20+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "56653285-1694-44A3-BD64-039A48340820", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/56653285-1694-44A3-BD64-039A48340820/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Maxim Umansky", "profile_url": "https://scicomp.stackexchange.com/users/4325/maxim-umansky", "user_type": "registered"}, "created_at": "2026-02-25T00:14:34+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "C1164440-2522-4CA3-B997-25A50BEA32CB", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/C1164440-2522-4CA3-B997-25A50BEA32CB/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Maxim Umansky", "profile_url": "https://scicomp.stackexchange.com/users/4325/maxim-umansky", "user_type": "registered"}, "created_at": "2026-02-25T02:53:55+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "054FA401-B403-40F0-AD3E-42690191E4BE", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/054FA401-B403-40F0-AD3E-42690191E4BE/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Maxim Umansky", "profile_url": "https://scicomp.stackexchange.com/users/4325/maxim-umansky", "user_type": "registered"}, "created_at": "2026-02-27T21:25:52+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "8127BA24-67D1-4103-BFCC-667389465461", "revision_number": 5, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/8127BA24-67D1-4103-BFCC-667389465461/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Maxim Umansky", "profile_url": "https://scicomp.stackexchange.com/users/4325/maxim-umansky", "user_type": "registered"}, "created_at": "2026-02-27T21:55:52+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "8DF44554-2DD2-44F5-B706-213CDD100212", "revision_number": 6, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/8DF44554-2DD2-44F5-B706-213CDD100212/view-source"}], "score": 3, "updated_at": "2026-02-27T21:55:52+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I've been working as an aerospace engineer for a couple years now, and my job comprises mainly of building/running/analyzing CFD simulations and using their results to inform design decisions. I find myself running a lot of DOEs and trade studies, and it's very interesting work.\n\n\n\n\nInitially, my group gave me simpler problems as I was learning the software, and so I gradually learned how to build and run more complex models. Now, I have become somewhat proficient, even for very challenging models. I've trained an intern and now they are also up and running. I have started to get more recognition and have contributed to our team's best practices, found and solved bugs, etc.\n\n\n\n\nAnd so while the previous 'bottleneck of understanding' was simply building/running/converging a model, I've found the new challenge for me is understanding and analyzing my results. For context, I typically run multiphase, rotating, internal CFD with cell counts typically in the 5-30 M range, and I've had some trouble with 'seeing' what is going on in the flowfields. There are usually a ton of three-dimensional effects as well. I've found it difficult to root-cause analyze why, for example, Geometry A performs better than Geometry B, and then communicate that to others.\n\n\n\n\nWhat can I do to better understand CFD simulation results, especially with extremely complex geometries? Recently, I've made animations moving through the domain in one dimension, and it helps somewhat. What tips/tricks have worked for you?", "record_id": "Scientific-Answer-Ranking:scicomp:45380", "scores": [4, 2, 3, 3], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

It is possible you already do these things, but here are my two cents:

\n

Turbulence and chemical reactions will make your flow field quite chaotic and it is near impossible to see what is going on when seeing these directly. My approach would be to mostly visualize and inspect time-averaged properties of the flow and reactions, and then reduce the analysis to the 3D region of interest. In these large simulations a lot of flops are used for the environment while the interesting things happen in very small regions of space!

\n

Have you visualized these properties (or similar) at the points of interest ?

\n
    \n
  • average pressure variations + fourier analysis for frequency (->mechanical stress / vibration)
  • \n
  • average reaction/burn quota (chemical abrasion / heat)
  • \n
  • local maxima of average reaction/burn rate (is combustion happening where you want it to?)
  • \n
  • local maxima of surface forces on liquid/solid barrier (->are these where they should be?)
  • \n
  • local maxima of body forces in solids (->are these where they should be? Breaking points?)
  • \n
  • temperature gradients in materials (->mechanical stresses during warmup/cool down phases)
  • \n
\n", "answer_id": 45381, "answer_text": "It is possible you already do these things, but here are my two cents:\n\n\n\n\nTurbulence and chemical reactions will make your flow field quite chaotic and it is near impossible to see what is going on when seeing these directly. My approach would be to mostly visualize and inspect time-averaged properties of the flow and reactions, and then reduce the analysis to the 3D region of interest. In these large simulations a lot of flops are used for the environment while the interesting things happen in very small regions of space!\n\n\n\n\nHave you visualized these properties (or similar) at the points of interest ?\n\n\n\n\n\naverage pressure variations + fourier analysis for frequency (->mechanical stress / vibration)\n\n\n\n\naverage reaction/burn quota (chemical abrasion / heat)\n\n\n\n\nlocal maxima of average reaction/burn rate (is combustion happening where you want it to?)\n\n\n\n\nlocal maxima of surface forces on liquid/solid barrier (->are these where they should be?)\n\n\n\n\nlocal maxima of body forces in solids (->are these where they should be? Breaking points?)\n\n\n\n\ntemperature gradients in materials (->mechanical stresses during warmup/cool down phases)", "answer_url": "https://scicomp.stackexchange.com/a/45381", "author": "MPIchael", "author_url": "https://scicomp.stackexchange.com/users/28636/mpichael", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-02-23T09:17:33+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45380, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "MPIchael", "profile_url": "https://scicomp.stackexchange.com/users/28636/mpichael", "user_type": "registered"}, "created_at": "2026-02-23T09:17:33+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "A390A97B-8963-4F78-8F19-69468721F677", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/A390A97B-8963-4F78-8F19-69468721F677/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "MPIchael", "profile_url": "https://scicomp.stackexchange.com/users/28636/mpichael", "user_type": "registered"}, "created_at": "2026-02-23T12:18:03+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "CF210130-4810-4182-8CD1-0F94A63A78BD", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/CF210130-4810-4182-8CD1-0F94A63A78BD/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "MPIchael", "profile_url": "https://scicomp.stackexchange.com/users/28636/mpichael", "user_type": "registered"}, "created_at": "2026-02-23T12:34:30+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "35A837B0-574C-4D9B-99F3-3C6252D9C148", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/35A837B0-574C-4D9B-99F3-3C6252D9C148/view-source"}], "score": 4, "updated_at": "2026-02-23T12:34:30+00:00"}, {"answer_html": "

I think in order to 'see' results more clearly, you need to ask people who can 'see' already. Ask them to review your simulation results, and you will see them spotting things that you missed. After a while of doing this, you will improve. Recently, I presented results I was confident about to a senior colleague, and he spotted an error that showed me that my imposition of BCs was incorrect. I won't be making that error again.

\n", "answer_id": 45383, "answer_text": "I think in order to 'see' results more clearly, you need to ask people who can 'see' already. Ask them to review your simulation results, and you will see them spotting things that you missed. After a while of doing this, you will improve. Recently, I presented results I was confident about to a senior colleague, and he spotted an error that showed me that my imposition of BCs was incorrect. I won't be making that error again.", "answer_url": "https://scicomp.stackexchange.com/a/45383", "author": "NNN", "author_url": "https://scicomp.stackexchange.com/users/36539/nnn", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-02-23T11:03:19+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45380, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "NNN", "profile_url": "https://scicomp.stackexchange.com/users/36539/nnn", "user_type": "registered"}, "created_at": "2026-02-23T11:03:19+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "05ED0C9F-389C-4F87-8FB8-94FC47A5B359", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/05ED0C9F-389C-4F87-8FB8-94FC47A5B359/view-source"}], "score": 2, "updated_at": "2026-02-23T11:03:19+00:00"}, {"answer_html": "

To analyze why one geometry performs better than another one, you may want to get a better understanding of where total pressure losses are being generated. In simple terms, these losses arise primarily from viscous effects in boundary layers and especially flow separation and secondary flow. The book Internal Flow: Concepts and Applications by Greitzer et al. discusses various losses in considerable detail.

\n

Your CFD package should allow you to visualise the total pressure. In addition, it may offer options to identify regions with flow separation and secondary flow. The CFD community has for many years worked on the automated extraction of such regions, see especially the work by Bob Haimes at MIT, Using residence time for the extraction of recirculation regions and Automated Extraction of Secondary Flow Features. If your visualisation package does not offer these options, you may be able to write a user-defined function and call it from your package.

\n", "answer_id": 45384, "answer_text": "To analyze why one geometry performs better than another one, you may want to get a better understanding of where total pressure losses are being generated. In simple terms, these losses arise primarily from viscous effects in boundary layers and especially flow separation and secondary flow. The book Internal Flow: Concepts and Applications (https://www.cambridge.org/core/books/internal-flow/14285A6FF068386CF4A1EBBA835319DE) by Greitzer et al. discusses various losses in considerable detail.\n\n\n\n\nYour CFD package should allow you to visualise the total pressure. In addition, it may offer options to identify regions with flow separation and secondary flow. The CFD community has for many years worked on the automated extraction of such regions, see especially the work by Bob Haimes at MIT, Using residence time for the extraction of recirculation regions (https://arc.aiaa.org/doi/10.2514/6.1999-3291) and Automated Extraction of Secondary Flow Features (https://arc.aiaa.org/doi/10.2514/6.2005-1152). If your visualisation package does not offer these options, you may be able to write a user-defined function and call it from your package.", "answer_url": "https://scicomp.stackexchange.com/a/45384", "author": "Brian Zatapatique", "author_url": "https://scicomp.stackexchange.com/users/1792/brian-zatapatique", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-02-24T06:18:36+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45380, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Brian Zatapatique", "profile_url": "https://scicomp.stackexchange.com/users/1792/brian-zatapatique", "user_type": "registered"}, "created_at": "2026-02-24T06:18:36+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "48288EA0-3EAA-44FF-ACBD-344164177956", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/48288EA0-3EAA-44FF-ACBD-344164177956/view-source"}], "score": 3, "updated_at": "2026-02-24T06:18:36+00:00"}, {"answer_html": "

The approach that I have used a few times with considerable success is reconstruction of individual terms of the underlying partial differential equations from the simulations. This is achieved by using the simulated time history $f(\\vec{x},t)$ to calculate the spatial and temporal derivatives. Subsequently, one can establish the dominant terms in the equations. This technique often simplifies the construction of a reduced model and helps developing physical interpretation of the results.

\n", "answer_id": 45385, "answer_text": "The approach that I have used a few times with considerable success is reconstruction of individual terms of the underlying partial differential equations from the simulations. This is achieved by using the simulated time history $f(\\vec{x},t)$ to calculate the spatial and temporal derivatives. Subsequently, one can establish the dominant terms in the equations. This technique often simplifies the construction of a reduced model and helps developing physical interpretation of the results.", "answer_url": "https://scicomp.stackexchange.com/a/45385", "author": "Maxim Umansky", "author_url": "https://scicomp.stackexchange.com/users/4325/maxim-umansky", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-02-24T16:58:31+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45380, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Maxim Umansky", "profile_url": "https://scicomp.stackexchange.com/users/4325/maxim-umansky", "user_type": "registered"}, "created_at": "2026-02-24T16:58:31+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "183FE1E3-6551-4C57-9000-6B526DCDD5D8", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/183FE1E3-6551-4C57-9000-6B526DCDD5D8/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Maxim Umansky", "profile_url": "https://scicomp.stackexchange.com/users/4325/maxim-umansky", "user_type": "registered"}, "created_at": "2026-02-24T17:46:20+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "56653285-1694-44A3-BD64-039A48340820", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/56653285-1694-44A3-BD64-039A48340820/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Maxim Umansky", "profile_url": "https://scicomp.stackexchange.com/users/4325/maxim-umansky", "user_type": "registered"}, "created_at": "2026-02-25T00:14:34+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "C1164440-2522-4CA3-B997-25A50BEA32CB", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/C1164440-2522-4CA3-B997-25A50BEA32CB/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Maxim Umansky", "profile_url": "https://scicomp.stackexchange.com/users/4325/maxim-umansky", "user_type": "registered"}, "created_at": "2026-02-25T02:53:55+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "054FA401-B403-40F0-AD3E-42690191E4BE", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/054FA401-B403-40F0-AD3E-42690191E4BE/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Maxim Umansky", "profile_url": "https://scicomp.stackexchange.com/users/4325/maxim-umansky", "user_type": "registered"}, "created_at": "2026-02-27T21:25:52+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "8127BA24-67D1-4103-BFCC-667389465461", "revision_number": 5, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/8127BA24-67D1-4103-BFCC-667389465461/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Maxim Umansky", "profile_url": "https://scicomp.stackexchange.com/users/4325/maxim-umansky", "user_type": "registered"}, "created_at": "2026-02-27T21:55:52+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "8DF44554-2DD2-44F5-B706-213CDD100212", "revision_number": 6, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/8DF44554-2DD2-44F5-B706-213CDD100212/view-source"}], "score": 3, "updated_at": "2026-02-27T21:55:52+00:00"}], "domain": "computational_science", "external_links": ["https://arc.aiaa.org/doi/10.2514/6.1999-3291", "https://arc.aiaa.org/doi/10.2514/6.2005-1152", "https://www.cambridge.org/core/books/internal-flow/14285A6FF068386CF4A1EBBA835319DE"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:44.584971+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/272744bcc95b58699f7df6e6979b288bb8b00a80ab9c7982dbe170a6d0b63584_1790825325025901700_0.json", "raw_sha256": "27a81850a40920682c29ada76a2b55e80340a5c82764a3e9dde8a9c2ba23db4e", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Jacob Ivanov", "question_author_url": "https://scicomp.stackexchange.com/users/45035/jacob-ivanov", "question_author_user_type": "registered", "question_created_at": "2026-02-22T19:32:17+00:00", "question_html": "

I've been working as an aerospace engineer for a couple years now, and my job comprises mainly of building/running/analyzing CFD simulations and using their results to inform design decisions. I find myself running a lot of DOEs and trade studies, and it's very interesting work.

\n

Initially, my group gave me simpler problems as I was learning the software, and so I gradually learned how to build and run more complex models. Now, I have become somewhat proficient, even for very challenging models. I've trained an intern and now they are also up and running. I have started to get more recognition and have contributed to our team's best practices, found and solved bugs, etc.

\n

And so while the previous 'bottleneck of understanding' was simply building/running/converging a model, I've found the new challenge for me is understanding and analyzing my results. For context, I typically run multiphase, rotating, internal CFD with cell counts typically in the 5-30 M range, and I've had some trouble with 'seeing' what is going on in the flowfields. There are usually a ton of three-dimensional effects as well. I've found it difficult to root-cause analyze why, for example, Geometry A performs better than Geometry B, and then communicate that to others.

\n

What can I do to better understand CFD simulation results, especially with extremely complex geometries? Recently, I've made animations moving through the domain in one dimension, and it helps somewhat. What tips/tricks have worked for you?

\n", "question_id": 45380, "question_license": "CC BY-SA 4.0", "question_score": 5, "question_text": "I've been working as an aerospace engineer for a couple years now, and my job comprises mainly of building/running/analyzing CFD simulations and using their results to inform design decisions. I find myself running a lot of DOEs and trade studies, and it's very interesting work.\n\n\n\n\nInitially, my group gave me simpler problems as I was learning the software, and so I gradually learned how to build and run more complex models. Now, I have become somewhat proficient, even for very challenging models. I've trained an intern and now they are also up and running. I have started to get more recognition and have contributed to our team's best practices, found and solved bugs, etc.\n\n\n\n\nAnd so while the previous 'bottleneck of understanding' was simply building/running/converging a model, I've found the new challenge for me is understanding and analyzing my results. For context, I typically run multiphase, rotating, internal CFD with cell counts typically in the 5-30 M range, and I've had some trouble with 'seeing' what is going on in the flowfields. There are usually a ton of three-dimensional effects as well. I've found it difficult to root-cause analyze why, for example, Geometry A performs better than Geometry B, and then communicate that to others.\n\n\n\n\nWhat can I do to better understand CFD simulation results, especially with extremely complex geometries? Recently, I've made animations moving through the domain in one dimension, and it helps somewhat. What tips/tricks have worked for you?", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Jacob Ivanov", "profile_url": "https://scicomp.stackexchange.com/users/45035/jacob-ivanov", "user_type": "registered"}, "created_at": "2026-02-22T19:32:17+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "2CCBC65A-9F7C-49D0-AAB4-DE02DEDB150B", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/2CCBC65A-9F7C-49D0-AAB4-DE02DEDB150B/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-02-23T12:27:42+00:00", "raw_file": "raw/codex_api_v1/d49b4ef7856602e9d6b1a79d56b143976504b0637af4b266f03f2b60112c6c15_1790825353984908500_0.json", "raw_sha256": "4ebc32b188652be208cbfb32007d2c8fcbe5419e5ab336ca46a3e9eb5ef04d0e", "revision_guid": "11C3E9F9-EF45-4103-A8F7-B22EE90C009B", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://scicomp.stackexchange.com/revisions/11C3E9F9-EF45-4103-A8F7-B22EE90C009B/view-source"}], "source_site": "scicomp", "source_url": "https://scicomp.stackexchange.com/questions/45380/how-to-see-complex-simulation-results-more-clearly", "split": "train", "split_group": "71e142fd2b9c56d95722bfe35fb4f30cf6aed7405a182f097539479b50079f9b", "tags": ["fluid-dynamics", "computational-physics", "visualization"], "thread_id": "scicomp:45380", "title": "How to 'See' Complex Simulation Results More Clearly"}} {"accepted_status": [false, false], "candidate_answers": [{"answer_html": "

I think the paper by Gassner et al. discusses weak stability using a semi-norm rather than a norm. This means that the discretized problem does not need to be positive definite, which could perhaps be considered somewhat misleading. Note that weak stability of BR1 was also discussed by Arnold et al. for the Poisson equation in Section 5.3 or more precise 5.3.2.

\n", "answer_id": 45417, "answer_text": "I think the paper by Gassner et al. discusses weak stability using a semi-norm rather than a norm. This means that the discretized problem does not need to be positive definite, which could perhaps be considered somewhat misleading. Note that weak stability of BR1 was also discussed by Arnold et al. for the Poisson equation in Section 5.3 or more precise 5.3.2.", "answer_url": "https://scicomp.stackexchange.com/a/45417", "author": "ConvexHull", "author_url": "https://scicomp.stackexchange.com/users/36512/convexhull", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-03-23T22:28:27+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45416, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "ConvexHull", "profile_url": "https://scicomp.stackexchange.com/users/36512/convexhull", "user_type": "registered"}, "created_at": "2026-03-23T22:28:27+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "89AC3C84-024C-4435-8AD8-33864610826B", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/89AC3C84-024C-4435-8AD8-33864610826B/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "ConvexHull", "profile_url": "https://scicomp.stackexchange.com/users/36512/convexhull", "user_type": "registered"}, "created_at": "2026-03-29T07:38:49+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "C32D1B26-DD52-413A-B77C-E5993EA85B44", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/C32D1B26-DD52-413A-B77C-E5993EA85B44/view-source"}], "score": 2, "updated_at": "2026-03-29T07:38:49+00:00"}, {"answer_html": "

If you apply BR1 to stationary heat equation, $-\\Delta u = f$, you cannot show existence of the discrete solution.

\n

BR1 is the DG method applied to first order formulation

\n

$$\np = \\nabla u, \\qquad -\\nabla \\cdot p = f\n$$

\n

where, you use averages for both fluxes

\n

$$\n\\hat p = \\frac{1}{2}(p^- + p^+), \\qquad \\hat u = \\frac{1}{2}(u^- + u^+)\n$$

\n

If you apply BR1 to non-stationary heat equation, there is no problem of existence of discrete solution, because of the presence of mass matrix that arises from the time derivative term.

\n

This is the same reason why it is said to be stable for non-stationary compressible NS equations.

\n", "answer_id": 45420, "answer_text": "If you apply BR1 to stationary heat equation, $-\\Delta u = f$, you cannot show existence of the discrete solution.\n\n\n\n\nBR1 is the DG method applied to first order formulation\n\n\n\n\n$$\np = \\nabla u, \\qquad -\\nabla \\cdot p = f\n$$\n\n\n\n\nwhere, you use averages for both fluxes\n\n\n\n\n$$\n\\hat p = \\frac{1}{2}(p^- + p^+), \\qquad \\hat u = \\frac{1}{2}(u^- + u^+)\n$$\n\n\n\n\nIf you apply BR1 to non-stationary heat equation, there is no problem of existence of discrete solution, because of the presence of mass matrix that arises from the time derivative term.\n\n\n\n\nThis is the same reason why it is said to be stable for non-stationary compressible NS equations.", "answer_url": "https://scicomp.stackexchange.com/a/45420", "author": "cfdlab", "author_url": "https://scicomp.stackexchange.com/users/3970/cfdlab", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-03-29T11:41:11+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45416, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "cfdlab", "profile_url": "https://scicomp.stackexchange.com/users/3970/cfdlab", "user_type": "registered"}, "created_at": "2026-03-29T11:41:11+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "A290F8F2-0BA9-4D0D-9F5A-33DBF80C35E2", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/A290F8F2-0BA9-4D0D-9F5A-33DBF80C35E2/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "cfdlab", "profile_url": "https://scicomp.stackexchange.com/users/3970/cfdlab", "user_type": "registered"}, "created_at": "2026-03-30T10:04:20+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "08A1E50D-42CF-4E4A-B851-5533B1F6682E", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/08A1E50D-42CF-4E4A-B851-5533B1F6682E/view-source"}], "score": 3, "updated_at": "2026-03-30T10:04:20+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "It is well known that the BR1 scheme is not stable for pure diffusion problems in the standard discontinuous Galerkin setting. The standard explanation is that BR1 lacks a penalty term, so the bilinear form fails to be coercive.\n\n\n\n\nHowever, BR1 is reported to be stable when used within DGSEM (the DG Spectral Element Method with Gauss–Lobatto–Legendre nodes (GLL)), as shown for example in the work of Gassner (The BR1 Scheme is Stable for the Compressible Navier–Stokes Equations). And I do see the BR1 scheme being used in the DGSEM community with no issues.\n\n\n\n\nHow is that the case specially since GLL collocation nodes will integrate the diffusion term exactly in DGSEM so there are no variational crimes so the coercivity argument is still going to hold?", "record_id": "Scientific-Answer-Ranking:scicomp:45416", "scores": [2, 3], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

I think the paper by Gassner et al. discusses weak stability using a semi-norm rather than a norm. This means that the discretized problem does not need to be positive definite, which could perhaps be considered somewhat misleading. Note that weak stability of BR1 was also discussed by Arnold et al. for the Poisson equation in Section 5.3 or more precise 5.3.2.

\n", "answer_id": 45417, "answer_text": "I think the paper by Gassner et al. discusses weak stability using a semi-norm rather than a norm. This means that the discretized problem does not need to be positive definite, which could perhaps be considered somewhat misleading. Note that weak stability of BR1 was also discussed by Arnold et al. for the Poisson equation in Section 5.3 or more precise 5.3.2.", "answer_url": "https://scicomp.stackexchange.com/a/45417", "author": "ConvexHull", "author_url": "https://scicomp.stackexchange.com/users/36512/convexhull", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-03-23T22:28:27+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45416, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "ConvexHull", "profile_url": "https://scicomp.stackexchange.com/users/36512/convexhull", "user_type": "registered"}, "created_at": "2026-03-23T22:28:27+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "89AC3C84-024C-4435-8AD8-33864610826B", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/89AC3C84-024C-4435-8AD8-33864610826B/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "ConvexHull", "profile_url": "https://scicomp.stackexchange.com/users/36512/convexhull", "user_type": "registered"}, "created_at": "2026-03-29T07:38:49+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "C32D1B26-DD52-413A-B77C-E5993EA85B44", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/C32D1B26-DD52-413A-B77C-E5993EA85B44/view-source"}], "score": 2, "updated_at": "2026-03-29T07:38:49+00:00"}, {"answer_html": "

If you apply BR1 to stationary heat equation, $-\\Delta u = f$, you cannot show existence of the discrete solution.

\n

BR1 is the DG method applied to first order formulation

\n

$$\np = \\nabla u, \\qquad -\\nabla \\cdot p = f\n$$

\n

where, you use averages for both fluxes

\n

$$\n\\hat p = \\frac{1}{2}(p^- + p^+), \\qquad \\hat u = \\frac{1}{2}(u^- + u^+)\n$$

\n

If you apply BR1 to non-stationary heat equation, there is no problem of existence of discrete solution, because of the presence of mass matrix that arises from the time derivative term.

\n

This is the same reason why it is said to be stable for non-stationary compressible NS equations.

\n", "answer_id": 45420, "answer_text": "If you apply BR1 to stationary heat equation, $-\\Delta u = f$, you cannot show existence of the discrete solution.\n\n\n\n\nBR1 is the DG method applied to first order formulation\n\n\n\n\n$$\np = \\nabla u, \\qquad -\\nabla \\cdot p = f\n$$\n\n\n\n\nwhere, you use averages for both fluxes\n\n\n\n\n$$\n\\hat p = \\frac{1}{2}(p^- + p^+), \\qquad \\hat u = \\frac{1}{2}(u^- + u^+)\n$$\n\n\n\n\nIf you apply BR1 to non-stationary heat equation, there is no problem of existence of discrete solution, because of the presence of mass matrix that arises from the time derivative term.\n\n\n\n\nThis is the same reason why it is said to be stable for non-stationary compressible NS equations.", "answer_url": "https://scicomp.stackexchange.com/a/45420", "author": "cfdlab", "author_url": "https://scicomp.stackexchange.com/users/3970/cfdlab", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-03-29T11:41:11+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:47.033952+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/cb6e5f564c84a92c4e121c0637c99292018f8935652e423630f2001099a2410f_1790825327386675300_0.json", "raw_sha256": "1a957289f56621bebd21cb45dd99baaedb2c3bc11cb28d700558e4bbcaa19695", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45416, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "cfdlab", "profile_url": "https://scicomp.stackexchange.com/users/3970/cfdlab", "user_type": "registered"}, "created_at": "2026-03-29T11:41:11+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "A290F8F2-0BA9-4D0D-9F5A-33DBF80C35E2", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/A290F8F2-0BA9-4D0D-9F5A-33DBF80C35E2/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "cfdlab", "profile_url": "https://scicomp.stackexchange.com/users/3970/cfdlab", "user_type": "registered"}, "created_at": "2026-03-30T10:04:20+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "08A1E50D-42CF-4E4A-B851-5533B1F6682E", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/08A1E50D-42CF-4E4A-B851-5533B1F6682E/view-source"}], "score": 3, "updated_at": "2026-03-30T10:04:20+00:00"}], "domain": "computational_science", "external_links": [], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:44.584971+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/272744bcc95b58699f7df6e6979b288bb8b00a80ab9c7982dbe170a6d0b63584_1790825325025901700_0.json", "raw_sha256": "27a81850a40920682c29ada76a2b55e80340a5c82764a3e9dde8a9c2ba23db4e", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "CuteCompute", "question_author_url": "https://scicomp.stackexchange.com/users/38580/cutecompute", "question_author_user_type": "registered", "question_created_at": "2026-03-23T08:33:46+00:00", "question_html": "

It is well known that the BR1 scheme is not stable for pure diffusion problems in the standard discontinuous Galerkin setting. The standard explanation is that BR1 lacks a penalty term, so the bilinear form fails to be coercive.

\n

However, BR1 is reported to be stable when used within DGSEM (the DG Spectral Element Method with Gauss–Lobatto–Legendre nodes (GLL)), as shown for example in the work of Gassner (The BR1 Scheme is Stable for the Compressible Navier–Stokes Equations). And I do see the BR1 scheme being used in the DGSEM community with no issues.

\n

How is that the case specially since GLL collocation nodes will integrate the diffusion term exactly in DGSEM so there are no variational crimes so the coercivity argument is still going to hold?

\n", "question_id": 45416, "question_license": "CC BY-SA 4.0", "question_score": 2, "question_text": "It is well known that the BR1 scheme is not stable for pure diffusion problems in the standard discontinuous Galerkin setting. The standard explanation is that BR1 lacks a penalty term, so the bilinear form fails to be coercive.\n\n\n\n\nHowever, BR1 is reported to be stable when used within DGSEM (the DG Spectral Element Method with Gauss–Lobatto–Legendre nodes (GLL)), as shown for example in the work of Gassner (The BR1 Scheme is Stable for the Compressible Navier–Stokes Equations). And I do see the BR1 scheme being used in the DGSEM community with no issues.\n\n\n\n\nHow is that the case specially since GLL collocation nodes will integrate the diffusion term exactly in DGSEM so there are no variational crimes so the coercivity argument is still going to hold?", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "CuteCompute", "profile_url": "https://scicomp.stackexchange.com/users/38580/cutecompute", "user_type": "registered"}, "created_at": "2026-03-23T08:33:46+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "843E668B-BAF4-4DE8-BBA8-266AFB0A4386", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/843E668B-BAF4-4DE8-BBA8-266AFB0A4386/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-03-24T07:54:16+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "13C1E239-92B8-4C0F-BC07-4FF8D45BD73F", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://scicomp.stackexchange.com/revisions/13C1E239-92B8-4C0F-BC07-4FF8D45BD73F/view-source"}], "source_site": "scicomp", "source_url": "https://scicomp.stackexchange.com/questions/45416/why-is-br1-stable-for-pure-diffusion-in-dgsem-but-not-in-standard-dg-if-coerciv", "split": "train", "split_group": "dccbca5cec5b5eb97058aa8bfcdb4872922f78ed3e7d144e5206921712dc4968", "tags": ["finite-element", "stability", "discontinuous-galerkin", "diffusion"], "thread_id": "scicomp:45416", "title": "Why is BR1 stable for pure diffusion in DGSEM but not in standard DG, if coercivity is not recovered?"}} {"accepted_status": [false, false], "candidate_answers": [{"answer_html": "

This doesn't directly address your specific question but I can't fit my\ncomments in an actual "Comment".

\n

I google "origami tube" and I get pictures of foldable paper tubes.\nI have no idea how you would do a simple stability analysis of such a\nstructure and you have provided no information on this.

\n

I suspect your formulation for the mechanics of one of these tubes is more\nimportant than the approach you are using to trace the load-deflection curve, i.e. Riks.

\n

Finally, the first thing you should do before doing a non-linear load-deflection analysis\nis to do a linear buckling analysis. This will give you information about singular points\non the primary equilibrium path where you will encounter numerical problems in the non-linear\nanalysis.

\n", "answer_id": 45445, "answer_text": "This doesn't directly address your specific question but I can't fit my\ncomments in an actual \"Comment\".\n\n\n\n\nI google \"origami tube\" and I get pictures of foldable paper tubes.\nI have no idea how you would do a simple stability analysis of such a\nstructure and you have provided no information on this.\n\n\n\n\nI suspect your formulation for the mechanics of one of these tubes is more\nimportant than the approach you are using to trace the load-deflection curve, i.e. Riks.\n\n\n\n\nFinally, the first thing you should do before doing a non-linear load-deflection analysis\nis to do a linear buckling analysis. This will give you information about singular points\non the primary equilibrium path where you will encounter numerical problems in the non-linear\nanalysis.", "answer_url": "https://scicomp.stackexchange.com/a/45445", "author": "Bill Greene", "author_url": "https://scicomp.stackexchange.com/users/3441/bill-greene", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-05-07T13:42:56+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45444, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Bill Greene", "profile_url": "https://scicomp.stackexchange.com/users/3441/bill-greene", "user_type": "registered"}, "created_at": "2026-05-07T13:42:56+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "30A7624C-60B7-4022-ADD8-CD2957D864C5", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/30A7624C-60B7-4022-ADD8-CD2957D864C5/view-source"}], "score": 4, "updated_at": "2026-05-07T13:42:56+00:00"}, {"answer_html": "

This comment also does not give a direct answer to your question.

\n

From my point of view, your last plot, Compressive Load vs Axial Loading, shows that you actually have a stability/bifurcation problem. I.e., at the point where the red curve deviates from the blue curve your mechanical system has two (or even more) equilibrium paths. The arclen method "selects", in your case depending on the step size, one of them.\nThere are criteria/methods to identify if you are on a stable or unstable equilibrium path and "pin-point" instability points. As I'm by no means a specialist in this field, I refer to P. Wriggers. Nonlinear finite element methods, Springer, 2008.

\n

Chapter 7. p.259 "Within the incremental-iterative computation using the arc-length method, see Sect. 5.1.5, the instable points are not determined accurately since only the nonlinear solution path is of concern." and p.260 "Within the bi-section method, the algorithm runs backward on the loading path with half arc-length once a singular point is bypassed ..."\nYour problem description reminded me of these two sentences.

\n", "answer_id": 45446, "answer_text": "This comment also does not give a direct answer to your question.\n\n\n\n\nFrom my point of view, your last plot, Compressive Load vs Axial Loading, shows that you actually have a stability/bifurcation problem. I.e., at the point where the red curve deviates from the blue curve your mechanical system has two (or even more) equilibrium paths. The arclen method \"selects\", in your case depending on the step size, one of them.\nThere are criteria/methods to identify if you are on a stable or unstable equilibrium path and \"pin-point\" instability points. As I'm by no means a specialist in this field, I refer to P. Wriggers. Nonlinear finite element methods, Springer, 2008.\n\n\n\n\nChapter 7. p.259 \"Within the incremental-iterative computation using the arc-length method, see Sect. 5.1.5, the instable points are not determined accurately since only the nonlinear solution path is of concern.\" and p.260 \"Within the bi-section method, the algorithm runs backward on the loading path with half arc-length once a singular point is bypassed ...\"\nYour problem description reminded me of these two sentences.", "answer_url": "https://scicomp.stackexchange.com/a/45446", "author": "rcontinuum", "author_url": "https://scicomp.stackexchange.com/users/56820/rcontinuum", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-05-08T07:43:41+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45444, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "rcontinuum", "profile_url": "https://scicomp.stackexchange.com/users/56820/rcontinuum", "user_type": "registered"}, "created_at": "2026-05-08T07:43:41+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "1B186728-6C33-4742-841C-4AE433F0F4E2", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/1B186728-6C33-4742-841C-4AE433F0F4E2/view-source"}], "score": 3, "updated_at": "2026-05-08T07:43:41+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I am working on the stochastic buckling analysis of origami tubes using the bar-and-hinge model. In this framework, the in-plane stiffness of the tube is modeled with truss elements, and the out-of-plane stiffness is modeled with rotational springs. Interested readers may refer to the ``Nonlinear mechanics of non-rigid origami: an efficient computational approach'' by Liu and Paulino [Link] (https://royalsocietypublishing.org/rspa/article/473/2206/20170348/57498) for more details about bar-and-hinge model. Specifically, I am using the formulation for the internal force vectors of truss and rotational spring elements from this paper. For the evaluation of the tangent stiffness matrix, I am using the method of complex variable differentiation Link (https://scispace.com/pdf/numerically-generated-tangent-stiffness-matrices-for-3l0wzfcdq3.pdf).\n\n\n\n\nLinear Buckling Analysis. The global tangent stiffness matrix $K_T$ is generally composed of linear elastic stiffness matrix, $K_E$, and the geometric stiffness matrix, $K_G$. The fundamental relationship is\n\n\n\n\n$$ K_T = K_E + K_G $$\n\n\n\n\nSince we have computational routine for $K_T$, we can extract the linear buckling load by setting up a generalized eigenvalue problem using the following steps.\n\n\n\n\n\nIsolate the elastic stiffness matrix. We evaluate the expression for the tangent stiffness matrix, $K_T$, at zero external load. Because the geometric stiffness depends on the internal stresses, it vanishes when the load is zero. This directly yields the elastic stiffness matrix:\n\n\n\n\n\n$$ K_E = K_T \\left( P = 0 \\right) $$\n\n\n\n\n\nSolve the prebuckling problem. Apply a small compressive load, $P_{ref}$. Assuming linear elastic material behavior, we solve for the corresponding reference displacement field, $u_{ref}$, using the elastic stiffness matrix.\n\n\n\n\n\n$$ u_{ref} = K_E^{-1} P_{ref} $$\n\n\n\n\n\nIsolate the geometric stiffness matrix. Using the displacement field obtained in the previous step, we evaluate the tangent stiffness matrix at this new reference state, and subtract the elastic stiffness matrix from it to isolate the geometric stiffness matrix.\n\n\n\n\n\n$$ K_G = K_T \\left( u_{ref} \\right) - K_E $$\n\n\n\n\nSince the geometric stiffness matrix scales linearly with the applied load in the prebuckling regime, I verified that the reference load was sufficiently small by confirming that doubling the applied load approximately doubled every entry of the geometric stiffness matrix.\n\n\n\n\n\nFormulate the eigenvalue problem. Buckling occurs when the tangent stiffness matrix becomes singular. This leads to the generalized eigenvalue problem\n\n\n\n\n\n$$ \\left( K_E + \\lambda K_G \\right) \\phi = 0 $$\n\n\n\n\nSolving the above eigenvalue problem yields a set of eigenvalues, $\\lambda_i$, and corresponding eigenvectors, $\\phi_i$. The critical buckling load is found by multiplying our reference load, $P_{ref}$, by the smallest absolute eigenvalue.\n\n\n\n\nResults of the linear buckling analysis To investigate the imperfection sensitivity of the origami tubes, linear and nonlinear buckling analyses were performed for a range of prescribed imperfection amplitudes. The resulting linear and nonlinear buckling loads are summarized in the figure below.\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/M6N7CoFp.png] (https://i.sstatic.net/M6N7CoFp.png)\nNote: For the nonlinear buckling analysis, the results correspond to the smallest arc-length increment considered.\n\n\n\n\nNonlinear Buckling Analysis. For nonlinear analysis, we developed a nonlinear finite element solver using the Riks method. To verify the implementation, we compared the load–displacement curve of a tetrahedral shell obtained from our solver with the corresponding analytical solution. The two results are in excellent agreement.\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/CUaFptyr.png] (https://i.sstatic.net/CUaFptyr.png)\n\n\n\n\nBecause of the excellent agreement with the analytical results, we are fairly confident that our implementation of the nonlinear FEA and Riks method is correct.\n\n\n\n\nIn the next phase, radial imperfections are introduced into the origami tubes. It is observed that the results depend on the choice of arc-length parameters. For relatively large imperfections (1%–20% of the tube radius), the results are shown in the figure below. For imperfections larger than approximately 3% of the radius, all four choices of initial and maximum arc-length increments produce consistent results. However, for imperfections smaller than 3%, discrepancies begin to appear.\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/pkW8aFfg.png] (https://i.sstatic.net/pkW8aFfg.png)\n\n\n\n\nFor example, the load–displacement curves for a 2% imperfection are shown below. Since the objective is to extract accurate buckling loads, these results suggest that an inappropriate choice of arc-length parameters can significantly affect both the equilibrium path and the predicted peak load.\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/Jpa1ZhK2.png] (https://i.sstatic.net/Jpa1ZhK2.png)\n\n\n\n\nQuestion. How can one systematically determine an appropriate set of arc-length increments to ensure accurate identification of the buckling load? Simply reducing the initial and maximum arc-length increments progressively is not computationally feasible for the models considered here. Is there a more systematic strategy for selecting these parameters or for assessing convergence of the predicted buckling load?\n\n\n\n\nIn addition, I would be interested to know whether others have encountered similar sensitivity issues when using the arc-length (Riks) method.\n\n\n\n\nEdit 1: The load-displacement curve for the 5% imperfection case obtained by using two different values for the initial/maximum arclength step is shown in the following figure. Unlike the 2% imperfection case, here the response of the structure seems to be independent of the arclength parameters.\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/it7J9X7j.png] (https://i.sstatic.net/it7J9X7j.png)\n\n\n\n\nEdit 2: The load-displacement curve for the 3% imperfection case obtained by using two different values for the initial/maximum arclength step is shown in the following figure. Like the 5% imperfection case, here the response of the structure seems to be independent of the arclength parameters.\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/e8ftx1cv.jpg] (https://i.sstatic.net/e8ftx1cv.jpg)", "record_id": "Scientific-Answer-Ranking:scicomp:45444", "scores": [4, 3], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

This doesn't directly address your specific question but I can't fit my\ncomments in an actual "Comment".

\n

I google "origami tube" and I get pictures of foldable paper tubes.\nI have no idea how you would do a simple stability analysis of such a\nstructure and you have provided no information on this.

\n

I suspect your formulation for the mechanics of one of these tubes is more\nimportant than the approach you are using to trace the load-deflection curve, i.e. Riks.

\n

Finally, the first thing you should do before doing a non-linear load-deflection analysis\nis to do a linear buckling analysis. This will give you information about singular points\non the primary equilibrium path where you will encounter numerical problems in the non-linear\nanalysis.

\n", "answer_id": 45445, "answer_text": "This doesn't directly address your specific question but I can't fit my\ncomments in an actual \"Comment\".\n\n\n\n\nI google \"origami tube\" and I get pictures of foldable paper tubes.\nI have no idea how you would do a simple stability analysis of such a\nstructure and you have provided no information on this.\n\n\n\n\nI suspect your formulation for the mechanics of one of these tubes is more\nimportant than the approach you are using to trace the load-deflection curve, i.e. Riks.\n\n\n\n\nFinally, the first thing you should do before doing a non-linear load-deflection analysis\nis to do a linear buckling analysis. This will give you information about singular points\non the primary equilibrium path where you will encounter numerical problems in the non-linear\nanalysis.", "answer_url": "https://scicomp.stackexchange.com/a/45445", "author": "Bill Greene", "author_url": "https://scicomp.stackexchange.com/users/3441/bill-greene", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-05-07T13:42:56+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45444, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Bill Greene", "profile_url": "https://scicomp.stackexchange.com/users/3441/bill-greene", "user_type": "registered"}, "created_at": "2026-05-07T13:42:56+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "30A7624C-60B7-4022-ADD8-CD2957D864C5", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/30A7624C-60B7-4022-ADD8-CD2957D864C5/view-source"}], "score": 4, "updated_at": "2026-05-07T13:42:56+00:00"}, {"answer_html": "

This comment also does not give a direct answer to your question.

\n

From my point of view, your last plot, Compressive Load vs Axial Loading, shows that you actually have a stability/bifurcation problem. I.e., at the point where the red curve deviates from the blue curve your mechanical system has two (or even more) equilibrium paths. The arclen method "selects", in your case depending on the step size, one of them.\nThere are criteria/methods to identify if you are on a stable or unstable equilibrium path and "pin-point" instability points. As I'm by no means a specialist in this field, I refer to P. Wriggers. Nonlinear finite element methods, Springer, 2008.

\n

Chapter 7. p.259 "Within the incremental-iterative computation using the arc-length method, see Sect. 5.1.5, the instable points are not determined accurately since only the nonlinear solution path is of concern." and p.260 "Within the bi-section method, the algorithm runs backward on the loading path with half arc-length once a singular point is bypassed ..."\nYour problem description reminded me of these two sentences.

\n", "answer_id": 45446, "answer_text": "This comment also does not give a direct answer to your question.\n\n\n\n\nFrom my point of view, your last plot, Compressive Load vs Axial Loading, shows that you actually have a stability/bifurcation problem. I.e., at the point where the red curve deviates from the blue curve your mechanical system has two (or even more) equilibrium paths. The arclen method \"selects\", in your case depending on the step size, one of them.\nThere are criteria/methods to identify if you are on a stable or unstable equilibrium path and \"pin-point\" instability points. As I'm by no means a specialist in this field, I refer to P. Wriggers. Nonlinear finite element methods, Springer, 2008.\n\n\n\n\nChapter 7. p.259 \"Within the incremental-iterative computation using the arc-length method, see Sect. 5.1.5, the instable points are not determined accurately since only the nonlinear solution path is of concern.\" and p.260 \"Within the bi-section method, the algorithm runs backward on the loading path with half arc-length once a singular point is bypassed ...\"\nYour problem description reminded me of these two sentences.", "answer_url": "https://scicomp.stackexchange.com/a/45446", "author": "rcontinuum", "author_url": "https://scicomp.stackexchange.com/users/56820/rcontinuum", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-05-08T07:43:41+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45444, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "rcontinuum", "profile_url": "https://scicomp.stackexchange.com/users/56820/rcontinuum", "user_type": "registered"}, "created_at": "2026-05-08T07:43:41+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "1B186728-6C33-4742-841C-4AE433F0F4E2", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/1B186728-6C33-4742-841C-4AE433F0F4E2/view-source"}], "score": 3, "updated_at": "2026-05-08T07:43:41+00:00"}], "domain": "computational_science", "external_links": ["https://i.sstatic.net/CUaFptyr.png", "https://i.sstatic.net/Jpa1ZhK2.png", "https://i.sstatic.net/M6N7CoFp.png", "https://i.sstatic.net/e8ftx1cv.jpg", "https://i.sstatic.net/it7J9X7j.png", "https://i.sstatic.net/pkW8aFfg.png", "https://royalsocietypublishing.org/rspa/article/473/2206/20170348/57498", "https://scispace.com/pdf/numerically-generated-tangent-stiffness-matrices-for-3l0wzfcdq3.pdf"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:44.584971+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/272744bcc95b58699f7df6e6979b288bb8b00a80ab9c7982dbe170a6d0b63584_1790825325025901700_0.json", "raw_sha256": "27a81850a40920682c29ada76a2b55e80340a5c82764a3e9dde8a9c2ba23db4e", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "frustrated_engineer", "question_author_url": "https://scicomp.stackexchange.com/users/48798/frustrated-engineer", "question_author_user_type": "registered", "question_created_at": "2026-05-07T04:35:14+00:00", "question_html": "

I am working on the stochastic buckling analysis of origami tubes using the bar-and-hinge model. In this framework, the in-plane stiffness of the tube is modeled with truss elements, and the out-of-plane stiffness is modeled with rotational springs. Interested readers may refer to the ``Nonlinear mechanics of non-rigid origami: an efficient computational approach'' by Liu and Paulino [Link] for more details about bar-and-hinge model. Specifically, I am using the formulation for the internal force vectors of truss and rotational spring elements from this paper. For the evaluation of the tangent stiffness matrix, I am using the method of complex variable differentiation Link.

\n

Linear Buckling Analysis. The global tangent stiffness matrix $K_T$ is generally composed of linear elastic stiffness matrix, $K_E$, and the geometric stiffness matrix, $K_G$. The fundamental relationship is

\n

$$ K_T = K_E + K_G $$

\n

Since we have computational routine for $K_T$, we can extract the linear buckling load by setting up a generalized eigenvalue problem using the following steps.

\n
    \n
  1. Isolate the elastic stiffness matrix. We evaluate the expression for the tangent stiffness matrix, $K_T$, at zero external load. Because the geometric stiffness depends on the internal stresses, it vanishes when the load is zero. This directly yields the elastic stiffness matrix:
  2. \n
\n

$$ K_E = K_T \\left( P = 0 \\right) $$

\n
    \n
  1. Solve the prebuckling problem. Apply a small compressive load, $P_{ref}$. Assuming linear elastic material behavior, we solve for the corresponding reference displacement field, $u_{ref}$, using the elastic stiffness matrix.
  2. \n
\n

$$ u_{ref} = K_E^{-1} P_{ref} $$

\n
    \n
  1. Isolate the geometric stiffness matrix. Using the displacement field obtained in the previous step, we evaluate the tangent stiffness matrix at this new reference state, and subtract the elastic stiffness matrix from it to isolate the geometric stiffness matrix.
  2. \n
\n

$$ K_G = K_T \\left( u_{ref} \\right) - K_E $$

\n

Since the geometric stiffness matrix scales linearly with the applied load in the prebuckling regime, I verified that the reference load was sufficiently small by confirming that doubling the applied load approximately doubled every entry of the geometric stiffness matrix.

\n
    \n
  1. Formulate the eigenvalue problem. Buckling occurs when the tangent stiffness matrix becomes singular. This leads to the generalized eigenvalue problem
  2. \n
\n

$$ \\left( K_E + \\lambda K_G \\right) \\phi = 0 $$

\n

Solving the above eigenvalue problem yields a set of eigenvalues, $\\lambda_i$, and corresponding eigenvectors, $\\phi_i$. The critical buckling load is found by multiplying our reference load, $P_{ref}$, by the smallest absolute eigenvalue.

\n

Results of the linear buckling analysis To investigate the imperfection sensitivity of the origami tubes, linear and nonlinear buckling analyses were performed for a range of prescribed imperfection amplitudes. The resulting linear and nonlinear buckling loads are summarized in the figure below.

\n

\"enter\nNote: For the nonlinear buckling analysis, the results correspond to the smallest arc-length increment considered.

\n

Nonlinear Buckling Analysis. For nonlinear analysis, we developed a nonlinear finite element solver using the Riks method. To verify the implementation, we compared the load–displacement curve of a tetrahedral shell obtained from our solver with the corresponding analytical solution. The two results are in excellent agreement.

\n

\"enter

\n

Because of the excellent agreement with the analytical results, we are fairly confident that our implementation of the nonlinear FEA and Riks method is correct.

\n

In the next phase, radial imperfections are introduced into the origami tubes. It is observed that the results depend on the choice of arc-length parameters. For relatively large imperfections (1%–20% of the tube radius), the results are shown in the figure below. For imperfections larger than approximately 3% of the radius, all four choices of initial and maximum arc-length increments produce consistent results. However, for imperfections smaller than 3%, discrepancies begin to appear.

\n

\"enter

\n

For example, the load–displacement curves for a 2% imperfection are shown below. Since the objective is to extract accurate buckling loads, these results suggest that an inappropriate choice of arc-length parameters can significantly affect both the equilibrium path and the predicted peak load.

\n

\"enter

\n

Question. How can one systematically determine an appropriate set of arc-length increments to ensure accurate identification of the buckling load? Simply reducing the initial and maximum arc-length increments progressively is not computationally feasible for the models considered here. Is there a more systematic strategy for selecting these parameters or for assessing convergence of the predicted buckling load?

\n

In addition, I would be interested to know whether others have encountered similar sensitivity issues when using the arc-length (Riks) method.

\n

Edit 1: The load-displacement curve for the 5% imperfection case obtained by using two different values for the initial/maximum arclength step is shown in the following figure. Unlike the 2% imperfection case, here the response of the structure seems to be independent of the arclength parameters.

\n

\"enter

\n

Edit 2: The load-displacement curve for the 3% imperfection case obtained by using two different values for the initial/maximum arclength step is shown in the following figure. Like the 5% imperfection case, here the response of the structure seems to be independent of the arclength parameters.

\n

\"enter

\n", "question_id": 45444, "question_license": "CC BY-SA 4.0", "question_score": 2, "question_text": "I am working on the stochastic buckling analysis of origami tubes using the bar-and-hinge model. In this framework, the in-plane stiffness of the tube is modeled with truss elements, and the out-of-plane stiffness is modeled with rotational springs. Interested readers may refer to the ``Nonlinear mechanics of non-rigid origami: an efficient computational approach'' by Liu and Paulino [Link] (https://royalsocietypublishing.org/rspa/article/473/2206/20170348/57498) for more details about bar-and-hinge model. Specifically, I am using the formulation for the internal force vectors of truss and rotational spring elements from this paper. For the evaluation of the tangent stiffness matrix, I am using the method of complex variable differentiation Link (https://scispace.com/pdf/numerically-generated-tangent-stiffness-matrices-for-3l0wzfcdq3.pdf).\n\n\n\n\nLinear Buckling Analysis. The global tangent stiffness matrix $K_T$ is generally composed of linear elastic stiffness matrix, $K_E$, and the geometric stiffness matrix, $K_G$. The fundamental relationship is\n\n\n\n\n$$ K_T = K_E + K_G $$\n\n\n\n\nSince we have computational routine for $K_T$, we can extract the linear buckling load by setting up a generalized eigenvalue problem using the following steps.\n\n\n\n\n\nIsolate the elastic stiffness matrix. We evaluate the expression for the tangent stiffness matrix, $K_T$, at zero external load. Because the geometric stiffness depends on the internal stresses, it vanishes when the load is zero. This directly yields the elastic stiffness matrix:\n\n\n\n\n\n$$ K_E = K_T \\left( P = 0 \\right) $$\n\n\n\n\n\nSolve the prebuckling problem. Apply a small compressive load, $P_{ref}$. Assuming linear elastic material behavior, we solve for the corresponding reference displacement field, $u_{ref}$, using the elastic stiffness matrix.\n\n\n\n\n\n$$ u_{ref} = K_E^{-1} P_{ref} $$\n\n\n\n\n\nIsolate the geometric stiffness matrix. Using the displacement field obtained in the previous step, we evaluate the tangent stiffness matrix at this new reference state, and subtract the elastic stiffness matrix from it to isolate the geometric stiffness matrix.\n\n\n\n\n\n$$ K_G = K_T \\left( u_{ref} \\right) - K_E $$\n\n\n\n\nSince the geometric stiffness matrix scales linearly with the applied load in the prebuckling regime, I verified that the reference load was sufficiently small by confirming that doubling the applied load approximately doubled every entry of the geometric stiffness matrix.\n\n\n\n\n\nFormulate the eigenvalue problem. Buckling occurs when the tangent stiffness matrix becomes singular. This leads to the generalized eigenvalue problem\n\n\n\n\n\n$$ \\left( K_E + \\lambda K_G \\right) \\phi = 0 $$\n\n\n\n\nSolving the above eigenvalue problem yields a set of eigenvalues, $\\lambda_i$, and corresponding eigenvectors, $\\phi_i$. The critical buckling load is found by multiplying our reference load, $P_{ref}$, by the smallest absolute eigenvalue.\n\n\n\n\nResults of the linear buckling analysis To investigate the imperfection sensitivity of the origami tubes, linear and nonlinear buckling analyses were performed for a range of prescribed imperfection amplitudes. The resulting linear and nonlinear buckling loads are summarized in the figure below.\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/M6N7CoFp.png] (https://i.sstatic.net/M6N7CoFp.png)\nNote: For the nonlinear buckling analysis, the results correspond to the smallest arc-length increment considered.\n\n\n\n\nNonlinear Buckling Analysis. For nonlinear analysis, we developed a nonlinear finite element solver using the Riks method. To verify the implementation, we compared the load–displacement curve of a tetrahedral shell obtained from our solver with the corresponding analytical solution. The two results are in excellent agreement.\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/CUaFptyr.png] (https://i.sstatic.net/CUaFptyr.png)\n\n\n\n\nBecause of the excellent agreement with the analytical results, we are fairly confident that our implementation of the nonlinear FEA and Riks method is correct.\n\n\n\n\nIn the next phase, radial imperfections are introduced into the origami tubes. It is observed that the results depend on the choice of arc-length parameters. For relatively large imperfections (1%–20% of the tube radius), the results are shown in the figure below. For imperfections larger than approximately 3% of the radius, all four choices of initial and maximum arc-length increments produce consistent results. However, for imperfections smaller than 3%, discrepancies begin to appear.\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/pkW8aFfg.png] (https://i.sstatic.net/pkW8aFfg.png)\n\n\n\n\nFor example, the load–displacement curves for a 2% imperfection are shown below. Since the objective is to extract accurate buckling loads, these results suggest that an inappropriate choice of arc-length parameters can significantly affect both the equilibrium path and the predicted peak load.\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/Jpa1ZhK2.png] (https://i.sstatic.net/Jpa1ZhK2.png)\n\n\n\n\nQuestion. How can one systematically determine an appropriate set of arc-length increments to ensure accurate identification of the buckling load? Simply reducing the initial and maximum arc-length increments progressively is not computationally feasible for the models considered here. Is there a more systematic strategy for selecting these parameters or for assessing convergence of the predicted buckling load?\n\n\n\n\nIn addition, I would be interested to know whether others have encountered similar sensitivity issues when using the arc-length (Riks) method.\n\n\n\n\nEdit 1: The load-displacement curve for the 5% imperfection case obtained by using two different values for the initial/maximum arclength step is shown in the following figure. Unlike the 2% imperfection case, here the response of the structure seems to be independent of the arclength parameters.\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/it7J9X7j.png] (https://i.sstatic.net/it7J9X7j.png)\n\n\n\n\nEdit 2: The load-displacement curve for the 3% imperfection case obtained by using two different values for the initial/maximum arclength step is shown in the following figure. Like the 5% imperfection case, here the response of the structure seems to be independent of the arclength parameters.\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/e8ftx1cv.jpg] (https://i.sstatic.net/e8ftx1cv.jpg)", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "frustrated_engineer", "profile_url": "https://scicomp.stackexchange.com/users/48798/frustrated-engineer", "user_type": "registered"}, "created_at": "2026-05-07T04:35:14+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "66026A45-CF56-4D5F-8026-A976360D2AE1", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/66026A45-CF56-4D5F-8026-A976360D2AE1/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "frustrated_engineer", "profile_url": "https://scicomp.stackexchange.com/users/48798/frustrated-engineer", "user_type": "registered"}, "created_at": "2026-05-07T21:37:22+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "F4F479C8-9702-403F-9A00-DBD1BA73F116", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/F4F479C8-9702-403F-9A00-DBD1BA73F116/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "frustrated_engineer", "profile_url": "https://scicomp.stackexchange.com/users/48798/frustrated-engineer", "user_type": "registered"}, "created_at": "2026-05-08T19:57:03+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "3BE67053-F68D-4B54-8534-5A16438F9E58", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/3BE67053-F68D-4B54-8534-5A16438F9E58/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "frustrated_engineer", "profile_url": "https://scicomp.stackexchange.com/users/48798/frustrated-engineer", "user_type": "registered"}, "created_at": "2026-05-08T21:54:42+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "6A3E4BE7-2880-4B77-AE21-66D8D1D12BE2", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/6A3E4BE7-2880-4B77-AE21-66D8D1D12BE2/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-05-09T06:35:19+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "A6F961DE-E2B7-4DB6-862D-313F0B376CBF", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://scicomp.stackexchange.com/revisions/A6F961DE-E2B7-4DB6-862D-313F0B376CBF/view-source"}], "source_site": "scicomp", "source_url": "https://scicomp.stackexchange.com/questions/45444/why-do-riks-method-results-depend-on-arc-length-parameters", "split": "train", "split_group": "c02c5cdc848f6979a3065604a341773d6a8569ece1d7a6d617edca2ca3764676", "tags": ["finite-element", "numerics", "nonlinear-equations"], "thread_id": "scicomp:45444", "title": "Why Do Riks Method Results Depend on Arc-Length Parameters?"}} {"accepted_status": [false, false], "candidate_answers": [{"answer_html": "

The gist of the problem is (as the Author has suggested) to "assign" or match terms with known exponents of the first Laurent polynomial with terms with exponents depending on the variables $x_{ij}$ in the second Laurent polyomial.

\n

The given example exhibits some simplifying features that make the matching possible "by inspection" (with suitable bookkeeping).

\n

We assume the variables are allowed to take on integer values. I believe the example problem is infeasible if the $x_{ij}$ were restricted to nonnegative integers, as we will have occasion to point out below.

\n

Also the matching in the given example decouples variables that appear in the three terms corresponding to $a^{20},a^{18},a^{16}$. In other words we can match and solve separately for variables as they appear in only one of these three terms. Whether this is a general feature of the problems contemplated by the Author is not clear, so in the interest of simplicity I'll point out in my solution how that simplifies things.

\n

In order to arrange equality of the two Laurent polynomials, it is necessary and sufficient to get equality of the coefficients of $a^{20},a^{18},a^{16}$ respectively. The equality of the $a^{20}$ terms depends on six unknown values $$x_{13},x_{15},x_{17},x_{35},x_{37},x_{57}$$ while equality of the $a^{18}$ terms depends similarly on twenty unknowns $x_{12},\\ldots,x_{79}$ and that of the $a^{16}$ terms depends on ten unknowns $x_{24},\\ldots,x_{89}$.

\n

Because these three groups of unknowns are disjoint, they decouple; their solutions can be assigned independently. We proceed to give a detailed account of the possible solutions for the first group of unknowns.

\n

Comparing the coefficients of $a^{20}$, we find that monic terms $q^{-6},q^{6},q^{18}$ are already provided in the second Laurent polynomial. However the first polynomial has a term $2q^{18}$, so this nonmonic term has to be accounted for by variable exponents in the second polynomial (in addition to accounting for all the remaining terms in the coefficient of $a^{20}$).

\n

When those duplicate terms are omitted, e.g. by subtracting the like coefficients of $a^{20}$, we see that we have two lists of monic terms to be matched:

\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
First polynomialSecond polynomial
$1$ or $q^0$$q^{8+2x_{13}}$
$q^2$$q^{10+2x_{13}}$
$q^8$$q^{4+2x_{15}}$
$q^{10}$$q^{6+2x_{15}}$
$q^{12}$$q^{2x_{17}}$
$q^{14}$$q^{2+2x_{17}}$
$q^{16}$$q^{2x_{35}}$
$q^{18}$$q^{2+2x_{35}}$
$q^{20}$$q^{-4+2x_{37}}$
$q^{22}$$q^{-2+2x_{37}}$
$q^{24}$$q^{-8+2x_{57}}$
$q^{26}$$q^{-6+2x_{57}}$
\n

Note that the terms in the right column occur in six pairs of "stride two", i.e. the exponents will differ by two regardless of what (integer) values are assigned. Fortunately the left column also consists of six pairs of "stride two". In this case one solution is obtained by matching the left and right columns in the order indicated. Most generally we can match any of the six consecutive pairs on the left with any of the six consecutive pairs on the right, which means there are $6!$ distinct solutions.

\n

This resembles the graphic degree problem in which one is asked if a degree sequence can be attained by nodes of a simple graph. There are polynomial time algorithms for this problem.

\n

My personal choice of language for finding the matchings between two lists of polynomial terms would be Prolog because of its inherent list syntax and backtracking faculty. While I'm confident both Python and Mathematica could deal with lists, I'd be doubtful about the effort needed to tack on backtracking logic in them.

\n

I must pause for now to deal with some real world tasks, but I plan to return and sketch out the solutions for matching the $a^{18}$ and $a^{16}$ coefficients. I think both will introduce some noteworthy complications.

\n", "answer_id": 45473, "answer_text": "The gist of the problem is (as the Author has suggested) to \"assign\" or match terms with known exponents of the first Laurent polynomial with terms with exponents depending on the variables $x_{ij}$ in the second Laurent polyomial.\n\n\n\n\nThe given example exhibits some simplifying features that make the matching possible \"by inspection\" (with suitable bookkeeping).\n\n\n\n\nWe assume the variables are allowed to take on integer values. I believe the example problem is infeasible if the $x_{ij}$ were restricted to nonnegative integers, as we will have occasion to point out below.\n\n\n\n\nAlso the matching in the given example decouples variables that appear in the three terms corresponding to $a^{20},a^{18},a^{16}$. In other words we can match and solve separately for variables as they appear in only one of these three terms. Whether this is a general feature of the problems contemplated by the Author is not clear, so in the interest of simplicity I'll point out in my solution how that simplifies things.\n\n\n\n\nIn order to arrange equality of the two Laurent polynomials, it is necessary and sufficient to get equality of the coefficients of $a^{20},a^{18},a^{16}$ respectively. The equality of the $a^{20}$ terms depends on six unknown values $$x_{13},x_{15},x_{17},x_{35},x_{37},x_{57}$$ while equality of the $a^{18}$ terms depends similarly on twenty unknowns $x_{12},\\ldots,x_{79}$ and that of the $a^{16}$ terms depends on ten unknowns $x_{24},\\ldots,x_{89}$.\n\n\n\n\nBecause these three groups of unknowns are disjoint, they decouple; their solutions can be assigned independently. We proceed to give a detailed account of the possible solutions for the first group of unknowns.\n\n\n\n\nComparing the coefficients of $a^{20}$, we find that monic terms $q^{-6},q^{6},q^{18}$ are already provided in the second Laurent polynomial. However the first polynomial has a term $2q^{18}$, so this nonmonic term has to be accounted for by variable exponents in the second polynomial (in addition to accounting for all the remaining terms in the coefficient of $a^{20}$).\n\n\n\n\nWhen those duplicate terms are omitted, e.g. by subtracting the like coefficients of $a^{20}$, we see that we have two lists of monic terms to be matched:\n\n\n\n\n\n\n\n\n\nFirst polynomial\nSecond polynomial\n\n\n\n\n\n\n\n\n\t$1$ or $q^0$\n\t$q^{8+2x_{13}}$\n\n\n\n\n\n\n\t$q^2$\n\t$q^{10+2x_{13}}$\n\n\n\n\n\n\n\t$q^8$\n\t$q^{4+2x_{15}}$\n\n\n\n\n\n\n\t$q^{10}$\n\t$q^{6+2x_{15}}$\n\n\n\n\n\n\n\t$q^{12}$\n\t$q^{2x_{17}}$\n\n\n\n\n\n\n\t$q^{14}$\n\t$q^{2+2x_{17}}$\n\n\n\n\n\n\n\t$q^{16}$\n\t$q^{2x_{35}}$\n\n\n\n\n\n\n\t$q^{18}$\n\t$q^{2+2x_{35}}$\n\n\n\n\n\n\n\t$q^{20}$\n\t$q^{-4+2x_{37}}$\n\n\n\n\n\n\n\t$q^{22}$\n\t$q^{-2+2x_{37}}$\n\n\n\n\n\n\n\t$q^{24}$\n\t$q^{-8+2x_{57}}$\n\n\n\n\n\n\n\t$q^{26}$\n\t$q^{-6+2x_{57}}$\n\n\n\n\n\n\n\n\n\nNote that the terms in the right column occur in six pairs of \"stride two\", i.e. the exponents will differ by two regardless of what (integer) values are assigned. Fortunately the left column also consists of six pairs of \"stride two\". In this case one solution is obtained by matching the left and right columns in the order indicated. Most generally we can match any of the six consecutive pairs on the left with any of the six consecutive pairs on the right, which means there are $6!$ distinct solutions.\n\n\n\n\nThis resembles the graphic degree problem (https://en.wikipedia.org/wiki/Graph_realization_problem) in which one is asked if a degree sequence can be attained by nodes of a simple graph. There are polynomial time algorithms for this problem.\n\n\n\n\nMy personal choice of language for finding the matchings between two lists of polynomial terms would be Prolog (https://en.wikipedia.org/wiki/Prolog) because of its inherent list syntax and backtracking faculty. While I'm confident both Python and Mathematica could deal with lists, I'd be doubtful about the effort needed to tack on backtracking logic in them.\n\n\n\n\nI must pause for now to deal with some real world tasks, but I plan to return and sketch out the solutions for matching the $a^{18}$ and $a^{16}$ coefficients. I think both will introduce some noteworthy complications.", "answer_url": "https://scicomp.stackexchange.com/a/45473", "author": "hardmath", "author_url": "https://scicomp.stackexchange.com/users/651/hardmath", "author_user_type": "moderator", "content_license": "CC BY-SA 4.0", "created_at": "2026-06-24T21:53:31+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45472, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "hardmath", "profile_url": "https://scicomp.stackexchange.com/users/651/hardmath", "user_type": "moderator"}, "created_at": "2026-06-24T21:53:31+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "6B10CE88-2D26-43C8-9F27-870834FE5FB3", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/6B10CE88-2D26-43C8-9F27-870834FE5FB3/view-source"}], "score": 2, "updated_at": "2026-06-24T21:53:31+00:00"}, {"answer_html": "

Consider first the simpler problem where we have only the laurent polynomials in $q$ that are multiplied by $a^{20}$; call these $P_{1}$ and $P_{2}$. When\nwe have the desired $x_{i}$ values the two polynomials are equal for all values of $q$. The case of $q=1$ is easy to test since the result does not depend on the values of the exponents. So we expect $P_{1}(1)=P_{2}(1)$ and\nsince we were quaranteed the same set of monomials we find that is trivially true (both are $16$ in this case). Next consider that the derivative polynomials $dP_{1}/dq$ and $dP_{2}/dq$ at $q=1$ must also be equal. The\nderivative "pulls down" the exponents and the result is a linear equation in the $x_{i}$, which in this case is\n$$\n220=60+4x_{13}+4x_{15}+4x_{17}+4x_{35}+4x_{37}+4x_{57}\n$$\nFor the second derivative we find a quadratic equation\n$$\n4300=1236+(2+2x_{35})^{2}+(4+2x_{15})^{2}+4x_{17}^{2}+\\ldots\n$$\nand so on. There are $6$ unknowns and so we need $6$ equations, i.e.., up to the 6th derivative. Solving polynomial systems of equations is standard in computer algebra systems and although it may be slow for large number of variables, it is probably faster than solving a combinatorial problem. In this case, Maple's\nsolve produced 100 solutions in just over one second. The first of these is\n$$\n\\{x_{13}=0,x_{15}=10,x_{17}=6,x_{35}=0,x_{37}=12,x_{57}=12\\}\n$$\nThe complete Maple code is:

\n
restart;\nP1 := 1 + 1/q^6 + q^2 + q^6 + q^8 + q^10 + q^12 + q^14 + q^16 + 2*q^18 + q^20 + q^22 + q^24 + q^26 + q^30;\nP2 := 1/q^6 + q^6 + q^18 + q^30 + q^(-8 + 2*(8 + x[13])) + q^(-8 + 2*(9 + x[13])) + q^(-8 + 2*(6 + x[15])) + q^(-8 + 2*(7 + x[15])) + q^(2*x[17]) + q^(-8 + 2*(5 + x[17])) + q^(2*x[35]) + q^(-8 + 2*(5 + x[35])) + q^(-4 + 2*x[37]) + q^(-2 + 2*x[37]) + q^(-8 + 2*x[57]) + q^(-6 + 2*x[57]);\nvars := indets(P2, name) minus {q};\nn := nops(vars);\nfor i from 1 to n do\n  eq[i] := eval(diff(P1, q$i), q=1) = eval(diff(P2, q$i), q=1);\nend do:\neqs := convert(eq, set);\nans := [solve(eqs, vars)];\nnsols := nops(ans);\nans[1]; # display first of 100 solutions\n
\n

For the complete problem, if you know the $a^{20}$, $a^{18}$ and $a^{16}$ problems are uncoupled, then they can be solved separately; each solution of the first can go with the each of the second and so on. Solving them together will lead to an unworkable number of solutions.

\n", "answer_id": 45482, "answer_text": "Consider first the simpler problem where we have only the laurent polynomials in $q$ that are multiplied by $a^{20}$; call these $P_{1}$ and $P_{2}$. When\nwe have the desired $x_{i}$ values the two polynomials are equal for all values of $q$. The case of $q=1$ is easy to test since the result does not depend on the values of the exponents. So we expect $P_{1}(1)=P_{2}(1)$ and\nsince we were quaranteed the same set of monomials we find that is trivially true (both are $16$ in this case). Next consider that the derivative polynomials $dP_{1}/dq$ and $dP_{2}/dq$ at $q=1$ must also be equal. The\nderivative \"pulls down\" the exponents and the result is a linear equation in the $x_{i}$, which in this case is\n$$\n220=60+4x_{13}+4x_{15}+4x_{17}+4x_{35}+4x_{37}+4x_{57}\n$$\nFor the second derivative we find a quadratic equation\n$$\n4300=1236+(2+2x_{35})^{2}+(4+2x_{15})^{2}+4x_{17}^{2}+\\ldots\n$$\nand so on. There are $6$ unknowns and so we need $6$ equations, i.e.., up to the 6th derivative. Solving polynomial systems of equations is standard in computer algebra systems and although it may be slow for large number of variables, it is probably faster than solving a combinatorial problem. In this case, Maple's\nsolve produced 100 solutions in just over one second. The first of these is\n$$\n\\{x_{13}=0,x_{15}=10,x_{17}=6,x_{35}=0,x_{37}=12,x_{57}=12\\}\n$$\nThe complete Maple code is:\n\n\n\n\nrestart;\nP1 := 1 + 1/q^6 + q^2 + q^6 + q^8 + q^10 + q^12 + q^14 + q^16 + 2*q^18 + q^20 + q^22 + q^24 + q^26 + q^30;\nP2 := 1/q^6 + q^6 + q^18 + q^30 + q^(-8 + 2*(8 + x[13])) + q^(-8 + 2*(9 + x[13])) + q^(-8 + 2*(6 + x[15])) + q^(-8 + 2*(7 + x[15])) + q^(2*x[17]) + q^(-8 + 2*(5 + x[17])) + q^(2*x[35]) + q^(-8 + 2*(5 + x[35])) + q^(-4 + 2*x[37]) + q^(-2 + 2*x[37]) + q^(-8 + 2*x[57]) + q^(-6 + 2*x[57]);\nvars := indets(P2, name) minus {q};\nn := nops(vars);\nfor i from 1 to n do\n eq[i] := eval(diff(P1, q$i), q=1) = eval(diff(P2, q$i), q=1);\nend do:\neqs := convert(eq, set);\nans := [solve(eqs, vars)];\nnsols := nops(ans);\nans[1]; # display first of 100 solutions\n\n\n\n\n\nFor the complete problem, if you know the $a^{20}$, $a^{18}$ and $a^{16}$ problems are uncoupled, then they can be solved separately; each solution of the first can go with the each of the second and so on. Solving them together will lead to an unworkable number of solutions.", "answer_url": "https://scicomp.stackexchange.com/a/45482", "author": "dharr", "author_url": "https://scicomp.stackexchange.com/users/50934/dharr", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-06-28T17:22:41+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45472, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "dharr", "profile_url": "https://scicomp.stackexchange.com/users/50934/dharr", "user_type": "registered"}, "created_at": "2026-06-28T17:22:41+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "17B5B435-530D-44FB-A531-8C7EBC69DAB0", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/17B5B435-530D-44FB-A531-8C7EBC69DAB0/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "dharr", "profile_url": "https://scicomp.stackexchange.com/users/50934/dharr", "user_type": "registered"}, "created_at": "2026-06-28T17:30:54+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "B335F14D-BC1A-4871-8C8E-AA1A1574CE8E", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/B335F14D-BC1A-4871-8C8E-AA1A1574CE8E/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "dharr", "profile_url": "https://scicomp.stackexchange.com/users/50934/dharr", "user_type": "registered"}, "created_at": "2026-06-29T00:34:42+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "AE6B318A-E224-4873-94DF-796E47B0400A", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/AE6B318A-E224-4873-94DF-796E47B0400A/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "dharr", "profile_url": "https://scicomp.stackexchange.com/users/50934/dharr", "user_type": "registered"}, "created_at": "2026-06-29T01:28:55+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "E46B4CBF-9F68-49D7-885E-BE0F07FBA25B", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/E46B4CBF-9F68-49D7-885E-BE0F07FBA25B/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "dharr", "profile_url": "https://scicomp.stackexchange.com/users/50934/dharr", "user_type": "registered"}, "created_at": "2026-06-29T02:02:10+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "BE24CE57-475F-48DB-8B09-676A64E891E3", "revision_number": 5, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/BE24CE57-475F-48DB-8B09-676A64E891E3/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "dharr", "profile_url": "https://scicomp.stackexchange.com/users/50934/dharr", "user_type": "registered"}, "created_at": "2026-07-06T01:31:28+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "64B9EB1B-7407-427F-BF22-4AF94181F69C", "revision_number": 6, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/64B9EB1B-7407-427F-BF22-4AF94181F69C/view-source"}], "score": 3, "updated_at": "2026-07-06T01:31:28+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I am trying to solve a linear system of equations that comes from equating two Laurent polynomials (https://en.wikipedia.org/wiki/Laurent_polynomial). The first such polynomial has known numeric values of its exponents, while the second polynomial has the exponents depending linearly on variables we are trying to solve for.\n\n\n\n\nThey always have the same set of monomials, hence I know that the system is not trivially unsolvable. So we need to solve these linear equations, but the rub is that we don't know which equations should be allocated to which polynomial. There are a lot of these equations that come from multiple conditions, and the solutions must be consistent for all conditions.\n\n\n\n\nMy idea was to do a sort of combinatorics algorithm but I failed miserably.\nIn any case I guess that must be a problem that occurred other times, or at least something similar to it, and maybe it was already solved by someone with python, mathematica (I mainly use mathematica) or any other programming language.\n\n\n\n\nDo you guys know of any hint or solution on how to tackle these problems?\n\n\n\n\nAs an example to make things more clear. This is the purely numerical polynomial:\n$a^{20}\\left(\n1 + q^{-6} + q^{2} + q^{6} + q^{8} + q^{10} + q^{12} + q^{14} + q^{16}\n+ 2 q^{18} + q^{20} + q^{22} + q^{24} + q^{26} + q^{30}\n\\right)\n+\na^{18}\\left(\n-1 - q^{-12} - q^{-10} - q^{-6} - 2 q^{-4} - q^{-2}\n- 2 q^{2} - 2 q^{4} - 2 q^{6} - 2 q^{8} - 2 q^{10}\n- 3 q^{12} - 3 q^{14} - 2 q^{16} - 3 q^{18} - 3 q^{20}\n- 2 q^{22} - 2 q^{24} - 2 q^{26} - q^{28} - q^{30} - q^{32}\n\\right)\n+\na^{16}\\left(\n1 + q^{-16} + q^{-10} + q^{-8} + q^{-4} + q^{-2}\n+ q^{2} + q^{4} + q^{6} + 2 q^{8} + q^{10} + q^{12}\n+ 2 q^{14} + 2 q^{16} + q^{18} + 2 q^{20}\n+ q^{22} + q^{24} + q^{26} + q^{28} + q^{32}\n\\right)\n$\n\n\n\n\nand here is the polynomial with the variables:\n$a^{20}\\left(\nq^{-6} + q^{6} + q^{18} + q^{30}\n+ q^{-8 + 2(8 + x_{13})}\n+ q^{-8 + 2(9 + x_{13})}\n+ q^{-8 + 2(6 + x_{15})}\n+ q^{-8 + 2(7 + x_{15})}\n+ q^{2 x_{17}}\n+ q^{-8 + 2(5 + x_{17})}\n+ q^{2 x_{35}}\n+ q^{-8 + 2(5 + x_{35})}\n+ q^{-4 + 2 x_{37}}\n+ q^{-2 + 2 x_{37}}\n+ q^{-8 + 2 x_{57}}\n+ q^{-6 + 2 x_{57}}\n\\right)\n+\na^{18}\\left(\n- q^{14 + 2 x_{12}}\n- q^{16 + 2 x_{12}}\n- q^{10 + 2 x_{14}}\n- q^{12 + 2 x_{14}}\n- q^{6 + 2 x_{16}}\n- q^{8 + 2 x_{16}}\n- q^{-14 + 2(8 + x_{18})}\n- q^{-12 + 2(8 + x_{18})}\n- q^{-14 + 2(6 + x_{19})}\n- q^{-12 + 2(6 + x_{19})}\n- q^{10 + 2 x_{23}}\n- q^{12 + 2 x_{23}}\n- q^{6 + 2 x_{25}}\n- q^{8 + 2 x_{25}}\n- q^{-14 + 2(8 + x_{27})}\n- q^{-12 + 2(8 + x_{27})}\n- q^{6 + 2 x_{34}}\n- q^{8 + 2 x_{34}}\n- q^{-14 + 2(8 + x_{36})}\n- q^{-12 + 2(8 + x_{36})}\n- q^{-14 + 2(6 + x_{38})}\n- q^{-12 + 2(6 + x_{38})}\n- q^{-6 + 2 x_{39}}\n- q^{-4 + 2 x_{39}}\n- q^{-14 + 2(8 + x_{45})}\n- q^{-12 + 2(8 + x_{45})}\n- q^{-14 + 2(6 + x_{47})}\n- q^{-12 + 2(6 + x_{47})}\n- q^{-14 + 2(6 + x_{56})}\n- q^{-12 + 2(6 + x_{56})}\n- q^{-6 + 2 x_{58}}\n- q^{-4 + 2 x_{58}}\n- q^{-10 + 2 x_{59}}\n- q^{-8 + 2 x_{59}}\n- q^{-6 + 2 x_{67}}\n- q^{-4 + 2 x_{67}}\n- q^{-10 + 2 x_{78}}\n- q^{-8 + 2 x_{78}}\n- q^{-14 + 2 x_{79}}\n- q^{-12 + 2 x_{79}}\n\\right)\n+\na^{16}\\left(\nq^{-16} + q^{-4} + q^{8} + q^{20} + q^{32}\n+ q^{12 + 2 x_{24}}\n+ q^{14 + 2 x_{24}}\n+ q^{8 + 2 x_{26}}\n+ q^{10 + 2 x_{26}}\n+ q^{4 + 2 x_{28}}\n+ q^{6 + 2 x_{28}}\n+ q^{-16 + 2(8 + x_{29})}\n+ q^{-16 + 2(9 + x_{29})}\n+ q^{4 + 2 x_{46}}\n+ q^{6 + 2 x_{46}}\n+ q^{-16 + 2(8 + x_{48})}\n+ q^{-16 + 2(9 + x_{48})}\n+ q^{-16 + 2(6 + x_{49})}\n+ q^{-16 + 2(7 + x_{49})}\n+ q^{-16 + 2(6 + x_{68})}\n+ q^{-16 + 2(7 + x_{68})}\n+ q^{-8 + 2 x_{69}}\n+ q^{-16 + 2(5 + x_{69})}\n+ q^{-12 + 2 x_{89}}\n+ q^{-10 + 2 x_{89}}\n\\right)$\n\n\n\n\nThere are other such equations, and the goal is to solve for $x_{ij}$. Since we don't know beforehand how to match the numerical exponents to the exponents with variables, we have to do it with combinatorics and then use the same method on the other set of equations to guarantee that we have a consistent set of solutions.", "record_id": "Scientific-Answer-Ranking:scicomp:45472", "scores": [2, 3], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

The gist of the problem is (as the Author has suggested) to "assign" or match terms with known exponents of the first Laurent polynomial with terms with exponents depending on the variables $x_{ij}$ in the second Laurent polyomial.

\n

The given example exhibits some simplifying features that make the matching possible "by inspection" (with suitable bookkeeping).

\n

We assume the variables are allowed to take on integer values. I believe the example problem is infeasible if the $x_{ij}$ were restricted to nonnegative integers, as we will have occasion to point out below.

\n

Also the matching in the given example decouples variables that appear in the three terms corresponding to $a^{20},a^{18},a^{16}$. In other words we can match and solve separately for variables as they appear in only one of these three terms. Whether this is a general feature of the problems contemplated by the Author is not clear, so in the interest of simplicity I'll point out in my solution how that simplifies things.

\n

In order to arrange equality of the two Laurent polynomials, it is necessary and sufficient to get equality of the coefficients of $a^{20},a^{18},a^{16}$ respectively. The equality of the $a^{20}$ terms depends on six unknown values $$x_{13},x_{15},x_{17},x_{35},x_{37},x_{57}$$ while equality of the $a^{18}$ terms depends similarly on twenty unknowns $x_{12},\\ldots,x_{79}$ and that of the $a^{16}$ terms depends on ten unknowns $x_{24},\\ldots,x_{89}$.

\n

Because these three groups of unknowns are disjoint, they decouple; their solutions can be assigned independently. We proceed to give a detailed account of the possible solutions for the first group of unknowns.

\n

Comparing the coefficients of $a^{20}$, we find that monic terms $q^{-6},q^{6},q^{18}$ are already provided in the second Laurent polynomial. However the first polynomial has a term $2q^{18}$, so this nonmonic term has to be accounted for by variable exponents in the second polynomial (in addition to accounting for all the remaining terms in the coefficient of $a^{20}$).

\n

When those duplicate terms are omitted, e.g. by subtracting the like coefficients of $a^{20}$, we see that we have two lists of monic terms to be matched:

\n
\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
First polynomialSecond polynomial
$1$ or $q^0$$q^{8+2x_{13}}$
$q^2$$q^{10+2x_{13}}$
$q^8$$q^{4+2x_{15}}$
$q^{10}$$q^{6+2x_{15}}$
$q^{12}$$q^{2x_{17}}$
$q^{14}$$q^{2+2x_{17}}$
$q^{16}$$q^{2x_{35}}$
$q^{18}$$q^{2+2x_{35}}$
$q^{20}$$q^{-4+2x_{37}}$
$q^{22}$$q^{-2+2x_{37}}$
$q^{24}$$q^{-8+2x_{57}}$
$q^{26}$$q^{-6+2x_{57}}$
\n

Note that the terms in the right column occur in six pairs of "stride two", i.e. the exponents will differ by two regardless of what (integer) values are assigned. Fortunately the left column also consists of six pairs of "stride two". In this case one solution is obtained by matching the left and right columns in the order indicated. Most generally we can match any of the six consecutive pairs on the left with any of the six consecutive pairs on the right, which means there are $6!$ distinct solutions.

\n

This resembles the graphic degree problem in which one is asked if a degree sequence can be attained by nodes of a simple graph. There are polynomial time algorithms for this problem.

\n

My personal choice of language for finding the matchings between two lists of polynomial terms would be Prolog because of its inherent list syntax and backtracking faculty. While I'm confident both Python and Mathematica could deal with lists, I'd be doubtful about the effort needed to tack on backtracking logic in them.

\n

I must pause for now to deal with some real world tasks, but I plan to return and sketch out the solutions for matching the $a^{18}$ and $a^{16}$ coefficients. I think both will introduce some noteworthy complications.

\n", "answer_id": 45473, "answer_text": "The gist of the problem is (as the Author has suggested) to \"assign\" or match terms with known exponents of the first Laurent polynomial with terms with exponents depending on the variables $x_{ij}$ in the second Laurent polyomial.\n\n\n\n\nThe given example exhibits some simplifying features that make the matching possible \"by inspection\" (with suitable bookkeeping).\n\n\n\n\nWe assume the variables are allowed to take on integer values. I believe the example problem is infeasible if the $x_{ij}$ were restricted to nonnegative integers, as we will have occasion to point out below.\n\n\n\n\nAlso the matching in the given example decouples variables that appear in the three terms corresponding to $a^{20},a^{18},a^{16}$. In other words we can match and solve separately for variables as they appear in only one of these three terms. Whether this is a general feature of the problems contemplated by the Author is not clear, so in the interest of simplicity I'll point out in my solution how that simplifies things.\n\n\n\n\nIn order to arrange equality of the two Laurent polynomials, it is necessary and sufficient to get equality of the coefficients of $a^{20},a^{18},a^{16}$ respectively. The equality of the $a^{20}$ terms depends on six unknown values $$x_{13},x_{15},x_{17},x_{35},x_{37},x_{57}$$ while equality of the $a^{18}$ terms depends similarly on twenty unknowns $x_{12},\\ldots,x_{79}$ and that of the $a^{16}$ terms depends on ten unknowns $x_{24},\\ldots,x_{89}$.\n\n\n\n\nBecause these three groups of unknowns are disjoint, they decouple; their solutions can be assigned independently. We proceed to give a detailed account of the possible solutions for the first group of unknowns.\n\n\n\n\nComparing the coefficients of $a^{20}$, we find that monic terms $q^{-6},q^{6},q^{18}$ are already provided in the second Laurent polynomial. However the first polynomial has a term $2q^{18}$, so this nonmonic term has to be accounted for by variable exponents in the second polynomial (in addition to accounting for all the remaining terms in the coefficient of $a^{20}$).\n\n\n\n\nWhen those duplicate terms are omitted, e.g. by subtracting the like coefficients of $a^{20}$, we see that we have two lists of monic terms to be matched:\n\n\n\n\n\n\n\n\n\nFirst polynomial\nSecond polynomial\n\n\n\n\n\n\n\n\n\t$1$ or $q^0$\n\t$q^{8+2x_{13}}$\n\n\n\n\n\n\n\t$q^2$\n\t$q^{10+2x_{13}}$\n\n\n\n\n\n\n\t$q^8$\n\t$q^{4+2x_{15}}$\n\n\n\n\n\n\n\t$q^{10}$\n\t$q^{6+2x_{15}}$\n\n\n\n\n\n\n\t$q^{12}$\n\t$q^{2x_{17}}$\n\n\n\n\n\n\n\t$q^{14}$\n\t$q^{2+2x_{17}}$\n\n\n\n\n\n\n\t$q^{16}$\n\t$q^{2x_{35}}$\n\n\n\n\n\n\n\t$q^{18}$\n\t$q^{2+2x_{35}}$\n\n\n\n\n\n\n\t$q^{20}$\n\t$q^{-4+2x_{37}}$\n\n\n\n\n\n\n\t$q^{22}$\n\t$q^{-2+2x_{37}}$\n\n\n\n\n\n\n\t$q^{24}$\n\t$q^{-8+2x_{57}}$\n\n\n\n\n\n\n\t$q^{26}$\n\t$q^{-6+2x_{57}}$\n\n\n\n\n\n\n\n\n\nNote that the terms in the right column occur in six pairs of \"stride two\", i.e. the exponents will differ by two regardless of what (integer) values are assigned. Fortunately the left column also consists of six pairs of \"stride two\". In this case one solution is obtained by matching the left and right columns in the order indicated. Most generally we can match any of the six consecutive pairs on the left with any of the six consecutive pairs on the right, which means there are $6!$ distinct solutions.\n\n\n\n\nThis resembles the graphic degree problem (https://en.wikipedia.org/wiki/Graph_realization_problem) in which one is asked if a degree sequence can be attained by nodes of a simple graph. There are polynomial time algorithms for this problem.\n\n\n\n\nMy personal choice of language for finding the matchings between two lists of polynomial terms would be Prolog (https://en.wikipedia.org/wiki/Prolog) because of its inherent list syntax and backtracking faculty. While I'm confident both Python and Mathematica could deal with lists, I'd be doubtful about the effort needed to tack on backtracking logic in them.\n\n\n\n\nI must pause for now to deal with some real world tasks, but I plan to return and sketch out the solutions for matching the $a^{18}$ and $a^{16}$ coefficients. I think both will introduce some noteworthy complications.", "answer_url": "https://scicomp.stackexchange.com/a/45473", "author": "hardmath", "author_url": "https://scicomp.stackexchange.com/users/651/hardmath", "author_user_type": "moderator", "content_license": "CC BY-SA 4.0", "created_at": "2026-06-24T21:53:31+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45472, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "hardmath", "profile_url": "https://scicomp.stackexchange.com/users/651/hardmath", "user_type": "moderator"}, "created_at": "2026-06-24T21:53:31+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "6B10CE88-2D26-43C8-9F27-870834FE5FB3", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/6B10CE88-2D26-43C8-9F27-870834FE5FB3/view-source"}], "score": 2, "updated_at": "2026-06-24T21:53:31+00:00"}, {"answer_html": "

Consider first the simpler problem where we have only the laurent polynomials in $q$ that are multiplied by $a^{20}$; call these $P_{1}$ and $P_{2}$. When\nwe have the desired $x_{i}$ values the two polynomials are equal for all values of $q$. The case of $q=1$ is easy to test since the result does not depend on the values of the exponents. So we expect $P_{1}(1)=P_{2}(1)$ and\nsince we were quaranteed the same set of monomials we find that is trivially true (both are $16$ in this case). Next consider that the derivative polynomials $dP_{1}/dq$ and $dP_{2}/dq$ at $q=1$ must also be equal. The\nderivative "pulls down" the exponents and the result is a linear equation in the $x_{i}$, which in this case is\n$$\n220=60+4x_{13}+4x_{15}+4x_{17}+4x_{35}+4x_{37}+4x_{57}\n$$\nFor the second derivative we find a quadratic equation\n$$\n4300=1236+(2+2x_{35})^{2}+(4+2x_{15})^{2}+4x_{17}^{2}+\\ldots\n$$\nand so on. There are $6$ unknowns and so we need $6$ equations, i.e.., up to the 6th derivative. Solving polynomial systems of equations is standard in computer algebra systems and although it may be slow for large number of variables, it is probably faster than solving a combinatorial problem. In this case, Maple's\nsolve produced 100 solutions in just over one second. The first of these is\n$$\n\\{x_{13}=0,x_{15}=10,x_{17}=6,x_{35}=0,x_{37}=12,x_{57}=12\\}\n$$\nThe complete Maple code is:

\n
restart;\nP1 := 1 + 1/q^6 + q^2 + q^6 + q^8 + q^10 + q^12 + q^14 + q^16 + 2*q^18 + q^20 + q^22 + q^24 + q^26 + q^30;\nP2 := 1/q^6 + q^6 + q^18 + q^30 + q^(-8 + 2*(8 + x[13])) + q^(-8 + 2*(9 + x[13])) + q^(-8 + 2*(6 + x[15])) + q^(-8 + 2*(7 + x[15])) + q^(2*x[17]) + q^(-8 + 2*(5 + x[17])) + q^(2*x[35]) + q^(-8 + 2*(5 + x[35])) + q^(-4 + 2*x[37]) + q^(-2 + 2*x[37]) + q^(-8 + 2*x[57]) + q^(-6 + 2*x[57]);\nvars := indets(P2, name) minus {q};\nn := nops(vars);\nfor i from 1 to n do\n  eq[i] := eval(diff(P1, q$i), q=1) = eval(diff(P2, q$i), q=1);\nend do:\neqs := convert(eq, set);\nans := [solve(eqs, vars)];\nnsols := nops(ans);\nans[1]; # display first of 100 solutions\n
\n

For the complete problem, if you know the $a^{20}$, $a^{18}$ and $a^{16}$ problems are uncoupled, then they can be solved separately; each solution of the first can go with the each of the second and so on. Solving them together will lead to an unworkable number of solutions.

\n", "answer_id": 45482, "answer_text": "Consider first the simpler problem where we have only the laurent polynomials in $q$ that are multiplied by $a^{20}$; call these $P_{1}$ and $P_{2}$. When\nwe have the desired $x_{i}$ values the two polynomials are equal for all values of $q$. The case of $q=1$ is easy to test since the result does not depend on the values of the exponents. So we expect $P_{1}(1)=P_{2}(1)$ and\nsince we were quaranteed the same set of monomials we find that is trivially true (both are $16$ in this case). Next consider that the derivative polynomials $dP_{1}/dq$ and $dP_{2}/dq$ at $q=1$ must also be equal. The\nderivative \"pulls down\" the exponents and the result is a linear equation in the $x_{i}$, which in this case is\n$$\n220=60+4x_{13}+4x_{15}+4x_{17}+4x_{35}+4x_{37}+4x_{57}\n$$\nFor the second derivative we find a quadratic equation\n$$\n4300=1236+(2+2x_{35})^{2}+(4+2x_{15})^{2}+4x_{17}^{2}+\\ldots\n$$\nand so on. There are $6$ unknowns and so we need $6$ equations, i.e.., up to the 6th derivative. Solving polynomial systems of equations is standard in computer algebra systems and although it may be slow for large number of variables, it is probably faster than solving a combinatorial problem. In this case, Maple's\nsolve produced 100 solutions in just over one second. The first of these is\n$$\n\\{x_{13}=0,x_{15}=10,x_{17}=6,x_{35}=0,x_{37}=12,x_{57}=12\\}\n$$\nThe complete Maple code is:\n\n\n\n\nrestart;\nP1 := 1 + 1/q^6 + q^2 + q^6 + q^8 + q^10 + q^12 + q^14 + q^16 + 2*q^18 + q^20 + q^22 + q^24 + q^26 + q^30;\nP2 := 1/q^6 + q^6 + q^18 + q^30 + q^(-8 + 2*(8 + x[13])) + q^(-8 + 2*(9 + x[13])) + q^(-8 + 2*(6 + x[15])) + q^(-8 + 2*(7 + x[15])) + q^(2*x[17]) + q^(-8 + 2*(5 + x[17])) + q^(2*x[35]) + q^(-8 + 2*(5 + x[35])) + q^(-4 + 2*x[37]) + q^(-2 + 2*x[37]) + q^(-8 + 2*x[57]) + q^(-6 + 2*x[57]);\nvars := indets(P2, name) minus {q};\nn := nops(vars);\nfor i from 1 to n do\n eq[i] := eval(diff(P1, q$i), q=1) = eval(diff(P2, q$i), q=1);\nend do:\neqs := convert(eq, set);\nans := [solve(eqs, vars)];\nnsols := nops(ans);\nans[1]; # display first of 100 solutions\n\n\n\n\n\nFor the complete problem, if you know the $a^{20}$, $a^{18}$ and $a^{16}$ problems are uncoupled, then they can be solved separately; each solution of the first can go with the each of the second and so on. Solving them together will lead to an unworkable number of solutions.", "answer_url": "https://scicomp.stackexchange.com/a/45482", "author": "dharr", "author_url": "https://scicomp.stackexchange.com/users/50934/dharr", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-06-28T17:22:41+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45472, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "dharr", "profile_url": "https://scicomp.stackexchange.com/users/50934/dharr", "user_type": "registered"}, "created_at": "2026-06-28T17:22:41+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "17B5B435-530D-44FB-A531-8C7EBC69DAB0", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/17B5B435-530D-44FB-A531-8C7EBC69DAB0/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "dharr", "profile_url": "https://scicomp.stackexchange.com/users/50934/dharr", "user_type": "registered"}, "created_at": "2026-06-28T17:30:54+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "B335F14D-BC1A-4871-8C8E-AA1A1574CE8E", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/B335F14D-BC1A-4871-8C8E-AA1A1574CE8E/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "dharr", "profile_url": "https://scicomp.stackexchange.com/users/50934/dharr", "user_type": "registered"}, "created_at": "2026-06-29T00:34:42+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "AE6B318A-E224-4873-94DF-796E47B0400A", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/AE6B318A-E224-4873-94DF-796E47B0400A/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "dharr", "profile_url": "https://scicomp.stackexchange.com/users/50934/dharr", "user_type": "registered"}, "created_at": "2026-06-29T01:28:55+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "E46B4CBF-9F68-49D7-885E-BE0F07FBA25B", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/E46B4CBF-9F68-49D7-885E-BE0F07FBA25B/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "dharr", "profile_url": "https://scicomp.stackexchange.com/users/50934/dharr", "user_type": "registered"}, "created_at": "2026-06-29T02:02:10+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "BE24CE57-475F-48DB-8B09-676A64E891E3", "revision_number": 5, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/BE24CE57-475F-48DB-8B09-676A64E891E3/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "dharr", "profile_url": "https://scicomp.stackexchange.com/users/50934/dharr", "user_type": "registered"}, "created_at": "2026-07-06T01:31:28+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "64B9EB1B-7407-427F-BF22-4AF94181F69C", "revision_number": 6, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/64B9EB1B-7407-427F-BF22-4AF94181F69C/view-source"}], "score": 3, "updated_at": "2026-07-06T01:31:28+00:00"}], "domain": "computational_science", "external_links": ["https://en.wikipedia.org/wiki/Graph_realization_problem", "https://en.wikipedia.org/wiki/Laurent_polynomial", "https://en.wikipedia.org/wiki/Prolog"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:44.584971+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/272744bcc95b58699f7df6e6979b288bb8b00a80ab9c7982dbe170a6d0b63584_1790825325025901700_0.json", "raw_sha256": "27a81850a40920682c29ada76a2b55e80340a5c82764a3e9dde8a9c2ba23db4e", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "ateixeira82", "question_author_url": "https://scicomp.stackexchange.com/users/56972/ateixeira82", "question_author_user_type": "registered", "question_created_at": "2026-06-21T10:31:05+00:00", "question_html": "

I am trying to solve a linear system of equations that comes from equating two Laurent polynomials. The first such polynomial has known numeric values of its exponents, while the second polynomial has the exponents depending linearly on variables we are trying to solve for.

\n

They always have the same set of monomials, hence I know that the system is not trivially unsolvable. So we need to solve these linear equations, but the rub is that we don't know which equations should be allocated to which polynomial. There are a lot of these equations that come from multiple conditions, and the solutions must be consistent for all conditions.

\n

My idea was to do a sort of combinatorics algorithm but I failed miserably.\nIn any case I guess that must be a problem that occurred other times, or at least something similar to it, and maybe it was already solved by someone with python, mathematica (I mainly use mathematica) or any other programming language.

\n

Do you guys know of any hint or solution on how to tackle these problems?

\n

As an example to make things more clear. This is the purely numerical polynomial:\n$a^{20}\\left(\n1 + q^{-6} + q^{2} + q^{6} + q^{8} + q^{10} + q^{12} + q^{14} + q^{16}\n+ 2 q^{18} + q^{20} + q^{22} + q^{24} + q^{26} + q^{30}\n\\right)\n+\na^{18}\\left(\n-1 - q^{-12} - q^{-10} - q^{-6} - 2 q^{-4} - q^{-2}\n- 2 q^{2} - 2 q^{4} - 2 q^{6} - 2 q^{8} - 2 q^{10}\n- 3 q^{12} - 3 q^{14} - 2 q^{16} - 3 q^{18} - 3 q^{20}\n- 2 q^{22} - 2 q^{24} - 2 q^{26} - q^{28} - q^{30} - q^{32}\n\\right)\n+\na^{16}\\left(\n1 + q^{-16} + q^{-10} + q^{-8} + q^{-4} + q^{-2}\n+ q^{2} + q^{4} + q^{6} + 2 q^{8} + q^{10} + q^{12}\n+ 2 q^{14} + 2 q^{16} + q^{18} + 2 q^{20}\n+ q^{22} + q^{24} + q^{26} + q^{28} + q^{32}\n\\right)\n$

\n

and here is the polynomial with the variables:\n$a^{20}\\left(\nq^{-6} + q^{6} + q^{18} + q^{30}\n+ q^{-8 + 2(8 + x_{13})}\n+ q^{-8 + 2(9 + x_{13})}\n+ q^{-8 + 2(6 + x_{15})}\n+ q^{-8 + 2(7 + x_{15})}\n+ q^{2 x_{17}}\n+ q^{-8 + 2(5 + x_{17})}\n+ q^{2 x_{35}}\n+ q^{-8 + 2(5 + x_{35})}\n+ q^{-4 + 2 x_{37}}\n+ q^{-2 + 2 x_{37}}\n+ q^{-8 + 2 x_{57}}\n+ q^{-6 + 2 x_{57}}\n\\right)\n+\na^{18}\\left(\n- q^{14 + 2 x_{12}}\n- q^{16 + 2 x_{12}}\n- q^{10 + 2 x_{14}}\n- q^{12 + 2 x_{14}}\n- q^{6 + 2 x_{16}}\n- q^{8 + 2 x_{16}}\n- q^{-14 + 2(8 + x_{18})}\n- q^{-12 + 2(8 + x_{18})}\n- q^{-14 + 2(6 + x_{19})}\n- q^{-12 + 2(6 + x_{19})}\n- q^{10 + 2 x_{23}}\n- q^{12 + 2 x_{23}}\n- q^{6 + 2 x_{25}}\n- q^{8 + 2 x_{25}}\n- q^{-14 + 2(8 + x_{27})}\n- q^{-12 + 2(8 + x_{27})}\n- q^{6 + 2 x_{34}}\n- q^{8 + 2 x_{34}}\n- q^{-14 + 2(8 + x_{36})}\n- q^{-12 + 2(8 + x_{36})}\n- q^{-14 + 2(6 + x_{38})}\n- q^{-12 + 2(6 + x_{38})}\n- q^{-6 + 2 x_{39}}\n- q^{-4 + 2 x_{39}}\n- q^{-14 + 2(8 + x_{45})}\n- q^{-12 + 2(8 + x_{45})}\n- q^{-14 + 2(6 + x_{47})}\n- q^{-12 + 2(6 + x_{47})}\n- q^{-14 + 2(6 + x_{56})}\n- q^{-12 + 2(6 + x_{56})}\n- q^{-6 + 2 x_{58}}\n- q^{-4 + 2 x_{58}}\n- q^{-10 + 2 x_{59}}\n- q^{-8 + 2 x_{59}}\n- q^{-6 + 2 x_{67}}\n- q^{-4 + 2 x_{67}}\n- q^{-10 + 2 x_{78}}\n- q^{-8 + 2 x_{78}}\n- q^{-14 + 2 x_{79}}\n- q^{-12 + 2 x_{79}}\n\\right)\n+\na^{16}\\left(\nq^{-16} + q^{-4} + q^{8} + q^{20} + q^{32}\n+ q^{12 + 2 x_{24}}\n+ q^{14 + 2 x_{24}}\n+ q^{8 + 2 x_{26}}\n+ q^{10 + 2 x_{26}}\n+ q^{4 + 2 x_{28}}\n+ q^{6 + 2 x_{28}}\n+ q^{-16 + 2(8 + x_{29})}\n+ q^{-16 + 2(9 + x_{29})}\n+ q^{4 + 2 x_{46}}\n+ q^{6 + 2 x_{46}}\n+ q^{-16 + 2(8 + x_{48})}\n+ q^{-16 + 2(9 + x_{48})}\n+ q^{-16 + 2(6 + x_{49})}\n+ q^{-16 + 2(7 + x_{49})}\n+ q^{-16 + 2(6 + x_{68})}\n+ q^{-16 + 2(7 + x_{68})}\n+ q^{-8 + 2 x_{69}}\n+ q^{-16 + 2(5 + x_{69})}\n+ q^{-12 + 2 x_{89}}\n+ q^{-10 + 2 x_{89}}\n\\right)$

\n

There are other such equations, and the goal is to solve for $x_{ij}$. Since we don't know beforehand how to match the numerical exponents to the exponents with variables, we have to do it with combinatorics and then use the same method on the other set of equations to guarantee that we have a consistent set of solutions.

\n", "question_id": 45472, "question_license": "CC BY-SA 4.0", "question_score": 4, "question_text": "I am trying to solve a linear system of equations that comes from equating two Laurent polynomials (https://en.wikipedia.org/wiki/Laurent_polynomial). The first such polynomial has known numeric values of its exponents, while the second polynomial has the exponents depending linearly on variables we are trying to solve for.\n\n\n\n\nThey always have the same set of monomials, hence I know that the system is not trivially unsolvable. So we need to solve these linear equations, but the rub is that we don't know which equations should be allocated to which polynomial. There are a lot of these equations that come from multiple conditions, and the solutions must be consistent for all conditions.\n\n\n\n\nMy idea was to do a sort of combinatorics algorithm but I failed miserably.\nIn any case I guess that must be a problem that occurred other times, or at least something similar to it, and maybe it was already solved by someone with python, mathematica (I mainly use mathematica) or any other programming language.\n\n\n\n\nDo you guys know of any hint or solution on how to tackle these problems?\n\n\n\n\nAs an example to make things more clear. This is the purely numerical polynomial:\n$a^{20}\\left(\n1 + q^{-6} + q^{2} + q^{6} + q^{8} + q^{10} + q^{12} + q^{14} + q^{16}\n+ 2 q^{18} + q^{20} + q^{22} + q^{24} + q^{26} + q^{30}\n\\right)\n+\na^{18}\\left(\n-1 - q^{-12} - q^{-10} - q^{-6} - 2 q^{-4} - q^{-2}\n- 2 q^{2} - 2 q^{4} - 2 q^{6} - 2 q^{8} - 2 q^{10}\n- 3 q^{12} - 3 q^{14} - 2 q^{16} - 3 q^{18} - 3 q^{20}\n- 2 q^{22} - 2 q^{24} - 2 q^{26} - q^{28} - q^{30} - q^{32}\n\\right)\n+\na^{16}\\left(\n1 + q^{-16} + q^{-10} + q^{-8} + q^{-4} + q^{-2}\n+ q^{2} + q^{4} + q^{6} + 2 q^{8} + q^{10} + q^{12}\n+ 2 q^{14} + 2 q^{16} + q^{18} + 2 q^{20}\n+ q^{22} + q^{24} + q^{26} + q^{28} + q^{32}\n\\right)\n$\n\n\n\n\nand here is the polynomial with the variables:\n$a^{20}\\left(\nq^{-6} + q^{6} + q^{18} + q^{30}\n+ q^{-8 + 2(8 + x_{13})}\n+ q^{-8 + 2(9 + x_{13})}\n+ q^{-8 + 2(6 + x_{15})}\n+ q^{-8 + 2(7 + x_{15})}\n+ q^{2 x_{17}}\n+ q^{-8 + 2(5 + x_{17})}\n+ q^{2 x_{35}}\n+ q^{-8 + 2(5 + x_{35})}\n+ q^{-4 + 2 x_{37}}\n+ q^{-2 + 2 x_{37}}\n+ q^{-8 + 2 x_{57}}\n+ q^{-6 + 2 x_{57}}\n\\right)\n+\na^{18}\\left(\n- q^{14 + 2 x_{12}}\n- q^{16 + 2 x_{12}}\n- q^{10 + 2 x_{14}}\n- q^{12 + 2 x_{14}}\n- q^{6 + 2 x_{16}}\n- q^{8 + 2 x_{16}}\n- q^{-14 + 2(8 + x_{18})}\n- q^{-12 + 2(8 + x_{18})}\n- q^{-14 + 2(6 + x_{19})}\n- q^{-12 + 2(6 + x_{19})}\n- q^{10 + 2 x_{23}}\n- q^{12 + 2 x_{23}}\n- q^{6 + 2 x_{25}}\n- q^{8 + 2 x_{25}}\n- q^{-14 + 2(8 + x_{27})}\n- q^{-12 + 2(8 + x_{27})}\n- q^{6 + 2 x_{34}}\n- q^{8 + 2 x_{34}}\n- q^{-14 + 2(8 + x_{36})}\n- q^{-12 + 2(8 + x_{36})}\n- q^{-14 + 2(6 + x_{38})}\n- q^{-12 + 2(6 + x_{38})}\n- q^{-6 + 2 x_{39}}\n- q^{-4 + 2 x_{39}}\n- q^{-14 + 2(8 + x_{45})}\n- q^{-12 + 2(8 + x_{45})}\n- q^{-14 + 2(6 + x_{47})}\n- q^{-12 + 2(6 + x_{47})}\n- q^{-14 + 2(6 + x_{56})}\n- q^{-12 + 2(6 + x_{56})}\n- q^{-6 + 2 x_{58}}\n- q^{-4 + 2 x_{58}}\n- q^{-10 + 2 x_{59}}\n- q^{-8 + 2 x_{59}}\n- q^{-6 + 2 x_{67}}\n- q^{-4 + 2 x_{67}}\n- q^{-10 + 2 x_{78}}\n- q^{-8 + 2 x_{78}}\n- q^{-14 + 2 x_{79}}\n- q^{-12 + 2 x_{79}}\n\\right)\n+\na^{16}\\left(\nq^{-16} + q^{-4} + q^{8} + q^{20} + q^{32}\n+ q^{12 + 2 x_{24}}\n+ q^{14 + 2 x_{24}}\n+ q^{8 + 2 x_{26}}\n+ q^{10 + 2 x_{26}}\n+ q^{4 + 2 x_{28}}\n+ q^{6 + 2 x_{28}}\n+ q^{-16 + 2(8 + x_{29})}\n+ q^{-16 + 2(9 + x_{29})}\n+ q^{4 + 2 x_{46}}\n+ q^{6 + 2 x_{46}}\n+ q^{-16 + 2(8 + x_{48})}\n+ q^{-16 + 2(9 + x_{48})}\n+ q^{-16 + 2(6 + x_{49})}\n+ q^{-16 + 2(7 + x_{49})}\n+ q^{-16 + 2(6 + x_{68})}\n+ q^{-16 + 2(7 + x_{68})}\n+ q^{-8 + 2 x_{69}}\n+ q^{-16 + 2(5 + x_{69})}\n+ q^{-12 + 2 x_{89}}\n+ q^{-10 + 2 x_{89}}\n\\right)$\n\n\n\n\nThere are other such equations, and the goal is to solve for $x_{ij}$. Since we don't know beforehand how to match the numerical exponents to the exponents with variables, we have to do it with combinatorics and then use the same method on the other set of equations to guarantee that we have a consistent set of solutions.", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "ateixeira82", "profile_url": "https://scicomp.stackexchange.com/users/56972/ateixeira82", "user_type": "registered"}, "created_at": "2026-06-21T10:31:05+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "F5FC1979-2C80-415C-8F46-2AF9C62D8214", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/F5FC1979-2C80-415C-8F46-2AF9C62D8214/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "ateixeira82", "profile_url": "https://scicomp.stackexchange.com/users/56972/ateixeira82", "user_type": "registered"}, "created_at": "2026-06-21T14:46:19+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "53FB132D-482A-4B58-AD12-EF8D7216467C", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/53FB132D-482A-4B58-AD12-EF8D7216467C/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "hardmath", "profile_url": "https://scicomp.stackexchange.com/users/651/hardmath", "user_type": "moderator"}, "created_at": "2026-06-24T19:16:29+00:00", "raw_file": "raw/codex_api_v1/09cbe10ae05462240864407122b451f89c4541eb0ee757adda70c0629772d57a_1790825351806992800_0.json", "raw_sha256": "34f3f34325937951c51090d8305fb513e1e88ef2ed40dcec5c0fe96d5710ba75", "revision_guid": "41EC7BF5-D5F7-4405-918D-9C3797D59DDE", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/41EC7BF5-D5F7-4405-918D-9C3797D59DDE/view-source"}], "source_site": "scicomp", "source_url": "https://scicomp.stackexchange.com/questions/45472/solving-linear-system-of-equations-with-combinatorics", "split": "train", "split_group": "bc3b4da5bdff031e2377bca4a34351252b5b5eb37044f7ea6ace3a407e2df29e", "tags": ["python", "linear-system", "mathematica", "combinatorics"], "thread_id": "scicomp:45472", "title": "Solving linear system of equations with combinatorics"}} {"accepted_status": [false, false], "candidate_answers": [{"answer_html": "

Globally, for a system of size $n$, the LU factorisation is built with $O(n^3)$ floating point operations, and each linear solve with it requires two $O(n^2)$ triangular solve.

\n

Each Jacobi iteration is $O(n^2)$ (but with a lower factor) or potentially $O(n)$ for sparse matrices. However it is an iterative method, hence this cost is to be multiplied by the (unknown) number of iterations required, assuming that the algorithm converges.

\n

I am not sure how you could be more precise in the estimation of the complexity without more specific knowledge of the algorithmic details. Also the number of linear solves is important, since the initial decomposition may dominate the computational time.

\n", "answer_id": 45481, "answer_text": "Globally, for a system of size $n$, the LU factorisation is built with $O(n^3)$ floating point operations, and each linear solve with it requires two $O(n^2)$ triangular solve.\n\n\n\n\nEach Jacobi iteration is $O(n^2)$ (but with a lower factor) or potentially $O(n)$ for sparse matrices. However it is an iterative method, hence this cost is to be multiplied by the (unknown) number of iterations required, assuming that the algorithm converges.\n\n\n\n\nI am not sure how you could be more precise in the estimation of the complexity without more specific knowledge of the algorithmic details. Also the number of linear solves is important, since the initial decomposition may dominate the computational time.", "answer_url": "https://scicomp.stackexchange.com/a/45481", "author": "Laurent90", "author_url": "https://scicomp.stackexchange.com/users/37494/laurent90", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-06-27T17:14:54+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45479, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Laurent90", "profile_url": "https://scicomp.stackexchange.com/users/37494/laurent90", "user_type": "registered"}, "created_at": "2026-06-27T17:14:54+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "F965F514-F6CE-47E8-8158-0212FF152F27", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/F965F514-F6CE-47E8-8158-0212FF152F27/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Laurent90", "profile_url": "https://scicomp.stackexchange.com/users/37494/laurent90", "user_type": "registered"}, "created_at": "2026-06-28T15:17:20+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "1E147392-BD31-46EC-A189-8A7E3EFA258B", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/1E147392-BD31-46EC-A189-8A7E3EFA258B/view-source"}], "score": 4, "updated_at": "2026-06-28T15:17:20+00:00"}, {"answer_html": "

The question is not easy to answer. At least conceptually, one can compute a sparse decomposition of the matrix resulting from 2d discretizations in $O(n^{3/2})$ operations. That's not so bad. On the other hand, the Jacobi iteration is a pretty terrible method; in fact, Jacobi is so bad that even a conjugate gradient method with a Jacobi preconditioner is terrible. That's because for a 5-point stencil, all diagonal entries corresponding to interior nodes have the same value, and so the inverse of the diagonal is more or less equal to the inverse of the identity matrix. You really don't gain anything this way over the Richardson iteration. I don't recall what the computational complexity of that method is, but it's certainly not better than $O(n^{3/2})$ and likely worse.

\n

In practice, for 2d problems with less than $n=100,000$ or 200,000 unknowns, good sparse direct solvers beat pretty much every iterative method you can come up with.

\n", "answer_id": 45484, "answer_text": "The question is not easy to answer. At least conceptually, one can compute a sparse decomposition of the matrix resulting from 2d discretizations in $O(n^{3/2})$ operations. That's not so bad. On the other hand, the Jacobi iteration is a pretty terrible method; in fact, Jacobi is so bad that even a conjugate gradient method with a Jacobi preconditioner is terrible. That's because for a 5-point stencil, all diagonal entries corresponding to interior nodes have the same value, and so the inverse of the diagonal is more or less equal to the inverse of the identity matrix. You really don't gain anything this way over the Richardson iteration. I don't recall what the computational complexity of that method is, but it's certainly not better than $O(n^{3/2})$ and likely worse.\n\n\n\n\nIn practice, for 2d problems with less than $n=100,000$ or 200,000 unknowns, good sparse direct solvers beat pretty much every iterative method you can come up with.", "answer_url": "https://scicomp.stackexchange.com/a/45484", "author": "Wolfgang Bangerth", "author_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-06-29T20:03:17+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45479, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Wolfgang Bangerth", "profile_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "user_type": "registered"}, "created_at": "2026-06-29T20:03:17+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "BB295034-75D5-4DB9-BAAA-1C320CD49E39", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/BB295034-75D5-4DB9-BAAA-1C320CD49E39/view-source"}], "score": 4, "updated_at": "2026-06-29T20:03:17+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I'm solving the incompressible Navier-Stokes equations using a fractional-step (Chorin projection) method on a uniform 2D Cartesian grid of size $N \\times N$ (so $n = N^2$ total pressure unknowns). The pressure Poisson equation at each timestep is:\n\n\n\n\n$$\\nabla^2 p = \\frac{\\rho}{\\Delta t} \\nabla \\cdot \\mathbf{u}^*$$\n\n\n\n\ndiscretised with the standard 5-point finite difference stencil, giving a sparse linear system $A\\mathbf{p} = \\mathbf{b}$.\n\n\n\n\n\n\n\nMy two solvers\n\n\n\n\nDirect (sparse LU): I pre-factorise $A = LU$ once before the time loop using scipy.sparse.linalg.splu with MMD_AT_PLUS_A reordering, then call lu.solve(b) at every timestep.\n\n\n\n\nJacobi iteration: At every timestep I run Jacobi sweeps to convergence (tolerance $10^{-4}$ on the relative pressure update), warm-starting from the previous timestep's solution.\n\n\n\n\n\n\n\nHow would I go about finding the computational complexities of these two methods, in big O notation?", "record_id": "Scientific-Answer-Ranking:scicomp:45479", "scores": [4, 4], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

Globally, for a system of size $n$, the LU factorisation is built with $O(n^3)$ floating point operations, and each linear solve with it requires two $O(n^2)$ triangular solve.

\n

Each Jacobi iteration is $O(n^2)$ (but with a lower factor) or potentially $O(n)$ for sparse matrices. However it is an iterative method, hence this cost is to be multiplied by the (unknown) number of iterations required, assuming that the algorithm converges.

\n

I am not sure how you could be more precise in the estimation of the complexity without more specific knowledge of the algorithmic details. Also the number of linear solves is important, since the initial decomposition may dominate the computational time.

\n", "answer_id": 45481, "answer_text": "Globally, for a system of size $n$, the LU factorisation is built with $O(n^3)$ floating point operations, and each linear solve with it requires two $O(n^2)$ triangular solve.\n\n\n\n\nEach Jacobi iteration is $O(n^2)$ (but with a lower factor) or potentially $O(n)$ for sparse matrices. However it is an iterative method, hence this cost is to be multiplied by the (unknown) number of iterations required, assuming that the algorithm converges.\n\n\n\n\nI am not sure how you could be more precise in the estimation of the complexity without more specific knowledge of the algorithmic details. Also the number of linear solves is important, since the initial decomposition may dominate the computational time.", "answer_url": "https://scicomp.stackexchange.com/a/45481", "author": "Laurent90", "author_url": "https://scicomp.stackexchange.com/users/37494/laurent90", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-06-27T17:14:54+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45479, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Laurent90", "profile_url": "https://scicomp.stackexchange.com/users/37494/laurent90", "user_type": "registered"}, "created_at": "2026-06-27T17:14:54+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "F965F514-F6CE-47E8-8158-0212FF152F27", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/F965F514-F6CE-47E8-8158-0212FF152F27/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Laurent90", "profile_url": "https://scicomp.stackexchange.com/users/37494/laurent90", "user_type": "registered"}, "created_at": "2026-06-28T15:17:20+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "1E147392-BD31-46EC-A189-8A7E3EFA258B", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/1E147392-BD31-46EC-A189-8A7E3EFA258B/view-source"}], "score": 4, "updated_at": "2026-06-28T15:17:20+00:00"}, {"answer_html": "

The question is not easy to answer. At least conceptually, one can compute a sparse decomposition of the matrix resulting from 2d discretizations in $O(n^{3/2})$ operations. That's not so bad. On the other hand, the Jacobi iteration is a pretty terrible method; in fact, Jacobi is so bad that even a conjugate gradient method with a Jacobi preconditioner is terrible. That's because for a 5-point stencil, all diagonal entries corresponding to interior nodes have the same value, and so the inverse of the diagonal is more or less equal to the inverse of the identity matrix. You really don't gain anything this way over the Richardson iteration. I don't recall what the computational complexity of that method is, but it's certainly not better than $O(n^{3/2})$ and likely worse.

\n

In practice, for 2d problems with less than $n=100,000$ or 200,000 unknowns, good sparse direct solvers beat pretty much every iterative method you can come up with.

\n", "answer_id": 45484, "answer_text": "The question is not easy to answer. At least conceptually, one can compute a sparse decomposition of the matrix resulting from 2d discretizations in $O(n^{3/2})$ operations. That's not so bad. On the other hand, the Jacobi iteration is a pretty terrible method; in fact, Jacobi is so bad that even a conjugate gradient method with a Jacobi preconditioner is terrible. That's because for a 5-point stencil, all diagonal entries corresponding to interior nodes have the same value, and so the inverse of the diagonal is more or less equal to the inverse of the identity matrix. You really don't gain anything this way over the Richardson iteration. I don't recall what the computational complexity of that method is, but it's certainly not better than $O(n^{3/2})$ and likely worse.\n\n\n\n\nIn practice, for 2d problems with less than $n=100,000$ or 200,000 unknowns, good sparse direct solvers beat pretty much every iterative method you can come up with.", "answer_url": "https://scicomp.stackexchange.com/a/45484", "author": "Wolfgang Bangerth", "author_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-06-29T20:03:17+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45479, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Wolfgang Bangerth", "profile_url": "https://scicomp.stackexchange.com/users/393/wolfgang-bangerth", "user_type": "registered"}, "created_at": "2026-06-29T20:03:17+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "BB295034-75D5-4DB9-BAAA-1C320CD49E39", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/BB295034-75D5-4DB9-BAAA-1C320CD49E39/view-source"}], "score": 4, "updated_at": "2026-06-29T20:03:17+00:00"}], "domain": "computational_science", "external_links": [], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:44.584971+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/272744bcc95b58699f7df6e6979b288bb8b00a80ab9c7982dbe170a6d0b63584_1790825325025901700_0.json", "raw_sha256": "27a81850a40920682c29ada76a2b55e80340a5c82764a3e9dde8a9c2ba23db4e", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Hamza Hussian", "question_author_url": "https://scicomp.stackexchange.com/users/56815/hamza-hussian", "question_author_user_type": "registered", "question_created_at": "2026-06-26T20:46:22+00:00", "question_html": "

I'm solving the incompressible Navier-Stokes equations using a fractional-step (Chorin projection) method on a uniform 2D Cartesian grid of size $N \\times N$ (so $n = N^2$ total pressure unknowns). The pressure Poisson equation at each timestep is:

\n

$$\\nabla^2 p = \\frac{\\rho}{\\Delta t} \\nabla \\cdot \\mathbf{u}^*$$

\n

discretised with the standard 5-point finite difference stencil, giving a sparse linear system $A\\mathbf{p} = \\mathbf{b}$.

\n
\n

My two solvers

\n

Direct (sparse LU): I pre-factorise $A = LU$ once before the time loop using scipy.sparse.linalg.splu with MMD_AT_PLUS_A reordering, then call lu.solve(b) at every timestep.

\n

Jacobi iteration: At every timestep I run Jacobi sweeps to convergence (tolerance $10^{-4}$ on the relative pressure update), warm-starting from the previous timestep's solution.

\n
\n

How would I go about finding the computational complexities of these two methods, in big O notation?

\n", "question_id": 45479, "question_license": "CC BY-SA 4.0", "question_score": 2, "question_text": "I'm solving the incompressible Navier-Stokes equations using a fractional-step (Chorin projection) method on a uniform 2D Cartesian grid of size $N \\times N$ (so $n = N^2$ total pressure unknowns). The pressure Poisson equation at each timestep is:\n\n\n\n\n$$\\nabla^2 p = \\frac{\\rho}{\\Delta t} \\nabla \\cdot \\mathbf{u}^*$$\n\n\n\n\ndiscretised with the standard 5-point finite difference stencil, giving a sparse linear system $A\\mathbf{p} = \\mathbf{b}$.\n\n\n\n\n\n\n\nMy two solvers\n\n\n\n\nDirect (sparse LU): I pre-factorise $A = LU$ once before the time loop using scipy.sparse.linalg.splu with MMD_AT_PLUS_A reordering, then call lu.solve(b) at every timestep.\n\n\n\n\nJacobi iteration: At every timestep I run Jacobi sweeps to convergence (tolerance $10^{-4}$ on the relative pressure update), warm-starting from the previous timestep's solution.\n\n\n\n\n\n\n\nHow would I go about finding the computational complexities of these two methods, in big O notation?", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Hamza Hussian", "profile_url": "https://scicomp.stackexchange.com/users/56815/hamza-hussian", "user_type": "registered"}, "created_at": "2026-06-26T20:46:22+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "FE235592-46C5-41C4-89E9-D73175BEA130", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/FE235592-46C5-41C4-89E9-D73175BEA130/view-source"}], "source_site": "scicomp", "source_url": "https://scicomp.stackexchange.com/questions/45479/what-is-the-computational-complexity-of-lu-decomposition-vs-jacobi-iteration-for", "split": "train", "split_group": "0eeae0e73c3e91df419eb56476cdcef702591171c82fdcc358fb2dd187504374", "tags": ["fluid-dynamics", "sparse-matrix", "iterative-method", "matrix-factorization"], "thread_id": "scicomp:45479", "title": "What is the computational complexity of LU decomposition vs Jacobi iteration for the pressure Poisson equation in a 2D CFD projection method?"}} {"accepted_status": [false, false, true], "candidate_answers": [{"answer_html": "

From my eye, the biggest issue is that your timestep is simply too large. Decrease it, either explicitly or by allowing an adaptive-timestep method to meet a specified tolerance. You can see that, for your existing code (repaired to actually be able to run) and a timestep ten times more fine, the methods are closer:

\n
import matplotlib.pyplot as plt\nimport numpy as np\n\nG = 4 * np.pi**2\nM_sun = 1     # masse solaire\nn_steps = 300\n\n\ndef euler_function(x_earth: float = 1.5, y_earth: float = 0.,\n                   vx_earth: float = 0., vy_earth: float = 2*np.pi,\n                   dt: float = 0.1) -> tuple[list, list]:\n    xpos = []\n    ypos = []\n\n    for i in range(n_steps):\n        ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n        ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n        vx_earth += ax_earth * dt\n        vy_earth += ay_earth * dt\n\n        xpos.append(x_earth)\n        ypos.append(y_earth)\n\n        x_earth += vx_earth * dt\n        y_earth += vy_earth * dt\n\n    return xpos, ypos\n\n\ndef runge_kutta_function(x_earth: float = 1.5, y_earth: float = 0.,\n                   vx_earth: float = 0., vy_earth: float = 2*np.pi,\n                   dt: float = 0.1) -> tuple[list, list]:\n    xpos = []\n    ypos = []\n\n    for i in range(n_steps):\n        ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n        ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n        x_earth_mid = x_earth + vx_earth * (dt / 2)\n        y_earth_mid = y_earth + vy_earth * (dt / 2)\n\n        vx_earth_mid = vx_earth + ax_earth * (dt / 2)\n        vy_earth_mid = vy_earth + ay_earth * (dt / 2)\n\n        ax_earth_mid = -(G * M_sun) * x_earth_mid / ((x_earth_mid**2 + y_earth_mid**2)**0.5)**3\n        ay_earth_mid = -(G * M_sun) * y_earth_mid / ((x_earth_mid**2 + y_earth_mid**2)**0.5)**3\n\n        vx_earth += ax_earth_mid * dt\n        vy_earth += ay_earth_mid * dt\n\n        xpos.append(x_earth)\n        ypos.append(y_earth)\n\n        x_earth += vx_earth_mid * dt\n        y_earth += vy_earth_mid * dt\n\n    return xpos, ypos\n\n\ndef verlet_function(x_earth: float = 1.5, y_earth: float = 0.,\n                   vx_earth: float = 0., vy_earth: float = 2*np.pi,\n                   dt: float = 0.1) -> tuple[list, list]:\n    xpos = []\n    ypos = []\n\n    for i in range(n_steps):\n        ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n        ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n        xpos.append(x_earth)\n        ypos.append(y_earth)\n\n        x_earth += vx_earth * dt + ax_earth * (dt / 2)**2\n        y_earth += vy_earth * dt + ay_earth * (dt / 2)**2\n\n        ax_earth_mid = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n        ay_earth_mid = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n        vx_earth += ((ax_earth_mid + ax_earth) / 2) * dt\n        vy_earth += ((ay_earth_mid + ay_earth) / 2) * dt\n\n    return xpos, ypos\n\n\ndef main() -> None:\n    fig, ax = plt.subplots()\n    for method, name in (\n        (euler_function, 'Euler'),\n        (runge_kutta_function, 'RK2'),\n        (verlet_function, 'Verlet'),\n    ):\n        x, y = method(dt=0.01)\n        ax.plot(x, y, label=name)\n    ax.legend()\n    plt.show()\n\n\nif __name__ == '__main__':\n    main()\n
\n

\"comparison\"

\n

For n=5000, dt=0.001, the output is closer yet:

\n

\"dt=0.001\"

\n

Obviously there are different IVP methods that can do even better per iteration. For instance, the Bogacki-Shampine form of Runge-Kutta order 3(2) is extremely stable for this application; shown over 1000 years:

\n
import numpy as np\nimport matplotlib.pyplot as plt\nimport scipy.integrate\n\nG = 4 * np.pi**2\nM_sun = 1     # masse solaire\n\ndef ddt(t: float, state: np.ndarray) -> np.ndarray:\n    p, v = np.split(state, 2)\n    a = -G * M_sun / np.linalg.norm(p)**3 * p\n    return np.concat((v, a))\n\n\ndef d2dt2(t: float, state: np.ndarray) -> np.ndarray:\n    p, v = np.split(state, 2)\n\n    # The Jacobian matrix has shape (n, n) and its element (i, j) is equal to d f_i / d y_j\n    x, y = p\n    fnorm5 = -G*M_sun/np.linalg.norm(p)**5\n    daxdpx = fnorm5*(y**2 - 2*x**2)\n    daydpy = fnorm5*(x**2 - 2*y**2)\n    daxdpy = fnorm5*-3*x*y\n    daydpx = daxdpy\n    jac = np.array((\n        #  /dpx    /dpy /dvx /dvy\n        (     0,      0,   1,   0), # dvx\n        (     0,      0,   0,   1), # dvy\n        (daxdpx, daxdpy,   0,   0), # dax\n        (daydpx, daydpy,   0,   0), # day\n    ))\n\n    return jac\n\n\nout = scipy.integrate.solve_ivp(\n    method='RK23', fun=ddt, rtol=1e-5, dense_output=True,\n    # jac=d2dt2,  # not used by Runge-Kutta\n    t_span=(0, 1000),  # Année\n    y0=(\n        1.5, 0,      # UA\n        0, 2*np.pi,  # UA/Année\n    ),\n)\n\nassert out.success, out.message\nplt.plot(*out.y[:2])\nplt.show()\n
\n

\"RK32\"

\n", "answer_id": 45490, "answer_text": "From my eye, the biggest issue is that your timestep is simply too large. Decrease it, either explicitly or by allowing an adaptive-timestep method to meet a specified tolerance. You can see that, for your existing code (repaired to actually be able to run) and a timestep ten times more fine, the methods are closer:\n\n\n\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nG = 4 * np.pi**2\nM_sun = 1 # masse solaire\nn_steps = 300\n\n\ndef euler_function(x_earth: float = 1.5, y_earth: float = 0.,\n vx_earth: float = 0., vy_earth: float = 2*np.pi,\n dt: float = 0.1) -> tuple[list, list]:\n xpos = []\n ypos = []\n\n for i in range(n_steps):\n ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n vx_earth += ax_earth * dt\n vy_earth += ay_earth * dt\n\n xpos.append(x_earth)\n ypos.append(y_earth)\n\n x_earth += vx_earth * dt\n y_earth += vy_earth * dt\n\n return xpos, ypos\n\n\ndef runge_kutta_function(x_earth: float = 1.5, y_earth: float = 0.,\n vx_earth: float = 0., vy_earth: float = 2*np.pi,\n dt: float = 0.1) -> tuple[list, list]:\n xpos = []\n ypos = []\n\n for i in range(n_steps):\n ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n x_earth_mid = x_earth + vx_earth * (dt / 2)\n y_earth_mid = y_earth + vy_earth * (dt / 2)\n\n vx_earth_mid = vx_earth + ax_earth * (dt / 2)\n vy_earth_mid = vy_earth + ay_earth * (dt / 2)\n\n ax_earth_mid = -(G * M_sun) * x_earth_mid / ((x_earth_mid**2 + y_earth_mid**2)**0.5)**3\n ay_earth_mid = -(G * M_sun) * y_earth_mid / ((x_earth_mid**2 + y_earth_mid**2)**0.5)**3\n\n vx_earth += ax_earth_mid * dt\n vy_earth += ay_earth_mid * dt\n\n xpos.append(x_earth)\n ypos.append(y_earth)\n\n x_earth += vx_earth_mid * dt\n y_earth += vy_earth_mid * dt\n\n return xpos, ypos\n\n\ndef verlet_function(x_earth: float = 1.5, y_earth: float = 0.,\n vx_earth: float = 0., vy_earth: float = 2*np.pi,\n dt: float = 0.1) -> tuple[list, list]:\n xpos = []\n ypos = []\n\n for i in range(n_steps):\n ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n xpos.append(x_earth)\n ypos.append(y_earth)\n\n x_earth += vx_earth * dt + ax_earth * (dt / 2)**2\n y_earth += vy_earth * dt + ay_earth * (dt / 2)**2\n\n ax_earth_mid = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n ay_earth_mid = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n vx_earth += ((ax_earth_mid + ax_earth) / 2) * dt\n vy_earth += ((ay_earth_mid + ay_earth) / 2) * dt\n\n return xpos, ypos\n\n\ndef main() -> None:\n fig, ax = plt.subplots()\n for method, name in (\n (euler_function, 'Euler'),\n (runge_kutta_function, 'RK2'),\n (verlet_function, 'Verlet'),\n ):\n x, y = method(dt=0.01)\n ax.plot(x, y, label=name)\n ax.legend()\n plt.show()\n\n\nif __name__ == '__main__':\n main()\n\n\n\n\n\n[image: comparison; source: https://i.sstatic.net/ZOXbZlmS.png] (https://i.sstatic.net/ZOXbZlmS.png)\n\n\n\n\nFor n=5000, dt=0.001, the output is closer yet:\n\n\n\n\n[image: dt=0.001; source: https://i.sstatic.net/mLRffKQD.png] (https://i.sstatic.net/mLRffKQD.png)\n\n\n\n\nObviously there are different IVP methods that can do even better per iteration. For instance, the Bogacki-Shampine (https://www.sciencedirect.com/science/article/pii/0893965989900797) form of Runge-Kutta order 3(2) is extremely stable for this application; shown over 1000 years:\n\n\n\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport scipy.integrate\n\nG = 4 * np.pi**2\nM_sun = 1 # masse solaire\n\ndef ddt(t: float, state: np.ndarray) -> np.ndarray:\n p, v = np.split(state, 2)\n a = -G * M_sun / np.linalg.norm(p)**3 * p\n return np.concat((v, a))\n\n\ndef d2dt2(t: float, state: np.ndarray) -> np.ndarray:\n p, v = np.split(state, 2)\n\n # The Jacobian matrix has shape (n, n) and its element (i, j) is equal to d f_i / d y_j\n x, y = p\n fnorm5 = -G*M_sun/np.linalg.norm(p)**5\n daxdpx = fnorm5*(y**2 - 2*x**2)\n daydpy = fnorm5*(x**2 - 2*y**2)\n daxdpy = fnorm5*-3*x*y\n daydpx = daxdpy\n jac = np.array((\n # /dpx /dpy /dvx /dvy\n ( 0, 0, 1, 0), # dvx\n ( 0, 0, 0, 1), # dvy\n (daxdpx, daxdpy, 0, 0), # dax\n (daydpx, daydpy, 0, 0), # day\n ))\n\n return jac\n\n\nout = scipy.integrate.solve_ivp(\n method='RK23', fun=ddt, rtol=1e-5, dense_output=True,\n # jac=d2dt2, # not used by Runge-Kutta\n t_span=(0, 1000), # Année\n y0=(\n 1.5, 0, # UA\n 0, 2*np.pi, # UA/Année\n ),\n)\n\nassert out.success, out.message\nplt.plot(*out.y[:2])\nplt.show()\n\n\n\n\n\n[image: RK32; source: https://i.sstatic.net/DgMDrx4E.png] (https://i.sstatic.net/DgMDrx4E.png)", "answer_url": "https://scicomp.stackexchange.com/a/45490", "author": "Reinderien", "author_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-07-13T01:47:13+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45487, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Reinderien", "profile_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "user_type": "registered"}, "created_at": "2026-07-13T01:47:13+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "06EC415F-DC78-49A5-97D0-ED020CE6C74F", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/06EC415F-DC78-49A5-97D0-ED020CE6C74F/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Reinderien", "profile_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "user_type": "registered"}, "created_at": "2026-07-13T03:28:27+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "88B016CA-5B2E-46C7-99DA-7F374A3A0853", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/88B016CA-5B2E-46C7-99DA-7F374A3A0853/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Reinderien", "profile_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "user_type": "registered"}, "created_at": "2026-07-13T21:27:38+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "51F9060A-E0B8-4FC6-AAA1-D61ED8331962", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/51F9060A-E0B8-4FC6-AAA1-D61ED8331962/view-source"}], "score": 6, "updated_at": "2026-07-13T21:27:38+00:00"}, {"answer_html": "

When comparing numerical methods, we usually look up the order of the method (i.e. the upper bound of how the errors scale). This is only a very broad description of what is happening.

\n

Each method may have its own biases of how this error occurs and how it reflects in the different metrics you are interested in. For orbital mechanics you may be interested in that the method preserves the kinetic and potential energies of the bodies, while the exact spatial position is of low interest (or vice versa). Also, the order of the error makes no statement about the absoulte size of the error!

\n

What you could do is to verify if the errors of each implementation of your methods actually scale the way you expect them to, by plotting the absolute error of each method after a few timesteps under different refinements. If you are confident the scaling is right (strong, but not sufficient signal for correct implementation), then you can dig deeper into it:-)

\n

From the top of my head orbital mechanics are often solved with implicit euler-like methods "symplectic integrators", because they preserve energy and impulse better, but my memory may be leaky.

\n", "answer_id": 45491, "answer_text": "When comparing numerical methods, we usually look up the order of the method (i.e. the upper bound of how the errors scale). This is only a very broad description of what is happening.\n\n\n\n\nEach method may have its own biases of how this error occurs and how it reflects in the different metrics you are interested in. For orbital mechanics you may be interested in that the method preserves the kinetic and potential energies of the bodies, while the exact spatial position is of low interest (or vice versa). Also, the order of the error makes no statement about the absoulte size of the error!\n\n\n\n\nWhat you could do is to verify if the errors of each implementation of your methods actually scale the way you expect them to, by plotting the absolute error of each method after a few timesteps under different refinements. If you are confident the scaling is right (strong, but not sufficient signal for correct implementation), then you can dig deeper into it:-)\n\n\n\n\nFrom the top of my head orbital mechanics are often solved with implicit euler-like methods \"symplectic integrators\", because they preserve energy and impulse better, but my memory may be leaky.", "answer_url": "https://scicomp.stackexchange.com/a/45491", "author": "MPIchael", "author_url": "https://scicomp.stackexchange.com/users/28636/mpichael", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-07-13T06:50:20+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45487, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "MPIchael", "profile_url": "https://scicomp.stackexchange.com/users/28636/mpichael", "user_type": "registered"}, "created_at": "2026-07-13T06:50:20+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "6AC38EDB-7E81-4D4A-9023-CF4D31E3AB6E", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/6AC38EDB-7E81-4D4A-9023-CF4D31E3AB6E/view-source"}], "score": 7, "updated_at": "2026-07-13T06:50:20+00:00"}, {"answer_html": "

The answer was ultimately provided in a comment, so I'll reproduce it here for the benefit of future readers.

\n

In fact, I realized that I was updating the velocity before the position. This means I was not implementing the standard (explicit) Euler method, but the symplectic Euler (also known as semi-implicit Euler) method.

\n

For anyone interested, here is the corresponding Wikipedia article:\nhttps://en.wikipedia.org/wiki/Semi-implicit_Euler_method

\n

And here is an excellent video explaining the method:\nhttps://youtu.be/nCg3aXn5F3M?si=2dt1c9v5bBPWWuT6

\n

The original comment was:

\n
\n

Congratulations, you rediscovered the symplectic Euler method—a common outcome when the Euler step is implemented incorrectly for kinematic systems. As a result, your Euler and Verlet methods differ only by terms of order ( \\Delta t^2 ).

\n

Your RK2 implementation is not actually a second-order Runge–Kutta method, since it contains the same mistake that turned your Euler implementation into the symplectic Euler method.

\n

My advice is to implement numerical integrators for general first-order systems, and then express the kinematic equations as a first-order system as well. This approach also makes it clear that symplectic integrators are specialized methods designed specifically for Hamiltonian (or kinematic) systems.

\n
\n", "answer_id": 45503, "answer_text": "The answer was ultimately provided in a comment, so I'll reproduce it here for the benefit of future readers.\n\n\n\n\nIn fact, I realized that I was updating the velocity before the position. This means I was not implementing the standard (explicit) Euler method, but the symplectic Euler (also known as semi-implicit Euler) method.\n\n\n\n\nFor anyone interested, here is the corresponding Wikipedia article:\nhttps://en.wikipedia.org/wiki/Semi-implicit_Euler_method (https://en.wikipedia.org/wiki/Semi-implicit_Euler_method)\n\n\n\n\nAnd here is an excellent video explaining the method:\nhttps://youtu.be/nCg3aXn5F3M?si=2dt1c9v5bBPWWuT6 (https://youtu.be/nCg3aXn5F3M?si=2dt1c9v5bBPWWuT6)\n\n\n\n\nThe original comment was:\n\n\n\n\n\n\n\nCongratulations, you rediscovered the symplectic Euler method—a common outcome when the Euler step is implemented incorrectly for kinematic systems. As a result, your Euler and Verlet methods differ only by terms of order ( \\Delta t^2 ).\n\n\n\n\nYour RK2 implementation is not actually a second-order Runge–Kutta method, since it contains the same mistake that turned your Euler implementation into the symplectic Euler method.\n\n\n\n\nMy advice is to implement numerical integrators for general first-order systems, and then express the kinematic equations as a first-order system as well. This approach also makes it clear that symplectic integrators are specialized methods designed specifically for Hamiltonian (or kinematic) systems.", "answer_url": "https://scicomp.stackexchange.com/a/45503", "author": "Omar Osman Mahamoud", "author_url": "https://scicomp.stackexchange.com/users/57039/omar-osman-mahamoud", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-07-29T16:42:27+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45487, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Omar Osman Mahamoud", "profile_url": "https://scicomp.stackexchange.com/users/57039/omar-osman-mahamoud", "user_type": "registered"}, "created_at": "2026-07-29T16:42:27+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "DD32D002-9E3F-4398-BC22-FB7FBF667951", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/DD32D002-9E3F-4398-BC22-FB7FBF667951/view-source"}], "score": 2, "updated_at": "2026-07-29T16:42:27+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I'm simulating the Earth's orbit around the Sun using three different numerical integration methods: Euler, RK2 (midpoint), and Velocity Verlet. Since RK2 and Velocity Verlet are higher-order methods, I expected them to produce more accurate trajectories than Euler when using the same initial conditions and time step.\n\n\n\n\nHowever, in my simulation, the opposite seems to happen: the RK2 and Velocity Verlet trajectories appear less accurate than the Euler trajectory.\n\n\n\n\nI've checked the implementations several times but I can't find any obvious mistakes. Could someone point out whether I've implemented one of these methods incorrectly or explain why this behavior might occur?\n\n\n\n\nHere are the three implementations.\n\n\n\n\ndef euler_function(\n x_earth, y_earth, vx_earth, vy_earth, dt\n):\n\n for i in range(n_steps):\n ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n vx_earth += ax_earth * dt\n vy_earth += ay_earth * dt\n\n xpos.append(x_earth)\n ypos.append(y_earth)\n\n x_earth += vx_earth * dt\n y_earth += vy_earth * dt\n\n return xpos, ypos\n\n\n\n\n\ndef Runge_kutta_function(\n x_earth, y_earth, vx_earth, vy_earth, dt\n):\n\n for i in range(n_steps):\n\n ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n x_earth_mid = x_earth + vx_earth * (dt / 2)\n y_earth_mid = y_earth + vy_earth * (dt / 2)\n\n vx_earth_mid = vx_earth + ax_earth * (dt / 2)\n vy_earth_mid = vy_earth + ay_earth * (dt / 2)\n\n ax_earth_mid = -(G * M_sun) * x_earth_mid / ((x_earth_mid**2 + y_earth_mid**2)**0.5)**3\n ay_earth_mid = -(G * M_sun) * y_earth_mid / ((x_earth_mid**2 + y_earth_mid**2)**0.5)**3\n\n vx_earth += ax_earth_mid * dt\n vy_earth += ay_earth_mid * dt\n\n xpos.append(x_earth)\n ypos.append(y_earth)\n\n x_earth += vx_earth_mid * dt\n y_earth += vy_earth_mid * dt\n\n return xpos, ypos\n\n\n\n\n\ndef Verlet_function(\n x_earth, y_earth, vx_earth, vy_earth, dt\n):\n\n for i in range(n_steps):\n\n ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n xpos.append(x_earth)\n ypos.append(y_earth)\n\n x_earth += vx_earth * dt + ax_earth * (dt / 2)**2\n y_earth += vy_earth * dt + ay_earth * (dt / 2)**2\n\n ax_earth_mid = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n ay_earth_mid = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n vx_earth += ((ax_earth_mid + ax_earth) / 2) * dt\n vy_earth += ((ay_earth_mid + ay_earth) / 2) * dt\n\n return xpos, ypos\n\n\n\n\n\nWhat am I missing? Is there an error in one (or more) of these implementations, or is there another reason why RK2 and Velocity Verlet would appear less accurate than Euler?", "record_id": "Scientific-Answer-Ranking:scicomp:45487", "scores": [6, 7, 2], "split": "train", "thread": {"accepted_answer_id": 45503, "answers": [{"answer_html": "

From my eye, the biggest issue is that your timestep is simply too large. Decrease it, either explicitly or by allowing an adaptive-timestep method to meet a specified tolerance. You can see that, for your existing code (repaired to actually be able to run) and a timestep ten times more fine, the methods are closer:

\n
import matplotlib.pyplot as plt\nimport numpy as np\n\nG = 4 * np.pi**2\nM_sun = 1     # masse solaire\nn_steps = 300\n\n\ndef euler_function(x_earth: float = 1.5, y_earth: float = 0.,\n                   vx_earth: float = 0., vy_earth: float = 2*np.pi,\n                   dt: float = 0.1) -> tuple[list, list]:\n    xpos = []\n    ypos = []\n\n    for i in range(n_steps):\n        ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n        ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n        vx_earth += ax_earth * dt\n        vy_earth += ay_earth * dt\n\n        xpos.append(x_earth)\n        ypos.append(y_earth)\n\n        x_earth += vx_earth * dt\n        y_earth += vy_earth * dt\n\n    return xpos, ypos\n\n\ndef runge_kutta_function(x_earth: float = 1.5, y_earth: float = 0.,\n                   vx_earth: float = 0., vy_earth: float = 2*np.pi,\n                   dt: float = 0.1) -> tuple[list, list]:\n    xpos = []\n    ypos = []\n\n    for i in range(n_steps):\n        ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n        ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n        x_earth_mid = x_earth + vx_earth * (dt / 2)\n        y_earth_mid = y_earth + vy_earth * (dt / 2)\n\n        vx_earth_mid = vx_earth + ax_earth * (dt / 2)\n        vy_earth_mid = vy_earth + ay_earth * (dt / 2)\n\n        ax_earth_mid = -(G * M_sun) * x_earth_mid / ((x_earth_mid**2 + y_earth_mid**2)**0.5)**3\n        ay_earth_mid = -(G * M_sun) * y_earth_mid / ((x_earth_mid**2 + y_earth_mid**2)**0.5)**3\n\n        vx_earth += ax_earth_mid * dt\n        vy_earth += ay_earth_mid * dt\n\n        xpos.append(x_earth)\n        ypos.append(y_earth)\n\n        x_earth += vx_earth_mid * dt\n        y_earth += vy_earth_mid * dt\n\n    return xpos, ypos\n\n\ndef verlet_function(x_earth: float = 1.5, y_earth: float = 0.,\n                   vx_earth: float = 0., vy_earth: float = 2*np.pi,\n                   dt: float = 0.1) -> tuple[list, list]:\n    xpos = []\n    ypos = []\n\n    for i in range(n_steps):\n        ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n        ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n        xpos.append(x_earth)\n        ypos.append(y_earth)\n\n        x_earth += vx_earth * dt + ax_earth * (dt / 2)**2\n        y_earth += vy_earth * dt + ay_earth * (dt / 2)**2\n\n        ax_earth_mid = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n        ay_earth_mid = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n        vx_earth += ((ax_earth_mid + ax_earth) / 2) * dt\n        vy_earth += ((ay_earth_mid + ay_earth) / 2) * dt\n\n    return xpos, ypos\n\n\ndef main() -> None:\n    fig, ax = plt.subplots()\n    for method, name in (\n        (euler_function, 'Euler'),\n        (runge_kutta_function, 'RK2'),\n        (verlet_function, 'Verlet'),\n    ):\n        x, y = method(dt=0.01)\n        ax.plot(x, y, label=name)\n    ax.legend()\n    plt.show()\n\n\nif __name__ == '__main__':\n    main()\n
\n

\"comparison\"

\n

For n=5000, dt=0.001, the output is closer yet:

\n

\"dt=0.001\"

\n

Obviously there are different IVP methods that can do even better per iteration. For instance, the Bogacki-Shampine form of Runge-Kutta order 3(2) is extremely stable for this application; shown over 1000 years:

\n
import numpy as np\nimport matplotlib.pyplot as plt\nimport scipy.integrate\n\nG = 4 * np.pi**2\nM_sun = 1     # masse solaire\n\ndef ddt(t: float, state: np.ndarray) -> np.ndarray:\n    p, v = np.split(state, 2)\n    a = -G * M_sun / np.linalg.norm(p)**3 * p\n    return np.concat((v, a))\n\n\ndef d2dt2(t: float, state: np.ndarray) -> np.ndarray:\n    p, v = np.split(state, 2)\n\n    # The Jacobian matrix has shape (n, n) and its element (i, j) is equal to d f_i / d y_j\n    x, y = p\n    fnorm5 = -G*M_sun/np.linalg.norm(p)**5\n    daxdpx = fnorm5*(y**2 - 2*x**2)\n    daydpy = fnorm5*(x**2 - 2*y**2)\n    daxdpy = fnorm5*-3*x*y\n    daydpx = daxdpy\n    jac = np.array((\n        #  /dpx    /dpy /dvx /dvy\n        (     0,      0,   1,   0), # dvx\n        (     0,      0,   0,   1), # dvy\n        (daxdpx, daxdpy,   0,   0), # dax\n        (daydpx, daydpy,   0,   0), # day\n    ))\n\n    return jac\n\n\nout = scipy.integrate.solve_ivp(\n    method='RK23', fun=ddt, rtol=1e-5, dense_output=True,\n    # jac=d2dt2,  # not used by Runge-Kutta\n    t_span=(0, 1000),  # Année\n    y0=(\n        1.5, 0,      # UA\n        0, 2*np.pi,  # UA/Année\n    ),\n)\n\nassert out.success, out.message\nplt.plot(*out.y[:2])\nplt.show()\n
\n

\"RK32\"

\n", "answer_id": 45490, "answer_text": "From my eye, the biggest issue is that your timestep is simply too large. Decrease it, either explicitly or by allowing an adaptive-timestep method to meet a specified tolerance. You can see that, for your existing code (repaired to actually be able to run) and a timestep ten times more fine, the methods are closer:\n\n\n\n\nimport matplotlib.pyplot as plt\nimport numpy as np\n\nG = 4 * np.pi**2\nM_sun = 1 # masse solaire\nn_steps = 300\n\n\ndef euler_function(x_earth: float = 1.5, y_earth: float = 0.,\n vx_earth: float = 0., vy_earth: float = 2*np.pi,\n dt: float = 0.1) -> tuple[list, list]:\n xpos = []\n ypos = []\n\n for i in range(n_steps):\n ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n vx_earth += ax_earth * dt\n vy_earth += ay_earth * dt\n\n xpos.append(x_earth)\n ypos.append(y_earth)\n\n x_earth += vx_earth * dt\n y_earth += vy_earth * dt\n\n return xpos, ypos\n\n\ndef runge_kutta_function(x_earth: float = 1.5, y_earth: float = 0.,\n vx_earth: float = 0., vy_earth: float = 2*np.pi,\n dt: float = 0.1) -> tuple[list, list]:\n xpos = []\n ypos = []\n\n for i in range(n_steps):\n ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n x_earth_mid = x_earth + vx_earth * (dt / 2)\n y_earth_mid = y_earth + vy_earth * (dt / 2)\n\n vx_earth_mid = vx_earth + ax_earth * (dt / 2)\n vy_earth_mid = vy_earth + ay_earth * (dt / 2)\n\n ax_earth_mid = -(G * M_sun) * x_earth_mid / ((x_earth_mid**2 + y_earth_mid**2)**0.5)**3\n ay_earth_mid = -(G * M_sun) * y_earth_mid / ((x_earth_mid**2 + y_earth_mid**2)**0.5)**3\n\n vx_earth += ax_earth_mid * dt\n vy_earth += ay_earth_mid * dt\n\n xpos.append(x_earth)\n ypos.append(y_earth)\n\n x_earth += vx_earth_mid * dt\n y_earth += vy_earth_mid * dt\n\n return xpos, ypos\n\n\ndef verlet_function(x_earth: float = 1.5, y_earth: float = 0.,\n vx_earth: float = 0., vy_earth: float = 2*np.pi,\n dt: float = 0.1) -> tuple[list, list]:\n xpos = []\n ypos = []\n\n for i in range(n_steps):\n ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n xpos.append(x_earth)\n ypos.append(y_earth)\n\n x_earth += vx_earth * dt + ax_earth * (dt / 2)**2\n y_earth += vy_earth * dt + ay_earth * (dt / 2)**2\n\n ax_earth_mid = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n ay_earth_mid = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n vx_earth += ((ax_earth_mid + ax_earth) / 2) * dt\n vy_earth += ((ay_earth_mid + ay_earth) / 2) * dt\n\n return xpos, ypos\n\n\ndef main() -> None:\n fig, ax = plt.subplots()\n for method, name in (\n (euler_function, 'Euler'),\n (runge_kutta_function, 'RK2'),\n (verlet_function, 'Verlet'),\n ):\n x, y = method(dt=0.01)\n ax.plot(x, y, label=name)\n ax.legend()\n plt.show()\n\n\nif __name__ == '__main__':\n main()\n\n\n\n\n\n[image: comparison; source: https://i.sstatic.net/ZOXbZlmS.png] (https://i.sstatic.net/ZOXbZlmS.png)\n\n\n\n\nFor n=5000, dt=0.001, the output is closer yet:\n\n\n\n\n[image: dt=0.001; source: https://i.sstatic.net/mLRffKQD.png] (https://i.sstatic.net/mLRffKQD.png)\n\n\n\n\nObviously there are different IVP methods that can do even better per iteration. For instance, the Bogacki-Shampine (https://www.sciencedirect.com/science/article/pii/0893965989900797) form of Runge-Kutta order 3(2) is extremely stable for this application; shown over 1000 years:\n\n\n\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport scipy.integrate\n\nG = 4 * np.pi**2\nM_sun = 1 # masse solaire\n\ndef ddt(t: float, state: np.ndarray) -> np.ndarray:\n p, v = np.split(state, 2)\n a = -G * M_sun / np.linalg.norm(p)**3 * p\n return np.concat((v, a))\n\n\ndef d2dt2(t: float, state: np.ndarray) -> np.ndarray:\n p, v = np.split(state, 2)\n\n # The Jacobian matrix has shape (n, n) and its element (i, j) is equal to d f_i / d y_j\n x, y = p\n fnorm5 = -G*M_sun/np.linalg.norm(p)**5\n daxdpx = fnorm5*(y**2 - 2*x**2)\n daydpy = fnorm5*(x**2 - 2*y**2)\n daxdpy = fnorm5*-3*x*y\n daydpx = daxdpy\n jac = np.array((\n # /dpx /dpy /dvx /dvy\n ( 0, 0, 1, 0), # dvx\n ( 0, 0, 0, 1), # dvy\n (daxdpx, daxdpy, 0, 0), # dax\n (daydpx, daydpy, 0, 0), # day\n ))\n\n return jac\n\n\nout = scipy.integrate.solve_ivp(\n method='RK23', fun=ddt, rtol=1e-5, dense_output=True,\n # jac=d2dt2, # not used by Runge-Kutta\n t_span=(0, 1000), # Année\n y0=(\n 1.5, 0, # UA\n 0, 2*np.pi, # UA/Année\n ),\n)\n\nassert out.success, out.message\nplt.plot(*out.y[:2])\nplt.show()\n\n\n\n\n\n[image: RK32; source: https://i.sstatic.net/DgMDrx4E.png] (https://i.sstatic.net/DgMDrx4E.png)", "answer_url": "https://scicomp.stackexchange.com/a/45490", "author": "Reinderien", "author_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-07-13T01:47:13+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45487, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Reinderien", "profile_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "user_type": "registered"}, "created_at": "2026-07-13T01:47:13+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "06EC415F-DC78-49A5-97D0-ED020CE6C74F", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/06EC415F-DC78-49A5-97D0-ED020CE6C74F/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Reinderien", "profile_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "user_type": "registered"}, "created_at": "2026-07-13T03:28:27+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "88B016CA-5B2E-46C7-99DA-7F374A3A0853", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/88B016CA-5B2E-46C7-99DA-7F374A3A0853/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Reinderien", "profile_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "user_type": "registered"}, "created_at": "2026-07-13T21:27:38+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "51F9060A-E0B8-4FC6-AAA1-D61ED8331962", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/51F9060A-E0B8-4FC6-AAA1-D61ED8331962/view-source"}], "score": 6, "updated_at": "2026-07-13T21:27:38+00:00"}, {"answer_html": "

When comparing numerical methods, we usually look up the order of the method (i.e. the upper bound of how the errors scale). This is only a very broad description of what is happening.

\n

Each method may have its own biases of how this error occurs and how it reflects in the different metrics you are interested in. For orbital mechanics you may be interested in that the method preserves the kinetic and potential energies of the bodies, while the exact spatial position is of low interest (or vice versa). Also, the order of the error makes no statement about the absoulte size of the error!

\n

What you could do is to verify if the errors of each implementation of your methods actually scale the way you expect them to, by plotting the absolute error of each method after a few timesteps under different refinements. If you are confident the scaling is right (strong, but not sufficient signal for correct implementation), then you can dig deeper into it:-)

\n

From the top of my head orbital mechanics are often solved with implicit euler-like methods "symplectic integrators", because they preserve energy and impulse better, but my memory may be leaky.

\n", "answer_id": 45491, "answer_text": "When comparing numerical methods, we usually look up the order of the method (i.e. the upper bound of how the errors scale). This is only a very broad description of what is happening.\n\n\n\n\nEach method may have its own biases of how this error occurs and how it reflects in the different metrics you are interested in. For orbital mechanics you may be interested in that the method preserves the kinetic and potential energies of the bodies, while the exact spatial position is of low interest (or vice versa). Also, the order of the error makes no statement about the absoulte size of the error!\n\n\n\n\nWhat you could do is to verify if the errors of each implementation of your methods actually scale the way you expect them to, by plotting the absolute error of each method after a few timesteps under different refinements. If you are confident the scaling is right (strong, but not sufficient signal for correct implementation), then you can dig deeper into it:-)\n\n\n\n\nFrom the top of my head orbital mechanics are often solved with implicit euler-like methods \"symplectic integrators\", because they preserve energy and impulse better, but my memory may be leaky.", "answer_url": "https://scicomp.stackexchange.com/a/45491", "author": "MPIchael", "author_url": "https://scicomp.stackexchange.com/users/28636/mpichael", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-07-13T06:50:20+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45487, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "MPIchael", "profile_url": "https://scicomp.stackexchange.com/users/28636/mpichael", "user_type": "registered"}, "created_at": "2026-07-13T06:50:20+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "6AC38EDB-7E81-4D4A-9023-CF4D31E3AB6E", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/6AC38EDB-7E81-4D4A-9023-CF4D31E3AB6E/view-source"}], "score": 7, "updated_at": "2026-07-13T06:50:20+00:00"}, {"answer_html": "

The answer was ultimately provided in a comment, so I'll reproduce it here for the benefit of future readers.

\n

In fact, I realized that I was updating the velocity before the position. This means I was not implementing the standard (explicit) Euler method, but the symplectic Euler (also known as semi-implicit Euler) method.

\n

For anyone interested, here is the corresponding Wikipedia article:\nhttps://en.wikipedia.org/wiki/Semi-implicit_Euler_method

\n

And here is an excellent video explaining the method:\nhttps://youtu.be/nCg3aXn5F3M?si=2dt1c9v5bBPWWuT6

\n

The original comment was:

\n
\n

Congratulations, you rediscovered the symplectic Euler method—a common outcome when the Euler step is implemented incorrectly for kinematic systems. As a result, your Euler and Verlet methods differ only by terms of order ( \\Delta t^2 ).

\n

Your RK2 implementation is not actually a second-order Runge–Kutta method, since it contains the same mistake that turned your Euler implementation into the symplectic Euler method.

\n

My advice is to implement numerical integrators for general first-order systems, and then express the kinematic equations as a first-order system as well. This approach also makes it clear that symplectic integrators are specialized methods designed specifically for Hamiltonian (or kinematic) systems.

\n
\n", "answer_id": 45503, "answer_text": "The answer was ultimately provided in a comment, so I'll reproduce it here for the benefit of future readers.\n\n\n\n\nIn fact, I realized that I was updating the velocity before the position. This means I was not implementing the standard (explicit) Euler method, but the symplectic Euler (also known as semi-implicit Euler) method.\n\n\n\n\nFor anyone interested, here is the corresponding Wikipedia article:\nhttps://en.wikipedia.org/wiki/Semi-implicit_Euler_method (https://en.wikipedia.org/wiki/Semi-implicit_Euler_method)\n\n\n\n\nAnd here is an excellent video explaining the method:\nhttps://youtu.be/nCg3aXn5F3M?si=2dt1c9v5bBPWWuT6 (https://youtu.be/nCg3aXn5F3M?si=2dt1c9v5bBPWWuT6)\n\n\n\n\nThe original comment was:\n\n\n\n\n\n\n\nCongratulations, you rediscovered the symplectic Euler method—a common outcome when the Euler step is implemented incorrectly for kinematic systems. As a result, your Euler and Verlet methods differ only by terms of order ( \\Delta t^2 ).\n\n\n\n\nYour RK2 implementation is not actually a second-order Runge–Kutta method, since it contains the same mistake that turned your Euler implementation into the symplectic Euler method.\n\n\n\n\nMy advice is to implement numerical integrators for general first-order systems, and then express the kinematic equations as a first-order system as well. This approach also makes it clear that symplectic integrators are specialized methods designed specifically for Hamiltonian (or kinematic) systems.", "answer_url": "https://scicomp.stackexchange.com/a/45503", "author": "Omar Osman Mahamoud", "author_url": "https://scicomp.stackexchange.com/users/57039/omar-osman-mahamoud", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-07-29T16:42:27+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45487, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Omar Osman Mahamoud", "profile_url": "https://scicomp.stackexchange.com/users/57039/omar-osman-mahamoud", "user_type": "registered"}, "created_at": "2026-07-29T16:42:27+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "DD32D002-9E3F-4398-BC22-FB7FBF667951", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/DD32D002-9E3F-4398-BC22-FB7FBF667951/view-source"}], "score": 2, "updated_at": "2026-07-29T16:42:27+00:00"}], "domain": "computational_science", "external_links": ["https://en.wikipedia.org/wiki/Semi-implicit_Euler_method", "https://i.sstatic.net/DgMDrx4E.png", "https://i.sstatic.net/ZOXbZlmS.png", "https://i.sstatic.net/mLRffKQD.png", "https://www.sciencedirect.com/science/article/pii/0893965989900797", "https://youtu.be/nCg3aXn5F3M?si=2dt1c9v5bBPWWuT6"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:44.584971+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/272744bcc95b58699f7df6e6979b288bb8b00a80ab9c7982dbe170a6d0b63584_1790825325025901700_0.json", "raw_sha256": "27a81850a40920682c29ada76a2b55e80340a5c82764a3e9dde8a9c2ba23db4e", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Omar Osman Mahamoud", "question_author_url": "https://scicomp.stackexchange.com/users/57039/omar-osman-mahamoud", "question_author_user_type": "registered", "question_created_at": "2026-07-12T12:23:53+00:00", "question_html": "

I'm simulating the Earth's orbit around the Sun using three different numerical integration methods: Euler, RK2 (midpoint), and Velocity Verlet. Since RK2 and Velocity Verlet are higher-order methods, I expected them to produce more accurate trajectories than Euler when using the same initial conditions and time step.

\n

However, in my simulation, the opposite seems to happen: the RK2 and Velocity Verlet trajectories appear less accurate than the Euler trajectory.

\n

I've checked the implementations several times but I can't find any obvious mistakes. Could someone point out whether I've implemented one of these methods incorrectly or explain why this behavior might occur?

\n

Here are the three implementations.

\n
def euler_function(\n        x_earth, y_earth, vx_earth, vy_earth, dt\n):\n\n    for i in range(n_steps):\n        ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n        ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n        vx_earth += ax_earth * dt\n        vy_earth += ay_earth * dt\n\n        xpos.append(x_earth)\n        ypos.append(y_earth)\n\n        x_earth += vx_earth * dt\n        y_earth += vy_earth * dt\n\n    return xpos, ypos\n
\n
def Runge_kutta_function(\n        x_earth, y_earth, vx_earth, vy_earth, dt\n):\n\n    for i in range(n_steps):\n\n        ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n        ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n        x_earth_mid = x_earth + vx_earth * (dt / 2)\n        y_earth_mid = y_earth + vy_earth * (dt / 2)\n\n        vx_earth_mid = vx_earth + ax_earth * (dt / 2)\n        vy_earth_mid = vy_earth + ay_earth * (dt / 2)\n\n        ax_earth_mid = -(G * M_sun) * x_earth_mid / ((x_earth_mid**2 + y_earth_mid**2)**0.5)**3\n        ay_earth_mid = -(G * M_sun) * y_earth_mid / ((x_earth_mid**2 + y_earth_mid**2)**0.5)**3\n\n        vx_earth += ax_earth_mid * dt\n        vy_earth += ay_earth_mid * dt\n\n        xpos.append(x_earth)\n        ypos.append(y_earth)\n\n        x_earth += vx_earth_mid * dt\n        y_earth += vy_earth_mid * dt\n\n    return xpos, ypos\n
\n
def Verlet_function(\n        x_earth, y_earth, vx_earth, vy_earth, dt\n):\n\n    for i in range(n_steps):\n\n        ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n        ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n        xpos.append(x_earth)\n        ypos.append(y_earth)\n\n        x_earth += vx_earth * dt + ax_earth * (dt / 2)**2\n        y_earth += vy_earth * dt + ay_earth * (dt / 2)**2\n\n        ax_earth_mid = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n        ay_earth_mid = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n        vx_earth += ((ax_earth_mid + ax_earth) / 2) * dt\n        vy_earth += ((ay_earth_mid + ay_earth) / 2) * dt\n\n    return xpos, ypos\n
\n

What am I missing? Is there an error in one (or more) of these implementations, or is there another reason why RK2 and Velocity Verlet would appear less accurate than Euler?

\n", "question_id": 45487, "question_license": "CC BY-SA 4.0", "question_score": 7, "question_text": "I'm simulating the Earth's orbit around the Sun using three different numerical integration methods: Euler, RK2 (midpoint), and Velocity Verlet. Since RK2 and Velocity Verlet are higher-order methods, I expected them to produce more accurate trajectories than Euler when using the same initial conditions and time step.\n\n\n\n\nHowever, in my simulation, the opposite seems to happen: the RK2 and Velocity Verlet trajectories appear less accurate than the Euler trajectory.\n\n\n\n\nI've checked the implementations several times but I can't find any obvious mistakes. Could someone point out whether I've implemented one of these methods incorrectly or explain why this behavior might occur?\n\n\n\n\nHere are the three implementations.\n\n\n\n\ndef euler_function(\n x_earth, y_earth, vx_earth, vy_earth, dt\n):\n\n for i in range(n_steps):\n ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n vx_earth += ax_earth * dt\n vy_earth += ay_earth * dt\n\n xpos.append(x_earth)\n ypos.append(y_earth)\n\n x_earth += vx_earth * dt\n y_earth += vy_earth * dt\n\n return xpos, ypos\n\n\n\n\n\ndef Runge_kutta_function(\n x_earth, y_earth, vx_earth, vy_earth, dt\n):\n\n for i in range(n_steps):\n\n ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n x_earth_mid = x_earth + vx_earth * (dt / 2)\n y_earth_mid = y_earth + vy_earth * (dt / 2)\n\n vx_earth_mid = vx_earth + ax_earth * (dt / 2)\n vy_earth_mid = vy_earth + ay_earth * (dt / 2)\n\n ax_earth_mid = -(G * M_sun) * x_earth_mid / ((x_earth_mid**2 + y_earth_mid**2)**0.5)**3\n ay_earth_mid = -(G * M_sun) * y_earth_mid / ((x_earth_mid**2 + y_earth_mid**2)**0.5)**3\n\n vx_earth += ax_earth_mid * dt\n vy_earth += ay_earth_mid * dt\n\n xpos.append(x_earth)\n ypos.append(y_earth)\n\n x_earth += vx_earth_mid * dt\n y_earth += vy_earth_mid * dt\n\n return xpos, ypos\n\n\n\n\n\ndef Verlet_function(\n x_earth, y_earth, vx_earth, vy_earth, dt\n):\n\n for i in range(n_steps):\n\n ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n xpos.append(x_earth)\n ypos.append(y_earth)\n\n x_earth += vx_earth * dt + ax_earth * (dt / 2)**2\n y_earth += vy_earth * dt + ay_earth * (dt / 2)**2\n\n ax_earth_mid = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n ay_earth_mid = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n vx_earth += ((ax_earth_mid + ax_earth) / 2) * dt\n vy_earth += ((ay_earth_mid + ay_earth) / 2) * dt\n\n return xpos, ypos\n\n\n\n\n\nWhat am I missing? Is there an error in one (or more) of these implementations, or is there another reason why RK2 and Velocity Verlet would appear less accurate than Euler?", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Omar Osman Mahamoud", "profile_url": "https://scicomp.stackexchange.com/users/57039/omar-osman-mahamoud", "user_type": "registered"}, "created_at": "2026-07-12T12:23:53+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "D3AC3DA9-7794-465F-AF03-B877C6C0EF0D", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/D3AC3DA9-7794-465F-AF03-B877C6C0EF0D/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-07-13T01:54:39+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "8CA42130-747B-47CA-BB4D-D7CD4CD70CC8", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://scicomp.stackexchange.com/revisions/8CA42130-747B-47CA-BB4D-D7CD4CD70CC8/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Lutz Lehmann", "profile_url": "https://scicomp.stackexchange.com/users/6839/lutz-lehmann", "user_type": "registered"}, "created_at": "2026-07-13T09:09:11+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "3FEC6861-FADA-4330-8FB0-12A8839B955D", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/3FEC6861-FADA-4330-8FB0-12A8839B955D/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Omar Osman Mahamoud", "profile_url": "https://scicomp.stackexchange.com/users/57039/omar-osman-mahamoud", "user_type": "registered"}, "created_at": "2026-07-15T23:49:16+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "7914AE3D-629C-4FCA-BF96-6D9824005EDC", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/7914AE3D-629C-4FCA-BF96-6D9824005EDC/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Omar Osman Mahamoud", "profile_url": "https://scicomp.stackexchange.com/users/57039/omar-osman-mahamoud", "user_type": "registered"}, "created_at": "2026-07-16T00:10:59+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "62C0155C-4F90-4C15-8CFB-EDCF7BC7548E", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/62C0155C-4F90-4C15-8CFB-EDCF7BC7548E/view-source"}, {"content_license": null, "contributor": {"display_name": "Omar Osman Mahamoud", "profile_url": "https://scicomp.stackexchange.com/users/57039/omar-osman-mahamoud", "user_type": "registered"}, "created_at": "2026-07-16T11:22:30+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "BAF51E0F-7B50-4443-B0DF-BC44A34EF5BE", "revision_number": 5, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/BAF51E0F-7B50-4443-B0DF-BC44A34EF5BE/view-source"}], "source_site": "scicomp", "source_url": "https://scicomp.stackexchange.com/questions/45487/why-do-my-rk2-and-velocity-verlet-implementations-produce-less-accurate-orbits-t", "split": "train", "split_group": "e3c4c48d2016f7277be3216b64a0dd6deac291a4bba983d1b0acef890102a34a", "tags": ["python", "simulation", "runge-kutta", "physics"], "thread_id": "scicomp:45487", "title": "Why do my RK2 and Velocity Verlet implementations produce less accurate orbits than Euler?"}} {"accepted_status": [false, true], "candidate_answers": [{"answer_html": "

I'm going to read into your question a little and infer that you want to, at least in part, vectorise your code. You've gotten about halfway there. Try:

\n
import numpy as np\nimport matplotlib.pyplot as plt\n\nG = 4 * np.pi**2\nM_sun = 1     # masse solaire\ndt = 0.1\nn_steps = 1_000\n\np_earth = np.empty((n_steps, 2))\np_earth[0] = (1.5, 0)\nv_earth = np.array((0, 2*np.pi))  # UA/Année\n\nfor i in range(n_steps - 1):\n    factor = -G*M_sun/np.linalg.norm(p_earth[i])**3\n    v_earth += dt*factor*p_earth[i]\n    p_earth[i + 1] = p_earth[i] + v_earth*dt\n\nplt.plot(*p_earth.T)\nplt.show()\n
\n

\"plot\"

\n

But of course expressing this as a proper IVP is more stable:

\n
import numpy as np\nimport matplotlib.pyplot as plt\nimport scipy.integrate\n\nG = 4 * np.pi**2\nM_sun = 1     # masse solaire\n\ndef ddt(t: float, state: np.ndarray) -> np.ndarray:\n    p, v = np.split(state, 2)\n    a = -G * M_sun / np.linalg.norm(p)**3 * p\n    return np.concat((v, a))\n\n\nout = scipy.integrate.solve_ivp(\n    fun=ddt, dense_output=True, rtol=1e-6,\n    t_span=(0, 100),  # Année\n    y0=(\n        1.5, 0,      # UA\n        0, 2*np.pi,  # UA/Année\n    ),\n)\nassert out.success, out.message\n\nplt.plot(*out.y[:2])\nplt.show()\n
\n

\"ivp\"

\n
\n

As a more fulsome demo, note that for an ODE state vector of

\n

$$\n[ x, y, \\dot x, \\dot y ]\n$$

\n

the Jacobian is

\n

$$\n\\begin{bmatrix}\n0 & 0 & 1 & 0 \\\\\n0 & 0 & 0 & 1 \\\\\n \\frac{-G m_{sun}(y^2 - 2x^2)} {||p||^5} \n& \\frac{-G m_{sun}(-3xy)} {||p||^5} & 0 & 0 \\\\\n \\frac{-G m_{sun}(-3xy)} {||p||^5} \n& \\frac{-G m_{sun}(x^2 - 2y^2)} {||p||^5} & 0 & 0 \n\\end{bmatrix}\n$$

\n
import time\nimport typing\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport scipy.integrate\n\nG = 4 * np.pi**2\nM_sun = 1.     # masse solaire\nGmsun = -G * M_sun\n\nuses_jacobian = frozenset({'Radau', 'BDF', 'LSODA'}).__contains__\n\n\ndef ddt(t: float, state: np.ndarray) -> np.ndarray:\n    p, v = np.split(state, 2)\n    a = Gmsun / np.linalg.norm(p)**3 * p\n    return np.concat((v, a))\n\n\ndef d2dt2(t: float, state: np.ndarray) -> np.ndarray:\n    p, v = np.split(state, 2)\n\n    # The Jacobian matrix has shape (n, n) and its element (i, j) is equal to d f_i / d y_j\n    x, y = p\n    fnorm5 = Gmsun/np.linalg.norm(p)**5\n    daxdpx = fnorm5*(y**2 - 2*x**2)\n    daydpy = fnorm5*(x**2 - 2*y**2)\n    daxdpy = fnorm5*-3*x*y\n    daydpx = daxdpy\n    return scipy.sparse.csc_array([\n        #  /dpx    /dpy /dvx /dvy\n        (     0,      0,   1,   0), # dvx\n        (     0,      0,   0,   1), # dvy\n        (daxdpx, daxdpy,   0,   0), # dax\n        (daydpx, daydpy,   0,   0), # day\n    ])\n\n\ndef solve(\n    t_max: float,\n    method: typing.Literal['RK45', 'RK23', 'DOP853', 'Radau', 'BDF', 'LSODA'] = 'LSODA',\n    atol: float = 1e-6, rtol: float = 1e-5,\n) -> np.ndarray:\n    params = {}\n    if uses_jacobian(method):\n        params['jac'] = d2dt2\n\n    y0 = (\n        1.5, 0.,      # UA\n        0., 2*np.pi,  # UA/Année\n    )\n    t_span = (0., t_max)  # Année\n    out = scipy.integrate.solve_ivp(\n        method=method, fun=ddt, t_span=t_span, y0=y0, atol=atol, rtol=rtol, dense_output=True, **params)\n    if not out.success:\n        raise ValueError(out.message)\n    return out.y[:2]  # x,y\n\n\ndef main() -> None:\n    t_max = 1_000.\n    for method in ('RK45', 'RK23', 'DOP853', 'Radau', 'BDF', 'LSODA'):\n        t0 = time.perf_counter()\n        xy = solve(t_max, method=method)\n        t1 = time.perf_counter()\n        print(f'{method:8} t={t1-t0:.2f} n={xy.shape[1]}', flush=True)\n        fix, ax = plt.subplots()\n        ax.set_title(f'method={method}, t_max={t_max}y, dur={t1 - t0:.2f}s')\n        ax.plot(*xy)\n    plt.show()\n\n\nif __name__ == '__main__':\n    main()\n
\n", "answer_id": 45489, "answer_text": "I'm going to read into your question a little and infer that you want to, at least in part, vectorise your code. You've gotten about halfway there. Try:\n\n\n\n\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nG = 4 * np.pi**2\nM_sun = 1 # masse solaire\ndt = 0.1\nn_steps = 1_000\n\np_earth = np.empty((n_steps, 2))\np_earth[0] = (1.5, 0)\nv_earth = np.array((0, 2*np.pi)) # UA/Année\n\nfor i in range(n_steps - 1):\n factor = -G*M_sun/np.linalg.norm(p_earth[i])**3\n v_earth += dt*factor*p_earth[i]\n p_earth[i + 1] = p_earth[i] + v_earth*dt\n\nplt.plot(*p_earth.T)\nplt.show()\n\n\n\n\n\n[image: plot; source: https://i.sstatic.net/Tq7uPZJj.png] (https://i.sstatic.net/Tq7uPZJj.png)\n\n\n\n\nBut of course expressing this as a proper IVP is more stable:\n\n\n\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport scipy.integrate\n\nG = 4 * np.pi**2\nM_sun = 1 # masse solaire\n\ndef ddt(t: float, state: np.ndarray) -> np.ndarray:\n p, v = np.split(state, 2)\n a = -G * M_sun / np.linalg.norm(p)**3 * p\n return np.concat((v, a))\n\n\nout = scipy.integrate.solve_ivp(\n fun=ddt, dense_output=True, rtol=1e-6,\n t_span=(0, 100), # Année\n y0=(\n 1.5, 0, # UA\n 0, 2*np.pi, # UA/Année\n ),\n)\nassert out.success, out.message\n\nplt.plot(*out.y[:2])\nplt.show()\n\n\n\n\n\n[image: ivp; source: https://i.sstatic.net/KnVXs58G.png] (https://i.sstatic.net/KnVXs58G.png)\n\n\n\n\n\n\n\nAs a more fulsome demo, note that for an ODE state vector of\n\n\n\n\n$$\n[ x, y, \\dot x, \\dot y ]\n$$\n\n\n\n\nthe Jacobian is\n\n\n\n\n$$\n\\begin{bmatrix}\n0 & 0 & 1 & 0 \\\\\n0 & 0 & 0 & 1 \\\\\n \\frac{-G m_{sun}(y^2 - 2x^2)} {||p||^5} \n& \\frac{-G m_{sun}(-3xy)} {||p||^5} & 0 & 0 \\\\\n \\frac{-G m_{sun}(-3xy)} {||p||^5} \n& \\frac{-G m_{sun}(x^2 - 2y^2)} {||p||^5} & 0 & 0 \n\\end{bmatrix}\n$$\n\n\n\n\nimport time\nimport typing\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport scipy.integrate\n\nG = 4 * np.pi**2\nM_sun = 1. # masse solaire\nGmsun = -G * M_sun\n\nuses_jacobian = frozenset({'Radau', 'BDF', 'LSODA'}).__contains__\n\n\ndef ddt(t: float, state: np.ndarray) -> np.ndarray:\n p, v = np.split(state, 2)\n a = Gmsun / np.linalg.norm(p)**3 * p\n return np.concat((v, a))\n\n\ndef d2dt2(t: float, state: np.ndarray) -> np.ndarray:\n p, v = np.split(state, 2)\n\n # The Jacobian matrix has shape (n, n) and its element (i, j) is equal to d f_i / d y_j\n x, y = p\n fnorm5 = Gmsun/np.linalg.norm(p)**5\n daxdpx = fnorm5*(y**2 - 2*x**2)\n daydpy = fnorm5*(x**2 - 2*y**2)\n daxdpy = fnorm5*-3*x*y\n daydpx = daxdpy\n return scipy.sparse.csc_array([\n # /dpx /dpy /dvx /dvy\n ( 0, 0, 1, 0), # dvx\n ( 0, 0, 0, 1), # dvy\n (daxdpx, daxdpy, 0, 0), # dax\n (daydpx, daydpy, 0, 0), # day\n ])\n\n\ndef solve(\n t_max: float,\n method: typing.Literal['RK45', 'RK23', 'DOP853', 'Radau', 'BDF', 'LSODA'] = 'LSODA',\n atol: float = 1e-6, rtol: float = 1e-5,\n) -> np.ndarray:\n params = {}\n if uses_jacobian(method):\n params['jac'] = d2dt2\n\n y0 = (\n 1.5, 0., # UA\n 0., 2*np.pi, # UA/Année\n )\n t_span = (0., t_max) # Année\n out = scipy.integrate.solve_ivp(\n method=method, fun=ddt, t_span=t_span, y0=y0, atol=atol, rtol=rtol, dense_output=True, **params)\n if not out.success:\n raise ValueError(out.message)\n return out.y[:2] # x,y\n\n\ndef main() -> None:\n t_max = 1_000.\n for method in ('RK45', 'RK23', 'DOP853', 'Radau', 'BDF', 'LSODA'):\n t0 = time.perf_counter()\n xy = solve(t_max, method=method)\n t1 = time.perf_counter()\n print(f'{method:8} t={t1-t0:.2f} n={xy.shape[1]}', flush=True)\n fix, ax = plt.subplots()\n ax.set_title(f'method={method}, t_max={t_max}y, dur={t1 - t0:.2f}s')\n ax.plot(*xy)\n plt.show()\n\n\nif __name__ == '__main__':\n main()", "answer_url": "https://scicomp.stackexchange.com/a/45489", "author": "Reinderien", "author_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-07-13T00:25:35+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45488, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Reinderien", "profile_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "user_type": "registered"}, "created_at": "2026-07-13T00:25:35+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "C9922D8C-A590-4B1E-94CA-B97A778DA7B4", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/C9922D8C-A590-4B1E-94CA-B97A778DA7B4/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Reinderien", "profile_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "user_type": "registered"}, "created_at": "2026-07-13T01:06:34+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "43E7D35E-D810-41D3-9F12-FDE31BF65860", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/43E7D35E-D810-41D3-9F12-FDE31BF65860/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Reinderien", "profile_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "user_type": "registered"}, "created_at": "2026-09-26T19:23:41+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "9970817B-8E8F-4EAC-BE66-46090CDC3BB0", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/9970817B-8E8F-4EAC-BE66-46090CDC3BB0/view-source"}], "score": 8, "updated_at": "2026-09-26T19:23:41+00:00"}, {"answer_html": "

The second variant correctly implements the first-order Euler method for the kinematic equation seen as a first-order ODE system. As the Euler method with large step size tends to increase the radius of the orbit, and apparently also the energy level, the gravitational orbit seemingly gets modified from the elliptical to the hyperbolic case.

\n

The first variant on the other hand modifies it to the second-order symplectic Euler method. This is more conservative to the energy level, but not necessarily to the other parameters of the Kepler ellipse. Thus the apparent perihel rotation and also perhaps some drift in the eccentricity of the ellipse.

\n

These errors will of course be reduced when using smaller step sizes, or higher order methods.

\n", "answer_id": 45492, "answer_text": "The second variant correctly implements the first-order Euler method for the kinematic equation seen as a first-order ODE system. As the Euler method with large step size tends to increase the radius of the orbit, and apparently also the energy level, the gravitational orbit seemingly gets modified from the elliptical to the hyperbolic case.\n\n\n\n\nThe first variant on the other hand modifies it to the second-order symplectic Euler method. This is more conservative to the energy level, but not necessarily to the other parameters of the Kepler ellipse. Thus the apparent perihel rotation and also perhaps some drift in the eccentricity of the ellipse.\n\n\n\n\nThese errors will of course be reduced when using smaller step sizes, or higher order methods.", "answer_url": "https://scicomp.stackexchange.com/a/45492", "author": "Lutz Lehmann", "author_url": "https://scicomp.stackexchange.com/users/6839/lutz-lehmann", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-07-13T16:52:52+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45488, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Lutz Lehmann", "profile_url": "https://scicomp.stackexchange.com/users/6839/lutz-lehmann", "user_type": "registered"}, "created_at": "2026-07-13T16:52:52+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "2C5B9BF1-E49C-4BE3-8AF3-F047FF98EB7A", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/2C5B9BF1-E49C-4BE3-8AF3-F047FF98EB7A/view-source"}], "score": 6, "updated_at": "2026-07-13T16:52:52+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "Can someone please tell me why these two codes don't give the same answer?\n\n\n\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom matplotlib.animation import FuncAnimation\n\nG = 4 * (np.pi)**2\nM_sun = 1 # solar mass\ndistance = 1 # AU\ntemps = 1 # year\nM_earth = 3.002513826043238e-06 # solar mass\nv_earth = 2 * np.pi # AU/year\ndt = 0.1\nn_steps = 10**3\n\nxpos = []\nypos = []\n\nx_earth = 1.5\ny_earth = 0\n\nvx_earth = 0\nvy_earth = v_earth\n\nfor i in range(n_steps):\n ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n vx_earth = vx_earth + ax_earth * dt\n vy_earth = vy_earth + ay_earth * dt\n\n xpos.append(x_earth)\n ypos.append(y_earth)\n\n x_earth = x_earth + vx_earth * dt\n y_earth = y_earth + vy_earth * dt\n\nplt.plot(xpos, ypos, color=\"green\")\nplt.show()\n\n\n\n\n\n[image: it's image; source: https://i.sstatic.net/mLgbrUlD.png] (https://i.sstatic.net/mLgbrUlD.png)\n\n\n\n\nand\n\n\n\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom matplotlib.animation import FuncAnimation\n\n\nG=4*(np.pi)**2\nM_sun=1 # masse solaire\ndistance=1 # UA\ntemps=1 # Année\nM_earth=3.002513826043238e-06 # masse solaire\nv_earth=(2*np.pi) # UA/Année\ndt=0.1\nn_steps=10**3\n\n\nx_earth=np.zeros(n_steps)\ny_earth=np.zeros(n_steps)\n\nvx_earth=np.zeros(n_steps)\nvy_earth=np.zeros(n_steps)\n\n\nx_earth[0]=1.5\nvy_earth[0]=v_earth\n\nfor i in range(n_steps-1):\n ax_earth=-(G*M_sun)*x_earth[i]/((x_earth[i]**2+y_earth[i]**2)**0.5)**3\n ay_earth=-(G*M_sun)*y_earth[i]/((x_earth[i]**2+y_earth[i]**2)**0.5)**3\n \n\n vx_earth[i+1]=vx_earth[i]+ax_earth*dt\n vy_earth[i+1]=vy_earth[i]+ay_earth*dt\n\n x_earth[i+1]=x_earth[i]+vx_earth[i]*dt\n y_earth[i+1]=y_earth[i]+vy_earth[i]*dt\n\n\nplt.plot(x_earth,y_earth, color='green')\n\nplt.show()\n\n\n\n\n\n\n[image: it's image; source: https://i.sstatic.net/XWVvnmXc.png] (https://i.sstatic.net/XWVvnmXc.png)", "record_id": "Scientific-Answer-Ranking:scicomp:45488", "scores": [8, 6], "split": "train", "thread": {"accepted_answer_id": 45492, "answers": [{"answer_html": "

I'm going to read into your question a little and infer that you want to, at least in part, vectorise your code. You've gotten about halfway there. Try:

\n
import numpy as np\nimport matplotlib.pyplot as plt\n\nG = 4 * np.pi**2\nM_sun = 1     # masse solaire\ndt = 0.1\nn_steps = 1_000\n\np_earth = np.empty((n_steps, 2))\np_earth[0] = (1.5, 0)\nv_earth = np.array((0, 2*np.pi))  # UA/Année\n\nfor i in range(n_steps - 1):\n    factor = -G*M_sun/np.linalg.norm(p_earth[i])**3\n    v_earth += dt*factor*p_earth[i]\n    p_earth[i + 1] = p_earth[i] + v_earth*dt\n\nplt.plot(*p_earth.T)\nplt.show()\n
\n

\"plot\"

\n

But of course expressing this as a proper IVP is more stable:

\n
import numpy as np\nimport matplotlib.pyplot as plt\nimport scipy.integrate\n\nG = 4 * np.pi**2\nM_sun = 1     # masse solaire\n\ndef ddt(t: float, state: np.ndarray) -> np.ndarray:\n    p, v = np.split(state, 2)\n    a = -G * M_sun / np.linalg.norm(p)**3 * p\n    return np.concat((v, a))\n\n\nout = scipy.integrate.solve_ivp(\n    fun=ddt, dense_output=True, rtol=1e-6,\n    t_span=(0, 100),  # Année\n    y0=(\n        1.5, 0,      # UA\n        0, 2*np.pi,  # UA/Année\n    ),\n)\nassert out.success, out.message\n\nplt.plot(*out.y[:2])\nplt.show()\n
\n

\"ivp\"

\n
\n

As a more fulsome demo, note that for an ODE state vector of

\n

$$\n[ x, y, \\dot x, \\dot y ]\n$$

\n

the Jacobian is

\n

$$\n\\begin{bmatrix}\n0 & 0 & 1 & 0 \\\\\n0 & 0 & 0 & 1 \\\\\n \\frac{-G m_{sun}(y^2 - 2x^2)} {||p||^5} \n& \\frac{-G m_{sun}(-3xy)} {||p||^5} & 0 & 0 \\\\\n \\frac{-G m_{sun}(-3xy)} {||p||^5} \n& \\frac{-G m_{sun}(x^2 - 2y^2)} {||p||^5} & 0 & 0 \n\\end{bmatrix}\n$$

\n
import time\nimport typing\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport scipy.integrate\n\nG = 4 * np.pi**2\nM_sun = 1.     # masse solaire\nGmsun = -G * M_sun\n\nuses_jacobian = frozenset({'Radau', 'BDF', 'LSODA'}).__contains__\n\n\ndef ddt(t: float, state: np.ndarray) -> np.ndarray:\n    p, v = np.split(state, 2)\n    a = Gmsun / np.linalg.norm(p)**3 * p\n    return np.concat((v, a))\n\n\ndef d2dt2(t: float, state: np.ndarray) -> np.ndarray:\n    p, v = np.split(state, 2)\n\n    # The Jacobian matrix has shape (n, n) and its element (i, j) is equal to d f_i / d y_j\n    x, y = p\n    fnorm5 = Gmsun/np.linalg.norm(p)**5\n    daxdpx = fnorm5*(y**2 - 2*x**2)\n    daydpy = fnorm5*(x**2 - 2*y**2)\n    daxdpy = fnorm5*-3*x*y\n    daydpx = daxdpy\n    return scipy.sparse.csc_array([\n        #  /dpx    /dpy /dvx /dvy\n        (     0,      0,   1,   0), # dvx\n        (     0,      0,   0,   1), # dvy\n        (daxdpx, daxdpy,   0,   0), # dax\n        (daydpx, daydpy,   0,   0), # day\n    ])\n\n\ndef solve(\n    t_max: float,\n    method: typing.Literal['RK45', 'RK23', 'DOP853', 'Radau', 'BDF', 'LSODA'] = 'LSODA',\n    atol: float = 1e-6, rtol: float = 1e-5,\n) -> np.ndarray:\n    params = {}\n    if uses_jacobian(method):\n        params['jac'] = d2dt2\n\n    y0 = (\n        1.5, 0.,      # UA\n        0., 2*np.pi,  # UA/Année\n    )\n    t_span = (0., t_max)  # Année\n    out = scipy.integrate.solve_ivp(\n        method=method, fun=ddt, t_span=t_span, y0=y0, atol=atol, rtol=rtol, dense_output=True, **params)\n    if not out.success:\n        raise ValueError(out.message)\n    return out.y[:2]  # x,y\n\n\ndef main() -> None:\n    t_max = 1_000.\n    for method in ('RK45', 'RK23', 'DOP853', 'Radau', 'BDF', 'LSODA'):\n        t0 = time.perf_counter()\n        xy = solve(t_max, method=method)\n        t1 = time.perf_counter()\n        print(f'{method:8} t={t1-t0:.2f} n={xy.shape[1]}', flush=True)\n        fix, ax = plt.subplots()\n        ax.set_title(f'method={method}, t_max={t_max}y, dur={t1 - t0:.2f}s')\n        ax.plot(*xy)\n    plt.show()\n\n\nif __name__ == '__main__':\n    main()\n
\n", "answer_id": 45489, "answer_text": "I'm going to read into your question a little and infer that you want to, at least in part, vectorise your code. You've gotten about halfway there. Try:\n\n\n\n\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nG = 4 * np.pi**2\nM_sun = 1 # masse solaire\ndt = 0.1\nn_steps = 1_000\n\np_earth = np.empty((n_steps, 2))\np_earth[0] = (1.5, 0)\nv_earth = np.array((0, 2*np.pi)) # UA/Année\n\nfor i in range(n_steps - 1):\n factor = -G*M_sun/np.linalg.norm(p_earth[i])**3\n v_earth += dt*factor*p_earth[i]\n p_earth[i + 1] = p_earth[i] + v_earth*dt\n\nplt.plot(*p_earth.T)\nplt.show()\n\n\n\n\n\n[image: plot; source: https://i.sstatic.net/Tq7uPZJj.png] (https://i.sstatic.net/Tq7uPZJj.png)\n\n\n\n\nBut of course expressing this as a proper IVP is more stable:\n\n\n\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport scipy.integrate\n\nG = 4 * np.pi**2\nM_sun = 1 # masse solaire\n\ndef ddt(t: float, state: np.ndarray) -> np.ndarray:\n p, v = np.split(state, 2)\n a = -G * M_sun / np.linalg.norm(p)**3 * p\n return np.concat((v, a))\n\n\nout = scipy.integrate.solve_ivp(\n fun=ddt, dense_output=True, rtol=1e-6,\n t_span=(0, 100), # Année\n y0=(\n 1.5, 0, # UA\n 0, 2*np.pi, # UA/Année\n ),\n)\nassert out.success, out.message\n\nplt.plot(*out.y[:2])\nplt.show()\n\n\n\n\n\n[image: ivp; source: https://i.sstatic.net/KnVXs58G.png] (https://i.sstatic.net/KnVXs58G.png)\n\n\n\n\n\n\n\nAs a more fulsome demo, note that for an ODE state vector of\n\n\n\n\n$$\n[ x, y, \\dot x, \\dot y ]\n$$\n\n\n\n\nthe Jacobian is\n\n\n\n\n$$\n\\begin{bmatrix}\n0 & 0 & 1 & 0 \\\\\n0 & 0 & 0 & 1 \\\\\n \\frac{-G m_{sun}(y^2 - 2x^2)} {||p||^5} \n& \\frac{-G m_{sun}(-3xy)} {||p||^5} & 0 & 0 \\\\\n \\frac{-G m_{sun}(-3xy)} {||p||^5} \n& \\frac{-G m_{sun}(x^2 - 2y^2)} {||p||^5} & 0 & 0 \n\\end{bmatrix}\n$$\n\n\n\n\nimport time\nimport typing\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport scipy.integrate\n\nG = 4 * np.pi**2\nM_sun = 1. # masse solaire\nGmsun = -G * M_sun\n\nuses_jacobian = frozenset({'Radau', 'BDF', 'LSODA'}).__contains__\n\n\ndef ddt(t: float, state: np.ndarray) -> np.ndarray:\n p, v = np.split(state, 2)\n a = Gmsun / np.linalg.norm(p)**3 * p\n return np.concat((v, a))\n\n\ndef d2dt2(t: float, state: np.ndarray) -> np.ndarray:\n p, v = np.split(state, 2)\n\n # The Jacobian matrix has shape (n, n) and its element (i, j) is equal to d f_i / d y_j\n x, y = p\n fnorm5 = Gmsun/np.linalg.norm(p)**5\n daxdpx = fnorm5*(y**2 - 2*x**2)\n daydpy = fnorm5*(x**2 - 2*y**2)\n daxdpy = fnorm5*-3*x*y\n daydpx = daxdpy\n return scipy.sparse.csc_array([\n # /dpx /dpy /dvx /dvy\n ( 0, 0, 1, 0), # dvx\n ( 0, 0, 0, 1), # dvy\n (daxdpx, daxdpy, 0, 0), # dax\n (daydpx, daydpy, 0, 0), # day\n ])\n\n\ndef solve(\n t_max: float,\n method: typing.Literal['RK45', 'RK23', 'DOP853', 'Radau', 'BDF', 'LSODA'] = 'LSODA',\n atol: float = 1e-6, rtol: float = 1e-5,\n) -> np.ndarray:\n params = {}\n if uses_jacobian(method):\n params['jac'] = d2dt2\n\n y0 = (\n 1.5, 0., # UA\n 0., 2*np.pi, # UA/Année\n )\n t_span = (0., t_max) # Année\n out = scipy.integrate.solve_ivp(\n method=method, fun=ddt, t_span=t_span, y0=y0, atol=atol, rtol=rtol, dense_output=True, **params)\n if not out.success:\n raise ValueError(out.message)\n return out.y[:2] # x,y\n\n\ndef main() -> None:\n t_max = 1_000.\n for method in ('RK45', 'RK23', 'DOP853', 'Radau', 'BDF', 'LSODA'):\n t0 = time.perf_counter()\n xy = solve(t_max, method=method)\n t1 = time.perf_counter()\n print(f'{method:8} t={t1-t0:.2f} n={xy.shape[1]}', flush=True)\n fix, ax = plt.subplots()\n ax.set_title(f'method={method}, t_max={t_max}y, dur={t1 - t0:.2f}s')\n ax.plot(*xy)\n plt.show()\n\n\nif __name__ == '__main__':\n main()", "answer_url": "https://scicomp.stackexchange.com/a/45489", "author": "Reinderien", "author_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-07-13T00:25:35+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45488, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Reinderien", "profile_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "user_type": "registered"}, "created_at": "2026-07-13T00:25:35+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "C9922D8C-A590-4B1E-94CA-B97A778DA7B4", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/C9922D8C-A590-4B1E-94CA-B97A778DA7B4/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Reinderien", "profile_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "user_type": "registered"}, "created_at": "2026-07-13T01:06:34+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "43E7D35E-D810-41D3-9F12-FDE31BF65860", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/43E7D35E-D810-41D3-9F12-FDE31BF65860/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Reinderien", "profile_url": "https://scicomp.stackexchange.com/users/41212/reinderien", "user_type": "registered"}, "created_at": "2026-09-26T19:23:41+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "9970817B-8E8F-4EAC-BE66-46090CDC3BB0", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/9970817B-8E8F-4EAC-BE66-46090CDC3BB0/view-source"}], "score": 8, "updated_at": "2026-09-26T19:23:41+00:00"}, {"answer_html": "

The second variant correctly implements the first-order Euler method for the kinematic equation seen as a first-order ODE system. As the Euler method with large step size tends to increase the radius of the orbit, and apparently also the energy level, the gravitational orbit seemingly gets modified from the elliptical to the hyperbolic case.

\n

The first variant on the other hand modifies it to the second-order symplectic Euler method. This is more conservative to the energy level, but not necessarily to the other parameters of the Kepler ellipse. Thus the apparent perihel rotation and also perhaps some drift in the eccentricity of the ellipse.

\n

These errors will of course be reduced when using smaller step sizes, or higher order methods.

\n", "answer_id": 45492, "answer_text": "The second variant correctly implements the first-order Euler method for the kinematic equation seen as a first-order ODE system. As the Euler method with large step size tends to increase the radius of the orbit, and apparently also the energy level, the gravitational orbit seemingly gets modified from the elliptical to the hyperbolic case.\n\n\n\n\nThe first variant on the other hand modifies it to the second-order symplectic Euler method. This is more conservative to the energy level, but not necessarily to the other parameters of the Kepler ellipse. Thus the apparent perihel rotation and also perhaps some drift in the eccentricity of the ellipse.\n\n\n\n\nThese errors will of course be reduced when using smaller step sizes, or higher order methods.", "answer_url": "https://scicomp.stackexchange.com/a/45492", "author": "Lutz Lehmann", "author_url": "https://scicomp.stackexchange.com/users/6839/lutz-lehmann", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-07-13T16:52:52+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:49.393498+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/bdd73bdc9d483cfaf7d50f2075e853261f39886330cd6d24a17f7b3b2fb731e5_1790825329894890800_0.json", "raw_sha256": "dfbb76df9ebacfee7e902db64890f154a777bd3049356aee472798c591424d79", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/45545;45541;45538;45533;45532;45530;45523;45513;45510;45507;45499;45493;45488;45487;45479;45474;45472;45463;45461;45447;45444;45436;45428;45425;45424;45423;45422;45416;45414;45410;45404;45401;45396;45391;45389;45387;45380;45377;45376;45375;45369;45366;45365;45363;45362;45359;45350;45347;45344;45336;45334;45331;45326;45322;45316;45313;45311;45309;45305;45302;45300;45291;45289;45285;45276;45269;45263;45262;45261;45253;45247;45246;45238;45236;45230;45229;45208;45201;45200;45185;45183;45171;45167;45165;45158;45154;45146;45141;45139;45134;45129;45127;45122;45114;45112;45108;45105;45100;45098;45096/answers?filter=withbody&order=asc&page=2&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 45488, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Lutz Lehmann", "profile_url": "https://scicomp.stackexchange.com/users/6839/lutz-lehmann", "user_type": "registered"}, "created_at": "2026-07-13T16:52:52+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "2C5B9BF1-E49C-4BE3-8AF3-F047FF98EB7A", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/2C5B9BF1-E49C-4BE3-8AF3-F047FF98EB7A/view-source"}], "score": 6, "updated_at": "2026-07-13T16:52:52+00:00"}], "domain": "computational_science", "external_links": ["https://i.sstatic.net/KnVXs58G.png", "https://i.sstatic.net/Tq7uPZJj.png", "https://i.sstatic.net/XWVvnmXc.png", "https://i.sstatic.net/mLgbrUlD.png"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:28:44.584971+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/272744bcc95b58699f7df6e6979b288bb8b00a80ab9c7982dbe170a6d0b63584_1790825325025901700_0.json", "raw_sha256": "27a81850a40920682c29ada76a2b55e80340a5c82764a3e9dde8a9c2ba23db4e", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=1&pagesize=100&site=scicomp&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Omar Osman Mahamoud", "question_author_url": "https://scicomp.stackexchange.com/users/57039/omar-osman-mahamoud", "question_author_user_type": "registered", "question_created_at": "2026-07-12T16:05:18+00:00", "question_html": "

Can someone please tell me why these two codes don't give the same answer?

\n
import numpy as np\nimport matplotlib.pyplot as plt\nfrom matplotlib.animation import FuncAnimation\n\nG = 4 * (np.pi)**2\nM_sun = 1  # solar mass\ndistance = 1  # AU\ntemps = 1  # year\nM_earth = 3.002513826043238e-06  # solar mass\nv_earth = 2 * np.pi  # AU/year\ndt = 0.1\nn_steps = 10**3\n\nxpos = []\nypos = []\n\nx_earth = 1.5\ny_earth = 0\n\nvx_earth = 0\nvy_earth = v_earth\n\nfor i in range(n_steps):\n    ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n    ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n    vx_earth = vx_earth + ax_earth * dt\n    vy_earth = vy_earth + ay_earth * dt\n\n    xpos.append(x_earth)\n    ypos.append(y_earth)\n\n    x_earth = x_earth + vx_earth * dt\n    y_earth = y_earth + vy_earth * dt\n\nplt.plot(xpos, ypos, color="green")\nplt.show()\n
\n

\"it's

\n

and

\n
import numpy as np\nimport matplotlib.pyplot as plt\nfrom matplotlib.animation import FuncAnimation\n\n\nG=4*(np.pi)**2\nM_sun=1 # masse solaire\ndistance=1 # UA\ntemps=1 # Année\nM_earth=3.002513826043238e-06 # masse solaire\nv_earth=(2*np.pi) # UA/Année\ndt=0.1\nn_steps=10**3\n\n\nx_earth=np.zeros(n_steps)\ny_earth=np.zeros(n_steps)\n\nvx_earth=np.zeros(n_steps)\nvy_earth=np.zeros(n_steps)\n\n\nx_earth[0]=1.5\nvy_earth[0]=v_earth\n\nfor i in range(n_steps-1):\n    ax_earth=-(G*M_sun)*x_earth[i]/((x_earth[i]**2+y_earth[i]**2)**0.5)**3\n    ay_earth=-(G*M_sun)*y_earth[i]/((x_earth[i]**2+y_earth[i]**2)**0.5)**3\n    \n\n    vx_earth[i+1]=vx_earth[i]+ax_earth*dt\n    vy_earth[i+1]=vy_earth[i]+ay_earth*dt\n\n    x_earth[i+1]=x_earth[i]+vx_earth[i]*dt\n    y_earth[i+1]=y_earth[i]+vy_earth[i]*dt\n\n\nplt.plot(x_earth,y_earth, color='green')\n\nplt.show()\n\n
\n

\"it's

\n", "question_id": 45488, "question_license": "CC BY-SA 4.0", "question_score": 1, "question_text": "Can someone please tell me why these two codes don't give the same answer?\n\n\n\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom matplotlib.animation import FuncAnimation\n\nG = 4 * (np.pi)**2\nM_sun = 1 # solar mass\ndistance = 1 # AU\ntemps = 1 # year\nM_earth = 3.002513826043238e-06 # solar mass\nv_earth = 2 * np.pi # AU/year\ndt = 0.1\nn_steps = 10**3\n\nxpos = []\nypos = []\n\nx_earth = 1.5\ny_earth = 0\n\nvx_earth = 0\nvy_earth = v_earth\n\nfor i in range(n_steps):\n ax_earth = -(G * M_sun) * x_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n ay_earth = -(G * M_sun) * y_earth / ((x_earth**2 + y_earth**2)**0.5)**3\n\n vx_earth = vx_earth + ax_earth * dt\n vy_earth = vy_earth + ay_earth * dt\n\n xpos.append(x_earth)\n ypos.append(y_earth)\n\n x_earth = x_earth + vx_earth * dt\n y_earth = y_earth + vy_earth * dt\n\nplt.plot(xpos, ypos, color=\"green\")\nplt.show()\n\n\n\n\n\n[image: it's image; source: https://i.sstatic.net/mLgbrUlD.png] (https://i.sstatic.net/mLgbrUlD.png)\n\n\n\n\nand\n\n\n\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom matplotlib.animation import FuncAnimation\n\n\nG=4*(np.pi)**2\nM_sun=1 # masse solaire\ndistance=1 # UA\ntemps=1 # Année\nM_earth=3.002513826043238e-06 # masse solaire\nv_earth=(2*np.pi) # UA/Année\ndt=0.1\nn_steps=10**3\n\n\nx_earth=np.zeros(n_steps)\ny_earth=np.zeros(n_steps)\n\nvx_earth=np.zeros(n_steps)\nvy_earth=np.zeros(n_steps)\n\n\nx_earth[0]=1.5\nvy_earth[0]=v_earth\n\nfor i in range(n_steps-1):\n ax_earth=-(G*M_sun)*x_earth[i]/((x_earth[i]**2+y_earth[i]**2)**0.5)**3\n ay_earth=-(G*M_sun)*y_earth[i]/((x_earth[i]**2+y_earth[i]**2)**0.5)**3\n \n\n vx_earth[i+1]=vx_earth[i]+ax_earth*dt\n vy_earth[i+1]=vy_earth[i]+ay_earth*dt\n\n x_earth[i+1]=x_earth[i]+vx_earth[i]*dt\n y_earth[i+1]=y_earth[i]+vy_earth[i]*dt\n\n\nplt.plot(x_earth,y_earth, color='green')\n\nplt.show()\n\n\n\n\n\n\n[image: it's image; source: https://i.sstatic.net/XWVvnmXc.png] (https://i.sstatic.net/XWVvnmXc.png)", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Omar Osman Mahamoud", "profile_url": "https://scicomp.stackexchange.com/users/57039/omar-osman-mahamoud", "user_type": "registered"}, "created_at": "2026-07-12T16:05:18+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "F0D7914F-24E6-41F7-BF73-8B6CAC429B71", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://scicomp.stackexchange.com/revisions/F0D7914F-24E6-41F7-BF73-8B6CAC429B71/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2026-07-13T01:24:37+00:00", "raw_file": "raw/codex_api_v1/388d30597d4ce2c68c96b784f7bf92098fad8c44850c54687d3a3028cce83504_1790825358707940600_0.json", "raw_sha256": "798328140b22ca830f996dc29957e2ed66bad007670d3eb6cfce6a5d1c2b82b7", "revision_guid": "BC3D64B0-5C3E-43B3-B708-134F783143A0", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://scicomp.stackexchange.com/revisions/BC3D64B0-5C3E-43B3-B708-134F783143A0/view-source"}], "source_site": "scicomp", "source_url": "https://scicomp.stackexchange.com/questions/45488/why-do-these-two-python-implementations-of-the-same-algorithm-give-different-out", "split": "train", "split_group": "4ff0006883a431c9705a554000147f3098c4b66f9f495d2a19d5c9d5cef4057f", "tags": ["python", "computational-physics", "simulation", "numerical-integration"], "thread_id": "scicomp:45488", "title": "Why do these two Python implementations of the same algorithm give different outputs?"}} {"accepted_status": [false, false], "candidate_answers": [{"answer_html": "

Haven’t found a site, but if looking for ladybirds who are named after their numbers of spots, search

\n

Coccinellidae punctata

\n

The first is the family of ladybirds, the second is spots.

\n", "answer_id": 116017, "answer_text": "Haven’t found a site, but if looking for ladybirds who are named after their numbers of spots, search\n\n\n\n\nCoccinellidae punctata\n\n\n\n\nThe first is the family of ladybirds, the second is spots.", "answer_url": "https://biology.stackexchange.com/a/116017", "author": "Polypipe Wrangler", "author_url": "https://biology.stackexchange.com/users/56477/polypipe-wrangler", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-01-27T11:19:32+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:41.651282+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/49b81e7da29b3c5ecc961908934a60a3e3d33576f623d7db6647c4f4b3b18dba_0.json", "raw_sha256": "0cb9219330a5c9d57f3e474dcdd137ab3c3ae83667c4b84bf434435a38149889", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/112982;112980;112979;112977;112972;112967;112962;112956;112952;112948;112941;112938;112937;112936;112927;112925;112923;112919;112909;112905;112904;112898;112895;112893;112884;112881;112880;112879;112873;112872;112870;112869;112867;112850;112849;112848;112841;112835;112831;112824;112818;112811;112808;112807;112790;112789;112785;112777;112773;112770;112762;112759;112757;112756;112746;112739;112738;112737;112731;112705;112703;112700;112699;112698;112693;112691;112687;112685;112677;112671;112667;112663;112659;112653;112647;112646;112645;112636;112625;112621;112615;112614;112613;112610;112598;112593;112592;112586;112580;112575;112574;112564;112558;112552;112550;112549;112544;112539;112535;112531/answers?filter=withbody&order=asc&page=2&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 112952, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Polypipe Wrangler", "profile_url": "https://biology.stackexchange.com/users/56477/polypipe-wrangler", "user_type": "registered"}, "created_at": "2025-01-27T11:19:32+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "EE171CB8-C160-4818-97DF-8FE6E4366ECE", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/EE171CB8-C160-4818-97DF-8FE6E4366ECE/view-source"}], "score": 0, "updated_at": "2025-01-27T11:19:32+00:00"}, {"answer_html": "

This might not be the answer you were looking for, but it's worth noting that the number of spots can vary even within a single species. A remarkable example of this is showcased at the Natural History Museum in Vienna, Austria. One of the exhibits features a large, old collage of around 100 specimens of the species Anatis ocellata (see here on wikipedia), collected by Ernst Grundmann around 1970. This species, relatively common in Central Europe, displays a fascinating range of variation: some individuals have no spots at all, while others have more than 20 and pretty much everything in between. There are also unique forms where the spots have fused into fuzzy lines, adding to the diversity.

\n

I do have some photos of this collage, but I’m unsure if sharing them online would be allowed due to potential copyright issues. Fortunately, parts of the collage are already available online—check it out here.

\n", "answer_id": 116021, "answer_text": "This might not be the answer you were looking for, but it's worth noting that the number of spots can vary even within a single species. A remarkable example of this is showcased at the Natural History Museum in Vienna (https://nhm-wien.ac.at/), Austria. One of the exhibits features a large, old collage of around 100 specimens of the species Anatis ocellata (see here (https://en.wikipedia.org/wiki/Anatis_ocellata) on wikipedia), collected by Ernst Grundmann around 1970. This species, relatively common in Central Europe, displays a fascinating range of variation: some individuals have no spots at all, while others have more than 20 and pretty much everything in between. There are also unique forms where the spots have fused into fuzzy lines, adding to the diversity.\n\n\n\n\nI do have some photos of this collage, but I’m unsure if sharing them online would be allowed due to potential copyright issues. Fortunately, parts of the collage are already available online—check it out here (https://artsandculture.google.com/asset/ernst-grundmann-ladybird-collection/pwHVMB3YD5HoAw?hl=en).", "answer_url": "https://biology.stackexchange.com/a/116021", "author": "G. Blaickner", "author_url": "https://biology.stackexchange.com/users/76678/g-blaickner", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-01-28T08:08:16+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:41.651282+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/49b81e7da29b3c5ecc961908934a60a3e3d33576f623d7db6647c4f4b3b18dba_0.json", "raw_sha256": "0cb9219330a5c9d57f3e474dcdd137ab3c3ae83667c4b84bf434435a38149889", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/112982;112980;112979;112977;112972;112967;112962;112956;112952;112948;112941;112938;112937;112936;112927;112925;112923;112919;112909;112905;112904;112898;112895;112893;112884;112881;112880;112879;112873;112872;112870;112869;112867;112850;112849;112848;112841;112835;112831;112824;112818;112811;112808;112807;112790;112789;112785;112777;112773;112770;112762;112759;112757;112756;112746;112739;112738;112737;112731;112705;112703;112700;112699;112698;112693;112691;112687;112685;112677;112671;112667;112663;112659;112653;112647;112646;112645;112636;112625;112621;112615;112614;112613;112610;112598;112593;112592;112586;112580;112575;112574;112564;112558;112552;112550;112549;112544;112539;112535;112531/answers?filter=withbody&order=asc&page=2&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 112952, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "G. Blaickner", "profile_url": "https://biology.stackexchange.com/users/76678/g-blaickner", "user_type": "registered"}, "created_at": "2025-01-28T08:08:16+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "F7C853F5-DEAB-480B-856E-D99C61A7B14C", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/F7C853F5-DEAB-480B-856E-D99C61A7B14C/view-source"}], "score": 1, "updated_at": "2025-01-28T08:08:16+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I'm interested in Ladybugs. I read a lot about the number of spots of ladybugs. The number seems to be between 0 and 24, but as far as I can see, not every number in between exist. Up to now, I found ladybugs species with 0, 2, 4, 5, 7, 10, 11, 13, 14, 16, 17, 18, 19, 22 and 24 spots. Do more exist? Is there a scientifique site in the net with exactly that subject?\n\n\n\n\nThanks for your answers!\n\n\n\n\nLadybug", "record_id": "Scientific-Answer-Ranking:biology:112952", "scores": [0, 1], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

Haven’t found a site, but if looking for ladybirds who are named after their numbers of spots, search

\n

Coccinellidae punctata

\n

The first is the family of ladybirds, the second is spots.

\n", "answer_id": 116017, "answer_text": "Haven’t found a site, but if looking for ladybirds who are named after their numbers of spots, search\n\n\n\n\nCoccinellidae punctata\n\n\n\n\nThe first is the family of ladybirds, the second is spots.", "answer_url": "https://biology.stackexchange.com/a/116017", "author": "Polypipe Wrangler", "author_url": "https://biology.stackexchange.com/users/56477/polypipe-wrangler", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-01-27T11:19:32+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:41.651282+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/49b81e7da29b3c5ecc961908934a60a3e3d33576f623d7db6647c4f4b3b18dba_0.json", "raw_sha256": "0cb9219330a5c9d57f3e474dcdd137ab3c3ae83667c4b84bf434435a38149889", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/112982;112980;112979;112977;112972;112967;112962;112956;112952;112948;112941;112938;112937;112936;112927;112925;112923;112919;112909;112905;112904;112898;112895;112893;112884;112881;112880;112879;112873;112872;112870;112869;112867;112850;112849;112848;112841;112835;112831;112824;112818;112811;112808;112807;112790;112789;112785;112777;112773;112770;112762;112759;112757;112756;112746;112739;112738;112737;112731;112705;112703;112700;112699;112698;112693;112691;112687;112685;112677;112671;112667;112663;112659;112653;112647;112646;112645;112636;112625;112621;112615;112614;112613;112610;112598;112593;112592;112586;112580;112575;112574;112564;112558;112552;112550;112549;112544;112539;112535;112531/answers?filter=withbody&order=asc&page=2&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 112952, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Polypipe Wrangler", "profile_url": "https://biology.stackexchange.com/users/56477/polypipe-wrangler", "user_type": "registered"}, "created_at": "2025-01-27T11:19:32+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "EE171CB8-C160-4818-97DF-8FE6E4366ECE", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/EE171CB8-C160-4818-97DF-8FE6E4366ECE/view-source"}], "score": 0, "updated_at": "2025-01-27T11:19:32+00:00"}, {"answer_html": "

This might not be the answer you were looking for, but it's worth noting that the number of spots can vary even within a single species. A remarkable example of this is showcased at the Natural History Museum in Vienna, Austria. One of the exhibits features a large, old collage of around 100 specimens of the species Anatis ocellata (see here on wikipedia), collected by Ernst Grundmann around 1970. This species, relatively common in Central Europe, displays a fascinating range of variation: some individuals have no spots at all, while others have more than 20 and pretty much everything in between. There are also unique forms where the spots have fused into fuzzy lines, adding to the diversity.

\n

I do have some photos of this collage, but I’m unsure if sharing them online would be allowed due to potential copyright issues. Fortunately, parts of the collage are already available online—check it out here.

\n", "answer_id": 116021, "answer_text": "This might not be the answer you were looking for, but it's worth noting that the number of spots can vary even within a single species. A remarkable example of this is showcased at the Natural History Museum in Vienna (https://nhm-wien.ac.at/), Austria. One of the exhibits features a large, old collage of around 100 specimens of the species Anatis ocellata (see here (https://en.wikipedia.org/wiki/Anatis_ocellata) on wikipedia), collected by Ernst Grundmann around 1970. This species, relatively common in Central Europe, displays a fascinating range of variation: some individuals have no spots at all, while others have more than 20 and pretty much everything in between. There are also unique forms where the spots have fused into fuzzy lines, adding to the diversity.\n\n\n\n\nI do have some photos of this collage, but I’m unsure if sharing them online would be allowed due to potential copyright issues. Fortunately, parts of the collage are already available online—check it out here (https://artsandculture.google.com/asset/ernst-grundmann-ladybird-collection/pwHVMB3YD5HoAw?hl=en).", "answer_url": "https://biology.stackexchange.com/a/116021", "author": "G. Blaickner", "author_url": "https://biology.stackexchange.com/users/76678/g-blaickner", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-01-28T08:08:16+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:41.651282+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/49b81e7da29b3c5ecc961908934a60a3e3d33576f623d7db6647c4f4b3b18dba_0.json", "raw_sha256": "0cb9219330a5c9d57f3e474dcdd137ab3c3ae83667c4b84bf434435a38149889", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/112982;112980;112979;112977;112972;112967;112962;112956;112952;112948;112941;112938;112937;112936;112927;112925;112923;112919;112909;112905;112904;112898;112895;112893;112884;112881;112880;112879;112873;112872;112870;112869;112867;112850;112849;112848;112841;112835;112831;112824;112818;112811;112808;112807;112790;112789;112785;112777;112773;112770;112762;112759;112757;112756;112746;112739;112738;112737;112731;112705;112703;112700;112699;112698;112693;112691;112687;112685;112677;112671;112667;112663;112659;112653;112647;112646;112645;112636;112625;112621;112615;112614;112613;112610;112598;112593;112592;112586;112580;112575;112574;112564;112558;112552;112550;112549;112544;112539;112535;112531/answers?filter=withbody&order=asc&page=2&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 112952, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "G. Blaickner", "profile_url": "https://biology.stackexchange.com/users/76678/g-blaickner", "user_type": "registered"}, "created_at": "2025-01-28T08:08:16+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "F7C853F5-DEAB-480B-856E-D99C61A7B14C", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/F7C853F5-DEAB-480B-856E-D99C61A7B14C/view-source"}], "score": 1, "updated_at": "2025-01-28T08:08:16+00:00"}], "domain": "biology", "external_links": ["https://artsandculture.google.com/asset/ernst-grundmann-ladybird-collection/pwHVMB3YD5HoAw?hl=en", "https://en.wikipedia.org/wiki/Anatis_ocellata", "https://nhm-wien.ac.at/"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:12.794960+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/01e5186067e30dc1b8d7a145670ab7edd6b017797b271a481af8b7b7f55f13c2_0.json", "raw_sha256": "6c3960de7e1d3d7920bb88d02e2184614c219b391f39d9bddc2a582fdc9a71e7", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=10&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Ladybug", "question_author_url": "https://biology.stackexchange.com/users/76844/ladybug", "question_author_user_type": "registered", "question_created_at": "2023-09-07T06:36:21+00:00", "question_html": "

I'm interested in Ladybugs. I read a lot about the number of spots of ladybugs. The number seems to be between 0 and 24, but as far as I can see, not every number in between exist. Up to now, I found ladybugs species with 0, 2, 4, 5, 7, 10, 11, 13, 14, 16, 17, 18, 19, 22 and 24 spots. Do more exist? Is there a scientifique site in the net with exactly that subject?

\n

Thanks for your answers!

\n

Ladybug

\n", "question_id": 112952, "question_license": "CC BY-SA 4.0", "question_score": 2, "question_text": "I'm interested in Ladybugs. I read a lot about the number of spots of ladybugs. The number seems to be between 0 and 24, but as far as I can see, not every number in between exist. Up to now, I found ladybugs species with 0, 2, 4, 5, 7, 10, 11, 13, 14, 16, 17, 18, 19, 22 and 24 spots. Do more exist? Is there a scientifique site in the net with exactly that subject?\n\n\n\n\nThanks for your answers!\n\n\n\n\nLadybug", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ladybug", "profile_url": "https://biology.stackexchange.com/users/76844/ladybug", "user_type": "registered"}, "created_at": "2023-09-07T06:36:21+00:00", "raw_file": "raw/codex_api_v1/276704dec9e06f92cc8145549f11d289b09416db9510f3666cf41802c4fac079_1790824013419814500_0.json", "raw_sha256": "062895378f6d877b905162e2e8855c08fb76517235f50b72affe2d1d54cb9ced", "revision_guid": "24128BD9-EA2E-4F2A-BB2B-FB825B305564", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/24128BD9-EA2E-4F2A-BB2B-FB825B305564/view-source"}], "source_site": "biology", "source_url": "https://biology.stackexchange.com/questions/112952/ladybug-number-of-spots", "split": "train", "split_group": "6980c67ef3ac4321dc6986c6f2779af230c50273c71e1c698184e31a201e44c0", "tags": ["species-identification", "entomology", "species"], "thread_id": "biology:112952", "title": "Ladybug: Number of spots"}} {"accepted_status": [false, true], "candidate_answers": [{"answer_html": "

Update

\n

please see @bob1's answer below.

\n

Original answer

\n

I suspect that this is the paper you are interested in but I can't find even an abstract of it due to the obscurity/loss of the journal.

\n

In a different review paper, this 1959 Sinsheimer paper is described as such:

\n
\n

The first DNA molecule purified to homogeneity was the genome of bacteriophage ϕX174, reported by Sinsheimer in 1959 (12). Equilibrium buoyant density centrifugation of the ϕX virion yielded pure preparations from which the DNA could be easily isolated by phenol extraction. ϕX DNA turned out to be a single-stranded circular molecule that was estimated to be ∼5000 nt in length.

\n
\n", "answer_id": 114116, "answer_text": "Update\n\n\n\n\nplease see @bob1's answer below.\n\n\n\n\nOriginal answer\n\n\n\n\nI suspect that this (https://pubmed.ncbi.nlm.nih.gov/14447155/) is the paper you are interested in but I can't find even an abstract of it due to the obscurity/loss of the journal.\n\n\n\n\nIn a different review paper (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2094077/), this 1959 Sinsheimer paper is described as such:\n\n\n\n\n\n\n\nThe first DNA molecule purified to homogeneity was the genome of bacteriophage ϕX174, reported by Sinsheimer in 1959 (12). Equilibrium buoyant density centrifugation of the ϕX virion yielded pure preparations from which the DNA could be easily isolated by phenol extraction. ϕX DNA turned out to be a single-stranded circular molecule that was estimated to be ∼5000 nt in length.", "answer_url": "https://biology.stackexchange.com/a/114116", "author": "Maximilian Press", "author_url": "https://biology.stackexchange.com/users/22392/maximilian-press", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2024-02-17T18:04:38+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:30.839943+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/2139ae0ecb1bf62b149af3f8e91d7ce461ad269d38020aaf05922333eabb51a1_0.json", "raw_sha256": "2610bc07f1691b2794681a23d0459bba24822de1f31c7b48d79495b29b0b1285", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/114428;114427;114412;114410;114399;114395;114391;114386;114385;114381;114378;114377;114376;114374;114372;114371;114370;114361;114354;114353;114348;114342;114331;114329;114324;114321;114319;114307;114305;114304;114299;114298;114295;114290;114281;114277;114273;114266;114256;114239;114238;114222;114216;114213;114211;114207;114197;114192;114185;114180;114178;114175;114174;114173;114172;114169;114161;114156;114155;114148;114145;114144;114139;114136;114135;114127;114119;114117;114114;114111;114110;114103;114098;114096;114094;114089;114085;114078;114076;114069;114067;114065;114058;114055;114048;114045;114038;114031;114028;114027;114025;114021;114020;114012;114006;113998;113997;113988;113986;113983/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 114114, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Maximilian Press", "profile_url": "https://biology.stackexchange.com/users/22392/maximilian-press", "user_type": "registered"}, "created_at": "2024-02-17T18:04:38+00:00", "raw_file": "raw/codex_api_v1/4aa156cabb1f3edbc4e0a74ff84deb30f9cd06be13c7d021adab58e209db850d_1790824057164545000_0.json", "raw_sha256": "42ee08c1af6f231bf4bd10a51fd8384910e076e5d887f51c6dd79384012b46ec", "revision_guid": "3EC757B7-5578-4AE0-9794-BE9DB0995698", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/3EC757B7-5578-4AE0-9794-BE9DB0995698/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Maximilian Press", "profile_url": "https://biology.stackexchange.com/users/22392/maximilian-press", "user_type": "registered"}, "created_at": "2024-02-20T19:55:53+00:00", "raw_file": "raw/codex_api_v1/4aa156cabb1f3edbc4e0a74ff84deb30f9cd06be13c7d021adab58e209db850d_1790824057164545000_0.json", "raw_sha256": "42ee08c1af6f231bf4bd10a51fd8384910e076e5d887f51c6dd79384012b46ec", "revision_guid": "B08D65A7-4B84-4307-BF34-C49FEB8F6177", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/B08D65A7-4B84-4307-BF34-C49FEB8F6177/view-source"}], "score": 1, "updated_at": "2024-02-20T19:55:53+00:00"}, {"answer_html": "

I think @MaximilianPress was close. Chargaff certainly did early work on DNA structure, but he was not the one to identify that the genome of φX174 was circular. As far as I can tell, the actual peer reviewed publication was a pair of papers in Journal of Molecular Biology, written by R.L. Sinsheimer in 1959. I can access these articles through my institution, but I suspect that they are paywalled.

\n

These two articles are in volume 1, issue 1 of the journal on pages 37-42 and 43-53 respectively. I've reproduced the citations with abstracts below. The first indicates some oddities in the DNA of the bacteriophage and the second confirms these oddities and provides the explanation (emphasis is mine to highlight the salient point).

\n
\n

Robert L. Sinsheimer,\nPurification and properties of bacteriophage φX174,\nJournal of Molecular Biology,\nVolume 1, Issue 1,\n1959,\nPages 37-IN5,\nISSN 0022-2836,\nhttps://doi.org/10.1016/S0022-2836(59)80005-X.\n(https://www.sciencedirect.com/science/article/pii/S002228365980005X)

\n

Abstract: Procedures are described for the isolation in pure form of the bacterial virus φX174. This virus is shown to have a particle weight of 6·2 × 106 and to contain 25% by weight of DNA. At neutral pH, the purified virus forms a discrete aggregate, probably a tetra-mer. This aggregate dissociates either upon dilution or at alkaline pH. Lysates produced by φX174 contain a second particle, antigenically related to the virus, but not infective and of lower sedimentation rate and lesser DNA content. The DNA of φX174 appears to have an unusual structure in that it reacts with formaldehyde (even before extraction from the virus) and in that the atomic efficiency of inactivation of the virus by decay of incorporated phosphorus-32, calculated by combining our data and that of Tessman, is 1·0.

\n
\n
\n

Robert L. Sinsheimer,\nA single-stranded deoxyribonucleic acid from bacteriophage φX174,\nJournal of Molecular Biology,\nVolume 1, Issue 1,\n1959,\nPages 43-IN6,\nISSN 0022-2836,\nhttps://doi.org/10.1016/S0022-2836(59)80006-1.\n(https://www.sciencedirect.com/science/article/pii/S0022283659800061)

\n

Abstract: The deoxyribonucleic acid (DNA) of bacteriophage φX174 can be extracted by phenolic denaturation of the virus protein. The DNA thus obtained has a molecular weight of 1·7 × 106, indicating that there is one molecule per virus particle. This φX DNA does not have a complementary nucleotide composition. The ultraviolet absorption of this DNA is strongly dependent upon temperature in the range 20° to 60°C, and upon NaCl concentration in the range 10−3 to 10° M. This DNA reacts with formaldehyde at 37°C and is precipitated by plumbous ions. This evidence is interpreted to mean that the purine and pyrimidine rings are not involved in a tightly hydrogen-bonded complementary structure. Light scattering studies indicate that this DNA is highly flexible and that its configuration is strongly dependent upon the ionic strength of the solution. Upon treatment with pancreatic deoxyribonuclease, the weight-average molecular weight decreases in accordance with the function expected for a single-stranded molecule. It is concluded that the DNA of bacteriophage φX174 is single-stranded.

\n
\n", "answer_id": 114122, "answer_text": "I think @MaximilianPress was close. Chargaff certainly did early work on DNA structure, but he was not the one to identify that the genome of φX174 was circular. As far as I can tell, the actual peer reviewed publication was a pair of papers in Journal of Molecular Biology, written by R.L. Sinsheimer in 1959. I can access these articles through my institution, but I suspect that they are paywalled.\n\n\n\n\nThese two articles are in volume 1, issue 1 of the journal (https://www.sciencedirect.com/journal/journal-of-molecular-biology/vol/1/issue/1) on pages 37-42 and 43-53 respectively. I've reproduced the citations with abstracts below. The first indicates some oddities in the DNA of the bacteriophage and the second confirms these oddities and provides the explanation (emphasis is mine to highlight the salient point).\n\n\n\n\n\n\n\nRobert L. Sinsheimer,\nPurification and properties of bacteriophage φX174,\nJournal of Molecular Biology,\nVolume 1, Issue 1,\n1959,\nPages 37-IN5,\nISSN 0022-2836,\nhttps://doi.org/10.1016/S0022-2836(59)80005-X (https://doi.org/10.1016/S0022-2836(59)80005-X).\n(https://www.sciencedirect.com/science/article/pii/S002228365980005X (https://www.sciencedirect.com/science/article/pii/S002228365980005X))\n\n\n\n\nAbstract: Procedures are described for the isolation in pure form of the bacterial virus φX174. This virus is shown to have a particle weight of 6·2 × 106 and to contain 25% by weight of DNA. At neutral pH, the purified virus forms a discrete aggregate, probably a tetra-mer. This aggregate dissociates either upon dilution or at alkaline pH. Lysates produced by φX174 contain a second particle, antigenically related to the virus, but not infective and of lower sedimentation rate and lesser DNA content. The DNA of φX174 appears to have an unusual structure in that it reacts with formaldehyde (even before extraction from the virus) and in that the atomic efficiency of inactivation of the virus by decay of incorporated phosphorus-32, calculated by combining our data and that of Tessman, is 1·0.\n\n\n\n\n\n\n\n\n\n\nRobert L. Sinsheimer,\nA single-stranded deoxyribonucleic acid from bacteriophage φX174,\nJournal of Molecular Biology,\nVolume 1, Issue 1,\n1959,\nPages 43-IN6,\nISSN 0022-2836,\nhttps://doi.org/10.1016/S0022-2836(59)80006-1 (https://doi.org/10.1016/S0022-2836(59)80006-1).\n(https://www.sciencedirect.com/science/article/pii/S0022283659800061 (https://www.sciencedirect.com/science/article/pii/S0022283659800061))\n\n\n\n\nAbstract: The deoxyribonucleic acid (DNA) of bacteriophage φX174 can be extracted by phenolic denaturation of the virus protein. The DNA thus obtained has a molecular weight of 1·7 × 106, indicating that there is one molecule per virus particle. This φX DNA does not have a complementary nucleotide composition. The ultraviolet absorption of this DNA is strongly dependent upon temperature in the range 20° to 60°C, and upon NaCl concentration in the range 10−3 to 10° M. This DNA reacts with formaldehyde at 37°C and is precipitated by plumbous ions. This evidence is interpreted to mean that the purine and pyrimidine rings are not involved in a tightly hydrogen-bonded complementary structure. Light scattering studies indicate that this DNA is highly flexible and that its configuration is strongly dependent upon the ionic strength of the solution. Upon treatment with pancreatic deoxyribonuclease, the weight-average molecular weight decreases in accordance with the function expected for a single-stranded molecule. It is concluded that the DNA of bacteriophage φX174 is single-stranded.", "answer_url": "https://biology.stackexchange.com/a/114122", "author": "bob1", "author_url": "https://biology.stackexchange.com/users/65284/bob1", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2024-02-18T22:34:55+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:30.839943+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/2139ae0ecb1bf62b149af3f8e91d7ce461ad269d38020aaf05922333eabb51a1_0.json", "raw_sha256": "2610bc07f1691b2794681a23d0459bba24822de1f31c7b48d79495b29b0b1285", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/114428;114427;114412;114410;114399;114395;114391;114386;114385;114381;114378;114377;114376;114374;114372;114371;114370;114361;114354;114353;114348;114342;114331;114329;114324;114321;114319;114307;114305;114304;114299;114298;114295;114290;114281;114277;114273;114266;114256;114239;114238;114222;114216;114213;114211;114207;114197;114192;114185;114180;114178;114175;114174;114173;114172;114169;114161;114156;114155;114148;114145;114144;114139;114136;114135;114127;114119;114117;114114;114111;114110;114103;114098;114096;114094;114089;114085;114078;114076;114069;114067;114065;114058;114055;114048;114045;114038;114031;114028;114027;114025;114021;114020;114012;114006;113998;113997;113988;113986;113983/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 114114, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "bob1", "profile_url": "https://biology.stackexchange.com/users/65284/bob1", "user_type": "registered"}, "created_at": "2024-02-18T22:34:55+00:00", "raw_file": "raw/codex_api_v1/20c6382e006dfc70ceae89b5b384391a51cd420854d2e23edb6c44d00de6688e_1790824066738015300_0.json", "raw_sha256": "4baa513e3d4757eb58cf2dd23c824e0e27e58aa0c4e8ec570c22801fd30dcaa7", "revision_guid": "1BC4D02C-3290-4753-B797-25EB3A661C95", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/1BC4D02C-3290-4753-B797-25EB3A661C95/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "bob1", "profile_url": "https://biology.stackexchange.com/users/65284/bob1", "user_type": "registered"}, "created_at": "2024-02-19T03:49:05+00:00", "raw_file": "raw/codex_api_v1/20c6382e006dfc70ceae89b5b384391a51cd420854d2e23edb6c44d00de6688e_1790824066738015300_0.json", "raw_sha256": "4baa513e3d4757eb58cf2dd23c824e0e27e58aa0c4e8ec570c22801fd30dcaa7", "revision_guid": "13E01D91-AF7B-45B6-BA89-53BAAF5FAF1A", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/13E01D91-AF7B-45B6-BA89-53BAAF5FAF1A/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "bob1", "profile_url": "https://biology.stackexchange.com/users/65284/bob1", "user_type": "registered"}, "created_at": "2024-02-20T01:26:07+00:00", "raw_file": "raw/codex_api_v1/20c6382e006dfc70ceae89b5b384391a51cd420854d2e23edb6c44d00de6688e_1790824066738015300_0.json", "raw_sha256": "4baa513e3d4757eb58cf2dd23c824e0e27e58aa0c4e8ec570c22801fd30dcaa7", "revision_guid": "76AADE61-FCC0-4538-B58C-A6712E6E275C", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/76AADE61-FCC0-4538-B58C-A6712E6E275C/view-source"}], "score": 2, "updated_at": "2024-02-20T01:26:07+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I have recently read that Erwin Chargaff has discovered that the genome of phage phiX174 (ϕχ174) is single-stranded. However I could not find the paper reporting this discovery.\n\n\n\n\nIs there a link to the paper reporting this finding?\n\n\n\n\nThank you.", "record_id": "Scientific-Answer-Ranking:biology:114114", "scores": [1, 2], "split": "train", "thread": {"accepted_answer_id": 114122, "answers": [{"answer_html": "

Update

\n

please see @bob1's answer below.

\n

Original answer

\n

I suspect that this is the paper you are interested in but I can't find even an abstract of it due to the obscurity/loss of the journal.

\n

In a different review paper, this 1959 Sinsheimer paper is described as such:

\n
\n

The first DNA molecule purified to homogeneity was the genome of bacteriophage ϕX174, reported by Sinsheimer in 1959 (12). Equilibrium buoyant density centrifugation of the ϕX virion yielded pure preparations from which the DNA could be easily isolated by phenol extraction. ϕX DNA turned out to be a single-stranded circular molecule that was estimated to be ∼5000 nt in length.

\n
\n", "answer_id": 114116, "answer_text": "Update\n\n\n\n\nplease see @bob1's answer below.\n\n\n\n\nOriginal answer\n\n\n\n\nI suspect that this (https://pubmed.ncbi.nlm.nih.gov/14447155/) is the paper you are interested in but I can't find even an abstract of it due to the obscurity/loss of the journal.\n\n\n\n\nIn a different review paper (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2094077/), this 1959 Sinsheimer paper is described as such:\n\n\n\n\n\n\n\nThe first DNA molecule purified to homogeneity was the genome of bacteriophage ϕX174, reported by Sinsheimer in 1959 (12). Equilibrium buoyant density centrifugation of the ϕX virion yielded pure preparations from which the DNA could be easily isolated by phenol extraction. ϕX DNA turned out to be a single-stranded circular molecule that was estimated to be ∼5000 nt in length.", "answer_url": "https://biology.stackexchange.com/a/114116", "author": "Maximilian Press", "author_url": "https://biology.stackexchange.com/users/22392/maximilian-press", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2024-02-17T18:04:38+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:30.839943+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/2139ae0ecb1bf62b149af3f8e91d7ce461ad269d38020aaf05922333eabb51a1_0.json", "raw_sha256": "2610bc07f1691b2794681a23d0459bba24822de1f31c7b48d79495b29b0b1285", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/114428;114427;114412;114410;114399;114395;114391;114386;114385;114381;114378;114377;114376;114374;114372;114371;114370;114361;114354;114353;114348;114342;114331;114329;114324;114321;114319;114307;114305;114304;114299;114298;114295;114290;114281;114277;114273;114266;114256;114239;114238;114222;114216;114213;114211;114207;114197;114192;114185;114180;114178;114175;114174;114173;114172;114169;114161;114156;114155;114148;114145;114144;114139;114136;114135;114127;114119;114117;114114;114111;114110;114103;114098;114096;114094;114089;114085;114078;114076;114069;114067;114065;114058;114055;114048;114045;114038;114031;114028;114027;114025;114021;114020;114012;114006;113998;113997;113988;113986;113983/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 114114, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Maximilian Press", "profile_url": "https://biology.stackexchange.com/users/22392/maximilian-press", "user_type": "registered"}, "created_at": "2024-02-17T18:04:38+00:00", "raw_file": "raw/codex_api_v1/4aa156cabb1f3edbc4e0a74ff84deb30f9cd06be13c7d021adab58e209db850d_1790824057164545000_0.json", "raw_sha256": "42ee08c1af6f231bf4bd10a51fd8384910e076e5d887f51c6dd79384012b46ec", "revision_guid": "3EC757B7-5578-4AE0-9794-BE9DB0995698", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/3EC757B7-5578-4AE0-9794-BE9DB0995698/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Maximilian Press", "profile_url": "https://biology.stackexchange.com/users/22392/maximilian-press", "user_type": "registered"}, "created_at": "2024-02-20T19:55:53+00:00", "raw_file": "raw/codex_api_v1/4aa156cabb1f3edbc4e0a74ff84deb30f9cd06be13c7d021adab58e209db850d_1790824057164545000_0.json", "raw_sha256": "42ee08c1af6f231bf4bd10a51fd8384910e076e5d887f51c6dd79384012b46ec", "revision_guid": "B08D65A7-4B84-4307-BF34-C49FEB8F6177", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/B08D65A7-4B84-4307-BF34-C49FEB8F6177/view-source"}], "score": 1, "updated_at": "2024-02-20T19:55:53+00:00"}, {"answer_html": "

I think @MaximilianPress was close. Chargaff certainly did early work on DNA structure, but he was not the one to identify that the genome of φX174 was circular. As far as I can tell, the actual peer reviewed publication was a pair of papers in Journal of Molecular Biology, written by R.L. Sinsheimer in 1959. I can access these articles through my institution, but I suspect that they are paywalled.

\n

These two articles are in volume 1, issue 1 of the journal on pages 37-42 and 43-53 respectively. I've reproduced the citations with abstracts below. The first indicates some oddities in the DNA of the bacteriophage and the second confirms these oddities and provides the explanation (emphasis is mine to highlight the salient point).

\n
\n

Robert L. Sinsheimer,\nPurification and properties of bacteriophage φX174,\nJournal of Molecular Biology,\nVolume 1, Issue 1,\n1959,\nPages 37-IN5,\nISSN 0022-2836,\nhttps://doi.org/10.1016/S0022-2836(59)80005-X.\n(https://www.sciencedirect.com/science/article/pii/S002228365980005X)

\n

Abstract: Procedures are described for the isolation in pure form of the bacterial virus φX174. This virus is shown to have a particle weight of 6·2 × 106 and to contain 25% by weight of DNA. At neutral pH, the purified virus forms a discrete aggregate, probably a tetra-mer. This aggregate dissociates either upon dilution or at alkaline pH. Lysates produced by φX174 contain a second particle, antigenically related to the virus, but not infective and of lower sedimentation rate and lesser DNA content. The DNA of φX174 appears to have an unusual structure in that it reacts with formaldehyde (even before extraction from the virus) and in that the atomic efficiency of inactivation of the virus by decay of incorporated phosphorus-32, calculated by combining our data and that of Tessman, is 1·0.

\n
\n
\n

Robert L. Sinsheimer,\nA single-stranded deoxyribonucleic acid from bacteriophage φX174,\nJournal of Molecular Biology,\nVolume 1, Issue 1,\n1959,\nPages 43-IN6,\nISSN 0022-2836,\nhttps://doi.org/10.1016/S0022-2836(59)80006-1.\n(https://www.sciencedirect.com/science/article/pii/S0022283659800061)

\n

Abstract: The deoxyribonucleic acid (DNA) of bacteriophage φX174 can be extracted by phenolic denaturation of the virus protein. The DNA thus obtained has a molecular weight of 1·7 × 106, indicating that there is one molecule per virus particle. This φX DNA does not have a complementary nucleotide composition. The ultraviolet absorption of this DNA is strongly dependent upon temperature in the range 20° to 60°C, and upon NaCl concentration in the range 10−3 to 10° M. This DNA reacts with formaldehyde at 37°C and is precipitated by plumbous ions. This evidence is interpreted to mean that the purine and pyrimidine rings are not involved in a tightly hydrogen-bonded complementary structure. Light scattering studies indicate that this DNA is highly flexible and that its configuration is strongly dependent upon the ionic strength of the solution. Upon treatment with pancreatic deoxyribonuclease, the weight-average molecular weight decreases in accordance with the function expected for a single-stranded molecule. It is concluded that the DNA of bacteriophage φX174 is single-stranded.

\n
\n", "answer_id": 114122, "answer_text": "I think @MaximilianPress was close. Chargaff certainly did early work on DNA structure, but he was not the one to identify that the genome of φX174 was circular. As far as I can tell, the actual peer reviewed publication was a pair of papers in Journal of Molecular Biology, written by R.L. Sinsheimer in 1959. I can access these articles through my institution, but I suspect that they are paywalled.\n\n\n\n\nThese two articles are in volume 1, issue 1 of the journal (https://www.sciencedirect.com/journal/journal-of-molecular-biology/vol/1/issue/1) on pages 37-42 and 43-53 respectively. I've reproduced the citations with abstracts below. The first indicates some oddities in the DNA of the bacteriophage and the second confirms these oddities and provides the explanation (emphasis is mine to highlight the salient point).\n\n\n\n\n\n\n\nRobert L. Sinsheimer,\nPurification and properties of bacteriophage φX174,\nJournal of Molecular Biology,\nVolume 1, Issue 1,\n1959,\nPages 37-IN5,\nISSN 0022-2836,\nhttps://doi.org/10.1016/S0022-2836(59)80005-X (https://doi.org/10.1016/S0022-2836(59)80005-X).\n(https://www.sciencedirect.com/science/article/pii/S002228365980005X (https://www.sciencedirect.com/science/article/pii/S002228365980005X))\n\n\n\n\nAbstract: Procedures are described for the isolation in pure form of the bacterial virus φX174. This virus is shown to have a particle weight of 6·2 × 106 and to contain 25% by weight of DNA. At neutral pH, the purified virus forms a discrete aggregate, probably a tetra-mer. This aggregate dissociates either upon dilution or at alkaline pH. Lysates produced by φX174 contain a second particle, antigenically related to the virus, but not infective and of lower sedimentation rate and lesser DNA content. The DNA of φX174 appears to have an unusual structure in that it reacts with formaldehyde (even before extraction from the virus) and in that the atomic efficiency of inactivation of the virus by decay of incorporated phosphorus-32, calculated by combining our data and that of Tessman, is 1·0.\n\n\n\n\n\n\n\n\n\n\nRobert L. Sinsheimer,\nA single-stranded deoxyribonucleic acid from bacteriophage φX174,\nJournal of Molecular Biology,\nVolume 1, Issue 1,\n1959,\nPages 43-IN6,\nISSN 0022-2836,\nhttps://doi.org/10.1016/S0022-2836(59)80006-1 (https://doi.org/10.1016/S0022-2836(59)80006-1).\n(https://www.sciencedirect.com/science/article/pii/S0022283659800061 (https://www.sciencedirect.com/science/article/pii/S0022283659800061))\n\n\n\n\nAbstract: The deoxyribonucleic acid (DNA) of bacteriophage φX174 can be extracted by phenolic denaturation of the virus protein. The DNA thus obtained has a molecular weight of 1·7 × 106, indicating that there is one molecule per virus particle. This φX DNA does not have a complementary nucleotide composition. The ultraviolet absorption of this DNA is strongly dependent upon temperature in the range 20° to 60°C, and upon NaCl concentration in the range 10−3 to 10° M. This DNA reacts with formaldehyde at 37°C and is precipitated by plumbous ions. This evidence is interpreted to mean that the purine and pyrimidine rings are not involved in a tightly hydrogen-bonded complementary structure. Light scattering studies indicate that this DNA is highly flexible and that its configuration is strongly dependent upon the ionic strength of the solution. Upon treatment with pancreatic deoxyribonuclease, the weight-average molecular weight decreases in accordance with the function expected for a single-stranded molecule. It is concluded that the DNA of bacteriophage φX174 is single-stranded.", "answer_url": "https://biology.stackexchange.com/a/114122", "author": "bob1", "author_url": "https://biology.stackexchange.com/users/65284/bob1", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2024-02-18T22:34:55+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:30.839943+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/2139ae0ecb1bf62b149af3f8e91d7ce461ad269d38020aaf05922333eabb51a1_0.json", "raw_sha256": "2610bc07f1691b2794681a23d0459bba24822de1f31c7b48d79495b29b0b1285", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/114428;114427;114412;114410;114399;114395;114391;114386;114385;114381;114378;114377;114376;114374;114372;114371;114370;114361;114354;114353;114348;114342;114331;114329;114324;114321;114319;114307;114305;114304;114299;114298;114295;114290;114281;114277;114273;114266;114256;114239;114238;114222;114216;114213;114211;114207;114197;114192;114185;114180;114178;114175;114174;114173;114172;114169;114161;114156;114155;114148;114145;114144;114139;114136;114135;114127;114119;114117;114114;114111;114110;114103;114098;114096;114094;114089;114085;114078;114076;114069;114067;114065;114058;114055;114048;114045;114038;114031;114028;114027;114025;114021;114020;114012;114006;113998;113997;113988;113986;113983/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 114114, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "bob1", "profile_url": "https://biology.stackexchange.com/users/65284/bob1", "user_type": "registered"}, "created_at": "2024-02-18T22:34:55+00:00", "raw_file": "raw/codex_api_v1/20c6382e006dfc70ceae89b5b384391a51cd420854d2e23edb6c44d00de6688e_1790824066738015300_0.json", "raw_sha256": "4baa513e3d4757eb58cf2dd23c824e0e27e58aa0c4e8ec570c22801fd30dcaa7", "revision_guid": "1BC4D02C-3290-4753-B797-25EB3A661C95", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/1BC4D02C-3290-4753-B797-25EB3A661C95/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "bob1", "profile_url": "https://biology.stackexchange.com/users/65284/bob1", "user_type": "registered"}, "created_at": "2024-02-19T03:49:05+00:00", "raw_file": "raw/codex_api_v1/20c6382e006dfc70ceae89b5b384391a51cd420854d2e23edb6c44d00de6688e_1790824066738015300_0.json", "raw_sha256": "4baa513e3d4757eb58cf2dd23c824e0e27e58aa0c4e8ec570c22801fd30dcaa7", "revision_guid": "13E01D91-AF7B-45B6-BA89-53BAAF5FAF1A", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/13E01D91-AF7B-45B6-BA89-53BAAF5FAF1A/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "bob1", "profile_url": "https://biology.stackexchange.com/users/65284/bob1", "user_type": "registered"}, "created_at": "2024-02-20T01:26:07+00:00", "raw_file": "raw/codex_api_v1/20c6382e006dfc70ceae89b5b384391a51cd420854d2e23edb6c44d00de6688e_1790824066738015300_0.json", "raw_sha256": "4baa513e3d4757eb58cf2dd23c824e0e27e58aa0c4e8ec570c22801fd30dcaa7", "revision_guid": "76AADE61-FCC0-4538-B58C-A6712E6E275C", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/76AADE61-FCC0-4538-B58C-A6712E6E275C/view-source"}], "score": 2, "updated_at": "2024-02-20T01:26:07+00:00"}], "domain": "biology", "external_links": ["https://doi.org/10.1016/S0022-2836(59)80005-X", "https://doi.org/10.1016/S0022-2836(59)80006-1", "https://pubmed.ncbi.nlm.nih.gov/14447155/", "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2094077/", "https://www.sciencedirect.com/journal/journal-of-molecular-biology/vol/1/issue/1", "https://www.sciencedirect.com/science/article/pii/S002228365980005X", "https://www.sciencedirect.com/science/article/pii/S0022283659800061"], "medical_sensitive": true, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:08.576606+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/1051d4f3e38449f1419d1973ac812b2286659e454a76f89a23fdaa941dfadddb_0.json", "raw_sha256": "583dcd577e20d33b29e9f8818a7ab6a1fab039c19ab79927e16096cff23fa61d", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=7&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Gigiux", "question_author_url": "https://biology.stackexchange.com/users/27192/gigiux", "question_author_user_type": "registered", "question_created_at": "2024-02-17T08:35:15+00:00", "question_html": "

I have recently read that Erwin Chargaff has discovered that the genome of phage phiX174 (ϕχ174) is single-stranded. However I could not find the paper reporting this discovery.

\n

Is there a link to the paper reporting this finding?

\n

Thank you.

\n", "question_id": 114114, "question_license": "CC BY-SA 4.0", "question_score": 1, "question_text": "I have recently read that Erwin Chargaff has discovered that the genome of phage phiX174 (ϕχ174) is single-stranded. However I could not find the paper reporting this discovery.\n\n\n\n\nIs there a link to the paper reporting this finding?\n\n\n\n\nThank you.", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Gigiux", "profile_url": "https://biology.stackexchange.com/users/27192/gigiux", "user_type": "registered"}, "created_at": "2024-02-17T08:35:15+00:00", "raw_file": "raw/codex_api_v1/4aa156cabb1f3edbc4e0a74ff84deb30f9cd06be13c7d021adab58e209db850d_1790824057164545000_0.json", "raw_sha256": "42ee08c1af6f231bf4bd10a51fd8384910e076e5d887f51c6dd79384012b46ec", "revision_guid": "233C1C36-3C42-4C0B-8CDD-42D0529FE30A", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/233C1C36-3C42-4C0B-8CDD-42D0529FE30A/view-source"}, {"content_license": null, "contributor": {"display_name": "Maximilian Press", "profile_url": "https://biology.stackexchange.com/users/22392/maximilian-press", "user_type": "registered"}, "created_at": "2024-02-20T21:26:53+00:00", "raw_file": "raw/codex_api_v1/4aa156cabb1f3edbc4e0a74ff84deb30f9cd06be13c7d021adab58e209db850d_1790824057164545000_0.json", "raw_sha256": "42ee08c1af6f231bf4bd10a51fd8384910e076e5d887f51c6dd79384012b46ec", "revision_guid": "98F736C8-3A0C-4FE7-9AD6-4A9D9572A052", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/98F736C8-3A0C-4FE7-9AD6-4A9D9572A052/view-source"}], "source_site": "biology", "source_url": "https://biology.stackexchange.com/questions/114114/who-discovered-that-phage-phix174-has-a-single-stranded-genome", "split": "train", "split_group": "fc87616f4a0f84574906701edc374700c718cb7f039eaa0ea0056cd034e31d31", "tags": ["molecular-biology", "genomes", "history", "bacteriophage"], "thread_id": "biology:114114", "title": "Who discovered that phage phiX174 has a single-stranded genome?"}} {"accepted_status": [true, false, false], "candidate_answers": [{"answer_html": "

From Wikipedia, bold added by me:

\n
\n

In population genetics, the Hardy–Weinberg principle, also known as the Hardy–Weinberg equilibrium, model, theorem, or law, states that allele and genotype frequencies in a population will remain constant from generation to generation in the absence of other evolutionary influences. These influences include genetic drift, mate choice, assortative mating, natural selection, sexual selection, mutation, gene flow, meiotic drive, genetic hitchhiking, population bottleneck, founder effect, inbreeding and outbreeding depression.

\n
\n

Therefore, if you observe allele frequencies that do not match what Hardy-Weinberg would suggest, that means one of those other things is happening. Think of Hardy-Weinberg a bit like the "null hypothesis". You can't tell directly which of these is occurring, and multiple evolutionary influences can occur simultaneously.

\n

We can think about a particular example, though. Let's say you have a case with a recessive trait where the phenotype of vv individuals makes them more likely to die. You would expect when you look at genotype frequencies to find them out of equilibrium with respect to Hardy-Weinberg: you'll find fewer vv individuals than you'd otherwise expect based on the overall rate of v alleles in the population.

\n

It's important to consider sampling effects in your measurement, too. Your estimates will rarely match the Hardy-Weinberg frequencies perfectly just from noise in your sampling. You'll want some estimate of how likely it is that, assuming the population actually does follow Hardy-Weinberg, you'd get a deviation as large as the one you observe. That is achieved by performing a chi-squared test.

\n
\n

How can you tell if the population is evolving if you don't even know the allele frequencies or the genotype frequencies of the next generation?

\n
\n

You can tell because if the population isn't evolving (this statement means exactly that the allele frequencies stay the same) and mating is random then the allele frequencies would be equal to the Hardy-Weinberg frequencies. A bit like if you park your bicycle, go inside, and come back outside and see no bicycle there, you can infer that your bicycle has moved even though you didn't actually observe it moving. You may not be able to conclude whether it was ridden away, was blown by the wind, or picked up and placed in a truck and driven off, but just the fact that it's not where you left it provides information that something is happening besides the "null hypothesis" that bicycles left in a place stay there.

\n", "answer_id": 114345, "answer_text": "From Wikipedia (https://en.wikipedia.org/wiki/Hardy%E2%80%93Weinberg_principle), bold added by me:\n\n\n\n\n\n\n\nIn population genetics, the Hardy–Weinberg principle, also known as the Hardy–Weinberg equilibrium, model, theorem, or law, states that allele and genotype frequencies in a population will remain constant from generation to generation in the absence of other evolutionary influences. These influences include genetic drift, mate choice, assortative mating, natural selection, sexual selection, mutation, gene flow, meiotic drive, genetic hitchhiking, population bottleneck, founder effect, inbreeding and outbreeding depression.\n\n\n\n\n\n\n\nTherefore, if you observe allele frequencies that do not match what Hardy-Weinberg would suggest, that means one of those other things is happening. Think of Hardy-Weinberg a bit like the \"null hypothesis\". You can't tell directly which of these is occurring, and multiple evolutionary influences can occur simultaneously.\n\n\n\n\nWe can think about a particular example, though. Let's say you have a case with a recessive trait where the phenotype of vv individuals makes them more likely to die. You would expect when you look at genotype frequencies to find them out of equilibrium with respect to Hardy-Weinberg: you'll find fewer vv individuals than you'd otherwise expect based on the overall rate of v alleles in the population.\n\n\n\n\nIt's important to consider sampling effects in your measurement, too. Your estimates will rarely match the Hardy-Weinberg frequencies perfectly just from noise in your sampling. You'll want some estimate of how likely it is that, assuming the population actually does follow Hardy-Weinberg, you'd get a deviation as large as the one you observe. That is achieved by performing a chi-squared test.\n\n\n\n\n\n\n\nHow can you tell if the population is evolving if you don't even know the allele frequencies or the genotype frequencies of the next generation?\n\n\n\n\n\n\n\nYou can tell because if the population isn't evolving (this statement means exactly that the allele frequencies stay the same) and mating is random then the allele frequencies would be equal to the Hardy-Weinberg frequencies. A bit like if you park your bicycle, go inside, and come back outside and see no bicycle there, you can infer that your bicycle has moved even though you didn't actually observe it moving. You may not be able to conclude whether it was ridden away, was blown by the wind, or picked up and placed in a truck and driven off, but just the fact that it's not where you left it provides information that something is happening besides the \"null hypothesis\" that bicycles left in a place stay there.", "answer_url": "https://biology.stackexchange.com/a/114345", "author": "Bryan Krause", "author_url": "https://biology.stackexchange.com/users/27148/bryan-krause", "author_user_type": "moderator", "content_license": "CC BY-SA 4.0", "created_at": "2024-03-20T13:42:15+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:30.839943+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/2139ae0ecb1bf62b149af3f8e91d7ce461ad269d38020aaf05922333eabb51a1_0.json", "raw_sha256": "2610bc07f1691b2794681a23d0459bba24822de1f31c7b48d79495b29b0b1285", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/114428;114427;114412;114410;114399;114395;114391;114386;114385;114381;114378;114377;114376;114374;114372;114371;114370;114361;114354;114353;114348;114342;114331;114329;114324;114321;114319;114307;114305;114304;114299;114298;114295;114290;114281;114277;114273;114266;114256;114239;114238;114222;114216;114213;114211;114207;114197;114192;114185;114180;114178;114175;114174;114173;114172;114169;114161;114156;114155;114148;114145;114144;114139;114136;114135;114127;114119;114117;114114;114111;114110;114103;114098;114096;114094;114089;114085;114078;114076;114069;114067;114065;114058;114055;114048;114045;114038;114031;114028;114027;114025;114021;114020;114012;114006;113998;113997;113988;113986;113983/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 114342, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Bryan Krause", "profile_url": "https://biology.stackexchange.com/users/27148/bryan-krause", "user_type": "moderator"}, "created_at": "2024-03-20T13:42:15+00:00", "raw_file": "raw/codex_api_v1/22e8417b315063b6d3b906d11f4422eb4ac33f788b9058bddc9dd7bfc046cafc_1790824071906161300_0.json", "raw_sha256": "84dcb0018b97f3e9f1f4320ffea98714a55b6054974fc678a4c6cac9e312e078", "revision_guid": "FB12158F-F3D5-4699-812C-D573FCE32BBA", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/FB12158F-F3D5-4699-812C-D573FCE32BBA/view-source"}], "score": 2, "updated_at": "2024-03-20T13:42:15+00:00"}, {"answer_html": "

I am more than a little late, but for the sake of completeness I figured I should say that technically a population can both not be in Hardy-Weinberg Equilibrium and not experience evolution. For example, natural selection and sexual selection can act against one another. Think of brightly colored birds that suffer from more predation, but are more attractive mates. Another example is where the less common a phenotype is, more successful members are. This is actually the logic behind Fisher's Principle (i.e. the ratio between sexes in a species will be 1:1). These situations are examples of an evolutionary stable states and there is a whole field of mathematical biology that studies stuff just like this.

\n

Your textbook was probably ignoring these situations for the same of simplicity. It is really important to understand that Hardy-Weinberg Equilibrium always results in no evolution. Other situations that lead to no evolution can be taught later.

\n", "answer_id": 117608, "answer_text": "I am more than a little late, but for the sake of completeness I figured I should say that technically a population can both not be in Hardy-Weinberg Equilibrium and not experience evolution. For example, natural selection and sexual selection can act against one another. Think of brightly colored birds that suffer from more predation, but are more attractive mates. Another example is where the less common a phenotype is, more successful members are. This is actually the logic behind Fisher's Principle (https://en.wikipedia.org/wiki/Fisher%27s_principle) (i.e. the ratio between sexes in a species will be 1:1). These situations are examples of an evolutionary stable states (https://en.wikipedia.org/wiki/Evolutionarily_stable_state) and there is a whole field of mathematical biology that studies stuff just like this.\n\n\n\n\nYour textbook was probably ignoring these situations for the same of simplicity. It is really important to understand that Hardy-Weinberg Equilibrium always results in no evolution. Other situations that lead to no evolution can be taught later.", "answer_url": "https://biology.stackexchange.com/a/117608", "author": "E Tam", "author_url": "https://biology.stackexchange.com/users/5149/e-tam", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-06-19T20:47:59+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:32.233008+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/29e10377e709be0879cc174e9be11ba5513feaafd20aa842a20668af70c6d683_0.json", "raw_sha256": "535e870bb8fe62b3db0c0b66043a398cf2f6d26fcd7ad4a13a2a7e2a09999ee9", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/114428;114427;114412;114410;114399;114395;114391;114386;114385;114381;114378;114377;114376;114374;114372;114371;114370;114361;114354;114353;114348;114342;114331;114329;114324;114321;114319;114307;114305;114304;114299;114298;114295;114290;114281;114277;114273;114266;114256;114239;114238;114222;114216;114213;114211;114207;114197;114192;114185;114180;114178;114175;114174;114173;114172;114169;114161;114156;114155;114148;114145;114144;114139;114136;114135;114127;114119;114117;114114;114111;114110;114103;114098;114096;114094;114089;114085;114078;114076;114069;114067;114065;114058;114055;114048;114045;114038;114031;114028;114027;114025;114021;114020;114012;114006;113998;113997;113988;113986;113983/answers?filter=withbody&order=asc&page=2&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 114342, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "E Tam", "profile_url": "https://biology.stackexchange.com/users/5149/e-tam", "user_type": "registered"}, "created_at": "2025-06-19T20:47:59+00:00", "raw_file": "raw/codex_api_v1/80ec0626e4dca1e373c0bba13c4761d1214a376d40d05a99b2449abc3be980f1_1790824142842265700_0.json", "raw_sha256": "33eeba97fc2f78c2f9362274c5b7e2be011563807fed5b756d22d51f059bffce", "revision_guid": "14D0326D-0F41-4E6E-BCFD-25C0ED84A84C", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/14D0326D-0F41-4E6E-BCFD-25C0ED84A84C/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ben Bolker", "profile_url": "https://biology.stackexchange.com/users/25523/ben-bolker", "user_type": "registered"}, "created_at": "2025-06-20T01:05:59+00:00", "raw_file": "raw/codex_api_v1/80ec0626e4dca1e373c0bba13c4761d1214a376d40d05a99b2449abc3be980f1_1790824142842265700_0.json", "raw_sha256": "33eeba97fc2f78c2f9362274c5b7e2be011563807fed5b756d22d51f059bffce", "revision_guid": "AFDFC42B-11A8-43EC-B8AE-2D194664C2BB", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/AFDFC42B-11A8-43EC-B8AE-2D194664C2BB/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "E Tam", "profile_url": "https://biology.stackexchange.com/users/5149/e-tam", "user_type": "registered"}, "created_at": "2025-06-25T20:58:41+00:00", "raw_file": "raw/codex_api_v1/80ec0626e4dca1e373c0bba13c4761d1214a376d40d05a99b2449abc3be980f1_1790824142842265700_0.json", "raw_sha256": "33eeba97fc2f78c2f9362274c5b7e2be011563807fed5b756d22d51f059bffce", "revision_guid": "6E716C17-D9EB-4718-BC4F-7DA896F4F854", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/6E716C17-D9EB-4718-BC4F-7DA896F4F854/view-source"}], "score": 0, "updated_at": "2025-06-25T20:58:41+00:00"}, {"answer_html": "

There are several possible explanations for a lack of Hardy-Weinberg equilibrium.

\n

a) The sample is biased. For example, if the phenotype of vv reduces IQ on average, and your sample consists of university students, you will see fewer vv homozygotes not because they don't exist but because they are less likely to attend university - on average, university students tend to have higher IQs than the general population.

\n

b) Mating is non-random. For example, an allele that differs in frequency between different ethnic groups in the USA will probably not be in Hardy-Weinberg equilibrium because people in the USA disproportionately seek partners of the same race as them. If people prefer partners with similar phenotypes, as with race, homozygosity will be higher than predicted. If people prefer partners with distinct phenotypes, heterozygosity will be increased.

\n

c) The population is a new subset of one or more larger populations. For example, if you sample the population of an island that was settled 100 years ago by people from multiple regions, who are now choosing partners randomly, there's a good chance that they won't show Hardy-Weinberg equilibrium because they haven't had enough generations to evenly mix their traits yet.

\n

d) The trait is subject to selection pressure. In particular, if vv causes a phenotype that is being selected against, and Vv has no or milder effects, then vv will be underrepresented relative to Vv, exactly as shown.

\n", "answer_id": 117655, "answer_text": "There are several possible explanations for a lack of Hardy-Weinberg equilibrium.\n\n\n\n\na) The sample is biased. For example, if the phenotype of vv reduces IQ on average, and your sample consists of university students, you will see fewer vv homozygotes not because they don't exist but because they are less likely to attend university - on average, university students tend to have higher IQs than the general population.\n\n\n\n\nb) Mating is non-random. For example, an allele that differs in frequency between different ethnic groups in the USA will probably not be in Hardy-Weinberg equilibrium because people in the USA disproportionately seek partners of the same race as them. If people prefer partners with similar phenotypes, as with race, homozygosity will be higher than predicted. If people prefer partners with distinct phenotypes, heterozygosity will be increased.\n\n\n\n\nc) The population is a new subset of one or more larger populations. For example, if you sample the population of an island that was settled 100 years ago by people from multiple regions, who are now choosing partners randomly, there's a good chance that they won't show Hardy-Weinberg equilibrium because they haven't had enough generations to evenly mix their traits yet.\n\n\n\n\nd) The trait is subject to selection pressure. In particular, if vv causes a phenotype that is being selected against, and Vv has no or milder effects, then vv will be underrepresented relative to Vv, exactly as shown.", "answer_url": "https://biology.stackexchange.com/a/117655", "author": "Ettina Kitten", "author_url": "https://biology.stackexchange.com/users/111870/ettina-kitten", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-07-06T00:00:39+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:32.233008+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/29e10377e709be0879cc174e9be11ba5513feaafd20aa842a20668af70c6d683_0.json", "raw_sha256": "535e870bb8fe62b3db0c0b66043a398cf2f6d26fcd7ad4a13a2a7e2a09999ee9", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/114428;114427;114412;114410;114399;114395;114391;114386;114385;114381;114378;114377;114376;114374;114372;114371;114370;114361;114354;114353;114348;114342;114331;114329;114324;114321;114319;114307;114305;114304;114299;114298;114295;114290;114281;114277;114273;114266;114256;114239;114238;114222;114216;114213;114211;114207;114197;114192;114185;114180;114178;114175;114174;114173;114172;114169;114161;114156;114155;114148;114145;114144;114139;114136;114135;114127;114119;114117;114114;114111;114110;114103;114098;114096;114094;114089;114085;114078;114076;114069;114067;114065;114058;114055;114048;114045;114038;114031;114028;114027;114025;114021;114020;114012;114006;113998;113997;113988;113986;113983/answers?filter=withbody&order=asc&page=2&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 114342, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ettina Kitten", "profile_url": "https://biology.stackexchange.com/users/111870/ettina-kitten", "user_type": "registered"}, "created_at": "2025-07-06T00:00:39+00:00", "raw_file": "raw/codex_api_v1/80ec0626e4dca1e373c0bba13c4761d1214a376d40d05a99b2449abc3be980f1_1790824142842265700_0.json", "raw_sha256": "33eeba97fc2f78c2f9362274c5b7e2be011563807fed5b756d22d51f059bffce", "revision_guid": "90FE2E6E-3E27-4B0E-AB05-4D30ED46BD51", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/90FE2E6E-3E27-4B0E-AB05-4D30ED46BD51/view-source"}], "score": 0, "updated_at": "2025-07-06T00:00:39+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "As I understand it, if a population is at Hardy-Weinberg equilibrium, then the genotype frequencies should be $$p^2 + 2pq + q^2 = 1,$$ given the allele frequencies of $p$ and $q$, which you can figure out if given the number of homozygous recessive individuals in a population (such as 1/10,000 babies are born with PKU, so $q = \\sqrt{1/10000} = 0.01$).\n\n\n\n\nWhat I don't understand is what does it mean if your expected genotype frequencies do not match your expected frequencies. For example, here is a textbook problem where there are two alleles, $V$ and $v$. There are 16 $VV$, 92 $Vv$, and 12 $vv$ individuals.\n\n\n\n\nIf I did this right, that means\n\n\n\n\n\n$V = (16\\times 2 + 92)/240 = 0.516$\n\n\n\n\n$v = (92 + 12\\times2)/240 = 0.483$\n\n\n\n\n\nand then the expected frequencies are:\n\n\n\n\n\n$VV = 0.516\\times0.516 = 0.266$\n\n\n\n\n$Vv = 2\\times0.516\\times0.483 = 0.498$\n\n\n\n\n$vv = 0.483\\times0.483 = 0.233$\n\n\n\n\n\nwhich are different from the observed frequencies:\n\n\n\n\n\n$VV = 16/(120) = 0.133$\n\n\n\n\n$Vv = 92/(120) = 0.766$\n\n\n\n\n$vv = 12/(120) = 0.1$\n\n\n\n\n\nThe book says that the population is evolving because the observed frequencies are different from the expected frequencies. What exactly does that mean though? How can you tell if the population is evolving if you don't even know the allele frequencies or the genotype frequencies of the next generation? The reason I ask is because I thought to disrupt the Hardy-Weinberg equilibrium means that the allele frequencies would change over generations, so could you say the population is evolving is you're only given the data for one single generation? I mean, you can get the same allele frequencies from both the expected and the observed genotype frequencies, so I don't know if the population can be said to be evolving. Maybe I'm understanding this wrong. Please help. Thank you all.\n\n\n\n\nMy related question is: Can you have no change in allele frequencies across generations, while in each generation, the observed genotype frequency is different from the expected genotype frequency. If so, does this still mean the population is evolving?", "record_id": "Scientific-Answer-Ranking:biology:114342", "scores": [2, 0, 0], "split": "train", "thread": {"accepted_answer_id": 114345, "answers": [{"answer_html": "

From Wikipedia, bold added by me:

\n
\n

In population genetics, the Hardy–Weinberg principle, also known as the Hardy–Weinberg equilibrium, model, theorem, or law, states that allele and genotype frequencies in a population will remain constant from generation to generation in the absence of other evolutionary influences. These influences include genetic drift, mate choice, assortative mating, natural selection, sexual selection, mutation, gene flow, meiotic drive, genetic hitchhiking, population bottleneck, founder effect, inbreeding and outbreeding depression.

\n
\n

Therefore, if you observe allele frequencies that do not match what Hardy-Weinberg would suggest, that means one of those other things is happening. Think of Hardy-Weinberg a bit like the "null hypothesis". You can't tell directly which of these is occurring, and multiple evolutionary influences can occur simultaneously.

\n

We can think about a particular example, though. Let's say you have a case with a recessive trait where the phenotype of vv individuals makes them more likely to die. You would expect when you look at genotype frequencies to find them out of equilibrium with respect to Hardy-Weinberg: you'll find fewer vv individuals than you'd otherwise expect based on the overall rate of v alleles in the population.

\n

It's important to consider sampling effects in your measurement, too. Your estimates will rarely match the Hardy-Weinberg frequencies perfectly just from noise in your sampling. You'll want some estimate of how likely it is that, assuming the population actually does follow Hardy-Weinberg, you'd get a deviation as large as the one you observe. That is achieved by performing a chi-squared test.

\n
\n

How can you tell if the population is evolving if you don't even know the allele frequencies or the genotype frequencies of the next generation?

\n
\n

You can tell because if the population isn't evolving (this statement means exactly that the allele frequencies stay the same) and mating is random then the allele frequencies would be equal to the Hardy-Weinberg frequencies. A bit like if you park your bicycle, go inside, and come back outside and see no bicycle there, you can infer that your bicycle has moved even though you didn't actually observe it moving. You may not be able to conclude whether it was ridden away, was blown by the wind, or picked up and placed in a truck and driven off, but just the fact that it's not where you left it provides information that something is happening besides the "null hypothesis" that bicycles left in a place stay there.

\n", "answer_id": 114345, "answer_text": "From Wikipedia (https://en.wikipedia.org/wiki/Hardy%E2%80%93Weinberg_principle), bold added by me:\n\n\n\n\n\n\n\nIn population genetics, the Hardy–Weinberg principle, also known as the Hardy–Weinberg equilibrium, model, theorem, or law, states that allele and genotype frequencies in a population will remain constant from generation to generation in the absence of other evolutionary influences. These influences include genetic drift, mate choice, assortative mating, natural selection, sexual selection, mutation, gene flow, meiotic drive, genetic hitchhiking, population bottleneck, founder effect, inbreeding and outbreeding depression.\n\n\n\n\n\n\n\nTherefore, if you observe allele frequencies that do not match what Hardy-Weinberg would suggest, that means one of those other things is happening. Think of Hardy-Weinberg a bit like the \"null hypothesis\". You can't tell directly which of these is occurring, and multiple evolutionary influences can occur simultaneously.\n\n\n\n\nWe can think about a particular example, though. Let's say you have a case with a recessive trait where the phenotype of vv individuals makes them more likely to die. You would expect when you look at genotype frequencies to find them out of equilibrium with respect to Hardy-Weinberg: you'll find fewer vv individuals than you'd otherwise expect based on the overall rate of v alleles in the population.\n\n\n\n\nIt's important to consider sampling effects in your measurement, too. Your estimates will rarely match the Hardy-Weinberg frequencies perfectly just from noise in your sampling. You'll want some estimate of how likely it is that, assuming the population actually does follow Hardy-Weinberg, you'd get a deviation as large as the one you observe. That is achieved by performing a chi-squared test.\n\n\n\n\n\n\n\nHow can you tell if the population is evolving if you don't even know the allele frequencies or the genotype frequencies of the next generation?\n\n\n\n\n\n\n\nYou can tell because if the population isn't evolving (this statement means exactly that the allele frequencies stay the same) and mating is random then the allele frequencies would be equal to the Hardy-Weinberg frequencies. A bit like if you park your bicycle, go inside, and come back outside and see no bicycle there, you can infer that your bicycle has moved even though you didn't actually observe it moving. You may not be able to conclude whether it was ridden away, was blown by the wind, or picked up and placed in a truck and driven off, but just the fact that it's not where you left it provides information that something is happening besides the \"null hypothesis\" that bicycles left in a place stay there.", "answer_url": "https://biology.stackexchange.com/a/114345", "author": "Bryan Krause", "author_url": "https://biology.stackexchange.com/users/27148/bryan-krause", "author_user_type": "moderator", "content_license": "CC BY-SA 4.0", "created_at": "2024-03-20T13:42:15+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:30.839943+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/2139ae0ecb1bf62b149af3f8e91d7ce461ad269d38020aaf05922333eabb51a1_0.json", "raw_sha256": "2610bc07f1691b2794681a23d0459bba24822de1f31c7b48d79495b29b0b1285", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/114428;114427;114412;114410;114399;114395;114391;114386;114385;114381;114378;114377;114376;114374;114372;114371;114370;114361;114354;114353;114348;114342;114331;114329;114324;114321;114319;114307;114305;114304;114299;114298;114295;114290;114281;114277;114273;114266;114256;114239;114238;114222;114216;114213;114211;114207;114197;114192;114185;114180;114178;114175;114174;114173;114172;114169;114161;114156;114155;114148;114145;114144;114139;114136;114135;114127;114119;114117;114114;114111;114110;114103;114098;114096;114094;114089;114085;114078;114076;114069;114067;114065;114058;114055;114048;114045;114038;114031;114028;114027;114025;114021;114020;114012;114006;113998;113997;113988;113986;113983/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 114342, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Bryan Krause", "profile_url": "https://biology.stackexchange.com/users/27148/bryan-krause", "user_type": "moderator"}, "created_at": "2024-03-20T13:42:15+00:00", "raw_file": "raw/codex_api_v1/22e8417b315063b6d3b906d11f4422eb4ac33f788b9058bddc9dd7bfc046cafc_1790824071906161300_0.json", "raw_sha256": "84dcb0018b97f3e9f1f4320ffea98714a55b6054974fc678a4c6cac9e312e078", "revision_guid": "FB12158F-F3D5-4699-812C-D573FCE32BBA", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/FB12158F-F3D5-4699-812C-D573FCE32BBA/view-source"}], "score": 2, "updated_at": "2024-03-20T13:42:15+00:00"}, {"answer_html": "

I am more than a little late, but for the sake of completeness I figured I should say that technically a population can both not be in Hardy-Weinberg Equilibrium and not experience evolution. For example, natural selection and sexual selection can act against one another. Think of brightly colored birds that suffer from more predation, but are more attractive mates. Another example is where the less common a phenotype is, more successful members are. This is actually the logic behind Fisher's Principle (i.e. the ratio between sexes in a species will be 1:1). These situations are examples of an evolutionary stable states and there is a whole field of mathematical biology that studies stuff just like this.

\n

Your textbook was probably ignoring these situations for the same of simplicity. It is really important to understand that Hardy-Weinberg Equilibrium always results in no evolution. Other situations that lead to no evolution can be taught later.

\n", "answer_id": 117608, "answer_text": "I am more than a little late, but for the sake of completeness I figured I should say that technically a population can both not be in Hardy-Weinberg Equilibrium and not experience evolution. For example, natural selection and sexual selection can act against one another. Think of brightly colored birds that suffer from more predation, but are more attractive mates. Another example is where the less common a phenotype is, more successful members are. This is actually the logic behind Fisher's Principle (https://en.wikipedia.org/wiki/Fisher%27s_principle) (i.e. the ratio between sexes in a species will be 1:1). These situations are examples of an evolutionary stable states (https://en.wikipedia.org/wiki/Evolutionarily_stable_state) and there is a whole field of mathematical biology that studies stuff just like this.\n\n\n\n\nYour textbook was probably ignoring these situations for the same of simplicity. It is really important to understand that Hardy-Weinberg Equilibrium always results in no evolution. Other situations that lead to no evolution can be taught later.", "answer_url": "https://biology.stackexchange.com/a/117608", "author": "E Tam", "author_url": "https://biology.stackexchange.com/users/5149/e-tam", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-06-19T20:47:59+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:32.233008+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/29e10377e709be0879cc174e9be11ba5513feaafd20aa842a20668af70c6d683_0.json", "raw_sha256": "535e870bb8fe62b3db0c0b66043a398cf2f6d26fcd7ad4a13a2a7e2a09999ee9", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/114428;114427;114412;114410;114399;114395;114391;114386;114385;114381;114378;114377;114376;114374;114372;114371;114370;114361;114354;114353;114348;114342;114331;114329;114324;114321;114319;114307;114305;114304;114299;114298;114295;114290;114281;114277;114273;114266;114256;114239;114238;114222;114216;114213;114211;114207;114197;114192;114185;114180;114178;114175;114174;114173;114172;114169;114161;114156;114155;114148;114145;114144;114139;114136;114135;114127;114119;114117;114114;114111;114110;114103;114098;114096;114094;114089;114085;114078;114076;114069;114067;114065;114058;114055;114048;114045;114038;114031;114028;114027;114025;114021;114020;114012;114006;113998;113997;113988;113986;113983/answers?filter=withbody&order=asc&page=2&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 114342, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "E Tam", "profile_url": "https://biology.stackexchange.com/users/5149/e-tam", "user_type": "registered"}, "created_at": "2025-06-19T20:47:59+00:00", "raw_file": "raw/codex_api_v1/80ec0626e4dca1e373c0bba13c4761d1214a376d40d05a99b2449abc3be980f1_1790824142842265700_0.json", "raw_sha256": "33eeba97fc2f78c2f9362274c5b7e2be011563807fed5b756d22d51f059bffce", "revision_guid": "14D0326D-0F41-4E6E-BCFD-25C0ED84A84C", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/14D0326D-0F41-4E6E-BCFD-25C0ED84A84C/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ben Bolker", "profile_url": "https://biology.stackexchange.com/users/25523/ben-bolker", "user_type": "registered"}, "created_at": "2025-06-20T01:05:59+00:00", "raw_file": "raw/codex_api_v1/80ec0626e4dca1e373c0bba13c4761d1214a376d40d05a99b2449abc3be980f1_1790824142842265700_0.json", "raw_sha256": "33eeba97fc2f78c2f9362274c5b7e2be011563807fed5b756d22d51f059bffce", "revision_guid": "AFDFC42B-11A8-43EC-B8AE-2D194664C2BB", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/AFDFC42B-11A8-43EC-B8AE-2D194664C2BB/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "E Tam", "profile_url": "https://biology.stackexchange.com/users/5149/e-tam", "user_type": "registered"}, "created_at": "2025-06-25T20:58:41+00:00", "raw_file": "raw/codex_api_v1/80ec0626e4dca1e373c0bba13c4761d1214a376d40d05a99b2449abc3be980f1_1790824142842265700_0.json", "raw_sha256": "33eeba97fc2f78c2f9362274c5b7e2be011563807fed5b756d22d51f059bffce", "revision_guid": "6E716C17-D9EB-4718-BC4F-7DA896F4F854", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/6E716C17-D9EB-4718-BC4F-7DA896F4F854/view-source"}], "score": 0, "updated_at": "2025-06-25T20:58:41+00:00"}, {"answer_html": "

There are several possible explanations for a lack of Hardy-Weinberg equilibrium.

\n

a) The sample is biased. For example, if the phenotype of vv reduces IQ on average, and your sample consists of university students, you will see fewer vv homozygotes not because they don't exist but because they are less likely to attend university - on average, university students tend to have higher IQs than the general population.

\n

b) Mating is non-random. For example, an allele that differs in frequency between different ethnic groups in the USA will probably not be in Hardy-Weinberg equilibrium because people in the USA disproportionately seek partners of the same race as them. If people prefer partners with similar phenotypes, as with race, homozygosity will be higher than predicted. If people prefer partners with distinct phenotypes, heterozygosity will be increased.

\n

c) The population is a new subset of one or more larger populations. For example, if you sample the population of an island that was settled 100 years ago by people from multiple regions, who are now choosing partners randomly, there's a good chance that they won't show Hardy-Weinberg equilibrium because they haven't had enough generations to evenly mix their traits yet.

\n

d) The trait is subject to selection pressure. In particular, if vv causes a phenotype that is being selected against, and Vv has no or milder effects, then vv will be underrepresented relative to Vv, exactly as shown.

\n", "answer_id": 117655, "answer_text": "There are several possible explanations for a lack of Hardy-Weinberg equilibrium.\n\n\n\n\na) The sample is biased. For example, if the phenotype of vv reduces IQ on average, and your sample consists of university students, you will see fewer vv homozygotes not because they don't exist but because they are less likely to attend university - on average, university students tend to have higher IQs than the general population.\n\n\n\n\nb) Mating is non-random. For example, an allele that differs in frequency between different ethnic groups in the USA will probably not be in Hardy-Weinberg equilibrium because people in the USA disproportionately seek partners of the same race as them. If people prefer partners with similar phenotypes, as with race, homozygosity will be higher than predicted. If people prefer partners with distinct phenotypes, heterozygosity will be increased.\n\n\n\n\nc) The population is a new subset of one or more larger populations. For example, if you sample the population of an island that was settled 100 years ago by people from multiple regions, who are now choosing partners randomly, there's a good chance that they won't show Hardy-Weinberg equilibrium because they haven't had enough generations to evenly mix their traits yet.\n\n\n\n\nd) The trait is subject to selection pressure. In particular, if vv causes a phenotype that is being selected against, and Vv has no or milder effects, then vv will be underrepresented relative to Vv, exactly as shown.", "answer_url": "https://biology.stackexchange.com/a/117655", "author": "Ettina Kitten", "author_url": "https://biology.stackexchange.com/users/111870/ettina-kitten", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-07-06T00:00:39+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:32.233008+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/29e10377e709be0879cc174e9be11ba5513feaafd20aa842a20668af70c6d683_0.json", "raw_sha256": "535e870bb8fe62b3db0c0b66043a398cf2f6d26fcd7ad4a13a2a7e2a09999ee9", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/114428;114427;114412;114410;114399;114395;114391;114386;114385;114381;114378;114377;114376;114374;114372;114371;114370;114361;114354;114353;114348;114342;114331;114329;114324;114321;114319;114307;114305;114304;114299;114298;114295;114290;114281;114277;114273;114266;114256;114239;114238;114222;114216;114213;114211;114207;114197;114192;114185;114180;114178;114175;114174;114173;114172;114169;114161;114156;114155;114148;114145;114144;114139;114136;114135;114127;114119;114117;114114;114111;114110;114103;114098;114096;114094;114089;114085;114078;114076;114069;114067;114065;114058;114055;114048;114045;114038;114031;114028;114027;114025;114021;114020;114012;114006;113998;113997;113988;113986;113983/answers?filter=withbody&order=asc&page=2&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 114342, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ettina Kitten", "profile_url": "https://biology.stackexchange.com/users/111870/ettina-kitten", "user_type": "registered"}, "created_at": "2025-07-06T00:00:39+00:00", "raw_file": "raw/codex_api_v1/80ec0626e4dca1e373c0bba13c4761d1214a376d40d05a99b2449abc3be980f1_1790824142842265700_0.json", "raw_sha256": "33eeba97fc2f78c2f9362274c5b7e2be011563807fed5b756d22d51f059bffce", "revision_guid": "90FE2E6E-3E27-4B0E-AB05-4D30ED46BD51", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/90FE2E6E-3E27-4B0E-AB05-4D30ED46BD51/view-source"}], "score": 0, "updated_at": "2025-07-06T00:00:39+00:00"}], "domain": "biology", "external_links": ["https://en.wikipedia.org/wiki/Evolutionarily_stable_state", "https://en.wikipedia.org/wiki/Fisher%27s_principle", "https://en.wikipedia.org/wiki/Hardy%E2%80%93Weinberg_principle"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:08.576606+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/1051d4f3e38449f1419d1973ac812b2286659e454a76f89a23fdaa941dfadddb_0.json", "raw_sha256": "583dcd577e20d33b29e9f8818a7ab6a1fab039c19ab79927e16096cff23fa61d", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=7&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "geneticscodingnoob", "question_author_url": "https://biology.stackexchange.com/users/70013/geneticscodingnoob", "question_author_user_type": "registered", "question_created_at": "2024-03-20T01:28:11+00:00", "question_html": "

As I understand it, if a population is at Hardy-Weinberg equilibrium, then the genotype frequencies should be $$p^2 + 2pq + q^2 = 1,$$ given the allele frequencies of $p$ and $q$, which you can figure out if given the number of homozygous recessive individuals in a population (such as 1/10,000 babies are born with PKU, so $q = \\sqrt{1/10000} = 0.01$).

\n

What I don't understand is what does it mean if your expected genotype frequencies do not match your expected frequencies. For example, here is a textbook problem where there are two alleles, $V$ and $v$. There are 16 $VV$, 92 $Vv$, and 12 $vv$ individuals.

\n

If I did this right, that means

\n
    \n
  • $V = (16\\times 2 + 92)/240 = 0.516$
  • \n
  • $v = (92 + 12\\times2)/240 = 0.483$
  • \n
\n

and then the expected frequencies are:

\n
    \n
  • $VV = 0.516\\times0.516 = 0.266$
  • \n
  • $Vv = 2\\times0.516\\times0.483 = 0.498$
  • \n
  • $vv = 0.483\\times0.483 = 0.233$
  • \n
\n

which are different from the observed frequencies:

\n
    \n
  • $VV = 16/(120) = 0.133$
  • \n
  • $Vv = 92/(120) = 0.766$
  • \n
  • $vv = 12/(120) = 0.1$
  • \n
\n

The book says that the population is evolving because the observed frequencies are different from the expected frequencies. What exactly does that mean though? How can you tell if the population is evolving if you don't even know the allele frequencies or the genotype frequencies of the next generation? The reason I ask is because I thought to disrupt the Hardy-Weinberg equilibrium means that the allele frequencies would change over generations, so could you say the population is evolving is you're only given the data for one single generation? I mean, you can get the same allele frequencies from both the expected and the observed genotype frequencies, so I don't know if the population can be said to be evolving. Maybe I'm understanding this wrong. Please help. Thank you all.

\n

My related question is: Can you have no change in allele frequencies across generations, while in each generation, the observed genotype frequency is different from the expected genotype frequency. If so, does this still mean the population is evolving?

\n", "question_id": 114342, "question_license": "CC BY-SA 4.0", "question_score": 1, "question_text": "As I understand it, if a population is at Hardy-Weinberg equilibrium, then the genotype frequencies should be $$p^2 + 2pq + q^2 = 1,$$ given the allele frequencies of $p$ and $q$, which you can figure out if given the number of homozygous recessive individuals in a population (such as 1/10,000 babies are born with PKU, so $q = \\sqrt{1/10000} = 0.01$).\n\n\n\n\nWhat I don't understand is what does it mean if your expected genotype frequencies do not match your expected frequencies. For example, here is a textbook problem where there are two alleles, $V$ and $v$. There are 16 $VV$, 92 $Vv$, and 12 $vv$ individuals.\n\n\n\n\nIf I did this right, that means\n\n\n\n\n\n$V = (16\\times 2 + 92)/240 = 0.516$\n\n\n\n\n$v = (92 + 12\\times2)/240 = 0.483$\n\n\n\n\n\nand then the expected frequencies are:\n\n\n\n\n\n$VV = 0.516\\times0.516 = 0.266$\n\n\n\n\n$Vv = 2\\times0.516\\times0.483 = 0.498$\n\n\n\n\n$vv = 0.483\\times0.483 = 0.233$\n\n\n\n\n\nwhich are different from the observed frequencies:\n\n\n\n\n\n$VV = 16/(120) = 0.133$\n\n\n\n\n$Vv = 92/(120) = 0.766$\n\n\n\n\n$vv = 12/(120) = 0.1$\n\n\n\n\n\nThe book says that the population is evolving because the observed frequencies are different from the expected frequencies. What exactly does that mean though? How can you tell if the population is evolving if you don't even know the allele frequencies or the genotype frequencies of the next generation? The reason I ask is because I thought to disrupt the Hardy-Weinberg equilibrium means that the allele frequencies would change over generations, so could you say the population is evolving is you're only given the data for one single generation? I mean, you can get the same allele frequencies from both the expected and the observed genotype frequencies, so I don't know if the population can be said to be evolving. Maybe I'm understanding this wrong. Please help. Thank you all.\n\n\n\n\nMy related question is: Can you have no change in allele frequencies across generations, while in each generation, the observed genotype frequency is different from the expected genotype frequency. If so, does this still mean the population is evolving?", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "geneticscodingnoob", "profile_url": "https://biology.stackexchange.com/users/70013/geneticscodingnoob", "user_type": "registered"}, "created_at": "2024-03-20T01:28:11+00:00", "raw_file": "raw/codex_api_v1/22e8417b315063b6d3b906d11f4422eb4ac33f788b9058bddc9dd7bfc046cafc_1790824071906161300_0.json", "raw_sha256": "84dcb0018b97f3e9f1f4320ffea98714a55b6054974fc678a4c6cac9e312e078", "revision_guid": "C5A28D07-B3A8-40E5-8C16-BED73AF96D16", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/C5A28D07-B3A8-40E5-8C16-BED73AF96D16/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "geneticscodingnoob", "profile_url": "https://biology.stackexchange.com/users/70013/geneticscodingnoob", "user_type": "registered"}, "created_at": "2024-03-20T01:42:36+00:00", "raw_file": "raw/codex_api_v1/22e8417b315063b6d3b906d11f4422eb4ac33f788b9058bddc9dd7bfc046cafc_1790824071906161300_0.json", "raw_sha256": "84dcb0018b97f3e9f1f4320ffea98714a55b6054974fc678a4c6cac9e312e078", "revision_guid": "E4448323-8997-4B2D-9D8E-E35F75C42262", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/E4448323-8997-4B2D-9D8E-E35F75C42262/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "geneticscodingnoob", "profile_url": "https://biology.stackexchange.com/users/70013/geneticscodingnoob", "user_type": "registered"}, "created_at": "2024-03-20T01:51:26+00:00", "raw_file": "raw/codex_api_v1/22e8417b315063b6d3b906d11f4422eb4ac33f788b9058bddc9dd7bfc046cafc_1790824071906161300_0.json", "raw_sha256": "84dcb0018b97f3e9f1f4320ffea98714a55b6054974fc678a4c6cac9e312e078", "revision_guid": "C38EE41B-5D68-495A-AEE5-22AE116D5DDC", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/C38EE41B-5D68-495A-AEE5-22AE116D5DDC/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Domen", "profile_url": "https://biology.stackexchange.com/users/39423/domen", "user_type": "registered"}, "created_at": "2024-03-22T14:26:54+00:00", "raw_file": "raw/codex_api_v1/22e8417b315063b6d3b906d11f4422eb4ac33f788b9058bddc9dd7bfc046cafc_1790824071906161300_0.json", "raw_sha256": "84dcb0018b97f3e9f1f4320ffea98714a55b6054974fc678a4c6cac9e312e078", "revision_guid": "5194786D-04AA-4D69-91F5-BDAFF5D45E4D", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/5194786D-04AA-4D69-91F5-BDAFF5D45E4D/view-source"}], "source_site": "biology", "source_url": "https://biology.stackexchange.com/questions/114342/what-does-it-mean-when-observed-genotype-frequency-is-different-from-expected-ge", "split": "train", "split_group": "583197c5fac51506b6b02cc37458038d7159ef659fa7cbd45c4ce0c6c0d9a565", "tags": ["genetics", "evolution", "population-genetics", "hardy-weinberg"], "thread_id": "biology:114342", "title": "What does it mean when observed genotype frequency is different from expected genotype frequency in Hardy-Weinberg equilibrium?"}} {"accepted_status": [false, false], "candidate_answers": [{"answer_html": "

I think something like this could work. Arrows represent cut and join events of strands.

\n

\"enter

\n", "answer_id": 116339, "answer_text": "I think something like this could work. Arrows represent cut and join events of strands.\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/F8spgeVo.jpg] (https://i.sstatic.net/F8spgeVo.jpg)", "answer_url": "https://biology.stackexchange.com/a/116339", "author": "Manuel Lera Ramírez", "author_url": "https://biology.stackexchange.com/users/104383/manuel-lera-ram%c3%adrez", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-04-08T17:27:27+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:19.947691+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/df693642d727b738d2a533740632235c18a06cefec7a1e337c9589214a4ec91e_0.json", "raw_sha256": "9df534f437f3b2f12d33db8536999ec4e6ffa10f2f59394799d9fe01c3c1ad16", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/117606;117602;117598;117594;117585;117579;117570;117568;117565;117559;117558;117555;117552;117548;117538;117524;117523;117522;117520;117515;117510;116509;116508;116504;116499;116491;116485;116483;116461;116454;116453;116445;116441;116435;116430;116426;116425;116414;116412;116406;116401;116399;116396;116395;116394;116392;116389;116384;116370;116367;116363;116361;116352;116351;116347;116345;116343;116338;116337;116332;116331;116324;116320;116316;116314;116312;116306;116292;116290;116284;116280;116277;116271;116270;116268;116267;116257;116256;116253;116250;116249;116240;116237;116233;116219;116214;116212;116205;116204;116200;116198;116187;116184;116173;116172;116167;116162;116149;116142;116129/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 116337, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Manuel Lera Ramírez", "profile_url": "https://biology.stackexchange.com/users/104383/manuel-lera-ram%c3%adrez", "user_type": "registered"}, "created_at": "2025-04-08T17:27:27+00:00", "raw_file": "raw/codex_api_v1/2e46271dd42cc68e540cd93745d874445294455a8c8fc89effd7f36ed497eee4_1790824137680573300_0.json", "raw_sha256": "21274b3e65918ff952c3e3901f10b15b146be4d989ae74907eaed06f2a54ef5e", "revision_guid": "0E1ED623-881B-4DBB-B8D4-18A98FA7F5C7", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/0E1ED623-881B-4DBB-B8D4-18A98FA7F5C7/view-source"}], "score": 1, "updated_at": "2025-04-08T17:27:27+00:00"}, {"answer_html": "

I strongly recommend looking at the papers in @gaspanic's answer. If you follow the reference for Orr-Weaver et al. 1981, you find the following figure showing mechanisms for both linear and circular DNA. These seem to approximately reflect your diagram though I am not looking terribly closely.

\n

\"Figure

\n

Here is their description of the mechanism in the text:

\n
\n

The integration of circular plasmids must occur by a different\nmechanism from that of linear plasmids, as the RAD52 gene\nproduct is not required for the integration of circular molecules.\nOur model for the integration of a circular plasmid is shown in\nFig. 6B. Strand invasion is initiated from a nick on either chromosomal or plasmid DNA. In this case, however, it is not necessary to enlarge the resulting D loop by repair synthesis and strand displacement. If the D loop is cut, a short region of symmetric heteroduplex can form, terminated by a classical Holliday junction (4). Resolution of the Holliday structure after\nisomerization can yield the reciprocally recombined form: an integrated plasmid. The major difference in enzymatic terms between these two models is that repair synthesis is not required for the integration of a circle.

\n
\n", "answer_id": 119420, "answer_text": "I strongly recommend looking at the papers in @gaspanic's answer. If you follow the reference for Orr-Weaver et al. 1981 (https://pmc.ncbi.nlm.nih.gov/articles/PMC349037/pdf/pnas00661-0458.pdf), you find the following figure showing mechanisms for both linear and circular DNA. These seem to approximately reflect your diagram though I am not looking terribly closely.\n\n\n\n\n[image: Figure 6 from Orr-Weaver et al. showing mechanisms for linear and circular DNA integration in yeast via homologous recombination.; source: https://i.sstatic.net/OlFuSRR1.png] (https://i.sstatic.net/OlFuSRR1.png)\n\n\n\n\nHere is their description of the mechanism in the text:\n\n\n\n\n\n\n\nThe integration of circular plasmids must occur by a different\nmechanism from that of linear plasmids, as the RAD52 gene\nproduct is not required for the integration of circular molecules.\nOur model for the integration of a circular plasmid is shown in\nFig. 6B. Strand invasion is initiated from a nick on either chromosomal or plasmid DNA. In this case, however, it is not necessary to enlarge the resulting D loop by repair synthesis and strand displacement. If the D loop is cut, a short region of symmetric heteroduplex can form, terminated by a classical Holliday junction (4). Resolution of the Holliday structure after\nisomerization can yield the reciprocally recombined form: an integrated plasmid. The major difference in enzymatic terms between these two models is that repair synthesis is not required for the integration of a circle.", "answer_url": "https://biology.stackexchange.com/a/119420", "author": "Maximilian Press", "author_url": "https://biology.stackexchange.com/users/22392/maximilian-press", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-04-12T19:38:36+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:21.341336+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/4a6d7f421e875dc35579c83d7a4c55dbac2053818a9a4ddcabe8f9bc1da6b2ac_0.json", "raw_sha256": "18201221ae9e649a5dbff65ead31fe8bdd7aa9179c4e5be0dcae831c03b0ed5f", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/117606;117602;117598;117594;117585;117579;117570;117568;117565;117559;117558;117555;117552;117548;117538;117524;117523;117522;117520;117515;117510;116509;116508;116504;116499;116491;116485;116483;116461;116454;116453;116445;116441;116435;116430;116426;116425;116414;116412;116406;116401;116399;116396;116395;116394;116392;116389;116384;116370;116367;116363;116361;116352;116351;116347;116345;116343;116338;116337;116332;116331;116324;116320;116316;116314;116312;116306;116292;116290;116284;116280;116277;116271;116270;116268;116267;116257;116256;116253;116250;116249;116240;116237;116233;116219;116214;116212;116205;116204;116200;116198;116187;116184;116173;116172;116167;116162;116149;116142;116129/answers?filter=withbody&order=asc&page=2&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 116337, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Maximilian Press", "profile_url": "https://biology.stackexchange.com/users/22392/maximilian-press", "user_type": "registered"}, "created_at": "2026-04-12T19:38:36+00:00", "raw_file": "raw/codex_api_v1/579a4d2562ba9524cfbccb0521aa128aef0c357c985479e84dfae99b419043f3_1790824187996707100_0.json", "raw_sha256": "498851e9e2788dd78c09b5bc32fc2c43c0983eaa43d2c56d9c618718c8202873", "revision_guid": "E7D6022D-612D-4840-8AD5-36695457BC59", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/E7D6022D-612D-4840-8AD5-36695457BC59/view-source"}], "score": 1, "updated_at": "2026-04-12T19:38:36+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "In this answer (https://biology.stackexchange.com/a/108331/63707) @gaspanic provides a diagram of the before and after of a single crossover event where a linearised plasmid is integrated into a genome by homologous recombination, which is a very common methodology in synthetic biology for expression of heterologous proteins in the yeast K. phaffii (Pichia pastoris)(inserting here for convenience):\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/oHdNhxA4.png] (https://i.sstatic.net/oHdNhxA4.png)\n\n\n\n\nThey use crossed lines to represent the integration. I have tried googling extensively, have asked ChatGPT, and have read the reference that gaspanic cites amongst other papers around K. phaffii engineering, but haven't been able to find an actual diagram/explanation of how the mechanism happens. Can someone please explain the molecular mechanism? E.g. resection, invasion etc.?\n\n\n\n\nI've tried sketching it out myself but get stuck right at the end with non-homologous ends.\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/GAu8tDQE.png] (https://i.sstatic.net/GAu8tDQE.png)", "record_id": "Scientific-Answer-Ranking:biology:116337", "scores": [1, 1], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

I think something like this could work. Arrows represent cut and join events of strands.

\n

\"enter

\n", "answer_id": 116339, "answer_text": "I think something like this could work. Arrows represent cut and join events of strands.\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/F8spgeVo.jpg] (https://i.sstatic.net/F8spgeVo.jpg)", "answer_url": "https://biology.stackexchange.com/a/116339", "author": "Manuel Lera Ramírez", "author_url": "https://biology.stackexchange.com/users/104383/manuel-lera-ram%c3%adrez", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-04-08T17:27:27+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:19.947691+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/df693642d727b738d2a533740632235c18a06cefec7a1e337c9589214a4ec91e_0.json", "raw_sha256": "9df534f437f3b2f12d33db8536999ec4e6ffa10f2f59394799d9fe01c3c1ad16", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/117606;117602;117598;117594;117585;117579;117570;117568;117565;117559;117558;117555;117552;117548;117538;117524;117523;117522;117520;117515;117510;116509;116508;116504;116499;116491;116485;116483;116461;116454;116453;116445;116441;116435;116430;116426;116425;116414;116412;116406;116401;116399;116396;116395;116394;116392;116389;116384;116370;116367;116363;116361;116352;116351;116347;116345;116343;116338;116337;116332;116331;116324;116320;116316;116314;116312;116306;116292;116290;116284;116280;116277;116271;116270;116268;116267;116257;116256;116253;116250;116249;116240;116237;116233;116219;116214;116212;116205;116204;116200;116198;116187;116184;116173;116172;116167;116162;116149;116142;116129/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 116337, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Manuel Lera Ramírez", "profile_url": "https://biology.stackexchange.com/users/104383/manuel-lera-ram%c3%adrez", "user_type": "registered"}, "created_at": "2025-04-08T17:27:27+00:00", "raw_file": "raw/codex_api_v1/2e46271dd42cc68e540cd93745d874445294455a8c8fc89effd7f36ed497eee4_1790824137680573300_0.json", "raw_sha256": "21274b3e65918ff952c3e3901f10b15b146be4d989ae74907eaed06f2a54ef5e", "revision_guid": "0E1ED623-881B-4DBB-B8D4-18A98FA7F5C7", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/0E1ED623-881B-4DBB-B8D4-18A98FA7F5C7/view-source"}], "score": 1, "updated_at": "2025-04-08T17:27:27+00:00"}, {"answer_html": "

I strongly recommend looking at the papers in @gaspanic's answer. If you follow the reference for Orr-Weaver et al. 1981, you find the following figure showing mechanisms for both linear and circular DNA. These seem to approximately reflect your diagram though I am not looking terribly closely.

\n

\"Figure

\n

Here is their description of the mechanism in the text:

\n
\n

The integration of circular plasmids must occur by a different\nmechanism from that of linear plasmids, as the RAD52 gene\nproduct is not required for the integration of circular molecules.\nOur model for the integration of a circular plasmid is shown in\nFig. 6B. Strand invasion is initiated from a nick on either chromosomal or plasmid DNA. In this case, however, it is not necessary to enlarge the resulting D loop by repair synthesis and strand displacement. If the D loop is cut, a short region of symmetric heteroduplex can form, terminated by a classical Holliday junction (4). Resolution of the Holliday structure after\nisomerization can yield the reciprocally recombined form: an integrated plasmid. The major difference in enzymatic terms between these two models is that repair synthesis is not required for the integration of a circle.

\n
\n", "answer_id": 119420, "answer_text": "I strongly recommend looking at the papers in @gaspanic's answer. If you follow the reference for Orr-Weaver et al. 1981 (https://pmc.ncbi.nlm.nih.gov/articles/PMC349037/pdf/pnas00661-0458.pdf), you find the following figure showing mechanisms for both linear and circular DNA. These seem to approximately reflect your diagram though I am not looking terribly closely.\n\n\n\n\n[image: Figure 6 from Orr-Weaver et al. showing mechanisms for linear and circular DNA integration in yeast via homologous recombination.; source: https://i.sstatic.net/OlFuSRR1.png] (https://i.sstatic.net/OlFuSRR1.png)\n\n\n\n\nHere is their description of the mechanism in the text:\n\n\n\n\n\n\n\nThe integration of circular plasmids must occur by a different\nmechanism from that of linear plasmids, as the RAD52 gene\nproduct is not required for the integration of circular molecules.\nOur model for the integration of a circular plasmid is shown in\nFig. 6B. Strand invasion is initiated from a nick on either chromosomal or plasmid DNA. In this case, however, it is not necessary to enlarge the resulting D loop by repair synthesis and strand displacement. If the D loop is cut, a short region of symmetric heteroduplex can form, terminated by a classical Holliday junction (4). Resolution of the Holliday structure after\nisomerization can yield the reciprocally recombined form: an integrated plasmid. The major difference in enzymatic terms between these two models is that repair synthesis is not required for the integration of a circle.", "answer_url": "https://biology.stackexchange.com/a/119420", "author": "Maximilian Press", "author_url": "https://biology.stackexchange.com/users/22392/maximilian-press", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2026-04-12T19:38:36+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:21.341336+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/4a6d7f421e875dc35579c83d7a4c55dbac2053818a9a4ddcabe8f9bc1da6b2ac_0.json", "raw_sha256": "18201221ae9e649a5dbff65ead31fe8bdd7aa9179c4e5be0dcae831c03b0ed5f", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/117606;117602;117598;117594;117585;117579;117570;117568;117565;117559;117558;117555;117552;117548;117538;117524;117523;117522;117520;117515;117510;116509;116508;116504;116499;116491;116485;116483;116461;116454;116453;116445;116441;116435;116430;116426;116425;116414;116412;116406;116401;116399;116396;116395;116394;116392;116389;116384;116370;116367;116363;116361;116352;116351;116347;116345;116343;116338;116337;116332;116331;116324;116320;116316;116314;116312;116306;116292;116290;116284;116280;116277;116271;116270;116268;116267;116257;116256;116253;116250;116249;116240;116237;116233;116219;116214;116212;116205;116204;116200;116198;116187;116184;116173;116172;116167;116162;116149;116142;116129/answers?filter=withbody&order=asc&page=2&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 116337, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Maximilian Press", "profile_url": "https://biology.stackexchange.com/users/22392/maximilian-press", "user_type": "registered"}, "created_at": "2026-04-12T19:38:36+00:00", "raw_file": "raw/codex_api_v1/579a4d2562ba9524cfbccb0521aa128aef0c357c985479e84dfae99b419043f3_1790824187996707100_0.json", "raw_sha256": "498851e9e2788dd78c09b5bc32fc2c43c0983eaa43d2c56d9c618718c8202873", "revision_guid": "E7D6022D-612D-4840-8AD5-36695457BC59", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/E7D6022D-612D-4840-8AD5-36695457BC59/view-source"}], "score": 1, "updated_at": "2026-04-12T19:38:36+00:00"}], "domain": "biology", "external_links": ["https://i.sstatic.net/F8spgeVo.jpg", "https://i.sstatic.net/GAu8tDQE.png", "https://i.sstatic.net/OlFuSRR1.png", "https://i.sstatic.net/oHdNhxA4.png", "https://pmc.ncbi.nlm.nih.gov/articles/PMC349037/pdf/pnas00661-0458.pdf"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:02.598621+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/5d480e4bd1bd45ab525a4baf3227fba404f89b6af9dad33215fd9fa7c302a211_0.json", "raw_sha256": "d723c7a62c8386d143891d26ae30b2234242ed3dac9599b11f141712ea994a96", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=3&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Noah Sprent", "question_author_url": "https://biology.stackexchange.com/users/63707/noah-sprent", "question_author_user_type": "registered", "question_created_at": "2025-04-08T14:26:05+00:00", "question_html": "

In this answer @gaspanic provides a diagram of the before and after of a single crossover event where a linearised plasmid is integrated into a genome by homologous recombination, which is a very common methodology in synthetic biology for expression of heterologous proteins in the yeast K. phaffii (Pichia pastoris)(inserting here for convenience):

\n

\"enter

\n

They use crossed lines to represent the integration. I have tried googling extensively, have asked ChatGPT, and have read the reference that gaspanic cites amongst other papers around K. phaffii engineering, but haven't been able to find an actual diagram/explanation of how the mechanism happens. Can someone please explain the molecular mechanism? E.g. resection, invasion etc.?

\n

I've tried sketching it out myself but get stuck right at the end with non-homologous ends.

\n

\"enter

\n", "question_id": 116337, "question_license": "CC BY-SA 4.0", "question_score": 2, "question_text": "In this answer (https://biology.stackexchange.com/a/108331/63707) @gaspanic provides a diagram of the before and after of a single crossover event where a linearised plasmid is integrated into a genome by homologous recombination, which is a very common methodology in synthetic biology for expression of heterologous proteins in the yeast K. phaffii (Pichia pastoris)(inserting here for convenience):\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/oHdNhxA4.png] (https://i.sstatic.net/oHdNhxA4.png)\n\n\n\n\nThey use crossed lines to represent the integration. I have tried googling extensively, have asked ChatGPT, and have read the reference that gaspanic cites amongst other papers around K. phaffii engineering, but haven't been able to find an actual diagram/explanation of how the mechanism happens. Can someone please explain the molecular mechanism? E.g. resection, invasion etc.?\n\n\n\n\nI've tried sketching it out myself but get stuck right at the end with non-homologous ends.\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/GAu8tDQE.png] (https://i.sstatic.net/GAu8tDQE.png)", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Noah Sprent", "profile_url": "https://biology.stackexchange.com/users/63707/noah-sprent", "user_type": "registered"}, "created_at": "2025-04-08T14:26:05+00:00", "raw_file": "raw/codex_api_v1/2e46271dd42cc68e540cd93745d874445294455a8c8fc89effd7f36ed497eee4_1790824137680573300_0.json", "raw_sha256": "21274b3e65918ff952c3e3901f10b15b146be4d989ae74907eaed06f2a54ef5e", "revision_guid": "D3D27619-3BAE-46B9-8A6F-85925064B7EB", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/D3D27619-3BAE-46B9-8A6F-85925064B7EB/view-source"}, {"content_license": null, "contributor": {"display_name": "David", "profile_url": "https://biology.stackexchange.com/users/22057/david", "user_type": "registered"}, "created_at": "2025-04-08T15:22:31+00:00", "raw_file": "raw/codex_api_v1/2e46271dd42cc68e540cd93745d874445294455a8c8fc89effd7f36ed497eee4_1790824137680573300_0.json", "raw_sha256": "21274b3e65918ff952c3e3901f10b15b146be4d989ae74907eaed06f2a54ef5e", "revision_guid": "93F46C53-AD7E-405B-9B4D-A53F163535B2", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/93F46C53-AD7E-405B-9B4D-A53F163535B2/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Noah Sprent", "profile_url": "https://biology.stackexchange.com/users/63707/noah-sprent", "user_type": "registered"}, "created_at": "2025-04-16T09:22:56+00:00", "raw_file": "raw/codex_api_v1/2e46271dd42cc68e540cd93745d874445294455a8c8fc89effd7f36ed497eee4_1790824137680573300_0.json", "raw_sha256": "21274b3e65918ff952c3e3901f10b15b146be4d989ae74907eaed06f2a54ef5e", "revision_guid": "EA9ABB12-791A-4BA2-8215-8F6D1A339918", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/EA9ABB12-791A-4BA2-8215-8F6D1A339918/view-source"}, {"content_license": null, "contributor": {"display_name": "Community", "profile_url": "https://biology.stackexchange.com/users/-1/community", "user_type": "moderator"}, "created_at": "2026-04-11T11:02:30+00:00", "raw_file": "raw/codex_api_v1/00f792a35cd1fe53cc744b44d1c7f5a2081648f5d4403a4e8f1d570c00e5dc95_1790824135500262400_0.json", "raw_sha256": "0face46f22b53414ff8968bb035acf71d0f5c1f84da8d6f0813602f842802d98", "revision_guid": "E4615F6D-1035-4F5E-B269-4E9064D0BD8B", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://biology.stackexchange.com/revisions/E4615F6D-1035-4F5E-B269-4E9064D0BD8B/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Maximilian Press", "profile_url": "https://biology.stackexchange.com/users/22392/maximilian-press", "user_type": "registered"}, "created_at": "2026-04-12T19:39:50+00:00", "raw_file": "raw/codex_api_v1/00f792a35cd1fe53cc744b44d1c7f5a2081648f5d4403a4e8f1d570c00e5dc95_1790824135500262400_0.json", "raw_sha256": "0face46f22b53414ff8968bb035acf71d0f5c1f84da8d6f0813602f842802d98", "revision_guid": "5B72BFFF-C393-406C-887C-6D4FB0FBAC18", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/5B72BFFF-C393-406C-887C-6D4FB0FBAC18/view-source"}, {"content_license": null, "contributor": {"display_name": "Community", "profile_url": "https://biology.stackexchange.com/users/-1/community", "user_type": "moderator"}, "created_at": "2026-05-12T20:03:40+00:00", "raw_file": "raw/codex_api_v1/00f792a35cd1fe53cc744b44d1c7f5a2081648f5d4403a4e8f1d570c00e5dc95_1790824135500262400_0.json", "raw_sha256": "0face46f22b53414ff8968bb035acf71d0f5c1f84da8d6f0813602f842802d98", "revision_guid": "2D80D859-5DD5-44B3-A3BF-1199C4CAA152", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://biology.stackexchange.com/revisions/2D80D859-5DD5-44B3-A3BF-1199C4CAA152/view-source"}], "source_site": "biology", "source_url": "https://biology.stackexchange.com/questions/116337/what-is-the-molecular-mechanism-for-how-a-single-crossover-event-leads-to-genomi", "split": "train", "split_group": "20780a4c29cbdabf74738a8984c80635d23cb6a43fd5b84d7a514110f0b4813d", "tags": ["molecular-biology", "synthetic-biology", "recombination", "yeast", "protein-expression"], "thread_id": "biology:116337", "title": "What is the molecular mechanism for how a single crossover event leads to genomic integration of a plasmid?"}} {"accepted_status": [false, false], "candidate_answers": [{"answer_html": "

It is possible that over time, they would diverge from each other solely from the effects of the slight differences in the gene pools. Even if you distributed the genotypes equally between each group, there will be average differences that can be amplified over generations of reproduction.

\n

How much would they diverge? That depends at which timepoint you analyze their differences. Since they begin with similar gene pools, the average genotype from each group will be similar at first, but become less and less similar over time. The rate of change would be linear(constant) without any external influences and if the populations reproduce at the same rate.

\n

Would they diverge into separate species eventually? Possibly, given enough time. Essentially, this question can be reworded to "will they be able to produce fertile offspring with eachother?" At some point, probably not, but it would take a while.

\n

(This assumes the isolated population groups are large enough to avoid negative effects of inbreeding, or the species is naturally not negatively affected by inbreeding.)

\n", "answer_id": 115969, "answer_text": "It is possible that over time, they would diverge from each other solely from the effects of the slight differences in the gene pools. Even if you distributed the genotypes equally between each group, there will be average differences that can be amplified over generations of reproduction.\n\n\n\n\nHow much would they diverge? That depends at which timepoint you analyze their differences. Since they begin with similar gene pools, the average genotype from each group will be similar at first, but become less and less similar over time. The rate of change would be linear(constant) without any external influences and if the populations reproduce at the same rate.\n\n\n\n\nWould they diverge into separate species eventually? Possibly, given enough time. Essentially, this question can be reworded to \"will they be able to produce fertile offspring with eachother?\" At some point, probably not, but it would take a while.\n\n\n\n\n(This assumes the isolated population groups are large enough to avoid negative effects of inbreeding, or the species is naturally not negatively affected by inbreeding.)", "answer_url": "https://biology.stackexchange.com/a/115969", "author": "boredatwork1234", "author_url": "https://biology.stackexchange.com/users/98533/boredatwork1234", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-01-16T15:33:42+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:22.614155+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/2c8799380b8f5d7bf0fd42e594fd78a1835b27e1da9f481cc00f096bab9c01ca_0.json", "raw_sha256": "348375a094fdfd6d9ca55d0bddc65d8dc7a7f0757e1e5a44c25e22a66b1a4892", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/116119;116113;116097;116096;116091;116087;116076;116067;116063;116059;116055;116037;116034;116028;116022;116012;116005;115997;115989;115988;115987;115979;115978;115976;115974;115973;115970;115966;115965;115957;115952;115939;115933;115932;115927;115921;115915;115903;115897;115894;115886;115885;115884;115881;115880;115868;115867;115857;115852;115840;115830;115825;115819;115815;115791;115780;115773;115764;115759;115756;115743;115736;115726;115723;115713;115699;115691;115689;115685;115678;115668;115664;115657;115650;115642;115639;115632;115627;115626;115609;115602;115598;115592;115588;115587;115580;115578;115570;115566;115562;115549;115537;115536;115531;115530;115528;115525;115521;115513;115510/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 115965, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "boredatwork1234", "profile_url": "https://biology.stackexchange.com/users/98533/boredatwork1234", "user_type": "registered"}, "created_at": "2025-01-16T15:33:42+00:00", "raw_file": "raw/codex_api_v1/9208faf10edface85b193538ceee277a2c29dd57b691eaef3dbbd7fcb70c256f_1790824112025498400_0.json", "raw_sha256": "cacf2fdbe629fb39b1a0932a5485abc61f5635b5e51482d0d3b8ab40f1450c36", "revision_guid": "A6C26EA4-ADED-4723-9473-4B3963FC0170", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/A6C26EA4-ADED-4723-9473-4B3963FC0170/view-source"}], "score": 0, "updated_at": "2025-01-16T15:33:42+00:00"}, {"answer_html": "

The general topic you're looking for is sympatric speciation. Some explanations given include divergent selection and allochrony. There are some less-certain but intriguing explanations possible that are tied to genetics, besides the polyploidization that you mention. Sometimes - as when a butterfly species mimics two different models - it pays to recombine all of the relevant traits into a supergene. If the supergene can become the basis of assortative mating, there should be a benefit in having fewer hybrids with non-mimetic wing patterns.

\n

A curious, similar phenomenon is inversion polymorphism, as seen in Drosophila. While these by definition occur within one species, the inverted regions have a strong barrier to gene flow, since simple recombinants develop a chromosomal abnormality. Cases of speciation are believed to have arisen this way.

\n", "answer_id": 116114, "answer_text": "The general topic you're looking for is sympatric speciation (https://pubmed.ncbi.nlm.nih.gov/?term=sympatric+speciation). Some explanations given include divergent selection (https://pmc.ncbi.nlm.nih.gov/articles/PMC9060526/) and allochrony (https://pmc.ncbi.nlm.nih.gov/articles/PMC2141821/). There are some less-certain but intriguing explanations possible that are tied to genetics, besides the polyploidization that you mention. Sometimes - as when a butterfly species mimics two different models - it pays to recombine all of the relevant traits into a supergene (https://pubmed.ncbi.nlm.nih.gov/33346837/). If the supergene can become the basis of assortative mating, there should be a benefit in having fewer hybrids with non-mimetic wing patterns.\n\n\n\n\nA curious, similar phenomenon is inversion polymorphism (https://pubmed.ncbi.nlm.nih.gov/?term=drosophila+inversion+polymorphism), as seen in Drosophila. While these by definition occur within one species, the inverted regions have a strong barrier to gene flow, since simple recombinants develop a chromosomal abnormality. Cases of speciation (https://pubmed.ncbi.nlm.nih.gov/38482698/) are believed to have arisen this way.", "answer_url": "https://biology.stackexchange.com/a/116114", "author": "Mike Serfas", "author_url": "https://biology.stackexchange.com/users/57271/mike-serfas", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-02-16T23:20:27+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:24.022014+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/01aac796e48517b802ddadc0ad653c0cb9714bed9c7b63fe9d85feeb033045b4_0.json", "raw_sha256": "78b00075a5e7010b6a99b251890c500809ce80227f5b68d26c5fa522422bf915", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/116119;116113;116097;116096;116091;116087;116076;116067;116063;116059;116055;116037;116034;116028;116022;116012;116005;115997;115989;115988;115987;115979;115978;115976;115974;115973;115970;115966;115965;115957;115952;115939;115933;115932;115927;115921;115915;115903;115897;115894;115886;115885;115884;115881;115880;115868;115867;115857;115852;115840;115830;115825;115819;115815;115791;115780;115773;115764;115759;115756;115743;115736;115726;115723;115713;115699;115691;115689;115685;115678;115668;115664;115657;115650;115642;115639;115632;115627;115626;115609;115602;115598;115592;115588;115587;115580;115578;115570;115566;115562;115549;115537;115536;115531;115530;115528;115525;115521;115513;115510/answers?filter=withbody&order=asc&page=2&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 115965, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Mike Serfas", "profile_url": "https://biology.stackexchange.com/users/57271/mike-serfas", "user_type": "registered"}, "created_at": "2025-02-16T23:20:27+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "58BB4721-86F5-4D09-BA4E-D9D603FDC827", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/58BB4721-86F5-4D09-BA4E-D9D603FDC827/view-source"}], "score": 2, "updated_at": "2025-02-16T23:20:27+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I already know that the divergence of one species into two can happen through a variety of methods.\n\n\n\n\n\n\n\npart of a population is isolated and different environmental factors cause different selective pressures\n\n\n\n\n\n\n\n\n\nsexual selection because certain traits are more considered more attractive in organisms\n\n\n\n\n\n\n\n\n\npolyploidy\n\n\n\n\n\n\n\n\n\ngenetic drift/mutation/other random things\n\n\n\n\n\n\n\n\n\netc.\n\n\n\n\n\n\n\n\nHowever, say a part of a species is isolated in similar conditions as the species in the main area. Ruling out random factors like genetic drift, mutation, etc., could the species still diverge? What I mean is, would it be possible for certain organisms to inherit unique combinations of genes from their parents so that they develop unique enough traits over a long period of time and can thus be classified as a separate species? I am basically wondering if simple inheritance and basic genetics, without any selective pressures or random occurences, can lead to the divergence of a species. Please let me know if the wording of this question doesn't make sense so I can fix it. Thanks!", "record_id": "Scientific-Answer-Ranking:biology:115965", "scores": [0, 2], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

It is possible that over time, they would diverge from each other solely from the effects of the slight differences in the gene pools. Even if you distributed the genotypes equally between each group, there will be average differences that can be amplified over generations of reproduction.

\n

How much would they diverge? That depends at which timepoint you analyze their differences. Since they begin with similar gene pools, the average genotype from each group will be similar at first, but become less and less similar over time. The rate of change would be linear(constant) without any external influences and if the populations reproduce at the same rate.

\n

Would they diverge into separate species eventually? Possibly, given enough time. Essentially, this question can be reworded to "will they be able to produce fertile offspring with eachother?" At some point, probably not, but it would take a while.

\n

(This assumes the isolated population groups are large enough to avoid negative effects of inbreeding, or the species is naturally not negatively affected by inbreeding.)

\n", "answer_id": 115969, "answer_text": "It is possible that over time, they would diverge from each other solely from the effects of the slight differences in the gene pools. Even if you distributed the genotypes equally between each group, there will be average differences that can be amplified over generations of reproduction.\n\n\n\n\nHow much would they diverge? That depends at which timepoint you analyze their differences. Since they begin with similar gene pools, the average genotype from each group will be similar at first, but become less and less similar over time. The rate of change would be linear(constant) without any external influences and if the populations reproduce at the same rate.\n\n\n\n\nWould they diverge into separate species eventually? Possibly, given enough time. Essentially, this question can be reworded to \"will they be able to produce fertile offspring with eachother?\" At some point, probably not, but it would take a while.\n\n\n\n\n(This assumes the isolated population groups are large enough to avoid negative effects of inbreeding, or the species is naturally not negatively affected by inbreeding.)", "answer_url": "https://biology.stackexchange.com/a/115969", "author": "boredatwork1234", "author_url": "https://biology.stackexchange.com/users/98533/boredatwork1234", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-01-16T15:33:42+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:22.614155+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/2c8799380b8f5d7bf0fd42e594fd78a1835b27e1da9f481cc00f096bab9c01ca_0.json", "raw_sha256": "348375a094fdfd6d9ca55d0bddc65d8dc7a7f0757e1e5a44c25e22a66b1a4892", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/116119;116113;116097;116096;116091;116087;116076;116067;116063;116059;116055;116037;116034;116028;116022;116012;116005;115997;115989;115988;115987;115979;115978;115976;115974;115973;115970;115966;115965;115957;115952;115939;115933;115932;115927;115921;115915;115903;115897;115894;115886;115885;115884;115881;115880;115868;115867;115857;115852;115840;115830;115825;115819;115815;115791;115780;115773;115764;115759;115756;115743;115736;115726;115723;115713;115699;115691;115689;115685;115678;115668;115664;115657;115650;115642;115639;115632;115627;115626;115609;115602;115598;115592;115588;115587;115580;115578;115570;115566;115562;115549;115537;115536;115531;115530;115528;115525;115521;115513;115510/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 115965, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "boredatwork1234", "profile_url": "https://biology.stackexchange.com/users/98533/boredatwork1234", "user_type": "registered"}, "created_at": "2025-01-16T15:33:42+00:00", "raw_file": "raw/codex_api_v1/9208faf10edface85b193538ceee277a2c29dd57b691eaef3dbbd7fcb70c256f_1790824112025498400_0.json", "raw_sha256": "cacf2fdbe629fb39b1a0932a5485abc61f5635b5e51482d0d3b8ab40f1450c36", "revision_guid": "A6C26EA4-ADED-4723-9473-4B3963FC0170", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/A6C26EA4-ADED-4723-9473-4B3963FC0170/view-source"}], "score": 0, "updated_at": "2025-01-16T15:33:42+00:00"}, {"answer_html": "

The general topic you're looking for is sympatric speciation. Some explanations given include divergent selection and allochrony. There are some less-certain but intriguing explanations possible that are tied to genetics, besides the polyploidization that you mention. Sometimes - as when a butterfly species mimics two different models - it pays to recombine all of the relevant traits into a supergene. If the supergene can become the basis of assortative mating, there should be a benefit in having fewer hybrids with non-mimetic wing patterns.

\n

A curious, similar phenomenon is inversion polymorphism, as seen in Drosophila. While these by definition occur within one species, the inverted regions have a strong barrier to gene flow, since simple recombinants develop a chromosomal abnormality. Cases of speciation are believed to have arisen this way.

\n", "answer_id": 116114, "answer_text": "The general topic you're looking for is sympatric speciation (https://pubmed.ncbi.nlm.nih.gov/?term=sympatric+speciation). Some explanations given include divergent selection (https://pmc.ncbi.nlm.nih.gov/articles/PMC9060526/) and allochrony (https://pmc.ncbi.nlm.nih.gov/articles/PMC2141821/). There are some less-certain but intriguing explanations possible that are tied to genetics, besides the polyploidization that you mention. Sometimes - as when a butterfly species mimics two different models - it pays to recombine all of the relevant traits into a supergene (https://pubmed.ncbi.nlm.nih.gov/33346837/). If the supergene can become the basis of assortative mating, there should be a benefit in having fewer hybrids with non-mimetic wing patterns.\n\n\n\n\nA curious, similar phenomenon is inversion polymorphism (https://pubmed.ncbi.nlm.nih.gov/?term=drosophila+inversion+polymorphism), as seen in Drosophila. While these by definition occur within one species, the inverted regions have a strong barrier to gene flow, since simple recombinants develop a chromosomal abnormality. Cases of speciation (https://pubmed.ncbi.nlm.nih.gov/38482698/) are believed to have arisen this way.", "answer_url": "https://biology.stackexchange.com/a/116114", "author": "Mike Serfas", "author_url": "https://biology.stackexchange.com/users/57271/mike-serfas", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-02-16T23:20:27+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:24.022014+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/01aac796e48517b802ddadc0ad653c0cb9714bed9c7b63fe9d85feeb033045b4_0.json", "raw_sha256": "78b00075a5e7010b6a99b251890c500809ce80227f5b68d26c5fa522422bf915", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/116119;116113;116097;116096;116091;116087;116076;116067;116063;116059;116055;116037;116034;116028;116022;116012;116005;115997;115989;115988;115987;115979;115978;115976;115974;115973;115970;115966;115965;115957;115952;115939;115933;115932;115927;115921;115915;115903;115897;115894;115886;115885;115884;115881;115880;115868;115867;115857;115852;115840;115830;115825;115819;115815;115791;115780;115773;115764;115759;115756;115743;115736;115726;115723;115713;115699;115691;115689;115685;115678;115668;115664;115657;115650;115642;115639;115632;115627;115626;115609;115602;115598;115592;115588;115587;115580;115578;115570;115566;115562;115549;115537;115536;115531;115530;115528;115525;115521;115513;115510/answers?filter=withbody&order=asc&page=2&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 115965, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Mike Serfas", "profile_url": "https://biology.stackexchange.com/users/57271/mike-serfas", "user_type": "registered"}, "created_at": "2025-02-16T23:20:27+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "58BB4721-86F5-4D09-BA4E-D9D603FDC827", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/58BB4721-86F5-4D09-BA4E-D9D603FDC827/view-source"}], "score": 2, "updated_at": "2025-02-16T23:20:27+00:00"}], "domain": "biology", "external_links": ["https://pmc.ncbi.nlm.nih.gov/articles/PMC2141821/", "https://pmc.ncbi.nlm.nih.gov/articles/PMC9060526/", "https://pubmed.ncbi.nlm.nih.gov/33346837/", "https://pubmed.ncbi.nlm.nih.gov/38482698/", "https://pubmed.ncbi.nlm.nih.gov/?term=drosophila+inversion+polymorphism", "https://pubmed.ncbi.nlm.nih.gov/?term=sympatric+speciation"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:04.377249+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/54ece81cba3a5a552bb15d6d3feedc4324a2ba2706d33480080ece9537efd4b1_0.json", "raw_sha256": "f1eb8f7eda9336b81701b663029f9411e040c0bcf262148b7ede9a103ae73e69", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=4&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "user386598", "question_author_url": "https://biology.stackexchange.com/users/87773/user386598", "question_author_user_type": "registered", "question_created_at": "2025-01-15T22:55:14+00:00", "question_html": "

I already know that the divergence of one species into two can happen through a variety of methods.

\n
    \n
  • part of a population is isolated and different environmental factors cause different selective pressures

    \n
  • \n
  • sexual selection because certain traits are more considered more attractive in organisms

    \n
  • \n
  • polyploidy

    \n
  • \n
  • genetic drift/mutation/other random things

    \n
  • \n
  • etc.

    \n
  • \n
\n

However, say a part of a species is isolated in similar conditions as the species in the main area. Ruling out random factors like genetic drift, mutation, etc., could the species still diverge? What I mean is, would it be possible for certain organisms to inherit unique combinations of genes from their parents so that they develop unique enough traits over a long period of time and can thus be classified as a separate species? I am basically wondering if simple inheritance and basic genetics, without any selective pressures or random occurences, can lead to the divergence of a species. Please let me know if the wording of this question doesn't make sense so I can fix it. Thanks!

\n", "question_id": 115965, "question_license": "CC BY-SA 4.0", "question_score": 0, "question_text": "I already know that the divergence of one species into two can happen through a variety of methods.\n\n\n\n\n\n\n\npart of a population is isolated and different environmental factors cause different selective pressures\n\n\n\n\n\n\n\n\n\nsexual selection because certain traits are more considered more attractive in organisms\n\n\n\n\n\n\n\n\n\npolyploidy\n\n\n\n\n\n\n\n\n\ngenetic drift/mutation/other random things\n\n\n\n\n\n\n\n\n\netc.\n\n\n\n\n\n\n\n\nHowever, say a part of a species is isolated in similar conditions as the species in the main area. Ruling out random factors like genetic drift, mutation, etc., could the species still diverge? What I mean is, would it be possible for certain organisms to inherit unique combinations of genes from their parents so that they develop unique enough traits over a long period of time and can thus be classified as a separate species? I am basically wondering if simple inheritance and basic genetics, without any selective pressures or random occurences, can lead to the divergence of a species. Please let me know if the wording of this question doesn't make sense so I can fix it. Thanks!", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "user386598", "profile_url": "https://biology.stackexchange.com/users/87773/user386598", "user_type": "registered"}, "created_at": "2025-01-15T22:55:14+00:00", "raw_file": "raw/codex_api_v1/9208faf10edface85b193538ceee277a2c29dd57b691eaef3dbbd7fcb70c256f_1790824112025498400_0.json", "raw_sha256": "cacf2fdbe629fb39b1a0932a5485abc61f5635b5e51482d0d3b8ab40f1450c36", "revision_guid": "3223C0BD-BB65-4057-BCD3-7F5FB8FFBAEE", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/3223C0BD-BB65-4057-BCD3-7F5FB8FFBAEE/view-source"}, {"content_license": null, "contributor": {"display_name": "Community", "profile_url": "https://biology.stackexchange.com/users/-1/community", "user_type": "moderator"}, "created_at": "2025-02-15T16:04:35+00:00", "raw_file": "raw/codex_api_v1/9208faf10edface85b193538ceee277a2c29dd57b691eaef3dbbd7fcb70c256f_1790824112025498400_0.json", "raw_sha256": "cacf2fdbe629fb39b1a0932a5485abc61f5635b5e51482d0d3b8ab40f1450c36", "revision_guid": "25D462F1-79A8-4ED6-B1A6-637FA7EE1204", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://biology.stackexchange.com/revisions/25D462F1-79A8-4ED6-B1A6-637FA7EE1204/view-source"}], "source_site": "biology", "source_url": "https://biology.stackexchange.com/questions/115965/by-which-processes-can-speciation-occur", "split": "train", "split_group": "e838f5a578f3ab927ea85a7b2a27480002b3a86fec19c8ffe4e3ba659d0ff721", "tags": ["genetics", "evolution"], "thread_id": "biology:115965", "title": "By which processes can speciation occur?"}} {"accepted_status": [false, false, false], "candidate_answers": [{"answer_html": "

Short answer
\nNot all species of snake have lost all of their limbs completely

\n

Background
\nWhile snakes are generally considered to lack appendages, this is not entirely true. Not all species have lost their limbs completely, and vestigial remains may still be anatomically identifiable. It depends on the species, however.

\n

In pythons and boa constrictors vestigial legs can be visible with the naked eye as tiny hind leg bones located in their tails, referred to as pelvic spurs (Fig. 1). In some species these spurs are only present in males and are thought to be involved in mating behaviors (Kenji Anzai et al, 2023)).

\n

Depending on the species and sex within a species, vestigial pelvic bones may also be present (Fig. 2).

\n

\"spurs\"
\nFig. 1. Bone spur in a species of python. source: Wikipedia

\n

\"snake\nFig. 2. Vestigial pelvic bones in a dwarf boa in the male (left) but not in the female (right). source: IFL Science

\n

Reference
\n- Kenji Anzai et al., Herpet Bull (2023); 163: 35–6

\n", "answer_id": 116321, "answer_text": "Short answer\n\nNot all species of snake have lost all of their limbs completely\n\n\n\n\nBackground\n\nWhile snakes are generally considered to lack appendages, this is not entirely true. Not all species have lost their limbs completely, and vestigial remains may still be anatomically identifiable. It depends on the species, however.\n\n\n\n\nIn pythons and boa constrictors vestigial legs can be visible with the naked eye as tiny hind leg bones (https://www.amnh.org/exhibitions/darwin/evolution-today/how-do-we-know-living-things-are-related/vestigial-organs) located in their tails, referred to as pelvic spurs (Fig. 1). In some species these spurs are only present in males and are thought to be involved in mating behaviors (Kenji Anzai et al, 2023) (https://www.iflscience.com/new-species-of-dwarf-boa-with-remnants-of-a-pelvis-found-in-ecuadorian-amazon-66983)).\n\n\n\n\nDepending on the species and sex within a species, vestigial pelvic bones may also be present (Fig. 2).\n\n\n\n\n[image: spurs; source: https://i.sstatic.net/v59rFPo7.png] (https://i.sstatic.net/v59rFPo7.png)\n\nFig. 1. Bone spur in a species of python. source: Wikipedia (https://en.wikipedia.org/wiki/Pelvic_spur)\n\n\n\n\n[image: snake skeleton; source: https://i.sstatic.net/V0INm7qt.png] (https://i.sstatic.net/V0INm7qt.png)\nFig. 2. Vestigial pelvic bones in a dwarf boa in the male (left) but not in the female (right). source: IFL Science (https://www.iflscience.com/new-species-of-dwarf-boa-with-remnants-of-a-pelvis-found-in-ecuadorian-amazon-66983)\n\n\n\n\nReference\n\n- Kenji Anzai et al., Herpet Bull (2023); 163: 35–6 (https://www.iflscience.com/new-species-of-dwarf-boa-with-remnants-of-a-pelvis-found-in-ecuadorian-amazon-66983)", "answer_url": "https://biology.stackexchange.com/a/116321", "author": "AliceD", "author_url": "https://biology.stackexchange.com/users/9943/aliced", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-04-04T08:34:15+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:19.947691+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/df693642d727b738d2a533740632235c18a06cefec7a1e337c9589214a4ec91e_0.json", "raw_sha256": "9df534f437f3b2f12d33db8536999ec4e6ffa10f2f59394799d9fe01c3c1ad16", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/117606;117602;117598;117594;117585;117579;117570;117568;117565;117559;117558;117555;117552;117548;117538;117524;117523;117522;117520;117515;117510;116509;116508;116504;116499;116491;116485;116483;116461;116454;116453;116445;116441;116435;116430;116426;116425;116414;116412;116406;116401;116399;116396;116395;116394;116392;116389;116384;116370;116367;116363;116361;116352;116351;116347;116345;116343;116338;116337;116332;116331;116324;116320;116316;116314;116312;116306;116292;116290;116284;116280;116277;116271;116270;116268;116267;116257;116256;116253;116250;116249;116240;116237;116233;116219;116214;116212;116205;116204;116200;116198;116187;116184;116173;116172;116167;116162;116149;116142;116129/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 116320, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "AliceD", "profile_url": "https://biology.stackexchange.com/users/9943/aliced", "user_type": "registered"}, "created_at": "2025-04-04T08:34:15+00:00", "raw_file": "raw/codex_api_v1/2e46271dd42cc68e540cd93745d874445294455a8c8fc89effd7f36ed497eee4_1790824137680573300_0.json", "raw_sha256": "21274b3e65918ff952c3e3901f10b15b146be4d989ae74907eaed06f2a54ef5e", "revision_guid": "2362D2C7-FAFE-4877-9AAD-18BD544C9B64", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/2362D2C7-FAFE-4877-9AAD-18BD544C9B64/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "AliceD", "profile_url": "https://biology.stackexchange.com/users/9943/aliced", "user_type": "registered"}, "created_at": "2025-04-04T08:41:33+00:00", "raw_file": "raw/codex_api_v1/2e46271dd42cc68e540cd93745d874445294455a8c8fc89effd7f36ed497eee4_1790824137680573300_0.json", "raw_sha256": "21274b3e65918ff952c3e3901f10b15b146be4d989ae74907eaed06f2a54ef5e", "revision_guid": "5BC7FC17-2A3E-4D3B-8CA4-8DEAAF19F2EB", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/5BC7FC17-2A3E-4D3B-8CA4-8DEAAF19F2EB/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "AliceD", "profile_url": "https://biology.stackexchange.com/users/9943/aliced", "user_type": "registered"}, "created_at": "2025-04-04T11:51:43+00:00", "raw_file": "raw/codex_api_v1/2e46271dd42cc68e540cd93745d874445294455a8c8fc89effd7f36ed497eee4_1790824137680573300_0.json", "raw_sha256": "21274b3e65918ff952c3e3901f10b15b146be4d989ae74907eaed06f2a54ef5e", "revision_guid": "BD49C58B-A950-4CE5-B5C5-A2BFF4E7F528", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/BD49C58B-A950-4CE5-B5C5-A2BFF4E7F528/view-source"}], "score": 23, "updated_at": "2025-04-04T11:51:43+00:00"}, {"answer_html": "

Researchers investigated the fossil remains of ancestral snakes and they kind of reveal valuable information on how snakes lost legs. Most of the land snakes did not have any hind limbs nor any shoulder/pelvic attachments. Those which did have were tiny appendages assumed to be for mating purposes. Water snakes also have hind limbs but they were of little use for swimming. This somewhat explained the long, sinuous body with highly reduced limbs of snakes as they were undergoing an adaptive radiation that would meet the ecological requirement of burrowing. Their long body would help in pushing through the soil and legs would only get in the way. Inside the narrow burrows underground, the "proto-snakes" came to depend only on smell and taste (which explains forked tongue) and wriggling seem to work well than walking and hence evolution played its part of shrinking the limbs to stubs/appendages. Evolutionary scientists termed the rule "Use it or lose it".

\n

\"enter

\n

Researchers also found out that due to genetic mutation of Hox gene (that helps in regulating body plan by aiding in cell differentiation in the animal embryo) caused the gene expression to alter causing inhibition of limb growth. Other reasons include DNA missing from a gene called PTCH1 (which helps control limb development) and researches claims that this mutation “could be one of the important genetic bases underlying snakes’ limb loss”.

\n

References:

\n
    \n
  1. How the Snake Lost its Legs By Lewis I. Held (Jr.)
  2. \n
  3. https://www.scientificamerican.com/article/how-snakes-lost-their-legs/
  4. \n
  5. https://knowledge.carolina.com/discipline/life-science/ap-biology/how-snakes-lost-their-legs/
  6. \n
  7. https://www.science.org/content/article/how-did-snakes-lose-their-limbs-mass-genome-effort-provides-clues
  8. \n
\n", "answer_id": 116325, "answer_text": "Researchers investigated the fossil remains of ancestral snakes and they kind of reveal valuable information on how snakes lost legs. Most of the land snakes did not have any hind limbs nor any shoulder/pelvic attachments. Those which did have were tiny appendages assumed to be for mating purposes. Water snakes also have hind limbs but they were of little use for swimming. This somewhat explained the long, sinuous body with highly reduced limbs of snakes as they were undergoing an adaptive radiation that would meet the ecological requirement of burrowing. Their long body would help in pushing through the soil and legs would only get in the way. Inside the narrow burrows underground, the \"proto-snakes\" came to depend only on smell and taste (which explains forked tongue) and wriggling seem to work well than walking and hence evolution played its part of shrinking the limbs to stubs/appendages. Evolutionary scientists termed the rule \"Use it or lose it\".\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/c9jky6gY.png] (https://i.sstatic.net/c9jky6gY.png)\n\n\n\n\nResearchers also found out that due to genetic mutation of Hox gene (that helps in regulating body plan by aiding in cell differentiation in the animal embryo) caused the gene expression to alter causing inhibition of limb growth. Other reasons include DNA missing from a gene called PTCH1 (which helps control limb development) and researches claims that this mutation “could be one of the important genetic bases underlying snakes’ limb loss”.\n\n\n\n\nReferences:\n\n\n\n\n\nHow the Snake Lost its Legs By Lewis I. Held (Jr.)\n\n\n\n\nhttps://www.scientificamerican.com/article/how-snakes-lost-their-legs/ (https://www.scientificamerican.com/article/how-snakes-lost-their-legs/)\n\n\n\n\nhttps://knowledge.carolina.com/discipline/life-science/ap-biology/how-snakes-lost-their-legs/ (https://knowledge.carolina.com/discipline/life-science/ap-biology/how-snakes-lost-their-legs/)\n\n\n\n\nhttps://www.science.org/content/article/how-did-snakes-lose-their-limbs-mass-genome-effort-provides-clues (https://www.science.org/content/article/how-did-snakes-lose-their-limbs-mass-genome-effort-provides-clues)", "answer_url": "https://biology.stackexchange.com/a/116325", "author": "Nilay Ghosh", "author_url": "https://biology.stackexchange.com/users/16927/nilay-ghosh", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-04-05T05:54:16+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:19.947691+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/df693642d727b738d2a533740632235c18a06cefec7a1e337c9589214a4ec91e_0.json", "raw_sha256": "9df534f437f3b2f12d33db8536999ec4e6ffa10f2f59394799d9fe01c3c1ad16", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/117606;117602;117598;117594;117585;117579;117570;117568;117565;117559;117558;117555;117552;117548;117538;117524;117523;117522;117520;117515;117510;116509;116508;116504;116499;116491;116485;116483;116461;116454;116453;116445;116441;116435;116430;116426;116425;116414;116412;116406;116401;116399;116396;116395;116394;116392;116389;116384;116370;116367;116363;116361;116352;116351;116347;116345;116343;116338;116337;116332;116331;116324;116320;116316;116314;116312;116306;116292;116290;116284;116280;116277;116271;116270;116268;116267;116257;116256;116253;116250;116249;116240;116237;116233;116219;116214;116212;116205;116204;116200;116198;116187;116184;116173;116172;116167;116162;116149;116142;116129/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 116320, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nilay Ghosh", "profile_url": "https://biology.stackexchange.com/users/16927/nilay-ghosh", "user_type": "registered"}, "created_at": "2025-04-05T05:54:16+00:00", "raw_file": "raw/codex_api_v1/2e46271dd42cc68e540cd93745d874445294455a8c8fc89effd7f36ed497eee4_1790824137680573300_0.json", "raw_sha256": "21274b3e65918ff952c3e3901f10b15b146be4d989ae74907eaed06f2a54ef5e", "revision_guid": "0510E60B-BE05-47E8-B4CE-03C7672B472A", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/0510E60B-BE05-47E8-B4CE-03C7672B472A/view-source"}], "score": 4, "updated_at": "2025-04-05T05:54:16+00:00"}, {"answer_html": "

There are already some great answers here, but I would like to add a few things:

\n

The "How"-Question:

\n

As previously mentioned, the loss of limbs is associated with mutations in the Hox and Tbx genes. However, this change is at least genetically speaking less dramatic than it might seem. Essentially, it involves simply "switching off" these genes. As Prothero puts it in Vertebrate Evolution: From Origins to Dinosaurs and Beyond (page 145):

\n
\n

"Actually, becoming legless is the simplest part of the whole process."

\n
\n

In fact, limblessness has evolved independently numerous times across different lineages. Besides snakes, other examples include the following:

\n\n

In particular, I would also tend to disagree with the claim that "In most other cases they [the limbs] become very small but still there" in the question, even though there are certainly examples in which this is true (even within some snakes as mentioned in the answer of AliceD).

\n

The "Why"-Question:

\n

I would also like to add some comments on the "why-question", even though this is not the objective of the question. In the other answers and in the question it was stated that snakes lost their limbs because they evolved from burrowing lizard ancestors. However, this is just one of two competing hypotheses and the answer to this question is still pretty much debated:

\n
    \n
  1. Snakes evolved their elongated, limbless bodies from burrowing terrestrial ancestors, or

    \n
  2. \n
  3. From aquatic ancestors adapted to life in water.

    \n
  4. \n
\n

Now, this question is closely tied to the position of snakes within the evolutionary tree of squamates. There is a lot of evidence that snakes are members of the Toxicofera, a group that also includes the Anguimorpha, which comprises both limbed and limbless members, and the Iguania, which includes for example the iguanas and chameleons. Notably, all of these groups are terrestrial today, which would support the first (burrowing) hypothesis.

\n

However, this does not take into account extinct groups. For example, the Mosasauria were fully aquatic and had elongated, snake-like bodies. Some phylogenetic analyses (see e.g. Conrad 2008, Zaher et al. 2023) support the view that they are closely related to the varanids and monitor lizards within the Anguimorpha, while others (e.g. Lee 1997) have argued they are sister groups to snakes. Similar conclusions have also been supported by molecular-morphological analyses (Reeder et al. 2015, Pyron 2017).

\n

The oldest fossil snakes — Pachyrhachis and Haasiophis — are found in marine sediments. On the other hand, other Cretaceous snakes, such as the slightly younger Najash, come from terrestrial environments.

\n

To sum up, as Benton puts it in his book Vertebrate Paleontology (5th edition, see Box 9.6 on page 381) :

\n
\n

"So, the phylogenetic analyses and the older fossils may broadly\nconcur that snakes originated from among the mosasauroids and had an\naquatic ancestry, and yet the anatomy, ecology, and habits of modern\nand many fossil snakes point to a terrestrial origin."

\n
\n

So, the "why-question" remains pretty much an unresolved topic in evolutionary biology.

\n", "answer_id": 116383, "answer_text": "There are already some great answers here, but I would like to add a few things:\n\n\n\n\nThe \"How\"-Question:\n\n\n\n\nAs previously mentioned, the loss of limbs is associated with mutations in the Hox and Tbx genes. However, this change is at least genetically speaking less dramatic than it might seem. Essentially, it involves simply \"switching off\" these genes. As Prothero puts it in Vertebrate Evolution: From Origins to Dinosaurs and Beyond (page 145):\n\n\n\n\n\n\n\n\"Actually, becoming legless is the simplest part of the whole process.\"\n\n\n\n\n\n\n\nIn fact, limblessness has evolved independently numerous times across different lineages. Besides snakes, other examples include the following:\n\n\n\n\n\namong reptiles, the amphisbaenians (https://en.wikipedia.org/wiki/Amphisbaenia) (\"worm lizzards\"), some species of skinks (e.g. Acontias (https://en.wikipedia.org/wiki/Acontias), Scelotes (https://en.wikipedia.org/wiki/Scelotes), etc.), the Anguinae (https://en.wikipedia.org/wiki/Anguinae) (\"glass lizzards\"), the genus Chamaesaura (https://en.wikipedia.org/wiki/Chamaesaura), which is a member of the Cordylidae (https://en.wikipedia.org/wiki/Cordylidae) (\"spinytail lizards\"), the Pygopodidae (https://en.wikipedia.org/wiki/Pygopodidae) (\"snake-lizards\") of Australia, the Dibamidae (https://en.wikipedia.org/wiki/Dibamidae) (\" blind skinks\"), and some more. (see also this wikipedia article (https://en.wikipedia.org/wiki/Legless_lizard)).\n\n\n\n\namong amphibians, the Caecilians (https://en.wikipedia.org/wiki/Caecilian) and some extinct groups (aistopods (https://en.wikipedia.org/wiki/Aistopoda) and lysorophids (https://en.wikipedia.org/wiki/Lysorophia)).\n\n\n\n\n\nIn particular, I would also tend to disagree with the claim that \"In most other cases they [the limbs] become very small but still there\" in the question, even though there are certainly examples in which this is true (even within some snakes as mentioned in the answer of AliceD).\n\n\n\n\nThe \"Why\"-Question:\n\n\n\n\nI would also like to add some comments on the \"why-question\", even though this is not the objective of the question. In the other answers and in the question it was stated that snakes lost their limbs because they evolved from burrowing lizard ancestors. However, this is just one of two competing hypotheses and the answer to this question is still pretty much debated:\n\n\n\n\n\n\n\nSnakes evolved their elongated, limbless bodies from burrowing terrestrial ancestors, or\n\n\n\n\n\n\n\n\n\nFrom aquatic ancestors adapted to life in water.\n\n\n\n\n\n\n\n\nNow, this question is closely tied to the position of snakes within the evolutionary tree of squamates. There is a lot of evidence that snakes are members of the Toxicofera (https://en.wikipedia.org/wiki/Toxicofera), a group that also includes the Anguimorpha (https://en.wikipedia.org/wiki/Anguimorpha), which comprises both limbed and limbless members, and the Iguania (https://en.wikipedia.org/wiki/Iguanomorpha), which includes for example the iguanas and chameleons. Notably, all of these groups are terrestrial today, which would support the first (burrowing) hypothesis.\n\n\n\n\nHowever, this does not take into account extinct groups. For example, the Mosasauria (https://en.wikipedia.org/wiki/Mosasauria) were fully aquatic and had elongated, snake-like bodies. Some phylogenetic analyses (see e.g. Conrad 2008 (https://doi.org/10.1206/310.1), Zaher et al. 2023 (https://doi.org/10.1093/zoolinnean/zlac001)) support the view that they are closely related to the varanids and monitor lizards within the Anguimorpha, while others (e.g. Lee 1997 (https://doi.org/10.1098/rstb.1997.0005)) have argued they are sister groups to snakes. Similar conclusions have also been supported by molecular-morphological analyses (Reeder et al. 2015 (https://doi.org/10.1371/journal.pone.0118199), Pyron 2017 (https://doi.org/10.1093/sysbio/syw068)).\n\n\n\n\nThe oldest fossil snakes — Pachyrhachis (https://en.wikipedia.org/wiki/Pachyrhachis) and Haasiophis (https://en.wikipedia.org/wiki/Haasiophis) — are found in marine sediments. On the other hand, other Cretaceous snakes, such as the slightly younger Najash (https://en.wikipedia.org/wiki/Najash), come from terrestrial environments.\n\n\n\n\nTo sum up, as Benton puts it in his book Vertebrate Paleontology (https://www.wiley.com/en-us/Vertebrate+Palaeontology%2C+5th+Edition-p-9781394195091) (5th edition, see Box 9.6 on page 381) :\n\n\n\n\n\n\n\n\"So, the phylogenetic analyses and the older fossils may broadly\nconcur that snakes originated from among the mosasauroids and had an\naquatic ancestry, and yet the anatomy, ecology, and habits of modern\nand many fossil snakes point to a terrestrial origin.\"\n\n\n\n\n\n\n\nSo, the \"why-question\" remains pretty much an unresolved topic in evolutionary biology.", "answer_url": "https://biology.stackexchange.com/a/116383", "author": "G. Blaickner", "author_url": "https://biology.stackexchange.com/users/76678/g-blaickner", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-04-20T08:48:29+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:19.947691+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/df693642d727b738d2a533740632235c18a06cefec7a1e337c9589214a4ec91e_0.json", "raw_sha256": "9df534f437f3b2f12d33db8536999ec4e6ffa10f2f59394799d9fe01c3c1ad16", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/117606;117602;117598;117594;117585;117579;117570;117568;117565;117559;117558;117555;117552;117548;117538;117524;117523;117522;117520;117515;117510;116509;116508;116504;116499;116491;116485;116483;116461;116454;116453;116445;116441;116435;116430;116426;116425;116414;116412;116406;116401;116399;116396;116395;116394;116392;116389;116384;116370;116367;116363;116361;116352;116351;116347;116345;116343;116338;116337;116332;116331;116324;116320;116316;116314;116312;116306;116292;116290;116284;116280;116277;116271;116270;116268;116267;116257;116256;116253;116250;116249;116240;116237;116233;116219;116214;116212;116205;116204;116200;116198;116187;116184;116173;116172;116167;116162;116149;116142;116129/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 116320, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "G. Blaickner", "profile_url": "https://biology.stackexchange.com/users/76678/g-blaickner", "user_type": "registered"}, "created_at": "2025-04-20T08:48:29+00:00", "raw_file": "raw/codex_api_v1/00f792a35cd1fe53cc744b44d1c7f5a2081648f5d4403a4e8f1d570c00e5dc95_1790824135500262400_0.json", "raw_sha256": "0face46f22b53414ff8968bb035acf71d0f5c1f84da8d6f0813602f842802d98", "revision_guid": "F191A647-436E-48C6-BF0A-07D13528E537", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/F191A647-436E-48C6-BF0A-07D13528E537/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "G. Blaickner", "profile_url": "https://biology.stackexchange.com/users/76678/g-blaickner", "user_type": "registered"}, "created_at": "2025-04-20T08:54:53+00:00", "raw_file": "raw/codex_api_v1/00f792a35cd1fe53cc744b44d1c7f5a2081648f5d4403a4e8f1d570c00e5dc95_1790824135500262400_0.json", "raw_sha256": "0face46f22b53414ff8968bb035acf71d0f5c1f84da8d6f0813602f842802d98", "revision_guid": "FE158015-4E5A-402C-B02E-BB7B57C66736", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/FE158015-4E5A-402C-B02E-BB7B57C66736/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "G. Blaickner", "profile_url": "https://biology.stackexchange.com/users/76678/g-blaickner", "user_type": "registered"}, "created_at": "2025-04-20T09:21:46+00:00", "raw_file": "raw/codex_api_v1/00f792a35cd1fe53cc744b44d1c7f5a2081648f5d4403a4e8f1d570c00e5dc95_1790824135500262400_0.json", "raw_sha256": "0face46f22b53414ff8968bb035acf71d0f5c1f84da8d6f0813602f842802d98", "revision_guid": "7DFDAFDB-D50D-4FDA-9B88-EEB70940BB15", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/7DFDAFDB-D50D-4FDA-9B88-EEB70940BB15/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "G. Blaickner", "profile_url": "https://biology.stackexchange.com/users/76678/g-blaickner", "user_type": "registered"}, "created_at": "2025-04-20T09:27:38+00:00", "raw_file": "raw/codex_api_v1/00f792a35cd1fe53cc744b44d1c7f5a2081648f5d4403a4e8f1d570c00e5dc95_1790824135500262400_0.json", "raw_sha256": "0face46f22b53414ff8968bb035acf71d0f5c1f84da8d6f0813602f842802d98", "revision_guid": "72ABB037-51D5-443D-BDDA-527245A3E624", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/72ABB037-51D5-443D-BDDA-527245A3E624/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "G. Blaickner", "profile_url": "https://biology.stackexchange.com/users/76678/g-blaickner", "user_type": "registered"}, "created_at": "2025-04-21T09:24:03+00:00", "raw_file": "raw/codex_api_v1/00f792a35cd1fe53cc744b44d1c7f5a2081648f5d4403a4e8f1d570c00e5dc95_1790824135500262400_0.json", "raw_sha256": "0face46f22b53414ff8968bb035acf71d0f5c1f84da8d6f0813602f842802d98", "revision_guid": "AA8E44FF-5CF8-4C95-8F26-3A7B481A51E5", "revision_number": 5, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/AA8E44FF-5CF8-4C95-8F26-3A7B481A51E5/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "G. Blaickner", "profile_url": "https://biology.stackexchange.com/users/76678/g-blaickner", "user_type": "registered"}, "created_at": "2025-04-22T07:38:17+00:00", "raw_file": "raw/codex_api_v1/00f792a35cd1fe53cc744b44d1c7f5a2081648f5d4403a4e8f1d570c00e5dc95_1790824135500262400_0.json", "raw_sha256": "0face46f22b53414ff8968bb035acf71d0f5c1f84da8d6f0813602f842802d98", "revision_guid": "F8E6A848-8A39-43C6-939F-9F29CE4F542A", "revision_number": 6, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/F8E6A848-8A39-43C6-939F-9F29CE4F542A/view-source"}], "score": 3, "updated_at": "2025-04-22T07:38:17+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I understand the why, but how did snakes lose legs completely? In most other cases they become very small but still there (whale back legs, fly secondary wings, kiwi wings, etc.) but they almost never lose them completely. So how did snakes complete this process beyond most other animals undergoing a similar loss of limbs?\n\n\n\n\nTo those of you wondering why snakes lost limbs it’s because burrowing animals lose or reduce body parts, including limbs. Snakes just took this to the extreme and I’m wondering why they didn’t leave at least a little within their body in advanced snakes.", "record_id": "Scientific-Answer-Ranking:biology:116320", "scores": [23, 4, 3], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

Short answer
\nNot all species of snake have lost all of their limbs completely

\n

Background
\nWhile snakes are generally considered to lack appendages, this is not entirely true. Not all species have lost their limbs completely, and vestigial remains may still be anatomically identifiable. It depends on the species, however.

\n

In pythons and boa constrictors vestigial legs can be visible with the naked eye as tiny hind leg bones located in their tails, referred to as pelvic spurs (Fig. 1). In some species these spurs are only present in males and are thought to be involved in mating behaviors (Kenji Anzai et al, 2023)).

\n

Depending on the species and sex within a species, vestigial pelvic bones may also be present (Fig. 2).

\n

\"spurs\"
\nFig. 1. Bone spur in a species of python. source: Wikipedia

\n

\"snake\nFig. 2. Vestigial pelvic bones in a dwarf boa in the male (left) but not in the female (right). source: IFL Science

\n

Reference
\n- Kenji Anzai et al., Herpet Bull (2023); 163: 35–6

\n", "answer_id": 116321, "answer_text": "Short answer\n\nNot all species of snake have lost all of their limbs completely\n\n\n\n\nBackground\n\nWhile snakes are generally considered to lack appendages, this is not entirely true. Not all species have lost their limbs completely, and vestigial remains may still be anatomically identifiable. It depends on the species, however.\n\n\n\n\nIn pythons and boa constrictors vestigial legs can be visible with the naked eye as tiny hind leg bones (https://www.amnh.org/exhibitions/darwin/evolution-today/how-do-we-know-living-things-are-related/vestigial-organs) located in their tails, referred to as pelvic spurs (Fig. 1). In some species these spurs are only present in males and are thought to be involved in mating behaviors (Kenji Anzai et al, 2023) (https://www.iflscience.com/new-species-of-dwarf-boa-with-remnants-of-a-pelvis-found-in-ecuadorian-amazon-66983)).\n\n\n\n\nDepending on the species and sex within a species, vestigial pelvic bones may also be present (Fig. 2).\n\n\n\n\n[image: spurs; source: https://i.sstatic.net/v59rFPo7.png] (https://i.sstatic.net/v59rFPo7.png)\n\nFig. 1. Bone spur in a species of python. source: Wikipedia (https://en.wikipedia.org/wiki/Pelvic_spur)\n\n\n\n\n[image: snake skeleton; source: https://i.sstatic.net/V0INm7qt.png] (https://i.sstatic.net/V0INm7qt.png)\nFig. 2. Vestigial pelvic bones in a dwarf boa in the male (left) but not in the female (right). source: IFL Science (https://www.iflscience.com/new-species-of-dwarf-boa-with-remnants-of-a-pelvis-found-in-ecuadorian-amazon-66983)\n\n\n\n\nReference\n\n- Kenji Anzai et al., Herpet Bull (2023); 163: 35–6 (https://www.iflscience.com/new-species-of-dwarf-boa-with-remnants-of-a-pelvis-found-in-ecuadorian-amazon-66983)", "answer_url": "https://biology.stackexchange.com/a/116321", "author": "AliceD", "author_url": "https://biology.stackexchange.com/users/9943/aliced", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-04-04T08:34:15+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:19.947691+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/df693642d727b738d2a533740632235c18a06cefec7a1e337c9589214a4ec91e_0.json", "raw_sha256": "9df534f437f3b2f12d33db8536999ec4e6ffa10f2f59394799d9fe01c3c1ad16", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/117606;117602;117598;117594;117585;117579;117570;117568;117565;117559;117558;117555;117552;117548;117538;117524;117523;117522;117520;117515;117510;116509;116508;116504;116499;116491;116485;116483;116461;116454;116453;116445;116441;116435;116430;116426;116425;116414;116412;116406;116401;116399;116396;116395;116394;116392;116389;116384;116370;116367;116363;116361;116352;116351;116347;116345;116343;116338;116337;116332;116331;116324;116320;116316;116314;116312;116306;116292;116290;116284;116280;116277;116271;116270;116268;116267;116257;116256;116253;116250;116249;116240;116237;116233;116219;116214;116212;116205;116204;116200;116198;116187;116184;116173;116172;116167;116162;116149;116142;116129/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 116320, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "AliceD", "profile_url": "https://biology.stackexchange.com/users/9943/aliced", "user_type": "registered"}, "created_at": "2025-04-04T08:34:15+00:00", "raw_file": "raw/codex_api_v1/2e46271dd42cc68e540cd93745d874445294455a8c8fc89effd7f36ed497eee4_1790824137680573300_0.json", "raw_sha256": "21274b3e65918ff952c3e3901f10b15b146be4d989ae74907eaed06f2a54ef5e", "revision_guid": "2362D2C7-FAFE-4877-9AAD-18BD544C9B64", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/2362D2C7-FAFE-4877-9AAD-18BD544C9B64/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "AliceD", "profile_url": "https://biology.stackexchange.com/users/9943/aliced", "user_type": "registered"}, "created_at": "2025-04-04T08:41:33+00:00", "raw_file": "raw/codex_api_v1/2e46271dd42cc68e540cd93745d874445294455a8c8fc89effd7f36ed497eee4_1790824137680573300_0.json", "raw_sha256": "21274b3e65918ff952c3e3901f10b15b146be4d989ae74907eaed06f2a54ef5e", "revision_guid": "5BC7FC17-2A3E-4D3B-8CA4-8DEAAF19F2EB", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/5BC7FC17-2A3E-4D3B-8CA4-8DEAAF19F2EB/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "AliceD", "profile_url": "https://biology.stackexchange.com/users/9943/aliced", "user_type": "registered"}, "created_at": "2025-04-04T11:51:43+00:00", "raw_file": "raw/codex_api_v1/2e46271dd42cc68e540cd93745d874445294455a8c8fc89effd7f36ed497eee4_1790824137680573300_0.json", "raw_sha256": "21274b3e65918ff952c3e3901f10b15b146be4d989ae74907eaed06f2a54ef5e", "revision_guid": "BD49C58B-A950-4CE5-B5C5-A2BFF4E7F528", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/BD49C58B-A950-4CE5-B5C5-A2BFF4E7F528/view-source"}], "score": 23, "updated_at": "2025-04-04T11:51:43+00:00"}, {"answer_html": "

Researchers investigated the fossil remains of ancestral snakes and they kind of reveal valuable information on how snakes lost legs. Most of the land snakes did not have any hind limbs nor any shoulder/pelvic attachments. Those which did have were tiny appendages assumed to be for mating purposes. Water snakes also have hind limbs but they were of little use for swimming. This somewhat explained the long, sinuous body with highly reduced limbs of snakes as they were undergoing an adaptive radiation that would meet the ecological requirement of burrowing. Their long body would help in pushing through the soil and legs would only get in the way. Inside the narrow burrows underground, the "proto-snakes" came to depend only on smell and taste (which explains forked tongue) and wriggling seem to work well than walking and hence evolution played its part of shrinking the limbs to stubs/appendages. Evolutionary scientists termed the rule "Use it or lose it".

\n

\"enter

\n

Researchers also found out that due to genetic mutation of Hox gene (that helps in regulating body plan by aiding in cell differentiation in the animal embryo) caused the gene expression to alter causing inhibition of limb growth. Other reasons include DNA missing from a gene called PTCH1 (which helps control limb development) and researches claims that this mutation “could be one of the important genetic bases underlying snakes’ limb loss”.

\n

References:

\n
    \n
  1. How the Snake Lost its Legs By Lewis I. Held (Jr.)
  2. \n
  3. https://www.scientificamerican.com/article/how-snakes-lost-their-legs/
  4. \n
  5. https://knowledge.carolina.com/discipline/life-science/ap-biology/how-snakes-lost-their-legs/
  6. \n
  7. https://www.science.org/content/article/how-did-snakes-lose-their-limbs-mass-genome-effort-provides-clues
  8. \n
\n", "answer_id": 116325, "answer_text": "Researchers investigated the fossil remains of ancestral snakes and they kind of reveal valuable information on how snakes lost legs. Most of the land snakes did not have any hind limbs nor any shoulder/pelvic attachments. Those which did have were tiny appendages assumed to be for mating purposes. Water snakes also have hind limbs but they were of little use for swimming. This somewhat explained the long, sinuous body with highly reduced limbs of snakes as they were undergoing an adaptive radiation that would meet the ecological requirement of burrowing. Their long body would help in pushing through the soil and legs would only get in the way. Inside the narrow burrows underground, the \"proto-snakes\" came to depend only on smell and taste (which explains forked tongue) and wriggling seem to work well than walking and hence evolution played its part of shrinking the limbs to stubs/appendages. Evolutionary scientists termed the rule \"Use it or lose it\".\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/c9jky6gY.png] (https://i.sstatic.net/c9jky6gY.png)\n\n\n\n\nResearchers also found out that due to genetic mutation of Hox gene (that helps in regulating body plan by aiding in cell differentiation in the animal embryo) caused the gene expression to alter causing inhibition of limb growth. Other reasons include DNA missing from a gene called PTCH1 (which helps control limb development) and researches claims that this mutation “could be one of the important genetic bases underlying snakes’ limb loss”.\n\n\n\n\nReferences:\n\n\n\n\n\nHow the Snake Lost its Legs By Lewis I. Held (Jr.)\n\n\n\n\nhttps://www.scientificamerican.com/article/how-snakes-lost-their-legs/ (https://www.scientificamerican.com/article/how-snakes-lost-their-legs/)\n\n\n\n\nhttps://knowledge.carolina.com/discipline/life-science/ap-biology/how-snakes-lost-their-legs/ (https://knowledge.carolina.com/discipline/life-science/ap-biology/how-snakes-lost-their-legs/)\n\n\n\n\nhttps://www.science.org/content/article/how-did-snakes-lose-their-limbs-mass-genome-effort-provides-clues (https://www.science.org/content/article/how-did-snakes-lose-their-limbs-mass-genome-effort-provides-clues)", "answer_url": "https://biology.stackexchange.com/a/116325", "author": "Nilay Ghosh", "author_url": "https://biology.stackexchange.com/users/16927/nilay-ghosh", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-04-05T05:54:16+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:19.947691+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/df693642d727b738d2a533740632235c18a06cefec7a1e337c9589214a4ec91e_0.json", "raw_sha256": "9df534f437f3b2f12d33db8536999ec4e6ffa10f2f59394799d9fe01c3c1ad16", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/117606;117602;117598;117594;117585;117579;117570;117568;117565;117559;117558;117555;117552;117548;117538;117524;117523;117522;117520;117515;117510;116509;116508;116504;116499;116491;116485;116483;116461;116454;116453;116445;116441;116435;116430;116426;116425;116414;116412;116406;116401;116399;116396;116395;116394;116392;116389;116384;116370;116367;116363;116361;116352;116351;116347;116345;116343;116338;116337;116332;116331;116324;116320;116316;116314;116312;116306;116292;116290;116284;116280;116277;116271;116270;116268;116267;116257;116256;116253;116250;116249;116240;116237;116233;116219;116214;116212;116205;116204;116200;116198;116187;116184;116173;116172;116167;116162;116149;116142;116129/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 116320, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nilay Ghosh", "profile_url": "https://biology.stackexchange.com/users/16927/nilay-ghosh", "user_type": "registered"}, "created_at": "2025-04-05T05:54:16+00:00", "raw_file": "raw/codex_api_v1/2e46271dd42cc68e540cd93745d874445294455a8c8fc89effd7f36ed497eee4_1790824137680573300_0.json", "raw_sha256": "21274b3e65918ff952c3e3901f10b15b146be4d989ae74907eaed06f2a54ef5e", "revision_guid": "0510E60B-BE05-47E8-B4CE-03C7672B472A", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/0510E60B-BE05-47E8-B4CE-03C7672B472A/view-source"}], "score": 4, "updated_at": "2025-04-05T05:54:16+00:00"}, {"answer_html": "

There are already some great answers here, but I would like to add a few things:

\n

The "How"-Question:

\n

As previously mentioned, the loss of limbs is associated with mutations in the Hox and Tbx genes. However, this change is at least genetically speaking less dramatic than it might seem. Essentially, it involves simply "switching off" these genes. As Prothero puts it in Vertebrate Evolution: From Origins to Dinosaurs and Beyond (page 145):

\n
\n

"Actually, becoming legless is the simplest part of the whole process."

\n
\n

In fact, limblessness has evolved independently numerous times across different lineages. Besides snakes, other examples include the following:

\n\n

In particular, I would also tend to disagree with the claim that "In most other cases they [the limbs] become very small but still there" in the question, even though there are certainly examples in which this is true (even within some snakes as mentioned in the answer of AliceD).

\n

The "Why"-Question:

\n

I would also like to add some comments on the "why-question", even though this is not the objective of the question. In the other answers and in the question it was stated that snakes lost their limbs because they evolved from burrowing lizard ancestors. However, this is just one of two competing hypotheses and the answer to this question is still pretty much debated:

\n
    \n
  1. Snakes evolved their elongated, limbless bodies from burrowing terrestrial ancestors, or

    \n
  2. \n
  3. From aquatic ancestors adapted to life in water.

    \n
  4. \n
\n

Now, this question is closely tied to the position of snakes within the evolutionary tree of squamates. There is a lot of evidence that snakes are members of the Toxicofera, a group that also includes the Anguimorpha, which comprises both limbed and limbless members, and the Iguania, which includes for example the iguanas and chameleons. Notably, all of these groups are terrestrial today, which would support the first (burrowing) hypothesis.

\n

However, this does not take into account extinct groups. For example, the Mosasauria were fully aquatic and had elongated, snake-like bodies. Some phylogenetic analyses (see e.g. Conrad 2008, Zaher et al. 2023) support the view that they are closely related to the varanids and monitor lizards within the Anguimorpha, while others (e.g. Lee 1997) have argued they are sister groups to snakes. Similar conclusions have also been supported by molecular-morphological analyses (Reeder et al. 2015, Pyron 2017).

\n

The oldest fossil snakes — Pachyrhachis and Haasiophis — are found in marine sediments. On the other hand, other Cretaceous snakes, such as the slightly younger Najash, come from terrestrial environments.

\n

To sum up, as Benton puts it in his book Vertebrate Paleontology (5th edition, see Box 9.6 on page 381) :

\n
\n

"So, the phylogenetic analyses and the older fossils may broadly\nconcur that snakes originated from among the mosasauroids and had an\naquatic ancestry, and yet the anatomy, ecology, and habits of modern\nand many fossil snakes point to a terrestrial origin."

\n
\n

So, the "why-question" remains pretty much an unresolved topic in evolutionary biology.

\n", "answer_id": 116383, "answer_text": "There are already some great answers here, but I would like to add a few things:\n\n\n\n\nThe \"How\"-Question:\n\n\n\n\nAs previously mentioned, the loss of limbs is associated with mutations in the Hox and Tbx genes. However, this change is at least genetically speaking less dramatic than it might seem. Essentially, it involves simply \"switching off\" these genes. As Prothero puts it in Vertebrate Evolution: From Origins to Dinosaurs and Beyond (page 145):\n\n\n\n\n\n\n\n\"Actually, becoming legless is the simplest part of the whole process.\"\n\n\n\n\n\n\n\nIn fact, limblessness has evolved independently numerous times across different lineages. Besides snakes, other examples include the following:\n\n\n\n\n\namong reptiles, the amphisbaenians (https://en.wikipedia.org/wiki/Amphisbaenia) (\"worm lizzards\"), some species of skinks (e.g. Acontias (https://en.wikipedia.org/wiki/Acontias), Scelotes (https://en.wikipedia.org/wiki/Scelotes), etc.), the Anguinae (https://en.wikipedia.org/wiki/Anguinae) (\"glass lizzards\"), the genus Chamaesaura (https://en.wikipedia.org/wiki/Chamaesaura), which is a member of the Cordylidae (https://en.wikipedia.org/wiki/Cordylidae) (\"spinytail lizards\"), the Pygopodidae (https://en.wikipedia.org/wiki/Pygopodidae) (\"snake-lizards\") of Australia, the Dibamidae (https://en.wikipedia.org/wiki/Dibamidae) (\" blind skinks\"), and some more. (see also this wikipedia article (https://en.wikipedia.org/wiki/Legless_lizard)).\n\n\n\n\namong amphibians, the Caecilians (https://en.wikipedia.org/wiki/Caecilian) and some extinct groups (aistopods (https://en.wikipedia.org/wiki/Aistopoda) and lysorophids (https://en.wikipedia.org/wiki/Lysorophia)).\n\n\n\n\n\nIn particular, I would also tend to disagree with the claim that \"In most other cases they [the limbs] become very small but still there\" in the question, even though there are certainly examples in which this is true (even within some snakes as mentioned in the answer of AliceD).\n\n\n\n\nThe \"Why\"-Question:\n\n\n\n\nI would also like to add some comments on the \"why-question\", even though this is not the objective of the question. In the other answers and in the question it was stated that snakes lost their limbs because they evolved from burrowing lizard ancestors. However, this is just one of two competing hypotheses and the answer to this question is still pretty much debated:\n\n\n\n\n\n\n\nSnakes evolved their elongated, limbless bodies from burrowing terrestrial ancestors, or\n\n\n\n\n\n\n\n\n\nFrom aquatic ancestors adapted to life in water.\n\n\n\n\n\n\n\n\nNow, this question is closely tied to the position of snakes within the evolutionary tree of squamates. There is a lot of evidence that snakes are members of the Toxicofera (https://en.wikipedia.org/wiki/Toxicofera), a group that also includes the Anguimorpha (https://en.wikipedia.org/wiki/Anguimorpha), which comprises both limbed and limbless members, and the Iguania (https://en.wikipedia.org/wiki/Iguanomorpha), which includes for example the iguanas and chameleons. Notably, all of these groups are terrestrial today, which would support the first (burrowing) hypothesis.\n\n\n\n\nHowever, this does not take into account extinct groups. For example, the Mosasauria (https://en.wikipedia.org/wiki/Mosasauria) were fully aquatic and had elongated, snake-like bodies. Some phylogenetic analyses (see e.g. Conrad 2008 (https://doi.org/10.1206/310.1), Zaher et al. 2023 (https://doi.org/10.1093/zoolinnean/zlac001)) support the view that they are closely related to the varanids and monitor lizards within the Anguimorpha, while others (e.g. Lee 1997 (https://doi.org/10.1098/rstb.1997.0005)) have argued they are sister groups to snakes. Similar conclusions have also been supported by molecular-morphological analyses (Reeder et al. 2015 (https://doi.org/10.1371/journal.pone.0118199), Pyron 2017 (https://doi.org/10.1093/sysbio/syw068)).\n\n\n\n\nThe oldest fossil snakes — Pachyrhachis (https://en.wikipedia.org/wiki/Pachyrhachis) and Haasiophis (https://en.wikipedia.org/wiki/Haasiophis) — are found in marine sediments. On the other hand, other Cretaceous snakes, such as the slightly younger Najash (https://en.wikipedia.org/wiki/Najash), come from terrestrial environments.\n\n\n\n\nTo sum up, as Benton puts it in his book Vertebrate Paleontology (https://www.wiley.com/en-us/Vertebrate+Palaeontology%2C+5th+Edition-p-9781394195091) (5th edition, see Box 9.6 on page 381) :\n\n\n\n\n\n\n\n\"So, the phylogenetic analyses and the older fossils may broadly\nconcur that snakes originated from among the mosasauroids and had an\naquatic ancestry, and yet the anatomy, ecology, and habits of modern\nand many fossil snakes point to a terrestrial origin.\"\n\n\n\n\n\n\n\nSo, the \"why-question\" remains pretty much an unresolved topic in evolutionary biology.", "answer_url": "https://biology.stackexchange.com/a/116383", "author": "G. Blaickner", "author_url": "https://biology.stackexchange.com/users/76678/g-blaickner", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-04-20T08:48:29+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:19.947691+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/df693642d727b738d2a533740632235c18a06cefec7a1e337c9589214a4ec91e_0.json", "raw_sha256": "9df534f437f3b2f12d33db8536999ec4e6ffa10f2f59394799d9fe01c3c1ad16", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/117606;117602;117598;117594;117585;117579;117570;117568;117565;117559;117558;117555;117552;117548;117538;117524;117523;117522;117520;117515;117510;116509;116508;116504;116499;116491;116485;116483;116461;116454;116453;116445;116441;116435;116430;116426;116425;116414;116412;116406;116401;116399;116396;116395;116394;116392;116389;116384;116370;116367;116363;116361;116352;116351;116347;116345;116343;116338;116337;116332;116331;116324;116320;116316;116314;116312;116306;116292;116290;116284;116280;116277;116271;116270;116268;116267;116257;116256;116253;116250;116249;116240;116237;116233;116219;116214;116212;116205;116204;116200;116198;116187;116184;116173;116172;116167;116162;116149;116142;116129/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 116320, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "G. Blaickner", "profile_url": "https://biology.stackexchange.com/users/76678/g-blaickner", "user_type": "registered"}, "created_at": "2025-04-20T08:48:29+00:00", "raw_file": "raw/codex_api_v1/00f792a35cd1fe53cc744b44d1c7f5a2081648f5d4403a4e8f1d570c00e5dc95_1790824135500262400_0.json", "raw_sha256": "0face46f22b53414ff8968bb035acf71d0f5c1f84da8d6f0813602f842802d98", "revision_guid": "F191A647-436E-48C6-BF0A-07D13528E537", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/F191A647-436E-48C6-BF0A-07D13528E537/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "G. Blaickner", "profile_url": "https://biology.stackexchange.com/users/76678/g-blaickner", "user_type": "registered"}, "created_at": "2025-04-20T08:54:53+00:00", "raw_file": "raw/codex_api_v1/00f792a35cd1fe53cc744b44d1c7f5a2081648f5d4403a4e8f1d570c00e5dc95_1790824135500262400_0.json", "raw_sha256": "0face46f22b53414ff8968bb035acf71d0f5c1f84da8d6f0813602f842802d98", "revision_guid": "FE158015-4E5A-402C-B02E-BB7B57C66736", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/FE158015-4E5A-402C-B02E-BB7B57C66736/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "G. Blaickner", "profile_url": "https://biology.stackexchange.com/users/76678/g-blaickner", "user_type": "registered"}, "created_at": "2025-04-20T09:21:46+00:00", "raw_file": "raw/codex_api_v1/00f792a35cd1fe53cc744b44d1c7f5a2081648f5d4403a4e8f1d570c00e5dc95_1790824135500262400_0.json", "raw_sha256": "0face46f22b53414ff8968bb035acf71d0f5c1f84da8d6f0813602f842802d98", "revision_guid": "7DFDAFDB-D50D-4FDA-9B88-EEB70940BB15", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/7DFDAFDB-D50D-4FDA-9B88-EEB70940BB15/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "G. Blaickner", "profile_url": "https://biology.stackexchange.com/users/76678/g-blaickner", "user_type": "registered"}, "created_at": "2025-04-20T09:27:38+00:00", "raw_file": "raw/codex_api_v1/00f792a35cd1fe53cc744b44d1c7f5a2081648f5d4403a4e8f1d570c00e5dc95_1790824135500262400_0.json", "raw_sha256": "0face46f22b53414ff8968bb035acf71d0f5c1f84da8d6f0813602f842802d98", "revision_guid": "72ABB037-51D5-443D-BDDA-527245A3E624", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/72ABB037-51D5-443D-BDDA-527245A3E624/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "G. Blaickner", "profile_url": "https://biology.stackexchange.com/users/76678/g-blaickner", "user_type": "registered"}, "created_at": "2025-04-21T09:24:03+00:00", "raw_file": "raw/codex_api_v1/00f792a35cd1fe53cc744b44d1c7f5a2081648f5d4403a4e8f1d570c00e5dc95_1790824135500262400_0.json", "raw_sha256": "0face46f22b53414ff8968bb035acf71d0f5c1f84da8d6f0813602f842802d98", "revision_guid": "AA8E44FF-5CF8-4C95-8F26-3A7B481A51E5", "revision_number": 5, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/AA8E44FF-5CF8-4C95-8F26-3A7B481A51E5/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "G. Blaickner", "profile_url": "https://biology.stackexchange.com/users/76678/g-blaickner", "user_type": "registered"}, "created_at": "2025-04-22T07:38:17+00:00", "raw_file": "raw/codex_api_v1/00f792a35cd1fe53cc744b44d1c7f5a2081648f5d4403a4e8f1d570c00e5dc95_1790824135500262400_0.json", "raw_sha256": "0face46f22b53414ff8968bb035acf71d0f5c1f84da8d6f0813602f842802d98", "revision_guid": "F8E6A848-8A39-43C6-939F-9F29CE4F542A", "revision_number": 6, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/F8E6A848-8A39-43C6-939F-9F29CE4F542A/view-source"}], "score": 3, "updated_at": "2025-04-22T07:38:17+00:00"}], "domain": "biology", "external_links": ["https://doi.org/10.1093/sysbio/syw068", "https://doi.org/10.1093/zoolinnean/zlac001", "https://doi.org/10.1098/rstb.1997.0005", "https://doi.org/10.1206/310.1", "https://doi.org/10.1371/journal.pone.0118199", "https://en.wikipedia.org/wiki/Acontias", "https://en.wikipedia.org/wiki/Aistopoda", "https://en.wikipedia.org/wiki/Amphisbaenia", "https://en.wikipedia.org/wiki/Anguimorpha", "https://en.wikipedia.org/wiki/Anguinae", "https://en.wikipedia.org/wiki/Caecilian", "https://en.wikipedia.org/wiki/Chamaesaura", "https://en.wikipedia.org/wiki/Cordylidae", "https://en.wikipedia.org/wiki/Dibamidae", "https://en.wikipedia.org/wiki/Haasiophis", "https://en.wikipedia.org/wiki/Iguanomorpha", "https://en.wikipedia.org/wiki/Legless_lizard", "https://en.wikipedia.org/wiki/Lysorophia", "https://en.wikipedia.org/wiki/Mosasauria", "https://en.wikipedia.org/wiki/Najash", "https://en.wikipedia.org/wiki/Pachyrhachis", "https://en.wikipedia.org/wiki/Pelvic_spur", "https://en.wikipedia.org/wiki/Pygopodidae", "https://en.wikipedia.org/wiki/Scelotes", "https://en.wikipedia.org/wiki/Toxicofera", "https://i.sstatic.net/V0INm7qt.png", "https://i.sstatic.net/c9jky6gY.png", "https://i.sstatic.net/v59rFPo7.png", "https://knowledge.carolina.com/discipline/life-science/ap-biology/how-snakes-lost-their-legs/", "https://www.amnh.org/exhibitions/darwin/evolution-today/how-do-we-know-living-things-are-related/vestigial-organs", "https://www.iflscience.com/new-species-of-dwarf-boa-with-remnants-of-a-pelvis-found-in-ecuadorian-amazon-66983", "https://www.science.org/content/article/how-did-snakes-lose-their-limbs-mass-genome-effort-provides-clues", "https://www.scientificamerican.com/article/how-snakes-lost-their-legs/", "https://www.wiley.com/en-us/Vertebrate+Palaeontology%2C+5th+Edition-p-9781394195091"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:02.598621+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/5d480e4bd1bd45ab525a4baf3227fba404f89b6af9dad33215fd9fa7c302a211_0.json", "raw_sha256": "d723c7a62c8386d143891d26ae30b2234242ed3dac9599b11f141712ea994a96", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=3&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Sharkey Malarkey", "question_author_url": "https://biology.stackexchange.com/users/104078/sharkey-malarkey", "question_author_user_type": "registered", "question_created_at": "2025-04-04T02:47:24+00:00", "question_html": "

I understand the why, but how did snakes lose legs completely? In most other cases they become very small but still there (whale back legs, fly secondary wings, kiwi wings, etc.) but they almost never lose them completely. So how did snakes complete this process beyond most other animals undergoing a similar loss of limbs?

\n

To those of you wondering why snakes lost limbs it’s because burrowing animals lose or reduce body parts, including limbs. Snakes just took this to the extreme and I’m wondering why they didn’t leave at least a little within their body in advanced snakes.

\n", "question_id": 116320, "question_license": "CC BY-SA 4.0", "question_score": 16, "question_text": "I understand the why, but how did snakes lose legs completely? In most other cases they become very small but still there (whale back legs, fly secondary wings, kiwi wings, etc.) but they almost never lose them completely. So how did snakes complete this process beyond most other animals undergoing a similar loss of limbs?\n\n\n\n\nTo those of you wondering why snakes lost limbs it’s because burrowing animals lose or reduce body parts, including limbs. Snakes just took this to the extreme and I’m wondering why they didn’t leave at least a little within their body in advanced snakes.", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Sharkey Malarkey", "profile_url": "https://biology.stackexchange.com/users/104078/sharkey-malarkey", "user_type": "registered"}, "created_at": "2025-04-04T02:47:24+00:00", "raw_file": "raw/codex_api_v1/2e46271dd42cc68e540cd93745d874445294455a8c8fc89effd7f36ed497eee4_1790824137680573300_0.json", "raw_sha256": "21274b3e65918ff952c3e3901f10b15b146be4d989ae74907eaed06f2a54ef5e", "revision_guid": "E0E9D430-777F-4885-81C5-B10B366559C1", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/E0E9D430-777F-4885-81C5-B10B366559C1/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "AliceD", "profile_url": "https://biology.stackexchange.com/users/9943/aliced", "user_type": "registered"}, "created_at": "2025-04-04T08:42:26+00:00", "raw_file": "raw/codex_api_v1/2e46271dd42cc68e540cd93745d874445294455a8c8fc89effd7f36ed497eee4_1790824137680573300_0.json", "raw_sha256": "21274b3e65918ff952c3e3901f10b15b146be4d989ae74907eaed06f2a54ef5e", "revision_guid": "1C451F88-A683-4602-8221-77F5350A7527", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/1C451F88-A683-4602-8221-77F5350A7527/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2025-04-04T10:59:59+00:00", "raw_file": "raw/codex_api_v1/2e46271dd42cc68e540cd93745d874445294455a8c8fc89effd7f36ed497eee4_1790824137680573300_0.json", "raw_sha256": "21274b3e65918ff952c3e3901f10b15b146be4d989ae74907eaed06f2a54ef5e", "revision_guid": "A20057E3-DFD1-4326-A584-6DB34CC5E90A", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://biology.stackexchange.com/revisions/A20057E3-DFD1-4326-A584-6DB34CC5E90A/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Sharkey Malarkey", "profile_url": "https://biology.stackexchange.com/users/104078/sharkey-malarkey", "user_type": "registered"}, "created_at": "2025-04-04T19:34:55+00:00", "raw_file": "raw/codex_api_v1/2e46271dd42cc68e540cd93745d874445294455a8c8fc89effd7f36ed497eee4_1790824137680573300_0.json", "raw_sha256": "21274b3e65918ff952c3e3901f10b15b146be4d989ae74907eaed06f2a54ef5e", "revision_guid": "ED703ED1-D87D-4E3D-A4ED-CA71F3153705", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/ED703ED1-D87D-4E3D-A4ED-CA71F3153705/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Sharkey Malarkey", "profile_url": "https://biology.stackexchange.com/users/104078/sharkey-malarkey", "user_type": "registered"}, "created_at": "2025-04-05T00:26:02+00:00", "raw_file": "raw/codex_api_v1/2e46271dd42cc68e540cd93745d874445294455a8c8fc89effd7f36ed497eee4_1790824137680573300_0.json", "raw_sha256": "21274b3e65918ff952c3e3901f10b15b146be4d989ae74907eaed06f2a54ef5e", "revision_guid": "2044315A-0623-4496-8958-0D0C6EF7905D", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/2044315A-0623-4496-8958-0D0C6EF7905D/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "D.W.", "profile_url": "https://biology.stackexchange.com/users/61455/d-w", "user_type": "registered"}, "created_at": "2025-04-20T04:20:20+00:00", "raw_file": "raw/codex_api_v1/00f792a35cd1fe53cc744b44d1c7f5a2081648f5d4403a4e8f1d570c00e5dc95_1790824135500262400_0.json", "raw_sha256": "0face46f22b53414ff8968bb035acf71d0f5c1f84da8d6f0813602f842802d98", "revision_guid": "262CB57A-8A0C-4BE3-87AD-4CB6823C7AA2", "revision_number": 5, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/262CB57A-8A0C-4BE3-87AD-4CB6823C7AA2/view-source"}], "source_site": "biology", "source_url": "https://biology.stackexchange.com/questions/116320/how-did-snakes-lose-their-legs", "split": "train", "split_group": "cddac663bf7650fa4bc4621621980778745a10576053385857f4249d42861a2d", "tags": ["evolution", "herpetology", "snake"], "thread_id": "biology:116320", "title": "How did snakes lose their legs?"}} {"accepted_status": [false, false], "candidate_answers": [{"answer_html": "

Yes, penetrance would "vary in a somewhat consistent way between heterozygous and homozygous genotypes". Some genes may usually show that (for a phenotype) one particular allele shows 0% penetrance in the heterozygous genotype and 100% (complete) penetrance in the homozygous genotype. Such an ideal allele would be called a Mendelian recessive allele. (Its partner in the heterozygous genotype would be the dominant allele; see Wikipedia.)

\n

Often, however, a particular genotype (whether it's a heterozygous or homozygous genotype that's of interest) will show partial penetrance, not either 0% or 100%. This is due to other factors, generally unknown, of environmental and/or genetic influence.

\n", "answer_id": 116078, "answer_text": "Yes, penetrance would \"vary in a somewhat consistent way between heterozygous and homozygous genotypes\". Some genes may usually show that (for a phenotype) one particular allele shows 0% penetrance in the heterozygous genotype and 100% (complete) penetrance in the homozygous genotype. Such an ideal allele would be called a Mendelian recessive allele. (Its partner in the heterozygous genotype would be the dominant allele; see Wikipedia (https://en.wikipedia.org/wiki/Dominance_(genetics)).)\n\n\n\n\nOften, however, a particular genotype (whether it's a heterozygous or homozygous genotype that's of interest) will show partial penetrance, not either 0% or 100%. This is due to other factors, generally unknown, of environmental and/or genetic influence.", "answer_url": "https://biology.stackexchange.com/a/116078", "author": "mgkrebbs", "author_url": "https://biology.stackexchange.com/users/231/mgkrebbs", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-02-09T00:01:51+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:24.022014+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/01aac796e48517b802ddadc0ad653c0cb9714bed9c7b63fe9d85feeb033045b4_0.json", "raw_sha256": "78b00075a5e7010b6a99b251890c500809ce80227f5b68d26c5fa522422bf915", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/116119;116113;116097;116096;116091;116087;116076;116067;116063;116059;116055;116037;116034;116028;116022;116012;116005;115997;115989;115988;115987;115979;115978;115976;115974;115973;115970;115966;115965;115957;115952;115939;115933;115932;115927;115921;115915;115903;115897;115894;115886;115885;115884;115881;115880;115868;115867;115857;115852;115840;115830;115825;115819;115815;115791;115780;115773;115764;115759;115756;115743;115736;115726;115723;115713;115699;115691;115689;115685;115678;115668;115664;115657;115650;115642;115639;115632;115627;115626;115609;115602;115598;115592;115588;115587;115580;115578;115570;115566;115562;115549;115537;115536;115531;115530;115528;115525;115521;115513;115510/answers?filter=withbody&order=asc&page=2&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 116076, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "mgkrebbs", "profile_url": "https://biology.stackexchange.com/users/231/mgkrebbs", "user_type": "registered"}, "created_at": "2025-02-09T00:01:51+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "78111C88-9E58-49E4-AD58-4BB1C9B67E1D", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/78111C88-9E58-49E4-AD58-4BB1C9B67E1D/view-source"}], "score": -1, "updated_at": "2025-02-09T00:01:51+00:00"}, {"answer_html": "

As you must be well aware, your genotype does not, in and of itself, determine your phenotype. Environmental effects and stochastic developmental processes can (and, in many cases, do) have a large effect on phenotype. This is one reason why penetrance exists. Your position is still coming from a place that genotype is the largest/most important factor contributing to phenotype, but that may not be the case.

\n

Say we had a fully dominant allele that gave you a 100% risk of alcoholism. Whether someone possesses one or two copies doesn't matter, if they have this allele they will become addicted to alcohol. If they never had access to alcohol, there is no way for this allele to act to make them an alcoholic. Penetrance would be independent of zygosity and the only deterministic factor for individuals carrying this allele would be the environment.

\n

In reality, life is more complicated than simple genotype-phenotype maps. It feels like you are trying to force genetic determinism into an area where it is clear that genetics don't necessarily determine phenotype.

\n", "answer_id": 116236, "answer_text": "As you must be well aware, your genotype does not, in and of itself, determine your phenotype. Environmental effects and stochastic developmental processes can (and, in many cases, do) have a large effect on phenotype. This is one reason why penetrance exists. Your position is still coming from a place that genotype is the largest/most important factor contributing to phenotype, but that may not be the case.\n\n\n\n\nSay we had a fully dominant allele that gave you a 100% risk of alcoholism. Whether someone possesses one or two copies doesn't matter, if they have this allele they will become addicted to alcohol. If they never had access to alcohol, there is no way for this allele to act to make them an alcoholic. Penetrance would be independent of zygosity and the only deterministic factor for individuals carrying this allele would be the environment.\n\n\n\n\nIn reality, life is more complicated than simple genotype-phenotype maps. It feels like you are trying to force genetic determinism into an area where it is clear that genetics don't necessarily determine phenotype.", "answer_url": "https://biology.stackexchange.com/a/116236", "author": "middle_author", "author_url": "https://biology.stackexchange.com/users/102914/middle-author", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-03-14T17:13:11+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:24.022014+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/01aac796e48517b802ddadc0ad653c0cb9714bed9c7b63fe9d85feeb033045b4_0.json", "raw_sha256": "78b00075a5e7010b6a99b251890c500809ce80227f5b68d26c5fa522422bf915", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/116119;116113;116097;116096;116091;116087;116076;116067;116063;116059;116055;116037;116034;116028;116022;116012;116005;115997;115989;115988;115987;115979;115978;115976;115974;115973;115970;115966;115965;115957;115952;115939;115933;115932;115927;115921;115915;115903;115897;115894;115886;115885;115884;115881;115880;115868;115867;115857;115852;115840;115830;115825;115819;115815;115791;115780;115773;115764;115759;115756;115743;115736;115726;115723;115713;115699;115691;115689;115685;115678;115668;115664;115657;115650;115642;115639;115632;115627;115626;115609;115602;115598;115592;115588;115587;115580;115578;115570;115566;115562;115549;115537;115536;115531;115530;115528;115525;115521;115513;115510/answers?filter=withbody&order=asc&page=2&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 116076, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "middle_author", "profile_url": "https://biology.stackexchange.com/users/102914/middle-author", "user_type": "registered"}, "created_at": "2025-03-14T17:13:11+00:00", "raw_file": "raw/codex_api_v1/d15f4865285273ae6317f3f3c349227e1b259d6015b55aa14ef5accac806b399_1790824130296338000_0.json", "raw_sha256": "611d5d0f66539d270d10e88493add03469f6e7c1f54b654a8efbaea5fbbc2960", "revision_guid": "CEF35FB1-2201-4A76-9A38-2D6F506B6FD8", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/CEF35FB1-2201-4A76-9A38-2D6F506B6FD8/view-source"}], "score": -1, "updated_at": "2025-03-14T17:13:11+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I'm doing some self-directed study in genetics and microbiology. For example, I've viewed most of the videos from the MIT OpenCourseWare series 7.01SC Fundamentals of Biology (https://www.youtube.com/playlist?list=PLF83B8D8C87426E44) by Eric Lander and others. I have also read twenty or so papers, from individuals (and groups) like Avery, Brenner, Bressan, Crick, Davenport, Fisher, Hall, Jackman, Loomis, Mackey, Mendel, Radick, Spiegelman, Watson, and Weeden.\n\n\n\n\nMy question stems from my trying to wrap my brain around the concept of penetrance. I find—for instance in a 2001 paper by Kurtz et al. in J. Neurogenet. (https://pubmed.ncbi.nlm.nih.gov/12092906/)—that \"penetrance is the percentage of animals of a specific genotype who express the phenotype associated with that underlying genotype\" (in contrast to expressivity, which is \"the degree that a particular genotype is expressed as a phenotype within an individual\"). So as I understand it, penetrance is analogous to the percentage of Americans who are Baltimore Orioles fans, whereas expressivity is analogous to the fervor of some particular American's dedication to and affection for the Orioles.\n\n\n\n\nFrom that (perhaps flawed) understanding, the question that arises is\n\n\n\n\n\n\n\nSince penetrance is a property of the set of all organisms with a particular genotype (and may thus be considered to be \"with respect to\" that genotype), wouldn't it vary in a somewhat consistent way between heterozygous and homozygous genotypes associated with a common phenotype?\n\n\n\n\n\n\n\nFrom my armchair intuition, I'd imagine the homozygous genotype to be reliably, I dunno, more compelling cause to express the phenotype in question than its heterozygous counterpart.", "record_id": "Scientific-Answer-Ranking:biology:116076", "scores": [-1, -1], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

Yes, penetrance would "vary in a somewhat consistent way between heterozygous and homozygous genotypes". Some genes may usually show that (for a phenotype) one particular allele shows 0% penetrance in the heterozygous genotype and 100% (complete) penetrance in the homozygous genotype. Such an ideal allele would be called a Mendelian recessive allele. (Its partner in the heterozygous genotype would be the dominant allele; see Wikipedia.)

\n

Often, however, a particular genotype (whether it's a heterozygous or homozygous genotype that's of interest) will show partial penetrance, not either 0% or 100%. This is due to other factors, generally unknown, of environmental and/or genetic influence.

\n", "answer_id": 116078, "answer_text": "Yes, penetrance would \"vary in a somewhat consistent way between heterozygous and homozygous genotypes\". Some genes may usually show that (for a phenotype) one particular allele shows 0% penetrance in the heterozygous genotype and 100% (complete) penetrance in the homozygous genotype. Such an ideal allele would be called a Mendelian recessive allele. (Its partner in the heterozygous genotype would be the dominant allele; see Wikipedia (https://en.wikipedia.org/wiki/Dominance_(genetics)).)\n\n\n\n\nOften, however, a particular genotype (whether it's a heterozygous or homozygous genotype that's of interest) will show partial penetrance, not either 0% or 100%. This is due to other factors, generally unknown, of environmental and/or genetic influence.", "answer_url": "https://biology.stackexchange.com/a/116078", "author": "mgkrebbs", "author_url": "https://biology.stackexchange.com/users/231/mgkrebbs", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-02-09T00:01:51+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:24.022014+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/01aac796e48517b802ddadc0ad653c0cb9714bed9c7b63fe9d85feeb033045b4_0.json", "raw_sha256": "78b00075a5e7010b6a99b251890c500809ce80227f5b68d26c5fa522422bf915", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/116119;116113;116097;116096;116091;116087;116076;116067;116063;116059;116055;116037;116034;116028;116022;116012;116005;115997;115989;115988;115987;115979;115978;115976;115974;115973;115970;115966;115965;115957;115952;115939;115933;115932;115927;115921;115915;115903;115897;115894;115886;115885;115884;115881;115880;115868;115867;115857;115852;115840;115830;115825;115819;115815;115791;115780;115773;115764;115759;115756;115743;115736;115726;115723;115713;115699;115691;115689;115685;115678;115668;115664;115657;115650;115642;115639;115632;115627;115626;115609;115602;115598;115592;115588;115587;115580;115578;115570;115566;115562;115549;115537;115536;115531;115530;115528;115525;115521;115513;115510/answers?filter=withbody&order=asc&page=2&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 116076, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "mgkrebbs", "profile_url": "https://biology.stackexchange.com/users/231/mgkrebbs", "user_type": "registered"}, "created_at": "2025-02-09T00:01:51+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "78111C88-9E58-49E4-AD58-4BB1C9B67E1D", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/78111C88-9E58-49E4-AD58-4BB1C9B67E1D/view-source"}], "score": -1, "updated_at": "2025-02-09T00:01:51+00:00"}, {"answer_html": "

As you must be well aware, your genotype does not, in and of itself, determine your phenotype. Environmental effects and stochastic developmental processes can (and, in many cases, do) have a large effect on phenotype. This is one reason why penetrance exists. Your position is still coming from a place that genotype is the largest/most important factor contributing to phenotype, but that may not be the case.

\n

Say we had a fully dominant allele that gave you a 100% risk of alcoholism. Whether someone possesses one or two copies doesn't matter, if they have this allele they will become addicted to alcohol. If they never had access to alcohol, there is no way for this allele to act to make them an alcoholic. Penetrance would be independent of zygosity and the only deterministic factor for individuals carrying this allele would be the environment.

\n

In reality, life is more complicated than simple genotype-phenotype maps. It feels like you are trying to force genetic determinism into an area where it is clear that genetics don't necessarily determine phenotype.

\n", "answer_id": 116236, "answer_text": "As you must be well aware, your genotype does not, in and of itself, determine your phenotype. Environmental effects and stochastic developmental processes can (and, in many cases, do) have a large effect on phenotype. This is one reason why penetrance exists. Your position is still coming from a place that genotype is the largest/most important factor contributing to phenotype, but that may not be the case.\n\n\n\n\nSay we had a fully dominant allele that gave you a 100% risk of alcoholism. Whether someone possesses one or two copies doesn't matter, if they have this allele they will become addicted to alcohol. If they never had access to alcohol, there is no way for this allele to act to make them an alcoholic. Penetrance would be independent of zygosity and the only deterministic factor for individuals carrying this allele would be the environment.\n\n\n\n\nIn reality, life is more complicated than simple genotype-phenotype maps. It feels like you are trying to force genetic determinism into an area where it is clear that genetics don't necessarily determine phenotype.", "answer_url": "https://biology.stackexchange.com/a/116236", "author": "middle_author", "author_url": "https://biology.stackexchange.com/users/102914/middle-author", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-03-14T17:13:11+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:24.022014+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/01aac796e48517b802ddadc0ad653c0cb9714bed9c7b63fe9d85feeb033045b4_0.json", "raw_sha256": "78b00075a5e7010b6a99b251890c500809ce80227f5b68d26c5fa522422bf915", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/116119;116113;116097;116096;116091;116087;116076;116067;116063;116059;116055;116037;116034;116028;116022;116012;116005;115997;115989;115988;115987;115979;115978;115976;115974;115973;115970;115966;115965;115957;115952;115939;115933;115932;115927;115921;115915;115903;115897;115894;115886;115885;115884;115881;115880;115868;115867;115857;115852;115840;115830;115825;115819;115815;115791;115780;115773;115764;115759;115756;115743;115736;115726;115723;115713;115699;115691;115689;115685;115678;115668;115664;115657;115650;115642;115639;115632;115627;115626;115609;115602;115598;115592;115588;115587;115580;115578;115570;115566;115562;115549;115537;115536;115531;115530;115528;115525;115521;115513;115510/answers?filter=withbody&order=asc&page=2&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 116076, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "middle_author", "profile_url": "https://biology.stackexchange.com/users/102914/middle-author", "user_type": "registered"}, "created_at": "2025-03-14T17:13:11+00:00", "raw_file": "raw/codex_api_v1/d15f4865285273ae6317f3f3c349227e1b259d6015b55aa14ef5accac806b399_1790824130296338000_0.json", "raw_sha256": "611d5d0f66539d270d10e88493add03469f6e7c1f54b654a8efbaea5fbbc2960", "revision_guid": "CEF35FB1-2201-4A76-9A38-2D6F506B6FD8", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/CEF35FB1-2201-4A76-9A38-2D6F506B6FD8/view-source"}], "score": -1, "updated_at": "2025-03-14T17:13:11+00:00"}], "domain": "biology", "external_links": ["https://en.wikipedia.org/wiki/Dominance_(genetics", "https://pubmed.ncbi.nlm.nih.gov/12092906/", "https://www.youtube.com/playlist?list=PLF83B8D8C87426E44"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:04.377249+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/54ece81cba3a5a552bb15d6d3feedc4324a2ba2706d33480080ece9537efd4b1_0.json", "raw_sha256": "f1eb8f7eda9336b81701b663029f9411e040c0bcf262148b7ede9a103ae73e69", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=4&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Paul Tanenbaum", "question_author_url": "https://biology.stackexchange.com/users/59614/paul-tanenbaum", "question_author_user_type": "registered", "question_created_at": "2025-02-08T16:50:03+00:00", "question_html": "

I'm doing some self-directed study in genetics and microbiology. For example, I've viewed most of the videos from the MIT OpenCourseWare series 7.01SC Fundamentals of Biology by Eric Lander and others. I have also read twenty or so papers, from individuals (and groups) like Avery, Brenner, Bressan, Crick, Davenport, Fisher, Hall, Jackman, Loomis, Mackey, Mendel, Radick, Spiegelman, Watson, and Weeden.

\n

My question stems from my trying to wrap my brain around the concept of penetrance. I find—for instance in a 2001 paper by Kurtz et al. in J. Neurogenet.—that "penetrance is the percentage of animals of a specific genotype who express the phenotype associated with that underlying genotype" (in contrast to expressivity, which is "the degree that a particular genotype is expressed as a phenotype within an individual"). So as I understand it, penetrance is analogous to the percentage of Americans who are Baltimore Orioles fans, whereas expressivity is analogous to the fervor of some particular American's dedication to and affection for the Orioles.

\n

From that (perhaps flawed) understanding, the question that arises is

\n
\n

Since penetrance is a property of the set of all organisms with a particular genotype (and may thus be considered to be "with respect to" that genotype), wouldn't it vary in a somewhat consistent way between heterozygous and homozygous genotypes associated with a common phenotype?

\n
\n

From my armchair intuition, I'd imagine the homozygous genotype to be reliably, I dunno, more compelling cause to express the phenotype in question than its heterozygous counterpart.

\n", "question_id": 116076, "question_license": "CC BY-SA 4.0", "question_score": 2, "question_text": "I'm doing some self-directed study in genetics and microbiology. For example, I've viewed most of the videos from the MIT OpenCourseWare series 7.01SC Fundamentals of Biology (https://www.youtube.com/playlist?list=PLF83B8D8C87426E44) by Eric Lander and others. I have also read twenty or so papers, from individuals (and groups) like Avery, Brenner, Bressan, Crick, Davenport, Fisher, Hall, Jackman, Loomis, Mackey, Mendel, Radick, Spiegelman, Watson, and Weeden.\n\n\n\n\nMy question stems from my trying to wrap my brain around the concept of penetrance. I find—for instance in a 2001 paper by Kurtz et al. in J. Neurogenet. (https://pubmed.ncbi.nlm.nih.gov/12092906/)—that \"penetrance is the percentage of animals of a specific genotype who express the phenotype associated with that underlying genotype\" (in contrast to expressivity, which is \"the degree that a particular genotype is expressed as a phenotype within an individual\"). So as I understand it, penetrance is analogous to the percentage of Americans who are Baltimore Orioles fans, whereas expressivity is analogous to the fervor of some particular American's dedication to and affection for the Orioles.\n\n\n\n\nFrom that (perhaps flawed) understanding, the question that arises is\n\n\n\n\n\n\n\nSince penetrance is a property of the set of all organisms with a particular genotype (and may thus be considered to be \"with respect to\" that genotype), wouldn't it vary in a somewhat consistent way between heterozygous and homozygous genotypes associated with a common phenotype?\n\n\n\n\n\n\n\nFrom my armchair intuition, I'd imagine the homozygous genotype to be reliably, I dunno, more compelling cause to express the phenotype in question than its heterozygous counterpart.", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Paul Tanenbaum", "profile_url": "https://biology.stackexchange.com/users/59614/paul-tanenbaum", "user_type": "registered"}, "created_at": "2025-02-08T16:50:03+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "84DF8D02-9048-42AD-A11A-66A4E91C3ED8", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/84DF8D02-9048-42AD-A11A-66A4E91C3ED8/view-source"}], "source_site": "biology", "source_url": "https://biology.stackexchange.com/questions/116076/does-penetrance-depend-in-a-regular-way-on-zygosity", "split": "train", "split_group": "4e8abc112ffe3a727eb056de3e9cdb6879ff6ebf01b2936dffc355da908f9d28", "tags": ["genetics", "gene-expression"], "thread_id": "biology:116076", "title": "Does penetrance depend in a regular way on zygosity?"}} {"accepted_status": [true, false], "candidate_answers": [{"answer_html": "

It's a tricky query to answer, so here's some prelim info and someone can be more specific from there:

\n

Apocrine glands are a type of sweat gland found in certain mammals, including humans. These glands are responsible for producing a thick, odorous sweat that is involved in various physiological and social functions. Here are some key characteristics and functions of apocrine glands:

\n

Location:

\n

Apocrine glands are typically found in specific areas of the body, such as the armpits (axillae), genital region, and around the nipples in humans. In other mammals, they may be located in different regions depending on the species.

\n

Odorous Secretion:

\n

Unlike eccrine glands, which produce a watery and odorless sweat, apocrine glands secrete a thicker sweat that contains proteins, lipids, and other compounds. When this sweat comes into contact with bacteria on the skin's surface, it can lead to body odor.

\n

Activation:

\n

Apocrine glands are activated during emotional arousal, stress, and sexual activity. The sympathetic nervous system controls their secretion, and hormonal factors can also influence their activity.

\n

Scent Communication:

\n

One of the primary functions of apocrine glands in mammals is scent communication. The odorous sweat they produce contains unique chemical compounds that can convey information about an individual's identity, reproductive status, and social position to other members of the species. This is particularly important in social species where scent marking and recognition play a crucial role in group dynamics and hierarchies.

\n

Sexual Signaling:

\n

In some species, apocrine gland secretions may play a role in sexual attraction and mate selection. The distinct scents emitted by individuals can serve as cues for potential mates to assess each other's fitness and genetic compatibility.

\n

Developmental Timing:

\n

Apocrine glands are not fully functional until puberty in humans. Their activation and development are influenced by hormonal changes during adolescence.

\n

Associated with Hair Follicles:

\n

Apocrine glands are associated with hair follicles, and their ducts open into the hair follicle canal. This is in contrast to eccrine glands, which release sweat directly onto the skin's surface.

\n

Here's a ref from nature stating that human primates may use sweat pheromones to communicate:\nhttps://www.nature.com/articles/npre.2008.2561.1.pdf

\n

Primates, especially those living in social groups, rely heavily on communication to maintain social bonds, establish hierarchies, and coordinate group activities. Scent plays a crucial role in primate communication, and sweat scent could have evolved as a means for individuals to convey information about their identity, reproductive status, and emotional state to other members of their group.

\n

mate selection in primates can be influenced by olfactory cues. Scent signals emitted through sweat may allow potential mates to assess each other's genetic compatibility, overall health, and reproductive fitness.

\n

the scent-marking behavior using secretions from sweat glands may serve as a way to establish territorial boundaries and prevent conflicts with neighboring groups.

\n

The odor produced by sweat may play a role in avoiding predators. For example, certain primate species may produce alarm pheromones through their sweat, signaling danger to other group members.

\n

Sweat scent in primates could be a remnant of their ancestral heritage, where scent communication was crucial for survival and reproduction.

\n

incidentally, horses, dogs, deer, they also have strong pheromones.

\n", "answer_id": 112702, "answer_text": "It's a tricky query to answer, so here's some prelim info and someone can be more specific from there:\n\n\n\n\nApocrine glands are a type of sweat gland found in certain mammals, including humans. These glands are responsible for producing a thick, odorous sweat that is involved in various physiological and social functions. Here are some key characteristics and functions of apocrine glands:\n\n\n\n\nLocation:\n\n\n\n\nApocrine glands are typically found in specific areas of the body, such as the armpits (axillae), genital region, and around the nipples in humans. In other mammals, they may be located in different regions depending on the species.\n\n\n\n\nOdorous Secretion:\n\n\n\n\nUnlike eccrine glands, which produce a watery and odorless sweat, apocrine glands secrete a thicker sweat that contains proteins, lipids, and other compounds. When this sweat comes into contact with bacteria on the skin's surface, it can lead to body odor.\n\n\n\n\nActivation:\n\n\n\n\nApocrine glands are activated during emotional arousal, stress, and sexual activity. The sympathetic nervous system controls their secretion, and hormonal factors can also influence their activity.\n\n\n\n\nScent Communication:\n\n\n\n\nOne of the primary functions of apocrine glands in mammals is scent communication. The odorous sweat they produce contains unique chemical compounds that can convey information about an individual's identity, reproductive status, and social position to other members of the species. This is particularly important in social species where scent marking and recognition play a crucial role in group dynamics and hierarchies.\n\n\n\n\nSexual Signaling:\n\n\n\n\nIn some species, apocrine gland secretions may play a role in sexual attraction and mate selection. The distinct scents emitted by individuals can serve as cues for potential mates to assess each other's fitness and genetic compatibility.\n\n\n\n\nDevelopmental Timing:\n\n\n\n\nApocrine glands are not fully functional until puberty in humans. Their activation and development are influenced by hormonal changes during adolescence.\n\n\n\n\nAssociated with Hair Follicles:\n\n\n\n\nApocrine glands are associated with hair follicles, and their ducts open into the hair follicle canal. This is in contrast to eccrine glands, which release sweat directly onto the skin's surface.\n\n\n\n\nHere's a ref from nature stating that human primates may use sweat pheromones to communicate:\nhttps://www.nature.com/articles/npre.2008.2561.1.pdf (https://www.nature.com/articles/npre.2008.2561.1.pdf)\n\n\n\n\nPrimates, especially those living in social groups, rely heavily on communication to maintain social bonds, establish hierarchies, and coordinate group activities. Scent plays a crucial role in primate communication, and sweat scent could have evolved as a means for individuals to convey information about their identity, reproductive status, and emotional state to other members of their group.\n\n\n\n\nmate selection in primates can be influenced by olfactory cues. Scent signals emitted through sweat may allow potential mates to assess each other's genetic compatibility, overall health, and reproductive fitness.\n\n\n\n\nthe scent-marking behavior using secretions from sweat glands may serve as a way to establish territorial boundaries and prevent conflicts with neighboring groups.\n\n\n\n\nThe odor produced by sweat may play a role in avoiding predators. For example, certain primate species may produce alarm pheromones through their sweat, signaling danger to other group members.\n\n\n\n\nSweat scent in primates could be a remnant of their ancestral heritage, where scent communication was crucial for survival and reproduction.\n\n\n\n\nincidentally, horses, dogs, deer, they also have strong pheromones.", "answer_url": "https://biology.stackexchange.com/a/112702", "author": "bandybabboon", "author_url": "https://biology.stackexchange.com/users/8952/bandybabboon", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2023-07-31T11:48:43+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:38.885561+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/a145de97eabc007745b45919875489a41261075cbdf33d916d9640ba4ad0bd35_0.json", "raw_sha256": "e7d8d4315eef8e039a452d2811869cbe305575c6ff8a6bef8f80d6dfb58c5bfd", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/112982;112980;112979;112977;112972;112967;112962;112956;112952;112948;112941;112938;112937;112936;112927;112925;112923;112919;112909;112905;112904;112898;112895;112893;112884;112881;112880;112879;112873;112872;112870;112869;112867;112850;112849;112848;112841;112835;112831;112824;112818;112811;112808;112807;112790;112789;112785;112777;112773;112770;112762;112759;112757;112756;112746;112739;112738;112737;112731;112705;112703;112700;112699;112698;112693;112691;112687;112685;112677;112671;112667;112663;112659;112653;112647;112646;112645;112636;112625;112621;112615;112614;112613;112610;112598;112593;112592;112586;112580;112575;112574;112564;112558;112552;112550;112549;112544;112539;112535;112531/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 112700, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "bandybabboon", "profile_url": "https://biology.stackexchange.com/users/8952/bandybabboon", "user_type": "registered"}, "created_at": "2023-07-31T11:48:43+00:00", "raw_file": "raw/codex_api_v1/a04a0f8b9b816f605414240c86ef0796529040fa885a4b1183bd818d12b64e65_0.json", "raw_sha256": "630e8bf25473aeb8900409dec408d29d2bdc2011bc3b72f26995c17452a2c689", "revision_guid": "436A5135-596D-4167-AF99-CFB22B99EA41", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/436A5135-596D-4167-AF99-CFB22B99EA41/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "bandybabboon", "profile_url": "https://biology.stackexchange.com/users/8952/bandybabboon", "user_type": "registered"}, "created_at": "2023-07-31T13:59:28+00:00", "raw_file": "raw/codex_api_v1/a04a0f8b9b816f605414240c86ef0796529040fa885a4b1183bd818d12b64e65_0.json", "raw_sha256": "630e8bf25473aeb8900409dec408d29d2bdc2011bc3b72f26995c17452a2c689", "revision_guid": "CAA85B42-ED40-4DC1-853E-84F58F8E5E44", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/CAA85B42-ED40-4DC1-853E-84F58F8E5E44/view-source"}], "score": 2, "updated_at": "2023-07-31T13:59:28+00:00"}, {"answer_html": "

To elaborate slightly on the existing answer in which mention is made of 'genetic compatibility', there are many compelling studies which indicate a strong preference for dissimilarity in class 1 HLA alleles between human mating partners, and that this dissimilarity is readily detectable in the body odour of respective individuals. The link below 1 is to one such study; and the following paragraph is its abstract.

\n
\n

The major histocompatibility complex (MHC, called HLA in humans) is an important genetic component of the immune system. Fish, birds and mammals prefer mates with different genetic MHC code compared to their own, which they determine using olfactory cues. This preference increases the chances of high MHC variety in the offspring, leading to enhanced resilience against a variety of pathogens. Humans are also able to discriminate HLA related olfactory stimuli, however, it is debated whether this mechanism is of behavioural relevance. We show on a large sample (N = 508), with high-resolution typing of HLA class I/II, that HLA dissimilarity correlates with partnership, sexuality and enhances the desire to procreate. We conclude that HLA mediates mate behaviour in humans.

\n
\n

Interestingly, there are also allied studies which demonstrate that the use of oral contraceptive hormones disrupts this sensitivity, and one such example is cited by the study linked.

\n

There is clearly a heuristic argument that this dissimilarity favours a broader range of immunological memory in any viable offspring; and this hypothesis is explored in the 'Wikipedia' articles on 'Major Histocompatibility Complex' and its subsidiaries on 'sexual selection'.

\n

To address the comment inquiring upon a causative basis for this phenomenon in the relation between MHC or HLA type and body odour, the latter section of that 'Wikipedia' article makes the following observation and cites the relevant study.

\n
\n

MHC may be related to mate choice in some human populations, a theory that found support by studies by Ober and colleagues in 1997, as well as by Chaix and colleagues in 2008. However, the latter findings have been controversial. If it exists, the phenomenon might be mediated by olfaction, as MHC phenotype appears strongly involved in the strength and pleasantness of perceived odour of compounds from sweat. Fatty acid esters—such as methyl undecanoate, methyl decanoate, methyl nonanoate, methyl octanoate, and methyl hexanoate—show strong connection to MHC.2

\n
\n

I might add here that perhaps the most consequential determination of these sorts of studies is the finding that hormonal contraceptives such as the OC pill effectively inhibit any olfactory sensitivity to this potentially important dissimilarity in HLA type.

\n

Consider for example the implications of less than optimal breeding matches arising under the influence of these hormones and of this manipulation of female fertility on a massive scale, the persistence of which culture in the face of such evidence -- arguably in order merely to sustain the putative bodily autonomy of women in the illusory form of a simple pill -- defies reason. Common sense alone informs us that practices of this kind invite sociological and even biological calamity.

\n

Influence of HLA on human partnership and sexual satisfaction

\n

Infuence of MHC on odour perception of 43 chemicals and body odour

\n", "answer_id": 112726, "answer_text": "To elaborate slightly on the existing answer in which mention is made of 'genetic compatibility', there are many compelling studies which indicate a strong preference for dissimilarity in class 1 HLA alleles between human mating partners, and that this dissimilarity is readily detectable in the body odour of respective individuals. The link below 1 (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5006172/) is to one such study; and the following paragraph is its abstract.\n\n\n\n\n\n\n\nThe major histocompatibility complex (MHC, called HLA in humans) is an important genetic component of the immune system. Fish, birds and mammals prefer mates with different genetic MHC code compared to their own, which they determine using olfactory cues. This preference increases the chances of high MHC variety in the offspring, leading to enhanced resilience against a variety of pathogens. Humans are also able to discriminate HLA related olfactory stimuli, however, it is debated whether this mechanism is of behavioural relevance. We show on a large sample (N = 508), with high-resolution typing of HLA class I/II, that HLA dissimilarity correlates with partnership, sexuality and enhances the desire to procreate. We conclude that HLA mediates mate behaviour in humans.\n\n\n\n\n\n\n\nInterestingly, there are also allied studies which demonstrate that the use of oral contraceptive hormones disrupts this sensitivity, and one such example is cited by the study linked.\n\n\n\n\nThere is clearly a heuristic argument that this dissimilarity favours a broader range of immunological memory in any viable offspring; and this hypothesis is explored in the 'Wikipedia' articles on 'Major Histocompatibility Complex' and its subsidiaries on 'sexual selection'.\n\n\n\n\nTo address the comment inquiring upon a causative basis for this phenomenon in the relation between MHC or HLA type and body odour, the latter section of that 'Wikipedia' article makes the following observation and cites the relevant study.\n\n\n\n\n\n\n\nMHC may be related to mate choice in some human populations, a theory that found support by studies by Ober and colleagues in 1997, as well as by Chaix and colleagues in 2008. However, the latter findings have been controversial. If it exists, the phenomenon might be mediated by olfaction, as MHC phenotype appears strongly involved in the strength and pleasantness of perceived odour of compounds from sweat. Fatty acid esters—such as methyl undecanoate, methyl decanoate, methyl nonanoate, methyl octanoate, and methyl hexanoate—show strong connection to MHC.2 (https://www.degruyter.com/document/doi/10.2478/s11535-010-0020-6/html)\n\n\n\n\n\n\n\nI might add here that perhaps the most consequential determination of these sorts of studies is the finding that hormonal contraceptives such as the OC pill effectively inhibit any olfactory sensitivity to this potentially important dissimilarity in HLA type.\n\n\n\n\nConsider for example the implications of less than optimal breeding matches arising under the influence of these hormones and of this manipulation of female fertility on a massive scale, the persistence of which culture in the face of such evidence -- arguably in order merely to sustain the putative bodily autonomy of women in the illusory form of a simple pill -- defies reason. Common sense alone informs us that practices of this kind invite sociological and even biological calamity.\n\n\n\n\nInfluence of HLA on human partnership and sexual satisfaction (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5006172/)\n\n\n\n\nInfuence of MHC on odour perception of 43 chemicals and body odour (https://www.degruyter.com/document/doi/10.2478/s11535-010-0020-6/html)", "answer_url": "https://biology.stackexchange.com/a/112726", "author": "jeremiah", "author_url": "https://biology.stackexchange.com/users/37891/jeremiah", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2023-08-04T00:20:54+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:38.885561+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/a145de97eabc007745b45919875489a41261075cbdf33d916d9640ba4ad0bd35_0.json", "raw_sha256": "e7d8d4315eef8e039a452d2811869cbe305575c6ff8a6bef8f80d6dfb58c5bfd", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/112982;112980;112979;112977;112972;112967;112962;112956;112952;112948;112941;112938;112937;112936;112927;112925;112923;112919;112909;112905;112904;112898;112895;112893;112884;112881;112880;112879;112873;112872;112870;112869;112867;112850;112849;112848;112841;112835;112831;112824;112818;112811;112808;112807;112790;112789;112785;112777;112773;112770;112762;112759;112757;112756;112746;112739;112738;112737;112731;112705;112703;112700;112699;112698;112693;112691;112687;112685;112677;112671;112667;112663;112659;112653;112647;112646;112645;112636;112625;112621;112615;112614;112613;112610;112598;112593;112592;112586;112580;112575;112574;112564;112558;112552;112550;112549;112544;112539;112535;112531/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 112700, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jeremiah", "profile_url": "https://biology.stackexchange.com/users/37891/jeremiah", "user_type": "registered"}, "created_at": "2023-08-04T00:20:54+00:00", "raw_file": "raw/codex_api_v1/a04a0f8b9b816f605414240c86ef0796529040fa885a4b1183bd818d12b64e65_0.json", "raw_sha256": "630e8bf25473aeb8900409dec408d29d2bdc2011bc3b72f26995c17452a2c689", "revision_guid": "42FA50E0-186F-4A06-89C2-FEDD6B89651A", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/42FA50E0-186F-4A06-89C2-FEDD6B89651A/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jeremiah", "profile_url": "https://biology.stackexchange.com/users/37891/jeremiah", "user_type": "registered"}, "created_at": "2023-08-04T00:28:00+00:00", "raw_file": "raw/codex_api_v1/a04a0f8b9b816f605414240c86ef0796529040fa885a4b1183bd818d12b64e65_0.json", "raw_sha256": "630e8bf25473aeb8900409dec408d29d2bdc2011bc3b72f26995c17452a2c689", "revision_guid": "630363A5-D596-48FA-810A-2A261C7C86FD", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/630363A5-D596-48FA-810A-2A261C7C86FD/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jeremiah", "profile_url": "https://biology.stackexchange.com/users/37891/jeremiah", "user_type": "registered"}, "created_at": "2023-08-04T23:28:30+00:00", "raw_file": "raw/codex_api_v1/a04a0f8b9b816f605414240c86ef0796529040fa885a4b1183bd818d12b64e65_0.json", "raw_sha256": "630e8bf25473aeb8900409dec408d29d2bdc2011bc3b72f26995c17452a2c689", "revision_guid": "47CB6610-62AE-445D-8153-123E2B82A9C0", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/47CB6610-62AE-445D-8153-123E2B82A9C0/view-source"}], "score": 1, "updated_at": "2023-08-04T23:28:30+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I remember one, sweltering day in Malaysia, I was climbing the very long staircase to a Buddha statue in a cave, when I suddenly felt enveloped in an overpowering smell of sweat. My first thought was that I must have forgot to wash, possibly for several weeks, but then I realised that I was in the middle of a troupe of monkeys.\n\n\n\n\nAnd now I've come to wonder what the function is of this very characteristic smell. There seems to be connection to sexual maturity, since children don't start producing the smell until puberty, and the overwhelming base of evidence I collected that day, seems to suggest that this may be universal among primates.\n\n\n\n\nHas any research been done into the function smell of sweat, socially or otherwise?", "record_id": "Scientific-Answer-Ranking:biology:112700", "scores": [2, 1], "split": "train", "thread": {"accepted_answer_id": 112702, "answers": [{"answer_html": "

It's a tricky query to answer, so here's some prelim info and someone can be more specific from there:

\n

Apocrine glands are a type of sweat gland found in certain mammals, including humans. These glands are responsible for producing a thick, odorous sweat that is involved in various physiological and social functions. Here are some key characteristics and functions of apocrine glands:

\n

Location:

\n

Apocrine glands are typically found in specific areas of the body, such as the armpits (axillae), genital region, and around the nipples in humans. In other mammals, they may be located in different regions depending on the species.

\n

Odorous Secretion:

\n

Unlike eccrine glands, which produce a watery and odorless sweat, apocrine glands secrete a thicker sweat that contains proteins, lipids, and other compounds. When this sweat comes into contact with bacteria on the skin's surface, it can lead to body odor.

\n

Activation:

\n

Apocrine glands are activated during emotional arousal, stress, and sexual activity. The sympathetic nervous system controls their secretion, and hormonal factors can also influence their activity.

\n

Scent Communication:

\n

One of the primary functions of apocrine glands in mammals is scent communication. The odorous sweat they produce contains unique chemical compounds that can convey information about an individual's identity, reproductive status, and social position to other members of the species. This is particularly important in social species where scent marking and recognition play a crucial role in group dynamics and hierarchies.

\n

Sexual Signaling:

\n

In some species, apocrine gland secretions may play a role in sexual attraction and mate selection. The distinct scents emitted by individuals can serve as cues for potential mates to assess each other's fitness and genetic compatibility.

\n

Developmental Timing:

\n

Apocrine glands are not fully functional until puberty in humans. Their activation and development are influenced by hormonal changes during adolescence.

\n

Associated with Hair Follicles:

\n

Apocrine glands are associated with hair follicles, and their ducts open into the hair follicle canal. This is in contrast to eccrine glands, which release sweat directly onto the skin's surface.

\n

Here's a ref from nature stating that human primates may use sweat pheromones to communicate:\nhttps://www.nature.com/articles/npre.2008.2561.1.pdf

\n

Primates, especially those living in social groups, rely heavily on communication to maintain social bonds, establish hierarchies, and coordinate group activities. Scent plays a crucial role in primate communication, and sweat scent could have evolved as a means for individuals to convey information about their identity, reproductive status, and emotional state to other members of their group.

\n

mate selection in primates can be influenced by olfactory cues. Scent signals emitted through sweat may allow potential mates to assess each other's genetic compatibility, overall health, and reproductive fitness.

\n

the scent-marking behavior using secretions from sweat glands may serve as a way to establish territorial boundaries and prevent conflicts with neighboring groups.

\n

The odor produced by sweat may play a role in avoiding predators. For example, certain primate species may produce alarm pheromones through their sweat, signaling danger to other group members.

\n

Sweat scent in primates could be a remnant of their ancestral heritage, where scent communication was crucial for survival and reproduction.

\n

incidentally, horses, dogs, deer, they also have strong pheromones.

\n", "answer_id": 112702, "answer_text": "It's a tricky query to answer, so here's some prelim info and someone can be more specific from there:\n\n\n\n\nApocrine glands are a type of sweat gland found in certain mammals, including humans. These glands are responsible for producing a thick, odorous sweat that is involved in various physiological and social functions. Here are some key characteristics and functions of apocrine glands:\n\n\n\n\nLocation:\n\n\n\n\nApocrine glands are typically found in specific areas of the body, such as the armpits (axillae), genital region, and around the nipples in humans. In other mammals, they may be located in different regions depending on the species.\n\n\n\n\nOdorous Secretion:\n\n\n\n\nUnlike eccrine glands, which produce a watery and odorless sweat, apocrine glands secrete a thicker sweat that contains proteins, lipids, and other compounds. When this sweat comes into contact with bacteria on the skin's surface, it can lead to body odor.\n\n\n\n\nActivation:\n\n\n\n\nApocrine glands are activated during emotional arousal, stress, and sexual activity. The sympathetic nervous system controls their secretion, and hormonal factors can also influence their activity.\n\n\n\n\nScent Communication:\n\n\n\n\nOne of the primary functions of apocrine glands in mammals is scent communication. The odorous sweat they produce contains unique chemical compounds that can convey information about an individual's identity, reproductive status, and social position to other members of the species. This is particularly important in social species where scent marking and recognition play a crucial role in group dynamics and hierarchies.\n\n\n\n\nSexual Signaling:\n\n\n\n\nIn some species, apocrine gland secretions may play a role in sexual attraction and mate selection. The distinct scents emitted by individuals can serve as cues for potential mates to assess each other's fitness and genetic compatibility.\n\n\n\n\nDevelopmental Timing:\n\n\n\n\nApocrine glands are not fully functional until puberty in humans. Their activation and development are influenced by hormonal changes during adolescence.\n\n\n\n\nAssociated with Hair Follicles:\n\n\n\n\nApocrine glands are associated with hair follicles, and their ducts open into the hair follicle canal. This is in contrast to eccrine glands, which release sweat directly onto the skin's surface.\n\n\n\n\nHere's a ref from nature stating that human primates may use sweat pheromones to communicate:\nhttps://www.nature.com/articles/npre.2008.2561.1.pdf (https://www.nature.com/articles/npre.2008.2561.1.pdf)\n\n\n\n\nPrimates, especially those living in social groups, rely heavily on communication to maintain social bonds, establish hierarchies, and coordinate group activities. Scent plays a crucial role in primate communication, and sweat scent could have evolved as a means for individuals to convey information about their identity, reproductive status, and emotional state to other members of their group.\n\n\n\n\nmate selection in primates can be influenced by olfactory cues. Scent signals emitted through sweat may allow potential mates to assess each other's genetic compatibility, overall health, and reproductive fitness.\n\n\n\n\nthe scent-marking behavior using secretions from sweat glands may serve as a way to establish territorial boundaries and prevent conflicts with neighboring groups.\n\n\n\n\nThe odor produced by sweat may play a role in avoiding predators. For example, certain primate species may produce alarm pheromones through their sweat, signaling danger to other group members.\n\n\n\n\nSweat scent in primates could be a remnant of their ancestral heritage, where scent communication was crucial for survival and reproduction.\n\n\n\n\nincidentally, horses, dogs, deer, they also have strong pheromones.", "answer_url": "https://biology.stackexchange.com/a/112702", "author": "bandybabboon", "author_url": "https://biology.stackexchange.com/users/8952/bandybabboon", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2023-07-31T11:48:43+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:38.885561+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/a145de97eabc007745b45919875489a41261075cbdf33d916d9640ba4ad0bd35_0.json", "raw_sha256": "e7d8d4315eef8e039a452d2811869cbe305575c6ff8a6bef8f80d6dfb58c5bfd", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/112982;112980;112979;112977;112972;112967;112962;112956;112952;112948;112941;112938;112937;112936;112927;112925;112923;112919;112909;112905;112904;112898;112895;112893;112884;112881;112880;112879;112873;112872;112870;112869;112867;112850;112849;112848;112841;112835;112831;112824;112818;112811;112808;112807;112790;112789;112785;112777;112773;112770;112762;112759;112757;112756;112746;112739;112738;112737;112731;112705;112703;112700;112699;112698;112693;112691;112687;112685;112677;112671;112667;112663;112659;112653;112647;112646;112645;112636;112625;112621;112615;112614;112613;112610;112598;112593;112592;112586;112580;112575;112574;112564;112558;112552;112550;112549;112544;112539;112535;112531/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 112700, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "bandybabboon", "profile_url": "https://biology.stackexchange.com/users/8952/bandybabboon", "user_type": "registered"}, "created_at": "2023-07-31T11:48:43+00:00", "raw_file": "raw/codex_api_v1/a04a0f8b9b816f605414240c86ef0796529040fa885a4b1183bd818d12b64e65_0.json", "raw_sha256": "630e8bf25473aeb8900409dec408d29d2bdc2011bc3b72f26995c17452a2c689", "revision_guid": "436A5135-596D-4167-AF99-CFB22B99EA41", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/436A5135-596D-4167-AF99-CFB22B99EA41/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "bandybabboon", "profile_url": "https://biology.stackexchange.com/users/8952/bandybabboon", "user_type": "registered"}, "created_at": "2023-07-31T13:59:28+00:00", "raw_file": "raw/codex_api_v1/a04a0f8b9b816f605414240c86ef0796529040fa885a4b1183bd818d12b64e65_0.json", "raw_sha256": "630e8bf25473aeb8900409dec408d29d2bdc2011bc3b72f26995c17452a2c689", "revision_guid": "CAA85B42-ED40-4DC1-853E-84F58F8E5E44", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/CAA85B42-ED40-4DC1-853E-84F58F8E5E44/view-source"}], "score": 2, "updated_at": "2023-07-31T13:59:28+00:00"}, {"answer_html": "

To elaborate slightly on the existing answer in which mention is made of 'genetic compatibility', there are many compelling studies which indicate a strong preference for dissimilarity in class 1 HLA alleles between human mating partners, and that this dissimilarity is readily detectable in the body odour of respective individuals. The link below 1 is to one such study; and the following paragraph is its abstract.

\n
\n

The major histocompatibility complex (MHC, called HLA in humans) is an important genetic component of the immune system. Fish, birds and mammals prefer mates with different genetic MHC code compared to their own, which they determine using olfactory cues. This preference increases the chances of high MHC variety in the offspring, leading to enhanced resilience against a variety of pathogens. Humans are also able to discriminate HLA related olfactory stimuli, however, it is debated whether this mechanism is of behavioural relevance. We show on a large sample (N = 508), with high-resolution typing of HLA class I/II, that HLA dissimilarity correlates with partnership, sexuality and enhances the desire to procreate. We conclude that HLA mediates mate behaviour in humans.

\n
\n

Interestingly, there are also allied studies which demonstrate that the use of oral contraceptive hormones disrupts this sensitivity, and one such example is cited by the study linked.

\n

There is clearly a heuristic argument that this dissimilarity favours a broader range of immunological memory in any viable offspring; and this hypothesis is explored in the 'Wikipedia' articles on 'Major Histocompatibility Complex' and its subsidiaries on 'sexual selection'.

\n

To address the comment inquiring upon a causative basis for this phenomenon in the relation between MHC or HLA type and body odour, the latter section of that 'Wikipedia' article makes the following observation and cites the relevant study.

\n
\n

MHC may be related to mate choice in some human populations, a theory that found support by studies by Ober and colleagues in 1997, as well as by Chaix and colleagues in 2008. However, the latter findings have been controversial. If it exists, the phenomenon might be mediated by olfaction, as MHC phenotype appears strongly involved in the strength and pleasantness of perceived odour of compounds from sweat. Fatty acid esters—such as methyl undecanoate, methyl decanoate, methyl nonanoate, methyl octanoate, and methyl hexanoate—show strong connection to MHC.2

\n
\n

I might add here that perhaps the most consequential determination of these sorts of studies is the finding that hormonal contraceptives such as the OC pill effectively inhibit any olfactory sensitivity to this potentially important dissimilarity in HLA type.

\n

Consider for example the implications of less than optimal breeding matches arising under the influence of these hormones and of this manipulation of female fertility on a massive scale, the persistence of which culture in the face of such evidence -- arguably in order merely to sustain the putative bodily autonomy of women in the illusory form of a simple pill -- defies reason. Common sense alone informs us that practices of this kind invite sociological and even biological calamity.

\n

Influence of HLA on human partnership and sexual satisfaction

\n

Infuence of MHC on odour perception of 43 chemicals and body odour

\n", "answer_id": 112726, "answer_text": "To elaborate slightly on the existing answer in which mention is made of 'genetic compatibility', there are many compelling studies which indicate a strong preference for dissimilarity in class 1 HLA alleles between human mating partners, and that this dissimilarity is readily detectable in the body odour of respective individuals. The link below 1 (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5006172/) is to one such study; and the following paragraph is its abstract.\n\n\n\n\n\n\n\nThe major histocompatibility complex (MHC, called HLA in humans) is an important genetic component of the immune system. Fish, birds and mammals prefer mates with different genetic MHC code compared to their own, which they determine using olfactory cues. This preference increases the chances of high MHC variety in the offspring, leading to enhanced resilience against a variety of pathogens. Humans are also able to discriminate HLA related olfactory stimuli, however, it is debated whether this mechanism is of behavioural relevance. We show on a large sample (N = 508), with high-resolution typing of HLA class I/II, that HLA dissimilarity correlates with partnership, sexuality and enhances the desire to procreate. We conclude that HLA mediates mate behaviour in humans.\n\n\n\n\n\n\n\nInterestingly, there are also allied studies which demonstrate that the use of oral contraceptive hormones disrupts this sensitivity, and one such example is cited by the study linked.\n\n\n\n\nThere is clearly a heuristic argument that this dissimilarity favours a broader range of immunological memory in any viable offspring; and this hypothesis is explored in the 'Wikipedia' articles on 'Major Histocompatibility Complex' and its subsidiaries on 'sexual selection'.\n\n\n\n\nTo address the comment inquiring upon a causative basis for this phenomenon in the relation between MHC or HLA type and body odour, the latter section of that 'Wikipedia' article makes the following observation and cites the relevant study.\n\n\n\n\n\n\n\nMHC may be related to mate choice in some human populations, a theory that found support by studies by Ober and colleagues in 1997, as well as by Chaix and colleagues in 2008. However, the latter findings have been controversial. If it exists, the phenomenon might be mediated by olfaction, as MHC phenotype appears strongly involved in the strength and pleasantness of perceived odour of compounds from sweat. Fatty acid esters—such as methyl undecanoate, methyl decanoate, methyl nonanoate, methyl octanoate, and methyl hexanoate—show strong connection to MHC.2 (https://www.degruyter.com/document/doi/10.2478/s11535-010-0020-6/html)\n\n\n\n\n\n\n\nI might add here that perhaps the most consequential determination of these sorts of studies is the finding that hormonal contraceptives such as the OC pill effectively inhibit any olfactory sensitivity to this potentially important dissimilarity in HLA type.\n\n\n\n\nConsider for example the implications of less than optimal breeding matches arising under the influence of these hormones and of this manipulation of female fertility on a massive scale, the persistence of which culture in the face of such evidence -- arguably in order merely to sustain the putative bodily autonomy of women in the illusory form of a simple pill -- defies reason. Common sense alone informs us that practices of this kind invite sociological and even biological calamity.\n\n\n\n\nInfluence of HLA on human partnership and sexual satisfaction (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5006172/)\n\n\n\n\nInfuence of MHC on odour perception of 43 chemicals and body odour (https://www.degruyter.com/document/doi/10.2478/s11535-010-0020-6/html)", "answer_url": "https://biology.stackexchange.com/a/112726", "author": "jeremiah", "author_url": "https://biology.stackexchange.com/users/37891/jeremiah", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2023-08-04T00:20:54+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:38.885561+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/a145de97eabc007745b45919875489a41261075cbdf33d916d9640ba4ad0bd35_0.json", "raw_sha256": "e7d8d4315eef8e039a452d2811869cbe305575c6ff8a6bef8f80d6dfb58c5bfd", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/112982;112980;112979;112977;112972;112967;112962;112956;112952;112948;112941;112938;112937;112936;112927;112925;112923;112919;112909;112905;112904;112898;112895;112893;112884;112881;112880;112879;112873;112872;112870;112869;112867;112850;112849;112848;112841;112835;112831;112824;112818;112811;112808;112807;112790;112789;112785;112777;112773;112770;112762;112759;112757;112756;112746;112739;112738;112737;112731;112705;112703;112700;112699;112698;112693;112691;112687;112685;112677;112671;112667;112663;112659;112653;112647;112646;112645;112636;112625;112621;112615;112614;112613;112610;112598;112593;112592;112586;112580;112575;112574;112564;112558;112552;112550;112549;112544;112539;112535;112531/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 112700, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jeremiah", "profile_url": "https://biology.stackexchange.com/users/37891/jeremiah", "user_type": "registered"}, "created_at": "2023-08-04T00:20:54+00:00", "raw_file": "raw/codex_api_v1/a04a0f8b9b816f605414240c86ef0796529040fa885a4b1183bd818d12b64e65_0.json", "raw_sha256": "630e8bf25473aeb8900409dec408d29d2bdc2011bc3b72f26995c17452a2c689", "revision_guid": "42FA50E0-186F-4A06-89C2-FEDD6B89651A", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/42FA50E0-186F-4A06-89C2-FEDD6B89651A/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jeremiah", "profile_url": "https://biology.stackexchange.com/users/37891/jeremiah", "user_type": "registered"}, "created_at": "2023-08-04T00:28:00+00:00", "raw_file": "raw/codex_api_v1/a04a0f8b9b816f605414240c86ef0796529040fa885a4b1183bd818d12b64e65_0.json", "raw_sha256": "630e8bf25473aeb8900409dec408d29d2bdc2011bc3b72f26995c17452a2c689", "revision_guid": "630363A5-D596-48FA-810A-2A261C7C86FD", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/630363A5-D596-48FA-810A-2A261C7C86FD/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "jeremiah", "profile_url": "https://biology.stackexchange.com/users/37891/jeremiah", "user_type": "registered"}, "created_at": "2023-08-04T23:28:30+00:00", "raw_file": "raw/codex_api_v1/a04a0f8b9b816f605414240c86ef0796529040fa885a4b1183bd818d12b64e65_0.json", "raw_sha256": "630e8bf25473aeb8900409dec408d29d2bdc2011bc3b72f26995c17452a2c689", "revision_guid": "47CB6610-62AE-445D-8153-123E2B82A9C0", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/47CB6610-62AE-445D-8153-123E2B82A9C0/view-source"}], "score": 1, "updated_at": "2023-08-04T23:28:30+00:00"}], "domain": "biology", "external_links": ["https://www.degruyter.com/document/doi/10.2478/s11535-010-0020-6/html", "https://www.nature.com/articles/npre.2008.2561.1.pdf", "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5006172/"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:12.794960+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/01e5186067e30dc1b8d7a145670ab7edd6b017797b271a481af8b7b7f55f13c2_0.json", "raw_sha256": "6c3960de7e1d3d7920bb88d02e2184614c219b391f39d9bddc2a582fdc9a71e7", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=10&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "j4nd3r53n", "question_author_url": "https://biology.stackexchange.com/users/47366/j4nd3r53n", "question_author_user_type": "registered", "question_created_at": "2023-07-31T09:51:00+00:00", "question_html": "

I remember one, sweltering day in Malaysia, I was climbing the very long staircase to a Buddha statue in a cave, when I suddenly felt enveloped in an overpowering smell of sweat. My first thought was that I must have forgot to wash, possibly for several weeks, but then I realised that I was in the middle of a troupe of monkeys.

\n

And now I've come to wonder what the function is of this very characteristic smell. There seems to be connection to sexual maturity, since children don't start producing the smell until puberty, and the overwhelming base of evidence I collected that day, seems to suggest that this may be universal among primates.

\n

Has any research been done into the function smell of sweat, socially or otherwise?

\n", "question_id": 112700, "question_license": "CC BY-SA 4.0", "question_score": 3, "question_text": "I remember one, sweltering day in Malaysia, I was climbing the very long staircase to a Buddha statue in a cave, when I suddenly felt enveloped in an overpowering smell of sweat. My first thought was that I must have forgot to wash, possibly for several weeks, but then I realised that I was in the middle of a troupe of monkeys.\n\n\n\n\nAnd now I've come to wonder what the function is of this very characteristic smell. There seems to be connection to sexual maturity, since children don't start producing the smell until puberty, and the overwhelming base of evidence I collected that day, seems to suggest that this may be universal among primates.\n\n\n\n\nHas any research been done into the function smell of sweat, socially or otherwise?", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "j4nd3r53n", "profile_url": "https://biology.stackexchange.com/users/47366/j4nd3r53n", "user_type": "registered"}, "created_at": "2023-07-31T09:51:00+00:00", "raw_file": "raw/codex_api_v1/a04a0f8b9b816f605414240c86ef0796529040fa885a4b1183bd818d12b64e65_0.json", "raw_sha256": "630e8bf25473aeb8900409dec408d29d2bdc2011bc3b72f26995c17452a2c689", "revision_guid": "066ADDC9-4D6A-4F00-AD0A-3BE455CF08E1", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/066ADDC9-4D6A-4F00-AD0A-3BE455CF08E1/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2023-07-31T17:55:44+00:00", "raw_file": "raw/codex_api_v1/a04a0f8b9b816f605414240c86ef0796529040fa885a4b1183bd818d12b64e65_0.json", "raw_sha256": "630e8bf25473aeb8900409dec408d29d2bdc2011bc3b72f26995c17452a2c689", "revision_guid": "D6230417-8A4B-4709-9324-BC4D5301D883", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://biology.stackexchange.com/revisions/D6230417-8A4B-4709-9324-BC4D5301D883/view-source"}], "source_site": "biology", "source_url": "https://biology.stackexchange.com/questions/112700/what-is-the-function-of-smelly-sweat-in-primates", "split": "train", "split_group": "39a57b0bee8a358fd6ef9b912b05f4a56e1d4d4ecec7012f15a4217454163c6d", "tags": ["sociality", "olfaction"], "thread_id": "biology:112700", "title": "What is the function of smelly sweat in primates?"}} {"accepted_status": [false, true], "candidate_answers": [{"answer_html": "

There are a number of pathways involved in anaerobic respiration. It's not like the Krebs cycle (TCA) where there's only one pathway in aerobic respiration. To be clear my professional background is carbon fixation. The reason aerobic respiration is important is it can get conflagrated (how do you spell it?) anyway mixed up - with the rTCA (described below) 'cause its the same genes but reverse process. If that happens it’s a disaster :-) because the calculations are kaput.

\n

Anyway, here's a number of examples.

\n

Lactic Acid\nFound in: Certainly in mammals, I would suspect its in all vertebrates and some bacteria Lactobacillus is one\nPyruvate is converted to Lactic Acid (C3H5O3) in the absence of oxygen.

\n

Classic fermentation such as making beer, thats yeasts, and some bacteria.\nPyruvate to Ethanol (C2H5OH) + Carbon Dioxide (CO2).\nThis occurs in brewing and baking processes.

\n

Methanogenesis\nProduces methane (CH4) which occurs in methanogen bacteria which include archaea and bacteria in the stomachs of ruminants in the digestion of cellulose from grass. This does occur in the soil in the degradation of living matter and also found in high abundance in peat bogs.

\n

Sulfur reducing bacteria\nProduces hydrogen sulfide (H2S) and are found in hydro-thermal vents and thought to be the origin of respiration, not necessarily these bacteria but biochemical process in the first life-forms.

\n
\n

Its important to distinguish this from bacteria that are purely involved in carbon-fixation e.g. the Arnon-Buchanan cycle - this is the reverse TCA, which is performed mostly by chemolithotrophs, a diverse group of bacteria. The reason I brought this up is that rTCA - the exact reverse of the Krebs cycle in aerobic respiration, is carbon fixation but not respiration.

\n

Methanogens both fix CO2, i.e. carbon fixation but this is also their pathway of respiration.

\n
\n

As for citations, most of this pretty basic so:

\n

Lactic acid.\nAlberts, B., et al. (2014). Molecular Biology of the Cell (6th ed.). Garland Science.

\n

Sulfur reduction and alcohol fermentation\nMadigan, M. T., et al (2020). Brock Biology of Microorganisms (16th ed.). Pearson.

\n

For methanogenesis (what I know most about):\nThauer, R. K., and Shima, S. (2008). "Methane as Fuel for Anaerobic Microorganisms." Annual Review of Microbiology, 62(1), 43–64.

\n
\n

Final point, just waving my arms about a bit, I'd suggest the diversity of anaerobic respiration infers one of these was the ancestral pathway of respiration (it's a hot topic).

\n", "answer_id": 115724, "answer_text": "There are a number of pathways involved in anaerobic respiration. It's not like the Krebs cycle (TCA) where there's only one pathway in aerobic respiration. To be clear my professional background is carbon fixation. The reason aerobic respiration is important is it can get conflagrated (how do you spell it?) anyway mixed up - with the rTCA (described below) 'cause its the same genes but reverse process. If that happens it’s a disaster :-) because the calculations are kaput.\n\n\n\n\nAnyway, here's a number of examples.\n\n\n\n\nLactic Acid\nFound in: Certainly in mammals, I would suspect its in all vertebrates and some bacteria Lactobacillus is one\nPyruvate is converted to Lactic Acid (C3H5O3) in the absence of oxygen.\n\n\n\n\nClassic fermentation such as making beer, thats yeasts, and some bacteria.\nPyruvate to Ethanol (C2H5OH) + Carbon Dioxide (CO2).\nThis occurs in brewing and baking processes.\n\n\n\n\nMethanogenesis\nProduces methane (CH4) which occurs in methanogen bacteria which include archaea and bacteria in the stomachs of ruminants in the digestion of cellulose from grass. This does occur in the soil in the degradation of living matter and also found in high abundance in peat bogs.\n\n\n\n\nSulfur reducing bacteria\nProduces hydrogen sulfide (H2S) and are found in hydro-thermal vents and thought to be the origin of respiration, not necessarily these bacteria but biochemical process in the first life-forms.\n\n\n\n\n\n\n\nIts important to distinguish this from bacteria that are purely involved in carbon-fixation e.g. the Arnon-Buchanan cycle - this is the reverse TCA, which is performed mostly by chemolithotrophs, a diverse group of bacteria. The reason I brought this up is that rTCA - the exact reverse of the Krebs cycle in aerobic respiration, is carbon fixation but not respiration.\n\n\n\n\nMethanogens both fix CO2, i.e. carbon fixation but this is also their pathway of respiration.\n\n\n\n\n\n\n\nAs for citations, most of this pretty basic so:\n\n\n\n\nLactic acid.\nAlberts, B., et al. (2014). Molecular Biology of the Cell (6th ed.). Garland Science. (https://rads.stackoverflow.com/amzn/click/com/0815344325)\n\n\n\n\nSulfur reduction and alcohol fermentation\nMadigan, M. T., et al (2020). Brock Biology of Microorganisms (16th ed.). Pearson. (https://rads.stackoverflow.com/amzn/click/com/0135845688)\n\n\n\n\nFor methanogenesis (what I know most about):\nThauer, R. K., and Shima, S. (2008). \"Methane as Fuel for Anaerobic Microorganisms.\" Annual Review of Microbiology, 62(1), 43–64.\n\n\n\n\n\n\n\nFinal point, just waving my arms about a bit, I'd suggest the diversity of anaerobic respiration infers one of these was the ancestral pathway of respiration (it's a hot topic).", "answer_url": "https://biology.stackexchange.com/a/115724", "author": "user75152", "author_url": null, "author_user_type": "does_not_exist", "content_license": "CC BY-SA 4.0", "created_at": "2024-12-02T22:36:30+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:22.614155+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/2c8799380b8f5d7bf0fd42e594fd78a1835b27e1da9f481cc00f096bab9c01ca_0.json", "raw_sha256": "348375a094fdfd6d9ca55d0bddc65d8dc7a7f0757e1e5a44c25e22a66b1a4892", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/116119;116113;116097;116096;116091;116087;116076;116067;116063;116059;116055;116037;116034;116028;116022;116012;116005;115997;115989;115988;115987;115979;115978;115976;115974;115973;115970;115966;115965;115957;115952;115939;115933;115932;115927;115921;115915;115903;115897;115894;115886;115885;115884;115881;115880;115868;115867;115857;115852;115840;115830;115825;115819;115815;115791;115780;115773;115764;115759;115756;115743;115736;115726;115723;115713;115699;115691;115689;115685;115678;115668;115664;115657;115650;115642;115639;115632;115627;115626;115609;115602;115598;115592;115588;115587;115580;115578;115570;115566;115562;115549;115537;115536;115531;115530;115528;115525;115521;115513;115510/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 115723, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "user75152", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2024-12-02T22:36:30+00:00", "raw_file": "raw/codex_api_v1/e9f8d53002b67c70a1e0faa4e07e18311daa0dd2e2a655222036d0cc60803d5a_1790824104499255500_0.json", "raw_sha256": "7675135c0936bb0999aeac9143b12cafaa9f0b2130abeca1b246467c5d0b26d5", "revision_guid": "AC80A021-832B-4D19-88BB-3818F94BBDBE", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/AC80A021-832B-4D19-88BB-3818F94BBDBE/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "user75152", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2024-12-02T22:43:53+00:00", "raw_file": "raw/codex_api_v1/e9f8d53002b67c70a1e0faa4e07e18311daa0dd2e2a655222036d0cc60803d5a_1790824104499255500_0.json", "raw_sha256": "7675135c0936bb0999aeac9143b12cafaa9f0b2130abeca1b246467c5d0b26d5", "revision_guid": "70DCC162-16CB-4003-8E64-23BBB58E5F0B", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/70DCC162-16CB-4003-8E64-23BBB58E5F0B/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "David", "profile_url": "https://biology.stackexchange.com/users/22057/david", "user_type": "registered"}, "created_at": "2024-12-02T23:22:49+00:00", "raw_file": "raw/codex_api_v1/e9f8d53002b67c70a1e0faa4e07e18311daa0dd2e2a655222036d0cc60803d5a_1790824104499255500_0.json", "raw_sha256": "7675135c0936bb0999aeac9143b12cafaa9f0b2130abeca1b246467c5d0b26d5", "revision_guid": "7EC08DAF-F0B2-437A-8672-1B3CC9481653", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/7EC08DAF-F0B2-437A-8672-1B3CC9481653/view-source"}], "score": 0, "updated_at": "2024-12-02T23:22:49+00:00"}, {"answer_html": "

Terminology

\n
\n

“I teach that anaerobic respiration and fermentation are different.”

\n
\n

Although not conforming to the historic or lay use of the terms “respiration” and “fermentation” the poster is correct regarding the current scientific usage of these terms, as evidenced by the following quotations from the Wikipedia article on fermentation:

\n
\n

“The definition of fermentation has evolved over the years. The most\nmodern definition is catabolism where organic compounds are both the\nelectron donor and acceptor. A common electron donor is glucose, and\npyruvate is a common electron acceptor. This definition distinguishes\nfermentation from aerobic respiration, where oxygen is the acceptor,\nand types of anaerobic respiration where inorganic compound is the\nacceptor.”

\n
\n

This is developed in more detail in the Wikipedia article on Anaerobic respiration.

\n

However, given the confusing nature of the terminology, if I were teaching this myself I would first stress the fundamental difference between the two ways of converting metabolic ‘energy’ to ATP: 1. Directly phosphorylating ADP in a metabolic reaction, and 2. Establishing an electrochemical gradient across a membrane that drives the multi-subunit ATP synthase that produces ATP from ADP and inorganic phosphate. Indeed, depending on the background of one’s students, the use of the word “oxidation” to “mean removal of electrons” may need emphasizing.

\n

N.B. The regeneration of NADH+ in fermentation is to allow the process to continue at all, not to accelerate 16x or by any other factor as stated in the question.

\n

Necessity of the Tricarboxylic Acid Cycle for Anaerobic Respiration

\n
\n

“Do anaerobic organisms that have a terminal electron acceptor other\nthan oxygen have a Citric Acid cycle?”

\n
\n

No, not necessarily.
Some may, but others only have genes for some of the enzymes of the tricarboxylic acid cycle, as a genomic analysis by Huynen et al. demonstrated (relevant details in footnote).

\n
\n

I say that the process is the “same“ as aerobic respiration just a\ndifferent electron acceptor.

\n
\n

No, that is incorrect.
Certainly a system analagous to the mitochondrial electron transport system must be present to establish an electrochemical gradient. However the assumption that the process is the same in other respects and “glucose/pyruvate/acetyl-CoA” must be involved and provide the electrons through generation of NADH in the tricarboxylic acid cycle is unfounded. Bacteria that utilize ‘unusual’ terminal electron acceptors generally occupy ‘unusual’ ecological niches, with ‘unusual’ sources of carbon and reducing power.

\n

An example: bacteria of the Desulfovibrio genus

\n

I found it difficult to find detailed metabolic information about bacteria which employ terminal electron acceptor other than oxygen. This may reflect the fact that many occupy extreme ecological niches and are difficult to study in the laboratory. In addition the situation is often confused by alternative methods of oxidation (some are also fermenters) and the possibility of symbiotic relationships with other bacteria). One more tractible example is found in members of the Desulfovibrio genus, which employ sulphate as their terminal electron acceptor, and use hydrogen and various organic acids as the source of reductive energy. With metabolic observations supplemented by genomic and transcriptomic analysis the model below has been proposed for the flow of electrons during sulphate respiration in D. vulgaris.

\n

\"Sulphate

\n

From a 2011 review by Keller and Wall which should be consulted for further details.

\n

It should be emphasized that the pyruvate generated when lactate is oxidized is converted to acetate as an end-product and not converted into acetyl-CoA for input into a tricarboxylic acid cycle. Genome sequencing indicates that genes for most of the enzymes of the cycle are present, except for citrate synthase and perhaps 2-ketoglutarate dehydrogenase. It should be explained that the presence of an incomplete tricarboxylic acid cycle allows other metabolic interconversions to occur, and, to quote Huynen et al.,

\n
\n

“it has been argued that the CAC evolved originally as two separate\npathways stemming from pyruvate, with an oxidative branch leading to\n2-ketoglutarate and a reductive branch leading to succinyl CoA\n[Melendez-Hevia, E., Wadell, T.G. and Cascante, M. (1996) J. Mol.\nEvol. 43, 293–303]”.

\n
\n

Footnote: Hynen et al. and incomplete tricarboxylic acid cycles

\n

At least one of the bacteria the genome of which Hynen et al. found to lack enzymes of the tricarboxylic acid cycle — Methanocaldococcus jannaschii — uses an alternative electron acceptor. It is only capable of growth on carbon dioxide and hydrogen as an energy source, and lacks genes for the first three enzymes of the oxidative cycle: citrate synthase, iconitase and isocitrate dehydrogenase. A detailed consideration of the energetics of such methanogens can be found in a review by Thauer et al..

\n", "answer_id": 115776, "answer_text": "Terminology\n\n\n\n\n\n\n\n“I teach that anaerobic respiration and fermentation are different.”\n\n\n\n\n\n\n\nAlthough not conforming to the historic or lay use of the terms “respiration” and “fermentation” the poster is correct regarding the current scientific usage of these terms, as evidenced by the following quotations from the Wikipedia article on fermentation (https://en.wikipedia.org/wiki/Fermentation):\n\n\n\n\n\n\n\n“The definition of fermentation has evolved over the years. The most\nmodern definition is catabolism where organic compounds are both the\nelectron donor and acceptor. A common electron donor is glucose, and\npyruvate is a common electron acceptor. This definition distinguishes\nfermentation from aerobic respiration, where oxygen is the acceptor,\nand types of anaerobic respiration where inorganic compound is the\nacceptor.”\n\n\n\n\n\n\n\nThis is developed in more detail in the Wikipedia article on Anaerobic respiration (https://en.wikipedia.org/wiki/Anaerobic_respiration).\n\n\n\n\nHowever, given the confusing nature of the terminology, if I were teaching this myself I would first stress the fundamental difference between the two ways of converting metabolic ‘energy’ to ATP: 1. Directly phosphorylating ADP in a metabolic reaction, and 2. Establishing an electrochemical gradient across a membrane that drives the multi-subunit ATP synthase that produces ATP from ADP and inorganic phosphate. Indeed, depending on the background of one’s students, the use of the word “oxidation” to “mean removal of electrons” may need emphasizing.\n\n\n\n\nN.B. The regeneration of NADH+ in fermentation is to allow the process to continue at all, not to accelerate 16x or by any other factor as stated in the question.\n\n\n\n\nNecessity of the Tricarboxylic Acid Cycle for Anaerobic Respiration\n\n\n\n\n\n\n\n“Do anaerobic organisms that have a terminal electron acceptor other\nthan oxygen have a Citric Acid cycle?”\n\n\n\n\n\n\n\nNo, not necessarily. \nSome may, but others only have genes for some of the enzymes of the tricarboxylic acid cycle, as a genomic analysis by Huynen et al. (https://pubmed.ncbi.nlm.nih.gov/10390638/) demonstrated (relevant details in footnote).\n\n\n\n\n\n\n\nI say that the process is the “same“ as aerobic respiration just a\ndifferent electron acceptor.\n\n\n\n\n\n\n\nNo, that is incorrect. \nCertainly a system analagous to the mitochondrial electron transport system must be present to establish an electrochemical gradient. However the assumption that the process is the same in other respects and “glucose/pyruvate/acetyl-CoA” must be involved and provide the electrons through generation of NADH in the tricarboxylic acid cycle is unfounded. Bacteria that utilize ‘unusual’ terminal electron acceptors generally occupy ‘unusual’ ecological niches, with ‘unusual’ sources of carbon and reducing power.\n\n\n\n\nAn example: bacteria of the Desulfovibrio genus\n\n\n\n\nI found it difficult to find detailed metabolic information about bacteria which employ terminal electron acceptor other than oxygen. This may reflect the fact that many occupy extreme ecological niches and are difficult to study in the laboratory. In addition the situation is often confused by alternative methods of oxidation (some are also fermenters) and the possibility of symbiotic relationships with other bacteria). One more tractible example is found in members of the Desulfovibrio genus, which employ sulphate as their terminal electron acceptor, and use hydrogen and various organic acids as the source of reductive energy. With metabolic observations supplemented by genomic and transcriptomic analysis the model below has been proposed for the flow of electrons during sulphate respiration in D. vulgaris.\n\n\n\n\n[image: Sulphate reduction; source: https://i.sstatic.net/Z4WNApom.png] (https://i.sstatic.net/Z4WNApom.png)\n\n\n\n\nFrom a 2011 review by Keller and Wall (https://www.frontiersin.org/journals/microbiology/articles/10.3389/fmicb.2011.00135) which should be consulted for further details.\n\n\n\n\nIt should be emphasized that the pyruvate generated when lactate is oxidized is converted to acetate as an end-product and not converted into acetyl-CoA for input into a tricarboxylic acid cycle. Genome sequencing (https://www.nature.com/articles/nbt959) indicates that genes for most of the enzymes of the cycle are present, except for citrate synthase and perhaps 2-ketoglutarate dehydrogenase. It should be explained that the presence of an incomplete tricarboxylic acid cycle allows other metabolic interconversions to occur, and, to quote Huynen et al.,\n\n\n\n\n\n\n\n“it has been argued that the CAC evolved originally as two separate\npathways stemming from pyruvate, with an oxidative branch leading to\n2-ketoglutarate and a reductive branch leading to succinyl CoA\n[Melendez-Hevia, E., Wadell, T.G. and Cascante, M. (1996) J. Mol.\nEvol. 43, 293–303]”.\n\n\n\n\n\n\n\nFootnote: Hynen et al. and incomplete tricarboxylic acid cycles\n\n\n\n\nAt least one of the bacteria the genome of which Hynen et al. found to lack enzymes of the tricarboxylic acid cycle — Methanocaldococcus jannaschii — uses an alternative electron acceptor. It is only capable of growth on carbon dioxide and hydrogen as an energy source, and lacks genes for the first three enzymes of the oxidative cycle: citrate synthase, iconitase and isocitrate dehydrogenase. A detailed consideration of the energetics of such methanogens can be found in a review by Thauer et al. (https://www.nature.com/articles/nrmicro1931).", "answer_url": "https://biology.stackexchange.com/a/115776", "author": "David", "author_url": "https://biology.stackexchange.com/users/22057/david", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2024-12-11T18:15:38+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:22.614155+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/2c8799380b8f5d7bf0fd42e594fd78a1835b27e1da9f481cc00f096bab9c01ca_0.json", "raw_sha256": "348375a094fdfd6d9ca55d0bddc65d8dc7a7f0757e1e5a44c25e22a66b1a4892", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/116119;116113;116097;116096;116091;116087;116076;116067;116063;116059;116055;116037;116034;116028;116022;116012;116005;115997;115989;115988;115987;115979;115978;115976;115974;115973;115970;115966;115965;115957;115952;115939;115933;115932;115927;115921;115915;115903;115897;115894;115886;115885;115884;115881;115880;115868;115867;115857;115852;115840;115830;115825;115819;115815;115791;115780;115773;115764;115759;115756;115743;115736;115726;115723;115713;115699;115691;115689;115685;115678;115668;115664;115657;115650;115642;115639;115632;115627;115626;115609;115602;115598;115592;115588;115587;115580;115578;115570;115566;115562;115549;115537;115536;115531;115530;115528;115525;115521;115513;115510/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 115723, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "David", "profile_url": "https://biology.stackexchange.com/users/22057/david", "user_type": "registered"}, "created_at": "2024-12-11T18:15:38+00:00", "raw_file": "raw/codex_api_v1/5ced1a9f1ef6cec4e5ea414f5920558abe1f2afe671db804d768d0c0886f0b02_1790824127343029500_0.json", "raw_sha256": "9b7f4987291adc582d9a7ae47056606e7a91fc10c512e504e60da3797727c346", "revision_guid": "EC89ACAE-F300-4808-9F1A-B09FCA958DA4", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/EC89ACAE-F300-4808-9F1A-B09FCA958DA4/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "David", "profile_url": "https://biology.stackexchange.com/users/22057/david", "user_type": "registered"}, "created_at": "2024-12-11T18:22:27+00:00", "raw_file": "raw/codex_api_v1/5ced1a9f1ef6cec4e5ea414f5920558abe1f2afe671db804d768d0c0886f0b02_1790824127343029500_0.json", "raw_sha256": "9b7f4987291adc582d9a7ae47056606e7a91fc10c512e504e60da3797727c346", "revision_guid": "CCE679AB-6001-4F9B-90F3-7081E8516525", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/CCE679AB-6001-4F9B-90F3-7081E8516525/view-source"}], "score": 1, "updated_at": "2024-12-11T18:22:27+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I have been teaching for a while (College level) and wish to check the accuracy of my material. I teach that anaerobic respiration and fermentation are different. In fermentation the NAD+ are re-generated and Glycolysis can go ~16x faster. But when I talk about anaerobic respiration I say that the process is the \"same\" as aerobic respiration just a different electron acceptor. But I admit I don't know much more than that, and as I do research, for example into sulfur-reducing bacteria, I am not finding clear information.\n\n\n\n\nI've been assuming that strict anaerobes don't just rely on fermentation and utilize an Electron transport chain to generate ATP. But do they use a cycle like the Citric Acid cycle? In other words can they fully oxidize glucose/pyruvate/acetyl-CoA?\n\n\n\n\nIf they don't fully oxidize glucose and/or pyruvate, what are the consequences of building up pyruvate (biochemically)?\n\n\n\n\nIf they don't fully oxidize glucose, how do they produce enough electron carriers (NADH, FADH2) to make enough ATP in their ETC? Or do they just require less ATP per glucose to survive?", "record_id": "Scientific-Answer-Ranking:biology:115723", "scores": [0, 1], "split": "train", "thread": {"accepted_answer_id": 115776, "answers": [{"answer_html": "

There are a number of pathways involved in anaerobic respiration. It's not like the Krebs cycle (TCA) where there's only one pathway in aerobic respiration. To be clear my professional background is carbon fixation. The reason aerobic respiration is important is it can get conflagrated (how do you spell it?) anyway mixed up - with the rTCA (described below) 'cause its the same genes but reverse process. If that happens it’s a disaster :-) because the calculations are kaput.

\n

Anyway, here's a number of examples.

\n

Lactic Acid\nFound in: Certainly in mammals, I would suspect its in all vertebrates and some bacteria Lactobacillus is one\nPyruvate is converted to Lactic Acid (C3H5O3) in the absence of oxygen.

\n

Classic fermentation such as making beer, thats yeasts, and some bacteria.\nPyruvate to Ethanol (C2H5OH) + Carbon Dioxide (CO2).\nThis occurs in brewing and baking processes.

\n

Methanogenesis\nProduces methane (CH4) which occurs in methanogen bacteria which include archaea and bacteria in the stomachs of ruminants in the digestion of cellulose from grass. This does occur in the soil in the degradation of living matter and also found in high abundance in peat bogs.

\n

Sulfur reducing bacteria\nProduces hydrogen sulfide (H2S) and are found in hydro-thermal vents and thought to be the origin of respiration, not necessarily these bacteria but biochemical process in the first life-forms.

\n
\n

Its important to distinguish this from bacteria that are purely involved in carbon-fixation e.g. the Arnon-Buchanan cycle - this is the reverse TCA, which is performed mostly by chemolithotrophs, a diverse group of bacteria. The reason I brought this up is that rTCA - the exact reverse of the Krebs cycle in aerobic respiration, is carbon fixation but not respiration.

\n

Methanogens both fix CO2, i.e. carbon fixation but this is also their pathway of respiration.

\n
\n

As for citations, most of this pretty basic so:

\n

Lactic acid.\nAlberts, B., et al. (2014). Molecular Biology of the Cell (6th ed.). Garland Science.

\n

Sulfur reduction and alcohol fermentation\nMadigan, M. T., et al (2020). Brock Biology of Microorganisms (16th ed.). Pearson.

\n

For methanogenesis (what I know most about):\nThauer, R. K., and Shima, S. (2008). "Methane as Fuel for Anaerobic Microorganisms." Annual Review of Microbiology, 62(1), 43–64.

\n
\n

Final point, just waving my arms about a bit, I'd suggest the diversity of anaerobic respiration infers one of these was the ancestral pathway of respiration (it's a hot topic).

\n", "answer_id": 115724, "answer_text": "There are a number of pathways involved in anaerobic respiration. It's not like the Krebs cycle (TCA) where there's only one pathway in aerobic respiration. To be clear my professional background is carbon fixation. The reason aerobic respiration is important is it can get conflagrated (how do you spell it?) anyway mixed up - with the rTCA (described below) 'cause its the same genes but reverse process. If that happens it’s a disaster :-) because the calculations are kaput.\n\n\n\n\nAnyway, here's a number of examples.\n\n\n\n\nLactic Acid\nFound in: Certainly in mammals, I would suspect its in all vertebrates and some bacteria Lactobacillus is one\nPyruvate is converted to Lactic Acid (C3H5O3) in the absence of oxygen.\n\n\n\n\nClassic fermentation such as making beer, thats yeasts, and some bacteria.\nPyruvate to Ethanol (C2H5OH) + Carbon Dioxide (CO2).\nThis occurs in brewing and baking processes.\n\n\n\n\nMethanogenesis\nProduces methane (CH4) which occurs in methanogen bacteria which include archaea and bacteria in the stomachs of ruminants in the digestion of cellulose from grass. This does occur in the soil in the degradation of living matter and also found in high abundance in peat bogs.\n\n\n\n\nSulfur reducing bacteria\nProduces hydrogen sulfide (H2S) and are found in hydro-thermal vents and thought to be the origin of respiration, not necessarily these bacteria but biochemical process in the first life-forms.\n\n\n\n\n\n\n\nIts important to distinguish this from bacteria that are purely involved in carbon-fixation e.g. the Arnon-Buchanan cycle - this is the reverse TCA, which is performed mostly by chemolithotrophs, a diverse group of bacteria. The reason I brought this up is that rTCA - the exact reverse of the Krebs cycle in aerobic respiration, is carbon fixation but not respiration.\n\n\n\n\nMethanogens both fix CO2, i.e. carbon fixation but this is also their pathway of respiration.\n\n\n\n\n\n\n\nAs for citations, most of this pretty basic so:\n\n\n\n\nLactic acid.\nAlberts, B., et al. (2014). Molecular Biology of the Cell (6th ed.). Garland Science. (https://rads.stackoverflow.com/amzn/click/com/0815344325)\n\n\n\n\nSulfur reduction and alcohol fermentation\nMadigan, M. T., et al (2020). Brock Biology of Microorganisms (16th ed.). Pearson. (https://rads.stackoverflow.com/amzn/click/com/0135845688)\n\n\n\n\nFor methanogenesis (what I know most about):\nThauer, R. K., and Shima, S. (2008). \"Methane as Fuel for Anaerobic Microorganisms.\" Annual Review of Microbiology, 62(1), 43–64.\n\n\n\n\n\n\n\nFinal point, just waving my arms about a bit, I'd suggest the diversity of anaerobic respiration infers one of these was the ancestral pathway of respiration (it's a hot topic).", "answer_url": "https://biology.stackexchange.com/a/115724", "author": "user75152", "author_url": null, "author_user_type": "does_not_exist", "content_license": "CC BY-SA 4.0", "created_at": "2024-12-02T22:36:30+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:22.614155+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/2c8799380b8f5d7bf0fd42e594fd78a1835b27e1da9f481cc00f096bab9c01ca_0.json", "raw_sha256": "348375a094fdfd6d9ca55d0bddc65d8dc7a7f0757e1e5a44c25e22a66b1a4892", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/116119;116113;116097;116096;116091;116087;116076;116067;116063;116059;116055;116037;116034;116028;116022;116012;116005;115997;115989;115988;115987;115979;115978;115976;115974;115973;115970;115966;115965;115957;115952;115939;115933;115932;115927;115921;115915;115903;115897;115894;115886;115885;115884;115881;115880;115868;115867;115857;115852;115840;115830;115825;115819;115815;115791;115780;115773;115764;115759;115756;115743;115736;115726;115723;115713;115699;115691;115689;115685;115678;115668;115664;115657;115650;115642;115639;115632;115627;115626;115609;115602;115598;115592;115588;115587;115580;115578;115570;115566;115562;115549;115537;115536;115531;115530;115528;115525;115521;115513;115510/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 115723, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "user75152", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2024-12-02T22:36:30+00:00", "raw_file": "raw/codex_api_v1/e9f8d53002b67c70a1e0faa4e07e18311daa0dd2e2a655222036d0cc60803d5a_1790824104499255500_0.json", "raw_sha256": "7675135c0936bb0999aeac9143b12cafaa9f0b2130abeca1b246467c5d0b26d5", "revision_guid": "AC80A021-832B-4D19-88BB-3818F94BBDBE", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/AC80A021-832B-4D19-88BB-3818F94BBDBE/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "user75152", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2024-12-02T22:43:53+00:00", "raw_file": "raw/codex_api_v1/e9f8d53002b67c70a1e0faa4e07e18311daa0dd2e2a655222036d0cc60803d5a_1790824104499255500_0.json", "raw_sha256": "7675135c0936bb0999aeac9143b12cafaa9f0b2130abeca1b246467c5d0b26d5", "revision_guid": "70DCC162-16CB-4003-8E64-23BBB58E5F0B", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/70DCC162-16CB-4003-8E64-23BBB58E5F0B/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "David", "profile_url": "https://biology.stackexchange.com/users/22057/david", "user_type": "registered"}, "created_at": "2024-12-02T23:22:49+00:00", "raw_file": "raw/codex_api_v1/e9f8d53002b67c70a1e0faa4e07e18311daa0dd2e2a655222036d0cc60803d5a_1790824104499255500_0.json", "raw_sha256": "7675135c0936bb0999aeac9143b12cafaa9f0b2130abeca1b246467c5d0b26d5", "revision_guid": "7EC08DAF-F0B2-437A-8672-1B3CC9481653", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/7EC08DAF-F0B2-437A-8672-1B3CC9481653/view-source"}], "score": 0, "updated_at": "2024-12-02T23:22:49+00:00"}, {"answer_html": "

Terminology

\n
\n

“I teach that anaerobic respiration and fermentation are different.”

\n
\n

Although not conforming to the historic or lay use of the terms “respiration” and “fermentation” the poster is correct regarding the current scientific usage of these terms, as evidenced by the following quotations from the Wikipedia article on fermentation:

\n
\n

“The definition of fermentation has evolved over the years. The most\nmodern definition is catabolism where organic compounds are both the\nelectron donor and acceptor. A common electron donor is glucose, and\npyruvate is a common electron acceptor. This definition distinguishes\nfermentation from aerobic respiration, where oxygen is the acceptor,\nand types of anaerobic respiration where inorganic compound is the\nacceptor.”

\n
\n

This is developed in more detail in the Wikipedia article on Anaerobic respiration.

\n

However, given the confusing nature of the terminology, if I were teaching this myself I would first stress the fundamental difference between the two ways of converting metabolic ‘energy’ to ATP: 1. Directly phosphorylating ADP in a metabolic reaction, and 2. Establishing an electrochemical gradient across a membrane that drives the multi-subunit ATP synthase that produces ATP from ADP and inorganic phosphate. Indeed, depending on the background of one’s students, the use of the word “oxidation” to “mean removal of electrons” may need emphasizing.

\n

N.B. The regeneration of NADH+ in fermentation is to allow the process to continue at all, not to accelerate 16x or by any other factor as stated in the question.

\n

Necessity of the Tricarboxylic Acid Cycle for Anaerobic Respiration

\n
\n

“Do anaerobic organisms that have a terminal electron acceptor other\nthan oxygen have a Citric Acid cycle?”

\n
\n

No, not necessarily.
Some may, but others only have genes for some of the enzymes of the tricarboxylic acid cycle, as a genomic analysis by Huynen et al. demonstrated (relevant details in footnote).

\n
\n

I say that the process is the “same“ as aerobic respiration just a\ndifferent electron acceptor.

\n
\n

No, that is incorrect.
Certainly a system analagous to the mitochondrial electron transport system must be present to establish an electrochemical gradient. However the assumption that the process is the same in other respects and “glucose/pyruvate/acetyl-CoA” must be involved and provide the electrons through generation of NADH in the tricarboxylic acid cycle is unfounded. Bacteria that utilize ‘unusual’ terminal electron acceptors generally occupy ‘unusual’ ecological niches, with ‘unusual’ sources of carbon and reducing power.

\n

An example: bacteria of the Desulfovibrio genus

\n

I found it difficult to find detailed metabolic information about bacteria which employ terminal electron acceptor other than oxygen. This may reflect the fact that many occupy extreme ecological niches and are difficult to study in the laboratory. In addition the situation is often confused by alternative methods of oxidation (some are also fermenters) and the possibility of symbiotic relationships with other bacteria). One more tractible example is found in members of the Desulfovibrio genus, which employ sulphate as their terminal electron acceptor, and use hydrogen and various organic acids as the source of reductive energy. With metabolic observations supplemented by genomic and transcriptomic analysis the model below has been proposed for the flow of electrons during sulphate respiration in D. vulgaris.

\n

\"Sulphate

\n

From a 2011 review by Keller and Wall which should be consulted for further details.

\n

It should be emphasized that the pyruvate generated when lactate is oxidized is converted to acetate as an end-product and not converted into acetyl-CoA for input into a tricarboxylic acid cycle. Genome sequencing indicates that genes for most of the enzymes of the cycle are present, except for citrate synthase and perhaps 2-ketoglutarate dehydrogenase. It should be explained that the presence of an incomplete tricarboxylic acid cycle allows other metabolic interconversions to occur, and, to quote Huynen et al.,

\n
\n

“it has been argued that the CAC evolved originally as two separate\npathways stemming from pyruvate, with an oxidative branch leading to\n2-ketoglutarate and a reductive branch leading to succinyl CoA\n[Melendez-Hevia, E., Wadell, T.G. and Cascante, M. (1996) J. Mol.\nEvol. 43, 293–303]”.

\n
\n

Footnote: Hynen et al. and incomplete tricarboxylic acid cycles

\n

At least one of the bacteria the genome of which Hynen et al. found to lack enzymes of the tricarboxylic acid cycle — Methanocaldococcus jannaschii — uses an alternative electron acceptor. It is only capable of growth on carbon dioxide and hydrogen as an energy source, and lacks genes for the first three enzymes of the oxidative cycle: citrate synthase, iconitase and isocitrate dehydrogenase. A detailed consideration of the energetics of such methanogens can be found in a review by Thauer et al..

\n", "answer_id": 115776, "answer_text": "Terminology\n\n\n\n\n\n\n\n“I teach that anaerobic respiration and fermentation are different.”\n\n\n\n\n\n\n\nAlthough not conforming to the historic or lay use of the terms “respiration” and “fermentation” the poster is correct regarding the current scientific usage of these terms, as evidenced by the following quotations from the Wikipedia article on fermentation (https://en.wikipedia.org/wiki/Fermentation):\n\n\n\n\n\n\n\n“The definition of fermentation has evolved over the years. The most\nmodern definition is catabolism where organic compounds are both the\nelectron donor and acceptor. A common electron donor is glucose, and\npyruvate is a common electron acceptor. This definition distinguishes\nfermentation from aerobic respiration, where oxygen is the acceptor,\nand types of anaerobic respiration where inorganic compound is the\nacceptor.”\n\n\n\n\n\n\n\nThis is developed in more detail in the Wikipedia article on Anaerobic respiration (https://en.wikipedia.org/wiki/Anaerobic_respiration).\n\n\n\n\nHowever, given the confusing nature of the terminology, if I were teaching this myself I would first stress the fundamental difference between the two ways of converting metabolic ‘energy’ to ATP: 1. Directly phosphorylating ADP in a metabolic reaction, and 2. Establishing an electrochemical gradient across a membrane that drives the multi-subunit ATP synthase that produces ATP from ADP and inorganic phosphate. Indeed, depending on the background of one’s students, the use of the word “oxidation” to “mean removal of electrons” may need emphasizing.\n\n\n\n\nN.B. The regeneration of NADH+ in fermentation is to allow the process to continue at all, not to accelerate 16x or by any other factor as stated in the question.\n\n\n\n\nNecessity of the Tricarboxylic Acid Cycle for Anaerobic Respiration\n\n\n\n\n\n\n\n“Do anaerobic organisms that have a terminal electron acceptor other\nthan oxygen have a Citric Acid cycle?”\n\n\n\n\n\n\n\nNo, not necessarily. \nSome may, but others only have genes for some of the enzymes of the tricarboxylic acid cycle, as a genomic analysis by Huynen et al. (https://pubmed.ncbi.nlm.nih.gov/10390638/) demonstrated (relevant details in footnote).\n\n\n\n\n\n\n\nI say that the process is the “same“ as aerobic respiration just a\ndifferent electron acceptor.\n\n\n\n\n\n\n\nNo, that is incorrect. \nCertainly a system analagous to the mitochondrial electron transport system must be present to establish an electrochemical gradient. However the assumption that the process is the same in other respects and “glucose/pyruvate/acetyl-CoA” must be involved and provide the electrons through generation of NADH in the tricarboxylic acid cycle is unfounded. Bacteria that utilize ‘unusual’ terminal electron acceptors generally occupy ‘unusual’ ecological niches, with ‘unusual’ sources of carbon and reducing power.\n\n\n\n\nAn example: bacteria of the Desulfovibrio genus\n\n\n\n\nI found it difficult to find detailed metabolic information about bacteria which employ terminal electron acceptor other than oxygen. This may reflect the fact that many occupy extreme ecological niches and are difficult to study in the laboratory. In addition the situation is often confused by alternative methods of oxidation (some are also fermenters) and the possibility of symbiotic relationships with other bacteria). One more tractible example is found in members of the Desulfovibrio genus, which employ sulphate as their terminal electron acceptor, and use hydrogen and various organic acids as the source of reductive energy. With metabolic observations supplemented by genomic and transcriptomic analysis the model below has been proposed for the flow of electrons during sulphate respiration in D. vulgaris.\n\n\n\n\n[image: Sulphate reduction; source: https://i.sstatic.net/Z4WNApom.png] (https://i.sstatic.net/Z4WNApom.png)\n\n\n\n\nFrom a 2011 review by Keller and Wall (https://www.frontiersin.org/journals/microbiology/articles/10.3389/fmicb.2011.00135) which should be consulted for further details.\n\n\n\n\nIt should be emphasized that the pyruvate generated when lactate is oxidized is converted to acetate as an end-product and not converted into acetyl-CoA for input into a tricarboxylic acid cycle. Genome sequencing (https://www.nature.com/articles/nbt959) indicates that genes for most of the enzymes of the cycle are present, except for citrate synthase and perhaps 2-ketoglutarate dehydrogenase. It should be explained that the presence of an incomplete tricarboxylic acid cycle allows other metabolic interconversions to occur, and, to quote Huynen et al.,\n\n\n\n\n\n\n\n“it has been argued that the CAC evolved originally as two separate\npathways stemming from pyruvate, with an oxidative branch leading to\n2-ketoglutarate and a reductive branch leading to succinyl CoA\n[Melendez-Hevia, E., Wadell, T.G. and Cascante, M. (1996) J. Mol.\nEvol. 43, 293–303]”.\n\n\n\n\n\n\n\nFootnote: Hynen et al. and incomplete tricarboxylic acid cycles\n\n\n\n\nAt least one of the bacteria the genome of which Hynen et al. found to lack enzymes of the tricarboxylic acid cycle — Methanocaldococcus jannaschii — uses an alternative electron acceptor. It is only capable of growth on carbon dioxide and hydrogen as an energy source, and lacks genes for the first three enzymes of the oxidative cycle: citrate synthase, iconitase and isocitrate dehydrogenase. A detailed consideration of the energetics of such methanogens can be found in a review by Thauer et al. (https://www.nature.com/articles/nrmicro1931).", "answer_url": "https://biology.stackexchange.com/a/115776", "author": "David", "author_url": "https://biology.stackexchange.com/users/22057/david", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2024-12-11T18:15:38+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:22.614155+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/2c8799380b8f5d7bf0fd42e594fd78a1835b27e1da9f481cc00f096bab9c01ca_0.json", "raw_sha256": "348375a094fdfd6d9ca55d0bddc65d8dc7a7f0757e1e5a44c25e22a66b1a4892", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/116119;116113;116097;116096;116091;116087;116076;116067;116063;116059;116055;116037;116034;116028;116022;116012;116005;115997;115989;115988;115987;115979;115978;115976;115974;115973;115970;115966;115965;115957;115952;115939;115933;115932;115927;115921;115915;115903;115897;115894;115886;115885;115884;115881;115880;115868;115867;115857;115852;115840;115830;115825;115819;115815;115791;115780;115773;115764;115759;115756;115743;115736;115726;115723;115713;115699;115691;115689;115685;115678;115668;115664;115657;115650;115642;115639;115632;115627;115626;115609;115602;115598;115592;115588;115587;115580;115578;115570;115566;115562;115549;115537;115536;115531;115530;115528;115525;115521;115513;115510/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 115723, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "David", "profile_url": "https://biology.stackexchange.com/users/22057/david", "user_type": "registered"}, "created_at": "2024-12-11T18:15:38+00:00", "raw_file": "raw/codex_api_v1/5ced1a9f1ef6cec4e5ea414f5920558abe1f2afe671db804d768d0c0886f0b02_1790824127343029500_0.json", "raw_sha256": "9b7f4987291adc582d9a7ae47056606e7a91fc10c512e504e60da3797727c346", "revision_guid": "EC89ACAE-F300-4808-9F1A-B09FCA958DA4", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/EC89ACAE-F300-4808-9F1A-B09FCA958DA4/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "David", "profile_url": "https://biology.stackexchange.com/users/22057/david", "user_type": "registered"}, "created_at": "2024-12-11T18:22:27+00:00", "raw_file": "raw/codex_api_v1/5ced1a9f1ef6cec4e5ea414f5920558abe1f2afe671db804d768d0c0886f0b02_1790824127343029500_0.json", "raw_sha256": "9b7f4987291adc582d9a7ae47056606e7a91fc10c512e504e60da3797727c346", "revision_guid": "CCE679AB-6001-4F9B-90F3-7081E8516525", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/CCE679AB-6001-4F9B-90F3-7081E8516525/view-source"}], "score": 1, "updated_at": "2024-12-11T18:22:27+00:00"}], "domain": "biology", "external_links": ["https://en.wikipedia.org/wiki/Anaerobic_respiration", "https://en.wikipedia.org/wiki/Fermentation", "https://i.sstatic.net/Z4WNApom.png", "https://pubmed.ncbi.nlm.nih.gov/10390638/", "https://rads.stackoverflow.com/amzn/click/com/0135845688", "https://rads.stackoverflow.com/amzn/click/com/0815344325", "https://www.frontiersin.org/journals/microbiology/articles/10.3389/fmicb.2011.00135", "https://www.nature.com/articles/nbt959", "https://www.nature.com/articles/nrmicro1931"], "medical_sensitive": false, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:04.377249+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/54ece81cba3a5a552bb15d6d3feedc4324a2ba2706d33480080ece9537efd4b1_0.json", "raw_sha256": "f1eb8f7eda9336b81701b663029f9411e040c0bcf262148b7ede9a103ae73e69", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=4&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Diane Vorbroker", "question_author_url": "https://biology.stackexchange.com/users/92986/diane-vorbroker", "question_author_user_type": "registered", "question_created_at": "2024-12-02T21:55:47+00:00", "question_html": "

I have been teaching for a while (College level) and wish to check the accuracy of my material. I teach that anaerobic respiration and fermentation are different. In fermentation the NAD+ are re-generated and Glycolysis can go ~16x faster. But when I talk about anaerobic respiration I say that the process is the "same" as aerobic respiration just a different electron acceptor. But I admit I don't know much more than that, and as I do research, for example into sulfur-reducing bacteria, I am not finding clear information.

\n

I've been assuming that strict anaerobes don't just rely on fermentation and utilize an Electron transport chain to generate ATP. But do they use a cycle like the Citric Acid cycle? In other words can they fully oxidize glucose/pyruvate/acetyl-CoA?

\n

If they don't fully oxidize glucose and/or pyruvate, what are the consequences of building up pyruvate (biochemically)?

\n

If they don't fully oxidize glucose, how do they produce enough electron carriers (NADH, FADH2) to make enough ATP in their ETC? Or do they just require less ATP per glucose to survive?

\n", "question_id": 115723, "question_license": "CC BY-SA 4.0", "question_score": 1, "question_text": "I have been teaching for a while (College level) and wish to check the accuracy of my material. I teach that anaerobic respiration and fermentation are different. In fermentation the NAD+ are re-generated and Glycolysis can go ~16x faster. But when I talk about anaerobic respiration I say that the process is the \"same\" as aerobic respiration just a different electron acceptor. But I admit I don't know much more than that, and as I do research, for example into sulfur-reducing bacteria, I am not finding clear information.\n\n\n\n\nI've been assuming that strict anaerobes don't just rely on fermentation and utilize an Electron transport chain to generate ATP. But do they use a cycle like the Citric Acid cycle? In other words can they fully oxidize glucose/pyruvate/acetyl-CoA?\n\n\n\n\nIf they don't fully oxidize glucose and/or pyruvate, what are the consequences of building up pyruvate (biochemically)?\n\n\n\n\nIf they don't fully oxidize glucose, how do they produce enough electron carriers (NADH, FADH2) to make enough ATP in their ETC? Or do they just require less ATP per glucose to survive?", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Diane Vorbroker", "profile_url": "https://biology.stackexchange.com/users/92986/diane-vorbroker", "user_type": "registered"}, "created_at": "2024-12-02T21:55:47+00:00", "raw_file": "raw/codex_api_v1/e9f8d53002b67c70a1e0faa4e07e18311daa0dd2e2a655222036d0cc60803d5a_1790824104499255500_0.json", "raw_sha256": "7675135c0936bb0999aeac9143b12cafaa9f0b2130abeca1b246467c5d0b26d5", "revision_guid": "564C4E2F-5FDE-4ED7-A67A-6845C17DA0E8", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/564C4E2F-5FDE-4ED7-A67A-6845C17DA0E8/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "David", "profile_url": "https://biology.stackexchange.com/users/22057/david", "user_type": "registered"}, "created_at": "2024-12-11T18:23:51+00:00", "raw_file": "raw/codex_api_v1/e9f8d53002b67c70a1e0faa4e07e18311daa0dd2e2a655222036d0cc60803d5a_1790824104499255500_0.json", "raw_sha256": "7675135c0936bb0999aeac9143b12cafaa9f0b2130abeca1b246467c5d0b26d5", "revision_guid": "719EDC28-AFAF-4522-A573-BE67070728AB", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/719EDC28-AFAF-4522-A573-BE67070728AB/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "David", "profile_url": "https://biology.stackexchange.com/users/22057/david", "user_type": "registered"}, "created_at": "2024-12-11T22:16:03+00:00", "raw_file": "raw/codex_api_v1/e9f8d53002b67c70a1e0faa4e07e18311daa0dd2e2a655222036d0cc60803d5a_1790824104499255500_0.json", "raw_sha256": "7675135c0936bb0999aeac9143b12cafaa9f0b2130abeca1b246467c5d0b26d5", "revision_guid": "15577551-9526-4877-BC48-61EAB5D7E883", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/15577551-9526-4877-BC48-61EAB5D7E883/view-source"}, {"content_license": null, "contributor": {"display_name": "Community", "profile_url": "https://biology.stackexchange.com/users/-1/community", "user_type": "moderator"}, "created_at": "2025-01-10T23:08:15+00:00", "raw_file": "raw/codex_api_v1/e9f8d53002b67c70a1e0faa4e07e18311daa0dd2e2a655222036d0cc60803d5a_1790824104499255500_0.json", "raw_sha256": "7675135c0936bb0999aeac9143b12cafaa9f0b2130abeca1b246467c5d0b26d5", "revision_guid": "005E1913-9806-4E74-8578-9FE352D32049", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://biology.stackexchange.com/revisions/005E1913-9806-4E74-8578-9FE352D32049/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "David", "profile_url": "https://biology.stackexchange.com/users/22057/david", "user_type": "registered"}, "created_at": "2025-01-12T11:48:08+00:00", "raw_file": "raw/codex_api_v1/e9f8d53002b67c70a1e0faa4e07e18311daa0dd2e2a655222036d0cc60803d5a_1790824104499255500_0.json", "raw_sha256": "7675135c0936bb0999aeac9143b12cafaa9f0b2130abeca1b246467c5d0b26d5", "revision_guid": "F8B70CBD-B20A-4A4F-B255-42294C4ECA3B", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/F8B70CBD-B20A-4A4F-B255-42294C4ECA3B/view-source"}], "source_site": "biology", "source_url": "https://biology.stackexchange.com/questions/115723/do-anaerobic-organisms-that-have-a-terminal-electron-acceptor-other-than-oxygen", "split": "train", "split_group": "be53f0970504c6f2525aba03eefd384163977400c0291c9f5a26388e28a4453d", "tags": ["biochemistry", "anaerobic-respiration"], "thread_id": "biology:115723", "title": "Do anaerobic organisms that have a terminal electron acceptor other than oxygen have a Citric Acid cycle?"}} {"accepted_status": [true, false], "candidate_answers": [{"answer_html": "

Mice will easily manage 3 metres of swimming. I think that they can even swim under water for around this distance, as according to Animalanswers.com, they can hold their breath for up to 3 minutes and one study1 found that they could cover 40 cm (15.7 in) in about 4-6 seconds.

\n

New Zealand is the expert on rodent elimination and has been successful in removal of mice (and other rodents) from a range of islands within its territories and is attempting to do more. For this reason, their Department of Conservation has a number of experts who have published information on mice and their eradication, including details on re-introduction via natural means.

\n

One publication (Broome et al, 20192) mentions that mice have been found swimming up to 600 metres (1980 feet) from the shore during a mouse plague (lots of mice, not plague as a disease) and islands assumed to be a safe distance (up to 600 m/1980 feet) from shore were re-invaded within 10 years of eradication, though the exact method is unknown and might have been from rafting on floating debris.

\n

Ref:

\n
    \n
  1. Hult, E.M., Bingaman, M.J. & Swoap, S.J. A robust diving response in the laboratory mouse. J Comp Physiol B 189, 685–692 (2019). https://doi.org/10.1007/s00360-019-01237-5

    \n
  2. \n
  3. K. Broome, D. Brown, K. Brown, E. Murphy, C. Birmingham, C. Golding, P. Corson, A. Cox and R. Griffith. House mice on islands: management and lessons from New Zealand. In: R. Veitch, M.N. Clout, A.R. Martin, J.C. Russell and C.J. West (eds.) (2019). Island invasives: scaling up to meet the challenge, pp. 100–107. Occasional Paper SSC no. 62. Gland, Switzerland: IUCN

    \n
  4. \n
\n", "answer_id": 116029, "answer_text": "Mice will easily manage 3 metres of swimming. I think that they can even swim under water for around this distance, as according to Animalanswers.com (https://animalsanswers.com/can-mice-swim/), they can hold their breath for up to 3 minutes and one study (https://link.springer.com/article/10.1007/s00360-019-01237-5)1 found that they could cover 40 cm (15.7 in) in about 4-6 seconds.\n\n\n\n\nNew Zealand is the expert on rodent elimination and has been successful in removal of mice (and other rodents) from a range of islands within its territories and is attempting to do more. For this reason, their Department of Conservation (https://www.doc.govt.nz/) has a number of experts who have published information on mice and their eradication, including details on re-introduction via natural means.\n\n\n\n\nOne publication (https://www.islandconservation.org/wp-content/uploads/2020/04/House-mice-on-islands-management-and-lessons-from-New-Zealand-Island-invasives-scaling-up-to-meet-the-challenge.pdf) (Broome et al, 20192) mentions that mice have been found swimming up to 600 metres (1980 feet) from the shore during a mouse plague (lots of mice, not plague as a disease) and islands assumed to be a safe distance (up to 600 m/1980 feet) from shore were re-invaded within 10 years of eradication, though the exact method is unknown and might have been from rafting on floating debris.\n\n\n\n\nRef:\n\n\n\n\n\n\n\nHult, E.M., Bingaman, M.J. & Swoap, S.J. A robust diving response in the laboratory mouse. J Comp Physiol B 189, 685–692 (2019). https://doi.org/10.1007/s00360-019-01237-5 (https://doi.org/10.1007/s00360-019-01237-5)\n\n\n\n\n\n\n\n\n\nK. Broome, D. Brown, K. Brown, E. Murphy, C. Birmingham, C. Golding, P. Corson, A. Cox and R. Griffith. House mice on islands: management and lessons from New Zealand. In: R. Veitch, M.N. Clout, A.R. Martin, J.C. Russell and C.J. West (eds.) (2019). Island invasives: scaling up to meet the challenge, pp. 100–107. Occasional Paper SSC no. 62. Gland, Switzerland: IUCN", "answer_url": "https://biology.stackexchange.com/a/116029", "author": "bob1", "author_url": "https://biology.stackexchange.com/users/65284/bob1", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-01-28T20:27:41+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:22.614155+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/2c8799380b8f5d7bf0fd42e594fd78a1835b27e1da9f481cc00f096bab9c01ca_0.json", "raw_sha256": "348375a094fdfd6d9ca55d0bddc65d8dc7a7f0757e1e5a44c25e22a66b1a4892", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/116119;116113;116097;116096;116091;116087;116076;116067;116063;116059;116055;116037;116034;116028;116022;116012;116005;115997;115989;115988;115987;115979;115978;115976;115974;115973;115970;115966;115965;115957;115952;115939;115933;115932;115927;115921;115915;115903;115897;115894;115886;115885;115884;115881;115880;115868;115867;115857;115852;115840;115830;115825;115819;115815;115791;115780;115773;115764;115759;115756;115743;115736;115726;115723;115713;115699;115691;115689;115685;115678;115668;115664;115657;115650;115642;115639;115632;115627;115626;115609;115602;115598;115592;115588;115587;115580;115578;115570;115566;115562;115549;115537;115536;115531;115530;115528;115525;115521;115513;115510/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 116028, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "bob1", "profile_url": "https://biology.stackexchange.com/users/65284/bob1", "user_type": "registered"}, "created_at": "2025-01-28T20:27:41+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "CED0365C-547D-43CD-9076-7E6B17F8992E", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/CED0365C-547D-43CD-9076-7E6B17F8992E/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "bob1", "profile_url": "https://biology.stackexchange.com/users/65284/bob1", "user_type": "registered"}, "created_at": "2025-01-29T00:21:17+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "6EFDEF94-3398-4C0B-AD5B-AF2652E55C04", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/6EFDEF94-3398-4C0B-AD5B-AF2652E55C04/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "bob1", "profile_url": "https://biology.stackexchange.com/users/65284/bob1", "user_type": "registered"}, "created_at": "2025-01-29T19:24:14+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "1C3E1E0B-F189-4245-A0C0-78148E1EFA9E", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/1C3E1E0B-F189-4245-A0C0-78148E1EFA9E/view-source"}], "score": 27, "updated_at": "2025-01-29T19:24:14+00:00"}, {"answer_html": "

They can swim more than a hundred times that distance.

\n

According to studies done by rodent infiltration of islands a house mouse can swim around 500 meters max assuming still water.

\n

Swim speed for mice in mazes is around 15cm per second so they can swim your distance in about 20 seconds. Rodents are good swimmers which is why rivers makes a poor barrier to the spread of rodents.

\n

More details in links:

\n

How far rodents can swim

\n

Swim speed

\n", "answer_id": 116030, "answer_text": "They can swim more than a hundred times that distance.\n\n\n\n\nAccording to studies done by rodent infiltration of islands a house mouse can swim around 500 meters max assuming still water.\n\n\n\n\nSwim speed for mice in mazes is around 15cm per second so they can swim your distance in about 20 seconds. Rodents are good swimmers which is why rivers makes a poor barrier to the spread of rodents.\n\n\n\n\nMore details in links:\n\n\n\n\nHow far rodents can swim (https://biosecurityforlife.org.uk/resources/detail/how-far-can-rodents-swim)\n\n\n\n\nSwim speed (https://www.researchgate.net/figure/A-Graph-showing-the-swim-speed-of-mice-in-the-different-groups-during-the-screening_fig1_339682177)", "answer_url": "https://biology.stackexchange.com/a/116030", "author": "John", "author_url": "https://biology.stackexchange.com/users/28022/john", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-01-28T22:16:04+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:22.614155+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/2c8799380b8f5d7bf0fd42e594fd78a1835b27e1da9f481cc00f096bab9c01ca_0.json", "raw_sha256": "348375a094fdfd6d9ca55d0bddc65d8dc7a7f0757e1e5a44c25e22a66b1a4892", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/116119;116113;116097;116096;116091;116087;116076;116067;116063;116059;116055;116037;116034;116028;116022;116012;116005;115997;115989;115988;115987;115979;115978;115976;115974;115973;115970;115966;115965;115957;115952;115939;115933;115932;115927;115921;115915;115903;115897;115894;115886;115885;115884;115881;115880;115868;115867;115857;115852;115840;115830;115825;115819;115815;115791;115780;115773;115764;115759;115756;115743;115736;115726;115723;115713;115699;115691;115689;115685;115678;115668;115664;115657;115650;115642;115639;115632;115627;115626;115609;115602;115598;115592;115588;115587;115580;115578;115570;115566;115562;115549;115537;115536;115531;115530;115528;115525;115521;115513;115510/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 116028, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "John", "profile_url": "https://biology.stackexchange.com/users/28022/john", "user_type": "registered"}, "created_at": "2025-01-28T22:16:04+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "7B149A09-1BBD-4DD8-B2FB-A6F99F40FC11", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/7B149A09-1BBD-4DD8-B2FB-A6F99F40FC11/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "John", "profile_url": "https://biology.stackexchange.com/users/28022/john", "user_type": "registered"}, "created_at": "2025-01-29T01:23:45+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "D8E06707-BEA5-49B0-B420-C028E46A0D77", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/D8E06707-BEA5-49B0-B420-C028E46A0D77/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Piro", "profile_url": "https://biology.stackexchange.com/users/30108/piro", "user_type": "registered"}, "created_at": "2025-01-29T21:36:48+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "F5416522-89AB-4A3E-AE2B-5632FF0F6124", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/F5416522-89AB-4A3E-AE2B-5632FF0F6124/view-source"}], "score": 23, "updated_at": "2025-01-29T21:36:48+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "According to other questions on this site (1 (https://biology.stackexchange.com/q/7592/77558), 2 (https://biology.stackexchange.com/q/1827/77558)), mammals should generally be able to swim to some extent. Wikipedia (https://en.wikipedia.org/wiki/House_mouse#Behavior) currently claims that \"Mice are good jumpers, climbers, and swimmers, … [citation needed]\".\n\n\n\n\nIf a\n\n\n\n\n\ncommon non-domesticated house mouse (Mus musculus, of EU origin if that matters);\n\n\n\n\nunexpectedly falls from a height of about 50 cm (some 20 inches); and\n\n\n\n\ninto clean fresh room-temperature water;\n\n\n\n\n\nwill it be able to swim for approx. 3 metres (roughly the length of a ten-foot pole) when its life depends on it?", "record_id": "Scientific-Answer-Ranking:biology:116028", "scores": [27, 23], "split": "train", "thread": {"accepted_answer_id": 116029, "answers": [{"answer_html": "

Mice will easily manage 3 metres of swimming. I think that they can even swim under water for around this distance, as according to Animalanswers.com, they can hold their breath for up to 3 minutes and one study1 found that they could cover 40 cm (15.7 in) in about 4-6 seconds.

\n

New Zealand is the expert on rodent elimination and has been successful in removal of mice (and other rodents) from a range of islands within its territories and is attempting to do more. For this reason, their Department of Conservation has a number of experts who have published information on mice and their eradication, including details on re-introduction via natural means.

\n

One publication (Broome et al, 20192) mentions that mice have been found swimming up to 600 metres (1980 feet) from the shore during a mouse plague (lots of mice, not plague as a disease) and islands assumed to be a safe distance (up to 600 m/1980 feet) from shore were re-invaded within 10 years of eradication, though the exact method is unknown and might have been from rafting on floating debris.

\n

Ref:

\n
    \n
  1. Hult, E.M., Bingaman, M.J. & Swoap, S.J. A robust diving response in the laboratory mouse. J Comp Physiol B 189, 685–692 (2019). https://doi.org/10.1007/s00360-019-01237-5

    \n
  2. \n
  3. K. Broome, D. Brown, K. Brown, E. Murphy, C. Birmingham, C. Golding, P. Corson, A. Cox and R. Griffith. House mice on islands: management and lessons from New Zealand. In: R. Veitch, M.N. Clout, A.R. Martin, J.C. Russell and C.J. West (eds.) (2019). Island invasives: scaling up to meet the challenge, pp. 100–107. Occasional Paper SSC no. 62. Gland, Switzerland: IUCN

    \n
  4. \n
\n", "answer_id": 116029, "answer_text": "Mice will easily manage 3 metres of swimming. I think that they can even swim under water for around this distance, as according to Animalanswers.com (https://animalsanswers.com/can-mice-swim/), they can hold their breath for up to 3 minutes and one study (https://link.springer.com/article/10.1007/s00360-019-01237-5)1 found that they could cover 40 cm (15.7 in) in about 4-6 seconds.\n\n\n\n\nNew Zealand is the expert on rodent elimination and has been successful in removal of mice (and other rodents) from a range of islands within its territories and is attempting to do more. For this reason, their Department of Conservation (https://www.doc.govt.nz/) has a number of experts who have published information on mice and their eradication, including details on re-introduction via natural means.\n\n\n\n\nOne publication (https://www.islandconservation.org/wp-content/uploads/2020/04/House-mice-on-islands-management-and-lessons-from-New-Zealand-Island-invasives-scaling-up-to-meet-the-challenge.pdf) (Broome et al, 20192) mentions that mice have been found swimming up to 600 metres (1980 feet) from the shore during a mouse plague (lots of mice, not plague as a disease) and islands assumed to be a safe distance (up to 600 m/1980 feet) from shore were re-invaded within 10 years of eradication, though the exact method is unknown and might have been from rafting on floating debris.\n\n\n\n\nRef:\n\n\n\n\n\n\n\nHult, E.M., Bingaman, M.J. & Swoap, S.J. A robust diving response in the laboratory mouse. J Comp Physiol B 189, 685–692 (2019). https://doi.org/10.1007/s00360-019-01237-5 (https://doi.org/10.1007/s00360-019-01237-5)\n\n\n\n\n\n\n\n\n\nK. Broome, D. Brown, K. Brown, E. Murphy, C. Birmingham, C. Golding, P. Corson, A. Cox and R. Griffith. House mice on islands: management and lessons from New Zealand. In: R. Veitch, M.N. Clout, A.R. Martin, J.C. Russell and C.J. West (eds.) (2019). Island invasives: scaling up to meet the challenge, pp. 100–107. Occasional Paper SSC no. 62. Gland, Switzerland: IUCN", "answer_url": "https://biology.stackexchange.com/a/116029", "author": "bob1", "author_url": "https://biology.stackexchange.com/users/65284/bob1", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-01-28T20:27:41+00:00", "is_accepted": true, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:22.614155+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/2c8799380b8f5d7bf0fd42e594fd78a1835b27e1da9f481cc00f096bab9c01ca_0.json", "raw_sha256": "348375a094fdfd6d9ca55d0bddc65d8dc7a7f0757e1e5a44c25e22a66b1a4892", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/116119;116113;116097;116096;116091;116087;116076;116067;116063;116059;116055;116037;116034;116028;116022;116012;116005;115997;115989;115988;115987;115979;115978;115976;115974;115973;115970;115966;115965;115957;115952;115939;115933;115932;115927;115921;115915;115903;115897;115894;115886;115885;115884;115881;115880;115868;115867;115857;115852;115840;115830;115825;115819;115815;115791;115780;115773;115764;115759;115756;115743;115736;115726;115723;115713;115699;115691;115689;115685;115678;115668;115664;115657;115650;115642;115639;115632;115627;115626;115609;115602;115598;115592;115588;115587;115580;115578;115570;115566;115562;115549;115537;115536;115531;115530;115528;115525;115521;115513;115510/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 116028, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "bob1", "profile_url": "https://biology.stackexchange.com/users/65284/bob1", "user_type": "registered"}, "created_at": "2025-01-28T20:27:41+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "CED0365C-547D-43CD-9076-7E6B17F8992E", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/CED0365C-547D-43CD-9076-7E6B17F8992E/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "bob1", "profile_url": "https://biology.stackexchange.com/users/65284/bob1", "user_type": "registered"}, "created_at": "2025-01-29T00:21:17+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "6EFDEF94-3398-4C0B-AD5B-AF2652E55C04", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/6EFDEF94-3398-4C0B-AD5B-AF2652E55C04/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "bob1", "profile_url": "https://biology.stackexchange.com/users/65284/bob1", "user_type": "registered"}, "created_at": "2025-01-29T19:24:14+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "1C3E1E0B-F189-4245-A0C0-78148E1EFA9E", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/1C3E1E0B-F189-4245-A0C0-78148E1EFA9E/view-source"}], "score": 27, "updated_at": "2025-01-29T19:24:14+00:00"}, {"answer_html": "

They can swim more than a hundred times that distance.

\n

According to studies done by rodent infiltration of islands a house mouse can swim around 500 meters max assuming still water.

\n

Swim speed for mice in mazes is around 15cm per second so they can swim your distance in about 20 seconds. Rodents are good swimmers which is why rivers makes a poor barrier to the spread of rodents.

\n

More details in links:

\n

How far rodents can swim

\n

Swim speed

\n", "answer_id": 116030, "answer_text": "They can swim more than a hundred times that distance.\n\n\n\n\nAccording to studies done by rodent infiltration of islands a house mouse can swim around 500 meters max assuming still water.\n\n\n\n\nSwim speed for mice in mazes is around 15cm per second so they can swim your distance in about 20 seconds. Rodents are good swimmers which is why rivers makes a poor barrier to the spread of rodents.\n\n\n\n\nMore details in links:\n\n\n\n\nHow far rodents can swim (https://biosecurityforlife.org.uk/resources/detail/how-far-can-rodents-swim)\n\n\n\n\nSwim speed (https://www.researchgate.net/figure/A-Graph-showing-the-swim-speed-of-mice-in-the-different-groups-during-the-screening_fig1_339682177)", "answer_url": "https://biology.stackexchange.com/a/116030", "author": "John", "author_url": "https://biology.stackexchange.com/users/28022/john", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2025-01-28T22:16:04+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:22.614155+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/2c8799380b8f5d7bf0fd42e594fd78a1835b27e1da9f481cc00f096bab9c01ca_0.json", "raw_sha256": "348375a094fdfd6d9ca55d0bddc65d8dc7a7f0757e1e5a44c25e22a66b1a4892", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/116119;116113;116097;116096;116091;116087;116076;116067;116063;116059;116055;116037;116034;116028;116022;116012;116005;115997;115989;115988;115987;115979;115978;115976;115974;115973;115970;115966;115965;115957;115952;115939;115933;115932;115927;115921;115915;115903;115897;115894;115886;115885;115884;115881;115880;115868;115867;115857;115852;115840;115830;115825;115819;115815;115791;115780;115773;115764;115759;115756;115743;115736;115726;115723;115713;115699;115691;115689;115685;115678;115668;115664;115657;115650;115642;115639;115632;115627;115626;115609;115602;115598;115592;115588;115587;115580;115578;115570;115566;115562;115549;115537;115536;115531;115530;115528;115525;115521;115513;115510/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 116028, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "John", "profile_url": "https://biology.stackexchange.com/users/28022/john", "user_type": "registered"}, "created_at": "2025-01-28T22:16:04+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "7B149A09-1BBD-4DD8-B2FB-A6F99F40FC11", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/7B149A09-1BBD-4DD8-B2FB-A6F99F40FC11/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "John", "profile_url": "https://biology.stackexchange.com/users/28022/john", "user_type": "registered"}, "created_at": "2025-01-29T01:23:45+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "D8E06707-BEA5-49B0-B420-C028E46A0D77", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/D8E06707-BEA5-49B0-B420-C028E46A0D77/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Piro", "profile_url": "https://biology.stackexchange.com/users/30108/piro", "user_type": "registered"}, "created_at": "2025-01-29T21:36:48+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "F5416522-89AB-4A3E-AE2B-5632FF0F6124", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/F5416522-89AB-4A3E-AE2B-5632FF0F6124/view-source"}], "score": 23, "updated_at": "2025-01-29T21:36:48+00:00"}], "domain": "biology", "external_links": ["https://animalsanswers.com/can-mice-swim/", "https://biosecurityforlife.org.uk/resources/detail/how-far-can-rodents-swim", "https://doi.org/10.1007/s00360-019-01237-5", "https://en.wikipedia.org/wiki/House_mouse#Behavior", "https://link.springer.com/article/10.1007/s00360-019-01237-5", "https://www.doc.govt.nz/", "https://www.islandconservation.org/wp-content/uploads/2020/04/House-mice-on-islands-management-and-lessons-from-New-Zealand-Island-invasives-scaling-up-to-meet-the-challenge.pdf", "https://www.researchgate.net/figure/A-Graph-showing-the-swim-speed-of-mice-in-the-different-groups-during-the-screening_fig1_339682177"], "medical_sensitive": true, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:04.377249+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/54ece81cba3a5a552bb15d6d3feedc4324a2ba2706d33480080ece9537efd4b1_0.json", "raw_sha256": "f1eb8f7eda9336b81701b663029f9411e040c0bcf262148b7ede9a103ae73e69", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=4&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "TooTea", "question_author_url": "https://biology.stackexchange.com/users/77558/tootea", "question_author_user_type": "registered", "question_created_at": "2025-01-28T19:59:03+00:00", "question_html": "

According to other questions on this site (1, 2), mammals should generally be able to swim to some extent. Wikipedia currently claims that "Mice are good jumpers, climbers, and swimmers, … [citation needed]".

\n

If a

\n
    \n
  • common non-domesticated house mouse (Mus musculus, of EU origin if that matters);
  • \n
  • unexpectedly falls from a height of about 50 cm (some 20 inches); and
  • \n
  • into clean fresh room-temperature water;
  • \n
\n

will it be able to swim for approx. 3 metres (roughly the length of a ten-foot pole) when its life depends on it?

\n", "question_id": 116028, "question_license": "CC BY-SA 4.0", "question_score": 18, "question_text": "According to other questions on this site (1 (https://biology.stackexchange.com/q/7592/77558), 2 (https://biology.stackexchange.com/q/1827/77558)), mammals should generally be able to swim to some extent. Wikipedia (https://en.wikipedia.org/wiki/House_mouse#Behavior) currently claims that \"Mice are good jumpers, climbers, and swimmers, … [citation needed]\".\n\n\n\n\nIf a\n\n\n\n\n\ncommon non-domesticated house mouse (Mus musculus, of EU origin if that matters);\n\n\n\n\nunexpectedly falls from a height of about 50 cm (some 20 inches); and\n\n\n\n\ninto clean fresh room-temperature water;\n\n\n\n\n\nwill it be able to swim for approx. 3 metres (roughly the length of a ten-foot pole) when its life depends on it?", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "TooTea", "profile_url": "https://biology.stackexchange.com/users/77558/tootea", "user_type": "registered"}, "created_at": "2025-01-28T19:59:03+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "77CF6C20-1748-4227-8230-21979D0EFAC6", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/77CF6C20-1748-4227-8230-21979D0EFAC6/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2025-01-29T04:07:00+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "972B3B3D-6BCA-4002-A3C2-371E31EABF86", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://biology.stackexchange.com/revisions/972B3B3D-6BCA-4002-A3C2-371E31EABF86/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "willeM_ Van Onsem", "profile_url": "https://biology.stackexchange.com/users/14595/willem-van-onsem", "user_type": "registered"}, "created_at": "2025-01-29T10:34:45+00:00", "raw_file": "raw/codex_api_v1/b5cf9e7681589fdd0a03b17b5d31b32f33f38a7cf6e5ac27090a128a163b0540_1790824132485859700_0.json", "raw_sha256": "0ba2d7bf8064037255ed7e8ce785d71d15061c9d80c66749fdabc38844ca42a2", "revision_guid": "1C913928-263B-422A-8D5F-FAB212F9C3EC", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/1C913928-263B-422A-8D5F-FAB212F9C3EC/view-source"}], "source_site": "biology", "source_url": "https://biology.stackexchange.com/questions/116028/how-well-can-common-mice-swim", "split": "train", "split_group": "003092e93a4dabab0dcc816e4af6c11a694d0116fcdfda83a8d70dddc0f3082e", "tags": ["zoology", "mouse", "locomotion"], "thread_id": "biology:116028", "title": "How well can common mice swim?"}} {"accepted_status": [false, false, false, false], "candidate_answers": [{"answer_html": "

You're right to say that chemical reactions primarily involve the valence electrons of an atom. However, there are other factors that are key to understanding the difference in toxicity between lead and carbon. Mass isn’t really the explanation — correlation isn’t causation. Li and Be may be toxic in certain scenarios.

\n
    \n
  1. Some heavy metals share chemical similarities with essential elements our body uses. Lead, for example, can mimic calcium and sneak into important biological processes (e.g., disrupting neurotransmitter release by activating protein kinases).
  2. \n
  3. Oxidative Stress: Some heavy metals can generate free radicals or reactive oxygen species, due to their flexible oxidation states and redox potential, which damage cells. (https://www.intechopen.com/chapters/71913)
  4. \n
  5. Heavy metals tend to bioaccumulate and remain in organisms over time, specifically in the kidneys and liver. Because lead has no known biological role, there are no efficient excretion pathways for it. Carbon is continuously cycled through metabolic processes.
  6. \n
\n

Now, carbon's small atomic size and stable quadrivalent electron configuration allow it to form strong bonds with itself and other elements, creating the vast diversity of organic molecules crucial for life (like DNA, proteins, and carbohydrates). The inability to easily lose electrons prevents it from exhibiting these toxic behaviors in biological systems. Its chemistry is perfectly tailored for the organic molecular backbone.

\n

***It's important to note that not all heavy metals are inherently toxic. Some, like iron and copper, are essential for our body in small amounts.

\n

Good review article to read: https://www.frontiersin.org/journals/pharmacology/articles/10.3389/fphar.2021.643972/full

\n", "answer_id": 114877, "answer_text": "You're right to say that chemical reactions primarily involve the valence electrons of an atom. However, there are other factors that are key to understanding the difference in toxicity between lead and carbon. Mass isn’t really the explanation — correlation isn’t causation. Li and Be may be toxic in certain scenarios.\n\n\n\n\n\nSome heavy metals share chemical similarities with essential elements our body uses. Lead, for example, can mimic calcium and sneak into important biological processes (e.g., disrupting neurotransmitter release by activating protein kinases).\n\n\n\n\nOxidative Stress: Some heavy metals can generate free radicals or reactive oxygen species, due to their flexible oxidation states and redox potential, which damage cells. (https://www.intechopen.com/chapters/71913 (https://www.intechopen.com/chapters/71913))\n\n\n\n\nHeavy metals tend to bioaccumulate and remain in organisms over time, specifically in the kidneys and liver. Because lead has no known biological role, there are no efficient excretion pathways for it. Carbon is continuously cycled through metabolic processes.\n\n\n\n\n\nNow, carbon's small atomic size and stable quadrivalent electron configuration allow it to form strong bonds with itself and other elements, creating the vast diversity of organic molecules crucial for life (like DNA, proteins, and carbohydrates). The inability to easily lose electrons prevents it from exhibiting these toxic behaviors in biological systems. Its chemistry is perfectly tailored for the organic molecular backbone.\n\n\n\n\n***It's important to note that not all heavy metals are inherently toxic. Some, like iron and copper, are essential for our body in small amounts.\n\n\n\n\nGood review article to read: https://www.frontiersin.org/journals/pharmacology/articles/10.3389/fphar.2021.643972/full (https://www.frontiersin.org/journals/pharmacology/articles/10.3389/fphar.2021.643972/full)", "answer_url": "https://biology.stackexchange.com/a/114877", "author": "Ansh Tandon", "author_url": "https://biology.stackexchange.com/users/68056/ansh-tandon", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2024-06-17T19:57:50+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:27.977583+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/1cbf95322a17dce0fd00a109179063ffe60bcd4bddc6e720f0ca398ee7aa9da8_0.json", "raw_sha256": "a096c86028a279b01346143890b4827bd8ed05afc0a76bd7c8bcb840211dc20e", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/114983;114969;114966;114963;114939;114936;114918;114909;114904;114899;114888;114885;114881;114875;114874;114873;114872;114864;114857;114850;114846;114841;114834;114827;114821;114819;114813;114804;114791;114784;114768;114765;114762;114760;114758;114755;114745;114741;114739;114738;114732;114730;114726;114714;114706;114695;114691;114690;114686;114683;114677;114675;114666;114660;114656;114653;114642;114641;114632;114628;114620;114618;114613;114601;114599;114597;114581;114577;114573;114567;114558;114555;114553;114552;114547;114545;114543;114542;114541;114539;114529;114524;114516;114502;114501;114498;114495;114492;114481;114476;114474;114470;114453;114451;114449;114448;114446;114440;114438;114435/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 114873, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ansh Tandon", "profile_url": "https://biology.stackexchange.com/users/68056/ansh-tandon", "user_type": "registered"}, "created_at": "2024-06-17T19:57:50+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "F3887921-311F-422E-856E-368D4FF319F4", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/F3887921-311F-422E-856E-368D4FF319F4/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ansh Tandon", "profile_url": "https://biology.stackexchange.com/users/68056/ansh-tandon", "user_type": "registered"}, "created_at": "2024-06-17T20:43:21+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "FADCDC56-934C-44B5-A9BA-FED44F245FA1", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/FADCDC56-934C-44B5-A9BA-FED44F245FA1/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ansh Tandon", "profile_url": "https://biology.stackexchange.com/users/68056/ansh-tandon", "user_type": "registered"}, "created_at": "2024-06-17T20:49:32+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "2EAB79DA-8B34-41A9-8A91-1138D7197701", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/2EAB79DA-8B34-41A9-8A91-1138D7197701/view-source"}, {"content_license": null, "contributor": {"display_name": "Chris", "profile_url": "https://biology.stackexchange.com/users/5144/chris", "user_type": "moderator"}, "created_at": "2024-06-18T06:06:22+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "EDB886E8-FB5F-4245-A7D6-85A4DB8F2DD8", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://biology.stackexchange.com/revisions/EDB886E8-FB5F-4245-A7D6-85A4DB8F2DD8/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ansh Tandon", "profile_url": "https://biology.stackexchange.com/users/68056/ansh-tandon", "user_type": "registered"}, "created_at": "2024-06-18T13:09:01+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "21C60AD2-7796-475A-8BB6-70A5192AB914", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/21C60AD2-7796-475A-8BB6-70A5192AB914/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ansh Tandon", "profile_url": "https://biology.stackexchange.com/users/68056/ansh-tandon", "user_type": "registered"}, "created_at": "2024-06-18T16:04:44+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "4B9AE6B7-858E-4BB4-80A1-D21FAF90E92D", "revision_number": 5, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/4B9AE6B7-858E-4BB4-80A1-D21FAF90E92D/view-source"}, {"content_license": null, "contributor": {"display_name": "Chris", "profile_url": "https://biology.stackexchange.com/users/5144/chris", "user_type": "moderator"}, "created_at": "2024-06-18T18:05:18+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "2E1EA734-E5E0-4675-B633-E6FAAE2A998D", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://biology.stackexchange.com/revisions/2E1EA734-E5E0-4675-B633-E6FAAE2A998D/view-source"}], "score": 12, "updated_at": "2024-06-18T16:04:44+00:00"}, {"answer_html": "

It's not the "heavy" that makes a metal toxic. Lithium and Beryllium are considerably lighter but still toxic to humans. If the metals interact negatively within the human body, it is considered toxic. For e.g. Lead disrupts the functions of the digestive system, nervous system, respiratory system, reproductive system. In addition, it prevents enzymes from performing their normal activities. Lead even disrupts the normal DNA transcription process and causes disability in bones. Lead as such has no physiological role in the body and even smaller levels of lead can cause toxicity.

\n

You can refer to below studies for more information:

\n
    \n
  1. Mahdi Balali-Mood,Kobra Naseri, Zoya Tahergorabi, Mohammad Reza Khazdair, Mahmood Sadeghi, Toxic Mechanisms of Five Heavy Metals: Mercury, Lead, Chromium, Cadmium, and Arsenic, . Pharmacol., 2021 DOI: 10.3389/fphar.2021.643972
  2. \n
  3. Jaishankar M, Tseten T, Anbalagan N, Mathew BB, Beeregowda KN. Toxicity, mechanism and health effects of some heavy metals. Interdiscip Toxicol. 2014; 7(2):60-72. doi: 10.2478/intox-2014-0009
  4. \n
  5. Tchounwou PB, Yedjou CG, Patlolla AK, Sutton DJ. Heavy metal toxicity and the environment. Exp Suppl. 2012;101:133-64. doi: 10.1007/978-3-7643-8340-4_6
  6. \n
\n
\n

I should add more on what "actually" makes lead toxic to humans. Please see this simplified diagram:

\n

\"enter

\n

(Image source)

\n

I'll go by each routes:

\n
    \n
  • Route 1: Lead is known to have a strong affinity towards sulfur. In human body, sulfur exists in the form of thiols. So, lead tries to bind with thiol group1 leading to major implications.

    \n
  • \n
  • Route 2: Lead is able to produce free radical and reactive oxygen species (ROS) via Fenton-Haver-Weiss pathway2 possible by stimulating NADPH oxidases or by competing for the metal binding site of an enzyme/protein (Route 3) or by attacking the thiols moiety of protein (Route 1). The mechanism is below:\n\"enter

    \n

    It causes a destructive behavior known as oxidative stress. One of the major implication of oxidative stress is lead-induced hypertension and cardiovascular diseases3

    \n
  • \n
  • Route 3: Lead is known to mimic calcium because they share similar properties (In its +2 cationic form, lead has a radius of 132 pm while the calcium cation has a radius of 106 pm. In their elemental forms, lead has a radius of 175 pm and calcium has a radius of 197 pm). And that is the reason, lead compete with calcium and substitutes calcium from cells, tissues and enzymatic sites. One of the major effect is on calmodulin which is a calcium binding protein and lead will try to replace calcium inhibiting phosphorylation of brain membranes4.

    \n
  • \n
\n

There are other diagrams which which shows the mechanistical and pathological effect of lead in human body like this and this (the latter one shows the effect in DNA, RNA and lipids)

\n

References:

\n
    \n
  1. Magyar JS, Weng TC, Stern CM, Dye DF, Rous BW, Payne JC, Bridgewater BM, Mijovilovich A, Parkin G, Zaleski JM, Penner-Hahn JE, Godwin HA. Reexamination of lead(II) coordination preferences in sulfur-rich sites: implications for a critical mechanism of lead poisoning. J Am Chem Soc. 2005 127(26):9495-505. doi: 10.1021/ja0424530
  2. \n
  3. Kehrer JP. The Haber-Weiss reaction and mechanisms of toxicity. Toxicology. 2000 Aug 14;149(1):43-50. doi: 10.1016/s0300-483x(00)00231-6
  4. \n
  5. Mechanisms of lead-induced hypertension and cardiovascular disease, Nosratola D. Vaziri, American Journal of Physiology-Heart and Circulatory Physiology 2008 295:2, H454-H465, DOI: 10.1152/ajpheart.00158.2008
  6. \n
  7. Habermann E, Crowell K, Janicki P. Lead and other metals can substitute for Ca2+ in calmodulin. Arch Toxicol. 1983 Sep;54(1):61-70. doi: 10.1007/BF00277816
  8. \n
  9. https://sites.tufts.edu/leadpoisoning/pathways/lead-and-calcium/
  10. \n
  11. FHW pathway mechanism image source: Trace Metals in the Environment by Daisy Joseph, 2023
  12. \n
\n", "answer_id": 114879, "answer_text": "It's not the \"heavy\" that makes a metal toxic. Lithium and Beryllium are considerably lighter but still toxic to humans. If the metals interact negatively within the human body, it is considered toxic. For e.g. Lead disrupts the functions of the digestive system, nervous system, respiratory system, reproductive system. In addition, it prevents enzymes from performing their normal activities. Lead even disrupts the normal DNA transcription process and causes disability in bones. Lead as such has no physiological role in the body and even smaller levels of lead can cause toxicity.\n\n\n\n\nYou can refer to below studies for more information:\n\n\n\n\n\nMahdi Balali-Mood,Kobra Naseri, Zoya Tahergorabi, Mohammad Reza Khazdair, Mahmood Sadeghi, Toxic Mechanisms of Five Heavy Metals: Mercury, Lead, Chromium, Cadmium, and Arsenic, . Pharmacol., 2021 DOI: 10.3389/fphar.2021.643972 (https://www.frontiersin.org/journals/pharmacology/articles/10.3389/fphar.2021.643972/full)\n\n\n\n\nJaishankar M, Tseten T, Anbalagan N, Mathew BB, Beeregowda KN. Toxicity, mechanism and health effects of some heavy metals. Interdiscip Toxicol. 2014; 7(2):60-72. doi: 10.2478/intox-2014-0009 (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4427717/)\n\n\n\n\nTchounwou PB, Yedjou CG, Patlolla AK, Sutton DJ. Heavy metal toxicity and the environment. Exp Suppl. 2012;101:133-64. doi: 10.1007/978-3-7643-8340-4_6 (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4144270/)\n\n\n\n\n\n\n\n\nI should add more on what \"actually\" makes lead toxic to humans. Please see this simplified diagram:\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/M6Jal9cp.png] (https://i.sstatic.net/M6Jal9cp.png)\n\n\n\n\n(Image source (https://www.researchgate.net/figure/Figure-depicting-the-mechanisms-of-lead-toxicity-It-can-thus-be-concluded-that-inhibitory_fig4_6313819))\n\n\n\n\nI'll go by each routes:\n\n\n\n\n\n\n\nRoute 1: Lead is known to have a strong affinity towards sulfur (https://chemistry.stackexchange.com/questions/71734/why-do-heavy-metals-like-mercury-and-lead-have-an-affinity-for-sulfur-or-sulfur). In human body, sulfur exists in the form of thiols. So, lead tries to bind with thiol group1 leading to major implications.\n\n\n\n\n\n\n\n\n\nRoute 2: Lead is able to produce free radical and reactive oxygen species (ROS) via Fenton-Haver-Weiss pathway2 possible by stimulating NADPH oxidases or by competing for the metal binding site of an enzyme/protein (Route 3) or by attacking the thiols moiety of protein (Route 1). The mechanism is below:\n[image: enter image description here; source: https://i.sstatic.net/oTmaNfHA.png] (https://i.sstatic.net/oTmaNfHA.png)\n\n\n\n\nIt causes a destructive behavior known as oxidative stress (https://en.wikipedia.org/wiki/Oxidative_stress). One of the major implication of oxidative stress is lead-induced hypertension and cardiovascular diseases3\n\n\n\n\n\n\n\n\n\nRoute 3: Lead is known to mimic calcium because they share similar properties (In its +2 cationic form, lead has a radius of 132 pm while the calcium cation has a radius of 106 pm. In their elemental forms, lead has a radius of 175 pm and calcium has a radius of 197 pm). And that is the reason, lead compete with calcium and substitutes calcium from cells, tissues and enzymatic sites. One of the major effect is on calmodulin which is a calcium binding protein and lead will try to replace calcium inhibiting phosphorylation of brain membranes4.\n\n\n\n\n\n\n\n\nThere are other diagrams which which shows the mechanistical and pathological effect of lead in human body like this (https://Pb%20toxicity%20causes%20oxidative%20stress%20by%20reactive%20oxygen%20species%20(ROS)%20production%20and%20depletion%20of%20antioxidant%20enzymes.) and this (https://www.semanticscholar.org/paper/Molecular-mechanisms-of-lead-toxicity-Szymanski/2eac0c763e0efc5057617c30b826534b41ec8a32) (the latter one shows the effect in DNA, RNA and lipids)\n\n\n\n\nReferences:\n\n\n\n\n\nMagyar JS, Weng TC, Stern CM, Dye DF, Rous BW, Payne JC, Bridgewater BM, Mijovilovich A, Parkin G, Zaleski JM, Penner-Hahn JE, Godwin HA. Reexamination of lead(II) coordination preferences in sulfur-rich sites: implications for a critical mechanism of lead poisoning. J Am Chem Soc. 2005 127(26):9495-505. doi: 10.1021/ja0424530 (https://pubmed.ncbi.nlm.nih.gov/15984876/)\n\n\n\n\nKehrer JP. The Haber-Weiss reaction and mechanisms of toxicity. Toxicology. 2000 Aug 14;149(1):43-50. doi: 10.1016/s0300-483x(00)00231-6 (https://pubmed.ncbi.nlm.nih.gov/10963860/)\n\n\n\n\nMechanisms of lead-induced hypertension and cardiovascular disease, Nosratola D. Vaziri, American Journal of Physiology-Heart and Circulatory Physiology 2008 295:2, H454-H465, DOI: 10.1152/ajpheart.00158.2008 (https://journals.physiology.org/doi/full/10.1152/ajpheart.00158.2008)\n\n\n\n\nHabermann E, Crowell K, Janicki P. Lead and other metals can substitute for Ca2+ in calmodulin. Arch Toxicol. 1983 Sep;54(1):61-70. doi: 10.1007/BF00277816 (https://pubmed.ncbi.nlm.nih.gov/6314931/)\n\n\n\n\nhttps://sites.tufts.edu/leadpoisoning/pathways/lead-and-calcium/ (https://sites.tufts.edu/leadpoisoning/pathways/lead-and-calcium/)\n\n\n\n\nFHW pathway mechanism image source: Trace Metals in the Environment by Daisy Joseph, 2023", "answer_url": "https://biology.stackexchange.com/a/114879", "author": "Nilay Ghosh", "author_url": "https://biology.stackexchange.com/users/16927/nilay-ghosh", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2024-06-18T02:26:36+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:27.977583+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/1cbf95322a17dce0fd00a109179063ffe60bcd4bddc6e720f0ca398ee7aa9da8_0.json", "raw_sha256": "a096c86028a279b01346143890b4827bd8ed05afc0a76bd7c8bcb840211dc20e", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/114983;114969;114966;114963;114939;114936;114918;114909;114904;114899;114888;114885;114881;114875;114874;114873;114872;114864;114857;114850;114846;114841;114834;114827;114821;114819;114813;114804;114791;114784;114768;114765;114762;114760;114758;114755;114745;114741;114739;114738;114732;114730;114726;114714;114706;114695;114691;114690;114686;114683;114677;114675;114666;114660;114656;114653;114642;114641;114632;114628;114620;114618;114613;114601;114599;114597;114581;114577;114573;114567;114558;114555;114553;114552;114547;114545;114543;114542;114541;114539;114529;114524;114516;114502;114501;114498;114495;114492;114481;114476;114474;114470;114453;114451;114449;114448;114446;114440;114438;114435/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 114873, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nilay Ghosh", "profile_url": "https://biology.stackexchange.com/users/16927/nilay-ghosh", "user_type": "registered"}, "created_at": "2024-06-18T02:26:36+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "6D628C11-B28F-40C6-A8EB-16E8DA3C2612", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/6D628C11-B28F-40C6-A8EB-16E8DA3C2612/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nilay Ghosh", "profile_url": "https://biology.stackexchange.com/users/16927/nilay-ghosh", "user_type": "registered"}, "created_at": "2024-06-18T23:51:30+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "74A854A3-AF21-431A-8EE3-FFA9DBA1EF20", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/74A854A3-AF21-431A-8EE3-FFA9DBA1EF20/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nilay Ghosh", "profile_url": "https://biology.stackexchange.com/users/16927/nilay-ghosh", "user_type": "registered"}, "created_at": "2024-06-20T02:00:44+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "E0FD28DB-41F7-419A-96AD-CE6CB5CD048A", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/E0FD28DB-41F7-419A-96AD-CE6CB5CD048A/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nilay Ghosh", "profile_url": "https://biology.stackexchange.com/users/16927/nilay-ghosh", "user_type": "registered"}, "created_at": "2024-06-20T02:21:52+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "E08E0C13-2ECC-4639-8F4F-9F677D2D908E", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/E08E0C13-2ECC-4639-8F4F-9F677D2D908E/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nilay Ghosh", "profile_url": "https://biology.stackexchange.com/users/16927/nilay-ghosh", "user_type": "registered"}, "created_at": "2024-06-20T02:34:13+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "9636BCC7-C4D8-4142-8050-4362B529C013", "revision_number": 5, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/9636BCC7-C4D8-4142-8050-4362B529C013/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nilay Ghosh", "profile_url": "https://biology.stackexchange.com/users/16927/nilay-ghosh", "user_type": "registered"}, "created_at": "2024-06-20T02:42:24+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "56AD084F-39BD-4A9F-A4BB-C774F033D2E0", "revision_number": 6, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/56AD084F-39BD-4A9F-A4BB-C774F033D2E0/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nilay Ghosh", "profile_url": "https://biology.stackexchange.com/users/16927/nilay-ghosh", "user_type": "registered"}, "created_at": "2024-06-20T03:05:57+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "63600F43-018F-46CB-9B54-FA142903CACC", "revision_number": 7, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/63600F43-018F-46CB-9B54-FA142903CACC/view-source"}], "score": 8, "updated_at": "2024-06-20T03:05:57+00:00"}, {"answer_html": "

I apologize for not being very scientific in this, I will explain how I understand this, based on my experience as a chemist, my whole life trying to understand how these groupings of atoms behave.\nChemistry is the science of how electrons fit together. I could say "the orbitals" of electrons, but we all know that there are no balls orbiting in atoms. Electrons are this phenomenon that occupies space in what we call an orbital. Sometimes orbitals are unstable and electrons are accommodated in other ways between nuclei.

\n

Well then. From the moment the number of electrons reaches that of Gold, a very strange thing appears. The orbitals no longer behave according to the Schrodinger equation.\nIn heavy atoms like gold, relativistic effects become significant because the inner electrons move at speeds close to the speed of light. This increases their relativistic mass and contracts the s orbitals while expanding the d orbitals.\nThe unique color of gold is due to these relativistic effects. The contraction of the 6s orbital and expansion of the 5d orbital reduce the energy gap between these orbitals. This shifts the absorption of light to the blue end of the spectrum, making the reflected light appear yellow to human eyes.\nRelativistic effects also influence gold’s chemical behavior, making it more inert compared to other metals like silver. This is because the contracted 6s electrons are less available for bonding, contributing to gold’s resistance to oxidation and its ability to form unique compounds.

\n

intuitively (it's all we chemists can do to understand these quantum phenomena), this causes a bubble. Extremely stable, causing a gold that does not react with almost anything. This little ball is the nucleus of everything that comes after in the periodic table.

\n

But biochemistry (for me, at least and we are a product of biochemistry for me) is a way for atoms to organize themselves so that electrons can create gradients of thermodynamic properties suitable for creating the minimum entropy outputs we call life. Now, these little balls get in the way, they don't enter the game. They become insensitive to the entropic flows that cause life.\nThis, my colleague, is how I understand that these heavy metals cannot be eliminated from the body. Biochemistry based on non-equilibrium thermodynamics has no way of dealing with them.\nThe toxicity of metalloids, on the other hand, appears to have other factors. Biochemistry is a game between complex structures of non-metallic atoms with occasional and specific roles of metals, as in hemoglobin and chlorophyll. Precisely because of the distinct roles that metals are said to be "chelated" when assimilated into biochemical structures.\nThe periodic table, however, includes a few intermediate elements between metals and non-metals, these metalloids. When they have lower atomic numbers, they have eccentric effects in biochemistry, a widely used property of B, Si, and Se. They may offer an exquisite effect on the molecule, but of course, it's use is limited. Although there is so much Si on Earth, life can't use more than a little quantity.\nIn contrast, As, Sb, Te, and Ge are highly toxic and exposure can cause various physiological dysfunctions, growth defects, and human diseases.\nThe toxicity of metalloids, on the other hand, appears to have other factors. Biochemistry is a game between complex structures of non-metallic atoms with occasional and specific roles of metals, as in hemoglobin and chlorophyll. Precisely because of the distinct roles that metals are said to be "chelated" when assimilated into biochemical structures.

\n

Despite being heavier than Si, all four of these metalloids are lighter than gold, so this toxicity comes from other properties.\nIn fact, the biochemistry of the toxicity has been an object of research (Front. Cell Dev. Biol., 28 August 2018, Sec. Cellular Biochemistry, Volume 6 - 2018 | https://doi.org/10.3389/fcell.2018.00099).

\n

We have to take into account that life developed in the crust of a planet that contains much more phosphorus (1,050 mg/kg or 0.105%) than arsenic (1.8 mg/kg or 0.00018%) and much more selenium (0.05 mg/kg or 50 parts per billion, ppb)​ than (tellurium 0.001 mg/kg or 1 part per billion, ppb)​ and these two pairs of elements have very similar properties.

\n

Phosphorus (P) and arsenic (As) are both group 15 elements in the periodic table, sharing many chemical properties due to their similar electronic configurations. Here are some key comparisons:

\n

Chemical Properties (P/Ar)\nOxidation States: Both elements exhibit common oxidation states of -3, +3, and +5.\nHydrides: Both form hydrides, such as phosphine (PH₃) and arsine (AsH₃). These are similar in structure but differ in stability and reactivity; arsine is generally more toxic and less stable.\nOxoacids: Phosphorus forms several oxoacids like phosphoric acid (H₃PO₄), while arsenic forms analogous compounds like arsenic acid (H₃AsO₄). These compounds have similar structures but differ in toxicity and some chemical properties.\nSimilar Molecules\nPhosphates and Arsenates: Both elements form compounds such as phosphates (PO₄³⁻) and arsenates (AsO₄³⁻). These ions are structurally similar and often substitute for each other in minerals.\nOrganic Compounds: Phosphorus and arsenic both form organophosphorus and organoarsenic compounds. These compounds are used in pesticides, herbicides, and other chemicals. However, organoarsenic compounds are often more toxic.

\n

Selenium (Se) and tellurium (Te) are both chalcogens (group 16 elements) and share many similar chemical properties, but they also have distinct differences due to their positions in the periodic table.

\n

Chemical Properties (Se/Te)\nOxidation States: Both elements commonly exhibit oxidation states of -2, +4, and +6.\nHydrides: Selenium forms hydrogen selenide (H₂Se), and tellurium forms hydrogen telluride (H₂Te). These hydrides are analogous in structure but differ significantly in stability and toxicity, with H₂Te being more unstable and toxic.\nOxoacids: Selenium forms selenous acid (H₂SeO₃) and selenic acid (H₂SeO₄), while tellurium forms tellurous acid (H₂TeO₃) and telluric acid (H₂TeO₄). These oxoacids are structurally similar but have different chemical behaviors and reactivities.\nAllotropes: Selenium has several allotropes, including red, gray, and black forms, with different properties. Tellurium has fewer allotropes, mainly existing in a metallic form.\nSimilar Molecules\nCompounds with Oxygen: Both form dioxides (SeO₂ and TeO₂) and trioxides (SeO₃ and TeO₃). These compounds are used in various chemical processes and have similar structures.\nOrganometallic Compounds: Selenium and tellurium form organometallic compounds used in organic synthesis and materials science.

\n

The fact that arsenic is confused with phosphorus is a true tragedy, as phosphorus is crucial in the most fundamental of biochemical reactions, the storage and release of energy. Arsenic spreads throughout the body and ends up being treated not as a foreign element, but as an essential part of metabolism.

\n

(see, for instance, Environ Toxicol Pharmacol. 2015 Mar;39(2):668-76. doi: 10.1016/j.etap.2015.01.012. Epub 2015 Feb 3. The arsenic accumulation and its effect on oxidative stress responses in juvenile rockfish, Sebastes schlegelii, exposed to waterborne arsenic (As₃+) Jun-Hwan Kim, Ju-Chan Kang)

\n

Selenium isn't so useful indeed, although there are some crucial enzymes containing Selenium, like glutathione peroxidase. I'll reproduce what Bienert and Tamas say about tellurium toxicity (Front. Cell Dev. Biol., 28 August 2018 Sec. Cellular Biochemistry, Volume 6 - 2018 | https://doi.org/10.3389/fcell.2018.00099):

\n

Certain chemical Te species, such as the tellurite oxyanion (TeO₂)³⁻, are highly toxic for most organisms (Lemire et al., 2013). The molecular mechanisms of tellurite toxicity and resistance remain to be fully understood. Turner and colleagues (Vrionis et al.) investigated the effect of selenite on tellurite toxicity in the bacterium Escherichia coli. The authors found that co-exposure to selenite strongly increased bacterial resistance to tellurite. Potential mechanisms of this protective effect of selenite are discussed.

\n

I hope it covers the toxicity of the main elements.

\n", "answer_id": 114887, "answer_text": "I apologize for not being very scientific in this, I will explain how I understand this, based on my experience as a chemist, my whole life trying to understand how these groupings of atoms behave.\nChemistry is the science of how electrons fit together. I could say \"the orbitals\" of electrons, but we all know that there are no balls orbiting in atoms. Electrons are this phenomenon that occupies space in what we call an orbital. Sometimes orbitals are unstable and electrons are accommodated in other ways between nuclei.\n\n\n\n\nWell then. From the moment the number of electrons reaches that of Gold, a very strange thing appears. The orbitals no longer behave according to the Schrodinger equation.\nIn heavy atoms like gold, relativistic effects become significant because the inner electrons move at speeds close to the speed of light. This increases their relativistic mass and contracts the s orbitals while expanding the d orbitals.\nThe unique color of gold is due to these relativistic effects. The contraction of the 6s orbital and expansion of the 5d orbital reduce the energy gap between these orbitals. This shifts the absorption of light to the blue end of the spectrum, making the reflected light appear yellow to human eyes.\nRelativistic effects also influence gold’s chemical behavior, making it more inert compared to other metals like silver. This is because the contracted 6s electrons are less available for bonding, contributing to gold’s resistance to oxidation and its ability to form unique compounds.\n\n\n\n\nintuitively (it's all we chemists can do to understand these quantum phenomena), this causes a bubble. Extremely stable, causing a gold that does not react with almost anything. This little ball is the nucleus of everything that comes after in the periodic table.\n\n\n\n\nBut biochemistry (for me, at least and we are a product of biochemistry for me) is a way for atoms to organize themselves so that electrons can create gradients of thermodynamic properties suitable for creating the minimum entropy outputs we call life. Now, these little balls get in the way, they don't enter the game. They become insensitive to the entropic flows that cause life.\nThis, my colleague, is how I understand that these heavy metals cannot be eliminated from the body. Biochemistry based on non-equilibrium thermodynamics has no way of dealing with them.\nThe toxicity of metalloids, on the other hand, appears to have other factors. Biochemistry is a game between complex structures of non-metallic atoms with occasional and specific roles of metals, as in hemoglobin and chlorophyll. Precisely because of the distinct roles that metals are said to be \"chelated\" when assimilated into biochemical structures.\nThe periodic table, however, includes a few intermediate elements between metals and non-metals, these metalloids. When they have lower atomic numbers, they have eccentric effects in biochemistry, a widely used property of B, Si, and Se. They may offer an exquisite effect on the molecule, but of course, it's use is limited. Although there is so much Si on Earth, life can't use more than a little quantity.\nIn contrast, As, Sb, Te, and Ge are highly toxic and exposure can cause various physiological dysfunctions, growth defects, and human diseases.\nThe toxicity of metalloids, on the other hand, appears to have other factors. Biochemistry is a game between complex structures of non-metallic atoms with occasional and specific roles of metals, as in hemoglobin and chlorophyll. Precisely because of the distinct roles that metals are said to be \"chelated\" when assimilated into biochemical structures.\n\n\n\n\nDespite being heavier than Si, all four of these metalloids are lighter than gold, so this toxicity comes from other properties.\nIn fact, the biochemistry of the toxicity has been an object of research (Front. Cell Dev. Biol., 28 August 2018, Sec. Cellular Biochemistry, Volume 6 - 2018 | https://doi.org/10.3389/fcell.2018.00099 (https://doi.org/10.3389/fcell.2018.00099)).\n\n\n\n\nWe have to take into account that life developed in the crust of a planet that contains much more phosphorus (1,050 mg/kg or 0.105%) than arsenic (1.8 mg/kg or 0.00018%) and much more selenium (0.05 mg/kg or 50 parts per billion, ppb)​ than (tellurium 0.001 mg/kg or 1 part per billion, ppb)​ and these two pairs of elements have very similar properties.\n\n\n\n\nPhosphorus (P) and arsenic (As) are both group 15 elements in the periodic table, sharing many chemical properties due to their similar electronic configurations. Here are some key comparisons:\n\n\n\n\nChemical Properties (P/Ar)\nOxidation States: Both elements exhibit common oxidation states of -3, +3, and +5.\nHydrides: Both form hydrides, such as phosphine (PH₃) and arsine (AsH₃). These are similar in structure but differ in stability and reactivity; arsine is generally more toxic and less stable.\nOxoacids: Phosphorus forms several oxoacids like phosphoric acid (H₃PO₄), while arsenic forms analogous compounds like arsenic acid (H₃AsO₄). These compounds have similar structures but differ in toxicity and some chemical properties.\nSimilar Molecules\nPhosphates and Arsenates: Both elements form compounds such as phosphates (PO₄³⁻) and arsenates (AsO₄³⁻). These ions are structurally similar and often substitute for each other in minerals.\nOrganic Compounds: Phosphorus and arsenic both form organophosphorus and organoarsenic compounds. These compounds are used in pesticides, herbicides, and other chemicals. However, organoarsenic compounds are often more toxic.\n\n\n\n\nSelenium (Se) and tellurium (Te) are both chalcogens (group 16 elements) and share many similar chemical properties, but they also have distinct differences due to their positions in the periodic table.\n\n\n\n\nChemical Properties (Se/Te)\nOxidation States: Both elements commonly exhibit oxidation states of -2, +4, and +6.\nHydrides: Selenium forms hydrogen selenide (H₂Se), and tellurium forms hydrogen telluride (H₂Te). These hydrides are analogous in structure but differ significantly in stability and toxicity, with H₂Te being more unstable and toxic.\nOxoacids: Selenium forms selenous acid (H₂SeO₃) and selenic acid (H₂SeO₄), while tellurium forms tellurous acid (H₂TeO₃) and telluric acid (H₂TeO₄). These oxoacids are structurally similar but have different chemical behaviors and reactivities.\nAllotropes: Selenium has several allotropes, including red, gray, and black forms, with different properties. Tellurium has fewer allotropes, mainly existing in a metallic form.\nSimilar Molecules\nCompounds with Oxygen: Both form dioxides (SeO₂ and TeO₂) and trioxides (SeO₃ and TeO₃). These compounds are used in various chemical processes and have similar structures.\nOrganometallic Compounds: Selenium and tellurium form organometallic compounds used in organic synthesis and materials science.\n\n\n\n\nThe fact that arsenic is confused with phosphorus is a true tragedy, as phosphorus is crucial in the most fundamental of biochemical reactions, the storage and release of energy. Arsenic spreads throughout the body and ends up being treated not as a foreign element, but as an essential part of metabolism.\n\n\n\n\n(see, for instance, Environ Toxicol Pharmacol. 2015 Mar;39(2):668-76. doi: 10.1016/j.etap.2015.01.012. Epub 2015 Feb 3. The arsenic accumulation and its effect on oxidative stress responses in juvenile rockfish, Sebastes schlegelii, exposed to waterborne arsenic (As₃+) Jun-Hwan Kim, Ju-Chan Kang)\n\n\n\n\nSelenium isn't so useful indeed, although there are some crucial enzymes containing Selenium, like glutathione peroxidase. I'll reproduce what Bienert and Tamas say about tellurium toxicity (Front. Cell Dev. Biol., 28 August 2018 Sec. Cellular Biochemistry, Volume 6 - 2018 | https://doi.org/10.3389/fcell.2018.00099 (https://doi.org/10.3389/fcell.2018.00099)):\n\n\n\n\nCertain chemical Te species, such as the tellurite oxyanion (TeO₂)³⁻, are highly toxic for most organisms (Lemire et al., 2013). The molecular mechanisms of tellurite toxicity and resistance remain to be fully understood. Turner and colleagues (Vrionis et al.) investigated the effect of selenite on tellurite toxicity in the bacterium Escherichia coli. The authors found that co-exposure to selenite strongly increased bacterial resistance to tellurite. Potential mechanisms of this protective effect of selenite are discussed.\n\n\n\n\nI hope it covers the toxicity of the main elements.", "answer_url": "https://biology.stackexchange.com/a/114887", "author": "Alfredo Maranca", "author_url": "https://biology.stackexchange.com/users/81801/alfredo-maranca", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2024-06-19T03:05:44+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:27.977583+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/1cbf95322a17dce0fd00a109179063ffe60bcd4bddc6e720f0ca398ee7aa9da8_0.json", "raw_sha256": "a096c86028a279b01346143890b4827bd8ed05afc0a76bd7c8bcb840211dc20e", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/114983;114969;114966;114963;114939;114936;114918;114909;114904;114899;114888;114885;114881;114875;114874;114873;114872;114864;114857;114850;114846;114841;114834;114827;114821;114819;114813;114804;114791;114784;114768;114765;114762;114760;114758;114755;114745;114741;114739;114738;114732;114730;114726;114714;114706;114695;114691;114690;114686;114683;114677;114675;114666;114660;114656;114653;114642;114641;114632;114628;114620;114618;114613;114601;114599;114597;114581;114577;114573;114567;114558;114555;114553;114552;114547;114545;114543;114542;114541;114539;114529;114524;114516;114502;114501;114498;114495;114492;114481;114476;114474;114470;114453;114451;114449;114448;114446;114440;114438;114435/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 114873, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Alfredo Maranca", "profile_url": "https://biology.stackexchange.com/users/81801/alfredo-maranca", "user_type": "registered"}, "created_at": "2024-06-19T03:05:44+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "83358FDD-09B6-4949-A9A5-B0D6C80D549D", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/83358FDD-09B6-4949-A9A5-B0D6C80D549D/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Alfredo Maranca", "profile_url": "https://biology.stackexchange.com/users/81801/alfredo-maranca", "user_type": "registered"}, "created_at": "2024-06-19T18:31:57+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "4062E4B4-71EA-4FC5-AFAC-DBAD7CB1350E", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/4062E4B4-71EA-4FC5-AFAC-DBAD7CB1350E/view-source"}], "score": 2, "updated_at": "2024-06-19T18:31:57+00:00"}, {"answer_html": "

I would answer this question in a different way. As others have pointed out above, elements behave differently than one another even when they have the same number of valence electrons. This makes it possible for some elements to be more toxic than others, even when they're in the same row of the periodic table. But (again, as others have pointed out) it doesn't explain why there's a tendency for the heavier elements to be more toxic. And then there's the curious fact that not all of the heavier elements are toxic, and not all of the lighter ones are non-toxic. On top of that, the mechanisms of toxicity are very different for different toxic elements.

\n

I would argue that the general rule is this: organisms haven't evolved to deal with unusually high concentrations of elements. Heavy elements, because they're rare, are hardly ever encountered at high concentrations. Does this mean that they are necessarily toxic? No - organisms might be able to deal with high concentrations of them, just by chance. For this reason, some rare elements happen to be non-toxic. But others mess with biomolecular functions in ways that organisms haven't evolved to counteract.

\n

In contrast, organisms must be able to deal with common elements at significant concentrations - in other words, those elements must be non-toxic, even if they're chemically reactive. For example, oxygen isn't toxic even in high concentrations because most organisms that couldn't tolerate oxygen went extinct eons ago, when the oxygen concentration in the atmosphere first rose to significant levels.

\n

Hypotheses like this run the risk of being circular or meaningless. ("X isn't harmful to organisms because they've evolved to be resistant to X. The proof is that X doesn't harm organisms!") However, we can put this hypothesis to the test, at least to some degree, by looking at organisms that encounter different elements. Organisms should show specific adaptations to deal with reactive chemicals that are common in their particular environment; they should lack adaptations specific to dealing with rare chemicals. For instance, aerobic bacteria should generate antioxidants, and the genes coding for these defenses should show signs of conservative selection; this shouldn't be the case for anaerobic microbes that rarely encounter oxygen.

\n

I apologize for not supplying more specifics (or citations). I'm in a bit of a rush. But I hope this way of re-framing the question is useful!

\n", "answer_id": 114892, "answer_text": "I would answer this question in a different way. As others have pointed out above, elements behave differently than one another even when they have the same number of valence electrons. This makes it possible for some elements to be more toxic than others, even when they're in the same row of the periodic table. But (again, as others have pointed out) it doesn't explain why there's a tendency for the heavier elements to be more toxic. And then there's the curious fact that not all of the heavier elements are toxic, and not all of the lighter ones are non-toxic. On top of that, the mechanisms of toxicity are very different for different toxic elements.\n\n\n\n\nI would argue that the general rule is this: organisms haven't evolved to deal with unusually high concentrations of elements. Heavy elements, because they're rare, are hardly ever encountered at high concentrations. Does this mean that they are necessarily toxic? No - organisms might be able to deal with high concentrations of them, just by chance. For this reason, some rare elements happen to be non-toxic. But others mess with biomolecular functions in ways that organisms haven't evolved to counteract.\n\n\n\n\nIn contrast, organisms must be able to deal with common elements at significant concentrations - in other words, those elements must be non-toxic, even if they're chemically reactive. For example, oxygen isn't toxic even in high concentrations because most organisms that couldn't tolerate oxygen went extinct eons ago, when the oxygen concentration in the atmosphere first rose to significant levels.\n\n\n\n\nHypotheses like this run the risk of being circular or meaningless. (\"X isn't harmful to organisms because they've evolved to be resistant to X. The proof is that X doesn't harm organisms!\") However, we can put this hypothesis to the test, at least to some degree, by looking at organisms that encounter different elements. Organisms should show specific adaptations to deal with reactive chemicals that are common in their particular environment; they should lack adaptations specific to dealing with rare chemicals. For instance, aerobic bacteria should generate antioxidants, and the genes coding for these defenses should show signs of conservative selection; this shouldn't be the case for anaerobic microbes that rarely encounter oxygen.\n\n\n\n\nI apologize for not supplying more specifics (or citations). I'm in a bit of a rush. But I hope this way of re-framing the question is useful!", "answer_url": "https://biology.stackexchange.com/a/114892", "author": "Brian", "author_url": "https://biology.stackexchange.com/users/81889/brian", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2024-06-20T13:24:13+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:29.530612+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/3ec390b88d6fcaad2351183fd6d84ec73799b065a6f093dbbc0eea59e94500ce_0.json", "raw_sha256": "a2f08981a2307fb8f456a33e92a38855de4bf9e165d024d5b20a23d9f8d656e1", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/114983;114969;114966;114963;114939;114936;114918;114909;114904;114899;114888;114885;114881;114875;114874;114873;114872;114864;114857;114850;114846;114841;114834;114827;114821;114819;114813;114804;114791;114784;114768;114765;114762;114760;114758;114755;114745;114741;114739;114738;114732;114730;114726;114714;114706;114695;114691;114690;114686;114683;114677;114675;114666;114660;114656;114653;114642;114641;114632;114628;114620;114618;114613;114601;114599;114597;114581;114577;114573;114567;114558;114555;114553;114552;114547;114545;114543;114542;114541;114539;114529;114524;114516;114502;114501;114498;114495;114492;114481;114476;114474;114470;114453;114451;114449;114448;114446;114440;114438;114435/answers?filter=withbody&order=asc&page=2&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 114873, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Brian", "profile_url": "https://biology.stackexchange.com/users/81889/brian", "user_type": "registered"}, "created_at": "2024-06-20T13:24:13+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "489EAF49-D487-4573-9EB1-1F8055303A3D", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/489EAF49-D487-4573-9EB1-1F8055303A3D/view-source"}], "score": 7, "updated_at": "2024-06-20T13:24:13+00:00"}], "ground_truth": "community signals only; no scientific truth label", "product": "ranking", "question": "I have read the different answers on the toxicity of heavy metals but I am still confused about the topic. Why does the mass of the nuclei matter when chemical reactions only involve the electrons. Carbon and lead are in the same chemical group and thus have the same chemical properties.", "record_id": "Scientific-Answer-Ranking:biology:114873", "scores": [12, 8, 2, 7], "split": "train", "thread": {"accepted_answer_id": null, "answers": [{"answer_html": "

You're right to say that chemical reactions primarily involve the valence electrons of an atom. However, there are other factors that are key to understanding the difference in toxicity between lead and carbon. Mass isn’t really the explanation — correlation isn’t causation. Li and Be may be toxic in certain scenarios.

\n
    \n
  1. Some heavy metals share chemical similarities with essential elements our body uses. Lead, for example, can mimic calcium and sneak into important biological processes (e.g., disrupting neurotransmitter release by activating protein kinases).
  2. \n
  3. Oxidative Stress: Some heavy metals can generate free radicals or reactive oxygen species, due to their flexible oxidation states and redox potential, which damage cells. (https://www.intechopen.com/chapters/71913)
  4. \n
  5. Heavy metals tend to bioaccumulate and remain in organisms over time, specifically in the kidneys and liver. Because lead has no known biological role, there are no efficient excretion pathways for it. Carbon is continuously cycled through metabolic processes.
  6. \n
\n

Now, carbon's small atomic size and stable quadrivalent electron configuration allow it to form strong bonds with itself and other elements, creating the vast diversity of organic molecules crucial for life (like DNA, proteins, and carbohydrates). The inability to easily lose electrons prevents it from exhibiting these toxic behaviors in biological systems. Its chemistry is perfectly tailored for the organic molecular backbone.

\n

***It's important to note that not all heavy metals are inherently toxic. Some, like iron and copper, are essential for our body in small amounts.

\n

Good review article to read: https://www.frontiersin.org/journals/pharmacology/articles/10.3389/fphar.2021.643972/full

\n", "answer_id": 114877, "answer_text": "You're right to say that chemical reactions primarily involve the valence electrons of an atom. However, there are other factors that are key to understanding the difference in toxicity between lead and carbon. Mass isn’t really the explanation — correlation isn’t causation. Li and Be may be toxic in certain scenarios.\n\n\n\n\n\nSome heavy metals share chemical similarities with essential elements our body uses. Lead, for example, can mimic calcium and sneak into important biological processes (e.g., disrupting neurotransmitter release by activating protein kinases).\n\n\n\n\nOxidative Stress: Some heavy metals can generate free radicals or reactive oxygen species, due to their flexible oxidation states and redox potential, which damage cells. (https://www.intechopen.com/chapters/71913 (https://www.intechopen.com/chapters/71913))\n\n\n\n\nHeavy metals tend to bioaccumulate and remain in organisms over time, specifically in the kidneys and liver. Because lead has no known biological role, there are no efficient excretion pathways for it. Carbon is continuously cycled through metabolic processes.\n\n\n\n\n\nNow, carbon's small atomic size and stable quadrivalent electron configuration allow it to form strong bonds with itself and other elements, creating the vast diversity of organic molecules crucial for life (like DNA, proteins, and carbohydrates). The inability to easily lose electrons prevents it from exhibiting these toxic behaviors in biological systems. Its chemistry is perfectly tailored for the organic molecular backbone.\n\n\n\n\n***It's important to note that not all heavy metals are inherently toxic. Some, like iron and copper, are essential for our body in small amounts.\n\n\n\n\nGood review article to read: https://www.frontiersin.org/journals/pharmacology/articles/10.3389/fphar.2021.643972/full (https://www.frontiersin.org/journals/pharmacology/articles/10.3389/fphar.2021.643972/full)", "answer_url": "https://biology.stackexchange.com/a/114877", "author": "Ansh Tandon", "author_url": "https://biology.stackexchange.com/users/68056/ansh-tandon", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2024-06-17T19:57:50+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:27.977583+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/1cbf95322a17dce0fd00a109179063ffe60bcd4bddc6e720f0ca398ee7aa9da8_0.json", "raw_sha256": "a096c86028a279b01346143890b4827bd8ed05afc0a76bd7c8bcb840211dc20e", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/114983;114969;114966;114963;114939;114936;114918;114909;114904;114899;114888;114885;114881;114875;114874;114873;114872;114864;114857;114850;114846;114841;114834;114827;114821;114819;114813;114804;114791;114784;114768;114765;114762;114760;114758;114755;114745;114741;114739;114738;114732;114730;114726;114714;114706;114695;114691;114690;114686;114683;114677;114675;114666;114660;114656;114653;114642;114641;114632;114628;114620;114618;114613;114601;114599;114597;114581;114577;114573;114567;114558;114555;114553;114552;114547;114545;114543;114542;114541;114539;114529;114524;114516;114502;114501;114498;114495;114492;114481;114476;114474;114470;114453;114451;114449;114448;114446;114440;114438;114435/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 114873, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ansh Tandon", "profile_url": "https://biology.stackexchange.com/users/68056/ansh-tandon", "user_type": "registered"}, "created_at": "2024-06-17T19:57:50+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "F3887921-311F-422E-856E-368D4FF319F4", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/F3887921-311F-422E-856E-368D4FF319F4/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ansh Tandon", "profile_url": "https://biology.stackexchange.com/users/68056/ansh-tandon", "user_type": "registered"}, "created_at": "2024-06-17T20:43:21+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "FADCDC56-934C-44B5-A9BA-FED44F245FA1", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/FADCDC56-934C-44B5-A9BA-FED44F245FA1/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ansh Tandon", "profile_url": "https://biology.stackexchange.com/users/68056/ansh-tandon", "user_type": "registered"}, "created_at": "2024-06-17T20:49:32+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "2EAB79DA-8B34-41A9-8A91-1138D7197701", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/2EAB79DA-8B34-41A9-8A91-1138D7197701/view-source"}, {"content_license": null, "contributor": {"display_name": "Chris", "profile_url": "https://biology.stackexchange.com/users/5144/chris", "user_type": "moderator"}, "created_at": "2024-06-18T06:06:22+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "EDB886E8-FB5F-4245-A7D6-85A4DB8F2DD8", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://biology.stackexchange.com/revisions/EDB886E8-FB5F-4245-A7D6-85A4DB8F2DD8/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ansh Tandon", "profile_url": "https://biology.stackexchange.com/users/68056/ansh-tandon", "user_type": "registered"}, "created_at": "2024-06-18T13:09:01+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "21C60AD2-7796-475A-8BB6-70A5192AB914", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/21C60AD2-7796-475A-8BB6-70A5192AB914/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Ansh Tandon", "profile_url": "https://biology.stackexchange.com/users/68056/ansh-tandon", "user_type": "registered"}, "created_at": "2024-06-18T16:04:44+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "4B9AE6B7-858E-4BB4-80A1-D21FAF90E92D", "revision_number": 5, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/4B9AE6B7-858E-4BB4-80A1-D21FAF90E92D/view-source"}, {"content_license": null, "contributor": {"display_name": "Chris", "profile_url": "https://biology.stackexchange.com/users/5144/chris", "user_type": "moderator"}, "created_at": "2024-06-18T18:05:18+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "2E1EA734-E5E0-4675-B633-E6FAAE2A998D", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://biology.stackexchange.com/revisions/2E1EA734-E5E0-4675-B633-E6FAAE2A998D/view-source"}], "score": 12, "updated_at": "2024-06-18T16:04:44+00:00"}, {"answer_html": "

It's not the "heavy" that makes a metal toxic. Lithium and Beryllium are considerably lighter but still toxic to humans. If the metals interact negatively within the human body, it is considered toxic. For e.g. Lead disrupts the functions of the digestive system, nervous system, respiratory system, reproductive system. In addition, it prevents enzymes from performing their normal activities. Lead even disrupts the normal DNA transcription process and causes disability in bones. Lead as such has no physiological role in the body and even smaller levels of lead can cause toxicity.

\n

You can refer to below studies for more information:

\n
    \n
  1. Mahdi Balali-Mood,Kobra Naseri, Zoya Tahergorabi, Mohammad Reza Khazdair, Mahmood Sadeghi, Toxic Mechanisms of Five Heavy Metals: Mercury, Lead, Chromium, Cadmium, and Arsenic, . Pharmacol., 2021 DOI: 10.3389/fphar.2021.643972
  2. \n
  3. Jaishankar M, Tseten T, Anbalagan N, Mathew BB, Beeregowda KN. Toxicity, mechanism and health effects of some heavy metals. Interdiscip Toxicol. 2014; 7(2):60-72. doi: 10.2478/intox-2014-0009
  4. \n
  5. Tchounwou PB, Yedjou CG, Patlolla AK, Sutton DJ. Heavy metal toxicity and the environment. Exp Suppl. 2012;101:133-64. doi: 10.1007/978-3-7643-8340-4_6
  6. \n
\n
\n

I should add more on what "actually" makes lead toxic to humans. Please see this simplified diagram:

\n

\"enter

\n

(Image source)

\n

I'll go by each routes:

\n
    \n
  • Route 1: Lead is known to have a strong affinity towards sulfur. In human body, sulfur exists in the form of thiols. So, lead tries to bind with thiol group1 leading to major implications.

    \n
  • \n
  • Route 2: Lead is able to produce free radical and reactive oxygen species (ROS) via Fenton-Haver-Weiss pathway2 possible by stimulating NADPH oxidases or by competing for the metal binding site of an enzyme/protein (Route 3) or by attacking the thiols moiety of protein (Route 1). The mechanism is below:\n\"enter

    \n

    It causes a destructive behavior known as oxidative stress. One of the major implication of oxidative stress is lead-induced hypertension and cardiovascular diseases3

    \n
  • \n
  • Route 3: Lead is known to mimic calcium because they share similar properties (In its +2 cationic form, lead has a radius of 132 pm while the calcium cation has a radius of 106 pm. In their elemental forms, lead has a radius of 175 pm and calcium has a radius of 197 pm). And that is the reason, lead compete with calcium and substitutes calcium from cells, tissues and enzymatic sites. One of the major effect is on calmodulin which is a calcium binding protein and lead will try to replace calcium inhibiting phosphorylation of brain membranes4.

    \n
  • \n
\n

There are other diagrams which which shows the mechanistical and pathological effect of lead in human body like this and this (the latter one shows the effect in DNA, RNA and lipids)

\n

References:

\n
    \n
  1. Magyar JS, Weng TC, Stern CM, Dye DF, Rous BW, Payne JC, Bridgewater BM, Mijovilovich A, Parkin G, Zaleski JM, Penner-Hahn JE, Godwin HA. Reexamination of lead(II) coordination preferences in sulfur-rich sites: implications for a critical mechanism of lead poisoning. J Am Chem Soc. 2005 127(26):9495-505. doi: 10.1021/ja0424530
  2. \n
  3. Kehrer JP. The Haber-Weiss reaction and mechanisms of toxicity. Toxicology. 2000 Aug 14;149(1):43-50. doi: 10.1016/s0300-483x(00)00231-6
  4. \n
  5. Mechanisms of lead-induced hypertension and cardiovascular disease, Nosratola D. Vaziri, American Journal of Physiology-Heart and Circulatory Physiology 2008 295:2, H454-H465, DOI: 10.1152/ajpheart.00158.2008
  6. \n
  7. Habermann E, Crowell K, Janicki P. Lead and other metals can substitute for Ca2+ in calmodulin. Arch Toxicol. 1983 Sep;54(1):61-70. doi: 10.1007/BF00277816
  8. \n
  9. https://sites.tufts.edu/leadpoisoning/pathways/lead-and-calcium/
  10. \n
  11. FHW pathway mechanism image source: Trace Metals in the Environment by Daisy Joseph, 2023
  12. \n
\n", "answer_id": 114879, "answer_text": "It's not the \"heavy\" that makes a metal toxic. Lithium and Beryllium are considerably lighter but still toxic to humans. If the metals interact negatively within the human body, it is considered toxic. For e.g. Lead disrupts the functions of the digestive system, nervous system, respiratory system, reproductive system. In addition, it prevents enzymes from performing their normal activities. Lead even disrupts the normal DNA transcription process and causes disability in bones. Lead as such has no physiological role in the body and even smaller levels of lead can cause toxicity.\n\n\n\n\nYou can refer to below studies for more information:\n\n\n\n\n\nMahdi Balali-Mood,Kobra Naseri, Zoya Tahergorabi, Mohammad Reza Khazdair, Mahmood Sadeghi, Toxic Mechanisms of Five Heavy Metals: Mercury, Lead, Chromium, Cadmium, and Arsenic, . Pharmacol., 2021 DOI: 10.3389/fphar.2021.643972 (https://www.frontiersin.org/journals/pharmacology/articles/10.3389/fphar.2021.643972/full)\n\n\n\n\nJaishankar M, Tseten T, Anbalagan N, Mathew BB, Beeregowda KN. Toxicity, mechanism and health effects of some heavy metals. Interdiscip Toxicol. 2014; 7(2):60-72. doi: 10.2478/intox-2014-0009 (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4427717/)\n\n\n\n\nTchounwou PB, Yedjou CG, Patlolla AK, Sutton DJ. Heavy metal toxicity and the environment. Exp Suppl. 2012;101:133-64. doi: 10.1007/978-3-7643-8340-4_6 (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4144270/)\n\n\n\n\n\n\n\n\nI should add more on what \"actually\" makes lead toxic to humans. Please see this simplified diagram:\n\n\n\n\n[image: enter image description here; source: https://i.sstatic.net/M6Jal9cp.png] (https://i.sstatic.net/M6Jal9cp.png)\n\n\n\n\n(Image source (https://www.researchgate.net/figure/Figure-depicting-the-mechanisms-of-lead-toxicity-It-can-thus-be-concluded-that-inhibitory_fig4_6313819))\n\n\n\n\nI'll go by each routes:\n\n\n\n\n\n\n\nRoute 1: Lead is known to have a strong affinity towards sulfur (https://chemistry.stackexchange.com/questions/71734/why-do-heavy-metals-like-mercury-and-lead-have-an-affinity-for-sulfur-or-sulfur). In human body, sulfur exists in the form of thiols. So, lead tries to bind with thiol group1 leading to major implications.\n\n\n\n\n\n\n\n\n\nRoute 2: Lead is able to produce free radical and reactive oxygen species (ROS) via Fenton-Haver-Weiss pathway2 possible by stimulating NADPH oxidases or by competing for the metal binding site of an enzyme/protein (Route 3) or by attacking the thiols moiety of protein (Route 1). The mechanism is below:\n[image: enter image description here; source: https://i.sstatic.net/oTmaNfHA.png] (https://i.sstatic.net/oTmaNfHA.png)\n\n\n\n\nIt causes a destructive behavior known as oxidative stress (https://en.wikipedia.org/wiki/Oxidative_stress). One of the major implication of oxidative stress is lead-induced hypertension and cardiovascular diseases3\n\n\n\n\n\n\n\n\n\nRoute 3: Lead is known to mimic calcium because they share similar properties (In its +2 cationic form, lead has a radius of 132 pm while the calcium cation has a radius of 106 pm. In their elemental forms, lead has a radius of 175 pm and calcium has a radius of 197 pm). And that is the reason, lead compete with calcium and substitutes calcium from cells, tissues and enzymatic sites. One of the major effect is on calmodulin which is a calcium binding protein and lead will try to replace calcium inhibiting phosphorylation of brain membranes4.\n\n\n\n\n\n\n\n\nThere are other diagrams which which shows the mechanistical and pathological effect of lead in human body like this (https://Pb%20toxicity%20causes%20oxidative%20stress%20by%20reactive%20oxygen%20species%20(ROS)%20production%20and%20depletion%20of%20antioxidant%20enzymes.) and this (https://www.semanticscholar.org/paper/Molecular-mechanisms-of-lead-toxicity-Szymanski/2eac0c763e0efc5057617c30b826534b41ec8a32) (the latter one shows the effect in DNA, RNA and lipids)\n\n\n\n\nReferences:\n\n\n\n\n\nMagyar JS, Weng TC, Stern CM, Dye DF, Rous BW, Payne JC, Bridgewater BM, Mijovilovich A, Parkin G, Zaleski JM, Penner-Hahn JE, Godwin HA. Reexamination of lead(II) coordination preferences in sulfur-rich sites: implications for a critical mechanism of lead poisoning. J Am Chem Soc. 2005 127(26):9495-505. doi: 10.1021/ja0424530 (https://pubmed.ncbi.nlm.nih.gov/15984876/)\n\n\n\n\nKehrer JP. The Haber-Weiss reaction and mechanisms of toxicity. Toxicology. 2000 Aug 14;149(1):43-50. doi: 10.1016/s0300-483x(00)00231-6 (https://pubmed.ncbi.nlm.nih.gov/10963860/)\n\n\n\n\nMechanisms of lead-induced hypertension and cardiovascular disease, Nosratola D. Vaziri, American Journal of Physiology-Heart and Circulatory Physiology 2008 295:2, H454-H465, DOI: 10.1152/ajpheart.00158.2008 (https://journals.physiology.org/doi/full/10.1152/ajpheart.00158.2008)\n\n\n\n\nHabermann E, Crowell K, Janicki P. Lead and other metals can substitute for Ca2+ in calmodulin. Arch Toxicol. 1983 Sep;54(1):61-70. doi: 10.1007/BF00277816 (https://pubmed.ncbi.nlm.nih.gov/6314931/)\n\n\n\n\nhttps://sites.tufts.edu/leadpoisoning/pathways/lead-and-calcium/ (https://sites.tufts.edu/leadpoisoning/pathways/lead-and-calcium/)\n\n\n\n\nFHW pathway mechanism image source: Trace Metals in the Environment by Daisy Joseph, 2023", "answer_url": "https://biology.stackexchange.com/a/114879", "author": "Nilay Ghosh", "author_url": "https://biology.stackexchange.com/users/16927/nilay-ghosh", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2024-06-18T02:26:36+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:27.977583+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/1cbf95322a17dce0fd00a109179063ffe60bcd4bddc6e720f0ca398ee7aa9da8_0.json", "raw_sha256": "a096c86028a279b01346143890b4827bd8ed05afc0a76bd7c8bcb840211dc20e", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/114983;114969;114966;114963;114939;114936;114918;114909;114904;114899;114888;114885;114881;114875;114874;114873;114872;114864;114857;114850;114846;114841;114834;114827;114821;114819;114813;114804;114791;114784;114768;114765;114762;114760;114758;114755;114745;114741;114739;114738;114732;114730;114726;114714;114706;114695;114691;114690;114686;114683;114677;114675;114666;114660;114656;114653;114642;114641;114632;114628;114620;114618;114613;114601;114599;114597;114581;114577;114573;114567;114558;114555;114553;114552;114547;114545;114543;114542;114541;114539;114529;114524;114516;114502;114501;114498;114495;114492;114481;114476;114474;114470;114453;114451;114449;114448;114446;114440;114438;114435/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 114873, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nilay Ghosh", "profile_url": "https://biology.stackexchange.com/users/16927/nilay-ghosh", "user_type": "registered"}, "created_at": "2024-06-18T02:26:36+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "6D628C11-B28F-40C6-A8EB-16E8DA3C2612", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/6D628C11-B28F-40C6-A8EB-16E8DA3C2612/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nilay Ghosh", "profile_url": "https://biology.stackexchange.com/users/16927/nilay-ghosh", "user_type": "registered"}, "created_at": "2024-06-18T23:51:30+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "74A854A3-AF21-431A-8EE3-FFA9DBA1EF20", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/74A854A3-AF21-431A-8EE3-FFA9DBA1EF20/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nilay Ghosh", "profile_url": "https://biology.stackexchange.com/users/16927/nilay-ghosh", "user_type": "registered"}, "created_at": "2024-06-20T02:00:44+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "E0FD28DB-41F7-419A-96AD-CE6CB5CD048A", "revision_number": 3, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/E0FD28DB-41F7-419A-96AD-CE6CB5CD048A/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nilay Ghosh", "profile_url": "https://biology.stackexchange.com/users/16927/nilay-ghosh", "user_type": "registered"}, "created_at": "2024-06-20T02:21:52+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "E08E0C13-2ECC-4639-8F4F-9F677D2D908E", "revision_number": 4, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/E08E0C13-2ECC-4639-8F4F-9F677D2D908E/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nilay Ghosh", "profile_url": "https://biology.stackexchange.com/users/16927/nilay-ghosh", "user_type": "registered"}, "created_at": "2024-06-20T02:34:13+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "9636BCC7-C4D8-4142-8050-4362B529C013", "revision_number": 5, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/9636BCC7-C4D8-4142-8050-4362B529C013/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nilay Ghosh", "profile_url": "https://biology.stackexchange.com/users/16927/nilay-ghosh", "user_type": "registered"}, "created_at": "2024-06-20T02:42:24+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "56AD084F-39BD-4A9F-A4BB-C774F033D2E0", "revision_number": 6, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/56AD084F-39BD-4A9F-A4BB-C774F033D2E0/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Nilay Ghosh", "profile_url": "https://biology.stackexchange.com/users/16927/nilay-ghosh", "user_type": "registered"}, "created_at": "2024-06-20T03:05:57+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "63600F43-018F-46CB-9B54-FA142903CACC", "revision_number": 7, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/63600F43-018F-46CB-9B54-FA142903CACC/view-source"}], "score": 8, "updated_at": "2024-06-20T03:05:57+00:00"}, {"answer_html": "

I apologize for not being very scientific in this, I will explain how I understand this, based on my experience as a chemist, my whole life trying to understand how these groupings of atoms behave.\nChemistry is the science of how electrons fit together. I could say "the orbitals" of electrons, but we all know that there are no balls orbiting in atoms. Electrons are this phenomenon that occupies space in what we call an orbital. Sometimes orbitals are unstable and electrons are accommodated in other ways between nuclei.

\n

Well then. From the moment the number of electrons reaches that of Gold, a very strange thing appears. The orbitals no longer behave according to the Schrodinger equation.\nIn heavy atoms like gold, relativistic effects become significant because the inner electrons move at speeds close to the speed of light. This increases their relativistic mass and contracts the s orbitals while expanding the d orbitals.\nThe unique color of gold is due to these relativistic effects. The contraction of the 6s orbital and expansion of the 5d orbital reduce the energy gap between these orbitals. This shifts the absorption of light to the blue end of the spectrum, making the reflected light appear yellow to human eyes.\nRelativistic effects also influence gold’s chemical behavior, making it more inert compared to other metals like silver. This is because the contracted 6s electrons are less available for bonding, contributing to gold’s resistance to oxidation and its ability to form unique compounds.

\n

intuitively (it's all we chemists can do to understand these quantum phenomena), this causes a bubble. Extremely stable, causing a gold that does not react with almost anything. This little ball is the nucleus of everything that comes after in the periodic table.

\n

But biochemistry (for me, at least and we are a product of biochemistry for me) is a way for atoms to organize themselves so that electrons can create gradients of thermodynamic properties suitable for creating the minimum entropy outputs we call life. Now, these little balls get in the way, they don't enter the game. They become insensitive to the entropic flows that cause life.\nThis, my colleague, is how I understand that these heavy metals cannot be eliminated from the body. Biochemistry based on non-equilibrium thermodynamics has no way of dealing with them.\nThe toxicity of metalloids, on the other hand, appears to have other factors. Biochemistry is a game between complex structures of non-metallic atoms with occasional and specific roles of metals, as in hemoglobin and chlorophyll. Precisely because of the distinct roles that metals are said to be "chelated" when assimilated into biochemical structures.\nThe periodic table, however, includes a few intermediate elements between metals and non-metals, these metalloids. When they have lower atomic numbers, they have eccentric effects in biochemistry, a widely used property of B, Si, and Se. They may offer an exquisite effect on the molecule, but of course, it's use is limited. Although there is so much Si on Earth, life can't use more than a little quantity.\nIn contrast, As, Sb, Te, and Ge are highly toxic and exposure can cause various physiological dysfunctions, growth defects, and human diseases.\nThe toxicity of metalloids, on the other hand, appears to have other factors. Biochemistry is a game between complex structures of non-metallic atoms with occasional and specific roles of metals, as in hemoglobin and chlorophyll. Precisely because of the distinct roles that metals are said to be "chelated" when assimilated into biochemical structures.

\n

Despite being heavier than Si, all four of these metalloids are lighter than gold, so this toxicity comes from other properties.\nIn fact, the biochemistry of the toxicity has been an object of research (Front. Cell Dev. Biol., 28 August 2018, Sec. Cellular Biochemistry, Volume 6 - 2018 | https://doi.org/10.3389/fcell.2018.00099).

\n

We have to take into account that life developed in the crust of a planet that contains much more phosphorus (1,050 mg/kg or 0.105%) than arsenic (1.8 mg/kg or 0.00018%) and much more selenium (0.05 mg/kg or 50 parts per billion, ppb)​ than (tellurium 0.001 mg/kg or 1 part per billion, ppb)​ and these two pairs of elements have very similar properties.

\n

Phosphorus (P) and arsenic (As) are both group 15 elements in the periodic table, sharing many chemical properties due to their similar electronic configurations. Here are some key comparisons:

\n

Chemical Properties (P/Ar)\nOxidation States: Both elements exhibit common oxidation states of -3, +3, and +5.\nHydrides: Both form hydrides, such as phosphine (PH₃) and arsine (AsH₃). These are similar in structure but differ in stability and reactivity; arsine is generally more toxic and less stable.\nOxoacids: Phosphorus forms several oxoacids like phosphoric acid (H₃PO₄), while arsenic forms analogous compounds like arsenic acid (H₃AsO₄). These compounds have similar structures but differ in toxicity and some chemical properties.\nSimilar Molecules\nPhosphates and Arsenates: Both elements form compounds such as phosphates (PO₄³⁻) and arsenates (AsO₄³⁻). These ions are structurally similar and often substitute for each other in minerals.\nOrganic Compounds: Phosphorus and arsenic both form organophosphorus and organoarsenic compounds. These compounds are used in pesticides, herbicides, and other chemicals. However, organoarsenic compounds are often more toxic.

\n

Selenium (Se) and tellurium (Te) are both chalcogens (group 16 elements) and share many similar chemical properties, but they also have distinct differences due to their positions in the periodic table.

\n

Chemical Properties (Se/Te)\nOxidation States: Both elements commonly exhibit oxidation states of -2, +4, and +6.\nHydrides: Selenium forms hydrogen selenide (H₂Se), and tellurium forms hydrogen telluride (H₂Te). These hydrides are analogous in structure but differ significantly in stability and toxicity, with H₂Te being more unstable and toxic.\nOxoacids: Selenium forms selenous acid (H₂SeO₃) and selenic acid (H₂SeO₄), while tellurium forms tellurous acid (H₂TeO₃) and telluric acid (H₂TeO₄). These oxoacids are structurally similar but have different chemical behaviors and reactivities.\nAllotropes: Selenium has several allotropes, including red, gray, and black forms, with different properties. Tellurium has fewer allotropes, mainly existing in a metallic form.\nSimilar Molecules\nCompounds with Oxygen: Both form dioxides (SeO₂ and TeO₂) and trioxides (SeO₃ and TeO₃). These compounds are used in various chemical processes and have similar structures.\nOrganometallic Compounds: Selenium and tellurium form organometallic compounds used in organic synthesis and materials science.

\n

The fact that arsenic is confused with phosphorus is a true tragedy, as phosphorus is crucial in the most fundamental of biochemical reactions, the storage and release of energy. Arsenic spreads throughout the body and ends up being treated not as a foreign element, but as an essential part of metabolism.

\n

(see, for instance, Environ Toxicol Pharmacol. 2015 Mar;39(2):668-76. doi: 10.1016/j.etap.2015.01.012. Epub 2015 Feb 3. The arsenic accumulation and its effect on oxidative stress responses in juvenile rockfish, Sebastes schlegelii, exposed to waterborne arsenic (As₃+) Jun-Hwan Kim, Ju-Chan Kang)

\n

Selenium isn't so useful indeed, although there are some crucial enzymes containing Selenium, like glutathione peroxidase. I'll reproduce what Bienert and Tamas say about tellurium toxicity (Front. Cell Dev. Biol., 28 August 2018 Sec. Cellular Biochemistry, Volume 6 - 2018 | https://doi.org/10.3389/fcell.2018.00099):

\n

Certain chemical Te species, such as the tellurite oxyanion (TeO₂)³⁻, are highly toxic for most organisms (Lemire et al., 2013). The molecular mechanisms of tellurite toxicity and resistance remain to be fully understood. Turner and colleagues (Vrionis et al.) investigated the effect of selenite on tellurite toxicity in the bacterium Escherichia coli. The authors found that co-exposure to selenite strongly increased bacterial resistance to tellurite. Potential mechanisms of this protective effect of selenite are discussed.

\n

I hope it covers the toxicity of the main elements.

\n", "answer_id": 114887, "answer_text": "I apologize for not being very scientific in this, I will explain how I understand this, based on my experience as a chemist, my whole life trying to understand how these groupings of atoms behave.\nChemistry is the science of how electrons fit together. I could say \"the orbitals\" of electrons, but we all know that there are no balls orbiting in atoms. Electrons are this phenomenon that occupies space in what we call an orbital. Sometimes orbitals are unstable and electrons are accommodated in other ways between nuclei.\n\n\n\n\nWell then. From the moment the number of electrons reaches that of Gold, a very strange thing appears. The orbitals no longer behave according to the Schrodinger equation.\nIn heavy atoms like gold, relativistic effects become significant because the inner electrons move at speeds close to the speed of light. This increases their relativistic mass and contracts the s orbitals while expanding the d orbitals.\nThe unique color of gold is due to these relativistic effects. The contraction of the 6s orbital and expansion of the 5d orbital reduce the energy gap between these orbitals. This shifts the absorption of light to the blue end of the spectrum, making the reflected light appear yellow to human eyes.\nRelativistic effects also influence gold’s chemical behavior, making it more inert compared to other metals like silver. This is because the contracted 6s electrons are less available for bonding, contributing to gold’s resistance to oxidation and its ability to form unique compounds.\n\n\n\n\nintuitively (it's all we chemists can do to understand these quantum phenomena), this causes a bubble. Extremely stable, causing a gold that does not react with almost anything. This little ball is the nucleus of everything that comes after in the periodic table.\n\n\n\n\nBut biochemistry (for me, at least and we are a product of biochemistry for me) is a way for atoms to organize themselves so that electrons can create gradients of thermodynamic properties suitable for creating the minimum entropy outputs we call life. Now, these little balls get in the way, they don't enter the game. They become insensitive to the entropic flows that cause life.\nThis, my colleague, is how I understand that these heavy metals cannot be eliminated from the body. Biochemistry based on non-equilibrium thermodynamics has no way of dealing with them.\nThe toxicity of metalloids, on the other hand, appears to have other factors. Biochemistry is a game between complex structures of non-metallic atoms with occasional and specific roles of metals, as in hemoglobin and chlorophyll. Precisely because of the distinct roles that metals are said to be \"chelated\" when assimilated into biochemical structures.\nThe periodic table, however, includes a few intermediate elements between metals and non-metals, these metalloids. When they have lower atomic numbers, they have eccentric effects in biochemistry, a widely used property of B, Si, and Se. They may offer an exquisite effect on the molecule, but of course, it's use is limited. Although there is so much Si on Earth, life can't use more than a little quantity.\nIn contrast, As, Sb, Te, and Ge are highly toxic and exposure can cause various physiological dysfunctions, growth defects, and human diseases.\nThe toxicity of metalloids, on the other hand, appears to have other factors. Biochemistry is a game between complex structures of non-metallic atoms with occasional and specific roles of metals, as in hemoglobin and chlorophyll. Precisely because of the distinct roles that metals are said to be \"chelated\" when assimilated into biochemical structures.\n\n\n\n\nDespite being heavier than Si, all four of these metalloids are lighter than gold, so this toxicity comes from other properties.\nIn fact, the biochemistry of the toxicity has been an object of research (Front. Cell Dev. Biol., 28 August 2018, Sec. Cellular Biochemistry, Volume 6 - 2018 | https://doi.org/10.3389/fcell.2018.00099 (https://doi.org/10.3389/fcell.2018.00099)).\n\n\n\n\nWe have to take into account that life developed in the crust of a planet that contains much more phosphorus (1,050 mg/kg or 0.105%) than arsenic (1.8 mg/kg or 0.00018%) and much more selenium (0.05 mg/kg or 50 parts per billion, ppb)​ than (tellurium 0.001 mg/kg or 1 part per billion, ppb)​ and these two pairs of elements have very similar properties.\n\n\n\n\nPhosphorus (P) and arsenic (As) are both group 15 elements in the periodic table, sharing many chemical properties due to their similar electronic configurations. Here are some key comparisons:\n\n\n\n\nChemical Properties (P/Ar)\nOxidation States: Both elements exhibit common oxidation states of -3, +3, and +5.\nHydrides: Both form hydrides, such as phosphine (PH₃) and arsine (AsH₃). These are similar in structure but differ in stability and reactivity; arsine is generally more toxic and less stable.\nOxoacids: Phosphorus forms several oxoacids like phosphoric acid (H₃PO₄), while arsenic forms analogous compounds like arsenic acid (H₃AsO₄). These compounds have similar structures but differ in toxicity and some chemical properties.\nSimilar Molecules\nPhosphates and Arsenates: Both elements form compounds such as phosphates (PO₄³⁻) and arsenates (AsO₄³⁻). These ions are structurally similar and often substitute for each other in minerals.\nOrganic Compounds: Phosphorus and arsenic both form organophosphorus and organoarsenic compounds. These compounds are used in pesticides, herbicides, and other chemicals. However, organoarsenic compounds are often more toxic.\n\n\n\n\nSelenium (Se) and tellurium (Te) are both chalcogens (group 16 elements) and share many similar chemical properties, but they also have distinct differences due to their positions in the periodic table.\n\n\n\n\nChemical Properties (Se/Te)\nOxidation States: Both elements commonly exhibit oxidation states of -2, +4, and +6.\nHydrides: Selenium forms hydrogen selenide (H₂Se), and tellurium forms hydrogen telluride (H₂Te). These hydrides are analogous in structure but differ significantly in stability and toxicity, with H₂Te being more unstable and toxic.\nOxoacids: Selenium forms selenous acid (H₂SeO₃) and selenic acid (H₂SeO₄), while tellurium forms tellurous acid (H₂TeO₃) and telluric acid (H₂TeO₄). These oxoacids are structurally similar but have different chemical behaviors and reactivities.\nAllotropes: Selenium has several allotropes, including red, gray, and black forms, with different properties. Tellurium has fewer allotropes, mainly existing in a metallic form.\nSimilar Molecules\nCompounds with Oxygen: Both form dioxides (SeO₂ and TeO₂) and trioxides (SeO₃ and TeO₃). These compounds are used in various chemical processes and have similar structures.\nOrganometallic Compounds: Selenium and tellurium form organometallic compounds used in organic synthesis and materials science.\n\n\n\n\nThe fact that arsenic is confused with phosphorus is a true tragedy, as phosphorus is crucial in the most fundamental of biochemical reactions, the storage and release of energy. Arsenic spreads throughout the body and ends up being treated not as a foreign element, but as an essential part of metabolism.\n\n\n\n\n(see, for instance, Environ Toxicol Pharmacol. 2015 Mar;39(2):668-76. doi: 10.1016/j.etap.2015.01.012. Epub 2015 Feb 3. The arsenic accumulation and its effect on oxidative stress responses in juvenile rockfish, Sebastes schlegelii, exposed to waterborne arsenic (As₃+) Jun-Hwan Kim, Ju-Chan Kang)\n\n\n\n\nSelenium isn't so useful indeed, although there are some crucial enzymes containing Selenium, like glutathione peroxidase. I'll reproduce what Bienert and Tamas say about tellurium toxicity (Front. Cell Dev. Biol., 28 August 2018 Sec. Cellular Biochemistry, Volume 6 - 2018 | https://doi.org/10.3389/fcell.2018.00099 (https://doi.org/10.3389/fcell.2018.00099)):\n\n\n\n\nCertain chemical Te species, such as the tellurite oxyanion (TeO₂)³⁻, are highly toxic for most organisms (Lemire et al., 2013). The molecular mechanisms of tellurite toxicity and resistance remain to be fully understood. Turner and colleagues (Vrionis et al.) investigated the effect of selenite on tellurite toxicity in the bacterium Escherichia coli. The authors found that co-exposure to selenite strongly increased bacterial resistance to tellurite. Potential mechanisms of this protective effect of selenite are discussed.\n\n\n\n\nI hope it covers the toxicity of the main elements.", "answer_url": "https://biology.stackexchange.com/a/114887", "author": "Alfredo Maranca", "author_url": "https://biology.stackexchange.com/users/81801/alfredo-maranca", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2024-06-19T03:05:44+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:27.977583+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/1cbf95322a17dce0fd00a109179063ffe60bcd4bddc6e720f0ca398ee7aa9da8_0.json", "raw_sha256": "a096c86028a279b01346143890b4827bd8ed05afc0a76bd7c8bcb840211dc20e", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/114983;114969;114966;114963;114939;114936;114918;114909;114904;114899;114888;114885;114881;114875;114874;114873;114872;114864;114857;114850;114846;114841;114834;114827;114821;114819;114813;114804;114791;114784;114768;114765;114762;114760;114758;114755;114745;114741;114739;114738;114732;114730;114726;114714;114706;114695;114691;114690;114686;114683;114677;114675;114666;114660;114656;114653;114642;114641;114632;114628;114620;114618;114613;114601;114599;114597;114581;114577;114573;114567;114558;114555;114553;114552;114547;114545;114543;114542;114541;114539;114529;114524;114516;114502;114501;114498;114495;114492;114481;114476;114474;114470;114453;114451;114449;114448;114446;114440;114438;114435/answers?filter=withbody&order=asc&page=1&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 114873, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Alfredo Maranca", "profile_url": "https://biology.stackexchange.com/users/81801/alfredo-maranca", "user_type": "registered"}, "created_at": "2024-06-19T03:05:44+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "83358FDD-09B6-4949-A9A5-B0D6C80D549D", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/83358FDD-09B6-4949-A9A5-B0D6C80D549D/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Alfredo Maranca", "profile_url": "https://biology.stackexchange.com/users/81801/alfredo-maranca", "user_type": "registered"}, "created_at": "2024-06-19T18:31:57+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "4062E4B4-71EA-4FC5-AFAC-DBAD7CB1350E", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/4062E4B4-71EA-4FC5-AFAC-DBAD7CB1350E/view-source"}], "score": 2, "updated_at": "2024-06-19T18:31:57+00:00"}, {"answer_html": "

I would answer this question in a different way. As others have pointed out above, elements behave differently than one another even when they have the same number of valence electrons. This makes it possible for some elements to be more toxic than others, even when they're in the same row of the periodic table. But (again, as others have pointed out) it doesn't explain why there's a tendency for the heavier elements to be more toxic. And then there's the curious fact that not all of the heavier elements are toxic, and not all of the lighter ones are non-toxic. On top of that, the mechanisms of toxicity are very different for different toxic elements.

\n

I would argue that the general rule is this: organisms haven't evolved to deal with unusually high concentrations of elements. Heavy elements, because they're rare, are hardly ever encountered at high concentrations. Does this mean that they are necessarily toxic? No - organisms might be able to deal with high concentrations of them, just by chance. For this reason, some rare elements happen to be non-toxic. But others mess with biomolecular functions in ways that organisms haven't evolved to counteract.

\n

In contrast, organisms must be able to deal with common elements at significant concentrations - in other words, those elements must be non-toxic, even if they're chemically reactive. For example, oxygen isn't toxic even in high concentrations because most organisms that couldn't tolerate oxygen went extinct eons ago, when the oxygen concentration in the atmosphere first rose to significant levels.

\n

Hypotheses like this run the risk of being circular or meaningless. ("X isn't harmful to organisms because they've evolved to be resistant to X. The proof is that X doesn't harm organisms!") However, we can put this hypothesis to the test, at least to some degree, by looking at organisms that encounter different elements. Organisms should show specific adaptations to deal with reactive chemicals that are common in their particular environment; they should lack adaptations specific to dealing with rare chemicals. For instance, aerobic bacteria should generate antioxidants, and the genes coding for these defenses should show signs of conservative selection; this shouldn't be the case for anaerobic microbes that rarely encounter oxygen.

\n

I apologize for not supplying more specifics (or citations). I'm in a bit of a rush. But I hope this way of re-framing the question is useful!

\n", "answer_id": 114892, "answer_text": "I would answer this question in a different way. As others have pointed out above, elements behave differently than one another even when they have the same number of valence electrons. This makes it possible for some elements to be more toxic than others, even when they're in the same row of the periodic table. But (again, as others have pointed out) it doesn't explain why there's a tendency for the heavier elements to be more toxic. And then there's the curious fact that not all of the heavier elements are toxic, and not all of the lighter ones are non-toxic. On top of that, the mechanisms of toxicity are very different for different toxic elements.\n\n\n\n\nI would argue that the general rule is this: organisms haven't evolved to deal with unusually high concentrations of elements. Heavy elements, because they're rare, are hardly ever encountered at high concentrations. Does this mean that they are necessarily toxic? No - organisms might be able to deal with high concentrations of them, just by chance. For this reason, some rare elements happen to be non-toxic. But others mess with biomolecular functions in ways that organisms haven't evolved to counteract.\n\n\n\n\nIn contrast, organisms must be able to deal with common elements at significant concentrations - in other words, those elements must be non-toxic, even if they're chemically reactive. For example, oxygen isn't toxic even in high concentrations because most organisms that couldn't tolerate oxygen went extinct eons ago, when the oxygen concentration in the atmosphere first rose to significant levels.\n\n\n\n\nHypotheses like this run the risk of being circular or meaningless. (\"X isn't harmful to organisms because they've evolved to be resistant to X. The proof is that X doesn't harm organisms!\") However, we can put this hypothesis to the test, at least to some degree, by looking at organisms that encounter different elements. Organisms should show specific adaptations to deal with reactive chemicals that are common in their particular environment; they should lack adaptations specific to dealing with rare chemicals. For instance, aerobic bacteria should generate antioxidants, and the genes coding for these defenses should show signs of conservative selection; this shouldn't be the case for anaerobic microbes that rarely encounter oxygen.\n\n\n\n\nI apologize for not supplying more specifics (or citations). I'm in a bit of a rush. But I hope this way of re-framing the question is useful!", "answer_url": "https://biology.stackexchange.com/a/114892", "author": "Brian", "author_url": "https://biology.stackexchange.com/users/81889/brian", "author_user_type": "registered", "content_license": "CC BY-SA 4.0", "created_at": "2024-06-20T13:24:13+00:00", "is_accepted": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:29.530612+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/3ec390b88d6fcaad2351183fd6d84ec73799b065a6f093dbbc0eea59e94500ce_0.json", "raw_sha256": "a2f08981a2307fb8f456a33e92a38855de4bf9e165d024d5b20a23d9f8d656e1", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/questions/114983;114969;114966;114963;114939;114936;114918;114909;114904;114899;114888;114885;114881;114875;114874;114873;114872;114864;114857;114850;114846;114841;114834;114827;114821;114819;114813;114804;114791;114784;114768;114765;114762;114760;114758;114755;114745;114741;114739;114738;114732;114730;114726;114714;114706;114695;114691;114690;114686;114683;114677;114675;114666;114660;114656;114653;114642;114641;114632;114628;114620;114618;114613;114601;114599;114597;114581;114577;114573;114567;114558;114555;114553;114552;114547;114545;114543;114542;114541;114539;114529;114524;114516;114502;114501;114498;114495;114492;114481;114476;114474;114470;114453;114451;114449;114448;114446;114440;114438;114435/answers?filter=withbody&order=asc&page=2&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_id": 114873, "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Brian", "profile_url": "https://biology.stackexchange.com/users/81889/brian", "user_type": "registered"}, "created_at": "2024-06-20T13:24:13+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "489EAF49-D487-4573-9EB1-1F8055303A3D", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/489EAF49-D487-4573-9EB1-1F8055303A3D/view-source"}], "score": 7, "updated_at": "2024-06-20T13:24:13+00:00"}], "domain": "biology", "external_links": ["https://Pb%20toxicity%20causes%20oxidative%20stress%20by%20reactive%20oxygen%20species%20(ROS)%20production%20and%20depletion%20of%20antioxidant%20enzymes", "https://doi.org/10.3389/fcell.2018.00099", "https://en.wikipedia.org/wiki/Oxidative_stress", "https://i.sstatic.net/M6Jal9cp.png", "https://i.sstatic.net/oTmaNfHA.png", "https://journals.physiology.org/doi/full/10.1152/ajpheart.00158.2008", "https://pubmed.ncbi.nlm.nih.gov/10963860/", "https://pubmed.ncbi.nlm.nih.gov/15984876/", "https://pubmed.ncbi.nlm.nih.gov/6314931/", "https://sites.tufts.edu/leadpoisoning/pathways/lead-and-calcium/", "https://www.frontiersin.org/journals/pharmacology/articles/10.3389/fphar.2021.643972/full", "https://www.intechopen.com/chapters/71913", "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4144270/", "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4427717/", "https://www.researchgate.net/figure/Figure-depicting-the-mechanisms-of-lead-toxicity-It-can-thus-be-concluded-that-inhibitory_fig4_6313819", "https://www.semanticscholar.org/paper/Molecular-mechanisms-of-lead-toxicity-Szymanski/2eac0c763e0efc5057617c30b826534b41ec8a32"], "medical_sensitive": true, "patient_specific": false, "provenance": {"attribution_required": true, "collected_at": "2026-10-01T03:03:07.165481+00:00", "license": "CC BY-SA 4.0", "license_url": "https://creativecommons.org/licenses/by-sa/4.0/", "raw_file": "raw/codex_api_v1/b97a755f39b54a1e8a057fa5e484426784aa17a1971c6ef0ca759105de983078_0.json", "raw_sha256": "4c9dcc077d306d60a8b8a237ad3f9b3144c0d5885fa62ef1bfdd55d2fbbdaf6a", "source_api": "Stack Exchange API 2.3", "source_url": "https://api.stackexchange.com/2.3/search/advanced?answers=1&filter=withbody&order=desc&page=6&pagesize=100&site=biology&sort=creation", "transformation": "API HTML retained; mechanical HTML-to-text; no LLM rewriting"}, "question_author": "Shaktyai", "question_author_url": "https://biology.stackexchange.com/users/81716/shaktyai", "question_author_user_type": "registered", "question_created_at": "2024-06-17T17:52:31+00:00", "question_html": "

I have read the different answers on the toxicity of heavy metals but I am still confused about the topic. Why does the mass of the nuclei matter when chemical reactions only involve the electrons. Carbon and lead are in the same chemical group and thus have the same chemical properties.

\n", "question_id": 114873, "question_license": "CC BY-SA 4.0", "question_score": 11, "question_text": "I have read the different answers on the toxicity of heavy metals but I am still confused about the topic. Why does the mass of the nuclei matter when chemical reactions only involve the electrons. Carbon and lead are in the same chemical group and thus have the same chemical properties.", "revision_attribution": [{"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Shaktyai", "profile_url": "https://biology.stackexchange.com/users/81716/shaktyai", "user_type": "registered"}, "created_at": "2024-06-17T17:52:31+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "1774FD53-88D6-4485-964B-CF82F5BC54EE", "revision_number": 1, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/1774FD53-88D6-4485-964B-CF82F5BC54EE/view-source"}, {"content_license": "CC BY-SA 4.0", "contributor": {"display_name": "Shaktyai", "profile_url": "https://biology.stackexchange.com/users/81716/shaktyai", "user_type": "registered"}, "created_at": "2024-06-17T18:39:10+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "678620DF-97D0-4CB5-A364-BA26C3A55E5C", "revision_number": 2, "revision_type": "single_user", "revision_url": "https://biology.stackexchange.com/revisions/678620DF-97D0-4CB5-A364-BA26C3A55E5C/view-source"}, {"content_license": null, "contributor": {"display_name": "[deleted/unavailable user]", "profile_url": null, "user_type": "does_not_exist"}, "created_at": "2024-06-18T01:55:56+00:00", "raw_file": "raw/codex_api_v1/b71692d4db54b1fd919e08bbd0e4d956635bb827b0cfa306c28bd8ef9b9590f2_1790824086740368100_0.json", "raw_sha256": "fa87ea0a08a62d73a8b2c94b9665153275b3cd424a985b194879915043e1dde4", "revision_guid": "77393B27-0D1F-43BA-B0E1-0D1396264871", "revision_number": null, "revision_type": "vote_based", "revision_url": "https://biology.stackexchange.com/revisions/77393B27-0D1F-43BA-B0E1-0D1396264871/view-source"}], "source_site": "biology", "source_url": "https://biology.stackexchange.com/questions/114873/why-are-heavy-metals-toxic-lead-and-carbon-are-in-the-same-group-one-is-toxic", "split": "train", "split_group": "b07cbbb6240f19f7e25a6609b7babe542edb2bc5e32f7ccf2e52ef543e65fff6", "tags": ["biochemistry", "cell-biology"], "thread_id": "biology:114873", "title": "Why are heavy metals toxic? Lead and Carbon are in the same group. One is toxic, the other is not"}}