Commit 267ff4f4 authored by Amit Goldenberg's avatar Amit Goldenberg

test

parent 2e1f1031
This diff is collapsed.
......@@ -7,14 +7,14 @@ do = struct('import',0, 'reimport',0, ... % fl
'build', 1, 'analyze', 0);
% Andero paths (change)
dataDir = 'L:\REGULATION\Amit 2016\'; % directory for large datafiles
scriptDir = 'S:\Teadus\affect regulation\16 motivated contagion\'; % directory for scripts and other files (mirrored to gitLab)
eeglabDir = 'C:\Program Files\EegLab\eeglab\'; % eeglab program directory
%dataDir = 'L:\REGULATION\Amit 2016\'; % directory for large datafiles
%scriptDir = 'S:\Teadus\affect regulation\16 motivated contagion\'; % directory for scripts and other files (mirrored to gitLab)
%eeglabDir = 'C:\Program Files\EegLab\eeglab\'; % eeglab program directory
%Amit paths
% dataDir = 'Z:\Amit\EEG DATA\test\' % directory for large datafiles
% scriptDir = 'C:\Users\Amit\OneDrive\Study_11_EEG_pilot\Results\' % directory for scripts and other files (mirrored to gitLab)
%eeglabDir = 'C:\Program Files\MATLAB\R2016a\toolbox\eeglab13_5_4b\'; % eeglab program directory. I am not sure I need this if I comment
dataDir = 'C:\Users\Amit\OneDrive\Study_11_EEG_pilot\test\' % directory for large datafiles
scriptDir = 'C:\Users\Amit\OneDrive\Study_11_EEG_pilot\Results\' % directory for scripts and other files (mirrored to gitLab)
eeglabDir = 'C:\Program Files\MATLAB\R2016a\toolbox\eeglab13_5_4b\'; % eeglab program directory. I am not sure I need this if I comment
% RELATIVE PATHS (don't change)
addpath(scriptDir); %addpath(eeglabDir); % add the second part if it doesn't wrok % add scripts and eeglab to MATLAB path for this session
......@@ -26,7 +26,7 @@ epochdir = [dataDir,'output\epoch\']; mkdir(epochdir); % fu
eeglab; % open eeglab
%% IMPORT %%
while do.import==1; % flow control question
while do.import==0; % flow control question
% Importing the EEG data, attaching events from excel file; relabeling the channael names and rereferencing.
pop_editoptions('option_storedisk', 0); % set eeglab to hold actual data from several datasets in MATLAB (as opposed to loading them from disk only when needed which is useful at later stages )
......
This diff is collapsed.
......@@ -104,7 +104,7 @@ d$dif = d$rate2 -d$rate1
#subsetting
d1 = subset (d, (photoType == "anger"& rate1<8 & rate1 >1 ) )
d1 = subset (d, (photoType == "anger"& rate1<7 & rate1 >2 ) )
d2 = subset (d, (photoType == "neutral"& rate1<8 & rate1 >1 ) )
......@@ -119,9 +119,9 @@ rm (ex, ex_n, a,b , dx, nn, y ,z)
temp2 <- aggregate(list(intensity = d$rate1), list(image = factor(d$photo)), mean, na.rm = T)
temp2Supp <- aggregate(list(se = d$rate1), list(image = factor(d$photo)), function(x) se(x))
temp2Supp <- aggregate(list(sd = d$rate1), list(image = factor(d$photo)), function(x) se(x))
temp <- cbind(temp2, temp2Supp$se)
temp <- cbind(temp2, temp2Supp$sd)
names(temp) <- c("image", "mean", "se")
......@@ -147,8 +147,8 @@ imagePlot
str(d$id)
rating = d2%>%
group_by(id, photoType) %>%
rating = d1%>%
group_by(id) %>%
summarise(
rate1 =mean(rate1, na.rm = T),
rate2 =mean (rate2, na.rm = T),
......@@ -157,14 +157,17 @@ rating = d2%>%
rt2= mean (rt2, na.rm = T)
)
print (rating)
rating
length(table (d$id))
rating = d1%>%
table()rating = d1%>%
group_by(condition) %>%
summarise(
poli =mean(poli, na.rm = T),
polisd =mean (poli, na.rm = T))
rating
data = subset (d1,photo==5)
ggplot(data, aes(x=poli)) +
......@@ -176,7 +179,16 @@ ggplot(data, aes(x=poli)) +
mytable = table(d1$condition, d1$dif_c) ; mytable
a= as.matrix(ftable(mytable)) ; a
d1$dd = d1$grate-d1$rate1
grating = d1%>%
group_by(condition) %>%
summarise(
g =mean(dd, na.rm = T),
sg =sd(dd, na.rm = T))
grating
```
......@@ -184,6 +196,19 @@ a= as.matrix(ftable(mytable)) ; a
```{r dif - primary analysis}
r = lmer (scale(dif, scale = F) ~ condition -1+(1|photo)+(1|id), d1) ; summary (r)
r = lmer (scale(dif, scale = F) ~ condition +order1+order2-1+(1|photo)+(1|id), d1) ; summary (r)
r = lmer (rate1 ~ scale(order1) + (1|id), d1 ) ; summary (r)
d1$condition <- relevel(d1$condition, "none")
####
r = lmer (rate1 ~ order1 + (1|photo) +(1|id), d1) ; summary (r)
r = lmer (rate2 ~ order2 + (1|photo) +(1|id), d1) ; summary (r)
......@@ -191,8 +216,8 @@ r = lmer (rate2 ~ order2 + (1|photo) +(1|id), d1) ; summary (r)
5.463-5.105
# correct for order
d1$rate1n = d1$rate1+ (d1$order1*0.003164)
d1$rate2n = d1$rate2+ (d1$order2*0.001397)
d1$rate1n = d1$rate1+ (d1$order1*0.0014964)
d1$rate2n = d1$rate2+ (d1$order2*0.001968)
r = lmer (rate1n ~ order1 + (1|photo) +(1|id), d1) ; summary (r)
......@@ -214,18 +239,6 @@ d1$o = mean(d1$dif)
contrasts (d1$condition)
# check wether the difference between higher and lower
r = lmer (scale(dif, scale = F) ~ condition -1+(1|photo)+(1|id), d1) ; summary (r)
r = lmer (scale(dif, scale = F) ~ condition +order1+order2-1+(1|photo)+(1|id), d1) ; summary (r)
r = lmer (rate1 ~ scale(order1) + (1|id), d1 ) ; summary (r)
d1$condition <- relevel(d1$condition, "none")
r = lmer (rate2~ condition+ order2 + (1|id) + (1|photo), d1) ; summary (r)
r = lmer (scale(dif, scale =F)~ condition +order1 +order2-1+(1|id), d1) ; summary (r)
......@@ -285,6 +298,26 @@ ggplot(dfc, aes(x=condition, y=dif, fill=condition)) +
```{r RTM analysis}
d1$mr1 = mean(d1$rate1)
d1$cr1 = d1$rate1-d1$mr1
d1$mr2 = mean(d1$rate2)
d1$cr2 = d1$rate2-d1$mr2
d1$cdif = d1$cr2 - d1$cr1
r = lmer (scale(rate2, scal = F) ~ condition+rate1 +(1|photo) + (1|id),d1); summary (r)
```
```{r priamiry analysis - long}
rate1= which(colnames(d1)=="rate1n")
......@@ -607,15 +640,15 @@ g;
```{r order effect}
r = lm(rate1 ~ order1 ,n) ;summary (r)
r = lm(rate1 ~ order1 ,d1) ;summary (r)
r = lm(rate2 ~ order2 ,d1) ;summary (r)
head(d1)
ggplot(dd, aes(x = order, y = rate, )) +
ggplot(d1, aes(x = order1, y = rate1, )) +
geom_point() +
stat_smooth(method='auto',fill = NA, se = F)+
geom_line() +
facet_wrap(~id,ncol=5)
facet_wrap(~photo,ncol=10)
ggplot(n, aes(x = order2, y = rate2 )) +
......
No preview for this file type
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