library(dplyr)#funktsioonid: select, filter,
library(reshape2)#functions: dcast()
library(ggplot2)
library(plyr)#funktsioon ddply
library(htmlTable) #htmlTable()
library(psych)#describeBy
library(reshape2) #melt
library(plotly)#plotlyga ühenduse loomiseks
setwd("C:/Users/Martin/Documents/Bitbucket/MIDIATAnalysis/AffectGrid")
data_subjects <- read.csv("subjects.csv", header=TRUE, sep=";")
data_All_Wtrials <- read.csv("subjects_trials.csv", header=TRUE, sep=",")
data_All_words <- read.csv("affect_results.csv", header=TRUE, sep=",")
data_trials <- read.csv("selectedWords.csv", header=TRUE, sep=",")
data_words <- read.csv("selectedWordsResults.csv", header=TRUE, sep=",")

Words

levels(droplevels(filter(data_words, trial == "High")$stimuli))
## [1] "äike"   "kiskja" "raev"   "süstal" "terav"  "torm"   "tung"   "võimas"
levels(droplevels(filter(data_words, trial == "Low")$stimuli))
## [1] "madal"   "nööp"    "pliiats" "põõsas"  "sokk"    "sulg"    "tigu"   
## [8] "tolm"
levels(droplevels(filter(data_words, trial == "Positive")$stimuli))
## [1] "ilus"    "kaunis"  "lemmik"  "mõnus"   "päike"   "parim"   "rahu"   
## [8] "unistus"
levels(droplevels(filter(data_words, trial == "Negative")$stimuli))
## [1] "haigus" "kaklus" "kaotus" "mürk"   "pettus" "pomm"   "valus"  "varas"

VALIM

describe(data_subjects$age)
##   vars  n  mean   sd median trimmed  mad min max range skew kurtosis   se
## 1    1 68 28.97 9.16     27   27.39 5.19  19  66    47 2.15     5.18 1.11
summary(data_subjects$gender)
##  M  N 
## 19 49
summary(data_subjects$education)
## kesk- või kutseharidus            kõrgharidus 
##                      5                     63
summary(data_subjects$language)
## eesti  vene 
##    67     1
summary(data_subjects$skill)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   3.000   5.000   6.000   5.794   6.000   7.000
## Kasutatud andmestik - hinnangute keskmised
vtable <- describeBy(data_words[,8:9],data_words$trial)
vmat <- as.matrix(round((do.call(rbind.data.frame, vtable)), digits = 2))
htmlTable(vmat, caption="HINNANGUD",col.columns = c("none", "#F7F7F7"),  css.cell = "padding-left: .7em; padding-right: .7em;", tfoot="&dagger; V - valents; I - intensiivsus; Z - standardiseeritud tulemustega arvutatud")
HINNANGUD
vars n mean sd median trimmed mad min max range skew kurtosis se
High.ZVkeskmine 1 8 -0.22 0.67 -0.16 -0.22 0.48 -1.28 0.86 2.14 -0.07 -1.2 0.24
High.ZIkeskmine 2 8 0.35 0.32 0.25 0.35 0.33 -0.03 0.82 0.85 0.33 -1.71 0.11
Low.ZVkeskmine 1 8 -0.05 0.34 0.06 -0.05 0.16 -0.8 0.26 1.06 -1.12 -0.16 0.12
Low.ZIkeskmine 2 8 -0.89 0.1 -0.89 -0.89 0.08 -1.02 -0.71 0.3 0.29 -1.08 0.03
Negative.ZVkeskmine 1 8 -1.31 0.05 -1.3 -1.31 0.06 -1.4 -1.26 0.14 -0.42 -1.61 0.02
Negative.ZIkeskmine 2 8 0.32 0.12 0.37 0.32 0.13 0.15 0.46 0.31 -0.25 -1.93 0.04
Positive.ZVkeskmine 1 8 1.05 0.07 1.06 1.05 0.06 0.92 1.12 0.21 -0.77 -0.51 0.02
Positive.ZIkeskmine 2 8 0.45 0.13 0.43 0.45 0.11 0.28 0.7 0.42 0.58 -0.86 0.05
† V - valents; I - intensiivsus; Z - standardiseeritud tulemustega arvutatud

Graafikud

## Using stimuli, trial as id variables

ANOVA

VALENCE

# One Way ANOVA - valents
aov_val <- aov(Vkeskmine~trial, data = data_words)
summary(aov_val)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## trial        3  66969   22323    51.4 1.64e-11 ***
## Residuals   28  12160     434                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Millised grupid erinevad valnetsi poolest:
tkV <- TukeyHSD(aov_val)
tkV
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Vkeskmine ~ trial, data = data_words)
## 
## $trial
##                         diff       lwr       upr     p adj
## Low-High            9.801751 -18.64719  38.25069 0.7833670
## Negative-High     -59.681025 -88.12996 -31.23208 0.0000218
## Positive-High      69.338743  40.88980  97.78768 0.0000019
## Negative-Low      -69.482776 -97.93172 -41.03384 0.0000018
## Positive-Low       59.536992  31.08805  87.98593 0.0000226
## Positive-Negative 129.019767 100.57083 157.46871 0.0000000
plot(tkV, las = 1,cex.axis = 0.5)

AROUSAL

# One Way ANOVA - intensiivsus
aov_int<- aov(Ikeskmine~trial, data = data_words)
summary(aov_int)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## trial        3   6923    2308   96.25 7.39e-15 ***
## Residuals   28    671      24                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Millised grupid erinevad intensiivsuse poolest:
tkI <- TukeyHSD(aov_int)
tkI
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Ikeskmine ~ trial, data = data_words)
## 
## $trial
##                         diff        lwr        upr     p adj
## Low-High          -33.797566 -40.482270 -27.112862 0.0000000
## Negative-High      -1.224822  -7.909526   5.459882 0.9583292
## Positive-High       1.515681  -5.169023   8.200385 0.9251204
## Negative-Low       32.572744  25.888040  39.257448 0.0000000
## Positive-Low       35.313247  28.628543  41.997951 0.0000000
## Positive-Negative   2.740503  -3.944201   9.425207 0.6808881
plot(tkI, las = 1,cex.axis = 0.5)

Tulemuste kuvamine

LISA

Kategooria - positiivne

Kategooria - negatiivne

Kategooria - tugev

Kategooria - madal