Commit c445ca74 authored by Amit Goldenberg's avatar Amit Goldenberg

adding the analysis of the eeg data (initial)

parent 39548476
---
title: "EEG_analysis"
author: "Amit"
date: "October 21, 2016"
output: html_document
---
```{r packages, include=FALSE}
library (ggplot2) ; library ('lme4'); library ('lmerTest'); library ('plyr'); library ('dplyr'); library ('psych'); library ('car'); library("tidyr")
```
```{r get file, include=FALSE}
setwd("C:/Users/Amit/Dropbox/Research/emotional conformity-non conformity/motivated_contation_EEG_2017/Results")
d <- read.csv("eeg_data_motivated_contagion.csv")
head(d)
#d = subset (d, condition != "none")
#ds = subset (d, phase == "social")
```
### 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
```{r }
id = which( colnames(d)=="id" )
condition = which( colnames(d)=="condition" )
urevent = which( colnames(d)=="urevent" )
photo = which( colnames(d)=="photo" )
photoType = which( colnames(d)=="photoType" )
phase = which( colnames(d)=="phase" )
rate = which( colnames(d)=="rate" )
rt = which( colnames(d)=="rt" )
grate = which( colnames(d)=="grate" )
P3 = which( colnames(d)=="P3" )
LPP = which( colnames(d)=="LPP" )
SLW = which( colnames(d)=="SLW" )
d= d[,c(id,condition,urevent, photoType, photo, phase, rate, rt, grate, P3, LPP, SLW)]
head(d)
rm(id,urevent, photoType, photo, phase, rate, rt, grate, P3, LPP, SLW)
d1 = subset (d, phase == "indiv")
d2 = subset (d, phase =="social")
d2 = d2[,c(9:11)]
colnames(d2)= c("P3s", "LPPs", "SLWs")
head(d2)
length (d1$LPP)
length (d2$LPPs)
```
## as you can see the length of the two datasets is not the same
```{r Look just at the second, eval=FALSE, include=FALSE}
d %>%
group_by(photoType) %>%
do(r = print(summary(lmer(P3 ~ condition +urevent+(1|id), data = .))))
d %>%
group_by(photoType) %>%
do(r = print(summary(lmer(LPP ~ condition+urevent +(1|id), data = .))))
d %>%
group_by(photoType) %>%
do(r = print(summary(lmer(SLW ~ condition+urevent +(1|id), data = .))))
```
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