Python for Psychological Inquiry
A Problem-Solving Approach to Programming
Assessment Framework
Assessment is continuous and process-oriented. The objective is not to test whether students can produce a correct output under examination conditions, but whether they have developed the habits of thinking that will serve them in research and practice. There is no final written examination.
| Component | Description | Weight | CO Mapped |
|---|---|---|---|
| Unit 1 — Function Library | Documented set of functions from Unit 1 | 10 marks | CO1CO2 |
| Unit 2 — Data Inspection Report | Pre-analysis report on an assigned dataset | 15 marks | CO2CO3 |
| Unit 3 — Annotated Analysis | Step-by-step commented inferential analysis | 25 marks | CO3CO4 |
A Note on Grading Code
When evaluating submitted scripts and notebooks, priority is given in the following order:
- Correctness of thinking: does the student's approach demonstrate understanding of what they are trying to compute and why?
- Clarity and documentation: can the reader follow the logic without running the code?
- Correctness of output: does the code produce the right answer?
- Elegance and efficiency: is the code concise without sacrificing clarity?
Resources and Tools
Software
- Python 3.10+ — freely available from python.org
- Anaconda distribution — recommended; includes Jupyter, pandas, numpy, matplotlib, scipy, and seaborn in a single installation
- Jupyter Notebooks — for literate programming sessions and submitted assessments
- Visual Studio Code with the Python extension — optional alternative for students comfortable with an IDE
Datasets
- Open Psychometrics (openpsychometrics.org) — freely available psychology survey datasets
- UCI Machine Learning Repository — well-documented datasets suitable for teaching
- Synthetic datasets generated by the instructor, drawn from realistic psychological measurement scenarios
Reference Reading
- Think Python, 2nd Ed. (Downey, 2015) — available free online; focused on computational thinking
- Python for Data Analysis (McKinney, 2022) — authoritative reference for pandas
- Telling Stories with Data (Alexander, 2023) — addresses reproducible research and ethical reporting
- How Charts Lie (Cairo, 2019) — essential reading for Section 4.2
Concurrent Course Coordination
The following topics are designed to appear in both courses within the same two-week window:
- Hypothesis testing framework — Unit 3, Sessions 3.1 and 3.2
- t-Tests (paired and independent) — Section 3.2
- Pearson's and Spearman's correlation — Section 3.3
- Introduction to regression — Section 3.5
- Chi-Square — Section 3.5
Instructor Notes
Managing the Transition from R
The most common early frustration is syntactic: "In R I just did this one thing, why is Python different?" The recommended response is not to say "Python is better" or "R is better" but to ask: "What problem were you solving in R, and how does Python ask you to solve it?" This orients students toward the underlying concept rather than the surface syntax.
Supporting Students Who Struggle with Abstraction
Functions — particularly the distinction between defining and calling, and between parameters and arguments — are a common sticking point. The best intervention is a concrete analogy: a recipe is a function definition; following the recipe for a specific set of ingredients is calling it. The recipe does not cook anything on its own.
Students who find abstraction difficult often excel at concrete activities. Extended practice with small functions that do one thing is more effective than explanation.
Handling the Concurrent Statistics Pressure
Students are simultaneously learning inferential statistics formally and encountering it computationally. There will be weeks when the statistics course is demanding and students arrive intellectually stretched. On those weeks, reduce the pace and privilege consolidation over progression. Sessions 3.3 (correlation) and 3.5 (regression and chi-square) are most suitable for slowing down.
Ethical Discussions
Several sessions include ethical touchpoints. These are not interruptions to the technical content — they are part of it. The goal is to make students uncomfortable with the idea that analysis can be ethically neutral. The instructor's role is to ask questions, not to provide correct answers.
Assessment Feedback
Feedback on submitted work should be specific about reasoning, not just output. "Your function returns the
correct mean" is less useful than "Your function correctly computes the sum and divides by length, but note
that len() returns an integer — in what situation could this cause a problem?" The latter teaches
students to anticipate edge cases, which is a core programming skill.