PSYC 480 -- Dr. King Mediation Exercises This is it. We're going old school on mediation analysis after the terrible showing on the last graded exercise. You get two things: My lecture (the video) on which you have to take your own notes (no slides, no guided exercises, watch the video, take notes, ask questions if there is something you don't understand), and this list of recommended exercises, one of which will be the basis for the next graded exercise (first half of it anyway). Okay, I'll also post the mediation diagram. To get the mediate() function: > source("http://ww2.coastal.edu/kingw/psyc480/functions/mediate.R") The syntax is: mediate(x = , y = , m = ) If you want r.crit(): > source("http://ww2.coastal.edu/kingw/psyc480/functions/rcrit.R") The syntax is: r.crit(df = , alpha = ) 1) shyness.txt # shyness.txt # Elizabeth Ostop Psyc 497 Spring 2010 # SAD: score on Social Avoidance and Distress Scale (high=more distress) # Shyness: score on Cheek and Buss Shyness Scale (high=more shyness) # LOC: score on Rotter's Locus of Control Scale (high=external) # Age: in years # Sex: gender coded 0=Female, 1=Male > file = "http://ww2.coastal.edu/kingw/psyc480/data/shyness.txt" > shy = read.table(file=file, header=T) This is the problem I worked through in detail in the video. You should work through it again and make sure you can get the same result I got, which is the result on the diagram. The "theory" was that the effect of locus of control on shyness is completely mediated through social avoidance and distress. 2) loneliness.txt # loneliness.txt # These data are from a Psyc 497 project (Parris Claytor, Fall 2011). # The subjects were given three tests, one of embarrassability ("embarrass"), # one of sense of emotional isolation ("emotiso"), and one of sense of social # isolation ("socialiso"). One case was deleted (by me) because of missing # values on all variables. > file = "http://ww2.coastal.edu/kingw/psyc480/data/loneliness.txt" > lone = read.table(file=file, header=T) These are Parris Claytor's data, which we've worked with before. We know there is an interaction, but this problem is just too good to let that stand in our way, so ignore the interaction! The "theory" is that the effect of embarrassabilty on emotional isolation (i.e., loneliness) is completely mediated through social isolation. If you're easily embarrassed, you avoid social situations where that might happen, and as a result, you feel lonely. 3) aggression.txt # aggression.txt # Leigh Ann Waslien's Data, Psyc 497, Fall 1999. # Variables: # physag = score on a physical aggression scale # verbag = score on a verbal aggression scale # anger = score on an anger scale # hostil = score on a hostility scale > file = "http://ww2.coastal.edu/kingw/psyc480/data/aggression.txt" > aggr = read.table(file=file, header=T) These are Leigh Ann Waslien's 497 data, and there are a lot of things we can "theorize" about here. But first, the dataset is really too small for mediation analysis (and that was not Leigh Ann's goal), so we're going to treat this as a pilot study. For this analysis, set alpha = .075. If we find significant effects at that alpha level, then we have reason to proceed to the full study. (Anyone looking for a 497 project?:^) Here's my take on it. Hostility is a trait. I.e., there are hostile people and nonhostile people. Anger is a state that we all experience from time to time, but it passes. Anger can lead to either verbal aggression or physical aggression, or perhaps both. Questions to investigate. a) Is the effect of hostility on verbal aggression mediated through anger and, if so, is the mediation complete, or is there some direct effect of hostility on verbal aggression? (Do hostile people have to become angry before they start yelling?) b) Is the effect of hostility on physical aggression mediated through anger and, if so, is the mediation complete, or is there some direct effect of hostility on physical aggression? (Do hostile people have to become angry before they start throwing punches?) c) Is the effect of anger on physical aggression mediated through verbal aggression? I.e., do people yell first then throw punches, or are verbal aggression and physical aggression two separate pathways for the discharge of "aggressive energy?" Another question: Is verbal aggression cathartic? I.e., does verbal aggression "discharge aggressive energy" and thereby prevent physical aggression, as Freud suggested? 4) internet.txt # internet.txt # Data from Shelley Stoecker and Christina Rukenbrod Psyc 497 Spring 2006. # Scores on a loneliness scale and social anxiety scale and three scores from # an Internet usage survey. # Lone: score on the loneliness survey # Soc.Anx: score on the social anxiety survey # GIU: general internet usage # LIU: leisure internet usage # SIU: social internet usage > file = "http://ww2.coastal.edu/kingw/psyc480/data/internet.txt" > int = read.table(file=file, header=T) Wow! What can I say about this? I am almost overwhelmed by the possibilities! There is a growing literature on internet usage and loneliness. Some people think loneliness causes internet usage, others think internet usage causes loneliness (because it replaces genuine social interaction). It might well be a two-way street, but in simple mediation, we can't have influence flowing between two variables in both direction, so pretend you didn't hear that! Let's cheat a little bit, in order to learn a lesson. Is social anxiety significantly correlated with any of the types of internet usage? If not, then we cannot have an arrow going in either direction between these two variables. So is this a valid mediation analysis? > with(int,mediate(x=Soc.Anx, y=GIU, m=Lone)) Test of Simple Mediation Effect X on M M on Y total direct indirect statistic 0.493427 0.230416 0.148310 0.034617 0.113694 std.err 0.152750 0.072656 0.120586 0.121287 0.050239 p.value 0.001635 0.001975 0.221378 0.775877 0.023634 Sobel.z n 2.26 111.00 No, because there is no convincing evidence of a total effect of Soc.Anx on GIU. But if there is no total effect, how can there be an indirect effect (i.e., an effect mediated through loneliness)? Answer: There can't be. You test the total effect first, and if that's not significant, you've crapped out, and you stop at that point. That's the disadvantage of using the mediate function (or other canned functions). It can trick you! I remember when these students were writing this up for publication, the reviewers suggested a hierarchical regression, so maybe we'll be visiting this problem again. 5) spss.csv The last example I have for you is one you can skip if you wish, but I'm including it for two reasons. First, it comes from this website: https://uedufy.com/how-to-run-mediation-analysis-in-spss/ Which explains how to do mediation analysis in SPSS in some detail. Check it out if you think you might need to know that someday. Second, it's not a half bad example of partial mediation. The data are FAKE, and the variables are not well explained at the website, so no good story came with these data. So I'll make one up. This example comes from marketing research. If a person develops a relationship with a certain company or place of business, i.e., she does business there, and she is satisfied with that place of business, we might ask why. This study investigates the role of customer discounts on customer satisfaction. You will see the three variables in the dataset are: Relationship, Discount, and Satisfaction. A glance at the correlation matrix will reveal how phony these data are. (Who gets correlation coefficients that high for mushy "psychological" variables like these?) The mediation we are interested in testing is: Relationship -> Discount -> Satisfaction I.e., x = Relationship, m = Discount, y = Satisfaction > file = "http://ww2.coastal.edu/kingw/psyc480/data/spss.csv" > spss = read.csv(file=file)