Hypothesis 2: There is a relationship between past experience with dementia and positive attitudes towards dementia.

Load and clean the data from the raw data files

# load functions and variables
source("DementiaAttitude_functions_variables.R") 
df_dementia_all <- read.csv("Dementia_Data_Response.csv")

Form a data frame with the averages of all questions about positive attitudes.

Allophilia scales were used to evaluate the positive attitude. The average of the is are used to measure the positive attitude.

[1] Kinney, J. M., Yamashita, T., & Brown, J. S. (2017). Measuring positive attitudes toward persons with dementia: A validation of the Allophilia scale. Dementia, 16(8), 1045–1060. https://doi.org/10.1177/1471301216633247

[2] FINGERHUT, A.W. (2011), Straight Allies: What Predicts Heterosexuals’ Alliance With the LGBT Community?1. Journal of Applied Social Psychology, 41: 2230-2248. doi:10.1111/j.1559-1816.2011.00807.x

type = 1 # 1: Positive, 2: Overall, 3: Understanding, 4: Negative

# scale = 7 # 6: Positive, 7: Overall, 2: Understanding, 5: Negative
# qnum = 21 # 18: Positive, 21: Overall, 23: Understanding, 30: Negative
scale = 6
attention = 12
qnum = 18
attention_answer = "Disagree" # Disagree: Positive, Slightly Disagree: Overall, TRUE: Understanding, Strongly Agree: Negative
if (type == 2) {
  scale = 7
  attention = 12
  qnum = 21
  attention_answer = "Slightly Disagree"
} else if (type == 3) {
  scale = 2
  attention = 16
  qnum = 23
  attention_answer = "TRUE"
} else if (type == 4) {
  scale = 5
  attention = 30
  qnum = 30
  attention_answer = "Strongly Agree"
}

Select questions for analysis

# MD_40 do not have session 2 data
df_all = df_dementia_all[!(df_dementia_all$PID==40 & df_dementia_all$Location=="L1"),]
df_s1 = get_attr_data(type, 1, df_all)
df_s2 = get_attr_data(type, 2, df_all)

df_attention = get_attention_data(type, df_all)
pass_participants = df_attention$S1==attention_answer & df_attention$S2==attention_answer
df_s1 = df_s1[pass_participants,]
df_s2 = df_s2[pass_participants,]

df_all <- data.frame(
  PID = as.character(df_s1$PID),
  Treatment = df_s1$Treatment,
  Session1 = df_s1$Mean,
  Session2 = df_s2$Mean
)

# transform the data frame for ANOVA
df_anova <- data.frame(
  PID = c(as.character(df_all$PID), as.character(df_all$PID)),
  Treatment = as.factor(c(as.character(df_all$Treatment), as.character(df_all$Treatment))),
  Session = as.factor(c(rep("Session1", nrow(df_all)), rep("Session2", nrow(df_all)))),
  Response = c(df_all$Session1, df_all$Session2)
)

Distribution of responses

# transform the data frame for ANOVA
df_box <- data.frame(
  PID = c(as.character(df_all$PID), as.character(df_all$PID)),
  Media = factor(c(as.character(df_all$Treatment), as.character(df_all$Treatment)), levels = c('Control', 'News Articles', 'Text Diaries', 'Audio Diaries')),
  Session = factor(c(rep("Pre", nrow(df_all)), rep("Post", nrow(df_all))), levels = c('Pre', 'Post')),
  Response = c(df_all$Session1, df_all$Session2)
)

draw_box_interaction(df_box, paste('Interaction_', type_str(type), '.pdf', sep=''), NULL, NULL, NULL)
##       PID                Media    Session       Response           x        
##  L1_1   :  2   Control      :62   Pre :117   Min.   :2.059   Min.   :1.000  
##  L1_10  :  2   News Articles:48   Post:117   1st Qu.:3.647   1st Qu.:1.000  
##  L1_11  :  2   Text Diaries :64              Median :4.059   Median :3.000  
##  L1_12  :  2   Audio Diaries:60              Mean   :4.036   Mean   :2.521  
##  L1_13  :  2                                 3rd Qu.:4.412   3rd Qu.:4.000  
##  L1_14  :  2                                 Max.   :5.765   Max.   :4.000  
##  (Other):222

Normality test

A data violates the normality assumption if the results of the Shapiro-Wilk test are not significant (p>.05).

df_anova %>%
  group_by(Treatment, Session) %>%
  shapiro_test(Response)
## # A tibble: 8 x 5
##   Treatment     Session  variable statistic       p
##   <fct>         <fct>    <chr>        <dbl>   <dbl>
## 1 Audio Diaries Session1 Response     0.951 0.176  
## 2 Audio Diaries Session2 Response     0.991 0.994  
## 3 Control       Session1 Response     0.978 0.755  
## 4 Control       Session2 Response     0.983 0.878  
## 5 News Articles Session1 Response     0.959 0.420  
## 6 News Articles Session2 Response     0.964 0.527  
## 7 Text Diaries  Session1 Response     0.953 0.173  
## 8 Text Diaries  Session2 Response     0.893 0.00421

Difference between the two sessions and treatments (ANOVA)

# perform the ART procedure on 'df'
# assume 'Response' is the name of the response column
# assume 'Treatment' is the name of the first factor column
# assume 'Session' is the name of the second factor column
# assume 'PID' is the id of the subjects column
m = art(Response ~ Treatment * Session + (1|PID), data=df_anova) # uses a linear mixed model
anova(m)
## Analysis of Variance of Aligned Rank Transformed Data
## 
## Table Type: Analysis of Deviance Table (Type III Wald F tests with Kenward-Roger df) 
## Model: Mixed Effects (lmer)
## Response: art(Response)
## 
##                            F Df Df.res     Pr(>F)    
## 1 Treatment          0.27276  3    113    0.84493    
## 2 Session           37.31808  1    113 1.4588e-08 ***
## 3 Treatment:Session  0.19972  3    113    0.89638    
## ---
## Signif. codes:   0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1