## load packages
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.2 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.0
## ✔ ggplot2 3.4.2 ✔ tibble 3.2.1
## ✔ lubridate 1.9.2 ✔ tidyr 1.3.0
## ✔ purrr 1.0.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(dplyr)
## dataset "john_real_data_230814"
setwd("C:/Users/Alexander")
d <- read.delim("Documents/r_intervention/john_real_data_230822.tsv")
## remove unnecessary columns
d <- d[,-23:-35]
d <- d [,-c(1,2,4,5,9,10,11,12,13,14,15,16)]
## add column with story value
d$story <- "John"
## Insert new string values in column "stimulus"
## prep for changing string value in column "stimulus"
d$stimulus <- gsub("[[:punct:]]", " ", d$stimulus)
d$stimulus <- gsub(" ", "", d$stimulus)
d$stimulus <- str_to_lower(d$stimulus)
d$stimulus <- trimws(d$stimulus)
d$stimulus <- gsub("[\r\n]", "", d$stimulus)
## change string value to "donation"
d$stimulus <-gsub ("h2bopportunitytodonatetotheymcabh2pidtextyouandeveryoneelsethatparticipatesinthisexperimentwillreceiveabonuspaymentof1pound100pencethisbonuspaymentisanadditionalpaymenttothebasicpaymentthatyoureceiveforparticipatinginthisexperimentwhateveryouchoosetodowithyourbonuspaymentyouwillreceiveyourbasicpaymentforparticipatinginthisexperimentppidtextasyouknowjohnandpeoplelikehimreceivehelpfromtheymcayoucanchoosetodonatesomeorallofyourbonuspaymenttotheymcaandtherebyhelppeoplelikejohnbnotebthatwhateveramountyouchoosetodonatewillbearealdonationtotheymcathattheresearchersconductingthisstudywillmakeonceitiscompletedppidtextmakeyourchoicebyusingthesliderbelowemmaximumamountthatcanbedonatedis100penceemyoucanalsochoosetonotdonateanymoneytotheymcabymovingthecursorto0theamountyouchoosetodonatewillbedeductedfromyourbonuspaymentp","donation",d$stimulus)
## change string value to "intervention"
d$stimulus <-gsub("pidtextbdefinitionbempathyisdefinedastheabilitytounderstandandsharethefeelingsandthoughtsofothersforexampleempathizingwithsomeoneindistressinvolvesunderstandingthesituationfromhisherperspectiveandfeelinghishernegativeemotionsppidtextrecentstudieshaveshownthatemwecanregulateourempathyemandthatitisnotarigidtraitthatiswecanbecomemoreempathicifwetrytoempathizewithpeoplesomeofthesestudiesalsoshowedthatwhenpeoplelearnedthatwecanregulateourempathytheyputmoreeffortintobecomingmoreempathicppidtextimaginethatyoufindyourselfinasocialsituationwhereyouwouldwanttobeempathichowmuchwouldyoubeabletoincreaseyourempathyinthatsituationppidtextpleaseanswerbyusingthescalebelowppidtextbfrom0biwouldnotbeabletoincreasemyempathyatallbto100biwouldbeabletoincreasemyempathyalotp", "intervention", d$stimulus)
d$stimulus <-gsub("pidtextbdefinitionbempathyisdefinedastheabilitytounderstandandsharethefeelingsandthoughtsofothersforexampleempathizingwithsomeoneindistressinvolvesunderstandingthesituationfromhisherperspectiveandfeelinghishernegativeemotionsppidtextrecentstudieshavefoundthatemempathyisalimitedresourceemsopeopleemcannotfeelemittowardalargenumberofpeopleppidtextimaginethatyouareabouttomeetpeopleindistresstowardhowmanyofthemcouldyoufeelempathyppidtextpleaseanswerhowmanypeopleyoucanempathizewithbyusingthescalebelowppidtextbfrom0bcantfeelempathytowardanyonebto3bcanfeelempathytowardthreepeoplep", "intervention", d$stimulus)
d$stimulus <-gsub("pidtextbdefinitionbempathyisdefinedastheabilitytounderstandandsharethefeelingsandthoughtsofothersforexampleempathizingwithsomeoneindistressinvolvesunderstandingthesituationfromhisherperspectiveandfeelinghishernegativeemotionsppidtextempathyishighlyvaluedinmostcommunitiesseveralstudiesdemonstratethatpeoplestronglyvalueempathyandexpectothersintheircommunitytobeempathicemempathicpeoplearealsowelllikedbytheirpeersembecausetheybetterunderstandthosearoundthemaspeoplelearnthattheircommunityvaluesempathytheyoftenputmoreeffortintorelatingtoandunderstandingothersppidtextimaginethatyoufindyourselfinasocialsituationwhereyouwouldwanttobeempathichowmuchwouldyoubeabletoincreaseyourempathyinthatsituationppidtextpleaseanswerbyusingthescalebelowppidtextbfrom0biwouldnotbeabletoincreasemyempathyatallbto100biwouldbeabletoincreasemyempathyalotp", "intervention", d$stimulus)
d$stimulus <-gsub("pidtextfinancialinvestmentscanberiskyonaverageempeoplelosemoneywhenmakingstockinvestmentsemasmallpercentageofstockinvestorsmakethelargestgainstherestoftenlosemoneyontheirinvestmentssomepeoplecanbesounfortunatethattheylosemuchoftheirsavingsandsometimesfindthemselvesinproblematicfinancialsituationsppidtexthowriskydoyouthinkstockinvestmentsareppidtextpleaseanswerbyusingthescalebelowppidtextbfrom0bnotriskyatallbto100bveryriskyp", "intervention", d$stimulus)
d$stimulus <-gsub("pidtextbdefinitionbempathyisdefinedastheabilitytounderstandandsharethefeelingsandthoughtsofothersforexampleempathizingwithsomeoneindistressinvolvesunderstandingthesituationfromhisherperspectiveandfeelinghishernegativeemotionsppidtextrecentstudieshavefoundthatemempathyisanunlimitedresourceemsopeopleemcanfeelemittowardalargenumberofpeopleppidtextimaginethatyouareabouttomeetpeopleindistresstowardhowmanyofthemcouldyoufeelempathyppidtextpleaseanswerhowmanypeopleyoucanempathizewithbyusingthescalebelowppidtextbfrom0bcantfeelempathytowardanyonebto300bcanfeelempathytowardthreehundredpeoplep", "intervention", d$stimulus)
## adding new values to column "stimulus
d[d$stimulus == "" & d$trial_index == 3, "stimulus"] <- "attention1"
d[d$stimulus == "" & d$trial_index == 6, "stimulus"] <- "empathic_reactions"
d[d$stimulus == "" & d$trial_index == 7, "stimulus"] <- "empathic_drivers"
d[d$stimulus == "" & d$trial_index == 9, "stimulus"] <- "perceived_ethnicity"
d[d$stimulus == "" & d$trial_index == 10, "stimulus"] <- "empathic_beliefs"
d[d$stimulus == "" & d$trial_index == 11, "stimulus"] <- "ymca"
## create new columns for variables
d <- transform(d, attention1= ifelse(stimulus=="attention1", response, ""))
d <- transform(d, intervention_response= ifelse(stimulus=="intervention", response, ""))
d <- transform(d, donation= ifelse(stimulus=="donation", response, ""))
d <- transform(d, empathic_reactions= ifelse(stimulus=="empathic_reactions", response, ""))
d <- transform(d, empathic_drivers= ifelse(stimulus=="empathic_drivers", response, ""))
d <- transform(d, perceived_ethnicity= ifelse(stimulus=="perceived_ethnicity", response, ""))
d <- transform(d, empathic_beliefs= ifelse(stimulus=="empathic_beliefs", response, ""))
d <- transform(d, ymca= ifelse(stimulus=="ymca", response, ""))
##fixing values in new columns for transformation into new columns
##empathic reactions
d$empathic_reactions <- gsub("empathy","", d$empathic_reactions)
d$empathic_reactions <- gsub("sympathy","", d$empathic_reactions)
d$empathic_reactions <- gsub("compassion","", d$empathic_reactions)
d$empathic_reactions <- gsub("\\{|\\}","",d$empathic_reactions)
d$empathic_reactions <- gsub('"', "", d$empathic_reactions, fixed=TRUE)
d$empathic_reactions <- gsub(',', "", d$empathic_reactions, fixed=TRUE)
dd <- str_split_fixed(d$empathic_reactions, ":", 4)
dd <- dd[,-1]
colnames(dd) <- c("empathy","sympathy","compassion")
d <- cbind(d,dd)
##empathic drivers
d$empathic_drivers <- gsub("affect","", d$empathic_drivers)
d$empathic_drivers <- gsub("relating","", d$empathic_drivers)
d$empathic_drivers <- gsub("motivation","", d$empathic_drivers)
d$empathic_drivers <- gsub("\\{|\\}","",d$empathic_drivers)
d$empathic_drivers <- gsub('"', "", d$empathic_drivers, fixed=TRUE)
d$empathic_drivers <- gsub(',', "", d$empathic_drivers, fixed=TRUE)
dd <- str_split_fixed(d$empathic_drivers, ":", 4)
dd <- dd[,-1]
colnames(dd) <- c("affect","relating","motivation")
d <- cbind(d,dd)
##empathic_beliefs
d$empathic_beliefs <- gsub("limitiedresource","", d$empathic_beliefs)
d$empathic_beliefs <- gsub("ability","", d$empathic_beliefs)
d$empathic_beliefs <- gsub("attention2","", d$empathic_beliefs)
d$empathic_beliefs <- gsub("empmotivation","", d$empathic_beliefs)
d$empathic_beliefs <- gsub("\\{|\\}","",d$empathic_beliefs)
d$empathic_beliefs <- gsub('"', "", d$empathic_beliefs, fixed=TRUE)
d$empathic_beliefs <- gsub(',', "", d$empathic_beliefs, fixed=TRUE)
dd <- str_split_fixed(d$empathic_beliefs, ":", 5)
dd <- dd[,-1]
colnames(dd) <- c("limitiedresource","ability","attention2","empmotivation")
d <- cbind(d,dd)
##ymca
d$ymca <- gsub("ymca","", d$ymca)
d$ymca <- gsub("[[:punct:]]", " ", d$ymca)
d$ymca <- gsub(" ", "", d$ymca)
##percevied_ethnicity
d$perceived_ethnicity <-gsub("John_ethnicity","",d$perceived_ethnicity)
d$perceived_ethnicity <- gsub("[[:punct:]]", " ", d$perceived_ethnicity)
d$perceived_ethnicity <- gsub(" ", "", d$perceived_ethnicity)
##attention1
d$attention1 <-gsub("P0_Q0","",d$attention1)
d$attention1 <- gsub("[[:punct:]]", " ", d$attention1)
d$attention1 <- gsub(" ", "", d$attention1)
##new columns as numeric
d$empathy <- as.numeric(d$empathy)
d$sympathy <- as.numeric(d$sympathy)
d$compassion <- as.numeric(d$compassion)
d$affect <- as.numeric(d$affect)
d$relating <- as.numeric(d$relating)
d$motivation <- as.numeric(d$motivation)
d$limitiedresource <- as.numeric(d$limitiedresource)
d$ability <- as.numeric(d$ability)
d$empmotivation <- as.numeric(d$empmotivation)
d$attention2 <- as.numeric(d$attention2)
d$ymca <- as.numeric(d$ymca)
d$donation <- as.numeric(d$donation)
d$intervention_response <- as.numeric(d$intervention_response)
##rescaling new numeric columns from 0-6 to 1-7
##empathy
d$empathy[d$empathy == 6] <- 7
d$empathy[d$empathy == 5] <- 6
d$empathy[d$empathy == 4] <- 5
d$empathy[d$empathy == 3] <- 4
d$empathy[d$empathy == 2] <- 3
d$empathy[d$empathy == 1] <- 2
d$empathy[d$empathy == 0] <- 1
##sympathy
d$sympathy[d$sympathy == 6] <- 7
d$sympathy[d$sympathy == 5] <- 6
d$sympathy[d$sympathy == 4] <- 5
d$sympathy[d$sympathy == 3] <- 4
d$sympathy[d$sympathy == 2] <- 3
d$sympathy[d$sympathy == 1] <- 2
d$sympathy[d$sympathy == 0] <- 1
##compassion
d$compassion[d$compassion == 6] <- 7
d$compassion[d$compassion == 5] <- 6
d$compassion[d$compassion == 4] <- 5
d$compassion[d$compassion == 3] <- 4
d$compassion[d$compassion == 2] <- 3
d$compassion[d$compassion == 1] <- 2
d$compassion[d$compassion == 0] <- 1
##affect
d$affect[d$affect == 6] <- 7
d$affect[d$affect == 5] <- 6
d$affect[d$affect == 4] <- 5
d$affect[d$affect == 3] <- 4
d$affect[d$affect == 2] <- 3
d$affect[d$affect == 1] <- 2
d$affect[d$affect == 0] <- 1
##relating
d$relating[d$relating == 6] <- 7
d$relating[d$relating == 5] <- 6
d$relating[d$relating == 4] <- 5
d$relating[d$relating == 3] <- 4
d$relating[d$relating == 2] <- 3
d$relating[d$relating == 1] <- 2
d$relating[d$relating == 0] <- 1
##motivation
d$motivation[d$motivation == 6] <- 7
d$motivation[d$motivation == 5] <- 6
d$motivation[d$motivation == 4] <- 5
d$motivation[d$motivation == 3] <- 4
d$motivation[d$motivation == 2] <- 3
d$motivation[d$motivation == 1] <- 2
d$motivation[d$motivation == 0] <- 1
##limitiedresource
d$limitiedresource[d$limitiedresource == 6] <- 7
d$limitiedresource[d$limitiedresource == 5] <- 6
d$limitiedresource[d$limitiedresource == 4] <- 5
d$limitiedresource[d$limitiedresource == 3] <- 4
d$limitiedresource[d$limitiedresource == 2] <- 3
d$limitiedresource[d$limitiedresource == 1] <- 2
d$limitiedresource[d$limitiedresource == 0] <- 1
##ability
d$ability[d$ability == 6] <- 7
d$ability[d$ability == 5] <- 6
d$ability[d$ability == 4] <- 5
d$ability[d$ability == 3] <- 4
d$ability[d$ability == 2] <- 3
d$ability[d$ability == 1] <- 2
d$ability[d$ability == 0] <- 1
##empmotivation
d$empmotivation[d$empmotivation == 6] <- 7
d$empmotivation[d$empmotivation == 5] <- 6
d$empmotivation[d$empmotivation == 4] <- 5
d$empmotivation[d$empmotivation == 3] <- 4
d$empmotivation[d$empmotivation == 2] <- 3
d$empmotivation[d$empmotivation == 1] <- 2
d$empmotivation[d$empmotivation == 0] <- 1
##attention2
d$attention2[d$attention2 == 6] <- 7
d$attention2[d$attention2 == 5] <- 6
d$attention2[d$attention2 == 4] <- 5
d$attention2[d$attention2 == 3] <- 4
d$attention2[d$attention2 == 2] <- 3
d$attention2[d$attention2 == 1] <- 2
d$attention2[d$attention2 == 0] <- 1
##ymca
d$ymca[d$ymca == 6] <- 7
d$ymca[d$ymca == 5] <- 6
d$ymca[d$ymca == 4] <- 5
d$ymca[d$ymca == 3] <- 4
d$ymca[d$ymca == 2] <- 3
d$ymca[d$ymca == 1] <- 2
d$ymca[d$ymca == 0] <- 1
##calculating empathic_reactions
d$empathic_reactions <-rowSums(cbind(d$empathy, d$sympathy, d$compassion), na.rm = F )
d$empathic_reactions <- d$empathic_reactions/ 3
d$empathic_reactions <-round(d$empathic_reactions, digits = 1)
##calculating empathic_drivers
d$empathic_drivers <-rowSums(cbind(d$affect, d$relate, d$motivation), na.rm = F )
d$empathic_drivers <- d$empathic_drivers/ 3
d$empathic_drivers <-round(d$empathic_drivers, digits = 1)
##calculating empathic_beliefs
d$empathic_beliefs <-rowSums(cbind(d$limitiedresource, d$ability, d$empmotivation), na.rm = F )
d$empathic_beliefs <- d$empathic_beliefs/ 3
d$empathic_beliefs <-round(d$empathic_beliefs, digits = 1)
## get value at trial 1 for each participant
d <- within(d, empathy[ trial_index == 0] <-(d$empathy[ trial_index == 6]))
d <- within(d, sympathy[ trial_index == 0] <-(d$sympathy[ trial_index == 6]))
d <- within(d, compassion[ trial_index == 0] <-(d$compassion[ trial_index == 6]))
d <- within(d, affect[ trial_index == 0] <-(d$affect[ trial_index == 7]))
d <- within(d, relating[ trial_index == 0] <-(d$relating[ trial_index == 7]))
d <- within(d, motivation[ trial_index == 0] <-(d$motivation[ trial_index == 7]))
d <- within(d, limitiedresource[ trial_index == 0] <-(d$limitiedresource[ trial_index == 10]))
d <- within(d, ability[ trial_index == 0] <-(d$ability[ trial_index == 10]))
d <- within(d, empmotivation[ trial_index == 0] <-(d$empmotivation[ trial_index == 10]))
d <- within(d, attention1[ trial_index == 0] <-(d$attention1[ trial_index == 3]))
d <- within(d, attention2[ trial_index == 0] <-(d$attention2[ trial_index == 10]))
d <- within(d, ymca[ trial_index == 0] <-(d$ymca[ trial_index == 11]))
d <- within(d, intervention_response[ trial_index == 0] <-(d$intervention_response[ trial_index == 2]))
d <- within(d, donation[ trial_index == 0] <-(d$donation[ trial_index == 8]))
d <- within(d, perceived_ethnicity[ trial_index == 0] <-(d$perceived_ethnicity[ trial_index == 9]))
d <- within(d, empathic_reactions[ trial_index == 0] <-(d$empathic_reactions[ trial_index == 6]))
d <- within(d, empathic_drivers[ trial_index == 0] <-(d$empathic_drivers[ trial_index == 7]))
d <- within(d, empathic_beliefs[ trial_index == 0] <-(d$empathic_beliefs[ trial_index == 10]))
##fill blank rows with values in column
d <-d %>% fill(empathy)
d <-d %>% fill(sympathy)
d <-d %>% fill(compassion)
d <-d %>% fill(affect)
d <-d %>% fill(relating)
d <-d %>% fill(motivation)
d <-d %>% fill(ability)
d <-d %>% fill(limitiedresource)
d <-d %>% fill(empmotivation)
##transforming chr to numeric and back again for fill to work
d$attention1[d$attention1 == "Pete"] <- 1
d$attention1[d$attention1 == "Matt"] <- 2
d$attention1 <- as.numeric(d$attention1)
d <-d %>% fill(attention1)
d$attention1[d$attention1 == 1] <- "Pete"
d$attention1[d$attention1 == 2] <- "Matt"
d$attention1 <- as.character(d$attention1)
d <-d %>% fill(attention2)
d <-d %>% fill(ymca)
d <-d %>% fill(intervention_response)
d <-d %>% fill(donation)
##transforming chr to numeric and back again for fill to work
d$perceived_ethnicity[d$perceived_ethnicity == "AmericanIndian"] <- 1
d$perceived_ethnicity[d$perceived_ethnicity == "Black"] <- 2
d$perceived_ethnicity[d$perceived_ethnicity == "Dontwanttoanswer"] <- 3
d$perceived_ethnicity[d$perceived_ethnicity == "Latino"] <- 4
d$perceived_ethnicity[d$perceived_ethnicity == "Other"] <- 5
d$perceived_ethnicity[d$perceived_ethnicity == "White"] <- 6
d$perceived_ethnicity <- as.numeric(d$perceived_ethnicity)
d <-d %>% fill(perceived_ethnicity)
d$perceived_ethnicity[d$perceived_ethnicity == 1] <- "AmericanIndian"
d$perceived_ethnicity[d$perceived_ethnicity == 2] <- "Black"
d$perceived_ethnicity[d$perceived_ethnicity == 3] <- "Dontwanttoanswer"
d$perceived_ethnicity[d$perceived_ethnicity == 4] <- "Latino"
d$perceived_ethnicity[d$perceived_ethnicity == 5] <- "Other"
d$perceived_ethnicity[d$perceived_ethnicity == 6] <- "White"
d$perceived_ethnicity <- as.character(d$perceived_ethnicity)
d <-d %>% fill(empathic_reactions)
d <-d %>% fill(empathic_drivers)
d <-d %>% fill(empathic_beliefs)
## demographic data frame
d_demo <-read.delim("Documents/r_intervention/demo_john_230818.txt")
## change column name for participant
colnames(d_demo)[2] = "PROLIFIC_PID"
##delete redundant columns
d <- d[,-c(1,8,9,10)]
##delete duplicate values
d <- d[!duplicated(d), ]
##delete rows with participants that partook in experiment multiple times
d <- d %>% distinct(PROLIFIC_PID, .keep_all = TRUE)
##check that participants have demographic data from Prolific
anti_join(d, d_demo, by= "PROLIFIC_PID")
## run_id condition recorded_at PROLIFIC_PID
## 1 261 3 2023-07-06 13:50:15 6064a0185b9ce0ca98b5e791
## 2 284 3 2023-07-06 14:15:29 63a77363dd6fabebef211019
## STUDY_ID SESSION_ID story attention1
## 1 64a67a40792efdf72df30532 64a6c690ad06e511c9476a8a John Pete
## 2 64a67a40792efdf72df30532 64a6cc6e2cda4468d644e00a John Pete
## intervention_response donation empathic_reactions empathic_drivers
## 1 100 50 7 3.7
## 2 91 75 7 3.7
## perceived_ethnicity empathic_beliefs ymca empathy sympathy compassion affect
## 1 White 7.0 7 7 7 7 5
## 2 Dontwanttoanswer 6.7 5 7 7 7 4
## relating motivation limitiedresource ability attention2 empmotivation
## 1 7 6 7 7 7 7
## 2 7 7 7 6 4 7
##delete rows with particpants without demographic data
d<-d[!(d$PROLIFIC_PID=="63a77363dd6fabebef211019" | d$PROLIFIC_PID=="6064a0185b9ce0ca98b5e791"),]
## check to remove participants that had multiple entries from demographic data
anti_join(d_demo, d, by= "PROLIFIC_PID")
## Submission.id PROLIFIC_PID Status
## 1 64a68b7e206b9a2a5a2ea6bd 646bb53fd47acd7f1ac76033 APPROVED
## 2 64a697dba1321cbd4237c407 6486c67b3237644e4eaef315 APPROVED
## 3 64a69de357df9e952c8bcc27 643adb4a213b87bfc7e21e3f APPROVED
## 4 64a6d027fb3105d62b1e2433 638623ae470ca58f7700fd90 APPROVED
## 5 64a6dad703876bcedbaf5b3c 60e8b06bfb1c78d450ae9f79 APPROVED
## Started.at Completed.at
## 1 2023-07-06T09:38:06.945000Z 2023-07-06T09:57:52.364000Z
## 2 2023-07-06T10:38:40.442000Z 2023-07-06T10:46:11.024000Z
## 3 2023-07-06T10:56:35.617000Z 2023-07-06T11:12:03.518000Z
## 4 2023-07-06T14:31:11.076000Z 2023-07-06T14:51:03.044000Z
## 5 2023-07-06T15:16:52.903000Z 2023-07-06T15:28:45.383000Z
## Reviewed.at Archived.at Time.taken
## 1 2023-07-27T00:00:12.027000 2023-07-06T09:57:52.812967Z 1186
## 2 2023-07-27T00:00:16.862000 2023-07-06T10:46:11.444738Z 451
## 3 2023-07-27T00:00:21.914000 2023-07-06T11:12:04.164687Z 928
## 4 2023-07-27T00:01:20.808000 2023-07-06T14:51:04.725683Z 1192
## 5 2023-07-27T00:01:25.441000 2023-07-06T15:28:46.124225Z 713
## Completion.code Total.approvals Highest.education.level.completed Age
## 1 CIDZFKYQ 218 Undergraduate degree (BA/BSc/other) 66
## 2 CIDZFKYQ 104 Undergraduate degree (BA/BSc/other) 48
## 3 CIDZFKYQ 432 Doctorate degree (PhD/other) 47
## 4 CIDZFKYQ 315 Technical/community college 50
## 5 CIDZFKYQ 4314 Undergraduate degree (BA/BSc/other) 48
## Sex Ethnicity.simplified Country.of.birth Country.of.residence
## 1 Male Black Nigeria United States
## 2 Male Black Ghana United States
## 3 Female Black United States United States
## 4 Female Black Bermuda United States
## 5 Male Black United States United States
## Nationality Language Student.status Employment.status
## 1 Nigeria English DATA_EXPIRED DATA_EXPIRED
## 2 United States English No Full-Time
## 3 United States English No Full-Time
## 4 Bermuda English DATA_EXPIRED DATA_EXPIRED
## 5 United States English No Full-Time
##d_demo %>% filter_all(any_vars(. %in% c("6064a0185b9ce0ca98b5e791")))
d_demo <- d_demo[!d_demo$PROLIFIC_PID %in% c("646bb53fd47acd7f1ac76033","6486c67b3237644e4eaef315","643adb4a213b87bfc7e21e3f","638623ae470ca58f7700fd90","60e8b06bfb1c78d450ae9f79"),]
d_demo <- d_demo[order(d_demo$PROLIFIC_PID),]
d <- d[order(d$PROLIFIC_PID),]
d<- merge(x=d,y=d_demo,by="PROLIFIC_PID", all=TRUE)
d <- d[,-c(4,5,6,26:34,39:44)]
outgroup_fp_black <- d[d$perceived_ethnicity == "White",]
ingroup_fp_black <- d[d$perceived_ethnicity == "Black",]
##add new dataset "Tyrone"
g <- read.delim("Documents/r_intervention/tyrone_real_data_230822.tsv")
## remove unnecessary columns
g <- g[, - c(35,36)]
g <- g[,-23:-35]
g <- g [,-c(1,2,4,5,9,10,11,12,13,14,15,16)]
## add column with story value
g$story <- "Tyrone"
## Insert new string values in column "stimulus"
## prep for changing string value in column "stimulus"
g$stimulus <- gsub("[[:punct:]]", " ", g$stimulus)
g$stimulus <- gsub(" ", "", g$stimulus)
g$stimulus <- str_to_lower(g$stimulus)
g$stimulus <- trimws(g$stimulus)
g$stimulus <- gsub("[\r\n]", "", g$stimulus)
## change string value to "donation"
g$stimulus <-gsub ("h2bopportunitytodonatetotheymcabh2pidtextyouandeveryoneelsethatparticipatesinthisexperimentwillreceiveabonuspaymentof1pound100pencethisbonuspaymentisanadditionalpaymenttothebasicpaymentthatyoureceiveforparticipatinginthisexperimentwhateveryouchoosetodowithyourbonuspaymentyouwillreceiveyourbasicpaymentforparticipatinginthisexperimentppidtextasyouknowtyroneandpeoplelikehimreceivehelpfromtheymcayoucanchoosetodonatesomeorallofyourbonuspaymenttotheymcaandtherebyhelppeopleliketyronebnotebthatwhateveramountyouchoosetodonatewillbearealdonationtotheymcathattheresearchersconductingthisstudywillmakeonceitiscompletedppidtextmakeyourchoicebyusingthesliderbelowemmaximumamountthatcanbedonatedis100penceemyoucanalsochoosetonotdonateanymoneytotheymcabymovingthecursorto0theamountyouchoosetodonatewillbedeductedfromyourbonuspaymentp","donation",g$stimulus)
## change string value to "intervention"
g$stimulus <-gsub("pidtextbdefinitionbempathyisdefinedastheabilitytounderstandandsharethefeelingsandthoughtsofothersforexampleempathizingwithsomeoneindistressinvolvesunderstandingthesituationfromhisherperspectiveandfeelinghishernegativeemotionsppidtextrecentstudieshaveshownthatemwecanregulateourempathyemandthatitisnotarigidtraitthatiswecanbecomemoreempathicifwetrytoempathizewithpeoplesomeofthesestudiesalsoshowedthatwhenpeoplelearnedthatwecanregulateourempathytheyputmoreeffortintobecomingmoreempathicppidtextimaginethatyoufindyourselfinasocialsituationwhereyouwouldwanttobeempathichowmuchwouldyoubeabletoincreaseyourempathyinthatsituationppidtextpleaseanswerbyusingthescalebelowppidtextbfrom0biwouldnotbeabletoincreasemyempathyatallbto100biwouldbeabletoincreasemyempathyalotp", "intervention", g$stimulus)
g$stimulus <-gsub("pidtextbdefinitionbempathyisdefinedastheabilitytounderstandandsharethefeelingsandthoughtsofothersforexampleempathizingwithsomeoneindistressinvolvesunderstandingthesituationfromhisherperspectiveandfeelinghishernegativeemotionsppidtextrecentstudieshavefoundthatemempathyisalimitedresourceemsopeopleemcannotfeelemittowardalargenumberofpeopleppidtextimaginethatyouareabouttomeetpeopleindistresstowardhowmanyofthemcouldyoufeelempathyppidtextpleaseanswerhowmanypeopleyoucanempathizewithbyusingthescalebelowppidtextbfrom0bcantfeelempathytowardanyonebto3bcanfeelempathytowardthreepeoplep", "intervention", g$stimulus)
g$stimulus <-gsub("pidtextbdefinitionbempathyisdefinedastheabilitytounderstandandsharethefeelingsandthoughtsofothersforexampleempathizingwithsomeoneindistressinvolvesunderstandingthesituationfromhisherperspectiveandfeelinghishernegativeemotionsppidtextempathyishighlyvaluedinmostcommunitiesseveralstudiesdemonstratethatpeoplestronglyvalueempathyandexpectothersintheircommunitytobeempathicemempathicpeoplearealsowelllikedbytheirpeersembecausetheybetterunderstandthosearoundthemaspeoplelearnthattheircommunityvaluesempathytheyoftenputmoreeffortintorelatingtoandunderstandingothersppidtextimaginethatyoufindyourselfinasocialsituationwhereyouwouldwanttobeempathichowmuchwouldyoubeabletoincreaseyourempathyinthatsituationppidtextpleaseanswerbyusingthescalebelowppidtextbfrom0biwouldnotbeabletoincreasemyempathyatallbto100biwouldbeabletoincreasemyempathyalotp", "intervention", g$stimulus)
g$stimulus <-gsub("pidtextfinancialinvestmentscanberiskyonaverageempeoplelosemoneywhenmakingstockinvestmentsemasmallpercentageofstockinvestorsmakethelargestgainstherestoftenlosemoneyontheirinvestmentssomepeoplecanbesounfortunatethattheylosemuchoftheirsavingsandsometimesfindthemselvesinproblematicfinancialsituationsppidtexthowriskydoyouthinkstockinvestmentsareppidtextpleaseanswerbyusingthescalebelowppidtextbfrom0bnotriskyatallbto100bveryriskyp", "intervention", g$stimulus)
g$stimulus <-gsub("pidtextbdefinitionbempathyisdefinedastheabilitytounderstandandsharethefeelingsandthoughtsofothersforexampleempathizingwithsomeoneindistressinvolvesunderstandingthesituationfromhisherperspectiveandfeelinghishernegativeemotionsppidtextrecentstudieshavefoundthatemempathyisanunlimitedresourceemsopeopleemcanfeelemittowardalargenumberofpeopleppidtextimaginethatyouareabouttomeetpeopleindistresstowardhowmanyofthemcouldyoufeelempathyppidtextpleaseanswerhowmanypeopleyoucanempathizewithbyusingthescalebelowppidtextbfrom0bcantfeelempathytowardanyonebto300bcanfeelempathytowardthreehundredpeoplep", "intervention", g$stimulus)
## adding new values to column "stimulus
g[g$stimulus == "" & g$trial_index == 3, "stimulus"] <- "attention1"
g[g$stimulus == "" & g$trial_index == 6, "stimulus"] <- "empathic_reactions"
g[g$stimulus == "" & g$trial_index == 7, "stimulus"] <- "empathic_drivers"
g[g$stimulus == "" & g$trial_index == 9, "stimulus"] <- "perceived_ethnicity"
g[g$stimulus == "" & g$trial_index == 10, "stimulus"] <- "empathic_beliefs"
g[g$stimulus == "" & g$trial_index == 11, "stimulus"] <- "ymca"
## create new columns for variables
g<- transform(g, attention1= ifelse(stimulus=="attention1", response, ""))
g <- transform(g, intervention_response= ifelse(stimulus=="intervention", response, ""))
g <- transform(g, donation= ifelse(stimulus=="donation", response, ""))
g <- transform(g, empathic_reactions= ifelse(stimulus=="empathic_reactions", response, ""))
g <- transform(g, empathic_drivers= ifelse(stimulus=="empathic_drivers", response, ""))
g <- transform(g, perceived_ethnicity= ifelse(stimulus=="perceived_ethnicity", response, ""))
g <- transform(g, empathic_beliefs= ifelse(stimulus=="empathic_beliefs", response, ""))
g <- transform(g, ymca= ifelse(stimulus=="ymca", response, ""))
##fixing values in new columns for transformation into new columns
##empathic reactions
g$empathic_reactions <- gsub("empathy","", g$empathic_reactions)
g$empathic_reactions <- gsub("sympathy","", g$empathic_reactions)
g$empathic_reactions <- gsub("compassion","", g$empathic_reactions)
g$empathic_reactions <- gsub("\\{|\\}","",g$empathic_reactions)
g$empathic_reactions <- gsub('"', "", g$empathic_reactions, fixed=TRUE)
g$empathic_reactions <- gsub(',', "", g$empathic_reactions, fixed=TRUE)
gg <- str_split_fixed(g$empathic_reactions, ":", 4)
gg <- gg[,-1]
colnames(gg) <- c("empathy","sympathy","compassion")
g <- cbind(g,gg)
##empathic drivers
g$empathic_drivers <- gsub("affect","", g$empathic_drivers)
g$empathic_drivers <- gsub("relating","", g$empathic_drivers)
g$empathic_drivers <- gsub("motivation","", g$empathic_drivers)
g$empathic_drivers <- gsub("\\{|\\}","",g$empathic_drivers)
g$empathic_drivers <- gsub('"', "", g$empathic_drivers, fixed=TRUE)
g$empathic_drivers <- gsub(',', "", g$empathic_drivers, fixed=TRUE)
gg <- str_split_fixed(g$empathic_drivers, ":", 4)
gg <- gg[,-1]
colnames(gg) <- c("affect","relating","motivation")
g <- cbind(g,gg)
##empathic_beliefs
g$empathic_beliefs <- gsub("limitiedresource","", g$empathic_beliefs)
g$empathic_beliefs <- gsub("ability","", g$empathic_beliefs)
g$empathic_beliefs <- gsub("attention2","", g$empathic_beliefs)
g$empathic_beliefs <- gsub("empmotivation","", g$empathic_beliefs)
g$empathic_beliefs <- gsub("\\{|\\}","",g$empathic_beliefs)
g$empathic_beliefs <- gsub('"', "", g$empathic_beliefs, fixed=TRUE)
g$empathic_beliefs <- gsub(',', "", g$empathic_beliefs, fixed=TRUE)
gg <- str_split_fixed(g$empathic_beliefs, ":", 5)
gg <- gg[,-1]
colnames(gg) <- c("limitiedresource","ability","attention2","empmotivation")
g <- cbind(g,gg)
##ymca
g$ymca <- gsub("ymca","", g$ymca)
g$ymca <- gsub("[[:punct:]]", " ", g$ymca)
g$ymca <- gsub(" ", "", g$ymca)
##percevied_ethnicity
g$perceived_ethnicity <-gsub("Tyrone_ethnicity","",g$perceived_ethnicity)
g$perceived_ethnicity <- gsub("[[:punct:]]", " ", g$perceived_ethnicity)
g$perceived_ethnicity <- gsub(" ", "", g$perceived_ethnicity)
##attention1
g$attention1 <-gsub("P0_Q0","",g$attention1)
g$attention1 <- gsub("[[:punct:]]", " ", g$attention1)
g$attention1 <- gsub(" ", "", g$attention1)
##new columns as numeric
g$empathy <- as.numeric(g$empathy)
g$sympathy <- as.numeric(g$sympathy)
g$compassion <- as.numeric(g$compassion)
g$affect <- as.numeric(g$affect)
g$relating <- as.numeric(g$relating)
g$motivation <- as.numeric(g$motivation)
g$limitiedresource <- as.numeric(g$limitiedresource)
g$ability <- as.numeric(g$ability)
g$empmotivation <- as.numeric(g$empmotivation)
g$attention2 <- as.numeric(g$attention2)
g$ymca <- as.numeric(g$ymca)
g$donation <- as.numeric(g$donation)
g$intervention_response <- as.numeric(g$intervention_response)
##rescaling new numeric columns from 0-6 to 1-7
##empathy
g$empathy[g$empathy == 6] <- 7
g$empathy[g$empathy == 5] <- 6
g$empathy[g$empathy == 4] <- 5
g$empathy[g$empathy == 3] <- 4
g$empathy[g$empathy == 2] <- 3
g$empathy[g$empathy == 1] <- 2
g$empathy[g$empathy == 0] <- 1
##sympathy
g$sympathy[g$sympathy == 6] <- 7
g$sympathy[g$sympathy == 5] <- 6
g$sympathy[g$sympathy == 4] <- 5
g$sympathy[g$sympathy == 3] <- 4
g$sympathy[g$sympathy == 2] <- 3
g$sympathy[g$sympathy == 1] <- 2
g$sympathy[g$sympathy == 0] <- 1
##compassion
g$compassion[g$compassion == 6] <- 7
g$compassion[g$compassion == 5] <- 6
g$compassion[g$compassion == 4] <- 5
g$compassion[g$compassion == 3] <- 4
g$compassion[g$compassion == 2] <- 3
g$compassion[g$compassion == 1] <- 2
g$compassion[g$compassion == 0] <- 1
##affect
g$affect[g$affect == 6] <- 7
g$affect[g$affect == 5] <- 6
g$affect[g$affect == 4] <- 5
g$affect[g$affect == 3] <- 4
g$affect[g$affect == 2] <- 3
g$affect[g$affect == 1] <- 2
g$affect[g$affect == 0] <- 1
##relating
g$relating[g$relating == 6] <- 7
g$relating[g$relating == 5] <- 6
g$relating[g$relating == 4] <- 5
g$relating[g$relating == 3] <- 4
g$relating[g$relating == 2] <- 3
g$relating[g$relating == 1] <- 2
g$relating[g$relating == 0] <- 1
##motivation
g$motivation[g$motivation == 6] <- 7
g$motivation[g$motivation == 5] <- 6
g$motivation[g$motivation == 4] <- 5
g$motivation[g$motivation == 3] <- 4
g$motivation[g$motivation == 2] <- 3
g$motivation[g$motivation == 1] <- 2
g$motivation[g$motivation == 0] <- 1
##limitiedresource
g$limitiedresource[g$limitiedresource == 6] <- 7
g$limitiedresource[g$limitiedresource == 5] <- 6
g$limitiedresource[g$limitiedresource == 4] <- 5
g$limitiedresource[g$limitiedresource == 3] <- 4
g$limitiedresource[g$limitiedresource == 2] <- 3
g$limitiedresource[g$limitiedresource == 1] <- 2
g$limitiedresource[g$limitiedresource == 0] <- 1
##ability
g$ability[g$ability == 6] <- 7
g$ability[g$ability == 5] <- 6
g$ability[g$ability == 4] <- 5
g$ability[g$ability == 3] <- 4
g$ability[g$ability == 2] <- 3
g$ability[g$ability == 1] <- 2
g$ability[g$ability == 0] <- 1
##empmotivation
g$empmotivation[g$empmotivation == 6] <- 7
g$empmotivation[g$empmotivation == 5] <- 6
g$empmotivation[g$empmotivation == 4] <- 5
g$empmotivation[g$empmotivation == 3] <- 4
g$empmotivation[g$empmotivation == 2] <- 3
g$empmotivation[g$empmotivation == 1] <- 2
g$empmotivation[g$empmotivation == 0] <- 1
##attention2
g$attention2[g$attention2 == 6] <- 7
g$attention2[g$attention2 == 5] <- 6
g$attention2[g$attention2 == 4] <- 5
g$attention2[g$attention2 == 3] <- 4
g$attention2[g$attention2 == 2] <- 3
g$attention2[g$attention2 == 1] <- 2
g$attention2[g$attention2 == 0] <- 1
##ymca
g$ymca[g$ymca == 6] <- 7
g$ymca[g$ymca == 5] <- 6
g$ymca[g$ymca == 4] <- 5
g$ymca[g$ymca == 3] <- 4
g$ymca[g$ymca == 2] <- 3
g$ymca[g$ymca == 1] <- 2
g$ymca[g$ymca == 0] <- 1
##calculating empathic_reactions
g$empathic_reactions <-rowSums(cbind(g$empathy, g$sympathy, g$compassion), na.rm = F )
g$empathic_reactions <- g$empathic_reactions/ 3
g$empathic_reactions <-round(g$empathic_reactions, digits = 1)
##calculating empathic_drivers
g$empathic_drivers <-rowSums(cbind(g$affect, g$relate, g$motivation), na.rm = F )
g$empathic_drivers <- g$empathic_drivers/ 3
g$empathic_drivers <-round(g$empathic_drivers, digits = 1)
##calculating empathic_beliefs
g$empathic_beliefs <-rowSums(cbind(g$limitiedresource, g$ability, g$empmotivation), na.rm = F )
g$empathic_beliefs <- g$empathic_beliefs/ 3
g$empathic_beliefs <-round(g$empathic_beliefs, digits = 1)
## get value at trial 1 for each participant
g <- within(g, empathy[ trial_index == 0] <-(g$empathy[ trial_index == 6]))
g <- within(g, sympathy[ trial_index == 0] <-(g$sympathy[ trial_index == 6]))
g <- within(g, compassion[ trial_index == 0] <-(g$compassion[ trial_index == 6]))
g <- within(g, affect[ trial_index == 0] <-(g$affect[ trial_index == 7]))
g <- within(g, relating[ trial_index == 0] <-(g$relating[ trial_index == 7]))
g <- within(g, motivation[ trial_index == 0] <-(g$motivation[ trial_index == 7]))
g <- within(g, limitiedresource[ trial_index == 0] <-(g$limitiedresource[ trial_index == 10]))
g <- within(g, ability[ trial_index == 0] <-(g$ability[ trial_index == 10]))
g <- within(g, empmotivation[ trial_index == 0] <-(g$empmotivation[ trial_index == 10]))
g <- within(g, attention1[ trial_index == 0] <-(g$attention1[ trial_index == 3]))
g <- within(g, attention2[ trial_index == 0] <-(g$attention2[ trial_index == 10]))
g <- within(g, ymca[ trial_index == 0] <-(g$ymca[ trial_index == 11]))
g <- within(g, intervention_response[ trial_index == 0] <-(g$intervention_response[ trial_index == 2]))
g <- within(g, donation[ trial_index == 0] <-(g$donation[ trial_index == 8]))
g <- within(g, perceived_ethnicity[ trial_index == 0] <-(g$perceived_ethnicity[ trial_index == 9]))
g <- within(g, empathic_reactions[ trial_index == 0] <-(g$empathic_reactions[ trial_index == 6]))
g <- within(g, empathic_drivers[ trial_index == 0] <-(g$empathic_drivers[ trial_index == 7]))
g <- within(g, empathic_beliefs[ trial_index == 0] <-(g$empathic_beliefs[ trial_index == 10]))
##fill blank rows with values in column
g <-g %>% fill(empathy)
g <-g %>% fill(sympathy)
g <-g %>% fill(compassion)
g <-g %>% fill(affect)
g <-g %>% fill(relating)
g <-g %>% fill(motivation)
g <-g %>% fill(ability)
g <-g %>% fill(limitiedresource)
g <-g %>% fill(empmotivation)
##transforming chr to numeric and back again for fill to work
g$attention1[g$attention1 == "Pete"] <- 1
g$attention1 <- as.numeric(g$attention1)
## Warning: NAs introduced by coercion
g <-g %>% fill(attention1)
g$attention1[g$attention1 == 1] <- "Pete"
g$attention1 <- as.character(g$attention1)
g <-g %>% fill(attention2)
g <-g %>% fill(ymca)
g <-g %>% fill(intervention_response)
g <-g %>% fill(donation)
##transforming chr to numeric and back again for fill to work
g$perceived_ethnicity[g$perceived_ethnicity == "Black"] <- 2
g$perceived_ethnicity[g$perceived_ethnicity == "Dontwanttoanswer"] <- 3
g$perceived_ethnicity[g$perceived_ethnicity == "Latino"] <- 4
g$perceived_ethnicity[g$perceived_ethnicity == "Other"] <- 5
g$perceived_ethnicity[g$perceived_ethnicity == "White"] <- 6
g$perceived_ethnicity <- as.numeric(g$perceived_ethnicity)
g <-g %>% fill(perceived_ethnicity)
g$perceived_ethnicity[g$perceived_ethnicity == 2] <- "Black"
g$perceived_ethnicity[g$perceived_ethnicity == 3] <- "Dontwanttoanswer"
g$perceived_ethnicity[g$perceived_ethnicity == 4] <- "Latino"
g$perceived_ethnicity[g$perceived_ethnicity == 5] <- "Other"
g$perceived_ethnicity[g$perceived_ethnicity == 6] <- "White"
g$perceived_ethnicity <- as.character(g$perceived_ethnicity)
g <-g %>% fill(empathic_reactions)
g <-g %>% fill(empathic_drivers)
g <-g %>% fill(empathic_beliefs)
g_demo <-read.delim("Documents/r_intervention/demo_tyrone_230822.txt")
## change column name for participant
colnames(g_demo)[2] = "PROLIFIC_PID"
##delete redundant columns
g <- g[,-c(1,8,9,10)]
##delete duplicate values
g <- g[!duplicated(g), ]
##delete rows with participants that partook in experiment multiple times
g <- g %>% distinct(PROLIFIC_PID, .keep_all = TRUE)
##check that participants have demographic data from Prolific
anti_join(g, g_demo, by= "PROLIFIC_PID")
## run_id condition recorded_at PROLIFIC_PID
## 1 242 3 2023-07-06 11:07:34 5d344bd3b0f315001a122275
## STUDY_ID SESSION_ID story attention1
## 1 64a5f17da12407ff9cdd2b1a 64a6a06f5992877cbe0da9f9 Tyrone Pete
## intervention_response donation empathic_reactions empathic_drivers
## 1 87 50 7 4
## perceived_ethnicity empathic_beliefs ymca empathy sympathy compassion affect
## 1 Black 5 7 7 7 7 6
## relating motivation limitiedresource ability attention2 empmotivation
## 1 5 6 3 5 4 7
##delete rows with particpants without demographic data
g<-g[!(g$PROLIFIC_PID=="5d344bd3b0f315001a122275"),]
## check to remove participants that had multiple entries from demographic data
anti_join(g_demo, g, by= "PROLIFIC_PID")
## Submission.id PROLIFIC_PID Status
## 1 64a68fbbec883656591d9af7 60ef4d541f9d5122ffad5d48 APPROVED
## 2 64a69e621e36c867bc618e77 648c815013ff60a0d783f986 APPROVED
## 3 64a69e7a16cfab9180a700a5 640f4e73468a5f639101e483 APPROVED
## 4 64a69ead93626118f571d094 647ffbcfcf8adc8070bc2291 APPROVED
## Started.at Completed.at
## 1 2023-07-06T10:02:36.023000Z 2023-07-06T10:15:08.116000Z
## 2 2023-07-06T10:58:50.576000Z 2023-07-06T11:06:02.190000Z
## 3 2023-07-06T10:59:13.238000Z 2023-07-06T11:05:47.806000Z
## 4 2023-07-06T11:00:07.187000Z 2023-07-06T11:12:46.587000Z
## Reviewed.at Archived.at Time.taken
## 1 2023-07-27T00:00:46.778000 2023-07-06T10:15:08.578701Z 753
## 2 2023-07-27T00:01:07.453000 2023-07-06T11:06:02.657434Z 432
## 3 2023-07-27T00:01:07.799000 2023-07-06T11:05:48.306397Z 395
## 4 2023-07-27T00:01:08.931000 2023-07-06T11:12:47.169929Z 760
## Completion.code Total.approvals Highest.education.level.completed Age
## 1 CIDZFKYQ 1905 High school diploma/A-levels 26
## 2 CIDZFKYQ 130 Doctorate degree (PhD/other) 65
## 3 CIDZFKYQ 452 Graduate degree (MA/MSc/MPhil/other) 56
## 4 CIDZFKYQ 235 Undergraduate degree (BA/BSc/other) 61
## Sex Ethnicity.simplified Country.of.birth Country.of.residence
## 1 Male White United States United States
## 2 Male White United States United States
## 3 Male White United States United States
## 4 Female White United States United States
## Nationality Language Student.status Employment.status
## 1 United States English No Full-Time
## 2 United States English Yes Full-Time
## 3 United States English No Full-Time
## 4 United States English Yes Full-Time
##d_demo %>% filter_all(any_vars(. %in% c("6064a0185b9ce0ca98b5e791")))
g_demo <- g_demo[!g_demo$PROLIFIC_PID %in% c("60ef4d541f9d5122ffad5d48","648c815013ff60a0d783f986","640f4e73468a5f639101e483","647ffbcfcf8adc8070bc2291"),]
g_demo <- g_demo[order(g_demo$PROLIFIC_PID),]
g <- g[order(g$PROLIFIC_PID),]
g <- merge(x=g,y=g_demo,by="PROLIFIC_PID", all=TRUE)
g <- g[,-c(4,5,6,26:34,39:44)]
outgroup_fp_white <- g[g$perceived_ethnicity == "Black",]
ingroup_fp_white <- g[g$perceived_ethnicity == "White",]
## kom ihåg att byta Run_ID mellan dataset eller droppa kolumnen
outgroup <- rbind(outgroup_fp_black,outgroup_fp_white)
ingroup <- rbind(ingroup_fp_black,ingroup_fp_white)
## analysis
library(brms)
## Loading required package: Rcpp
## Loading 'brms' package (version 2.20.1). Useful instructions
## can be found by typing help('brms'). A more detailed introduction
## to the package is available through vignette('brms_overview').
##
## Attaching package: 'brms'
##
## The following object is masked from 'package:stats':
##
## ar
library(bayesplot)
## This is bayesplot version 1.10.0
## - Online documentation and vignettes at mc-stan.org/bayesplot
## - bayesplot theme set to bayesplot::theme_default()
## * Does _not_ affect other ggplot2 plots
## * See ?bayesplot_theme_set for details on theme setting
##
## Attaching package: 'bayesplot'
##
## The following object is masked from 'package:brms':
##
## rhat
library(psych)
##
## Attaching package: 'psych'
##
## The following object is masked from 'package:brms':
##
## cs
##
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
##conditon as charachter for both dataframes
outgroup$condition <-as.character(outgroup$condition)
ingroup$condition <-as.character(ingroup$condition)
##changing names on levels for condition column
outgroup[outgroup$condition == 1, "condition"] <- "Limited"
outgroup[outgroup$condition == 2, "condition"] <- "Unlimited"
outgroup[outgroup$condition == 3, "condition"] <- "Malleable"
outgroup[outgroup$condition == 4, "condition"] <- "Normative"
outgroup[outgroup$condition == 5, "condition"] <- "Control"
ingroup[ingroup$condition == 1, "condition"] <- "Limited"
ingroup[ingroup$condition == 2, "condition"] <- "Unlimited"
ingroup[ingroup$condition == 3, "condition"] <- "Malleable"
ingroup[ingroup$condition == 4, "condition"] <- "Normative"
ingroup[ingroup$condition == 5, "condition"] <- "Control"
##standardizing columns of interest
outgroup <- outgroup %>% mutate_at(c('empathic_reactions'), ~(scale(.) %>% as.vector))
outgroup <- outgroup %>% mutate_at(c('empathic_drivers'), ~(scale(.) %>% as.vector))
outgroup <- outgroup %>% mutate_at(c('empathic_beliefs'), ~(scale(.) %>% as.vector))
outgroup <- outgroup %>% mutate_at(c('donation'), ~(scale(.) %>% as.vector))
ingroup <- ingroup %>% mutate_at(c('empathic_reactions'), ~(scale(.) %>% as.vector))
ingroup <- ingroup %>% mutate_at(c('empathic_drivers'), ~(scale(.) %>% as.vector))
ingroup <- ingroup %>% mutate_at(c('empathic_beliefs'), ~(scale(.) %>% as.vector))
ingroup <- ingroup %>% mutate_at(c('donation'), ~(scale(.) %>% as.vector))
knitr::opts_chunk$set(echo = TRUE)
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
out_emp_rea <- brm(data = outgroup, family = gaussian,
empathic_reactions ~ 0 + condition,
prior = c(prior(normal(0, 1), class = b),
prior(exponential(1), class = sigma)),
iter = 2000, warmup = 500, chains = 4, cores = 4,
seed = 5,
backend = "cmdstan",
silent = 0)
## In file included from stan/src/stan/model/model_header.hpp:11:
## stan/src/stan/model/model_base_crtp.hpp:198: warning: 'void stan::model::model_base_crtp<M>::write_array(boost::random::ecuyer1988&, std::vector<double, std::allocator<double> >&, std::vector<int>&, std::vector<double, std::allocator<double> >&, bool, bool, std::ostream*) const [with M = model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model; boost::random::ecuyer1988 = boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> >; std::ostream = std::basic_ostream<char>]' was hidden [-Woverloaded-virtual=]
## 198 | void write_array(boost::ecuyer1988& rng, std::vector<double>& theta,
## |
## C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3486f1b6f.hpp:418: note: by 'model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model::write_array'
## 418 | write_array(RNG& base_rng, std::vector<double>& params_r, std::vector<int>&
## |
## stan/src/stan/model/model_base_crtp.hpp:136: warning: 'void stan::model::model_base_crtp<M>::write_array(boost::random::ecuyer1988&, Eigen::VectorXd&, Eigen::VectorXd&, bool, bool, std::ostream*) const [with M = model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model; boost::random::ecuyer1988 = boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> >; Eigen::VectorXd = Eigen::Matrix<double, -1, 1>; std::ostream = std::basic_ostream<char>]' was hidden [-Woverloaded-virtual=]
## 136 | void write_array(boost::ecuyer1988& rng, Eigen::VectorXd& theta,
## |
## C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3486f1b6f.hpp:418: note: by 'model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model::write_array'
## 418 | write_array(RNG& base_rng, std::vector<double>& params_r, std::vector<int>&
## |
## Start sampling
## Running MCMC with 4 parallel chains...
##
## Chain 1 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 1 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 1 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 1 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 1 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 1 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 1 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 1 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 1 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 1 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 1 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 1 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 1 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 1 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 1 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 1 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 1 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 1 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 1 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 1 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 1 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 1 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 1 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 1 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3486f1b6f.stan', line 27, column 4 to column 53)
## Chain 1 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 1 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 1
## Chain 1 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 1 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3486f1b6f.stan', line 27, column 4 to column 53)
## Chain 1 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 1 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 1
## Chain 1 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 1 Exception: normal_id_glm_lpdf: Scale vector is 0, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3486f1b6f.stan', line 27, column 4 to column 53)
## Chain 1 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 1 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 1
## Chain 1 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 1 Exception: normal_id_glm_lpdf: Matrix of independent variables is inf, but must be finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3486f1b6f.stan', line 27, column 4 to column 53)
## Chain 1 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 1 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 1
## Chain 2 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 2 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 2 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 2 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 2 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 2 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 2 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 2 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 2 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 2 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 2 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 2 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 2 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 2 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 2 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 2 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 2 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 2 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 2 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 2 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 2 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 2 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 2 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 2 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3486f1b6f.stan', line 27, column 4 to column 53)
## Chain 2 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 2 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 2
## Chain 2 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 2 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3486f1b6f.stan', line 27, column 4 to column 53)
## Chain 2 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 2 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 2
## Chain 2 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 2 Exception: normal_id_glm_lpdf: Scale vector is 0, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3486f1b6f.stan', line 27, column 4 to column 53)
## Chain 2 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 2 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 2
## Chain 2 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 2 Exception: normal_id_glm_lpdf: Scale vector is 0, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3486f1b6f.stan', line 27, column 4 to column 53)
## Chain 2 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 2 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 2
## Chain 3 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 3 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 3 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 3 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 3 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 3 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 3 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 3 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 3 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 3 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 3 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 3 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 3 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 3 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 3 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 3 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 3 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 3 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 3 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 3 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3486f1b6f.stan', line 27, column 4 to column 53)
## Chain 3 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 3 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 3
## Chain 4 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 4 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 4 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 4 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 4 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 4 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 4 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 4 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 4 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 4 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 4 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 4 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 4 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 4 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 4 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3486f1b6f.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3486f1b6f.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3486f1b6f.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3486f1b6f.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3486f1b6f.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 1 finished in 0.1 seconds.
## Chain 2 finished in 0.1 seconds.
## Chain 3 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 3 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 3 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 3 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 3 finished in 0.1 seconds.
## Chain 4 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 4 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 4 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 4 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 4 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 4 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 4 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 4 finished in 0.1 seconds.
##
## All 4 chains finished successfully.
## Mean chain execution time: 0.1 seconds.
## Total execution time: 0.8 seconds.
print(out_emp_rea)
## Family: gaussian
## Links: mu = identity; sigma = identity
## Formula: empathic_reactions ~ 0 + condition
## Data: outgroup (Number of observations: 572)
## Draws: 4 chains, each with iter = 2000; warmup = 500; thin = 1;
## total post-warmup draws = 6000
##
## Population-Level Effects:
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## conditionControl 0.18 0.09 0.01 0.36 1.00 9021 4324
## conditionLimited 0.06 0.10 -0.13 0.25 1.00 7644 4926
## conditionMalleable -0.02 0.09 -0.21 0.16 1.00 8840 4788
## conditionNormative -0.04 0.09 -0.22 0.14 1.00 9111 4652
## conditionUnlimited -0.19 0.09 -0.37 -0.01 1.00 8997 4688
##
## Family Specific Parameters:
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sigma 1.00 0.03 0.94 1.06 1.00 8508 4565
##
## Draws were sampled using sample(hmc). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
out_emp_rea_post <- posterior_samples(out_emp_rea)
## Warning: Method 'posterior_samples' is deprecated. Please see ?as_draws for
## recommended alternatives.
out_emp_dri <- brm(data = outgroup, family = gaussian,
empathic_drivers ~ 0 + condition,
prior = c(prior(normal(0, 1), class = b),
prior(exponential(1), class = sigma)),
iter = 2000, warmup = 500, chains = 4, cores = 4,
seed = 5,
backend = "cmdstan",
silent = 0)
## In file included from stan/src/stan/model/model_header.hpp:11:
## stan/src/stan/model/model_base_crtp.hpp:198: warning: 'void stan::model::model_base_crtp<M>::write_array(boost::random::ecuyer1988&, std::vector<double, std::allocator<double> >&, std::vector<int>&, std::vector<double, std::allocator<double> >&, bool, bool, std::ostream*) const [with M = model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model; boost::random::ecuyer1988 = boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> >; std::ostream = std::basic_ostream<char>]' was hidden [-Woverloaded-virtual=]
## 198 | void write_array(boost::ecuyer1988& rng, std::vector<double>& theta,
## |
## C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f34a8c1d97.hpp:418: note: by 'model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model::write_array'
## 418 | write_array(RNG& base_rng, std::vector<double>& params_r, std::vector<int>&
## |
## stan/src/stan/model/model_base_crtp.hpp:136: warning: 'void stan::model::model_base_crtp<M>::write_array(boost::random::ecuyer1988&, Eigen::VectorXd&, Eigen::VectorXd&, bool, bool, std::ostream*) const [with M = model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model; boost::random::ecuyer1988 = boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> >; Eigen::VectorXd = Eigen::Matrix<double, -1, 1>; std::ostream = std::basic_ostream<char>]' was hidden [-Woverloaded-virtual=]
## 136 | void write_array(boost::ecuyer1988& rng, Eigen::VectorXd& theta,
## |
## C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f34a8c1d97.hpp:418: note: by 'model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model::write_array'
## 418 | write_array(RNG& base_rng, std::vector<double>& params_r, std::vector<int>&
## |
## Start sampling
## Running MCMC with 4 parallel chains...
##
## Chain 1 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 1 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 1 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 1 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 1 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 1 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 1 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 1 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 1 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 1 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 1 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 1 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 1 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 1 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 1 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 1 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 1 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 1 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 1 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 1 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 1 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 1 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 1 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 1 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f34a8c1d97.stan', line 27, column 4 to column 53)
## Chain 1 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 1 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 1
## Chain 1 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 1 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f34a8c1d97.stan', line 27, column 4 to column 53)
## Chain 1 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 1 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 1
## Chain 1 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 1 Exception: normal_id_glm_lpdf: Scale vector is 0, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f34a8c1d97.stan', line 27, column 4 to column 53)
## Chain 1 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 1 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 1
## Chain 2 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 2 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 2 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 2 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 2 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 2 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 2 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 2 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 2 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 2 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 2 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 2 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 2 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 2 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 2 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 2 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 2 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 2 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 2 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 2 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 2 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 2 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 2 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 2 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f34a8c1d97.stan', line 27, column 4 to column 53)
## Chain 2 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 2 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 2
## Chain 2 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 2 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f34a8c1d97.stan', line 27, column 4 to column 53)
## Chain 2 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 2 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 2
## Chain 2 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 2 Exception: normal_id_glm_lpdf: Scale vector is 0, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f34a8c1d97.stan', line 27, column 4 to column 53)
## Chain 2 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 2 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 2
## Chain 2 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 2 Exception: normal_id_glm_lpdf: Matrix of independent variables is inf, but must be finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f34a8c1d97.stan', line 27, column 4 to column 53)
## Chain 2 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 2 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 2
## Chain 3 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 3 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 3 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 3 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 3 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 3 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 3 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 3 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 3 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 3 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 3 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 3 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 3 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 3 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 3 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 3 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 3 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 3 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 3 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 3 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 3 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 3 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f34a8c1d97.stan', line 27, column 4 to column 53)
## Chain 3 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 3 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 3
## Chain 4 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 4 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 4 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 4 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 4 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 4 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 4 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 4 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 4 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 4 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 4 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 4 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 4 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 4 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 4 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 4 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f34a8c1d97.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f34a8c1d97.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f34a8c1d97.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f34a8c1d97.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f34a8c1d97.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 1 finished in 0.1 seconds.
## Chain 2 finished in 0.1 seconds.
## Chain 3 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 3 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 3 finished in 0.1 seconds.
## Chain 4 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 4 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 4 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 4 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 4 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 4 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 4 finished in 0.1 seconds.
##
## All 4 chains finished successfully.
## Mean chain execution time: 0.1 seconds.
## Total execution time: 0.6 seconds.
print(out_emp_dri)
## Family: gaussian
## Links: mu = identity; sigma = identity
## Formula: empathic_drivers ~ 0 + condition
## Data: outgroup (Number of observations: 572)
## Draws: 4 chains, each with iter = 2000; warmup = 500; thin = 1;
## total post-warmup draws = 6000
##
## Population-Level Effects:
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## conditionControl 0.11 0.09 -0.07 0.29 1.00 7968 4818
## conditionLimited -0.00 0.09 -0.18 0.19 1.00 7381 4705
## conditionMalleable -0.03 0.09 -0.21 0.16 1.00 9431 4880
## conditionNormative 0.06 0.09 -0.12 0.24 1.00 7724 4790
## conditionUnlimited -0.15 0.10 -0.33 0.04 1.00 8063 4883
##
## Family Specific Parameters:
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sigma 1.00 0.03 0.95 1.06 1.00 7274 4238
##
## Draws were sampled using sample(hmc). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
out_emp_dri_post <- posterior_samples(out_emp_dri)
## Warning: Method 'posterior_samples' is deprecated. Please see ?as_draws for
## recommended alternatives.
out_emp_don <- brm(data = outgroup, family = gaussian,
donation ~ 0 + condition,
prior = c(prior(normal(0, 1), class = b),
prior(exponential(1), class = sigma)),
iter = 2000, warmup = 500, chains = 4, cores = 4,
seed = 5,
backend = "cmdstan",
silent = 0)
## In file included from stan/src/stan/model/model_header.hpp:11:
## stan/src/stan/model/model_base_crtp.hpp:198: warning: 'void stan::model::model_base_crtp<M>::write_array(boost::random::ecuyer1988&, std::vector<double, std::allocator<double> >&, std::vector<int>&, std::vector<double, std::allocator<double> >&, bool, bool, std::ostream*) const [with M = model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model; boost::random::ecuyer1988 = boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> >; std::ostream = std::basic_ostream<char>]' was hidden [-Woverloaded-virtual=]
## 198 | void write_array(boost::ecuyer1988& rng, std::vector<double>& theta,
## |
## C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f346095663d.hpp:418: note: by 'model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model::write_array'
## 418 | write_array(RNG& base_rng, std::vector<double>& params_r, std::vector<int>&
## |
## stan/src/stan/model/model_base_crtp.hpp:136: warning: 'void stan::model::model_base_crtp<M>::write_array(boost::random::ecuyer1988&, Eigen::VectorXd&, Eigen::VectorXd&, bool, bool, std::ostream*) const [with M = model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model; boost::random::ecuyer1988 = boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> >; Eigen::VectorXd = Eigen::Matrix<double, -1, 1>; std::ostream = std::basic_ostream<char>]' was hidden [-Woverloaded-virtual=]
## 136 | void write_array(boost::ecuyer1988& rng, Eigen::VectorXd& theta,
## |
## C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f346095663d.hpp:418: note: by 'model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model::write_array'
## 418 | write_array(RNG& base_rng, std::vector<double>& params_r, std::vector<int>&
## |
## Start sampling
## Running MCMC with 4 parallel chains...
##
## Chain 1 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 1 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 1 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 1 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 1 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 1 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 1 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 1 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 1 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 1 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 1 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 1 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 1 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 1 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 1 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 1 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 1 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 1 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 1 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 1 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 1 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 1 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 1 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 1 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f346095663d.stan', line 27, column 4 to column 53)
## Chain 1 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 1 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 1
## Chain 1 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 1 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f346095663d.stan', line 27, column 4 to column 53)
## Chain 1 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 1 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 1
## Chain 1 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 1 Exception: normal_id_glm_lpdf: Scale vector is 0, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f346095663d.stan', line 27, column 4 to column 53)
## Chain 1 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 1 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 1
## Chain 2 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 2 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 2 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 2 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 2 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 2 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 2 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 2 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 2 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 2 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 2 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 2 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 2 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 2 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 2 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 2 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 2 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 2 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 2 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 2 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 2 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 2 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 2 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 2 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f346095663d.stan', line 27, column 4 to column 53)
## Chain 2 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 2 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 2
## Chain 2 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 2 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f346095663d.stan', line 27, column 4 to column 53)
## Chain 2 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 2 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 2
## Chain 2 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 2 Exception: normal_id_glm_lpdf: Scale vector is 0, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f346095663d.stan', line 27, column 4 to column 53)
## Chain 2 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 2 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 2
## Chain 2 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 2 Exception: normal_id_glm_lpdf: Matrix of independent variables is inf, but must be finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f346095663d.stan', line 27, column 4 to column 53)
## Chain 2 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 2 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 2
## Chain 3 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 3 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 3 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 3 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 3 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 3 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 3 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 3 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 3 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 3 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 3 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 3 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 3 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 3 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 3 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 3 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 3 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 3 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 3 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f346095663d.stan', line 27, column 4 to column 53)
## Chain 3 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 3 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 3
## Chain 4 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 4 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 4 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 4 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 4 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 4 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 4 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 4 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 4 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 4 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 4 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 4 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 4 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 4 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 4 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f346095663d.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f346095663d.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f346095663d.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f346095663d.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f346095663d.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 1 finished in 0.1 seconds.
## Chain 2 finished in 0.1 seconds.
## Chain 3 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 3 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 3 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 3 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 3 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 3 finished in 0.1 seconds.
## Chain 4 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 4 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 4 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 4 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 4 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 4 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 4 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 4 finished in 0.1 seconds.
##
## All 4 chains finished successfully.
## Mean chain execution time: 0.1 seconds.
## Total execution time: 0.6 seconds.
print(out_emp_don)
## Family: gaussian
## Links: mu = identity; sigma = identity
## Formula: donation ~ 0 + condition
## Data: outgroup (Number of observations: 572)
## Draws: 4 chains, each with iter = 2000; warmup = 500; thin = 1;
## total post-warmup draws = 6000
##
## Population-Level Effects:
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## conditionControl 0.02 0.09 -0.16 0.20 1.00 8265 4549
## conditionLimited -0.07 0.10 -0.25 0.12 1.00 8669 4404
## conditionMalleable -0.04 0.10 -0.24 0.15 1.00 8067 4709
## conditionNormative 0.10 0.09 -0.08 0.28 1.00 8071 4927
## conditionUnlimited -0.02 0.09 -0.20 0.16 1.00 7238 4404
##
## Family Specific Parameters:
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sigma 1.00 0.03 0.95 1.07 1.00 8616 4546
##
## Draws were sampled using sample(hmc). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
out_emp_don_post <- posterior_samples(out_emp_don)
## Warning: Method 'posterior_samples' is deprecated. Please see ?as_draws for
## recommended alternatives.
## models (brms package) and plots (bayesplot) for Ingroups
in_emp_rea <- brm(data = ingroup, family = gaussian,
empathic_reactions ~ 0 + condition,
prior = c(prior(normal(0, 1), class = b),
prior(exponential(1), class = sigma)),
iter = 2000, warmup = 500, chains = 4, cores = 4,
seed = 5,
backend = "cmdstan",
silent = 0)
## In file included from stan/src/stan/model/model_header.hpp:11:
## stan/src/stan/model/model_base_crtp.hpp:198: warning: 'void stan::model::model_base_crtp<M>::write_array(boost::random::ecuyer1988&, std::vector<double, std::allocator<double> >&, std::vector<int>&, std::vector<double, std::allocator<double> >&, bool, bool, std::ostream*) const [with M = model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model; boost::random::ecuyer1988 = boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> >; std::ostream = std::basic_ostream<char>]' was hidden [-Woverloaded-virtual=]
## 198 | void write_array(boost::ecuyer1988& rng, std::vector<double>& theta,
## |
## C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3476811177.hpp:418: note: by 'model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model::write_array'
## 418 | write_array(RNG& base_rng, std::vector<double>& params_r, std::vector<int>&
## |
## stan/src/stan/model/model_base_crtp.hpp:136: warning: 'void stan::model::model_base_crtp<M>::write_array(boost::random::ecuyer1988&, Eigen::VectorXd&, Eigen::VectorXd&, bool, bool, std::ostream*) const [with M = model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model; boost::random::ecuyer1988 = boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> >; Eigen::VectorXd = Eigen::Matrix<double, -1, 1>; std::ostream = std::basic_ostream<char>]' was hidden [-Woverloaded-virtual=]
## 136 | void write_array(boost::ecuyer1988& rng, Eigen::VectorXd& theta,
## |
## C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3476811177.hpp:418: note: by 'model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model::write_array'
## 418 | write_array(RNG& base_rng, std::vector<double>& params_r, std::vector<int>&
## |
## Start sampling
## Running MCMC with 4 parallel chains...
##
## Chain 1 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 1 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 1 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 1 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 1 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 1 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 1 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 1 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 1 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 1 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 1 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 1 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 1 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 1 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 1 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 1 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 1 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 1 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 1 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 1 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 1 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 1 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 1 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 1 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3476811177.stan', line 27, column 4 to column 53)
## Chain 1 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 1 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 1
## Chain 2 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 2 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 2 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 2 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 2 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 2 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 2 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 2 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 2 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 2 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 2 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 2 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 2 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 2 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 2 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 2 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 2 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 2 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 2 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 2 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 2 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 2 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 2 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 2 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3476811177.stan', line 27, column 4 to column 53)
## Chain 2 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 2 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 2
## Chain 3 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 3 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 3 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 3 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 3 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 3 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 3 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 3 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 3 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 3 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 3 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 3 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 3 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 3 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 3 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 3 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 3 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 3 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 3 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 3 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 3 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 3 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 4 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 4 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 4 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 4 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 4 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 4 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 4 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 4 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 4 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 4 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 4 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 4 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 4 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 4 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 4 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 4 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3476811177.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3476811177.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3476811177.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 1 finished in 0.1 seconds.
## Chain 2 finished in 0.1 seconds.
## Chain 3 finished in 0.1 seconds.
## Chain 4 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 4 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 4 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 4 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 4 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 4 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 4 finished in 0.1 seconds.
##
## All 4 chains finished successfully.
## Mean chain execution time: 0.1 seconds.
## Total execution time: 0.6 seconds.
print(in_emp_rea)
## Family: gaussian
## Links: mu = identity; sigma = identity
## Formula: empathic_reactions ~ 0 + condition
## Data: ingroup (Number of observations: 116)
## Draws: 4 chains, each with iter = 2000; warmup = 500; thin = 1;
## total post-warmup draws = 6000
##
## Population-Level Effects:
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## conditionControl -0.66 0.22 -1.11 -0.22 1.00 8401 4370
## conditionLimited 0.19 0.19 -0.17 0.55 1.00 9895 4609
## conditionMalleable 0.06 0.20 -0.33 0.46 1.00 10692 5073
## conditionNormative 0.24 0.20 -0.14 0.64 1.00 8273 4074
## conditionUnlimited 0.03 0.18 -0.33 0.39 1.00 8342 4553
##
## Family Specific Parameters:
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sigma 0.97 0.07 0.86 1.11 1.00 6627 4457
##
## Draws were sampled using sample(hmc). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
in_emp_rea_post <- posterior_samples(in_emp_rea)
## Warning: Method 'posterior_samples' is deprecated. Please see ?as_draws for
## recommended alternatives.
in_emp_dri <- brm(data = ingroup, family = gaussian,
empathic_drivers ~ 0 + condition,
prior = c(prior(normal(0, 1), class = b),
prior(exponential(1), class = sigma)),
iter = 2000, warmup = 500, chains = 4, cores = 4,
seed = 5,
backend = "cmdstan",
silent = 0)
## In file included from stan/src/stan/model/model_header.hpp:11:
## stan/src/stan/model/model_base_crtp.hpp:198: warning: 'void stan::model::model_base_crtp<M>::write_array(boost::random::ecuyer1988&, std::vector<double, std::allocator<double> >&, std::vector<int>&, std::vector<double, std::allocator<double> >&, bool, bool, std::ostream*) const [with M = model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model; boost::random::ecuyer1988 = boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> >; std::ostream = std::basic_ostream<char>]' was hidden [-Woverloaded-virtual=]
## 198 | void write_array(boost::ecuyer1988& rng, std::vector<double>& theta,
## |
## C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f345c494f60.hpp:418: note: by 'model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model::write_array'
## 418 | write_array(RNG& base_rng, std::vector<double>& params_r, std::vector<int>&
## |
## stan/src/stan/model/model_base_crtp.hpp:136: warning: 'void stan::model::model_base_crtp<M>::write_array(boost::random::ecuyer1988&, Eigen::VectorXd&, Eigen::VectorXd&, bool, bool, std::ostream*) const [with M = model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model; boost::random::ecuyer1988 = boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> >; Eigen::VectorXd = Eigen::Matrix<double, -1, 1>; std::ostream = std::basic_ostream<char>]' was hidden [-Woverloaded-virtual=]
## 136 | void write_array(boost::ecuyer1988& rng, Eigen::VectorXd& theta,
## |
## C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f345c494f60.hpp:418: note: by 'model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model::write_array'
## 418 | write_array(RNG& base_rng, std::vector<double>& params_r, std::vector<int>&
## |
## Start sampling
## Running MCMC with 4 parallel chains...
##
## Chain 1 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 1 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 1 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 1 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 1 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 1 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 1 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 1 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 1 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 1 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 1 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 1 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 1 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 1 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 1 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 1 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 1 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 1 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 1 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 1 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 1 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 1 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 1 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 1 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f345c494f60.stan', line 27, column 4 to column 53)
## Chain 1 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 1 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 1
## Chain 2 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 2 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 2 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 2 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 2 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 2 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 2 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 2 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 2 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 2 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 2 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 2 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 2 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 2 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 2 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 2 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 2 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 2 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 2 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 2 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 2 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 2 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 2 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 2 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f345c494f60.stan', line 27, column 4 to column 53)
## Chain 2 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 2 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 2
## Chain 3 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 3 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 3 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 3 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 3 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 3 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 3 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 3 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 3 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 3 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 3 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 3 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 3 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 3 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 3 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 4 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f345c494f60.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f345c494f60.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f345c494f60.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 1 finished in 0.1 seconds.
## Chain 2 finished in 0.2 seconds.
## Chain 3 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 3 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 3 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 3 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 3 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 3 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 3 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 3 finished in 0.1 seconds.
## Chain 4 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 4 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 4 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 4 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 4 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 4 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 4 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 4 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 4 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 4 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 4 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 4 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 4 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 4 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 4 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 4 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 4 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 4 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 4 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 4 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 4 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 4 finished in 0.1 seconds.
##
## All 4 chains finished successfully.
## Mean chain execution time: 0.1 seconds.
## Total execution time: 0.7 seconds.
print(in_emp_dri)
## Family: gaussian
## Links: mu = identity; sigma = identity
## Formula: empathic_drivers ~ 0 + condition
## Data: ingroup (Number of observations: 116)
## Draws: 4 chains, each with iter = 2000; warmup = 500; thin = 1;
## total post-warmup draws = 6000
##
## Population-Level Effects:
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## conditionControl -0.40 0.22 -0.83 0.04 1.00 8245 4744
## conditionLimited 0.04 0.20 -0.36 0.42 1.00 7757 4476
## conditionMalleable 0.19 0.21 -0.22 0.60 1.00 7925 4750
## conditionNormative 0.09 0.21 -0.32 0.50 1.00 8706 4723
## conditionUnlimited 0.01 0.19 -0.36 0.39 1.00 7707 4851
##
## Family Specific Parameters:
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sigma 1.00 0.07 0.88 1.15 1.00 7492 4462
##
## Draws were sampled using sample(hmc). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
in_emp_dri_post <- posterior_samples(in_emp_dri)
## Warning: Method 'posterior_samples' is deprecated. Please see ?as_draws for
## recommended alternatives.
in_emp_don <- brm(data = ingroup, family = gaussian,
donation ~ 0 + condition,
prior = c(prior(normal(0, 1), class = b),
prior(exponential(1), class = sigma)),
iter = 2000, warmup = 500, chains = 4, cores = 4,
seed = 5,
backend = "cmdstan",
silent = 0)
## In file included from stan/src/stan/model/model_header.hpp:11:
## stan/src/stan/model/model_base_crtp.hpp:198: warning: 'void stan::model::model_base_crtp<M>::write_array(boost::random::ecuyer1988&, std::vector<double, std::allocator<double> >&, std::vector<int>&, std::vector<double, std::allocator<double> >&, bool, bool, std::ostream*) const [with M = model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model; boost::random::ecuyer1988 = boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> >; std::ostream = std::basic_ostream<char>]' was hidden [-Woverloaded-virtual=]
## 198 | void write_array(boost::ecuyer1988& rng, std::vector<double>& theta,
## |
## C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3445e4640d.hpp:418: note: by 'model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model::write_array'
## 418 | write_array(RNG& base_rng, std::vector<double>& params_r, std::vector<int>&
## |
## stan/src/stan/model/model_base_crtp.hpp:136: warning: 'void stan::model::model_base_crtp<M>::write_array(boost::random::ecuyer1988&, Eigen::VectorXd&, Eigen::VectorXd&, bool, bool, std::ostream*) const [with M = model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model; boost::random::ecuyer1988 = boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> >; Eigen::VectorXd = Eigen::Matrix<double, -1, 1>; std::ostream = std::basic_ostream<char>]' was hidden [-Woverloaded-virtual=]
## 136 | void write_array(boost::ecuyer1988& rng, Eigen::VectorXd& theta,
## |
## C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3445e4640d.hpp:418: note: by 'model_d4279050a972b04b54f1bcc24a93f655_model_namespace::model_d4279050a972b04b54f1bcc24a93f655_model::write_array'
## 418 | write_array(RNG& base_rng, std::vector<double>& params_r, std::vector<int>&
## |
## Start sampling
## Running MCMC with 4 parallel chains...
##
## Chain 1 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 1 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 1 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 1 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 1 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 1 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 1 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 1 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 1 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 1 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 1 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 1 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 1 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 1 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 1 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 1 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 1 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 1 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 1 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 1 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 1 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 1 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 1 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 1 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3445e4640d.stan', line 27, column 4 to column 53)
## Chain 1 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 1 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 1
## Chain 2 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 2 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 2 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 2 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 2 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 2 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 2 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 2 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 2 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 2 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 2 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 2 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 2 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 2 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 2 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 2 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 2 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 2 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 2 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 2 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 2 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 2 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 2 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 2 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3445e4640d.stan', line 27, column 4 to column 53)
## Chain 2 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 2 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 2
## Chain 3 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 3 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 3 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 3 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 3 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 3 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 3 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 3 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 3 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 3 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 3 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 3 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 3 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 3 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 3 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 3 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 3 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 3 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 3 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 3 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 3 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 3 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 4 Iteration: 1 / 2000 [ 0%] (Warmup)
## Chain 4 Iteration: 100 / 2000 [ 5%] (Warmup)
## Chain 4 Iteration: 200 / 2000 [ 10%] (Warmup)
## Chain 4 Iteration: 300 / 2000 [ 15%] (Warmup)
## Chain 4 Iteration: 400 / 2000 [ 20%] (Warmup)
## Chain 4 Iteration: 500 / 2000 [ 25%] (Warmup)
## Chain 4 Iteration: 501 / 2000 [ 25%] (Sampling)
## Chain 4 Iteration: 600 / 2000 [ 30%] (Sampling)
## Chain 4 Iteration: 700 / 2000 [ 35%] (Sampling)
## Chain 4 Iteration: 800 / 2000 [ 40%] (Sampling)
## Chain 4 Iteration: 900 / 2000 [ 45%] (Sampling)
## Chain 4 Iteration: 1000 / 2000 [ 50%] (Sampling)
## Chain 4 Iteration: 1100 / 2000 [ 55%] (Sampling)
## Chain 4 Iteration: 1200 / 2000 [ 60%] (Sampling)
## Chain 4 Iteration: 1300 / 2000 [ 65%] (Sampling)
## Chain 4 Iteration: 1400 / 2000 [ 70%] (Sampling)
## Chain 4 Iteration: 1500 / 2000 [ 75%] (Sampling)
## Chain 4 Iteration: 1600 / 2000 [ 80%] (Sampling)
## Chain 4 Iteration: 1700 / 2000 [ 85%] (Sampling)
## Chain 4 Iteration: 1800 / 2000 [ 90%] (Sampling)
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3445e4640d.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3445e4640d.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 4 Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
## Chain 4 Exception: normal_id_glm_lpdf: Scale vector is inf, but must be positive finite! (in 'C:/Users/ALEXAN~1/AppData/Local/Temp/RtmpW4Vre4/model-2f3445e4640d.stan', line 27, column 4 to column 53)
## Chain 4 If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
## Chain 4 but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
## Chain 4
## Chain 1 finished in 0.1 seconds.
## Chain 2 finished in 0.1 seconds.
## Chain 3 finished in 0.1 seconds.
## Chain 4 Iteration: 1900 / 2000 [ 95%] (Sampling)
## Chain 4 Iteration: 2000 / 2000 [100%] (Sampling)
## Chain 4 finished in 0.1 seconds.
##
## All 4 chains finished successfully.
## Mean chain execution time: 0.1 seconds.
## Total execution time: 0.6 seconds.
print(in_emp_don)
## Family: gaussian
## Links: mu = identity; sigma = identity
## Formula: donation ~ 0 + condition
## Data: ingroup (Number of observations: 116)
## Draws: 4 chains, each with iter = 2000; warmup = 500; thin = 1;
## total post-warmup draws = 6000
##
## Population-Level Effects:
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## conditionControl -0.14 0.23 -0.59 0.30 1.00 7824 4750
## conditionLimited -0.04 0.20 -0.42 0.35 1.00 7200 4419
## conditionMalleable 0.16 0.21 -0.27 0.58 1.00 6849 4700
## conditionNormative -0.16 0.21 -0.57 0.25 1.00 7263 4661
## conditionUnlimited 0.14 0.19 -0.23 0.52 1.00 7650 4754
##
## Family Specific Parameters:
## Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sigma 1.01 0.07 0.89 1.15 1.00 6594 4248
##
## Draws were sampled using sample(hmc). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).
in_emp_don_post <- posterior_samples(in_emp_don)
## Warning: Method 'posterior_samples' is deprecated. Please see ?as_draws for
## recommended alternatives.
You can also embed plots, for example:
## Warning: The `size` argument of `element_line()` is deprecated as of ggplot2 3.4.0.
## ℹ Please use the `linewidth` argument instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.