Alexander (Sasha) Pastukhov
  • Home
  • Publications
  • Software
  • Teaching
  • Visual demonstrations

On this page

  • Lectures and seminars
    • Writing games with Python and PsychoPy
    • Data analysis using R for Psychology
    • Notes on Statistics
    • R-version of the code for “Linear Algebra: Theory, Intuition, Code” by Mike X Cohen
  • Workshops
    • You should write an R package. It is easier than you think, and I’ll show you how.
    • You should program your statistical models in Stan. It is easier than you think, and I’ll show you how.

Teaching

Currently, I teach courses on Bayesian statistics, consciousness, perception, data science using R, and programming using Python. Below are links to the teaching material that I use in my courses.


Lectures and seminars

Writing games with Python and PsychoPy

A two-semester introductory course on programming and Python aimed at undergraduate psychology students. The aim is to learn how to program psychological experiments using Python and PsychoPy by writing computer games (because experiments are simply boring computer games). The course assumes no prior knowledge or programming skills. The first semester covers basics including conditional statements, lists, dictionaries and use of PsychoPy. The second semester covers topics such as classes, generators, etc. You will program classic games such as “Guess the Number”, “Whack-a-Mole”, “Memory”, “Snake”, “Life”, “Guitar Hero”, etc.

Read the material

Data analysis using R for Psychology

An introductory course on how to use R to analyze a typical psychophysical and social psychology research data. The course will walk you through all the analysis stages from importing a raw data to compiling a nice looking final report that automatically incorporates all the figures and statistics. Although I will introduce base, the main focus is on using Tidyverse family of packages that make data wrangling easy.

Read the material

Notes on Statistics

Currently, a haphazard collection of notes on statistics. The primaryaim is to clarify or expand on topics mentioned but not fully explained in the “Statistical Rethinking” book by Richard McElreath but also now include topics from frequentist statistics. The topics include detailed explanation of information criteria, loss functions, (hidden) collider bias, DAGs, multicolliniarity, etc.

Read the material

R-version of the code for “Linear Algebra: Theory, Intuition, Code” by Mike X Cohen

An R-version that tries to keep the code as close to the original as possible.

Read the material

Book cover images were generated using MAI-Image-2e.


Workshops

You should write an R package. It is easier than you think, and I’ll show you how.

In our research, we generate innovative and useful analysis methods. Yet, reusing these methods across projects or sharing them as plain R scripts or notebooks can often be challenging or awkward. Packaging your code as an open-source library available at Github and CRAN not only facilitates reuse in new projects but also simplifies collaboration by ensuring your tools are accessible to the broader scientific community.The task may initially seem daunting, and you might feel that package-writing is best left to trained programmers. However, R and RStudio offer an excellent suite of tools that make transforming your code into a well-functioning, well-documented, and easy-to-install package surprisingly straightforward (or, at least, easier than you might think). Moreover, converting your code into a package – especially one that meets CRAN standards – encourages you to address aspects that might not be part of your usual workflow. This process will push you to write clear documentation complete with practical examples, prepare illustrative datasets, and test your code not only to confirm that it works but also to ensure it fails gracefully when expected.This workshop aims to provide a comprehensive overview of the entire package creation process. We will cover everything from creating an empty project and adding functions or classes to writing comprehensive documentation and practical examples (since poorly structured documentation is often the primary barrier to using your methods), as well as including and documenting example data, creating vignettes, and testing your package. Additionally, you will learn how to make your package installable from GitHub, publish documentation via GitPages, prepare it for CRAN submission, and ensure that your package is properly cited. I will introduce you to the tools R and RStudio provide for each step and how to automate tasks to streamline package creation. Together, we will build a simple yet feature-complete library that you can use as a stepping stone for your future packages.

Read the material

You should program your statistical models in Stan. It is easier than you think, and I’ll show you how.

In our research, we constantly rely on statistical models. Multiple R and Python packages provide models of various complexity from a basic t-test to generalized linear mixed models. However, they are limited in their design structure and flexibility of models that you can use. In this workshop, I will introduce an alternative approach of programming a statistical model from scratch using Stan probabilistic programming language. I will introduce syntax and walk you through an example of programming a basic two-group/condition comparison (a.k.a. a t-test), showing how it can be extended to allow for different distribution families, regularization. Next, I will show how Stan simplifies working with interactions using a two-way ANOVA. Finally, I will explain the underlying mechanisms of the MCMC engine, its limitations, how to diagnose the problems and ways to side-step them. This workshop is aimed at a broad audience and requires basic knowledge of statistics and programming (either R or Python). Its aim is to introduce a flexible method that allows to program virtually any statistical model that you are interested in.
Read the material

 
  • Datenschutzerklärung