-
Notifications
You must be signed in to change notification settings - Fork 0
/
Study3_Never_Testing_Bias_By_Preference.R
71 lines (61 loc) · 3.29 KB
/
Study3_Never_Testing_Bias_By_Preference.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
####################################
# Never Testing Bias By Preference #
####################################
# Import Libraries
library("tidyverse")
library('lmerTest')
# Import data
Never_Testing_Bias_by_Preference <- as_tibble(read.csv("Study3_Never_Testing_Bias_by_Preference.csv"))
# Preview data
head(Never_Testing_Bias_by_Preference)
# data dictionary:
## "Participant" = participant number
## "Function_Exposure" = denotes if participant was assigned to function exposure treatment (see study 3 methods for details); 1=yes, 0=no
## "Function" = Function number (range 1-6; refer to payoff function figure)
## "Preferred_Policy_at_Start" = notes if randomized to preferred policy at start (or not), as well as if a policy was "neutral" in regards to participant preference.
## "Policy_Changes" = count of number of times a policy/function was tested/changed at conclusion of learning task.
## "Did_Not_Test" = notes if participant never tested/changed a policy/function (1 = never tested; 0 = tested at least once)
# What percent of policies were never tested?
round(mean(Never_Testing_Bias_by_Preference$Did_Not_Test[Never_Testing_Bias_by_Preference$Function_Exposure==1]),4)*100 # function exposure mean = 8.10%
round(mean(Never_Testing_Bias_by_Preference$Did_Not_Test[Never_Testing_Bias_by_Preference$Function_Exposure==0]),4)*100 # no function exposure mean = 12.45%
# Effects coding
Never_Testing_Bias_by_Preference$Preferred_Policy_at_Start2 <-
ifelse(Never_Testing_Bias_by_Preference$Preferred_Policy_at_Start=='Preferred',.5,-.5)
Never_Testing_Bias_by_Preference$Function_Exposure2 <-
ifelse(Never_Testing_Bias_by_Preference$Function_Exposure==1,.5,-.5)
# logistic mixed effects model
m1 <- glmer(Did_Not_Test ~ Preferred_Policy_at_Start2*Function_Exposure2 + (1+Preferred_Policy_at_Start2|Participant),
data=Never_Testing_Bias_by_Preference, family='binomial')
summary(m1)
# Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
# Family: binomial ( logit )
# Formula: Did_Not_Test ~ Preferred_Policy_at_Start2 * Function_Exposure2 + (1 + Preferred_Policy_at_Start2 | Participant)
# Data: Never_Testing_Bias_by_Preference
#
# AIC BIC logLik deviance df.resid
# 209.4 238.2 -97.7 195.4 444
#
# Scaled residuals:
# Min 1Q Median 3Q Max
# -1.63286 -0.02431 -0.01192 -0.00310 1.85406
#
# Random effects:
# Groups Name Variance Std.Dev. Corr
# Participant (Intercept) 63.72 7.982
# Preferred_Policy_at_Start2 160.37 12.664 -0.37
# Number of obs: 451, groups: Participant, 78
#
# Fixed effects:
# Estimate Std. Error z value Pr(>|z|)
# (Intercept) -9.4399 1.7580 -5.370 7.89e-08 ***
# Preferred_Policy_at_Start2 3.8621 3.5099 1.100 0.271
# Function_Exposure2 -0.1537 1.7486 -0.088 0.930
# Preferred_Policy_at_Start2:Function_Exposure2 -0.9424 3.1911 -0.295 0.768
# ---
# Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#
# Correlation of Fixed Effects:
# (Intr) Pr_P__S2 Fnc_E2
# Prfrr_P__S2 -0.707
# Fnctn_Exps2 -0.028 0.045
# P_P__S2:F_E 0.033 -0.038 -0.634