Children’s Social Inferences about Close Social Relationships: Do children use food sharing to infer close relationships?
Creators: name: Calderwood, Cameron
name: Thomas, Ashley
Publisher: name: Open Science Framework
Year: 2022
Subjects: subject: Developmental Psychology
subject: Social Psychology
subject: Child Psychology
subject: Social and Behavioral Sciences
subject: Psychology
subject: FOS: Psychology
subject: Intuitive sociology
subject: Saliva sharing
subject: Social connectedness
subject: Social relationships

description: Start Date June 2022 Research Question In this study we are investigating what children infer after seeing saliva sharing in a social interaction. A previous study found that children expect saliva-sharing to occur more often in familial relationships than between friends. Here, we are interested in whether children use this cue to infer closeness in a friendship. In other words, do children see saliva sharing and infer a close relationship? We are testing this hypothesis by asking children whether they expect those who share saliva to be more likely to share a secret; more upset if the relationship ends; more likely to respond to the partner being sad and whether they think those who share saliva are ‘closer’. Alternatively, we also test whether food-sharing compared to toy-sharing is enough to elicit these expectations. Logic for study How do children recognise social connections, and what are their naïve theories of social relationships? Here we focus on children’s ideas of close, intimate, or thick relationships. A thick relationship, often between genetic relatives or those in romantic relationships, is categorised by the individuals’ mutual obligations, strong attachment levels, and a feeling of oneness. On the other hand, thin relationships do not share these same characteristics (Margalit, 2017, Clark &amp; Mills, 1979, Thomas et al., 2022). Younger children may understand how relationships are embodied, as it would allow them to distinguish between categories of relationships despite a multitude of unique interactions (Fiske, 2009). Thus, children may use to represent close social relationships by paying attention to who is willing to touch, cuddle and share bodily fluids. This intuition was exemplified in adults cross-culturally; Sorokowska et al. (2021) found adults reported that affective touch (touch classed as more hedonic and personal; McGlone et al., 2014) was most prevalent in stronger (thick) relationships (e.g., nuclear families) and not in weaker (thin) relationships (e.g., friends). Thomas et al., (2022) showed that the mutual transfer of saliva is a cue that young infants use to distinguish thick relationships from others. Indeed, when infants as young as 8 months saw someone in distress, infants looked first and longer at a puppet who had shared saliva with the distressed character, as though they expected them to respond. This suggests that children may expect individuals who shared saliva to be in closer and stronger relationships, compared to those who did not share saliva. The question in this study is whether children recognise that this can occur in close friendships as well. However, there is still limited experimental evidence exploring children’s ideas about close social relationships (Thomsen &amp; Carey, 2013; Kauffmann &amp; Clement, 2014, Liberman et al., 2016; 2017). For example, Thomas et al. (2022) did not directly investigate whether children think about saliva sharing as a cue of social closeness or as simply something that demarcates family from friends. Thus, the current study aims to understand children’s ideas about close relationships and sharing saliva. Hypothesis/predictions Thus, we hypothesis that children will expect that (all hypotheses compare saliva sharing to food sharing and toy sharing) • Those who share saliva will be more likely to share secrets. • Those who share saliva will be more upset when their social partner is moving. • Those who share saliva will be more likely to comfort the partner. • Those who share saliva will be socially closer on the ‘inclusion of the other in the self’ scale (a visual representation of social closeness, that uses concentric circles of varying degrees of overlap) Alternatively, it may be that children use food sharing compared to toy sharing to make these predictions. Method and Design The study will be conducted online, via synchronous video chat (Zoom). The experimenter will share their screen with the participants and go through a slide show visible on the caregiver’s laptop, tablet, phone, or screen. Caregivers will be asked to remain neutral, so they do not influence the child’s answers. First, the children will be asked to practice questions identical to the questions and measures used in the test phase. If children cannot understand the question, we will practice the questions until the children understand the questions and answer confidently. After the practice questions, children will see six stories whereby children will engage in food or toy sharing interactions. Two out the six items will be two of four-saliva-sharing interactions (i.e., licking the same ice cream cone, using the same spoon, licking the same lollipop, or drinking juice from the same straw). The other two food items will be two of four food-sharing items that can be split up and requires no saliva sharing (i.e., eating crackers, candies, cookies, and grapes). Lastly, there are two toy items which include a scooter and a jump rope which cannot be split up. The inclusion of toy sharing interactions are intended to be control items, these control items will help us understand whether it is the sharing behaviour or the saliva-sharing interaction that informs the children’s inferences. The children will be asked the same four questions for each item to investigate their inferences of people in thick or thin social relationships. For all interactions, the children are shown the character in white either playing with a toy or eating/drinking and told stories (shown in Figure 1, Figure 3, Figure 4, and Figure 5). Then the character moves towards the other character. In half of the food/drink scenarios the recipient will reply with ‘yummy!’, whereby the recipient will then accept the offer, eats the food/drink and handing it back to the character in white who eats the food/drink again. In the other half of the conditions the recipient will reject the offer saying ‘yucky!’ and will not handle or eat the food/drink offered. For the toy interactions (as shown in Figure 5), in half of the stories, the recipient will reply to the toy-sharing offer with ‘yay!’, in which the recipient is given the toy and plays with it. The first character then plays with the toy again. As in the food-sharing trials, in the other half of the toy trials, the recipient replies with ‘yucky!’ in which the recipient does not hold or play with the toy and so the story ends. Thus, all trials have the initial character playing with, eating/drinking or handling the toy or the food/drink at the end. Thus, the design of the experiment is a within subjects 2x2 (item type x accept/reject) design with four dependent variables. We will vary what kind of item is being shared (saliva-sharing food, partitionable food, or toy) and whether the recipient rejects (says ‘yucky!’) or accepts (says ‘yummy/yay!’) the item. Figure 1 Finalised illustrations used in the stimuli vignettes. Note. This figure only includes three examples, one saliva-sharing food, one non-saliva food-sharing and one toy sharing illustration. In total, there were four saliva-sharing, four non-saliva food sharing and two toy sharing illustrations that were mixed to create six final items per stimuli. Figure 2 All character illustrations used in the stimuli vignettes. Note. The central characters are in white coloured shirts, with the recipient characters being dressed in grey and black. Figure 3 Saliva-sharing vignette shown to the children. Note. This example is only one of the four possible saliva-sharing vignettes. This saliva sharing vignette includes a YUMMY interaction between partners, but when counterbalancing stimuli for each participant there will also be a saliva-sharing interaction with a YUCKY interaction between partners included in the same stimuli. Figure 4 Non-saliva food-sharing vignette shown to the children. Note. This example is only one of the four possible non-saliva food-sharing vignettes. This non-saliva food-sharing vignette includes a YUCKY interaction between partners, but when counterbalancing stimuli for each participant there will also be a non-saliva food-sharing interaction with a YUMMY interaction between partners included in the same stimuli. Figure 5 Toy-sharing vignette shown to the children. Note. This example is only one of the two possible toy-sharing vignettes. This saliva sharing vignette includes a YUMMY interaction between partners, but when counterbalancing stimuli for each participant there will also be a saliva-sharing interaction with a YUCKY interaction between partners included in the same stimuli. Participant Age and Language Exposure Our main study participants will be aged six-to-eight-year-olds (72 months to 94 months) as after piloting and judging children below this an age-range, we concluded that the children did not understand the questions. Moreover, experimental evidence has found age effects in understanding social closeness whereby children aged six-to-eight could more robustly represent and use relationships distinctions (Liberman 2016; Thomas et al., 2022). The child’s English level is obtained through the Harvard Lab for Developmental Studies FileMaker database that requires caregivers to provide the child’s English exposure, level and their spoken languages when signing up for studies. Only children with 50% English Level will be eligible. Study type and design Exploratory study with a within subject study design, whereby participants will partake in all conditions and answer all 24 questions. Randomization The order in which children hear the stories is randomised by the experimenter by shuffling the items in the keynote presentation or using a excel code that enables randomisation before the experiment. Thus, the script is amended to accord with the order of keynote presentation. We have a single blind procedure as the experimenter will need to randomise the stimuli and script for each participant. Counterbalancing First, we will counterbalance which items are used in the study as there are a total of eight food items but only four can be used for one participant/study. We made eight illustrations as it allows us to confirm that it is saliva sharing and not the sharing of a particular food or toy that’s informs the children’s inferences, thus we had multiple illustrations of food/drinks commonly implemented into children’s diets and well known to children aged six-eight years old. We counterbalance which characters in the vignettes will be in a thick or a thin relationship by having one character say YUMMY and another character say YUCKY in the food-saliva and food-sharing offers/conditions. Additionally, we will counterbalance the order of the questions asked to minimise order effects, insufficient effort responding or perseverance effects whereby the child starts answering with a particular pattern and continues to answer in that pattern for the rest of the questions on all the remaining stories. Sampling plan Existing Data and explanation of existing data This preregistration is prior to data collection or analysis. Sample size and Sample size rationale Our three pilots had a total sample size of 40 five-to-eight-year-olds. The main study sample size may be benchmarked against the effect size estimates of Thomas et al. (2022) due its similar research aims and methodology. This would include 50 six-to-eight-year-olds from mainly the greater Boston area. Participant exclusion We will exclude data if: (i) the caregiver wants to stop the study due to the child being uncomfortable, inattentive, or fussy; (ii) caregivers guide the children to the answer or interfere; (iii) there is a procedural error or equipment fails such as WIFI failures (iv) children do not answer more than 50% of the questions. (v) the child failed the practice questions more than once. Participant data will be excluded and replaced as the experimenter is actively running the study or when reviewed after the experiment. Variables Manipulated variables In both the pilot and main study, we are manipulating whether it is food or toys being shared, whether the food items require saliva sharing, and whether the recipient accepts or rejects the sharing. Measured variables We are measuring children’s responses to each question (as shown from Figure 6 to Figure 9). The four questions asked are: Figure 6 ‘Inclusion of the Other in the Self’ scale used for our social closeness question. Note. The question asks “Now we are going to look at some circles. You can think about these circles as the two boys/girls in the story. Which pair of circles do you think is most like the two boys/girls in the story?”. The answers will be scored as; Top left (blue) = 1, Top right (red) = 2, Middle left (green) = 3, Middle right (yellow) = 4, Bottom left (black) = 5, Bottom right (pink) = 6 Figure 7 Example of the vignette asking children whether the central character will tell the recipient a secret. Note. The question asks “The boy/girl in white has a secret. S/he’s afraid of the dark! Do you think the boy/girl in white told the boy/girl in grey the secret?”. The answers will be scored as; Definitely no = 1, Maybe not = 2, Maybe yes = 3, Definitely yes = 4 Figure 8 Example of the vignette asking children whether the recipient character will comfort the central character when sad or whether they will get someone socially closer to the central character to comfort them. Note. The question asks “The boy/girl in white is very sad, what do you think the boy/girl in black will do? Will they hug and comfort the boy/girl in white or will they go get the boy’s/girl’s mom to hug and comfort them?”. The answers will be coded as: Get their mom = 1, Hug them = 2 Figure 9 Example of the vignette asking children how the recipient character will feel if the central character left without the recipient, ending the relationship. Note. The question asks “The boy/girl in white is moving to a far-away country without the boy/girl in black. How do you think the boy/girl in black will feel?”. The answers will be scored as; Very sad = 4, A little sad = 3, A little happy = 2, Very happy = 1 We will record the zoom session and code the answers after the studies have been completed. Children’s answers will be coded on a likert scale, coded as 1-4 for the 4-point Likert scales questions, 1-2 for the binary question and from 1-6 for the circle closeness question. We will have a secondary coder go through recordings and code the answers to an excellent reliability level at a 0.95 alpha level. Ethics We will preserve the child’s anonymity and confidentiality throughout all stages of the research process including recruitment, data collection, analysis, dissemination of findings, retention of information and finally in the disposal of data, recordings, and files through multiple safeguards. Firstly, we have physical safeguards, whereby only fully ethically trained IRB and CITI approved research interns, postgraduate or Lab Managers can access the participants information. Secondly, we have technical safeguards such as computer passwords, firewalls, VPN and anti-virus software to protect the data from unauthorised individuals, loss, theft or modification of participant information and data. Thirdly, we have research design safeguards such as anonymising information by not attaching identifiable information to the child’s recordings, data, or files. We have stored de-identified data on a separate google sheet from the coding lists so data cannot be easily matched to each child. Moreover, we use random unique identification numbers when storing recordings, data, and files. We will code data as soon as possible after data collection and complete our data analysis to limit the amount of time we keep the children’s recordings, data, or files. Furthermore, we will keep the release of footage, data and files in line with what the parent/guardian of the children have consented to in the written CBMM_Child_Consent_Siegel_Remote_Study_Sessions consent form. Lastly, we state the safeguards implemented by researchers to protect the privacy and confidentiality of research participants in the section entitled “Privacy and Confidentiality” in the consent form. Analysis plan Statistical models Our main question is whether children have different social inferences based on two factors: type of item shared, and the recipient’s reaction. To tackle this, we will run a Mixed Effects Logistic Regression using R and the package lmer. Non-random factors will include item type and recipient reaction. We will run separate analyses for each question with an interaction between saliva-sharing condition (saliva-sharing food, partionable food, toy) and response (YUCKY or YUMMY) (Field, 2013). We will also test effect of food vs toy on the children’s answers with the same model described above, but with the data partitioned in food versus toy. For the Mixed Effects Logistic Regression to be run, three key assumptions must be met: the relationship between the odds and predictor variables must be linear; there must no outliers, and no multicollinearity (whereby two or more IVs are substantially correlated amongst each other) as this prevents the regression coefficients and statistical significance becoming less stable and/or reliable. If one of my various assumptions are not met, we will use Bayesian analysis or will conduct either a Multivariate multiple linear regression, multiple linear regression, multiple logistic regression, or a multinomial logistic regression/Linear Discriminant analysis (StatsTest, 2022). References Clark, M. S., &amp; Mills, J. (1979). Interpersonal attraction in exchange and communal relationships. Journal of personality and social psychology, 37(1), 12-24. https://doi.org/10.1037/0022-3514.37.1.12 Field, A. (2013). Discovering statistics using IBM SPSS statistics. California: Sage. Fiske, A. P., Thomsen, L., &amp; Thein, S. M. (2009). Differently embodying different relationships. European Journal of Social Psychology, 39(7), 1294-1297. https://doi.org/10.1002/ejsp.697 Kaufmann, L., &amp; Clément, F. (2014). Wired for society: cognizing pathways to society and culture. Topoi, 33(2), 459-475. https://doi.org/10.1007/s11245-014-9236-9 Liberman, Z., Woodward, A. L., Sullivan, K. R., &amp; Kinzler, K. D. (2016). Early emerging system for reasoning about the social nature of food. Proceedings of the National Academy of Sciences, 113(34), 9480-9485. https://doi.org/10.1073/pnas.1605456113 Liberman, Z., Woodward, A. L., &amp; Kinzler, K. D. (2017). Preverbal infants infer third‐party social relationships based on language. Cognitive Science, 41, 622-634. https://doi.org/10.1111/cogs.12403 Margalit, A. (2017). On betrayal. Harvard University Press. Rai, T. S., &amp; Fiske, A. P. (2011). Moral psychology is relationship regulation: moral motives for unity, hierarchy, equality, and proportionality. Psychological review, 118(1), 57-75. https://doi.org/10.1037/a0021867 Sorokowska, A., Saluja, S., Sorokowski, P., Frąckowiak, T., Karwowski, M., Aavik, T., ... &amp; Croy, I. (2021). Affective interpersonal touch in close relationships: a cross-cultural perspective. Personality and Social Psychology Bulletin, 47(12), 1705-1721. https://doi.org/10.1177/0146167220988373 Thomas, A. J., Woo, B., Nettle, D., Spelke, E., &amp; Saxe, R. (2022). Early concepts of intimacy: young humans use saliva sharing to infer close relationships. Science, 375(6578), 311-315. https://doi.org. 10.1126/science.abh1054 Thomsen, L., &amp; Carey, S. (2013). Core cognition of social relations. In M. R. Banaji &amp; S. A. Gelman (Eds.), Navigating the social world: What infants, children, and other species can teach us (pp. 17–22). Oxford University Press. https://doi.org/10.1093/acprof:oso/9780199890712.003.0004 Appendices Appendix A – Stimuli https://osf.io/mnjuw/ Appendix B - Study Script Introduce myself and ask if this is the child’s first online study Explain how this study will work Share screen with parent | Game introduction slide is shown State that the study will take 20 minutes Ask the parent to remain neutral and to not guide the child’s answers Remind the parent that we are recording to revisit the answers and that this will be kept in line with their consent form | Verbal consent slide is shown Ask the parent or guardian to read out the verbal consent shown on the screen | Bird Animation slide is shown Play the bird animation video and ask the parent and/or child to put a thumbs up if they can hear and see the animation clearly. | “Ready?” slide is shown Ask parent to minimise both videos and I must turn off my video Ask if they have any questions before we get started Remind both the parent and child that if they would like to stop at any time that is perfectly fine and that there is no pressure to continue the study. | Start the main study | Before we start, I’m going to ask you some practice questions. • We are going to look at some circles and we imagine the two circles to be two people. Which one do you think is most like a mom and her baby? Which one do you think is most like two people who don’t like each other? Which do you think are most like friends?” • This is a girl, and this is her mom. Do you think the mom knows the girl’s birthday? Definitely no, maybe not, maybe yes or definitely yes? • Do you think the mom is mean to the girl? Do you think she is always mean, sometimes mean, sometimes nice or always nice? • The girl’s mom is moving to a far-away country, how do you think the girl will feel? | Now that the practice questions have been completed, we are going to read some stories about children! I’m going to tell you about some sharing, and then I’m going to ask you some questions about the kids! Is that something you can help me with? Ok great. If child says no, we can ask them why and if they feel comfortable, communicate with the parent to understand child’s mindset and comfortability. | Cracker item Here is a girl and she is eating some crackers! The girl in white decides to share her crackers with the girl in grey. Let’s see what happens! The girl in grey says, YUMMY! I’d love to eat one of your crackers. Then, the girl in white eats another different cracker! | • Now we are going to look at some circles. You can think about these circles as the two girls in the story. Which pair of circles do you think is most like the two girls in the story? • The girl in white has a big secret. She’s afraid of the dark! Do you think the girl in white told the girl in grey the secret? • The girl in white is very very sad, what do you think the girl in grey will do? Will she hug the girl in white or get the girl in white’s mom? • The girl in white is moving to a far-away country without the girl in grey. How do you think the girl in grey will feel? | Applesauce item Here is a girl and she is eating an apple sauce with a spoon! The girl in white decides to share her apple sauce and spoon with the girl in black. Let’s see what happens! The girl in black says, YUCKY! I don’t want to use your spoon! | • Now we are going to look at some circles. You can think about these circles as the two girls in the story. Which pair of circles do you think is most like the two girls in the story? • The girl in white has a big secret. She’s afraid of the dark! Do you think the girl in white told the girl in black the secret? • The girl in white is very very sad, what do you think the girl in black will do? Will she hug the girl in white or get the girl in white’s mom? • The girl in white is moving to a far-away country without the girl in black. How do you think the girl in black will feel? | Candy item Here is another girl and she is eating some candies! The girl in white decides to share her candies with the girl in grey. Let’s see what happens! The girl in grey says YUCKY! I don’t want to eat one of your candies! | • Now we are going to look at some circles. You can think about these circles as the two girls in the story. Which pair of circles do you think is most like the two girls in the story? • The girl in white has a big secret. She’s afraid of the dark! Do you think the girl in white told the girl in grey the secret? • The girl in white is moving to a far-away country without the girl in grey. How do you think the girl in grey will feel? • The girl in white is very very sad, what do you think the girl in grey will do? Will she hug the girl in white or get the girl in white’s mom? | Ice cream item Here is another girl in white and she is eating some ice cream! The girl in white decides to share her ice cream with the girl in black. Let’s see what happens! The girl in black says, YUMMY! I’d love to lick some of your ice cream and takes a big lick. Then the girl in white is licks the same spot of the same ice cream cone again! | • The girl in white is very very sad, what do you think the girl in black will do? Will she hug the girl in white or get the girl in white’s mom? • Now we are going to look at some circles. You can think about these circles as the two girls in the story. Which pair of circles do you think is most like the two girls in the story? • The girl in white has a bug secret. She’s afraid of the dark! Do you think the girl in white told the girl in black the secret? • The girl in white is moving to a far-away country without the girl in black. How do you think the girl in black will feel? | Scooter item Here is another girl in white and she is riding on a scooter! The girl in white decides to share her scooter with the girl in grey. Let’s see what happens! The girl in grey says YAY YES! I’d love to ride your scooter and rides it! Then the girl in white rides the scooter again! | • Now we are going to look at some circles. You can think about these circles as the two girls in the story. Which pair of circles do you think is most like the two girls in the story? • The girl in white is very very sad, what do you think the girl in grey will do? Will she hug the girl in white or get the girl in white’s mom? • The girl in white has a big secret. She’s afraid of the dark! Do you think the girl in white told the girl in grey the secret? • The girl in white is moving to a far-away country without the girl in grey. How do you think the girl in grey will feel? | Jump rope item Here is another girl and she is playing jump rope! The girl in white decides to share her jump rope with the girl in black. Let’s see what happens! The girl in black says YUCK NO! I don’t want to use your jump rope! | • Now we are going to look at some circles. You can think about these circles as the two girls in the story. Which pair of circles do you think is most like the two girls in the story? • The girl in white has a big secret. She’s afraid of the dark! Do you think the girl in white told the girl in black the secret? • The girl in white is moving to a far-away country without the girl in black. How do you think the girl in black will feel? • The girl in white is very very sad, what do you think the girl in black will do? Will she hug the girl in white or get the girl in white’s mom? | Lollipop item Here is a girl in white and she is licking a lollipop! The girl in white decides to share her lollipop with the girl in black. Let’s see what happens! The girl in black says YUMMY! I’d love to lick your lollipop and licks it. Now, the girl in white licks the same spot of the same lollipop again! | • Now we are going to look at some circles. You can think about these circles as the two girls in the story. Which pair of circles do you think is most like the two girls in the story? • The girl in white has a big secret. She’s afraid of the dark! Do you think the girl in white told the girl in black the secret? • The girl in white is very very sad, what do you think the girl in black will do? Will she hug the girl in white or get the girl in white’s mom? • The girl in white is moving to a far-away country without the girl in black. How do you think the girl in black will feel? | Cookie item Here is a girl in white and she is eating some cookies! The girl in white decides to share her cookies with the girl in grey. Let’s see what happens! The girl in grey says YUCKY! I don’t want to eat one of your cookies! | • Now we are going to look at some circles. You can think about these circles as the two girls in the story. Which pair of circles do you think is most like the two girls in the story? • The girl in white is very very sad, what do you think the girl in grey will do? Will she hug the girl in white or get the girl in white’s mom? • The girl in white has a big secret. She’s afraid of the dark! Do you think the girl in white told the girl in grey the secret? • The girl in white is moving to a far-away country without the girl in grey. How do you think the girl in grey will feel? | Grape item Here is a girl in white and she is eating grapes! The girl in white decides to share her grapes with the girl in black. Let’s see what happens! The girl in black says YUCKY! I don’t want to eat one of your grapes! | • The girl in white is very very sad, what do you think the black in grey will do? Will she hug the girl in white or get the girl in white’s mom? • Now we are going to look at some circles. You can think about these circles as the two girls in the story. Which pair of circles do you think is most like the two girls in the story? • The girl in white has a big secret. She’s afraid of the dark! Do you think the girl in white told the girl in black the secret? • The girl in white is moving to a far-away country without the girl in black. How do you think the girl in black will feel? | Apple juice item Here is a girl in white and she is drinking apple juice! The girl in white decides to share her juice with the girl in grey. Let’s see what happens! The girl in grey says YUCKY! I don’t want to share your juice and straw! | • Now we are going to look at some circles. You can think about these circles as the two girls in the story. Which pair of circles do you think is most like the two girls in the story? • The girl in white has a secret. She’s afraid of the dark! Do you think the girl in white told the girl in grey the secret? • The girl in white is moving to a far-away country. How do you think the girl in grey will feel? • The girl in white is very very sad, what do you think the girl in grey will do? Will she hug the girl in white or get the girl in white’s mom? | Finished slide appears Thank the parents and the child Ask if the child liked the stories Ask if there were any issues with sound or animations Say we will send over the certificate and gift card Appendix C – R script for linear mixed effect regression. ##----------------------------------- Mixed Effects Models I ---------------------------------- ## Patrick Mair, Psych 1950 ## ---------- tool example: reading score subid &lt;- as.factor(rep(1:4, each = 4)) ## always define random effects as factors! reading &lt;- c(172, 185, 179, 194, 191, 199, 203, 215, 207, 213, 212, 213, 199, 208, 213, 218) time &lt;- as.factor(rep(1:4, 4)) gender &lt;- factor(rep(rep(0:1, each = 4), 2), labels = c("female", "male")) attendance &lt;- rep(c(0.94, 0.97, 0.85, 0.97), each = 4) readdf &lt;- data.frame(subid, reading, time, gender, attendance) readdf ## basic exploratory steps based on within subjects aggregation require("plyr") if (!require(plyr)) {install.packages("plyr"); require(plyr)} readdf1 &lt;- ddply(readdf, "subid", transform, submean = mean(reading)) readdf1 ## --- plotting trajectories require("lattice") if (!require(lattice)) {install.packages("lattice"); require(lattice)} xyplot(reading ~ time|subid, data = readdf, mainv = "Individual Regressions (Subjects)", panel = function(x, y){ panel.xyplot(x, y) panel.lmline(x, y, lty = 2)}) ## --------- Our first mixed-effects model --------------- if (!require(lmerTest)) {install.packages("lmerTest"); require(lmerTest)} ## uses lme4 package, gives p-values for regression parameters if (!require(nlme)) {install.packages("nlme"); require(nlme)} if (!require(car)) {install.packages("car"); require(car)} if (!require(effects)) {install.packages("effects"); require(effects)} require(car) require(effects) ## --- let's do it wrong first hist(readdf$reading, xlab = "reading") fitlm &lt;- lm(reading ~ time + gender + attendance, data = readdf) summary(fitlm) Anova(fitlm) ## we don't tell R that we have a within subjects design. #Didn't associate measurement with subject; dependence not accounted for. ## --- using lme4 fitlme4 &lt;- lmer(reading ~ time + gender + attendance + (1|subid), data = readdf) Anova(fitlme4) ## ANOVA-style inference summary(fitlme4) ## lm-style inference # Note dummy coding. # We get variance for random effects; like subject sum of squares. ## Random effect: variance = 23.91, sd = 4.890: between-subjects variance/sd (cf. SSB in repeated measurement ANOVA) ## effects plots; lifesaver plot(allEffects(fitlme4)) ## Note: There are some contradictory results for gender between Anova and summary. This is due to the fact that ## we have a super small sample size (and some other, more technical reasons) ## --- using nlme fitnlme &lt;- lme(reading ~ time + gender + attendance, random = ~1|subid, data = readdf) Anova(fitnlme) summary(fitnlme) ## Random effect: report sd = 4.890 only. plot(allEffects(fitnlme)) ## ---- quick assumption check plot(fitlme4) ## residuals should look healthy, i.e. no visible pattern. plot(fitnlme) ## -------------------- Other Within-Subjects Scenarios -------------------- ## --- paired $t$-test using nlme if (!require(PairedData)) {install.packages("PairedData"); require(PairedData)} ## paired datasets data(HorseBeginners) HorseBeginners ## wide format, each subject appears in both conditions res_t2 &lt;- with(HorseBeginners, t.test(Imaginary, Actual, paired = TRUE)) res_t2 if (!require(reshape)) {install.packages("reshape"); require(reshape)} ## paired datasets HorseBeginners$Subject &lt;- 1:nrow(HorseBeginners) HorseBeginners HorseLong &lt;- melt(HorseBeginners, id.vars=c("Subject")) colnames(HorseLong) &lt;- c("subject", "group", "performance") HorseLong # subject is random, perf is response, group is fixed fitHorse &lt;- lme(performance ~ group, random = ~1|subject, data = HorseLong) summary(fitHorse) ## --- within subjects ANOVA example RecallLong &lt;- read.table(file = "http://www.people.fas.harvard.edu/~mair/datasets/R.appendix3.data", header = TRUE) RecallLong # recall is response. subject is random. valence is fixed. id &lt;- c(1:10, 1:10) id id &lt;- as.factor(id) #now does it by level. ## classical way fitaovRecall1 &lt;- aov(Recall ~ Valence + Error(Subject/Valence), data = RecallLong) ## Note error term: valence within subject summary(fitaovRecall1) ## using nlme fitaovRecall4 &lt;- lme(Recall ~ Valence, random = ~1|Subject, data = RecallLong, method = "ML") summary(fitaovRecall4) anova(fitaovRecall4) ## ------ between-within subjects ANOVA ## Dataset from : Winter, B., &amp; Grawunder, S. (2012). The phonetic profile of Korean formality. ## Journal of Phonetics, 40, 808-815. Variables in model: ## We are interested whether the voice pitch differs across attitude and gender. ## response: frequency voice pitch measured in Hz ## gender: 3 males, 3 females, between-subjects condition (fixed effect) ## attitude: polite vs. informal, within-subjects condition (fixed effect!!) ## subject: subject ID (random effect) politeness &lt;- read.csv("http://www.people.fas.harvard.edu/~mair/datasets/politeness_data.csv") politeness$scenario &lt;- as.factor(politeness$scenario) head(politeness) politeness table(politeness$subject) ## 6 subjects, each 14 measurements boxplot(frequency ~ attitude*gender, col = c("white", "lightgray"), main = "Politeness/Gender Boxplots", data = politeness) xyplot(frequency ~ attitude|subject, mainv = "Individual Regressions (Subjects)", data = politeness, panel = function(x, y){ panel.xyplot(x, y) panel.lmline(x, y, lty = 2)}) fitpol &lt;- lme(frequency ~ gender + attitude, random = ~1|subject, data = politeness, na.action = na.omit) ## we have a missing value Anova(fitpol) summary(fitpol) plot(allEffects(fitpol)) ## ---------------------------- Various Experimental Designs ------------------------- # this doesn't give you significance. we're just thinking design. ## --- Design I y &lt;- c(5, 10, 11, 8, 8, 12, 3, 10, 9, 5, 9, 9, 7, 7, 7, 5, 12, 13) sid &lt;- as.factor(rep(1:6, each = 3)) time &lt;- as.factor(rep(1:3, 6)) df &lt;- data.frame(y, time, sid) df # lmer is from lme4 package. lmer(y ~ time + (1|sid), data = df) # fixed effects give you difference between time1 and other things. ## --- Design II gender &lt;- factor(rep(0:1, each = 9), labels = c("male", "female")) df2 &lt;- data.frame(df, gender) df2 lmer(y ~ time + gender + (1|sid), data = df2) # male vs female. could also include interaction but we haven't done that. ## --- Design III sid &lt;- as.factor(rep(rep(1:3, each = 3), 2)) condition &lt;- factor(rep(0:1, each = 9), labels = c("cond1", "cond2")) df3 &lt;- data.frame(y, time, condition, sid) df3 ## NB: random effect looks different from above lmer(y ~ time + condition + (1|sid), data = df3) ## --- Design IV y1 &lt;- c(5,6,7,1,1,8,4,6,7,3,5,6) y2 &lt;- c(6,8,3,5,4,9,5,4,6,7,8,3) y3 &lt;- c(7,3,3,2,4,2,6,8,7,9,1,6) y4 &lt;- c(6,4,4,4,5,6,5,3,4,5,6,7) y5 &lt;- c(2,5,6,4,5,4,9,8,9,8,9,9) y6 &lt;- c(5,5,5,6,2,4,4,3,5,5,5,5) y &lt;- c(y1, y2, y3, y4, y5, y6) time &lt;- as.factor(rep(rep(1:3, each = 4), 6)) sid &lt;- as.factor(rep(1:6, each = 12)) ## subject ID tid &lt;- as.factor(rep(1:4, 18)) ## trial ID df4 &lt;- data.frame(y, time, sid, tid) df4 lmer(y ~ time + (1|sid) + (1|tid), data = df4) ## we get two random effect variances # Not interested in differences between trials. ## --- Design V gender &lt;- factor(rep(0:1, each = 36), labels = c("male", "female")) df5 &lt;- data.frame(df4, gender) df5 lmer(y ~ time + gender + (1|sid) + (1|tid), data = df5) ## --- Design VI condition &lt;- factor(rep(0:1, each = 36), label = c("cond1", "cond2")) sid &lt;- as.factor(rep(rep(1:3, each = 12), 2)) df6 &lt;- data.frame(y, time, condition, sid, tid) df6 ## note that the subject ID starts again with 1 at the condition switch lmer(y ~ time + condition + (1|sid) + (1|tid), data = df6)