{
  "meta": {
    "name": "StatChooser",
    "version": "1.0.0",
    "description": "An interactive statistical test advisor. Companion to the surveyframe R package. Every recommendation carries a surveyframe method ID that runs directly in run_analysis_plan().",
    "citation": {
      "tool": "Sharafuddin, M. A. (2026). StatChooser: An interactive statistical test advisor (Version 1.0.0) [Computer software]. https://mohammedalisharafuddin.github.io/statchooser/",
      "package_r": "citation(\"surveyframe\")",
      "package_text": "Sharafuddin, M. A. (2026). surveyframe: Survey instrument workflows (Version 0.3.2) [R package]. CRAN. https://CRAN.R-project.org/package=surveyframe"
    },
    "surveyframe": {
      "cran": "https://CRAN.R-project.org/package=surveyframe",
      "github": "https://github.com/MohammedAliSharafuddin/surveyframe",
      "version_verified": "0.3.2"
    },
    "api_pattern": "api/tests/{surveyframe_id}.json",
    "licence": "MIT"
  },
  "start": "q_goal",
  "nodes": {
    "q_goal": {
      "type": "question",
      "stage": "Goal",
      "question": "What is your research goal?",
      "help": "Pick the sentence closest to your research question.",
      "options": [
        {
          "label": "Compare groups or conditions",
          "sub": "Differences between groups, or change over time",
          "token": "goal = compare",
          "next": "q_cmp_scale"
        },
        {
          "label": "Examine a relationship",
          "sub": "Association between two variables",
          "token": "goal = relate",
          "next": "q_rel_types"
        },
        {
          "label": "Predict an outcome",
          "sub": "One or more predictors explain an outcome",
          "token": "goal = predict",
          "next": "q_pred_outcome"
        },
        {
          "label": "Assess measurement or a model",
          "sub": "Reliability, factor structure, SEM",
          "token": "goal = model",
          "next": "q_model_focus"
        }
      ]
    },
    "q_cmp_scale": {
      "type": "question",
      "stage": "Design",
      "question": "What is the outcome's measurement level?",
      "help": "Summed or averaged multi-item scales are usually treated as continuous. Single Likert items are ordinal.",
      "options": [
        {
          "label": "Continuous",
          "sub": "Interval or ratio, including scale scores",
          "token": "scale = continuous",
          "next": "q_cmp_groups"
        },
        {
          "label": "Ordinal",
          "sub": "Ranks or single Likert items",
          "token": "scale = ordinal",
          "next": "q_cmp_groups_ord"
        },
        {
          "label": "Categorical",
          "sub": "Nominal categories such as yes or no",
          "token": "scale = categorical",
          "next": "q_cmp_cat_design"
        }
      ]
    },
    "q_cmp_cat_design": {
      "type": "question",
      "stage": "Data",
      "question": "How were the categorical outcomes collected?",
      "help": "Expected counts come from the contingency table, not the observed counts.",
      "options": [
        {
          "label": "Independent groups, adequate counts",
          "sub": "All expected cell counts reach 5",
          "token": "design = independent",
          "next": "t_chi_square"
        },
        {
          "label": "Independent groups, small counts",
          "sub": "A 2 by 2 table with any expected count below 5",
          "token": "design = small 2x2",
          "next": "t_fisher_exact"
        },
        {
          "label": "Same cases measured twice",
          "sub": "Before and after, binary outcome",
          "token": "design = paired",
          "next": "t_mcnemar"
        }
      ]
    },
    "q_cmp_groups": {
      "type": "question",
      "stage": "Design",
      "question": "How many groups or conditions?",
      "help": "Count the levels of your grouping factor, or the number of repeated measurements.",
      "options": [
        {
          "label": "Two",
          "sub": "",
          "token": "k = 2",
          "next": "q_cmp_design2"
        },
        {
          "label": "Three or more",
          "sub": "",
          "token": "k = 3+",
          "next": "q_cmp_design3"
        }
      ]
    },
    "q_cmp_design2": {
      "type": "question",
      "stage": "Design",
      "question": "How are the two sets of scores related?",
      "help": "",
      "options": [
        {
          "label": "Independent groups",
          "sub": "Different cases in each group",
          "token": "design = independent",
          "next": "q_cmp_dist2i"
        },
        {
          "label": "Paired or repeated",
          "sub": "The same cases measured twice, or matched pairs",
          "token": "design = paired",
          "next": "q_cmp_dist2p"
        }
      ]
    },
    "q_cmp_dist2i": {
      "type": "question",
      "stage": "Data",
      "question": "What do the data look like?",
      "help": "Check a histogram per group, or a Shapiro-Wilk test for samples under 50.",
      "options": [
        {
          "label": "Roughly normal, or 30 or more cases per group",
          "sub": "",
          "token": "n = adequate, normal",
          "next": "t_t_test_ind"
        },
        {
          "label": "Skewed, outliers, or small samples",
          "sub": "",
          "token": "n = small or skewed",
          "next": "t_mann_whitney"
        }
      ]
    },
    "q_cmp_dist2p": {
      "type": "question",
      "stage": "Data",
      "question": "What do the paired differences look like?",
      "help": "Compute the difference per case and inspect its distribution.",
      "options": [
        {
          "label": "Roughly normal differences",
          "sub": "",
          "token": "diff = normal",
          "next": "t_t_test_pair"
        },
        {
          "label": "Skewed differences, or a small sample",
          "sub": "",
          "token": "diff = skewed or small",
          "next": "t_wilcoxon_pair"
        }
      ]
    },
    "q_cmp_design3": {
      "type": "question",
      "stage": "Design",
      "question": "What is the design?",
      "help": "",
      "options": [
        {
          "label": "One factor, independent groups",
          "sub": "",
          "token": "design = one factor",
          "next": "q_cmp_dist3"
        },
        {
          "label": "Two factors, independent groups",
          "sub": "A factorial design with an interaction",
          "token": "design = factorial",
          "next": "t_anova_two"
        },
        {
          "label": "One factor plus a covariate",
          "sub": "A continuous variable to control for",
          "token": "design = covariate",
          "next": "t_ancova"
        },
        {
          "label": "Same cases, three or more times",
          "sub": "Repeated measurements",
          "token": "design = repeated",
          "next": "q_cmp_dist3r"
        }
      ]
    },
    "q_cmp_dist3": {
      "type": "question",
      "stage": "Data",
      "question": "What do the data look like?",
      "help": "Check normality within each group and Levene's test for equal variances.",
      "options": [
        {
          "label": "Normal within groups, similar variances",
          "sub": "",
          "token": "n = adequate, normal",
          "next": "t_anova_one"
        },
        {
          "label": "Violated assumptions, or small samples",
          "sub": "",
          "token": "n = small or skewed",
          "next": "t_kruskal_wallis"
        }
      ]
    },
    "q_cmp_dist3r": {
      "type": "question",
      "stage": "Data",
      "question": "What do the repeated measurements look like?",
      "help": "",
      "options": [
        {
          "label": "Roughly normal at each time point",
          "sub": "",
          "token": "data = normal",
          "next": "t_repeated_anova"
        },
        {
          "label": "Ordinal, or clearly non-normal",
          "sub": "",
          "token": "data = ordinal",
          "next": "t_friedman"
        }
      ]
    },
    "q_cmp_groups_ord": {
      "type": "question",
      "stage": "Design",
      "question": "How many groups, and how are they related?",
      "help": "Ordinal outcomes route directly to rank-based tests.",
      "options": [
        {
          "label": "Two independent groups",
          "sub": "",
          "token": "design = 2 independent",
          "next": "t_mann_whitney"
        },
        {
          "label": "Two paired measurements",
          "sub": "",
          "token": "design = 2 paired",
          "next": "t_wilcoxon_pair"
        },
        {
          "label": "Three or more independent groups",
          "sub": "",
          "token": "design = 3+ independent",
          "next": "t_kruskal_wallis"
        },
        {
          "label": "Three or more repeated measurements",
          "sub": "",
          "token": "design = 3+ repeated",
          "next": "t_friedman"
        }
      ]
    },
    "q_rel_types": {
      "type": "question",
      "stage": "Design",
      "question": "What are the two variables' measurement levels?",
      "help": "",
      "options": [
        {
          "label": "Both continuous",
          "sub": "",
          "token": "types = continuous pair",
          "next": "q_rel_dist"
        },
        {
          "label": "At least one ordinal",
          "sub": "Single Likert items, ranks",
          "token": "types = ordinal pair",
          "next": "q_rel_ord"
        },
        {
          "label": "Both categorical",
          "sub": "",
          "token": "types = categorical pair",
          "next": "t_chi_square"
        },
        {
          "label": "One categorical, one continuous",
          "sub": "",
          "token": "types = mixed",
          "next": "t_reframe"
        }
      ]
    },
    "q_rel_dist": {
      "type": "question",
      "stage": "Data",
      "question": "What does the scatter plot show?",
      "help": "Always plot the pair before choosing a coefficient.",
      "options": [
        {
          "label": "A linear pattern, no extreme outliers",
          "sub": "",
          "token": "pattern = linear",
          "next": "t_correlation_pearson"
        },
        {
          "label": "Outliers, skew, or a curved but monotonic pattern",
          "sub": "",
          "token": "pattern = monotonic",
          "next": "t_correlation_spearman"
        }
      ]
    },
    "q_rel_ord": {
      "type": "question",
      "stage": "Data",
      "question": "What is the sample like?",
      "help": "",
      "options": [
        {
          "label": "Moderate to large, few tied ranks",
          "sub": "",
          "token": "n = adequate",
          "next": "t_correlation_spearman"
        },
        {
          "label": "Small, or many tied ranks",
          "sub": "",
          "token": "n = small or tied",
          "next": "t_correlation_kendall"
        }
      ]
    },
    "q_pred_outcome": {
      "type": "question",
      "stage": "Design",
      "question": "What is the outcome variable?",
      "help": "",
      "options": [
        {
          "label": "Continuous",
          "sub": "",
          "token": "outcome = continuous",
          "next": "q_pred_terms"
        },
        {
          "label": "Binary",
          "sub": "Exactly two categories",
          "token": "outcome = binary",
          "next": "t_regression_logistic_binary"
        },
        {
          "label": "Nominal, three or more categories",
          "sub": "Unordered",
          "token": "outcome = nominal",
          "next": "t_regression_logistic_multinomial"
        },
        {
          "label": "Ordinal",
          "sub": "Ordered categories",
          "token": "outcome = ordinal",
          "next": "t_regression_logistic_ordinal"
        }
      ]
    },
    "q_pred_terms": {
      "type": "question",
      "stage": "Design",
      "question": "What kind of effect are you testing?",
      "help": "",
      "options": [
        {
          "label": "Direct effects of one or more predictors",
          "sub": "",
          "token": "effect = direct",
          "next": "t_regression_linear"
        },
        {
          "label": "An indirect effect through a mediator",
          "sub": "X affects Y through M",
          "token": "effect = indirect",
          "next": "t_mediation"
        },
        {
          "label": "An effect that depends on a moderator",
          "sub": "The X to Y effect changes with W",
          "token": "effect = conditional",
          "next": "t_moderation"
        }
      ]
    },
    "q_model_focus": {
      "type": "question",
      "stage": "Design",
      "question": "What are you assessing?",
      "help": "",
      "options": [
        {
          "label": "Internal consistency of a scale",
          "sub": "Reliability",
          "token": "focus = reliability",
          "next": "q_model_rel"
        },
        {
          "label": "An unknown factor structure",
          "sub": "Exploration",
          "token": "focus = efa",
          "next": "t_efa"
        },
        {
          "label": "A specified measurement model",
          "sub": "Confirmation",
          "token": "focus = cfa",
          "next": "t_cfa"
        },
        {
          "label": "A structural model with latent variables",
          "sub": "SEM",
          "token": "focus = sem",
          "next": "q_model_sem"
        }
      ]
    },
    "q_model_rel": {
      "type": "question",
      "stage": "Data",
      "question": "Which reliability assumption fits your items?",
      "help": "Omega is the safer default in current practice.",
      "options": [
        {
          "label": "Item loadings differ",
          "sub": "Congeneric items, the usual case",
          "token": "model = congeneric",
          "next": "t_reliability_omega"
        },
        {
          "label": "Items contribute roughly equally",
          "sub": "Tau-equivalent items",
          "token": "model = tau-equivalent",
          "next": "t_reliability_alpha"
        }
      ]
    },
    "q_model_sem": {
      "type": "question",
      "stage": "Data",
      "question": "Which estimation tradition fits your study?",
      "help": "",
      "options": [
        {
          "label": "Composite-based PLS-SEM",
          "sub": "Prediction focus, complex models, smaller samples",
          "token": "tradition = pls",
          "next": "t_pls_sem"
        },
        {
          "label": "Covariance-based SEM",
          "sub": "Strict theory testing, larger samples",
          "token": "tradition = cb",
          "next": "t_cb_sem"
        }
      ]
    },
    "t_chi_square": {
      "type": "result",
      "id": "t_chi_square",
      "name": "Chi-square test",
      "surveyframe_id": "chi_square",
      "example": "Imagine asking 100 students whether they prefer tea or coffee and noting each student's year of study. A chi-square test asks whether drink preference depends on year of study, or whether the two are unrelated.",
      "smallSample": "When the table is small or sparse the chi-square approximation breaks down. Switch to Fisher's exact test or simulate the p-value, and report Cramer's V with a confidence interval rather than the p-value alone.",
      "verdict": "Tests whether two categorical variables are related, or whether group membership and a categorical outcome are independent.",
      "assumptions": [
        "Observations are independent of one another",
        "Each case appears in exactly one cell of the table",
        "At least 80 per cent of expected cell counts are 5 or more, and none is below 1"
      ],
      "alternative": {
        "label": "Fisher's exact test, when expected counts are small in a 2 by 2 table",
        "node": "t_fisher_exact"
      },
      "r": "# analysis_plan_chi_square.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# Add this entry to your instrument's analysis_plan list.\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Are the two categorical variables related?\",\n  family            = \"association\",\n  method            = \"chi_square\",\n  roles             = list(\n    row        = \"var_a\",\n    column     = \"var_b\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# instr     <- sf_instrument(\"My study\", components = list(...),\n#                            analysis_plan = list(plan_entry))\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"chi_square\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\ncat_set <- sf_choices(\"cat_set\", 1:3, c(\"Category 1\", \"Category 2\", \"Category 3\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: Categorical variables ----\nsec_b <- sf_item(\"sec_b\", \"Section B: Categorical variables\", type = \"section_break\")\nvar_a <- sf_item(\"var_a\", \"[first categorical variable - replace]\", type = \"single_choice\", choice_set = \"cat_set\")\nvar_b <- sf_item(\"var_b\", \"[second categorical variable - replace]\", type = \"single_choice\", choice_set = \"cat_set\")\n\n# ---- Analysis plan (ids match the items and scales above) ----\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Are the two categorical variables related?\",\n  family            = \"association\",\n  method            = \"chi_square\",\n  roles             = list(\n    row        = \"var_a\",\n    column     = \"var_b\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, var_a, var_b\n  ),\n  analysis_plan = list(plan_entry)\n)\n\n# Run it end to end once you have responses:\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "Categorical variables",
            "intro": "",
            "items": [
              {
                "label": "first categorical variable",
                "type": "single_choice",
                "placeholder": true,
                "choices": [
                  "Category 1",
                  "Category 2",
                  "Category 3"
                ]
              },
              {
                "label": "second categorical variable",
                "type": "single_choice",
                "placeholder": true,
                "choices": [
                  "Category 1",
                  "Category 2",
                  "Category 3"
                ]
              }
            ]
          }
        ]
      },
      "jasp": [
        "Frequencies, then Contingency Tables",
        "Move one variable to Rows and the other to Columns",
        "Under Statistics, tick Chi-square and Phi and Cramer's V"
      ],
      "report": "A chi-square test of independence indicated a significant association between variable A and variable B, X2(df, N = value) = value, p = value, Cramer's V = value.",
      "refs": [
        "Pearson, K. (1900). On the criterion that a given system of deviations... Philosophical Magazine, 50(302), 157 to 175."
      ]
    },
    "t_fisher_exact": {
      "type": "result",
      "id": "t_fisher_exact",
      "name": "Fisher's exact test",
      "surveyframe_id": "fisher_exact",
      "example": "A pilot of 18 customers is split into those who saw a new advert and those who did not, and you record whether each one bought. With so few people the chi-square table cannot be trusted, so Fisher's exact test checks the advert and purchase link directly.",
      "smallSample": "This is already the small-sample choice for a 2 by 2 table. Report the odds ratio with a confidence interval, and treat a non-significant result from few cases as inconclusive rather than as evidence of no effect.",
      "verdict": "Tests association in a 2 by 2 table when samples are small and chi-square expected counts cannot be trusted.",
      "assumptions": [
        "Observations are independent",
        "Both variables have exactly two categories",
        "Row and column totals are treated as fixed"
      ],
      "alternative": {
        "label": "Chi-square test, when all expected counts reach 5",
        "node": "t_chi_square"
      },
      "r": "# analysis_plan_fisher_exact.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# Add this entry to your instrument's analysis_plan list.\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Are the two binary variables related in this small sample?\",\n  family            = \"association\",\n  method            = \"fisher_exact\",\n  roles             = list(\n    row        = \"var_a\",\n    column     = \"var_b\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# instr     <- sf_instrument(\"My study\", components = list(...),\n#                            analysis_plan = list(plan_entry))\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"fisher_exact\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\ncat_set <- sf_choices(\"cat_set\", 1:3, c(\"Category 1\", \"Category 2\", \"Category 3\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: Categorical variables ----\nsec_b <- sf_item(\"sec_b\", \"Section B: Categorical variables\", type = \"section_break\")\nvar_a <- sf_item(\"var_a\", \"[first categorical variable - replace]\", type = \"single_choice\", choice_set = \"cat_set\")\nvar_b <- sf_item(\"var_b\", \"[second categorical variable - replace]\", type = \"single_choice\", choice_set = \"cat_set\")\n\n# ---- Analysis plan (ids match the items and scales above) ----\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Are the two binary variables related in this small sample?\",\n  family            = \"association\",\n  method            = \"fisher_exact\",\n  roles             = list(\n    row        = \"var_a\",\n    column     = \"var_b\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, var_a, var_b\n  ),\n  analysis_plan = list(plan_entry)\n)\n\n# Run it end to end once you have responses:\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "Categorical variables",
            "intro": "",
            "items": [
              {
                "label": "first categorical variable",
                "type": "single_choice",
                "placeholder": true,
                "choices": [
                  "Category 1",
                  "Category 2",
                  "Category 3"
                ]
              },
              {
                "label": "second categorical variable",
                "type": "single_choice",
                "placeholder": true,
                "choices": [
                  "Category 1",
                  "Category 2",
                  "Category 3"
                ]
              }
            ]
          }
        ]
      },
      "jasp": [
        "Frequencies, then Contingency Tables",
        "Move the two binary variables to Rows and Columns",
        "Under Statistics, tick Fisher's exact test"
      ],
      "report": "Fisher's exact test indicated a significant association between variable A and variable B, p = value, odds ratio = value.",
      "refs": [
        "Fisher, R. A. (1935). The design of experiments. Oliver and Boyd."
      ]
    },
    "t_mcnemar": {
      "type": "result",
      "id": "t_mcnemar",
      "name": "McNemar's test",
      "surveyframe_id": "mcnemar",
      "example": "Forty people say whether they support a policy, watch a short film, then say again. McNemar's test asks whether the film shifted opinion, by comparing how many switched from no to yes against how many switched from yes to no.",
      "smallSample": "When the number of people who changed their mind is small, use the exact binomial form of McNemar's test rather than the chi-square approximation.",
      "verdict": "Tests change in a binary outcome when the same cases are measured twice, for example before and after an intervention.",
      "assumptions": [
        "The outcome is binary at both time points",
        "The two measurements come from the same cases",
        "Pairs of observations are independent of other pairs"
      ],
      "alternative": {
        "label": "Cochran's Q, when the binary outcome is measured at three or more time points",
        "node": null
      },
      "r": "# analysis_plan_mcnemar.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# Add this entry to your instrument's analysis_plan list.\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Did the binary outcome change between the two measurements?\",\n  family            = \"group_comparison\",\n  method            = \"mcnemar\",\n  roles             = list(\n    before     = \"time1_var\",\n    after      = \"time2_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# instr     <- sf_instrument(\"My study\", components = list(...),\n#                            analysis_plan = list(plan_entry))\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"mcnemar\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nyn <- sf_choices(\"yn\", c(\"yes\", \"no\"), c(\"Yes\", \"No\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: Repeated binary measure ----\nsec_b <- sf_item(\"sec_b\", \"Section B: Repeated binary measure\", type = \"section_break\")\ntime1_var <- sf_item(\"time1_var\", \"[binary outcome at time 1 - replace]\", type = \"single_choice\", choice_set = \"yn\")\ntime2_var <- sf_item(\"time2_var\", \"[binary outcome at time 2 - replace]\", type = \"single_choice\", choice_set = \"yn\")\n\n# ---- Analysis plan (ids match the items and scales above) ----\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Did the binary outcome change between the two measurements?\",\n  family            = \"group_comparison\",\n  method            = \"mcnemar\",\n  roles             = list(\n    before     = \"time1_var\",\n    after      = \"time2_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, time1_var, time2_var\n  ),\n  analysis_plan = list(plan_entry)\n)\n\n# Run it end to end once you have responses:\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "Repeated binary measure",
            "intro": "",
            "items": [
              {
                "label": "binary outcome at time 1",
                "type": "single_choice",
                "placeholder": true,
                "choices": [
                  "Yes",
                  "No"
                ]
              },
              {
                "label": "binary outcome at time 2",
                "type": "single_choice",
                "placeholder": true,
                "choices": [
                  "Yes",
                  "No"
                ]
              }
            ]
          }
        ]
      },
      "jasp": [
        "Frequencies, then Contingency Tables",
        "Move the before variable to Rows and the after variable to Columns",
        "Under Statistics, tick McNemar's test"
      ],
      "report": "McNemar's test indicated a significant change in the proportion of cases between the first measurement (value per cent) and the second (value per cent), X2(1, N = value) = value, p = value.",
      "refs": [
        "McNemar, Q. (1947). Note on the sampling error of the difference between correlated proportions or percentages. Psychometrika, 12(2), 153 to 157."
      ]
    },
    "t_t_test_ind": {
      "type": "result",
      "id": "t_t_test_ind",
      "name": "Independent samples t test",
      "surveyframe_id": "t_test_ind",
      "example": "You measure the exam scores of one class taught online and another taught in person. An independent samples t test asks whether the two classes differ in their average score.",
      "smallSample": "Below about 30 per group normality is hard to judge and power is low. Use Welch's correction by default, consider the Mann-Whitney U test or a permutation test, and report Cohen's d with a confidence interval.",
      "verdict": "Compares the means of two independent groups on a continuous outcome.",
      "assumptions": [
        "The outcome is continuous and roughly normal within each group, or each group has 30 or more cases",
        "The two groups are independent",
        "Variances are similar across groups, or Welch's correction is applied"
      ],
      "alternative": {
        "label": "Mann-Whitney U, when normality fails or samples are small",
        "node": "t_mann_whitney"
      },
      "r": "# analysis_plan_t_test_ind.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# Add this entry to your instrument's analysis_plan list.\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Do the two groups differ in their mean outcome?\",\n  family            = \"group_comparison\",\n  method            = \"t_test_ind\",\n  roles             = list(\n    group      = \"group_var\",\n    outcome    = \"outcome_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# instr     <- sf_instrument(\"My study\", components = list(...),\n#                            analysis_plan = list(plan_entry))\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"t_test_ind\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngrp_set <- sf_choices(\"grp_set\", 1:3, c(\"Group 1\", \"Group 2\", \"Group 3\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: Group and outcome ----\nsec_b <- sf_item(\"sec_b\", \"Section B: Group and outcome\", type = \"section_break\")\ngroup_var <- sf_item(\"group_var\", \"[group membership - replace]\", type = \"single_choice\", choice_set = \"grp_set\")\noutcome_var_1 <- sf_item(\"outcome_var_1\", \"[Outcome item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"outcome_var\")\noutcome_var_2 <- sf_item(\"outcome_var_2\", \"[Outcome item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"outcome_var\")\noutcome_var_3 <- sf_item(\"outcome_var_3\", \"[Outcome item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"outcome_var\")\noutcome_var <- sf_scale(\"outcome_var\", \"Outcome\", c(\"outcome_var_1\", \"outcome_var_2\", \"outcome_var_3\"), method = \"mean\")\n\n# ---- Analysis plan (ids match the items and scales above) ----\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Do the two groups differ in their mean outcome?\",\n  family            = \"group_comparison\",\n  method            = \"t_test_ind\",\n  roles             = list(\n    group      = \"group_var\",\n    outcome    = \"outcome_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, group_var, outcome_var_1, outcome_var_2, outcome_var_3, outcome_var\n  ),\n  analysis_plan = list(plan_entry)\n)\n\n# Run it end to end once you have responses:\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "Group and outcome",
            "intro": "",
            "items": [
              {
                "label": "group membership",
                "type": "single_choice",
                "placeholder": true,
                "choices": [
                  "Group 1",
                  "Group 2",
                  "Group 3"
                ]
              },
              {
                "label": "Outcome — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          }
        ]
      },
      "jasp": [
        "T-Tests, then Independent Samples T-Test",
        "Move the outcome to Variables and the group to Grouping Variable",
        "Tick Student and Welch, and under Effect Size tick Cohen's d"
      ],
      "report": "An independent samples t test indicated that group A (M = value, SD = value) and group B (M = value, SD = value) differed significantly on the outcome, t(df) = value, p = value, d = value.",
      "refs": [
        "Student. (1908). The probable error of a mean. Biometrika, 6(1), 1 to 25."
      ]
    },
    "t_mann_whitney": {
      "type": "result",
      "id": "t_mann_whitney",
      "name": "Mann-Whitney U test",
      "surveyframe_id": "mann_whitney",
      "example": "Twelve patients rate their pain from 1 to 10 on drug A, and twelve different patients on drug B. With small skewed ratings the Mann-Whitney U test compares the two groups using ranks rather than means.",
      "smallSample": "A dependable small-sample test. With tiny groups request the exact p-value, and report the rank-biserial correlation as the effect size.",
      "verdict": "Compares two independent groups on an ordinal or non-normal outcome using ranks.",
      "assumptions": [
        "The outcome is at least ordinal",
        "The two groups are independent",
        "Group distributions have a broadly similar shape if medians are compared"
      ],
      "alternative": {
        "label": "Independent samples t test, when both groups are roughly normal",
        "node": "t_t_test_ind"
      },
      "r": "# analysis_plan_mann_whitney.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# Add this entry to your instrument's analysis_plan list.\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Do the two groups differ in their outcome distributions?\",\n  family            = \"group_comparison\",\n  method            = \"mann_whitney\",\n  roles             = list(\n    group      = \"group_var\",\n    outcome    = \"outcome_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# instr     <- sf_instrument(\"My study\", components = list(...),\n#                            analysis_plan = list(plan_entry))\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"mann_whitney\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngrp_set <- sf_choices(\"grp_set\", 1:3, c(\"Group 1\", \"Group 2\", \"Group 3\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: Group and outcome ----\nsec_b <- sf_item(\"sec_b\", \"Section B: Group and outcome\", type = \"section_break\")\ngroup_var <- sf_item(\"group_var\", \"[group membership - replace]\", type = \"single_choice\", choice_set = \"grp_set\")\noutcome_var_1 <- sf_item(\"outcome_var_1\", \"[Outcome item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"outcome_var\")\noutcome_var_2 <- sf_item(\"outcome_var_2\", \"[Outcome item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"outcome_var\")\noutcome_var_3 <- sf_item(\"outcome_var_3\", \"[Outcome item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"outcome_var\")\noutcome_var <- sf_scale(\"outcome_var\", \"Outcome\", c(\"outcome_var_1\", \"outcome_var_2\", \"outcome_var_3\"), method = \"mean\")\n\n# ---- Analysis plan (ids match the items and scales above) ----\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Do the two groups differ in their outcome distributions?\",\n  family            = \"group_comparison\",\n  method            = \"mann_whitney\",\n  roles             = list(\n    group      = \"group_var\",\n    outcome    = \"outcome_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, group_var, outcome_var_1, outcome_var_2, outcome_var_3, outcome_var\n  ),\n  analysis_plan = list(plan_entry)\n)\n\n# Run it end to end once you have responses:\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "Group and outcome",
            "intro": "",
            "items": [
              {
                "label": "group membership",
                "type": "single_choice",
                "placeholder": true,
                "choices": [
                  "Group 1",
                  "Group 2",
                  "Group 3"
                ]
              },
              {
                "label": "Outcome — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          }
        ]
      },
      "jasp": [
        "T-Tests, then Independent Samples T-Test",
        "Move the outcome to Variables and the group to Grouping Variable",
        "Under Tests, tick Mann-Whitney"
      ],
      "report": "A Mann-Whitney U test indicated that scores differed significantly between group A (Mdn = value) and group B (Mdn = value), U = value, p = value, r = value.",
      "refs": [
        "Mann, H. B., and Whitney, D. R. (1947). On a test of whether one of two random variables is stochastically larger than the other. Annals of Mathematical Statistics, 18(1), 50 to 60."
      ]
    },
    "t_t_test_pair": {
      "type": "result",
      "id": "t_t_test_pair",
      "name": "Paired samples t test",
      "surveyframe_id": "t_test_pair",
      "example": "The same 25 runners are timed before and after a training programme. A paired samples t test asks whether their average time improved.",
      "smallSample": "Pairing raises power, which helps small studies. Still inspect the differences for outliers, fall back on the Wilcoxon signed-rank test if they are skewed, and report Cohen's d with a confidence interval.",
      "verdict": "Compares two measurements taken on the same cases, for example before and after a treatment.",
      "assumptions": [
        "The paired differences are continuous and roughly normal",
        "Pairs are independent of other pairs",
        "No extreme outliers in the differences"
      ],
      "alternative": {
        "label": "Wilcoxon signed-rank test, when the differences are skewed or the sample is small",
        "node": "t_wilcoxon_pair"
      },
      "r": "# analysis_plan_t_test_pair.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# Add this entry to your instrument's analysis_plan list.\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Did scores change between the two measurements?\",\n  family            = \"group_comparison\",\n  method            = \"t_test_pair\",\n  roles             = list(\n    before     = \"time1_var\",\n    after      = \"time2_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# instr     <- sf_instrument(\"My study\", components = list(...),\n#                            analysis_plan = list(plan_entry))\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"t_test_pair\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: Repeated outcome ----\nsec_b <- sf_item(\"sec_b\", \"Section B: Repeated outcome\", type = \"section_break\")\ntime1_var <- sf_item(\"time1_var\", \"[outcome at time 1 - replace]\", type = \"likert\", choice_set = \"agree5\")\ntime2_var <- sf_item(\"time2_var\", \"[outcome at time 2 - replace]\", type = \"likert\", choice_set = \"agree5\")\n\n# ---- Analysis plan (ids match the items and scales above) ----\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Did scores change between the two measurements?\",\n  family            = \"group_comparison\",\n  method            = \"t_test_pair\",\n  roles             = list(\n    before     = \"time1_var\",\n    after      = \"time2_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, time1_var, time2_var\n  ),\n  analysis_plan = list(plan_entry)\n)\n\n# Run it end to end once you have responses:\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "Repeated outcome",
            "intro": "",
            "items": [
              {
                "label": "outcome at time 1",
                "type": "likert",
                "placeholder": true,
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ]
              },
              {
                "label": "outcome at time 2",
                "type": "likert",
                "placeholder": true,
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ]
              }
            ]
          }
        ]
      },
      "jasp": [
        "T-Tests, then Paired Samples T-Test",
        "Move the two measurements into Variable Pairs",
        "Tick Student, and under Effect Size tick Cohen's d"
      ],
      "report": "A paired samples t test indicated that scores increased significantly from the first measurement (M = value, SD = value) to the second (M = value, SD = value), t(df) = value, p = value, d = value.",
      "refs": [
        "Student. (1908). The probable error of a mean. Biometrika, 6(1), 1 to 25."
      ]
    },
    "t_wilcoxon_pair": {
      "type": "result",
      "id": "t_wilcoxon_pair",
      "name": "Wilcoxon signed-rank test",
      "surveyframe_id": "wilcoxon_pair",
      "example": "Ten employees rate their stress from 1 to 5 before and after a wellbeing week. With a small skewed sample the Wilcoxon signed-rank test compares the before and after ratings using ranks.",
      "smallSample": "A reliable small-sample paired test. Request the exact p-value when you have few pairs, and report the matched-pairs rank-biserial correlation.",
      "verdict": "Compares two paired measurements using ranks when the differences are ordinal, skewed, or from a small sample.",
      "assumptions": [
        "The outcome is at least ordinal",
        "The two measurements come from the same cases",
        "The distribution of differences is roughly symmetric"
      ],
      "alternative": {
        "label": "Paired samples t test, when the differences are roughly normal",
        "node": "t_t_test_pair"
      },
      "r": "# analysis_plan_wilcoxon_pair.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# Add this entry to your instrument's analysis_plan list.\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Did the paired scores change between the two measurements?\",\n  family            = \"group_comparison\",\n  method            = \"wilcoxon_pair\",\n  roles             = list(\n    before     = \"time1_var\",\n    after      = \"time2_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# instr     <- sf_instrument(\"My study\", components = list(...),\n#                            analysis_plan = list(plan_entry))\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"wilcoxon_pair\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: Repeated outcome ----\nsec_b <- sf_item(\"sec_b\", \"Section B: Repeated outcome\", type = \"section_break\")\ntime1_var <- sf_item(\"time1_var\", \"[outcome at time 1 - replace]\", type = \"likert\", choice_set = \"agree5\")\ntime2_var <- sf_item(\"time2_var\", \"[outcome at time 2 - replace]\", type = \"likert\", choice_set = \"agree5\")\n\n# ---- Analysis plan (ids match the items and scales above) ----\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Did the paired scores change between the two measurements?\",\n  family            = \"group_comparison\",\n  method            = \"wilcoxon_pair\",\n  roles             = list(\n    before     = \"time1_var\",\n    after      = \"time2_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, time1_var, time2_var\n  ),\n  analysis_plan = list(plan_entry)\n)\n\n# Run it end to end once you have responses:\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "Repeated outcome",
            "intro": "",
            "items": [
              {
                "label": "outcome at time 1",
                "type": "likert",
                "placeholder": true,
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ]
              },
              {
                "label": "outcome at time 2",
                "type": "likert",
                "placeholder": true,
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ]
              }
            ]
          }
        ]
      },
      "jasp": [
        "T-Tests, then Paired Samples T-Test",
        "Move the two measurements into Variable Pairs",
        "Under Tests, tick Wilcoxon signed-rank"
      ],
      "report": "A Wilcoxon signed-rank test indicated that scores changed significantly from the first measurement (Mdn = value) to the second (Mdn = value), W = value, p = value, r = value.",
      "refs": [
        "Wilcoxon, F. (1945). Individual comparisons by ranking methods. Biometrics Bulletin, 1(6), 80 to 83."
      ]
    },
    "t_anova_one": {
      "type": "result",
      "id": "t_anova_one",
      "name": "One-way ANOVA",
      "surveyframe_id": "anova_one",
      "example": "You compare the average plant growth across three fertilisers. A one-way ANOVA asks whether at least one fertiliser gives a different mean growth.",
      "smallSample": "Small unequal groups make the equal-variance assumption fragile. Consider Welch's ANOVA or the Kruskal-Wallis test, and report eta squared or omega squared with a confidence interval.",
      "verdict": "Compares the means of three or more independent groups on a continuous outcome.",
      "assumptions": [
        "The outcome is continuous and roughly normal within each group",
        "Groups are independent",
        "Variances are similar across groups (Levene's test)",
        "Follow a significant result with post hoc comparisons"
      ],
      "alternative": {
        "label": "Kruskal-Wallis test, when assumptions fail or samples are small",
        "node": "t_kruskal_wallis"
      },
      "r": "# analysis_plan_anova_one.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# Add this entry to your instrument's analysis_plan list.\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Do the groups differ in their mean outcome?\",\n  family            = \"group_comparison\",\n  method            = \"anova_one\",\n  roles             = list(\n    group      = \"group_var\",\n    outcome    = \"outcome_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# instr     <- sf_instrument(\"My study\", components = list(...),\n#                            analysis_plan = list(plan_entry))\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"anova_one\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngrp_set <- sf_choices(\"grp_set\", 1:3, c(\"Group 1\", \"Group 2\", \"Group 3\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: Group and outcome ----\nsec_b <- sf_item(\"sec_b\", \"Section B: Group and outcome\", type = \"section_break\")\ngroup_var <- sf_item(\"group_var\", \"[group membership - replace]\", type = \"single_choice\", choice_set = \"grp_set\")\noutcome_var_1 <- sf_item(\"outcome_var_1\", \"[Outcome item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"outcome_var\")\noutcome_var_2 <- sf_item(\"outcome_var_2\", \"[Outcome item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"outcome_var\")\noutcome_var_3 <- sf_item(\"outcome_var_3\", \"[Outcome item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"outcome_var\")\noutcome_var <- sf_scale(\"outcome_var\", \"Outcome\", c(\"outcome_var_1\", \"outcome_var_2\", \"outcome_var_3\"), method = \"mean\")\n\n# ---- Analysis plan (ids match the items and scales above) ----\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Do the groups differ in their mean outcome?\",\n  family            = \"group_comparison\",\n  method            = \"anova_one\",\n  roles             = list(\n    group      = \"group_var\",\n    outcome    = \"outcome_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, group_var, outcome_var_1, outcome_var_2, outcome_var_3, outcome_var\n  ),\n  analysis_plan = list(plan_entry)\n)\n\n# Run it end to end once you have responses:\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "Group and outcome",
            "intro": "",
            "items": [
              {
                "label": "group membership",
                "type": "single_choice",
                "placeholder": true,
                "choices": [
                  "Group 1",
                  "Group 2",
                  "Group 3"
                ]
              },
              {
                "label": "Outcome — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          }
        ]
      },
      "jasp": [
        "ANOVA, then ANOVA",
        "Move the outcome to Dependent Variable and the group to Fixed Factors",
        "Under Post Hoc Tests, select the factor and tick Tukey; under Additional Options tick eta squared"
      ],
      "report": "A one-way ANOVA indicated a significant effect of group on the outcome, F(df1, df2) = value, p = value, eta squared = value. Tukey post hoc comparisons showed that group A differed from group B (p = value).",
      "refs": [
        "Fisher, R. A. (1925). Statistical methods for research workers. Oliver and Boyd."
      ]
    },
    "t_kruskal_wallis": {
      "type": "result",
      "id": "t_kruskal_wallis",
      "name": "Kruskal-Wallis test",
      "surveyframe_id": "kruskal_wallis",
      "example": "Customers at three branches rate service from 1 to 5. With small ordinal ratings the Kruskal-Wallis test asks whether satisfaction differs across the branches using ranks.",
      "smallSample": "A robust choice for small ordinal data. Follow a significant result with Dunn's test and a Holm correction, and report epsilon squared as the effect size.",
      "verdict": "Compares three or more independent groups on an ordinal or non-normal outcome using ranks.",
      "assumptions": [
        "The outcome is at least ordinal",
        "Groups are independent",
        "Group distributions have a broadly similar shape if medians are compared"
      ],
      "alternative": {
        "label": "One-way ANOVA, when normality and equal variances hold",
        "node": "t_anova_one"
      },
      "r": "# analysis_plan_kruskal_wallis.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# Add this entry to your instrument's analysis_plan list.\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Do the groups differ in their outcome distributions?\",\n  family            = \"group_comparison\",\n  method            = \"kruskal_wallis\",\n  roles             = list(\n    group      = \"group_var\",\n    outcome    = \"outcome_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# instr     <- sf_instrument(\"My study\", components = list(...),\n#                            analysis_plan = list(plan_entry))\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"kruskal_wallis\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngrp_set <- sf_choices(\"grp_set\", 1:3, c(\"Group 1\", \"Group 2\", \"Group 3\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: Group and outcome ----\nsec_b <- sf_item(\"sec_b\", \"Section B: Group and outcome\", type = \"section_break\")\ngroup_var <- sf_item(\"group_var\", \"[group membership - replace]\", type = \"single_choice\", choice_set = \"grp_set\")\noutcome_var_1 <- sf_item(\"outcome_var_1\", \"[Outcome item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"outcome_var\")\noutcome_var_2 <- sf_item(\"outcome_var_2\", \"[Outcome item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"outcome_var\")\noutcome_var_3 <- sf_item(\"outcome_var_3\", \"[Outcome item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"outcome_var\")\noutcome_var <- sf_scale(\"outcome_var\", \"Outcome\", c(\"outcome_var_1\", \"outcome_var_2\", \"outcome_var_3\"), method = \"mean\")\n\n# ---- Analysis plan (ids match the items and scales above) ----\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Do the groups differ in their outcome distributions?\",\n  family            = \"group_comparison\",\n  method            = \"kruskal_wallis\",\n  roles             = list(\n    group      = \"group_var\",\n    outcome    = \"outcome_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, group_var, outcome_var_1, outcome_var_2, outcome_var_3, outcome_var\n  ),\n  analysis_plan = list(plan_entry)\n)\n\n# Run it end to end once you have responses:\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "Group and outcome",
            "intro": "",
            "items": [
              {
                "label": "group membership",
                "type": "single_choice",
                "placeholder": true,
                "choices": [
                  "Group 1",
                  "Group 2",
                  "Group 3"
                ]
              },
              {
                "label": "Outcome — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          }
        ]
      },
      "jasp": [
        "ANOVA, then ANOVA",
        "Move the outcome to Dependent Variable and the group to Fixed Factors",
        "Under Nonparametrics, move the factor across and tick Dunn's post hoc test"
      ],
      "report": "A Kruskal-Wallis test indicated a significant difference between the groups, H(df) = value, p = value, epsilon squared = value. Dunn's pairwise comparisons showed that group A differed from group B (p = value).",
      "refs": [
        "Kruskal, W. H., and Wallis, W. A. (1952). Use of ranks in one-criterion variance analysis. Journal of the American Statistical Association, 47(260), 583 to 621."
      ]
    },
    "t_anova_two": {
      "type": "result",
      "id": "t_anova_two",
      "name": "Two-way (factorial) ANOVA",
      "surveyframe_id": "anova_two",
      "example": "Plant growth is measured under two fertilisers and two light levels. A two-way ANOVA asks whether fertiliser matters, whether light matters, and whether the effect of fertiliser depends on the light level.",
      "smallSample": "A factorial design splits a small sample across many cells, leaving little power in each. Keep the design simple, and interpret effect sizes with their confidence intervals rather than leaning on p-values.",
      "verdict": "Tests the main effects of two grouping factors and their interaction on a continuous outcome.",
      "assumptions": [
        "The outcome is continuous and roughly normal within each cell",
        "Observations are independent",
        "Variances are similar across cells",
        "Interpret the interaction before the main effects"
      ],
      "alternative": {
        "label": "Separate Kruskal-Wallis tests by factor, when assumptions fail badly",
        "node": "t_kruskal_wallis"
      },
      "r": "# analysis_plan_anova_two.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# Add this entry to your instrument's analysis_plan list.\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Do the two factors, and their interaction, affect the outcome?\",\n  family            = \"group_comparison\",\n  method            = \"anova_two\",\n  roles             = list(\n    factor1    = \"factor_a\",\n    factor2    = \"factor_b\",\n    outcome    = \"outcome_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# instr     <- sf_instrument(\"My study\", components = list(...),\n#                            analysis_plan = list(plan_entry))\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"anova_two\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngrp_set <- sf_choices(\"grp_set\", 1:3, c(\"Group 1\", \"Group 2\", \"Group 3\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: Factors and outcome ----\nsec_b <- sf_item(\"sec_b\", \"Section B: Factors and outcome\", type = \"section_break\")\nfactor_a <- sf_item(\"factor_a\", \"[first factor - replace]\", type = \"single_choice\", choice_set = \"grp_set\")\nfactor_b <- sf_item(\"factor_b\", \"[second factor - replace]\", type = \"single_choice\", choice_set = \"grp_set\")\noutcome_var_1 <- sf_item(\"outcome_var_1\", \"[Outcome item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"outcome_var\")\noutcome_var_2 <- sf_item(\"outcome_var_2\", \"[Outcome item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"outcome_var\")\noutcome_var_3 <- sf_item(\"outcome_var_3\", \"[Outcome item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"outcome_var\")\noutcome_var <- sf_scale(\"outcome_var\", \"Outcome\", c(\"outcome_var_1\", \"outcome_var_2\", \"outcome_var_3\"), method = \"mean\")\n\n# ---- Analysis plan (ids match the items and scales above) ----\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Do the two factors, and their interaction, affect the outcome?\",\n  family            = \"group_comparison\",\n  method            = \"anova_two\",\n  roles             = list(\n    factor1    = \"factor_a\",\n    factor2    = \"factor_b\",\n    outcome    = \"outcome_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, factor_a, factor_b, outcome_var_1, outcome_var_2, outcome_var_3, outcome_var\n  ),\n  analysis_plan = list(plan_entry)\n)\n\n# Run it end to end once you have responses:\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "Factors and outcome",
            "intro": "",
            "items": [
              {
                "label": "first factor",
                "type": "single_choice",
                "placeholder": true,
                "choices": [
                  "Group 1",
                  "Group 2",
                  "Group 3"
                ]
              },
              {
                "label": "second factor",
                "type": "single_choice",
                "placeholder": true,
                "choices": [
                  "Group 1",
                  "Group 2",
                  "Group 3"
                ]
              },
              {
                "label": "Outcome — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          }
        ]
      },
      "jasp": [
        "ANOVA, then ANOVA",
        "Move the outcome to Dependent Variable and both factors to Fixed Factors",
        "Under Descriptive Plots, place one factor on the horizontal axis and the other as separate lines"
      ],
      "report": "A two-way ANOVA indicated a significant interaction between factor A and factor B, F(df1, df2) = value, p = value, partial eta squared = value.",
      "refs": [
        "Fisher, R. A. (1925). Statistical methods for research workers. Oliver and Boyd."
      ]
    },
    "t_ancova": {
      "type": "result",
      "id": "t_ancova",
      "name": "ANCOVA",
      "surveyframe_id": "ancova",
      "example": "Two teaching methods are compared on final exam scores, but students began with different prior grades. ANCOVA compares the methods on the final score after fairly adjusting for those starting grades.",
      "smallSample": "A well-chosen covariate can recover power in a small study by reducing error variance. Confirm the covariate was measured before treatment and that the slopes are parallel across groups.",
      "verdict": "Compares group means on a continuous outcome while controlling for one or more continuous covariates.",
      "assumptions": [
        "The covariate is measured before the treatment and is unaffected by it",
        "The covariate relates linearly to the outcome",
        "Regression slopes are homogeneous across groups",
        "Residuals are roughly normal with similar variances"
      ],
      "alternative": {
        "label": "One-way ANOVA on the raw outcome, when no covariate is justified",
        "node": "t_anova_one"
      },
      "r": "# analysis_plan_ancova.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# Add this entry to your instrument's analysis_plan list.\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Do the groups differ in the outcome after controlling for the covariate?\",\n  family            = \"group_comparison\",\n  method            = \"ancova\",\n  roles             = list(\n    group      = \"group_var\",\n    covariates = c(\"covariate_var\"),\n    outcome    = \"outcome_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# instr     <- sf_instrument(\"My study\", components = list(...),\n#                            analysis_plan = list(plan_entry))\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"ancova\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngrp_set <- sf_choices(\"grp_set\", 1:3, c(\"Group 1\", \"Group 2\", \"Group 3\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: Group, covariate, and outcome ----\nsec_b <- sf_item(\"sec_b\", \"Section B: Group, covariate, and outcome\", type = \"section_break\")\ngroup_var <- sf_item(\"group_var\", \"[group membership - replace]\", type = \"single_choice\", choice_set = \"grp_set\")\ncovariate_var_1 <- sf_item(\"covariate_var_1\", \"[Covariate 1 item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"covariate_var\")\ncovariate_var_2 <- sf_item(\"covariate_var_2\", \"[Covariate 1 item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"covariate_var\")\ncovariate_var_3 <- sf_item(\"covariate_var_3\", \"[Covariate 1 item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"covariate_var\")\ncovariate_var <- sf_scale(\"covariate_var\", \"Covariate 1\", c(\"covariate_var_1\", \"covariate_var_2\", \"covariate_var_3\"), method = \"mean\")\noutcome_var_1 <- sf_item(\"outcome_var_1\", \"[Outcome item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"outcome_var\")\noutcome_var_2 <- sf_item(\"outcome_var_2\", \"[Outcome item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"outcome_var\")\noutcome_var_3 <- sf_item(\"outcome_var_3\", \"[Outcome item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"outcome_var\")\noutcome_var <- sf_scale(\"outcome_var\", \"Outcome\", c(\"outcome_var_1\", \"outcome_var_2\", \"outcome_var_3\"), method = \"mean\")\n\n# ---- Analysis plan (ids match the items and scales above) ----\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Do the groups differ in the outcome after controlling for the covariate?\",\n  family            = \"group_comparison\",\n  method            = \"ancova\",\n  roles             = list(\n    group      = \"group_var\",\n    covariates = c(\"covariate_var\"),\n    outcome    = \"outcome_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, group_var, covariate_var_1, covariate_var_2, covariate_var_3, covariate_var, outcome_var_1, outcome_var_2, outcome_var_3, outcome_var\n  ),\n  analysis_plan = list(plan_entry)\n)\n\n# Run it end to end once you have responses:\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "Group, covariate, and outcome",
            "intro": "",
            "items": [
              {
                "label": "group membership",
                "type": "single_choice",
                "placeholder": true,
                "choices": [
                  "Group 1",
                  "Group 2",
                  "Group 3"
                ]
              },
              {
                "label": "Covariate 1 — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Covariate 1 — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Covariate 1 — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          }
        ]
      },
      "jasp": [
        "ANOVA, then ANCOVA",
        "Move the outcome to Dependent Variable, the group to Fixed Factors, and the covariate to Covariates",
        "Under Additional Options, tick estimated marginal means"
      ],
      "report": "An ANCOVA indicated a significant effect of group on the outcome after controlling for the covariate, F(df1, df2) = value, p = value, partial eta squared = value.",
      "refs": [
        "Field, A. (2018). Discovering statistics using IBM SPSS statistics (5th ed.). Sage."
      ]
    },
    "t_repeated_anova": {
      "type": "result",
      "id": "t_repeated_anova",
      "name": "Repeated measures ANOVA",
      "surveyframe_id": "repeated_anova",
      "example": "The same patients have their blood pressure measured at weeks 1, 4, and 8. A repeated measures ANOVA asks whether the average reading changed across the three time points.",
      "smallSample": "Measuring the same people repeatedly is efficient for small samples. If sphericity is doubtful apply the Greenhouse-Geisser correction, or model the data with a linear mixed model.",
      "verdict": "Compares a continuous outcome measured three or more times on the same cases.",
      "assumptions": [
        "The outcome is continuous and roughly normal at each time point",
        "Sphericity holds, or a Greenhouse-Geisser correction is applied",
        "Cases are independent of one another"
      ],
      "alternative": {
        "label": "Friedman test, when the outcome is ordinal or clearly non-normal",
        "node": "t_friedman"
      },
      "r": "# analysis_plan_repeated_anova.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# Add this entry to your instrument's analysis_plan list.\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Did the outcome change across the repeated measurements?\",\n  family            = \"group_comparison\",\n  method            = \"repeated_anova\",\n  roles             = list(\n    measures   = c(\"time1_var\", \"time2_var\", \"time3_var\")\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# instr     <- sf_instrument(\"My study\", components = list(...),\n#                            analysis_plan = list(plan_entry))\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"repeated_anova\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: Repeated measurements ----\nsec_b <- sf_item(\"sec_b\", \"Section B: Repeated measurements\", type = \"section_break\")\ntime1_var <- sf_item(\"time1_var\", \"[outcome at time 1 - replace]\", type = \"likert\", choice_set = \"agree5\")\ntime2_var <- sf_item(\"time2_var\", \"[outcome at time 2 - replace]\", type = \"likert\", choice_set = \"agree5\")\ntime3_var <- sf_item(\"time3_var\", \"[outcome at time 3 - replace]\", type = \"likert\", choice_set = \"agree5\")\n\n# ---- Analysis plan (ids match the items and scales above) ----\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Did the outcome change across the repeated measurements?\",\n  family            = \"group_comparison\",\n  method            = \"repeated_anova\",\n  roles             = list(\n    measures   = c(\"time1_var\", \"time2_var\", \"time3_var\")\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, time1_var, time2_var, time3_var\n  ),\n  analysis_plan = list(plan_entry)\n)\n\n# Run it end to end once you have responses:\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "Repeated measurements",
            "intro": "",
            "items": [
              {
                "label": "outcome at time 1",
                "type": "likert",
                "placeholder": true,
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ]
              },
              {
                "label": "outcome at time 2",
                "type": "likert",
                "placeholder": true,
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ]
              },
              {
                "label": "outcome at time 3",
                "type": "likert",
                "placeholder": true,
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ]
              }
            ]
          }
        ]
      },
      "jasp": [
        "ANOVA, then Repeated Measures ANOVA",
        "Name the within-subject factor and its levels, then assign one measurement column to each level",
        "Under Assumption Checks, tick sphericity and the Greenhouse-Geisser correction"
      ],
      "report": "A repeated measures ANOVA indicated a significant effect of time on the outcome, F(df1, df2) = value, p = value, partial eta squared = value.",
      "refs": [
        "Field, A. (2018). Discovering statistics using IBM SPSS statistics (5th ed.). Sage."
      ]
    },
    "t_friedman": {
      "type": "result",
      "id": "t_friedman",
      "name": "Friedman test",
      "surveyframe_id": "friedman",
      "example": "Eight judges each rank the same three coffees from best to worst. The Friedman test asks whether the coffees received systematically different ratings.",
      "smallSample": "A solid small-sample choice for repeated rankings. Follow a significant result with Conover's post hoc test, and report Kendall's W as the effect size.",
      "verdict": "Compares three or more repeated measurements on the same cases using ranks.",
      "assumptions": [
        "The outcome is at least ordinal",
        "All measurements come from the same cases",
        "Cases are independent of one another"
      ],
      "alternative": {
        "label": "Repeated measures ANOVA, when normality holds at each time point",
        "node": "t_repeated_anova"
      },
      "r": "# analysis_plan_friedman.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# Add this entry to your instrument's analysis_plan list.\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Did the outcome change across the repeated measurements?\",\n  family            = \"group_comparison\",\n  method            = \"friedman\",\n  roles             = list(\n    measures   = c(\"time1_var\", \"time2_var\", \"time3_var\")\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# instr     <- sf_instrument(\"My study\", components = list(...),\n#                            analysis_plan = list(plan_entry))\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"friedman\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: Repeated measurements ----\nsec_b <- sf_item(\"sec_b\", \"Section B: Repeated measurements\", type = \"section_break\")\ntime1_var <- sf_item(\"time1_var\", \"[outcome at time 1 - replace]\", type = \"likert\", choice_set = \"agree5\")\ntime2_var <- sf_item(\"time2_var\", \"[outcome at time 2 - replace]\", type = \"likert\", choice_set = \"agree5\")\ntime3_var <- sf_item(\"time3_var\", \"[outcome at time 3 - replace]\", type = \"likert\", choice_set = \"agree5\")\n\n# ---- Analysis plan (ids match the items and scales above) ----\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Did the outcome change across the repeated measurements?\",\n  family            = \"group_comparison\",\n  method            = \"friedman\",\n  roles             = list(\n    measures   = c(\"time1_var\", \"time2_var\", \"time3_var\")\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, time1_var, time2_var, time3_var\n  ),\n  analysis_plan = list(plan_entry)\n)\n\n# Run it end to end once you have responses:\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "Repeated measurements",
            "intro": "",
            "items": [
              {
                "label": "outcome at time 1",
                "type": "likert",
                "placeholder": true,
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ]
              },
              {
                "label": "outcome at time 2",
                "type": "likert",
                "placeholder": true,
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ]
              },
              {
                "label": "outcome at time 3",
                "type": "likert",
                "placeholder": true,
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ]
              }
            ]
          }
        ]
      },
      "jasp": [
        "ANOVA, then Repeated Measures ANOVA",
        "Define the within-subject factor and assign the measurement columns",
        "Under Nonparametrics, move the factor across to run the Friedman test, and tick Conover's post hoc tests"
      ],
      "report": "A Friedman test indicated a significant difference across the three measurements, X2(df) = value, p = value, Kendall's W = value.",
      "refs": [
        "Friedman, M. (1937). The use of ranks to avoid the assumption of normality implicit in the analysis of variance. Journal of the American Statistical Association, 32(200), 675 to 701."
      ]
    },
    "t_correlation_pearson": {
      "type": "result",
      "id": "t_correlation_pearson",
      "name": "Pearson correlation",
      "surveyframe_id": "correlation_pearson",
      "example": "You record how many hours each student studied and their exam mark. A Pearson correlation measures how strongly study hours and marks rise together in a straight-line pattern.",
      "smallSample": "Correlations are unstable in small samples, where a single outlier can dominate. Report the confidence interval, consider a bootstrap interval, and switch to Spearman's rho if outliers are present.",
      "verdict": "Measures the strength and direction of a linear relationship between two continuous variables.",
      "assumptions": [
        "Both variables are continuous",
        "The relationship looks linear in a scatter plot",
        "Both variables are roughly normal, with no extreme outliers"
      ],
      "alternative": {
        "label": "Spearman's rho, when outliers or skew distort the linear pattern",
        "node": "t_correlation_spearman"
      },
      "r": "# analysis_plan_correlation_pearson.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# Add this entry to your instrument's analysis_plan list.\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Is there a linear relationship between X and Y?\",\n  family            = \"association\",\n  method            = \"correlation_pearson\",\n  roles             = list(\n    x          = \"x_var\",\n    y          = \"y_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# instr     <- sf_instrument(\"My study\", components = list(...),\n#                            analysis_plan = list(plan_entry))\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"correlation_pearson\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: The two variables ----\nsec_b <- sf_item(\"sec_b\", \"Section B: The two variables\", type = \"section_break\")\nx_var_1 <- sf_item(\"x_var_1\", \"[Variable X item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"x_var\")\nx_var_2 <- sf_item(\"x_var_2\", \"[Variable X item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"x_var\")\nx_var_3 <- sf_item(\"x_var_3\", \"[Variable X item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"x_var\")\nx_var <- sf_scale(\"x_var\", \"Variable X\", c(\"x_var_1\", \"x_var_2\", \"x_var_3\"), method = \"mean\")\ny_var_1 <- sf_item(\"y_var_1\", \"[Variable Y item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"y_var\")\ny_var_2 <- sf_item(\"y_var_2\", \"[Variable Y item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"y_var\")\ny_var_3 <- sf_item(\"y_var_3\", \"[Variable Y item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"y_var\")\ny_var <- sf_scale(\"y_var\", \"Variable Y\", c(\"y_var_1\", \"y_var_2\", \"y_var_3\"), method = \"mean\")\n\n# ---- Analysis plan (ids match the items and scales above) ----\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Is there a linear relationship between X and Y?\",\n  family            = \"association\",\n  method            = \"correlation_pearson\",\n  roles             = list(\n    x          = \"x_var\",\n    y          = \"y_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, x_var_1, x_var_2, x_var_3, x_var, y_var_1, y_var_2, y_var_3, y_var\n  ),\n  analysis_plan = list(plan_entry)\n)\n\n# Run it end to end once you have responses:\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "The two variables",
            "intro": "",
            "items": [
              {
                "label": "Variable X — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Variable X — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Variable X — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Variable Y — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Variable Y — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Variable Y — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          }
        ]
      },
      "jasp": [
        "Regression, then Correlation",
        "Move both variables into the Variables box",
        "Tick Pearson's r, and under Plots tick the scatter plot"
      ],
      "report": "A Pearson correlation indicated a significant positive relationship between X and Y, r(df) = value, p = value.",
      "refs": [
        "Pearson, K. (1896). Mathematical contributions to the theory of evolution III: Regression, heredity, and panmixia. Philosophical Transactions of the Royal Society A, 187, 253 to 318."
      ]
    },
    "t_correlation_spearman": {
      "type": "result",
      "id": "t_correlation_spearman",
      "name": "Spearman's rank correlation",
      "surveyframe_id": "correlation_spearman",
      "example": "You rank ten films by budget and by box-office takings. Spearman's correlation measures whether higher-budget films tend to earn more, even when the pattern is not a straight line.",
      "smallSample": "A robust small-sample choice. Report a bootstrap confidence interval, and prefer Kendall's tau when tied ranks are common.",
      "verdict": "Measures a monotonic relationship between two variables using ranks, robust to outliers and skew.",
      "assumptions": [
        "Both variables are at least ordinal",
        "The relationship is monotonic, rising or falling consistently",
        "Pairs of observations are independent"
      ],
      "alternative": {
        "label": "Kendall's tau, when the sample is small or ranks contain many ties",
        "node": "t_correlation_kendall"
      },
      "r": "# analysis_plan_correlation_spearman.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# Add this entry to your instrument's analysis_plan list.\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Is there a monotonic relationship between X and Y?\",\n  family            = \"association\",\n  method            = \"correlation_spearman\",\n  roles             = list(\n    x          = \"x_var\",\n    y          = \"y_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# instr     <- sf_instrument(\"My study\", components = list(...),\n#                            analysis_plan = list(plan_entry))\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"correlation_spearman\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: The two variables ----\nsec_b <- sf_item(\"sec_b\", \"Section B: The two variables\", type = \"section_break\")\nx_var_1 <- sf_item(\"x_var_1\", \"[Variable X item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"x_var\")\nx_var_2 <- sf_item(\"x_var_2\", \"[Variable X item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"x_var\")\nx_var_3 <- sf_item(\"x_var_3\", \"[Variable X item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"x_var\")\nx_var <- sf_scale(\"x_var\", \"Variable X\", c(\"x_var_1\", \"x_var_2\", \"x_var_3\"), method = \"mean\")\ny_var_1 <- sf_item(\"y_var_1\", \"[Variable Y item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"y_var\")\ny_var_2 <- sf_item(\"y_var_2\", \"[Variable Y item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"y_var\")\ny_var_3 <- sf_item(\"y_var_3\", \"[Variable Y item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"y_var\")\ny_var <- sf_scale(\"y_var\", \"Variable Y\", c(\"y_var_1\", \"y_var_2\", \"y_var_3\"), method = \"mean\")\n\n# ---- Analysis plan (ids match the items and scales above) ----\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Is there a monotonic relationship between X and Y?\",\n  family            = \"association\",\n  method            = \"correlation_spearman\",\n  roles             = list(\n    x          = \"x_var\",\n    y          = \"y_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, x_var_1, x_var_2, x_var_3, x_var, y_var_1, y_var_2, y_var_3, y_var\n  ),\n  analysis_plan = list(plan_entry)\n)\n\n# Run it end to end once you have responses:\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "The two variables",
            "intro": "",
            "items": [
              {
                "label": "Variable X — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Variable X — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Variable X — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Variable Y — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Variable Y — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Variable Y — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          }
        ]
      },
      "jasp": [
        "Regression, then Correlation",
        "Move both variables into the Variables box",
        "Tick Spearman's rho"
      ],
      "report": "A Spearman rank correlation indicated a significant positive relationship between X and Y, rs(df) = value, p = value.",
      "refs": [
        "Spearman, C. (1904). The proof and measurement of association between two things. American Journal of Psychology, 15(1), 72 to 101."
      ]
    },
    "t_correlation_kendall": {
      "type": "result",
      "id": "t_correlation_kendall",
      "name": "Kendall's tau",
      "surveyframe_id": "correlation_kendall",
      "example": "With only nine countries ranked on press freedom and on income, and several ties, Kendall's tau measures how consistently the two rankings agree.",
      "smallSample": "Kendall's tau is the preferred coefficient for very small samples and many ties. Report its confidence interval rather than the p-value alone.",
      "verdict": "Measures a monotonic relationship using concordant and discordant pairs, preferred for small samples and tied ranks.",
      "assumptions": [
        "Both variables are at least ordinal",
        "The relationship is monotonic",
        "Pairs of observations are independent"
      ],
      "alternative": {
        "label": "Spearman's rho, for moderate to large samples with few ties",
        "node": "t_correlation_spearman"
      },
      "r": "# analysis_plan_correlation_kendall.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# Add this entry to your instrument's analysis_plan list.\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Is there a monotonic relationship between X and Y in this small sample?\",\n  family            = \"association\",\n  method            = \"correlation_kendall\",\n  roles             = list(\n    x          = \"x_var\",\n    y          = \"y_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# instr     <- sf_instrument(\"My study\", components = list(...),\n#                            analysis_plan = list(plan_entry))\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"correlation_kendall\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: The two variables ----\nsec_b <- sf_item(\"sec_b\", \"Section B: The two variables\", type = \"section_break\")\nx_var_1 <- sf_item(\"x_var_1\", \"[Variable X item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"x_var\")\nx_var_2 <- sf_item(\"x_var_2\", \"[Variable X item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"x_var\")\nx_var_3 <- sf_item(\"x_var_3\", \"[Variable X item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"x_var\")\nx_var <- sf_scale(\"x_var\", \"Variable X\", c(\"x_var_1\", \"x_var_2\", \"x_var_3\"), method = \"mean\")\ny_var_1 <- sf_item(\"y_var_1\", \"[Variable Y item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"y_var\")\ny_var_2 <- sf_item(\"y_var_2\", \"[Variable Y item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"y_var\")\ny_var_3 <- sf_item(\"y_var_3\", \"[Variable Y item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"y_var\")\ny_var <- sf_scale(\"y_var\", \"Variable Y\", c(\"y_var_1\", \"y_var_2\", \"y_var_3\"), method = \"mean\")\n\n# ---- Analysis plan (ids match the items and scales above) ----\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Is there a monotonic relationship between X and Y in this small sample?\",\n  family            = \"association\",\n  method            = \"correlation_kendall\",\n  roles             = list(\n    x          = \"x_var\",\n    y          = \"y_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, x_var_1, x_var_2, x_var_3, x_var, y_var_1, y_var_2, y_var_3, y_var\n  ),\n  analysis_plan = list(plan_entry)\n)\n\n# Run it end to end once you have responses:\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "The two variables",
            "intro": "",
            "items": [
              {
                "label": "Variable X — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Variable X — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Variable X — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Variable Y — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Variable Y — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Variable Y — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          }
        ]
      },
      "jasp": [
        "Regression, then Correlation",
        "Move both variables into the Variables box",
        "Tick Kendall's tau-b"
      ],
      "report": "A Kendall rank correlation indicated a significant positive relationship between X and Y, tau-b = value, p = value.",
      "refs": [
        "Kendall, M. G. (1938). A new measure of rank correlation. Biometrika, 30(1/2), 81 to 93."
      ]
    },
    "t_regression_linear": {
      "type": "result",
      "id": "t_regression_linear",
      "name": "Multiple linear regression",
      "surveyframe_id": "regression_linear",
      "example": "You predict house price from floor area, number of bedrooms, and distance to the city. Multiple linear regression shows how much each feature adds to the price on its own.",
      "smallSample": "Small samples support only a few predictors, roughly 10 to 15 cases each. Consider penalised (ridge or lasso) or Bayesian regression to stabilise the estimates, and report confidence intervals.",
      "verdict": "Predicts a continuous outcome from one or more predictors and quantifies each predictor's unique contribution.",
      "assumptions": [
        "The outcome relates linearly to each predictor",
        "Residuals are independent, roughly normal, and have constant variance",
        "Predictors are not highly collinear (check VIF)",
        "Sample size is adequate for the number of predictors"
      ],
      "alternative": {
        "label": "Ordinal logistic regression, when the outcome is ordinal rather than continuous",
        "node": "t_regression_logistic_ordinal"
      },
      "r": "# analysis_plan_regression_linear.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# Add this entry to your instrument's analysis_plan list.\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Which predictors explain the outcome?\",\n  family            = \"prediction\",\n  method            = \"regression_linear\",\n  roles             = list(\n    predictors = c(\"pred1\", \"pred2\"),\n    dependent  = \"outcome_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# instr     <- sf_instrument(\"My study\", components = list(...),\n#                            analysis_plan = list(plan_entry))\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"regression_linear\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: Predictors and outcome ----\nsec_b <- sf_item(\"sec_b\", \"Section B: Predictors and outcome\", type = \"section_break\")\npred1_1 <- sf_item(\"pred1_1\", \"[Predictor 1 item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred1\")\npred1_2 <- sf_item(\"pred1_2\", \"[Predictor 1 item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred1\")\npred1_3 <- sf_item(\"pred1_3\", \"[Predictor 1 item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred1\")\npred1 <- sf_scale(\"pred1\", \"Predictor 1\", c(\"pred1_1\", \"pred1_2\", \"pred1_3\"), method = \"mean\")\npred2_1 <- sf_item(\"pred2_1\", \"[Predictor 2 item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred2\")\npred2_2 <- sf_item(\"pred2_2\", \"[Predictor 2 item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred2\")\npred2_3 <- sf_item(\"pred2_3\", \"[Predictor 2 item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred2\")\npred2 <- sf_scale(\"pred2\", \"Predictor 2\", c(\"pred2_1\", \"pred2_2\", \"pred2_3\"), method = \"mean\")\noutcome_var_1 <- sf_item(\"outcome_var_1\", \"[Outcome item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"outcome_var\")\noutcome_var_2 <- sf_item(\"outcome_var_2\", \"[Outcome item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"outcome_var\")\noutcome_var_3 <- sf_item(\"outcome_var_3\", \"[Outcome item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"outcome_var\")\noutcome_var <- sf_scale(\"outcome_var\", \"Outcome\", c(\"outcome_var_1\", \"outcome_var_2\", \"outcome_var_3\"), method = \"mean\")\n\n# ---- Analysis plan (ids match the items and scales above) ----\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Which predictors explain the outcome?\",\n  family            = \"prediction\",\n  method            = \"regression_linear\",\n  roles             = list(\n    predictors = c(\"pred1\", \"pred2\"),\n    dependent  = \"outcome_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, pred1_1, pred1_2, pred1_3, pred1, pred2_1, pred2_2, pred2_3, pred2, outcome_var_1, outcome_var_2, outcome_var_3, outcome_var\n  ),\n  analysis_plan = list(plan_entry)\n)\n\n# Run it end to end once you have responses:\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "Predictors and outcome",
            "intro": "",
            "items": [
              {
                "label": "Predictor 1 — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor 1 — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor 1 — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor 2 — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor 2 — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor 2 — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          }
        ]
      },
      "jasp": [
        "Regression, then Linear Regression",
        "Move the outcome to Dependent Variable and the predictors to Covariates",
        "Under Statistics, tick estimates, confidence intervals, and collinearity diagnostics"
      ],
      "report": "A multiple linear regression indicated that the model explained a significant proportion of variance in the outcome, R2 = value, F(df1, df2) = value, p = value. Predictor one was a significant predictor, B = value, beta = value, p = value.",
      "refs": [
        "Cohen, J., Cohen, P., West, S. G., and Aiken, L. S. (2003). Applied multiple regression/correlation analysis for the behavioral sciences (3rd ed.). Routledge."
      ]
    },
    "t_regression_logistic_binary": {
      "type": "result",
      "id": "t_regression_logistic_binary",
      "name": "Binary logistic regression",
      "surveyframe_id": "regression_logistic_binary",
      "example": "You predict whether a customer leaves (yes or no) from their age and monthly spend. Binary logistic regression reports how each one changes the odds of leaving.",
      "smallSample": "Rare events or perfect separation break ordinary logistic regression in small samples. Use Firth's penalised likelihood, and aim for at least 10 events per predictor.",
      "verdict": "Predicts a binary outcome from one or more predictors and reports effects as odds ratios.",
      "assumptions": [
        "The outcome has exactly two categories",
        "Observations are independent",
        "Each continuous predictor relates linearly to the log odds",
        "At least 10 events per predictor as a working minimum"
      ],
      "alternative": {
        "label": "Multinomial logistic regression, when the outcome has three or more unordered categories",
        "node": "t_regression_logistic_multinomial"
      },
      "r": "# analysis_plan_regression_logistic_binary.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# Add this entry to your instrument's analysis_plan list.\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Which predictors raise the odds of the outcome?\",\n  family            = \"prediction\",\n  method            = \"regression_logistic_binary\",\n  roles             = list(\n    predictors = c(\"pred1\", \"pred2\"),\n    dependent  = \"outcome_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# instr     <- sf_instrument(\"My study\", components = list(...),\n#                            analysis_plan = list(plan_entry))\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"regression_logistic_binary\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\nyn <- sf_choices(\"yn\", c(\"yes\", \"no\"), c(\"Yes\", \"No\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: Predictors and binary outcome ----\nsec_b <- sf_item(\"sec_b\", \"Section B: Predictors and binary outcome\", type = \"section_break\")\npred1_1 <- sf_item(\"pred1_1\", \"[Predictor 1 item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred1\")\npred1_2 <- sf_item(\"pred1_2\", \"[Predictor 1 item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred1\")\npred1_3 <- sf_item(\"pred1_3\", \"[Predictor 1 item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred1\")\npred1 <- sf_scale(\"pred1\", \"Predictor 1\", c(\"pred1_1\", \"pred1_2\", \"pred1_3\"), method = \"mean\")\npred2_1 <- sf_item(\"pred2_1\", \"[Predictor 2 item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred2\")\npred2_2 <- sf_item(\"pred2_2\", \"[Predictor 2 item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred2\")\npred2_3 <- sf_item(\"pred2_3\", \"[Predictor 2 item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred2\")\npred2 <- sf_scale(\"pred2\", \"Predictor 2\", c(\"pred2_1\", \"pred2_2\", \"pred2_3\"), method = \"mean\")\noutcome_var <- sf_item(\"outcome_var\", \"[binary outcome - replace]\", type = \"single_choice\", choice_set = \"yn\")\n\n# ---- Analysis plan (ids match the items and scales above) ----\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Which predictors raise the odds of the outcome?\",\n  family            = \"prediction\",\n  method            = \"regression_logistic_binary\",\n  roles             = list(\n    predictors = c(\"pred1\", \"pred2\"),\n    dependent  = \"outcome_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, pred1_1, pred1_2, pred1_3, pred1, pred2_1, pred2_2, pred2_3, pred2, outcome_var\n  ),\n  analysis_plan = list(plan_entry)\n)\n\n# Run it end to end once you have responses:\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "Predictors and binary outcome",
            "intro": "",
            "items": [
              {
                "label": "Predictor 1 — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor 1 — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor 1 — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor 2 — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor 2 — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor 2 — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "binary outcome",
                "type": "single_choice",
                "placeholder": true,
                "choices": [
                  "Yes",
                  "No"
                ]
              }
            ]
          }
        ]
      },
      "jasp": [
        "Regression, then Logistic Regression",
        "Move the binary outcome to Dependent Variable and the predictors to Covariates or Factors",
        "Under Statistics, tick odds ratios and their confidence intervals"
      ],
      "report": "A binary logistic regression indicated that the model was significant, X2(df) = value, p = value, Nagelkerke R2 = value. Predictor one significantly increased the odds of the outcome, OR = value, 95 per cent CI [value, value], p = value.",
      "refs": [
        "Hosmer, D. W., Lemeshow, S., and Sturdivant, R. X. (2013). Applied logistic regression (3rd ed.). Wiley."
      ]
    },
    "t_regression_logistic_multinomial": {
      "type": "result",
      "id": "t_regression_logistic_multinomial",
      "name": "Multinomial logistic regression",
      "surveyframe_id": "regression_logistic_multinomial",
      "example": "You predict which of three transport modes (car, bus, bike) a commuter chooses from their age and distance. Multinomial logistic regression compares each mode against a reference mode.",
      "smallSample": "Spreading a small sample across several outcome categories leaves sparse cells. Combine rare categories where it makes sense, or use a penalised estimator.",
      "verdict": "Predicts a nominal outcome with three or more unordered categories, comparing each category against a reference.",
      "assumptions": [
        "The outcome has three or more unordered categories",
        "Observations are independent",
        "Independence of irrelevant alternatives is plausible",
        "Adequate cases in every outcome category"
      ],
      "alternative": {
        "label": "Ordinal logistic regression, when the categories have a natural order",
        "node": "t_regression_logistic_ordinal"
      },
      "r": "# analysis_plan_regression_logistic_multinomial.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# Add this entry to your instrument's analysis_plan list.\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Which predictors distinguish the outcome categories?\",\n  family            = \"prediction\",\n  method            = \"regression_logistic_multinomial\",\n  roles             = list(\n    predictors = c(\"pred1\", \"pred2\"),\n    dependent  = \"outcome_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# instr     <- sf_instrument(\"My study\", components = list(...),\n#                            analysis_plan = list(plan_entry))\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"regression_logistic_multinomial\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\nout_cat <- sf_choices(\"out_cat\", 1:3, c(\"Outcome A\", \"Outcome B\", \"Outcome C\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: Predictors and nominal outcome ----\nsec_b <- sf_item(\"sec_b\", \"Section B: Predictors and nominal outcome\", type = \"section_break\")\npred1_1 <- sf_item(\"pred1_1\", \"[Predictor 1 item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred1\")\npred1_2 <- sf_item(\"pred1_2\", \"[Predictor 1 item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred1\")\npred1_3 <- sf_item(\"pred1_3\", \"[Predictor 1 item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred1\")\npred1 <- sf_scale(\"pred1\", \"Predictor 1\", c(\"pred1_1\", \"pred1_2\", \"pred1_3\"), method = \"mean\")\npred2_1 <- sf_item(\"pred2_1\", \"[Predictor 2 item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred2\")\npred2_2 <- sf_item(\"pred2_2\", \"[Predictor 2 item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred2\")\npred2_3 <- sf_item(\"pred2_3\", \"[Predictor 2 item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred2\")\npred2 <- sf_scale(\"pred2\", \"Predictor 2\", c(\"pred2_1\", \"pred2_2\", \"pred2_3\"), method = \"mean\")\noutcome_var <- sf_item(\"outcome_var\", \"[nominal outcome - replace]\", type = \"single_choice\", choice_set = \"out_cat\")\n\n# ---- Analysis plan (ids match the items and scales above) ----\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Which predictors distinguish the outcome categories?\",\n  family            = \"prediction\",\n  method            = \"regression_logistic_multinomial\",\n  roles             = list(\n    predictors = c(\"pred1\", \"pred2\"),\n    dependent  = \"outcome_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, pred1_1, pred1_2, pred1_3, pred1, pred2_1, pred2_2, pred2_3, pred2, outcome_var\n  ),\n  analysis_plan = list(plan_entry)\n)\n\n# Run it end to end once you have responses:\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "Predictors and nominal outcome",
            "intro": "",
            "items": [
              {
                "label": "Predictor 1 — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor 1 — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor 1 — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor 2 — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor 2 — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor 2 — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "nominal outcome",
                "type": "single_choice",
                "placeholder": true,
                "choices": [
                  "Outcome A",
                  "Outcome B",
                  "Outcome C"
                ]
              }
            ]
          }
        ]
      },
      "jasp": [
        "Regression, then Logistic Regression",
        "Set the nominal outcome as Dependent Variable; JASP fits the multinomial model when the outcome has more than two levels",
        "Inspect the coefficients for each category against the reference"
      ],
      "report": "A multinomial logistic regression indicated that the model was significant, X2(df) = value, p = value. Relative to the reference category, predictor one significantly increased the odds of membership in category B, OR = value, p = value.",
      "refs": [
        "Hosmer, D. W., Lemeshow, S., and Sturdivant, R. X. (2013). Applied logistic regression (3rd ed.). Wiley."
      ]
    },
    "t_regression_logistic_ordinal": {
      "type": "result",
      "id": "t_regression_logistic_ordinal",
      "name": "Ordinal logistic regression",
      "surveyframe_id": "regression_logistic_ordinal",
      "example": "You predict a single satisfaction rating (low, medium, high) from price and service. Ordinal logistic regression uses the natural order of the ratings to model the odds of a higher level.",
      "smallSample": "Using the order of the categories is more efficient than treating them as unordered, which helps small samples. Check the proportional odds assumption, and consider a penalised fit when categories are sparse.",
      "verdict": "Predicts an ordered categorical outcome, such as a single Likert rating, from one or more predictors.",
      "assumptions": [
        "The outcome categories have a natural order",
        "Observations are independent",
        "Proportional odds: each predictor's effect is constant across the category thresholds"
      ],
      "alternative": {
        "label": "Multinomial logistic regression, when proportional odds fails",
        "node": "t_regression_logistic_multinomial"
      },
      "r": "# analysis_plan_regression_logistic_ordinal.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# Add this entry to your instrument's analysis_plan list.\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Which predictors raise the odds of a higher outcome category?\",\n  family            = \"prediction\",\n  method            = \"regression_logistic_ordinal\",\n  roles             = list(\n    predictors = c(\"pred1\", \"pred2\"),\n    dependent  = \"outcome_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# instr     <- sf_instrument(\"My study\", components = list(...),\n#                            analysis_plan = list(plan_entry))\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"regression_logistic_ordinal\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: Predictors and ordinal outcome ----\nsec_b <- sf_item(\"sec_b\", \"Section B: Predictors and ordinal outcome\", type = \"section_break\")\npred1_1 <- sf_item(\"pred1_1\", \"[Predictor 1 item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred1\")\npred1_2 <- sf_item(\"pred1_2\", \"[Predictor 1 item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred1\")\npred1_3 <- sf_item(\"pred1_3\", \"[Predictor 1 item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred1\")\npred1 <- sf_scale(\"pred1\", \"Predictor 1\", c(\"pred1_1\", \"pred1_2\", \"pred1_3\"), method = \"mean\")\npred2_1 <- sf_item(\"pred2_1\", \"[Predictor 2 item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred2\")\npred2_2 <- sf_item(\"pred2_2\", \"[Predictor 2 item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred2\")\npred2_3 <- sf_item(\"pred2_3\", \"[Predictor 2 item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"pred2\")\npred2 <- sf_scale(\"pred2\", \"Predictor 2\", c(\"pred2_1\", \"pred2_2\", \"pred2_3\"), method = \"mean\")\noutcome_var <- sf_item(\"outcome_var\", \"[ordinal outcome rating - replace]\", type = \"likert\", choice_set = \"agree5\")\n\n# ---- Analysis plan (ids match the items and scales above) ----\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Which predictors raise the odds of a higher outcome category?\",\n  family            = \"prediction\",\n  method            = \"regression_logistic_ordinal\",\n  roles             = list(\n    predictors = c(\"pred1\", \"pred2\"),\n    dependent  = \"outcome_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, pred1_1, pred1_2, pred1_3, pred1, pred2_1, pred2_2, pred2_3, pred2, outcome_var\n  ),\n  analysis_plan = list(plan_entry)\n)\n\n# Run it end to end once you have responses:\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "Predictors and ordinal outcome",
            "intro": "",
            "items": [
              {
                "label": "Predictor 1 — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor 1 — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor 1 — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor 2 — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor 2 — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor 2 — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "ordinal outcome rating",
                "type": "likert",
                "placeholder": true,
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ]
              }
            ]
          }
        ]
      },
      "jasp": [
        "Regression, then Logistic Regression with an ordinal dependent variable",
        "Move the ordinal outcome to Dependent Variable and the predictors to Covariates",
        "Check the proportional odds assumption before interpreting"
      ],
      "report": "An ordinal logistic regression indicated that predictor one significantly increased the odds of a higher outcome category, OR = value, 95 per cent CI [value, value], p = value.",
      "refs": [
        "Hosmer, D. W., Lemeshow, S., and Sturdivant, R. X. (2013). Applied logistic regression (3rd ed.). Wiley."
      ]
    },
    "t_mediation": {
      "type": "result",
      "id": "t_mediation",
      "name": "Mediation analysis",
      "surveyframe_id": "mediation",
      "example": "A training course improves job performance. Mediation analysis asks whether it does so by first raising confidence, which then raises performance, rather than acting directly.",
      "smallSample": "Indirect effects rely on bootstrapping, and small samples need many resamples. Use at least 5000 bootstrap samples and report the bias-corrected confidence interval rather than the Sobel test.",
      "verdict": "Tests whether a predictor influences an outcome indirectly, through a mediating variable.",
      "assumptions": [
        "The causal order from predictor to mediator to outcome is justified by theory or design",
        "No unmeasured confounding of the mediator-outcome path",
        "The indirect effect is tested with bootstrapped confidence intervals, not the Sobel test alone"
      ],
      "alternative": {
        "label": "Moderation analysis, when the question is about a conditional effect rather than a pathway",
        "node": "t_moderation"
      },
      "r": "# analysis_plan_mediation.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# Add this entry to your instrument's analysis_plan list.\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Does the mediator carry the effect of the predictor on the outcome?\",\n  family            = \"prediction\",\n  method            = \"mediation\",\n  roles             = list(\n    predictor  = \"x_var\",\n    mediator   = \"m_var\",\n    outcome    = \"y_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# instr     <- sf_instrument(\"My study\", components = list(...),\n#                            analysis_plan = list(plan_entry))\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"mediation\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: Predictor construct ----\nsec_b <- sf_item(\"sec_b\", \"Section B: Predictor construct\", type = \"section_break\")\nx_var_1 <- sf_item(\"x_var_1\", \"[Predictor item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"x_var\")\nx_var_2 <- sf_item(\"x_var_2\", \"[Predictor item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"x_var\")\nx_var_3 <- sf_item(\"x_var_3\", \"[Predictor item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"x_var\")\nx_var <- sf_scale(\"x_var\", \"Predictor\", c(\"x_var_1\", \"x_var_2\", \"x_var_3\"), method = \"mean\")\n\n# ---- Section C: Mediator construct ----\nsec_c <- sf_item(\"sec_c\", \"Section C: Mediator construct\", type = \"section_break\")\nm_var_1 <- sf_item(\"m_var_1\", \"[Mediator item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"m_var\")\nm_var_2 <- sf_item(\"m_var_2\", \"[Mediator item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"m_var\")\nm_var_3 <- sf_item(\"m_var_3\", \"[Mediator item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"m_var\")\nm_var <- sf_scale(\"m_var\", \"Mediator\", c(\"m_var_1\", \"m_var_2\", \"m_var_3\"), method = \"mean\")\n\n# ---- Section D: Outcome construct ----\nsec_d <- sf_item(\"sec_d\", \"Section D: Outcome construct\", type = \"section_break\")\ny_var_1 <- sf_item(\"y_var_1\", \"[Outcome item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"y_var\")\ny_var_2 <- sf_item(\"y_var_2\", \"[Outcome item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"y_var\")\ny_var_3 <- sf_item(\"y_var_3\", \"[Outcome item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"y_var\")\ny_var <- sf_scale(\"y_var\", \"Outcome\", c(\"y_var_1\", \"y_var_2\", \"y_var_3\"), method = \"mean\")\n\n# ---- Analysis plan (ids match the items and scales above) ----\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Does the mediator carry the effect of the predictor on the outcome?\",\n  family            = \"prediction\",\n  method            = \"mediation\",\n  roles             = list(\n    predictor  = \"x_var\",\n    mediator   = \"m_var\",\n    outcome    = \"y_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, x_var_1, x_var_2, x_var_3, x_var, sec_c, m_var_1, m_var_2, m_var_3, m_var, sec_d, y_var_1, y_var_2, y_var_3, y_var\n  ),\n  analysis_plan = list(plan_entry)\n)\n\n# Run it end to end once you have responses:\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "Predictor construct",
            "intro": "",
            "items": [
              {
                "label": "Predictor — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          },
          {
            "letter": "C",
            "title": "Mediator construct",
            "intro": "",
            "items": [
              {
                "label": "Mediator — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Mediator — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Mediator — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          },
          {
            "letter": "D",
            "title": "Outcome construct",
            "intro": "",
            "items": [
              {
                "label": "Outcome — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          }
        ]
      },
      "jasp": [
        "SEM, then Mediation Analysis",
        "Assign Predictor, Mediator, and Outcome",
        "Under Options, set bootstrap samples to 5000 and request percentile confidence intervals"
      ],
      "report": "Mediation analysis indicated a significant indirect effect of the predictor on the outcome through the mediator, ab = value, 95 per cent bootstrap CI [value, value], based on 5000 resamples.",
      "refs": [
        "MacKinnon, D. P. (2008). Introduction to statistical mediation analysis. Routledge."
      ]
    },
    "t_moderation": {
      "type": "result",
      "id": "t_moderation",
      "name": "Moderation analysis",
      "surveyframe_id": "moderation",
      "example": "A discount boosts sales, but perhaps more for new customers than loyal ones. Moderation analysis asks whether the effect of the discount depends on customer type.",
      "smallSample": "Interactions are data-hungry and underpowered in small samples. Mean-centre the terms, probe simple slopes, and treat a non-significant interaction cautiously rather than as proof of none.",
      "verdict": "Tests whether the effect of a predictor on an outcome changes depending on the level of a moderator.",
      "assumptions": [
        "Standard linear regression assumptions apply to the model with the interaction term",
        "Predictor and moderator are mean-centred before forming the product term",
        "A significant interaction is probed with simple slopes"
      ],
      "alternative": {
        "label": "Mediation analysis, when the question is about a pathway rather than a conditional effect",
        "node": "t_mediation"
      },
      "r": "# analysis_plan_moderation.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# Add this entry to your instrument's analysis_plan list.\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Does the moderator change the effect of the predictor on the outcome?\",\n  family            = \"prediction\",\n  method            = \"moderation\",\n  roles             = list(\n    predictor  = \"x_var\",\n    moderator  = \"w_var\",\n    outcome    = \"y_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# instr     <- sf_instrument(\"My study\", components = list(...),\n#                            analysis_plan = list(plan_entry))\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"moderation\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: Predictor construct ----\nsec_b <- sf_item(\"sec_b\", \"Section B: Predictor construct\", type = \"section_break\")\nx_var_1 <- sf_item(\"x_var_1\", \"[Predictor item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"x_var\")\nx_var_2 <- sf_item(\"x_var_2\", \"[Predictor item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"x_var\")\nx_var_3 <- sf_item(\"x_var_3\", \"[Predictor item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"x_var\")\nx_var <- sf_scale(\"x_var\", \"Predictor\", c(\"x_var_1\", \"x_var_2\", \"x_var_3\"), method = \"mean\")\n\n# ---- Section C: Moderator construct ----\nsec_c <- sf_item(\"sec_c\", \"Section C: Moderator construct\", type = \"section_break\")\nw_var_1 <- sf_item(\"w_var_1\", \"[Moderator item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"w_var\")\nw_var_2 <- sf_item(\"w_var_2\", \"[Moderator item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"w_var\")\nw_var_3 <- sf_item(\"w_var_3\", \"[Moderator item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"w_var\")\nw_var <- sf_scale(\"w_var\", \"Moderator\", c(\"w_var_1\", \"w_var_2\", \"w_var_3\"), method = \"mean\")\n\n# ---- Section D: Outcome construct ----\nsec_d <- sf_item(\"sec_d\", \"Section D: Outcome construct\", type = \"section_break\")\ny_var_1 <- sf_item(\"y_var_1\", \"[Outcome item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"y_var\")\ny_var_2 <- sf_item(\"y_var_2\", \"[Outcome item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"y_var\")\ny_var_3 <- sf_item(\"y_var_3\", \"[Outcome item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"y_var\")\ny_var <- sf_scale(\"y_var\", \"Outcome\", c(\"y_var_1\", \"y_var_2\", \"y_var_3\"), method = \"mean\")\n\n# ---- Analysis plan (ids match the items and scales above) ----\nplan_entry <- list(\n  id                = \"RQ1\",\n  research_question = \"Does the moderator change the effect of the predictor on the outcome?\",\n  family            = \"prediction\",\n  method            = \"moderation\",\n  roles             = list(\n    predictor  = \"x_var\",\n    moderator  = \"w_var\",\n    outcome    = \"y_var\"\n  ),\n  options           = list(alpha = 0.05)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, x_var_1, x_var_2, x_var_3, x_var, sec_c, w_var_1, w_var_2, w_var_3, w_var, sec_d, y_var_1, y_var_2, y_var_3, y_var\n  ),\n  analysis_plan = list(plan_entry)\n)\n\n# Run it end to end once you have responses:\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\n# scored    <- score_scales(responses, instr)\n# results   <- run_analysis_plan(scored, instr)\n# render_results(results, instr, output_file = \"results.html\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "Predictor construct",
            "intro": "",
            "items": [
              {
                "label": "Predictor — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          },
          {
            "letter": "C",
            "title": "Moderator construct",
            "intro": "",
            "items": [
              {
                "label": "Moderator — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Moderator — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Moderator — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          },
          {
            "letter": "D",
            "title": "Outcome construct",
            "intro": "",
            "items": [
              {
                "label": "Outcome — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          }
        ]
      },
      "jasp": [
        "Regression, then Linear Regression",
        "Enter the centred predictor, the centred moderator, and their product term as covariates",
        "Probe a significant interaction with simple slopes at low, mean, and high moderator levels"
      ],
      "report": "Moderation analysis indicated a significant interaction between the predictor and the moderator, B = value, p = value. Simple slopes showed the effect was significant at high moderator levels (B = value, p = value) but not at low levels (B = value, p = value).",
      "refs": [
        "Aiken, L. S., and West, S. G. (1991). Multiple regression: Testing and interpreting interactions. Sage."
      ]
    },
    "t_reliability_alpha": {
      "type": "result",
      "id": "t_reliability_alpha",
      "name": "Cronbach's alpha",
      "surveyframe_id": "reliability_alpha",
      "example": "A questionnaire uses five questions to measure job satisfaction. Cronbach's alpha checks whether the five questions hang together and measure the same underlying idea.",
      "smallSample": "Alpha is unstable for short scales and few respondents. Report its confidence interval, and inspect the item-rest correlations rather than chasing a single threshold.",
      "verdict": "Estimates the internal consistency of a multi-item scale under the assumption that items contribute equally.",
      "assumptions": [
        "Items measure a single construct",
        "Items are tau-equivalent: loadings are roughly equal",
        "Errors are uncorrelated across items"
      ],
      "alternative": {
        "label": "McDonald's omega, the safer default when item loadings differ",
        "node": "t_reliability_omega"
      },
      "r": "# reliability_alpha.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\nlibrary(surveyframe)\n\n# instr holds your items grouped into scales with sf_scale().\n# resp is the response data loaded with read_responses().\nreliability_report(resp, instr, omega = FALSE)",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"reliability_alpha\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: The scale to assess ----\nsec_b <- sf_item(\"sec_b\", \"Section B: The scale to assess\", type = \"section_break\")\nscale_1_1 <- sf_item(\"scale_1_1\", \"[Construct item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"scale_1\")\nscale_1_2 <- sf_item(\"scale_1_2\", \"[Construct item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"scale_1\")\nscale_1_3 <- sf_item(\"scale_1_3\", \"[Construct item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"scale_1\")\nscale_1_4 <- sf_item(\"scale_1_4\", \"[Construct item 4 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"scale_1\")\nscale_1_5 <- sf_item(\"scale_1_5\", \"[Construct item 5 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"scale_1\")\nscale_1 <- sf_scale(\"scale_1\", \"Construct\", c(\"scale_1_1\", \"scale_1_2\", \"scale_1_3\", \"scale_1_4\", \"scale_1_5\"), method = \"mean\")\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, scale_1_1, scale_1_2, scale_1_3, scale_1_4, scale_1_5, scale_1\n  )\n)\n\n# Internal consistency (read responses first):\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\nreliability_report(responses, instr, omega = FALSE)",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "The scale to assess",
            "intro": "",
            "items": [
              {
                "label": "Construct — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Construct — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Construct — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Construct — item 4",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Construct — item 5",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          }
        ]
      },
      "jasp": [
        "Reliability, then Unidimensional Reliability",
        "Move the scale items into the Variables box",
        "Under Scale Statistics, tick Cronbach's alpha; inspect the item-rest correlations"
      ],
      "report": "The scale showed acceptable internal consistency, Cronbach's alpha = value, 95 per cent CI [value, value].",
      "refs": [
        "Cronbach, L. J. (1951). Coefficient alpha and the internal structure of tests. Psychometrika, 16(3), 297 to 334."
      ]
    },
    "t_reliability_omega": {
      "type": "result",
      "id": "t_reliability_omega",
      "name": "McDonald's omega",
      "surveyframe_id": "reliability_omega",
      "example": "The same five satisfaction questions vary in how strongly each reflects the idea. McDonald's omega estimates the scale's consistency without assuming every question counts equally.",
      "smallSample": "Omega is the safer estimate for short scales, but it needs enough cases for a stable factor model. Report its confidence interval and read it alongside alpha.",
      "verdict": "Estimates internal consistency from a factor model, allowing item loadings to differ, the recommended default.",
      "assumptions": [
        "Items measure a single construct",
        "A congeneric factor model fits the items",
        "Sample size supports stable loading estimates"
      ],
      "alternative": {
        "label": "Cronbach's alpha, when tau-equivalence is defensible or required for comparison with prior studies",
        "node": "t_reliability_alpha"
      },
      "r": "# reliability_omega.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\nlibrary(surveyframe)\n\n# instr holds your items grouped into scales with sf_scale().\n# resp is the response data loaded with read_responses().\nreliability_report(resp, instr, omega = TRUE)",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"reliability_omega\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: The scale to assess ----\nsec_b <- sf_item(\"sec_b\", \"Section B: The scale to assess\", type = \"section_break\")\nscale_1_1 <- sf_item(\"scale_1_1\", \"[Construct item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"scale_1\")\nscale_1_2 <- sf_item(\"scale_1_2\", \"[Construct item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"scale_1\")\nscale_1_3 <- sf_item(\"scale_1_3\", \"[Construct item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"scale_1\")\nscale_1_4 <- sf_item(\"scale_1_4\", \"[Construct item 4 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"scale_1\")\nscale_1_5 <- sf_item(\"scale_1_5\", \"[Construct item 5 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"scale_1\")\nscale_1 <- sf_scale(\"scale_1\", \"Construct\", c(\"scale_1_1\", \"scale_1_2\", \"scale_1_3\", \"scale_1_4\", \"scale_1_5\"), method = \"mean\")\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, scale_1_1, scale_1_2, scale_1_3, scale_1_4, scale_1_5, scale_1\n  )\n)\n\n# Internal consistency (read responses first):\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\nreliability_report(responses, instr, omega = TRUE)",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "The scale to assess",
            "intro": "",
            "items": [
              {
                "label": "Construct — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Construct — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Construct — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Construct — item 4",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Construct — item 5",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          }
        ]
      },
      "jasp": [
        "Reliability, then Unidimensional Reliability",
        "Move the scale items into the Variables box",
        "Under Scale Statistics, tick McDonald's omega"
      ],
      "report": "The scale showed good internal consistency, McDonald's omega = value, 95 per cent CI [value, value].",
      "refs": [
        "McDonald, R. P. (1999). Test theory: A unified treatment. Lawrence Erlbaum."
      ]
    },
    "t_efa": {
      "type": "result",
      "id": "t_efa",
      "name": "Exploratory factor analysis",
      "surveyframe_id": "efa_solution",
      "example": "You have twenty attitude questions and do not yet know how they group. Exploratory factor analysis looks for a smaller set of hidden themes that explain the answers.",
      "smallSample": "Factor analysis needs many cases per item, so it is fragile in small samples. Use parallel analysis to decide the number of factors, and treat a small-sample solution as exploratory only.",
      "verdict": "Uncovers the latent factor structure of a set of items when the structure is not specified in advance.",
      "assumptions": [
        "Items are continuous or treated as ordinal with an appropriate correlation matrix",
        "Sampling adequacy is acceptable (KMO above .60) and Bartlett's test is significant",
        "Sample size is adequate, commonly 5 to 10 cases per item"
      ],
      "alternative": {
        "label": "Confirmatory factor analysis, when theory specifies the structure in advance",
        "node": "t_cfa"
      },
      "r": "# efa_analysis.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\nlibrary(surveyframe)\n\n# Check readiness first (KMO, Bartlett), then extract the solution.\nefa_report(resp, instr)\nefa_solution(resp, instr)",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"efa_solution\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: The item pool to explore ----\nsec_b <- sf_item(\"sec_b\", \"Section B: The item pool to explore\", type = \"section_break\")\nscale_1_1 <- sf_item(\"scale_1_1\", \"[Item pool item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"scale_1\")\nscale_1_2 <- sf_item(\"scale_1_2\", \"[Item pool item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"scale_1\")\nscale_1_3 <- sf_item(\"scale_1_3\", \"[Item pool item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"scale_1\")\nscale_1_4 <- sf_item(\"scale_1_4\", \"[Item pool item 4 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"scale_1\")\nscale_1_5 <- sf_item(\"scale_1_5\", \"[Item pool item 5 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"scale_1\")\nscale_1_6 <- sf_item(\"scale_1_6\", \"[Item pool item 6 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"scale_1\")\nscale_1 <- sf_scale(\"scale_1\", \"Item pool\", c(\"scale_1_1\", \"scale_1_2\", \"scale_1_3\", \"scale_1_4\", \"scale_1_5\", \"scale_1_6\"), method = \"mean\")\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, scale_1_1, scale_1_2, scale_1_3, scale_1_4, scale_1_5, scale_1_6, scale_1\n  )\n)\n\n# Check readiness, then extract (read responses first):\n# responses <- read_responses(\"my_data.csv\", instr, strict = FALSE)\nefa_report(responses, instr)\nefa_solution(responses, instr)",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "The item pool to explore",
            "intro": "",
            "items": [
              {
                "label": "Item pool — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Item pool — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Item pool — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Item pool — item 4",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Item pool — item 5",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Item pool — item 6",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          }
        ]
      },
      "jasp": [
        "Factor, then Exploratory Factor Analysis",
        "Move the items into the Variables box",
        "Set extraction to parallel analysis and rotation to oblimin; inspect KMO and Bartlett under Assumption Checks"
      ],
      "report": "An exploratory factor analysis with oblimin rotation supported a two-factor solution explaining value per cent of the variance. Sampling adequacy was acceptable, KMO = value, and Bartlett's test was significant, X2(df) = value, p = value.",
      "refs": [
        "Fabrigar, L. R., Wegener, D. T., MacCallum, R. C., and Strahan, E. J. (1999). Evaluating the use of exploratory factor analysis in psychological research. Psychological Methods, 4(3), 272 to 299."
      ]
    },
    "t_cfa": {
      "type": "result",
      "id": "t_cfa",
      "name": "Confirmatory factor analysis",
      "surveyframe_id": "cfa",
      "example": "Theory says your twenty questions measure exactly four traits. Confirmatory factor analysis tests whether that four-trait structure actually fits the data.",
      "smallSample": "CFA usually needs 200 or more cases, so it is rarely appropriate for a small sample. Consider a shorter model or item parcels, and report any small-sample fit as tentative.",
      "verdict": "Tests whether a specified measurement model, with items assigned to constructs in advance, fits the data.",
      "assumptions": [
        "The factor structure is specified before seeing the data",
        "Items are continuous, or declared ordered for categorical estimation",
        "Sample size supports stable estimation, commonly 200 or more"
      ],
      "alternative": {
        "label": "Exploratory factor analysis, when the structure is unknown",
        "node": "t_efa"
      },
      "r": "# cfa_analysis.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\nlibrary(surveyframe)\n\n# The instrument's scales define the measurement model.\nsyntax <- cfa_lavaan_syntax(instr, ordered = TRUE)\ncat(syntax)\n\n# Fit the generated syntax with lavaan:\n# install.packages(\"lavaan\")\n# fit <- lavaan::cfa(syntax, data = scored, ordered = TRUE)\n# lavaan::summary(fit, fit.measures = TRUE, standardized = TRUE)",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"cfa\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: First construct ----\nsec_b <- sf_item(\"sec_b\", \"Section B: First construct\", type = \"section_break\")\nfactor_1_1 <- sf_item(\"factor_1_1\", \"[Factor 1 item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"factor_1\")\nfactor_1_2 <- sf_item(\"factor_1_2\", \"[Factor 1 item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"factor_1\")\nfactor_1_3 <- sf_item(\"factor_1_3\", \"[Factor 1 item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"factor_1\")\nfactor_1 <- sf_scale(\"factor_1\", \"Factor 1\", c(\"factor_1_1\", \"factor_1_2\", \"factor_1_3\"), method = \"mean\")\n\n# ---- Section C: Second construct ----\nsec_c <- sf_item(\"sec_c\", \"Section C: Second construct\", type = \"section_break\")\nfactor_2_1 <- sf_item(\"factor_2_1\", \"[Factor 2 item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"factor_2\")\nfactor_2_2 <- sf_item(\"factor_2_2\", \"[Factor 2 item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"factor_2\")\nfactor_2_3 <- sf_item(\"factor_2_3\", \"[Factor 2 item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"factor_2\")\nfactor_2 <- sf_scale(\"factor_2\", \"Factor 2\", c(\"factor_2_1\", \"factor_2_2\", \"factor_2_3\"), method = \"mean\")\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, factor_1_1, factor_1_2, factor_1_3, factor_1, sec_c, factor_2_1, factor_2_2, factor_2_3, factor_2\n  )\n)\n\n# Generate lavaan CFA syntax from the instrument's scales:\nsyntax <- cfa_lavaan_syntax(instr, ordered = TRUE)\ncat(syntax)\n\n# Fit with lavaan when ready:\n# install.packages(\"lavaan\")",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "First construct",
            "intro": "",
            "items": [
              {
                "label": "Factor 1 — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Factor 1 — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Factor 1 — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          },
          {
            "letter": "C",
            "title": "Second construct",
            "intro": "",
            "items": [
              {
                "label": "Factor 2 — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Factor 2 — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Factor 2 — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          }
        ]
      },
      "jasp": [
        "Factor, then Confirmatory Factor Analysis",
        "Define each factor and assign its items",
        "Report chi-square, CFI, TLI, RMSEA, and SRMR; inspect standardised loadings"
      ],
      "report": "The confirmatory factor analysis showed acceptable fit, X2(df) = value, p = value, CFI = value, TLI = value, RMSEA = value, 90 per cent CI [value, value], SRMR = value. All standardised loadings exceeded .60.",
      "refs": [
        "Kline, R. B. (2016). Principles and practice of structural equation modeling (4th ed.). Guilford Press."
      ]
    },
    "t_cb_sem": {
      "type": "result",
      "id": "t_cb_sem",
      "name": "Covariance-based SEM",
      "surveyframe_id": "cb_sem",
      "example": "A theory says service quality raises trust, which in turn raises loyalty. Covariance-based SEM tests this whole chain of relationships among the underlying ideas at once.",
      "smallSample": "Covariance-based SEM is demanding on sample size. With a small sample prefer PLS-SEM, or fit a simpler path model on observed scale scores.",
      "verdict": "Tests a full structural model among latent variables in the covariance-based tradition, suited to theory testing with larger samples.",
      "assumptions": [
        "The structural and measurement model is specified by theory in advance",
        "Multivariate normality, or a robust estimator such as MLR",
        "Sample size supports stable estimation, commonly 200 or more",
        "The model is identified"
      ],
      "alternative": {
        "label": "PLS-SEM, when the focus is prediction, constructs are composites, or the sample is small",
        "node": "t_pls_sem"
      },
      "r": "# cb_sem_analysis.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\nlibrary(surveyframe)\n\nmodel <- sf_model(\n  \"model_1\", \"Structural model\", type = \"cb_sem\",\n  constructs = list(\n    sf_construct(\"IV\", \"Predictor construct\", c(\"iv_1\", \"iv_2\", \"iv_3\")),\n    sf_construct(\"DV\", \"Outcome construct\", c(\"dv_1\", \"dv_2\", \"dv_3\"))\n  ),\n  paths = list(sf_path(\"IV\", \"DV\"))\n)\ninstr  <- add_model(instr, model)\nsyntax <- sem_lavaan_syntax(model, instr)\ncat(syntax)\n\n# Fit with lavaan:\n# fit <- lavaan::sem(syntax, data = scored)\n# lavaan::summary(fit, fit.measures = TRUE, standardized = TRUE)",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"cb_sem\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: Predictor construct (IV) ----\nsec_b <- sf_item(\"sec_b\", \"Section B: Predictor construct (IV)\", type = \"section_break\")\niv_1 <- sf_item(\"iv_1\", \"[Predictor item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"iv\")\niv_2 <- sf_item(\"iv_2\", \"[Predictor item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"iv\")\niv_3 <- sf_item(\"iv_3\", \"[Predictor item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"iv\")\niv <- sf_scale(\"iv\", \"Predictor\", c(\"iv_1\", \"iv_2\", \"iv_3\"), method = \"mean\")\n\n# ---- Section C: Outcome construct (DV) ----\nsec_c <- sf_item(\"sec_c\", \"Section C: Outcome construct (DV)\", type = \"section_break\")\ndv_1 <- sf_item(\"dv_1\", \"[Outcome item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"dv\")\ndv_2 <- sf_item(\"dv_2\", \"[Outcome item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"dv\")\ndv_3 <- sf_item(\"dv_3\", \"[Outcome item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"dv\")\ndv <- sf_scale(\"dv\", \"Outcome\", c(\"dv_1\", \"dv_2\", \"dv_3\"), method = \"mean\")\n\n# ---- Structural model ----\nsem_model <- sf_model(\n  \"model_1\", \"Structural model\", type = \"cb_sem\",\n  constructs = list(\n    sf_construct(\"IV\", \"Predictor construct\", c(\"iv_1\", \"iv_2\", \"iv_3\")),\n    sf_construct(\"DV\", \"Outcome construct\", c(\"dv_1\", \"dv_2\", \"dv_3\"))\n  ),\n  paths = list(sf_path(\"IV\", \"DV\"))\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, iv_1, iv_2, iv_3, iv, sec_c, dv_1, dv_2, dv_3, dv\n  ),\n  models        = list(sem_model)\n)\n\n# Generate the model syntax:\nsyntax <- sem_lavaan_syntax(sem_model, instr)\ncat(syntax)",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "Predictor construct (IV)",
            "intro": "",
            "items": [
              {
                "label": "Predictor — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          },
          {
            "letter": "C",
            "title": "Outcome construct (DV)",
            "intro": "",
            "items": [
              {
                "label": "Outcome — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          }
        ]
      },
      "jasp": [
        "SEM, then Structural Equation Modeling",
        "Paste or write the lavaan syntax generated by surveyframe",
        "Report fit indices and standardised path coefficients"
      ],
      "report": "The structural model showed acceptable fit, X2(df) = value, CFI = value, RMSEA = value, SRMR = value. The path from the predictor construct to the outcome construct was significant, beta = value, p = value.",
      "refs": [
        "Kline, R. B. (2016). Principles and practice of structural equation modeling (4th ed.). Guilford Press."
      ]
    },
    "t_pls_sem": {
      "type": "result",
      "id": "t_pls_sem",
      "name": "PLS-SEM",
      "surveyframe_id": "pls_sem",
      "example": "With a small sample and a focus on prediction, PLS-SEM estimates how brand image drives satisfaction and then loyalty, building each idea up from its survey items.",
      "smallSample": "PLS-SEM tolerates smaller samples, but the 10-times rule alone is not enough. Justify the size with a power analysis, and report bootstrap confidence intervals for every path.",
      "verdict": "Estimates a composite-based structural model, suited to prediction-oriented research, complex models, and smaller samples.",
      "assumptions": [
        "Constructs are modelled as composites of their indicators",
        "Sample size meets the minimum from a power analysis or the inverse square root method, not the 10-times rule alone",
        "Measurement quality is assessed before the structural model: loadings, composite reliability, AVE, and HTMT",
        "Paths are tested with bootstrapped confidence intervals, commonly 5000 resamples"
      ],
      "alternative": {
        "label": "Covariance-based SEM, for strict theory testing with larger samples",
        "node": "t_cb_sem"
      },
      "r": "# pls_sem_analysis.R\n# StatChooser export. Runs with the surveyframe package (Sharafuddin, 2026).\nlibrary(surveyframe)\n\npls_model <- sf_model(\n  \"pls_1\", \"Structural model\", type = \"pls_sem\",\n  constructs = list(\n    sf_construct(\"IV\", \"Predictor construct\", c(\"iv_1\", \"iv_2\", \"iv_3\"),\n                 mode = \"composite\"),\n    sf_construct(\"DV\", \"Outcome construct\", c(\"dv_1\", \"dv_2\", \"dv_3\"),\n                 mode = \"composite\")\n  ),\n  paths   = list(sf_path(\"IV\", \"DV\")),\n  options = list(bootstrap = 5000)\n)\nsyntax <- seminr_syntax(pls_model)\ncat(syntax)\n\n# Fit the generated syntax with seminr:\n# install.packages(\"seminr\")",
      "skeleton": "# survey_skeleton.R\n# StatChooser sample survey skeleton (surveyframe method = \"pls_sem\").\n# Section A is a standard demographic block. Section B, and C/D/E where present,\n# carry the measures the analysis plan needs. Replace every [bracketed] stem\n# with your own validated items before fielding the survey.\n# install.packages(\"surveyframe\")\nlibrary(surveyframe)\n\n# ---- Choice sets (define once, reuse) ----\nagree5 <- sf_choices(\"agree5\", 1:5,\n  c(\"Strongly disagree\", \"Disagree\", \"Neutral\", \"Agree\", \"Strongly agree\"))\ngender_cs <- sf_choices(\"gender_cs\",\n  c(\"woman\", \"man\", \"nonbinary\", \"selfdescribe\", \"na\"),\n  c(\"Woman\", \"Man\", \"Non-binary\", \"Prefer to self-describe\", \"Prefer not to say\"))\nedu_cs <- sf_choices(\"edu_cs\", 1:5,\n  c(\"Secondary or below\", \"Diploma\", \"Bachelor degree\", \"Master degree\", \"Doctorate\"))\nrole_cs <- sf_choices(\"role_cs\", 1:4,\n  c(\"Entry or junior\", \"Mid-level\", \"Senior or manager\", \"Executive or owner\"))\nindustry_cs <- sf_choices(\"industry_cs\", 1:5,\n  c(\"Manufacturing\", \"Retail or trade\", \"Services\", \"Public sector\", \"Other\"))\n\n# ---- Section A: Respondent profile ----\nsec_a <- sf_item(\"sec_a\", \"Section A: Respondent profile\", type = \"section_break\",\n  section_intro = \"A few background questions about you.\")\nage <- sf_item(\"age\", \"Your age in years\", type = \"numeric\")\ngender <- sf_item(\"gender\", \"Your gender\", type = \"single_choice\", choice_set = \"gender_cs\")\neducation <- sf_item(\"education\", \"Highest level of education completed\", type = \"single_choice\", choice_set = \"edu_cs\")\njob_role <- sf_item(\"job_role\", \"Your role or seniority\", type = \"single_choice\", choice_set = \"role_cs\")\nexperience <- sf_item(\"experience\", \"Years of experience\", type = \"numeric\")\nindustry <- sf_item(\"industry\", \"Your industry or sector\", type = \"single_choice\", choice_set = \"industry_cs\")\n\n# ---- Section B: Predictor construct (IV) ----\nsec_b <- sf_item(\"sec_b\", \"Section B: Predictor construct (IV)\", type = \"section_break\")\niv_1 <- sf_item(\"iv_1\", \"[Predictor item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"iv\")\niv_2 <- sf_item(\"iv_2\", \"[Predictor item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"iv\")\niv_3 <- sf_item(\"iv_3\", \"[Predictor item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"iv\")\niv <- sf_scale(\"iv\", \"Predictor\", c(\"iv_1\", \"iv_2\", \"iv_3\"), method = \"mean\")\n\n# ---- Section C: Outcome construct (DV) ----\nsec_c <- sf_item(\"sec_c\", \"Section C: Outcome construct (DV)\", type = \"section_break\")\ndv_1 <- sf_item(\"dv_1\", \"[Outcome item 1 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"dv\")\ndv_2 <- sf_item(\"dv_2\", \"[Outcome item 2 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"dv\")\ndv_3 <- sf_item(\"dv_3\", \"[Outcome item 3 - replace stem]\", type = \"likert\", choice_set = \"agree5\", scale_id = \"dv\")\ndv <- sf_scale(\"dv\", \"Outcome\", c(\"dv_1\", \"dv_2\", \"dv_3\"), method = \"mean\")\n\n# ---- Structural model ----\npls_model <- sf_model(\n  \"model_1\", \"Structural model\", type = \"pls_sem\",\n  constructs = list(\n    sf_construct(\"IV\", \"Predictor construct\", c(\"iv_1\", \"iv_2\", \"iv_3\"), mode = \"composite\"),\n    sf_construct(\"DV\", \"Outcome construct\", c(\"dv_1\", \"dv_2\", \"dv_3\"), mode = \"composite\")\n  ),\n  paths   = list(sf_path(\"IV\", \"DV\")),\n  options = list(bootstrap = 5000)\n)\n\n# ---- Assemble the instrument ----\ninstr <- sf_instrument(\n  title         = \"[Your study title]\",\n  description   = \"[Population and purpose]\",\n  components    = list(\n    sec_a, age, gender, education, job_role, experience, industry, sec_b, iv_1, iv_2, iv_3, iv, sec_c, dv_1, dv_2, dv_3, dv\n  ),\n  models        = list(pls_model)\n)\n\n# Generate the model syntax:\nsyntax <- seminr_syntax(pls_model)\ncat(syntax)",
      "survey": {
        "sections": [
          {
            "letter": "A",
            "title": "Respondent profile",
            "intro": "A few background questions about you.",
            "items": [
              {
                "label": "Your age in years",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your gender",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Woman",
                  "Man",
                  "Non-binary",
                  "Prefer to self-describe",
                  "Prefer not to say"
                ]
              },
              {
                "label": "Highest level of education completed",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Secondary or below",
                  "Diploma",
                  "Bachelor degree",
                  "Master degree",
                  "Doctorate"
                ]
              },
              {
                "label": "Your role or seniority",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Entry or junior",
                  "Mid-level",
                  "Senior or manager",
                  "Executive or owner"
                ]
              },
              {
                "label": "Years of experience",
                "type": "numeric",
                "placeholder": false
              },
              {
                "label": "Your industry or sector",
                "type": "single_choice",
                "placeholder": false,
                "choices": [
                  "Manufacturing",
                  "Retail or trade",
                  "Services",
                  "Public sector",
                  "Other"
                ]
              }
            ]
          },
          {
            "letter": "B",
            "title": "Predictor construct (IV)",
            "intro": "",
            "items": [
              {
                "label": "Predictor — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Predictor — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          },
          {
            "letter": "C",
            "title": "Outcome construct (DV)",
            "intro": "",
            "items": [
              {
                "label": "Outcome — item 1",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 2",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              },
              {
                "label": "Outcome — item 3",
                "type": "likert",
                "choices": [
                  "Strongly disagree",
                  "Disagree",
                  "Neutral",
                  "Agree",
                  "Strongly agree"
                ],
                "placeholder": true
              }
            ]
          }
        ]
      },
      "jasp": [
        "JASP does not estimate PLS-SEM; use R with seminr, or SmartPLS",
        "Assess the measurement model first: loadings above .708, composite reliability above .70, AVE above .50, HTMT below .85",
        "Then assess the structural model: path coefficients with 5000 bootstrap resamples, R2, and effect sizes"
      ],
      "report": "The PLS-SEM measurement model met all quality thresholds: loadings exceeded .708, composite reliability exceeded .70, and AVE exceeded .50. The structural path from the predictor construct to the outcome construct was significant, beta = value, t = value, p = value, based on 5000 bootstrap resamples.",
      "refs": [
        "Hair, J. F., Hult, G. T. M., Ringle, C. M., and Sarstedt, M. (2022). A primer on partial least squares structural equation modeling (PLS-SEM) (3rd ed.). Sage."
      ]
    },
    "t_reframe": {
      "type": "result",
      "id": "t_reframe",
      "name": "Reframe as a group comparison",
      "surveyframe_id": null,
      "example": "Asking whether average income differs across three regions is the same as asking whether region and income are related. Treat region as the groups and compare them.",
      "smallSample": "",
      "verdict": "A relationship between a categorical variable and a continuous variable is the same question as a difference between groups. Treat the categorical variable as the grouping factor and follow the comparison branch.",
      "assumptions": [
        "The categorical variable defines the groups",
        "The continuous variable is the outcome"
      ],
      "alternative": {
        "label": null,
        "node": null
      },
      "r": "# reframe_note.R\n# A categorical-continuous relationship is a group comparison.\n# Restart the chooser, select \"Compare groups or conditions\",\n# and answer for your design.",
      "skeleton": "",
      "survey": null,
      "jasp": [
        "Follow the comparison branch: T-Tests or ANOVA depending on the number of groups"
      ],
      "report": "",
      "refs": [],
      "restart": "q_cmp_scale"
    }
  }
}