tutorial

Learning Python as an R user

Below, I’ve embedded a Python Jupyter Notebook hosted on Kyso, which is a hub where you, “can publish Jupyter notebooks, charts, code, datasets and write articles in our custom markdown editor.” This is a work in progress while I teach myself Python (here is the original Kyso post, nmmichalak/python_selfteach).

Testing Conditional Indirect Effects/Mediation in R

This post builds on a previous post on Testing Indirect Effects/Mediation in R. What is mediation? There are many ways to define mediation and mediators. Here’s one way: Mediation is the process by which one variable transmits an effect onto another through one or more mediating variables. For example, as room temperature increases, people get thirstier, and then they drink more water. In this case, thirst transmits the effect of room temperature on water drinking.

Using Principal Components or Common Factor Analysis in Social Psychology

Multidimensional Scaling, the precursor to Principal Components Analysis, Common Factor Analysis, and related techniques Multidimensional scaling is an exploratory technique that uses distances or disimilarities between objects to create a multidimensional representation of those objects in metric space. In other words, multidimensional scaling uses data about the distance (e.g., miles between cities) or disimilarity (e.g., how (dis)similar are apples and tomatoes?) among a set of objects to “search” for some metric space that represents those objects and their relations to each other.

Learn R for Psychology Research: A Crash Course

Introduction I wrote this for psychologists who want to learn how to use R in their research right now. What does a psychologist need to know to use R to import, wrangle, plot, and model their data today? Here we go. Foundations: People and their resources that inspired me. Dan Robinson [.html] convinced me that beginneRs should learn tidyverse first, not Base R. This tutorial uses tidyverse.

Plotting Adjusted Associations in R

What is a correlation? A correlation quantifies the linear association between two variables. From one perspective, a correlation has two parts: one part quantifies the association, and the other part sets the scale of that association. The first part—the covariance, also the correlation numerator—equates to a sort of “average sum of squares” of two variables: \(cov_{(X, Y)} = \frac{\sum(X - \bar X)(Y - \bar Y)}{N - 1}\) It could be easier to interpret the covariance as an “average of the X-Y matches”: Deviations of X scores above the X mean multipled by deviations of Y scores below the Y mean will be negative, and deviations of X scores above the X mean multipled by deviations of Y scores above the Y mean will be positive.

Testing indirect effects/mediation in R

What is mediation? There are many ways to define mediation and mediators. Here’s one way: Mediation is the process by which one variable transmits an effect onto another through one or more mediating variables. For example, as room temperature increases, people get thirstier, and then they drink more water. In this case, thirst transmits the effect of room temperature on water drinking. What is an indirect effect?

Testing Within-Subjects Contrasts (Repeated Measures) in R

Within-Subjects Design In a within-subjects design, subjects give responses across multiple conditions or across time. In other words, measures are repeated across levels of some condition or across time points. For example, subjects can report how happy they feel when they see a sequence of positive pictures and another sequence of negative pictures. In this case, we’d observe each subjects’ happiness in both positive and negative conditions. As another example, we could measure subjects’ job satisifcation every month for 3 months.