| Variable | Contrast | True | direct | total | Crude | Adjusted (all) | Adjusted (DAG) | Estimate |
|---|---|---|---|---|---|---|---|---|
| age | per 1 years | OR | 1.05 | 1.07 | 1.06 | 1.05 | 1.07 | OR |
| bmi | per 5 kg/m2 | OR | 1.69 | 1.69 | 1.65 | 1.69 | 1.69 | OR |
| pedigree | per 0.5 | OR | 1.94 | 1.94 | 2.01 | 1.93 | 1.93 | OR |
| pregnancies | per 1 | OR | 1.09 | 1.09 | 1.17 | 1.09 | 1.09 | OR |
| diastolic | per 1 mmHg | OR | 1.00 | 1.00 | 1.03 | 1.00 | 1.00 | OR |
| triceps | per 1 mm | OR | 1.00 | 1.00 | 1.04 | 1.00 | 1.00 | OR |
Analysing the data in jamovi
Each design calls for its own analysis, and not all of them are in base jamovi. The table says which analysis fits each design and where to find it: in base jamovi, in another module of the jamovi library (Modules ▸ jamovi library), or in one of the author’s modules (jamovi-modules-vm). Below it, one worked exercise per design: the scenario, what to do in jamovi, and what the answer key says a correct analysis should find. The Epidemiology guide explains each design, its strengths and limitations, and how to read its parameters; Causal diagrams explains how to choose what to adjust for.
Design, analysis and module
| design | layout of the data | analysis | in jamovi |
|---|---|---|---|
| Cross-sectional | one row per person | logistic (binary), linear (continuous), Poisson (count) regression | Regression ▸ Logistic Regression ▸ 2 Outcomes, Linear Regression; Poisson: GAMLj Generalized Linear Models |
| Cohort (event) | time, status 0/1 (2 = competing event) | Kaplan-Meier, Cox regression | prognosis Prognosis ▸ Kaplan-Meier, Cox Regression |
| Case-control | case/control | logistic regression; odds ratio of a 2×2 table | Regression ▸ Logistic Regression ▸ 2 Outcomes; Frequencies ▸ Independent Samples (odds ratio) |
| Matched case-control | set = matched set |
conditional logistic regression | condLogReg Regression ▸ Logistic Regression ▸ Conditional (Matched), matching variable set |
| Nested case-control | set = risk set |
conditional logistic regression (it estimates the hazard ratio) | condLogReg, matching variable set |
| Case-cohort | subcohort yes/no, time, status | Cox regression with Prentice weights and robust variance | not in a jamovi module: the Rj editor with survival::cch() |
| Prognosis | time from entry, status | Kaplan-Meier, Cox; with a competing event, cause-specific Cox (status 2 censored) | prognosis; cumulative incidence of competing risks: Rj with cmprsk |
| Diagnostic accuracy | status, markers | ROC curve, AUC, sensitivity and specificity at a cut-off | meddecide (ClinicoPath) or psychoPDA Test ROC; at a cut-off: Compute a positive/negative column, then Frequencies ▸ Independent Samples |
| Method comparison | y_a, y_b |
Bland-Altman limits of agreement | blandr or SimplyAgree; or Compute the difference and the mean, then Descriptives and a scatterplot |
| Randomised trial | arm, outcome | risk difference, relative risk, NNT (binary); t-test or ANCOVA (continuous); Kaplan-Meier and Cox (event) | Frequencies ▸ Independent Samples; T-Tests, ANOVA ▸ ANCOVA; prognosis; interim looks: jmsequential |
| Cluster randomised trial | cluster |
mixed (multilevel) model with a random intercept per cluster | GAMLj Mixed Models (continuous), Generalized Mixed Models (binary, count) |
| 2×2 factorial trial | two arms | ANOVA or regression with both treatments and their interaction | ANOVA ▸ ANOVA; Regression ▸ Logistic Regression |
| 2×2 crossover | long: one row per period; wide: one per person | paired t-test (wide); mixed model with treatment and period (long) | T-Tests ▸ Paired Samples; GAMLj Mixed Models |
| Longitudinal trial | long: one row per visit; wide: one per person | linear mixed model with all visits (long); repeated-measures ANOVA on completers (wide) | GAMLj Mixed Models; ANOVA ▸ Repeated Measures ANOVA |
| Before-after | y_before, y |
paired t-test of the change | T-Tests ▸ Paired Samples |
| Ecological | one row per region | regression of the regional rate on regional means and percentages | Compute the rate (cases / people), then Regression ▸ Linear Regression |
Repeated measures (Design options) gives the crossover and longitudinal trials one row per person (wide), which jamovi’s paired t-test and repeated-measures ANOVA need; the default long layout is the one for mixed models.
Export codebook saves the data dictionary next to the CSV, since a CSV keeps no column descriptions.
Worked exercises
Each exercise uses the default seed (1) and the scenario’s default options. The tables are the answer key’s what this design should estimate: a correct analysis of a study of the size given should land near Adjusted, within its own confidence interval.
Cross-sectional: diabetes in Pima women
Diabetes in Pima women, cross-sectional, 700 women, all variables. Fit Regression ▸ Logistic Regression ▸ 2 Outcomes with diabetes as the outcome and the measured variables as covariates (Odds ratio under Model Coefficients). Then fit one variable at a time and compare each crude odds ratio with its adjusted one.
Cohort: coronary heart disease
Coronary heart disease, cohort of 3,000. In prognosis, Kaplan-Meier of time and chd by smoking, then Cox Regression with the measured variables. Leave out hdl (untick it under Variables) to see the hazard ratio for sex change: HDL is a mediator of sex, so the estimate moves towards the total effect, which is what the Adjusted (DAG) column estimates.
| Variable | Contrast | True | direct | total | Crude | Adjusted (all) | Adjusted (DAG) | Estimate |
|---|---|---|---|---|---|---|---|---|
| age | per 1 years | HR | 1.05 | 1.07 | 1.07 | 1.05 | 1.07 | HR |
| sex | male vs female | HR | 1.60 | 1.76 | 1.77 | 1.81 | 1.81 | HR |
| smoking | former vs never | HR | 1.20 | 1.21 | 1.21 | 1.21 | 1.21 | HR |
| smoking | current vs never | HR | 1.60 | 1.81 | 1.76 | 1.79 | 1.79 | HR |
| total_chol | per 1 mmol/L | HR | 1.20 | 1.20 | 1.31 | 1.20 | 1.20 | HR |
| bmi | per 1 kg/m2 | HR | 1.02 | 1.06 | 1.07 | 1.03 | 1.06 | HR |
| sbp | per 10 mmHg | HR | 1.18 | 1.18 | 1.34 | 1.17 | 1.17 | HR |
| diabetes | yes vs no | HR | 1.80 | 1.80 | 2.94 | 1.88 | 1.88 | HR |
Case-control and matched case-control: oesophageal cancer
Oesophageal cancer, case-control with the scenario’s 4 controls per case. Regression ▸ Logistic Regression ▸ 2 Outcomes with case as the outcome. Then Matched case-control (matched on age group) and condLogReg with set as the matching variable: the matching variable itself cannot be estimated, and an unconditional logistic regression of matched data is biased towards the null.
| Variable | Contrast | True | direct | Crude | Adjusted (all) | Estimate |
|---|---|---|---|---|---|---|
| age_group | 35-44 vs 25-34 | HR | 7.00 | NA | NA | OR |
| age_group | 45-54 vs 25-34 | HR | 40.00 | NA | NA | OR |
| age_group | 55-64 vs 25-34 | HR | 75.00 | NA | NA | OR |
| age_group | 65-74 vs 25-34 | HR | 130.00 | NA | NA | OR |
| age_group | 75+ vs 25-34 | HR | 125.00 | NA | NA | OR |
| alcohol | 40-79 vs 0-39 | HR | 4.20 | 4.70 | 4.33 | OR |
| alcohol | 80-119 vs 0-39 | HR | 7.30 | 8.30 | 7.26 | OR |
| alcohol | 120+ vs 0-39 | HR | 36.70 | 40.96 | 32.33 | OR |
| tobacco | 10-19 vs 0-9 | HR | 1.55 | 1.86 | 1.50 | OR |
| tobacco | 20-29 vs 0-9 | HR | 1.67 | 2.03 | 1.47 | OR |
| tobacco | 30+ vs 0-9 | HR | 5.16 | 7.42 | 4.69 | OR |
Nested case-control and case-cohort: Wilms tumour relapse
Relapse of Wilms tumour, nested case-control with 3 controls per case: condLogReg with set (the risk set) as matching variable gives hazard ratios, with no rare-disease assumption. The case-cohort version needs a weighted Cox model: in Rj, survival::cch(Surv(time, relapse) ~ histology + stage, data = data, subcoh = ~ subcohort == "yes", id = ~ id, cohort.size = …, method = "LinYing") (the cohort size is in the Study summary).
Prognosis with a competing event
Breast cancer prognosis, outcome Death from breast cancer, prognosis design. In prognosis, Cox Regression of time and the status: the status has a 2 for a death from other causes; treat it as censored to estimate the cause-specific hazard ratios of the key. 1 − Kaplan-Meier then overstates the cumulative incidence of the event.
Diagnostic accuracy: PSA
PSA and prostate cancer, diagnostic, 500 men. In meddecide or psychoPDA, the ROC curve of psa against prostate_cancer. The key gives the AUC and, at a cut-off, the sensitivity, specificity and predictive values; Compute psa > 5.63 and cross it with the disease (Frequencies ▸ Independent Samples) to check them by hand. Then set Test-negatives verified (%) to 20 (Biases): among the verified, sensitivity is far too high.
| Marker | Cut-off | True | Large study | |
|---|---|---|---|---|
| psa | 5.63 | sens | 0.630 | 0.632 |
| psa | 5.63 | spec | 0.636 | 0.638 |
| psa | 5.63 | ppv | 0.426 | 0.429 |
| psa | 5.63 | npv | 0.800 | 0.801 |
| free_psa | 19.40 | sens | 0.646 | 0.646 |
| free_psa | 19.40 | spec | 0.643 | 0.641 |
| free_psa | 19.40 | ppv | 0.437 | 0.436 |
| free_psa | 19.40 | npv | 0.809 | 0.808 |
Method comparison: two blood pressure devices
Blood pressure in US adults, method comparison of sbp. In blandr or SimplyAgree, the Bland-Altman analysis of sbp_a and sbp_b: the mean difference, the limits of agreement and the proportional bias (B grows faster than A).
Randomised trial: indomethacin and pancreatitis
Rectal indomethacin to prevent post-ERCP pancreatitis, randomised trial of 600. Frequencies ▸ Independent Samples with treatment and pancreatitis (Comparative measures: relative risk, difference in proportions); the number needed to treat is 1 / risk difference. The key’s trial table gives the true risks: note that the marginal odds ratio (what the 2×2 table estimates) is closer to 1 than the conditional one the data were generated with, with no confounding at all.
| Value | |
|---|---|
| Risk: placebo | 0.1700 |
| Risk: indomethacin | 0.0896 |
| Risk difference, indomethacin vs placebo | -0.0806 |
| Number needed to treat for one event fewer, indomethacin vs placebo | 12.4000 |
| Risk ratio, indomethacin vs placebo | 0.5260 |
| Odds ratio, marginal (population), indomethacin vs placebo | 0.4800 |
| Odds ratio, conditional (true model), indomethacin vs placebo | 0.4700 |
Cluster randomised trial: handwashing in Karachi
Handwashing and childhood pneumonia, cluster trial. In GAMLj Generalized Mixed Models, a Poisson model of pneumonia with soap as a fixed factor and cluster as the cluster variable. Ignoring the clusters (a plain Poisson regression) gives confidence intervals that are too narrow.
2×2 factorial: aspirin and beta-carotene
Aspirin and beta-carotene in male physicians, factorial. prognosis Cox Regression with both treatments; adding their interaction tests whether one changes the other’s effect.
Crossover: an antihypertensive
Antihypertensive drug, crossover of 30 people with Repeated measures: wide. T-Tests ▸ Paired Samples of sbp_placebo and sbp_amlodipine. With the long layout, GAMLj Mixed Models of sbp with drug and period as fixed factors and id as cluster gives the same estimate and the period effect.
| Variable | Contrast | True | direct | Crude | Adjusted (all) | Estimate |
|---|---|---|---|---|---|---|
| drug | amlodipine vs placebo | beta | -9 | -8.92 | -8.92 | beta |
Longitudinal trial: succimer for lead exposure
Succimer for lead-exposed children, longitudinal. Long layout: GAMLj Mixed Models of blood_lead with treatment, visit (as a factor) and their interaction, id as cluster. The key’s Crude is the naive comparison of the completers at the last visit, Adjusted the mixed model with every visit.
Before-after: metformin
Metformin vs placebo on HbA1c, before-after, enrolling only people above the 50th percentile. T-Tests ▸ Paired Samples of hba1c_before and hba1c: the mean change is larger than the true effect, because of regression to the mean.
Ecological: water hardness and mortality
Water hardness and mortality, ecological. Compute the death rate per 100,000 (death / population * 100000) and regress it on the region means and percentages (Regression ▸ Linear Regression); compare the regional slope with the true individual effect in the key: the gap is the ecological bias.
Simulating many studies
Compare designs with Replicate studies per design draws hundreds of studies of each design and reports, for each estimate, its mean, bias, spread (the standard error a study does not see), power and the coverage of its confidence intervals: chance and bias side by side.