File: Negativity R.R

Comment: Capture Age for Each particpant
Category: Data Variable
Code:
ParticipantAge <- summarize(Summary, count = n(), Age = mean(Age, na.rm = T))

Comment: EVENT VALENCE: Compare Rated Strength of Positive & Negative Events    CHECKING FOR OUTLIERS    Figure: Boxplot    Order Conditions
Category: Visualization
Code:
EventValenceRatings$Valence <- factor(EventValenceRatings$Valence, levels = c("Positive", "Negative")) BoxplotFig <- ggplot(EventValenceRatings, aes(x=Valence, y=Strength)) + theme_bw() BoxplotFig <- BoxplotFig +  geom_boxplot(aes(color = Valence, fill = Valence), outlier.size = 2.5, alpha = 0.5) BoxplotFig <- BoxplotFig + labs(x="Event Valence", y="Event Valence Ratings (-50 to 50)") + theme(title= element_text(size=14, face='bold'), axis.title.x= element_text(size=14), axis.text.x= element_text(face="bold", size=14), axis.title.y = element_text(size=14), axis.text.y= element_text(face="bold", size=14), strip.text.x= element_text(size = 14, face='bold'), strip.text.y= element_text(size = 14, face='bold'))

Comment: Dotplot Valence Figure (Winsorized & ReverseCoded)
Category: Visualization
Code:
EventValenceRatings_MEANFig <- ggplot(data=EventValenceRatings_ByParticipant_MEAN, aes(x=Valence, y=Strength_ReverseCoded)) EventValenceRatings_MEANFig <- EventValenceRatings_MEANFig + stat_summary(fun=mean, geom="bar", position ="dodge", alpha=0.5, aes(fill=Valence)) EventValenceRatings_MEANFig <- EventValenceRatings_MEANFig + theme_bw() EventValenceRatings_MEANFig <- EventValenceRatings_MEANFig + geom_violin(alpha = 0.5, color='grey50')

Comment: Mixed Effects Model with EventPosition as a Covariate (Linear & Quadratic)  Random Effects Structure simplified to converge:    ChainPosition removed from ChainID    SocialContext removed from Event
Category: Statistical Modeling
Code:
Analysis1GLMER <- glmer (Present~ SocialContext.C*Valence.C*ChainPosition.C + poly(EventPosition.C, 2) + (1 + Valence.C | ChainID) + (1 | Event), data=Analysis1, family=binomial) summary(Analysis1GLMER) Analysis2GLMER <- glmer (Present~ SocialContext.C*Valence.C*ChainPosition.C + poly(EventPosition.C, 2) + (1 + Valence.C | ChainID) + (1 | Event), data=Analysis2, family=binomial) summary(Analysis2GLMER)

Comment: Mixed Effects Model with EventPosition as a Covariate (Linear & Quadratic)  Random Effects Structure simplified to converge:    Valence & ChainPosition removed from ChainID    SocialContext removed from Event
Category: Statistical Modeling
Code:
Analysis3GLMER <- glmer (Present~ SocialContext.C*Valence.C*ChainPosition.C + poly(EventPosition.C, 2) + (1 | ChainID) + (1 | Event), data=Analysis3, family=binomial) summary(Analysis3GLMER)

Comment:    VISUALISE BIAS (POSITIVE, NEGATIVE) IN EACH SocialContext      Substract Mean Positive From Mean Negative Survival Score for each SocialContext  Prediction is that Perference for Negativity Decreases first with Communicative Intent and then further with Social Interaction  Calculate Means for Positive & Negative Information  Calculate Mean Positive  Mean Negative for Each Chain  Plot  Filter 
Category: Visualization
Code:
Bias <- filter(NegativityData, Valence %in% c("Positive", "Negative"))

Comment: Create a Vector of colours based on each Participant's Mean Bias Score (Positive  Negative)  Use this to Color the dot points by Value
Category: Visualization
Code:
wideBiasMEAN <- mutate(wideBiasMEAN, ColourFig = ifelse(Bias >1, "#006A40FF", ifelse(Bias <0, "#F08892FF", "#95828DFF"))) NegativityBiasFig <- ggplot(data=wideBiasMEAN, aes(x=SocialContext, y=Bias)) NegativityBiasFig <- NegativityBiasFig + stat_summary(fun.y=mean, geom="bar", position ="dodge", alpha=0.5, fill="red") NegativityBiasFig <- NegativityBiasFig + theme_bw() NegativityBiasFig <- NegativityBiasFig + geom_violin(alpha = 0.5, color='grey50')

Comment: Geom_dotplot with points coloured by Value
Category: Visualization
Code:
NegativityBiasFig <- NegativityBiasFig + geom_dotplot(aes(x=SocialContext, y=Bias, fill=ColourFig), binaxis='y', stackdir='center', dotsize=0.9, alpha = 1, stroke=0.75, colour='grey15') + scale_fill_identity()

Comment: Add Violin Geom to give indication or data normality
Category: Visualization
Code:
ResolutionCollapsedFig <- ResolutionCollapsedFig + geom_violin(alpha = 0.0, colour='grey50') ResolutionALLPosNegFig <- ResolutionALLPosNegFig + geom_violin(alpha = 0.5, color='grey50')