Gregory J. Depow

PhD Candidate in Social Psychology

Explore Data: Everyday Empathy and Response Surface Analysis

Response Surface Analysis

NOTE: Full model always plotted by default, model selection only working for the summary. Working on a fix. First plot shows which model performed best based on model weight. Choose the best performing model from the list (or another if you wish) and it will output that model summary.

Response surface analysis using the RSA package. In the shinyapp below, you can upload your own data and perform response surface analysis (RSA). Imagine two predictor variables and their range of values as a two-dimensional space. A given individual might land anywhere in that space. RSA allows us to estimate the value of an outcome variable of interest for all points in that space. The RSA package (https://cran.r-project.org/web/packages/RSA/RSA.pdf) by Felix Schönbrodt is doing the heavy-lifting here. What the shinyapp does is allow you to upload your data, choose two predictor variables and an outcome variable, and access aspects of the RSA package. When you click the Run RSA button, the app will use the RSA function to fit the default list of models (see model options for list), then use the aictab function to compare the models and display the winning model based on which is most probable given the data. It will also provide summary output for any model you select from the list. It currently plots the full model rather than the selected model, so you might look at the plot as the most complex model of the relationship between your variables given the data. However, if the aictab plot shows a model other than the full model, the relationship is likely better explained by the simpler model.

Some reading is needed to apply and interpret these models correctly, I am on this journey myself. I will supply some starting points below. The shiny app will input the median in place of missing values in your data, so you should ensure you have no missing values, your data is correctly structured, and your variables are appropriately-centred. Edwards & Parry advise centering such that 0 is the midpoint of the scale. *The shiny app will not display errors, so if you want to use RSA for research purposes, I recommend using and citing the RSA package directly in R–it is very user friendly. I will try to make the app more robust and possibly add features in the future. In the meantime, feel free to have some fun mapping out your variables in a 3D space.

#This code should let you implement the analysis from the shiny app in R. This will also afford you more flexibility in specifying different kinds of models and in customizing the plot. 

install.packages("RSA")
library(RSA)

setwd("path of folder you are working in") # set working directory 

data <- read.csv(file = "YourDataFile.csv") # Read in data 

model <- RSA(formula = DV ~ IV1 * IV2, data = data) # Run RSA, fitting a number of models. Swap out variable names for your variables of interest.

aictab(model, plot = TRUE) # compare fitted models to see which is most probable given the data (model weight)

plot(model, model = "model name") # use plot to get a 3d plot of your desired model (e.g. the winning model)

summary(model, model = "model name") # use summary to get the stats output

RSA Reading Starters:
https://osf.io/9vk3h/wiki/home/ (Collection of readings with supp. material from Schönbrodt)
https://pubmed.ncbi.nlm.nih.gov/33074694/ (Humberg et al., 2021 Cubic RSA and congruence)
https://onlinelibrary.wiley.com/doi/full/10.1002/per.2169 (Schönbrodt et al., 2021 dyadic RSA)
https://www.skiplab.org/response-surface-analysis (Two papers from Karlson SKIP lab about RSA)
https://doi.org/10.1080/00273171.2021.1884522 (Humberg and Grund, 2021 RSA with missing data)
http://public.kenan-flagler.unc.edu/faculty/edwardsj/EdwardsParry1993.pdf (Poly reg as alt to diff scores)
https://link.springer.com/chapter/10.1007/978-1-4612-4380-9_22 (Draper, 1992 intro to Box and Wilson)
https://www.jstor.org/stable/2983966 (seminal Box and Wilson, 1951)

Link to RSA shiny on it’s own: https://gregdepow.shinyapps.io/shiny6/

Explore Everyday Empathy Data

Note: All apps created using R shinyapps. Data presented here for descriptive purposes. This data is exploratory and correlational, meaning causation cannot be established and findings should be replicated with future research. We should be particularly cautious drawing conclusions about emotions with smaller samples. Data is at the observation level, meaning a single participant may have multiple reports in the figure, depending on how often they reported observing a specific emotion. See here for a description of data collection and further analysis: paper and here for the data.