Commit 061411f5 authored by Andero Uusberg's avatar Andero Uusberg

added stuff to the R file

parent 1cebe469
......@@ -8,7 +8,9 @@ output: html_document
```{r packages, include=FALSE}
library (ggplot2) ; library ('lme4'); library ('lmerTest'); library ('plyr'); library ('dplyr'); library ('psych'); library ('car'); library("tidyr")
library (ggplot2) ; library ('lme4'); library ('lmerTest'); library ('plyr'); library ('dplyr'); library ('psych'); library ('car'); library("tidyr");
library('lmerTest'); library('coefplot2')
```
```{r get file, include=FALSE}
......@@ -22,6 +24,34 @@ head(d)
#ds = subset (d, phase == "social")
```
### Andero's stuff ####
# separate phases
a <- d[d$phase=="indiv",]
b <- d[d$phase=="social",]
# make a wide format with each picture in a separate row and the phases in separate columns
D3 <- merge(a[,c("subject", "photo", "order", "rt", "P3", "LPP", "SLW")],b,by=c("subject", "photo"))
colnames(D3) <- gsub(".x", ".indiv", colnames(D3), fixed =T)
colnames(D3) <- gsub(".y", ".social", colnames(D3), fixed =T)
# continuous model
summary(fit <- lmer(LPP.social ~ LPP.indiv + rate*grate + (1|subject) + (1|photo), data = D3))
coefplot2(fit)
# categorical model
summary(fit <- lmer(SLW.social ~ SLW.social + photoType*condition + (1|subject) + (1|photo), data = D3))
coefplot2(fit)
# model without neutral pictures
summary(fit <- lmer(SLW.social ~ SLW.indiv + condition + (1|subject) + (1|photo), data = D3[D3$photoType=="emo",]))
coefplot2(fit)
### my plan is to create two wide formats
####1. will allow me to create a difference score from the first phase to the second
####2. Will allow me to create a difference scroe from the emotional and the neutral pictures
......
This diff is collapsed.
File added
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment