{"id":380,"date":"2026-03-31T07:21:22","date_gmt":"2026-03-31T07:21:22","guid":{"rendered":"https:\/\/www.endogeneity.net\/?page_id=380"},"modified":"2026-04-06T21:09:10","modified_gmt":"2026-04-06T21:09:10","slug":"flowchart","status":"publish","type":"page","link":"https:\/\/www.endogeneity.net\/?page_id=380","title":{"rendered":"Flowchart"},"content":{"rendered":"<div class=\"fusion-fullwidth fullwidth-box fusion-builder-row-1 fusion-flex-container has-pattern-background has-mask-background nonhundred-percent-fullwidth hundred-percent-height hundred-percent-height-center-content non-hundred-percent-height-scrolling\" style=\"--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-padding-top:0px;--awb-padding-bottom:0px;--awb-margin-bottom:0px;--awb-flex-wrap:wrap;\" ><div class=\"fusion-builder-row fusion-row fusion-flex-align-items-flex-start fusion-flex-content-wrap\" style=\"max-width:1248px;margin-left: calc(-4% \/ 2 );margin-right: calc(-4% \/ 2 );\"><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-0 fusion_builder_column_1_1 1_1 fusion-flex-column\" style=\"--awb-bg-size:cover;--awb-width-large:100%;--awb-margin-top-large:0px;--awb-spacing-right-large:1.92%;--awb-margin-bottom-large:20px;--awb-spacing-left-large:1.92%;--awb-width-medium:100%;--awb-order-medium:0;--awb-spacing-right-medium:1.92%;--awb-spacing-left-medium:1.92%;--awb-width-small:100%;--awb-order-small:0;--awb-spacing-right-small:1.92%;--awb-spacing-left-small:1.92%;\"><div class=\"fusion-column-wrapper fusion-column-has-shadow fusion-flex-justify-content-flex-start fusion-content-layout-column\"><div id=\"endo-app\">\n\n  <!-- START SCREEN -->\n  <div id=\"start-screen\" class=\"start-screen\">\n    <h1 class=\"tool-title\">The Endogeneity Decision Tool<\/h1>\n    <p class=\"tool-subtitle\">Navigating Endogeneity in Marketing Research<\/p>\n\n    <div class=\"intro-panel\">\n      <p>\n        The Endogeneity Decision Tool helps researchers navigate the key choices they face when studying causal relationships using real-world data.\n      <\/p>\n    <\/div>\n\n    <button id=\"start-btn\" class=\"start-btn\" type=\"button\">\n      Start\n    <\/button>\n  <\/div>\n\n  <!-- TOOL SCREEN -->\n  <div id=\"tool-screen\" class=\"hidden\">\n    <div id=\"endo-flowchart\" class=\"endo-tool\">\n      <div class=\"tool-header\">\n        <div class=\"tool-header-row\">\n          <span class=\"tool-kicker\">Endogeneity Decision Tool<\/span>\n          <button id=\"header-restart\" class=\"header-restart hidden\" type=\"button\">Restart<\/button>\n        <\/div>\n        <p class=\"intro\">Answer the questions below to receive a recommended methodological approach.<\/p>\n      <\/div>\n\n      <!-- PROGRESS -->\n      <div class=\"progress-wrap hidden\" id=\"progress-wrap\">\n        <div class=\"progress-bar\">\n          <div class=\"progress-fill\" id=\"progress-fill\"><\/div>\n        <\/div>\n      <\/div>\n\n      <div class=\"step\" id=\"step-1\" data-question=\"1\">\n        <div class=\"card\">\n          <div class=\"step-label\">Question 1<\/div>\n          <h3>Is it possible to manipulate the predictor in the field?<\/h3>\n          <div class=\"actions\">\n            <button data-next=\"step-2a\" type=\"button\">Yes<\/button>\n            <button data-next=\"step-2b\" type=\"button\">No<\/button>\n          <\/div>\n        <\/div>\n      <\/div>\n\n      <div class=\"step hidden\" id=\"step-2a\" data-question=\"2\">\n        <div class=\"card\">\n          <div class=\"step-label\">Question 2<\/div>\n          <h3>Field Experiment<\/h3>\n          <p>Is it possible to randomize exposure to the different levels of the predictor?<\/p>\n          <div class=\"actions\">\n            <button data-result=\"No endogeneity in predictor \u2192 Analysis of Variance\" data-final-question=\"2\" type=\"button\">Yes<\/button>\n            <button data-next=\"step-3a\" type=\"button\">No<\/button>\n          <\/div>\n        <\/div>\n      <\/div>\n\n      <div class=\"step hidden\" id=\"step-2b\" data-question=\"2\">\n        <div class=\"card\">\n          <div class=\"step-label\">Question 2<\/div>\n          <h3>Is there natural variation in the predictor in the field?<\/h3>\n          <div class=\"actions\">\n            <button data-next=\"step-3a\" type=\"button\">Yes<\/button>\n            <button data-next=\"step-obs\" type=\"button\">No<\/button>\n          <\/div>\n        <\/div>\n      <\/div>\n\n      <div class=\"step hidden\" id=\"step-3a\" data-question=\"3\">\n        <div class=\"card\">\n          <div class=\"step-label\">Question 3<\/div>\n          <h3>Quasi-Experiment<\/h3>\n          <p>Is the variation over time in the predictor exogenous?<\/p>\n          <div class=\"actions\">\n            <button data-result=\"No time-variant endogeneity in predictor (after matching) \u2192 Difference-in-Differences Analysis\" data-final-question=\"3\" type=\"button\">Yes<\/button>\n            <button data-next=\"step-obs\" type=\"button\">No<\/button>\n          <\/div>\n        <\/div>\n      <\/div>\n\n      <div class=\"step hidden\" id=\"step-obs\" data-question=\"4\">\n        <div class=\"card dark\">\n          <div class=\"step-label inverse\">Observational Study<\/div>\n          <h3>Which endogeneity threat is most relevant?<\/h3>\n          <p>Carefully and proactively address potential sources of endogeneity before selecting a final analytical strategy. You may select more than one option. <a href=\"https:\/\/www.endogeneity.net\/?page_id=60\" class=\"white-link\" target=\"_blank\" rel=\"noopener noreferrer\">Please refer to the different sources here.<\/a><\/p>\n          <div class=\"actions stack\">\n            <button data-threat=\"ov\" type=\"button\">Omitted Variable<\/button>\n            <button data-threat=\"ts\" type=\"button\">Treatment Selection<\/button>\n            <button data-threat=\"sim\" type=\"button\">Simultaneity<\/button>\n            <button data-threat=\"me\" type=\"button\">Measurement Error<\/button>\n            <button data-threat=\"ss\" type=\"button\">Sample Selection<\/button>\n          <\/div>\n          <div class=\"actions\">\n            <button id=\"obs-continue-btn\" type=\"button\" disabled>Continue<\/button>\n          <\/div>\n        <\/div>\n      <\/div>\n\n      <div class=\"step hidden\" id=\"step-threat-summary\" data-question=\"4\">\n        <div class=\"card\">\n          <div class=\"step-label\">Intermediate Result<\/div>\n          <h3 id=\"threat-summary-title\">Selected endogeneity threat<\/h3>\n          <div id=\"threat-summary-content\"><\/div>\n          <div class=\"actions\">\n            <button data-next=\"step-sensitivity\" type=\"button\">Continue to evaluate remaining endogeneity threats<\/button>\n          <\/div>\n        <\/div>\n      <\/div>\n\n      <div class=\"step hidden\" id=\"step-sensitivity\" data-question=\"5\">\n        <div class=\"card\">\n          <div class=\"step-label\">Question 5<\/div>\n          <h3>Sensitivity Approach<\/h3>\n          <p><a href=\"https:\/\/www.endogeneity.net\/?page_id=218\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"color: blue;\">Run a sensitivity analysis (click for more information).<br> <\/a> After running a sensitivity analysis: Is it (still) likely that an unobserved confound would alter the conclusion?<\/p>\n          <div class=\"actions\">\n            <button data-next=\"step-iv\" type=\"button\">Yes<\/button>\n            <button data-result=\"No remaining endogeneity concern \u2192 Regression Analysis\" data-final-question=\"5\" type=\"button\">No<\/button>\n          <\/div>\n        <\/div>\n      <\/div>\n\n      <div class=\"step hidden\" id=\"step-iv\" data-question=\"6\">\n        <div class=\"card\">\n          <div class=\"step-label\">Question 6<\/div>\n          <h3>Is a strong and valid instrument for the predictor available?<\/h3>\n          <p><a href=\"https:\/\/www.endogeneity.net\/?page_id=138\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"color: blue\">Click here for more information on finding instruments.<\/a><\/p>\n          <div class=\"actions\">\n            <button data-result=\"In order to attempt to cure remaining endogeneity threats use an Instrumental Variable Approach \u2192 Remove the endogenous part of the predictor. <br> <a href='https:\/\/www.endogeneity.net\/?page_id=443' target='_blank' rel='noopener noreferrer' style='color: blue'>Click here for more information on the Instrumental Variable Approach.<\/a>\" data-final-question=\"6\" type=\"button\">Yes<\/button>\n            <button data-next=\"step-instrumentfree\" type=\"button\">No<\/button>\n          <\/div>\n        <\/div>\n      <\/div>\n\n      <div class=\"step hidden\" id=\"step-instrumentfree\" data-question=\"7\">\n        <div class=\"card\">\n          <div class=\"step-label\">Question 7<\/div>\n          <h3>Are instrument-free approach requirements fulfilled?<\/h3>\n          <p><a href=\"https:\/\/www.endogeneity.net\/?page_id=437\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"color: blue\">Click here for more information on the Instrument Free Approach.<\/a><\/p>\n          <div class=\"actions\">\n            <button data-result=\"In order to attempt to cure remaining endogeneity threats use an Instrument-Free Approach \u2192 Remove or model the endogenous part of the predictor. <br> <a href='https:\/\/www.endogeneity.net\/?page_id=437' target='_blank' rel='noopener noreferrer' style='color: blue'>Click here for more information on the Instrument-Free Approach<\/a>\" data-final-question=\"7\" type=\"button\">Yes<\/button>\n            <button data-next=\"step-triangulate\" type=\"button\">No<\/button>\n          <\/div>\n        <\/div>\n      <\/div>\n\n      <div class=\"step hidden\" id=\"step-triangulate\" data-question=\"8\">\n        <div class=\"card\">\n          <div class=\"step-label\">Question 8<\/div>\n          <h3>Is it possible to triangulate the results with a controlled study?<\/h3>\n          <p><a href=\"https:\/\/www.endogeneity.net\/?page_id=432\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"color: blue\">Click here for more information on multi-method approaches.<\/a><\/p>\n          <div class=\"actions\">\n            <button data-result=\"In order to adress remaining endogeneity threats, use a Multi-Method Approach \u2192 Manipulate the predictor in an experimental study. <br> <a href='https:\/\/www.endogeneity.net\/?page_id=432' target='_blank' rel='noopener noreferrer' style='color: blue'>Click here for more information on the Multi-Method Approach<\/a>\" data-final-question=\"8\" type=\"button\">Yes<\/button>\n            <button data-result=\"When neither credible identification nor triangulation with experiments is possible, reconsider the research question or pivot to descriptive work that avoids causal claims. Well-executed descriptive work contributes by establishing empirical regularities that subsequent causal research must explain. This is especially valuable in rapidly evolving domains where documenting what is happening must precede understanding why.\" data-final-question=\"8\" type=\"button\">No<\/button>\n          <\/div>\n        <\/div>\n      <\/div>\n\n      <div class=\"result-divider hidden\" id=\"result-divider\"><\/div>\n\n      <div class=\"result hidden\" id=\"result-box\">\n        <div class=\"result-badge\">Recommended Outcome<\/div>\n        <h3>Your suggested approach<\/h3>\n        <div id=\"result-text\"><\/div>\n\n        <div id=\"result-help\" class=\"result-help hidden\">\n          <p class=\"result-help-title\">Helpful information:<\/p>\n          <div id=\"result-help-buttons\" class=\"result-help-buttons\"><\/div>\n        <\/div>\n\n        <div class=\"actions\">\n          <button id=\"restart-flowchart\" type=\"button\">Start over<\/button>\n        <\/div>\n      <\/div>\n    <\/div>\n  <\/div>\n\n<\/div>\n\n<style>\n  #endo-app {\n    max-width: 1400px;\n    margin: 0;\n    font-family: inherit;\n    color: #111827;\n  }\n\n  .hidden {\n    display: none !important;\n  }\n\n  .start-screen {\n    text-align: center;\n    padding: 12px 0 0;\n  }\n\n  .tool-title {\n    margin: 0 0 10px;\n    font-size: 38px !important;\n    line-height: 1.06;\n    font-weight: 800;\n    letter-spacing: -0.02em;\n    color: #0f172a;\n  }\n\n  .tool-subtitle {\n    margin: 0 0 34px;\n    font-size: 17px;\n    line-height: 1.5;\n    color: #374151;\n  }\n\n  .intro-panel {\n    background: linear-gradient(180deg, #f1f3f6 0%, #eceff3 100%);\n    border: 1px solid #dde3ea;\n    border-radius: 16px;\n    padding: 30px 34px;\n    text-align: left;\n    margin: 0 auto 30px;\n    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);\n  }\n\n  .intro-panel p {\n    margin: 0;\n    font-size: 17px;\n    line-height: 1.9;\n    color: #111827;\n  }\n\n  .start-btn {\n    width: 100%;\n    background: #778db3;\n    color: #ffffff;\n    border: none;\n    border-radius: 12px;\n    padding: 19px 24px;\n    font-size: 16px;\n    font-weight: 700;\n    letter-spacing: 0.01em;\n    cursor: pointer;\n    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;\n    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);\n  }\n\n  .start-btn:hover {\n    transform: translateY(-1px);\n    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.22);\n  }\n\n  .endo-tool {\n    width: 100%;\n    margin: 38px 0 0;\n    padding: 40px 48px;\n    border: 1px solid #e5e7eb;\n    border-radius: 24px;\n    background: #ffffff;\n    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.06);\n    box-sizing: border-box;\n  }\n\n  .tool-header {\n    margin-bottom: 22px;\n    padding-bottom: 18px;\n    border-bottom: 1px solid #edf0f3;\n  }\n\n  .tool-header-row {\n    display: flex;\n    align-items: center;\n    justify-content: space-between;\n    gap: 16px;\n  }\n\n  .tool-kicker {\n    display: inline-block;\n    margin-bottom: 10px;\n    padding: 6px 10px;\n    border-radius: 999px;\n    background: #eef2f7;\n    color: #334155;\n    font-size: 12px;\n    font-weight: 700;\n    letter-spacing: 0.04em;\n    text-transform: uppercase;\n  }\n\n  .header-restart {\n    background: #eef2f7 !important;\n    color: #334155 !important;\n    border: 1px solid transparent !important;\n    box-shadow: none !important;\n    padding: 10px 16px !important;\n    font-size: 14px !important;\n    border-radius: 10px !important;\n  }\n\n  .header-restart:hover {\n    background: #e2e8f0 !important;\n    color: #1f2937 !important;\n    transform: translateY(-1px);\n  }\n\n  .endo-tool .intro {\n    margin: 0;\n    font-size: 16px;\n    color: #4b5563;\n    line-height: 1.7;\n  }\n\n  .progress-wrap {\n    margin: 0 0 26px;\n  }\n\n  .progress-bar {\n    width: 100%;\n    height: 10px;\n    background: #e5e7eb;\n    border-radius: 999px;\n    overflow: hidden;\n  }\n\n  .progress-fill {\n    width: 12.5%;\n    height: 100%;\n    background: linear-gradient(90deg, #1f5b89 0%, #2f78b3 100%);\n    border-radius: 999px;\n    transition: width 0.25s ease;\n  }\n\n  .step {\n    margin-bottom: 20px;\n    animation: fadeInUp 0.28s ease;\n  }\n\n  .card {\n    border: 1px solid #e5e7eb;\n    border-radius: 20px;\n    padding: 28px 26px;\n    background: #f8fafc;\n    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);\n  }\n\n  .card h3 {\n    margin: 0 0 10px;\n    font-size: 24px;\n    line-height: 1.35;\n    color: #111827;\n  }\n\n  .card p {\n    margin: 0 0 12px;\n    font-size: 16px;\n    line-height: 1.75;\n    color: #4b5563;\n  }\n\n  .card p:last-child {\n    margin-bottom: 0;\n  }\n\n  .card.dark {\n    background: linear-gradient(135deg, #1f5b89 0%, #184767 100%);\n    border-color: #1c547f;\n    color: #ffffff;\n    box-shadow: 0 16px 34px rgba(24, 71, 103, 0.24);\n  }\n\n  .card.dark h3,\n  .card.dark p {\n    color: #ffffff;\n  }\n\n  .white-link,\n  .white-link:visited,\n  .white-link:hover,\n  .white-link:active {\n    color: #ffffff;\n  }\n\n  .step-label {\n    display: inline-block;\n    margin-bottom: 14px;\n    padding: 6px 12px;\n    border-radius: 999px;\n    background: #eef2f7;\n    color: #334155;\n    font-size: 12px;\n    font-weight: 700;\n    letter-spacing: 0.04em;\n    text-transform: uppercase;\n  }\n\n  .step-label.inverse {\n    background: rgba(255, 255, 255, 0.15);\n    color: #ffffff;\n    border: 1px solid rgba(255, 255, 255, 0.22);\n  }\n\n  .actions {\n    display: flex;\n    gap: 12px;\n    flex-wrap: wrap;\n    margin-top: 20px;\n  }\n\n  .actions.stack {\n    flex-direction: column;\n    align-items: flex-start;\n  }\n\n  .endo-tool button {\n    border: 1px solid #d1d5db;\n    border-radius: 12px;\n    padding: 12px 18px;\n    cursor: pointer;\n    font-weight: 600;\n    font-size: 15px;\n    line-height: 1.2;\n    background: #f3f4f6;\n    color: #374151;\n    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;\n    box-shadow: none;\n  }\n\n  .endo-tool button:hover {\n    background: #e5e7eb;\n    box-shadow: none;\n  }\n\n  .endo-tool button.active {\n    background: #1f5b89;\n    color: #ffffff;\n    border-color: #1f5b89;\n    box-shadow: none;\n  }\n\n  .endo-tool button:disabled {\n    opacity: 0.55;\n    cursor: not-allowed;\n  }\n\n  .card.dark button {\n    background: #ffffff;\n    color: #163a5a;\n    border: 1px solid rgba(255, 255, 255, 0.35);\n    box-shadow: none;\n  }\n\n  .card.dark button:hover {\n    background: #f7fafc;\n    box-shadow: none;\n  }\n\n  .card.dark button.active {\n    background: #418bc3;\n    color: #ffffff;\n    border-color: #1f5b89;\n    box-shadow: none;\n  }\n\n  .actions.stack button {\n    width: 100%;\n    justify-content: flex-start;\n    text-align: left;\n  }\n\n  .summary-list {\n    margin-top: 10px;\n  }\n\n  .summary-item {\n    padding: 16px 18px;\n    border: 1px solid #e5e7eb;\n    border-radius: 14px;\n    background: #ffffff;\n    margin-bottom: 14px;\n  }\n\n  .summary-item:last-child {\n    margin-bottom: 0;\n  }\n\n  .summary-item h4 {\n    margin: 0 0 8px;\n    font-size: 18px;\n    line-height: 1.35;\n    color: #111827;\n  }\n\n  .summary-intro {\n    margin-bottom: 16px;\n  }\n\n  .result-divider {\n    margin: 34px 0 0;\n    border-top: 1px solid #e5e7eb;\n  }\n\n  .result {\n    margin-top: 24px;\n    padding: 28px 24px;\n    border-radius: 20px;\n    background: linear-gradient(180deg, #eef8ef 0%, #e8f5e9 100%);\n    border: 1px solid #cfe5d1;\n    box-shadow: 0 14px 32px rgba(34, 84, 61, 0.08);\n    animation: fadeInUp 0.3s ease;\n  }\n\n  .result-badge {\n    display: inline-block;\n    margin-bottom: 12px;\n    padding: 6px 12px;\n    border-radius: 999px;\n    background: #dcefdc;\n    color: #1f5132;\n    font-size: 12px;\n    font-weight: 700;\n    letter-spacing: 0.04em;\n    text-transform: uppercase;\n  }\n\n  .result h3 {\n    margin: 0 0 12px;\n    font-size: 28px;\n    line-height: 1.25;\n    color: #11311d;\n  }\n\n  #result-text {\n    font-size: 17px;\n    line-height: 1.8;\n    color: #23412c;\n  }\n\n  .result-help {\n    margin-top: 18px;\n  }\n\n  .result-help-title {\n    margin: 0 0 10px;\n    font-size: 16px;\n    font-weight: 700;\n    color: #374151;\n  }\n\n  .result-help-buttons {\n    display: flex;\n    flex-wrap: wrap;\n    gap: 10px;\n  }\n\n  .result-help-buttons a {\n    display: inline-block;\n    padding: 10px 14px;\n    border-radius: 10px;\n    background: #e5e7eb;\n    color: #374151;\n    text-decoration: none;\n    font-size: 14px;\n    font-weight: 600;\n    line-height: 1.2;\n    border: 1px solid #d1d5db;\n    transition: background 0.18s ease, transform 0.18s ease;\n  }\n\n  .result-help-buttons a:hover {\n    background: #d1d5db;\n    transform: translateY(-1px);\n  }\n\n  #restart-flowchart {\n    background: #11311d;\n    color: #ffffff;\n    border-color: #11311d;\n  }\n\n  @keyframes fadeInUp {\n    from {\n      opacity: 0;\n      transform: translateY(8px);\n    }\n    to {\n      opacity: 1;\n      transform: translateY(0);\n    }\n  }\n\n  @media (max-width: 768px) {\n    .tool-title {\n      font-size: 40px;\n    }\n\n    .tool-subtitle {\n      font-size: 15px;\n      margin-bottom: 24px;\n    }\n\n    .intro-panel {\n      padding: 22px 20px;\n      border-radius: 14px;\n    }\n\n    .intro-panel p {\n      font-size: 15px;\n      line-height: 1.75;\n    }\n\n    .start-btn {\n      padding: 16px 18px;\n      font-size: 15px;\n      border-radius: 10px;\n    }\n\n    .endo-tool {\n      padding: 24px 18px;\n      border-radius: 18px;\n    }\n\n    .tool-header-row {\n      flex-direction: column;\n      align-items: flex-start;\n    }\n\n    .header-restart {\n      width: auto !important;\n    }\n\n    .card {\n      padding: 20px 18px;\n      border-radius: 16px;\n    }\n\n    .card h3 {\n      font-size: 21px;\n    }\n\n    .card p,\n    #result-text {\n      font-size: 15px;\n    }\n\n    .summary-item h4 {\n      font-size: 17px;\n    }\n\n    .result h3 {\n      font-size: 24px;\n    }\n\n    .actions {\n      gap: 10px;\n    }\n\n    .endo-tool button {\n      width: 100%;\n    }\n\n    .header-restart {\n      width: auto !important;\n    }\n  }\n<\/style>\n\n<script>\n  (function () {\n    const TOTAL_QUESTIONS = 8;\n\n    const THREAT_CONTENT = {\n      ov: {\n        title: 'Omitted Variable',\n        body: 'Recommended first-line approaches: Rich Data Approach, Fixed Effects Approach, and Unobservables Approach. <br> <a href=\"https:\/\/www.endogeneity.net\/?page_id=63\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"color: blue;\">Please find more information on the prevention of endogeneity here.<\/a>'\n      },\n      ts: {\n        title: 'Treatment Selection',\n        body: 'Recommended first-line approaches: Rich Data Approach, Fixed Effects Approach, and Unobservables Approach. <br> <a href=\"https:\/\/www.endogeneity.net\/?page_id=63\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"color: blue;\">Please find more information on the prevention of endogeneity here.<\/a>'\n      },\n      sim: {\n        title: 'Simultaneity',\n        body: 'Recommended first-line approach: Temporal Separation Approach. <br> <a href=\"https:\/\/www.endogeneity.net\/?page_id=63\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"color: blue;\">Please find more information on the prevention of endogeneity here.<\/a>'\n      },\n      me: {\n        title: 'Measurement Error',\n        body: 'Recommended first-line approach: Measurement Error Correction Approach. <br> <a href=\"https:\/\/www.endogeneity.net\/?page_id=63\" target=\"_blank\" rel=\"noopener noreferrer\" style=\"color: blue;\">Please find more information on the prevention of endogeneity here.<\/a>'\n      },\n      ss: {\n        title: 'Sample Selection',\n        body: 'No prevention available.'\n      }\n    };\n\n    const THREAT_ORDER = ['ov', 'ts', 'sim', 'me', 'ss'];\n\n    const RESULT_HELPERS = {\n      6: [\n        { label: 'Two-Stages Least Squares', href: 'https:\/\/www.endogeneity.net\/?page_id=155' },\n        { label: 'Control Function', href: 'https:\/\/www.endogeneity.net\/?page_id=158' },\n        { label: 'Heckman Treatment Estimate', href: 'https:\/\/www.endogeneity.net\/?page_id=180' },\n        { label: 'Heckman Selection Correction', href: 'https:\/\/www.endogeneity.net\/?page_id=178' }\n      ],\n      7: [\n        { label: 'Copula Correction', href: 'https:\/\/www.endogeneity.net\/?page_id=182' }\n      ],\n      8: [\n        ]\n    };\n\n    const startScreen = document.getElementById('start-screen');\n    const toolScreen = document.getElementById('tool-screen');\n    const startBtn = document.getElementById('start-btn');\n\n    const tool = document.getElementById('endo-flowchart');\n    const resultBox = document.getElementById('result-box');\n    const resultText = document.getElementById('result-text');\n    const resultDivider = document.getElementById('result-divider');\n    const resultHelp = document.getElementById('result-help');\n    const resultHelpButtons = document.getElementById('result-help-buttons');\n    const allSteps = Array.from(tool.querySelectorAll('.step'));\n\n    const headerRestart = document.getElementById('header-restart');\n\n    const progressWrap = document.getElementById('progress-wrap');\n    const progressFill = document.getElementById('progress-fill');\n\n    const obsStep = document.getElementById('step-obs');\n    const obsContinueBtn = document.getElementById('obs-continue-btn');\n    const threatButtons = obsStep ? Array.from(obsStep.querySelectorAll('[data-threat]')) : [];\n\n    const threatSummaryStep = document.getElementById('step-threat-summary');\n    const threatSummaryTitle = document.getElementById('threat-summary-title');\n    const threatSummaryContent = document.getElementById('threat-summary-content');\n\n    function updateProgress(questionNumber) {\n      const safeNumber = Math.max(1, Math.min(TOTAL_QUESTIONS, Number(questionNumber) || 1));\n      const percent = (safeNumber \/ TOTAL_QUESTIONS) * 100;\n\n      progressWrap.classList.remove('hidden');\n      progressFill.style.width = percent + '%';\n    }\n\n    function clearActiveButtons() {\n      tool.querySelectorAll('.actions button.active').forEach(button => {\n        button.classList.remove('active');\n      });\n    }\n\n    function resetObsSelections() {\n      threatButtons.forEach(button => button.classList.remove('active'));\n      if (obsContinueBtn) {\n        obsContinueBtn.disabled = true;\n      }\n    }\n\n    function getSelectedThreatKeys() {\n      return THREAT_ORDER.filter(key => {\n        const btn = obsStep.querySelector('[data-threat=\"' + key + '\"]');\n        return btn && btn.classList.contains('active');\n      });\n    }\n\n    function buildThreatSummary(selectedKeys) {\n      if (!selectedKeys.length) {\n        threatSummaryTitle.textContent = 'Selected endogeneity threat';\n        threatSummaryContent.innerHTML = '';\n        return;\n      }\n\n      if (selectedKeys.length === 1) {\n        const threat = THREAT_CONTENT[selectedKeys[0]];\n        threatSummaryTitle.textContent = threat.title;\n        threatSummaryContent.innerHTML = '<p>' + threat.body + '<\/p>';\n        return;\n      }\n\n      threatSummaryTitle.textContent = 'Selected endogeneity threats';\n\n      const intro = '<p class=\"summary-intro\">The following endogeneity threats appear relevant. Address each of them before continuing to the remaining questions.<\/p><a href=\"https:\/\/www.endogeneity.net\/?page_id=63\" target=\"_blank\" rel=\"noopener noreferrer\">Please visit this page for more information on prevention of endogeneity.<\/a>';\n\n      const items = selectedKeys.map(key => {\n        const threat = THREAT_CONTENT[key];\n        return (\n          '<div class=\"summary-item\">' +\n            '<h4>' + threat.title + '<\/h4>' +\n            '<p>' + threat.body + '<\/p>' +\n          '<\/div>'\n        );\n      }).join('');\n\n      threatSummaryContent.innerHTML = intro + '<div class=\"summary-list\">' + items + '<\/div>';\n    }\n\n    function renderHelpfulInformation(finalQuestion) {\n      const helpers = RESULT_HELPERS[Number(finalQuestion)] || [];\n\n      if (!helpers.length) {\n        resultHelp.classList.add('hidden');\n        resultHelpButtons.innerHTML = '';\n        return;\n      }\n\n      resultHelpButtons.innerHTML = helpers.map(item => {\n        return '<a href=\"' + item.href + '\" target=\"_blank\" rel=\"noopener noreferrer\">' + item.label + '<\/a>';\n      }).join('');\n\n      resultHelp.classList.remove('hidden');\n    }\n\n    function resetFlow() {\n      allSteps.forEach((step, idx) => {\n        if (idx === 0) {\n          step.classList.remove('hidden');\n        } else {\n          step.classList.add('hidden');\n        }\n      });\n\n      clearActiveButtons();\n      resetObsSelections();\n      buildThreatSummary([]);\n      resultBox.classList.add('hidden');\n      resultDivider.classList.add('hidden');\n      resultHelp.classList.add('hidden');\n      resultHelpButtons.innerHTML = '';\n      resultText.innerHTML = '';\n      headerRestart.classList.add('hidden');\n      progressWrap.classList.add('hidden');\n      updateProgress(1);\n    }\n\n    function hideFollowing(currentStep) {\n      let found = false;\n\n      allSteps.forEach(step => {\n        if (step === currentStep) {\n          found = true;\n          return;\n        }\n        if (found) {\n          step.classList.add('hidden');\n        }\n      });\n\n      resultBox.classList.add('hidden');\n      resultDivider.classList.add('hidden');\n      resultHelp.classList.add('hidden');\n      resultHelpButtons.innerHTML = '';\n      resultText.innerHTML = '';\n    }\n\n    startBtn.addEventListener('click', function () {\n      startScreen.classList.add('hidden');\n      toolScreen.classList.remove('hidden');\n\n      resetFlow();\n\n      setTimeout(() => {\n        tool.scrollIntoView({ behavior: 'smooth', block: 'start' });\n      }, 100);\n    });\n\n    tool.addEventListener('click', function (e) {\n      const btn = e.target.closest('button');\n      if (!btn) return;\n\n      if (btn.id === 'restart-flowchart' || btn.id === 'header-restart') {\n        resetFlow();\n        toolScreen.classList.add('hidden');\n        startScreen.classList.remove('hidden');\n        window.scrollTo({ top: 0, behavior: 'smooth' });\n        return;\n      }\n\n      if (btn.hasAttribute('data-threat')) {\n        btn.classList.toggle('active');\n        if (obsContinueBtn) {\n          obsContinueBtn.disabled = getSelectedThreatKeys().length === 0;\n        }\n        return;\n      }\n\n      if (btn.id === 'obs-continue-btn') {\n        const selectedThreatKeys = getSelectedThreatKeys();\n        if (!selectedThreatKeys.length) return;\n\n        hideFollowing(obsStep);\n        buildThreatSummary(selectedThreatKeys);\n        threatSummaryStep.classList.remove('hidden');\n        headerRestart.classList.remove('hidden');\n        updateProgress(4);\n        threatSummaryStep.scrollIntoView({ behavior: 'smooth', block: 'start' });\n        return;\n      }\n\n      const currentStep = btn.closest('.step');\n\n      if (currentStep) {\n        const buttonGroup = btn.parentElement;\n        if (buttonGroup) {\n          buttonGroup.querySelectorAll('button').forEach(sibling => {\n            sibling.classList.remove('active');\n          });\n        }\n\n        btn.classList.add('active');\n        hideFollowing(currentStep);\n        headerRestart.classList.remove('hidden');\n      }\n\n      const nextId = btn.getAttribute('data-next');\n      const result = btn.getAttribute('data-result');\n\n      if (nextId) {\n        const nextEl = document.getElementById(nextId);\n        if (nextEl) {\n          nextEl.classList.remove('hidden');\n\n          const nextQuestion = nextEl.getAttribute('data-question');\n          if (nextQuestion) {\n            updateProgress(nextQuestion);\n          }\n\n          nextEl.scrollIntoView({ behavior: 'smooth', block: 'start' });\n        }\n      }\n\n      if (result) {\n        const finalQuestion = btn.getAttribute('data-final-question') || (currentStep ? currentStep.getAttribute('data-question') : 1);\n        updateProgress(finalQuestion);\n\n        resultText.innerHTML = result;\n        renderHelpfulInformation(finalQuestion);\n\n        resultDivider.classList.remove('hidden');\n        resultBox.classList.remove('hidden');\n        resultBox.scrollIntoView({ behavior: 'smooth', block: 'start' });\n      }\n    });\n  })();\n<\/script><\/div><\/div><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"100-width.php","meta":{"footnotes":""},"class_list":["post-380","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.endogeneity.net\/index.php?rest_route=\/wp\/v2\/pages\/380","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.endogeneity.net\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.endogeneity.net\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.endogeneity.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.endogeneity.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=380"}],"version-history":[{"count":41,"href":"https:\/\/www.endogeneity.net\/index.php?rest_route=\/wp\/v2\/pages\/380\/revisions"}],"predecessor-version":[{"id":509,"href":"https:\/\/www.endogeneity.net\/index.php?rest_route=\/wp\/v2\/pages\/380\/revisions\/509"}],"wp:attachment":[{"href":"https:\/\/www.endogeneity.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=380"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}