Your pre-registration specifies a minimum age of 18 for inclusion. In SPSS, how do you filter to eligible respondents?
I used format_stat_line earlier to see the N per group — but filtering in SPSS means setting a filter condition and re-running every analysis. If I change the cutoff, I redo everything.
In Python, the eligibility rule is a boolean expression. age >= min_age evaluates to True or False — the same logical value that drives every if statement, every filter, every data quality check. Write it once as a function and it reruns on every wave:
age = 29.0
min_age = 18.0
eligible = age >= min_age # TrueWhy >= and not >? The pre-registration says "minimum age 18" — does that include exactly 18?
Great methodological question. >= means "greater than or equal to" — 18-year-olds are in. > means strictly older than 18 — 18-year-olds are out. Pre-registration language matters: "at least 18" means >=. The function encodes your inclusion criterion exactly:
def is_eligible(age: float, min_age: float) -> bool:
result = age >= min_age
print(f"Age {age:.2f} >= {min_age:.2f}: {result}")
return resultSo when the reviewer asks me to tighten the eligibility cutoff to 21, I change one argument in the function call. The analysis updates automatically.
Reviewer 2 is about to have a much worse day than you.
This is the first time I've felt like the analysis is actually reproducible. Not just "I saved the SPSS file" reproducible, but genuinely auditable.
That instinct is right. A boolean function is a falsifiable test — it either includes the respondent or it doesn't, and the logic is visible in code. Put the min_age in a constant at the top of your script and the pre-registration maps directly to your code.
A boolean is either True or False. Comparison operators produce booleans:
| Operator | Meaning | Example | Result |
|---|---|---|---|
>= | at least | 29.0 >= 18.0 | True |
> | strictly greater | 18.0 > 18.0 | False |
== | exactly equal | 18.0 == 18.0 | True |
!= | not equal | 18.0 != 18.0 | False |
The operator you choose encodes your inclusion criterion. >= matches "at least 18". > matches "older than 18". Document which you used in your methods section — it is a methodological choice, not a coding detail.
= vs === assigns. == compares. age = 18 sets the variable. age == 18 tests whether it equals 18.
Your pre-registration specifies a minimum age of 18 for inclusion. In SPSS, how do you filter to eligible respondents?
I used format_stat_line earlier to see the N per group — but filtering in SPSS means setting a filter condition and re-running every analysis. If I change the cutoff, I redo everything.
In Python, the eligibility rule is a boolean expression. age >= min_age evaluates to True or False — the same logical value that drives every if statement, every filter, every data quality check. Write it once as a function and it reruns on every wave:
age = 29.0
min_age = 18.0
eligible = age >= min_age # TrueWhy >= and not >? The pre-registration says "minimum age 18" — does that include exactly 18?
Great methodological question. >= means "greater than or equal to" — 18-year-olds are in. > means strictly older than 18 — 18-year-olds are out. Pre-registration language matters: "at least 18" means >=. The function encodes your inclusion criterion exactly:
def is_eligible(age: float, min_age: float) -> bool:
result = age >= min_age
print(f"Age {age:.2f} >= {min_age:.2f}: {result}")
return resultSo when the reviewer asks me to tighten the eligibility cutoff to 21, I change one argument in the function call. The analysis updates automatically.
Reviewer 2 is about to have a much worse day than you.
This is the first time I've felt like the analysis is actually reproducible. Not just "I saved the SPSS file" reproducible, but genuinely auditable.
That instinct is right. A boolean function is a falsifiable test — it either includes the respondent or it doesn't, and the logic is visible in code. Put the min_age in a constant at the top of your script and the pre-registration maps directly to your code.
A boolean is either True or False. Comparison operators produce booleans:
| Operator | Meaning | Example | Result |
|---|---|---|---|
>= | at least | 29.0 >= 18.0 | True |
> | strictly greater | 18.0 > 18.0 | False |
== | exactly equal | 18.0 == 18.0 | True |
!= | not equal | 18.0 != 18.0 | False |
The operator you choose encodes your inclusion criterion. >= matches "at least 18". > matches "older than 18". Document which you used in your methods section — it is a methodological choice, not a coding detail.
= vs === assigns. == compares. age = 18 sets the variable. age == 18 tests whether it equals 18.
Ravi's pre-registration specifies a minimum age of 18 for inclusion in the analysis. Write `is_eligible(age, min_age)` that returns `True` if the respondent's age meets or exceeds the pre-registered minimum, and `False` otherwise.
Tap each step for scaffolded hints.
No blank-editor panic.