d <- read.csv("C:/Users/Dani Grant/Dropbox/graduate school records/research projects/longitudinal gratitude/analyses/long_grat_w1w5.csv", header = T)

names(d)[names(d) == 'irrirated5'] <- 'irritated5'

rank <- d[c("subID", "f_rank1", "f_rank2", "f_rank3", "f_rank4", "f_rank5")] 
week <- d[c("subID", "week1", "week2", "week3", "week4", "week5")] 
wtr <-  d[c("subID", "w1wtr", "w2wtrAvg", "w3wtrAvg", "w4wtrAvg", "w5wtrAvg")]
close <-  d[c("subID", "w1close", "w2closeAvg", "w3closeAvg",  "w4closeAvg", "w5closeAvg")]
commit <- d[c("subID", "w1commit", "w2commitAvg", "w3commitAvg",  "w4commitAvg", "w5commitAvg")]
ios <- d[c("subID", "w1ios", "w2iosAvg", "w3iosAvg",  "w4iosAvg", "w5iosAvg")]

d$thankful1 <- NA
thankful <- d[c("subID", "thankful1", "thankful2", "thankful3",  "thankful4", "thankful5")]

d$irritated1 <- NA
irritated <- d[c("subID", "irritated1", "irritated2", "irritated3",  "irritated4", "irritated5")]

d$anger1 <- NA
anger <- d[c("subID", "anger1", "anger2", "anger3",  "anger4", "anger5")]

d$grat1 <- NA
grat <- d[c("subID", "grat1", "grat2", "grat3", "grat4", "grat5")]

#create grat construct

x <- cbind(d$thankful2, d$grat2, d$appreciative2)
d$gratScale2 <- rowMeans(x, na.rm = T)
remove(x)

x <- cbind(d$thankful3, d$grat3, d$appreciative3)
d$gratScale3 <- rowMeans(x, na.rm = T)
remove(x)

x <- cbind(d$thankful4, d$grat4, d$appreciative4)
d$gratScale4 <- rowMeans(x, na.rm = T)
remove(x)

x <- cbind(d$thankful5, d$grat5, d$appreciative5)
d$gratScale5 <- rowMeans(x, na.rm = T)
remove(x)

d$gratScale1 <- NA
gratScale <- d[c("subID", "gratScale1", "gratScale2", "gratScale3", "gratScale4", "gratScale5")]


# pivot long
rank_long <- rank %>% pivot_longer(cols = contains("rank"), names_to = "delete", values_to = "rank")  
week_long <- week %>% pivot_longer(cols = contains("week"), names_to = "delete", values_to = "week")  
wtr_long <- wtr %>% pivot_longer(cols = contains("wtr"), names_to = "delete", values_to = "wtr")  
close_long <- close %>% pivot_longer(cols = contains("close"), names_to = "delete", values_to = "close")  
commit_long <- commit %>% pivot_longer(cols = contains("commit"), names_to = "delete", values_to = "commit")  
ios_long <- ios %>% pivot_longer(cols = contains("ios"), names_to = "delete", values_to = "ios")  

thankful_long <- thankful %>% pivot_longer(cols = contains("thankful"), names_to = "delete", values_to = "thankful")  
irritated_long <- irritated %>% pivot_longer(cols = contains("irritated"), names_to = "delete", values_to = "irritated")
anger_long <- anger %>% pivot_longer(cols = contains("anger"), names_to = "delete", values_to = "anger")  
grat_long <- grat %>% pivot_longer(cols = contains("grat"), names_to = "delete", values_to = "grat")  
gratScale_long <- gratScale %>% pivot_longer(cols = contains("gratScale"), names_to = "delete", values_to = "gratScale")  

#append to single data frame
long_final <- data.frame(week_long$week)
long_final$subID <- week_long$subID
long_final$rank <- rank_long$rank
long_final$gratScale <- gratScale_long$gratScale
long_final$grat <- grat_long$grat
long_final$close <- close_long$close
long_final$wtr <- wtr_long$wtr
long_final$close <- close_long$close
long_final$commit <- commit_long$commit
long_final$ios <- ios_long$ios
long_final$thankful <- thankful_long$thankful
long_final$irritated <- irritated_long$irritated
long_final$anger <- anger_long$anger

names(long_final)[names(long_final) == 'week_long.week'] <- 'week'

descriptive stats

close

psych::alpha(d[c("w1close", "w2closeAvg", "w3closeAvg", "w4closeAvg", "w5closeAvg")]) #.91
## 
## Reliability analysis   
## Call: psych::alpha(x = d[c("w1close", "w2closeAvg", "w3closeAvg", "w4closeAvg", 
##     "w5closeAvg")])
## 
##   raw_alpha std.alpha G6(smc) average_r S/N    ase mean  sd median_r
##       0.91      0.91    0.92      0.67  10 0.0066  4.3 1.3     0.68
## 
##  lower alpha upper     95% confidence boundaries
## 0.9 0.91 0.92 
## 
##  Reliability if an item is dropped:
##            raw_alpha std.alpha G6(smc) average_r  S/N alpha se  var.r med.r
## w1close         0.91      0.91    0.90      0.72 10.1   0.0068 0.0053  0.70
## w2closeAvg      0.88      0.88    0.86      0.64  7.1   0.0092 0.0156  0.63
## w3closeAvg      0.89      0.89    0.89      0.66  7.7   0.0088 0.0167  0.66
## w4closeAvg      0.88      0.88    0.87      0.65  7.5   0.0088 0.0108  0.65
## w5closeAvg      0.89      0.89    0.88      0.67  8.3   0.0081 0.0087  0.70
## 
##  Item statistics 
##              n raw.r std.r r.cor r.drop mean  sd
## w1close    400  0.85  0.79  0.72   0.67  4.5 1.4
## w2closeAvg 406  0.92  0.90  0.87   0.83  4.4 1.4
## w3closeAvg 395  0.90  0.87  0.83   0.79  4.3 1.4
## w4closeAvg 336  0.90  0.88  0.86   0.81  4.3 1.4
## w5closeAvg 151  0.87  0.85  0.82   0.76  4.5 1.4
## 
## Non missing response frequency for each item
##               0    1    2 2.5    3    4    5    6 miss
## w1close    0.00 0.03 0.05   0 0.14 0.23 0.23 0.31 0.19
## w2closeAvg 0.01 0.02 0.05   0 0.15 0.26 0.25 0.26 0.17
## w3closeAvg 0.02 0.03 0.04   0 0.15 0.27 0.27 0.21 0.20
## w4closeAvg 0.02 0.02 0.04   0 0.17 0.26 0.27 0.22 0.32
## w5closeAvg 0.03 0.03 0.03   0 0.10 0.26 0.25 0.30 0.69
describeBy(d[c("w1close", "w2closeAvg", "w3closeAvg", "w4closeAvg", "w5closeAvg")])
## Warning in describeBy(d[c("w1close", "w2closeAvg", "w3closeAvg", "w4closeAvg", :
## no grouping variable requested

commit

psych::alpha(d[c("w1commit", "w2commitAvg", "w3commitAvg", "w4commitAvg", "w5commitAvg")]) #.91
## 
## Reliability analysis   
## Call: psych::alpha(x = d[c("w1commit", "w2commitAvg", "w3commitAvg", 
##     "w4commitAvg", "w5commitAvg")])
## 
##   raw_alpha std.alpha G6(smc) average_r S/N    ase mean  sd median_r
##       0.91      0.91    0.91      0.67  10 0.0065  4.4 1.3     0.68
## 
##  lower alpha upper     95% confidence boundaries
## 0.9 0.91 0.92 
## 
##  Reliability if an item is dropped:
##             raw_alpha std.alpha G6(smc) average_r  S/N alpha se  var.r med.r
## w1commit         0.91      0.91    0.89      0.72 10.1   0.0067 0.0027  0.70
## w2commitAvg      0.88      0.88    0.86      0.65  7.3   0.0090 0.0126  0.65
## w3commitAvg      0.89      0.89    0.89      0.66  7.9   0.0086 0.0138  0.68
## w4commitAvg      0.89      0.89    0.87      0.66  7.8   0.0086 0.0084  0.68
## w5commitAvg      0.89      0.89    0.87      0.67  8.3   0.0081 0.0060  0.70
## 
##  Item statistics 
##               n raw.r std.r r.cor r.drop mean  sd
## w1commit    399  0.86  0.80  0.73   0.68  4.6 1.4
## w2commitAvg 406  0.91  0.90  0.87   0.83  4.5 1.4
## w3commitAvg 399  0.90  0.87  0.82   0.79  4.4 1.5
## w4commitAvg 339  0.91  0.87  0.85   0.80  4.5 1.4
## w5commitAvg 152  0.88  0.86  0.82   0.77  4.6 1.5
## 
## Non missing response frequency for each item
##                0    1    2    3    4    5    6 miss
## w1commit    0.01 0.03 0.05 0.15 0.14 0.26 0.36 0.19
## w2commitAvg 0.01 0.02 0.04 0.15 0.22 0.27 0.28 0.17
## w3commitAvg 0.03 0.03 0.04 0.13 0.26 0.25 0.26 0.19
## w4commitAvg 0.02 0.02 0.03 0.15 0.24 0.22 0.31 0.31
## w5commitAvg 0.03 0.02 0.03 0.11 0.16 0.32 0.33 0.69
describeBy(d[c("w1commit", "w2commitAvg", "w3commitAvg", "w4commitAvg", "w5commitAvg")])
## Warning in describeBy(d[c("w1commit", "w2commitAvg", "w3commitAvg",
## "w4commitAvg", : no grouping variable requested

ios

psych::alpha(d[c("w1ios", "w2iosAvg", "w3iosAvg", "w4iosAvg", "w5iosAvg")]) #.92
## 
## Reliability analysis   
## Call: psych::alpha(x = d[c("w1ios", "w2iosAvg", "w3iosAvg", "w4iosAvg", 
##     "w5iosAvg")])
## 
##   raw_alpha std.alpha G6(smc) average_r S/N    ase mean  sd median_r
##       0.92      0.92    0.91       0.7  12 0.0057  4.2 1.4     0.71
## 
##  lower alpha upper     95% confidence boundaries
## 0.91 0.92 0.93 
## 
##  Reliability if an item is dropped:
##          raw_alpha std.alpha G6(smc) average_r  S/N alpha se  var.r med.r
## w1ios         0.91      0.91    0.89      0.72 10.4   0.0065 0.0013  0.73
## w2iosAvg      0.89      0.89    0.86      0.67  8.1   0.0082 0.0016  0.66
## w3iosAvg      0.90      0.90    0.88      0.70  9.4   0.0071 0.0025  0.71
## w4iosAvg      0.90      0.90    0.88      0.70  9.3   0.0072 0.0036  0.70
## w5iosAvg      0.91      0.91    0.89      0.71  9.9   0.0068 0.0038  0.74
## 
##  Item statistics 
##            n raw.r std.r r.cor r.drop mean  sd
## w1ios    400  0.87  0.84  0.79   0.75  4.3 1.6
## w2iosAvg 412  0.92  0.92  0.90   0.86  4.2 1.6
## w3iosAvg 401  0.90  0.87  0.83   0.79  4.2 1.6
## w4iosAvg 340  0.88  0.87  0.83   0.80  4.4 1.4
## w5iosAvg 153  0.87  0.86  0.80   0.77  4.5 1.6
## 
## Non missing response frequency for each item
##             1    2  2.5    3    4    5 5.5    6    7 miss
## w1ios    0.03 0.13 0.00 0.16 0.24 0.18   0 0.16 0.10 0.19
## w2iosAvg 0.04 0.14 0.00 0.14 0.21 0.23   0 0.18 0.07 0.16
## w3iosAvg 0.04 0.12 0.00 0.15 0.25 0.20   0 0.17 0.06 0.18
## w4iosAvg 0.04 0.09 0.00 0.12 0.27 0.25   0 0.18 0.05 0.31
## w5iosAvg 0.05 0.07 0.01 0.10 0.25 0.23   0 0.20 0.10 0.69
describeBy(d[c("w1ios", "w2iosAvg", "w3iosAvg", "w4iosAvg", "w5iosAvg")])
## Warning in describeBy(d[c("w1ios", "w2iosAvg", "w3iosAvg", "w4iosAvg",
## "w5iosAvg")]): no grouping variable requested

gratitude week 2-5

psych::alpha(d[c("grat2", "grat3", "grat4", "grat5")]) #.85
## 
## Reliability analysis   
## Call: psych::alpha(x = d[c("grat2", "grat3", "grat4", "grat5")])
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean  sd median_r
##       0.85      0.85    0.83      0.58 5.6 0.011  3.4 1.6      0.6
## 
##  lower alpha upper     95% confidence boundaries
## 0.83 0.85 0.87 
## 
##  Reliability if an item is dropped:
##       raw_alpha std.alpha G6(smc) average_r S/N alpha se  var.r med.r
## grat2      0.84      0.84    0.79      0.63 5.2    0.013 0.0062  0.68
## grat3      0.79      0.79    0.74      0.55 3.7    0.017 0.0216  0.58
## grat4      0.76      0.76    0.70      0.52 3.2    0.019 0.0141  0.54
## grat5      0.83      0.83    0.77      0.63 5.0    0.013 0.0026  0.63
## 
##  Item statistics 
##         n raw.r std.r r.cor r.drop mean  sd
## grat2 383  0.86  0.78  0.67   0.61  3.5 1.8
## grat3 366  0.89  0.86  0.80   0.73  3.4 1.8
## grat4 320  0.88  0.89  0.85   0.78  3.5 1.9
## grat5 143  0.87  0.79  0.69   0.62  3.6 1.9
## 
## Non missing response frequency for each item
##          0    1    2    3    4    5    6 miss
## grat2 0.09 0.07 0.10 0.22 0.21 0.16 0.14 0.22
## grat3 0.10 0.05 0.13 0.21 0.23 0.13 0.14 0.25
## grat4 0.11 0.05 0.10 0.14 0.25 0.18 0.16 0.35
## grat5 0.11 0.05 0.12 0.13 0.25 0.17 0.17 0.71
describeBy(d[c("grat2", "grat3", "grat4", "grat5")])
## Warning in describeBy(d[c("grat2", "grat3", "grat4", "grat5")]): no grouping
## variable requested

anger

psych::alpha(d[c("anger2", "anger3", "anger4", "anger5")]) #.81
## 
## Reliability analysis   
## Call: psych::alpha(x = d[c("anger2", "anger3", "anger4", "anger5")])
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean  sd median_r
##       0.81      0.81    0.79      0.51 4.2 0.014  1.1 1.4     0.55
## 
##  lower alpha upper     95% confidence boundaries
## 0.78 0.81 0.83 
## 
##  Reliability if an item is dropped:
##        raw_alpha std.alpha G6(smc) average_r S/N alpha se   var.r med.r
## anger2      0.79      0.79    0.72      0.56 3.8    0.016 0.00032  0.56
## anger3      0.72      0.72    0.66      0.46 2.6    0.022 0.02177  0.52
## anger4      0.74      0.74    0.69      0.48 2.8    0.020 0.02637  0.56
## anger5      0.78      0.78    0.71      0.55 3.6    0.017 0.00139  0.54
## 
##  Item statistics 
##          n raw.r std.r r.cor r.drop mean  sd
## anger2 380  0.85  0.75  0.64   0.57 1.09 1.6
## anger3 369  0.89  0.84  0.78   0.71 1.19 1.7
## anger4 317  0.84  0.83  0.74   0.67 0.92 1.5
## anger5 147  0.79  0.76  0.66   0.57 0.88 1.4
## 
## Non missing response frequency for each item
##           0    1    2    3    4    5    6 miss
## anger2 0.57 0.15 0.08 0.07 0.06 0.05 0.01 0.23
## anger3 0.56 0.13 0.10 0.07 0.05 0.04 0.04 0.25
## anger4 0.61 0.16 0.06 0.09 0.04 0.02 0.02 0.35
## anger5 0.59 0.18 0.10 0.07 0.02 0.01 0.02 0.70
describeBy(d[c("anger2", "anger3", "anger4", "anger5")])
## Warning in describeBy(d[c("anger2", "anger3", "anger4", "anger5")]): no grouping
## variable requested

irritated

psych::alpha(d[c("irritated2", "irritated3", "irritated4", "irritated5")]) #.81
## 
## Reliability analysis   
## Call: psych::alpha(x = d[c("irritated2", "irritated3", "irritated4", 
##     "irritated5")])
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean  sd median_r
##       0.81      0.81    0.78      0.52 4.2 0.014  1.4 1.5     0.54
## 
##  lower alpha upper     95% confidence boundaries
## 0.78 0.81 0.84 
## 
##  Reliability if an item is dropped:
##            raw_alpha std.alpha G6(smc) average_r S/N alpha se   var.r med.r
## irritated2      0.77      0.77    0.69      0.53 3.4    0.018 0.00069  0.53
## irritated3      0.74      0.74    0.66      0.48 2.8    0.021 0.00821  0.53
## irritated4      0.75      0.75    0.69      0.50 3.1    0.019 0.01179  0.56
## irritated5      0.78      0.78    0.70      0.54 3.5    0.017 0.00140  0.54
## 
##  Item statistics 
##              n raw.r std.r r.cor r.drop mean  sd
## irritated2 383  0.85  0.78  0.68   0.60  1.4 1.7
## irritated3 371  0.87  0.83  0.75   0.67  1.4 1.8
## irritated4 320  0.83  0.81  0.71   0.64  1.3 1.7
## irritated5 146  0.81  0.77  0.66   0.59  1.2 1.7
## 
## Non missing response frequency for each item
##               0    1    2    3    4    5    6 miss
## irritated2 0.48 0.15 0.13 0.08 0.09 0.05 0.03 0.22
## irritated3 0.48 0.17 0.11 0.08 0.07 0.05 0.05 0.24
## irritated4 0.48 0.22 0.10 0.08 0.05 0.03 0.04 0.35
## irritated5 0.53 0.16 0.10 0.08 0.04 0.05 0.03 0.70
describeBy(d[c("irritated2", "irritated3", "irritated4", "irritated5")])
## Warning in describeBy(d[c("irritated2", "irritated3", "irritated4",
## "irritated5")]): no grouping variable requested

happy

psych::alpha(d[c("happy2", "happy3", "happy4", "happy5")]) #.85
## 
## Reliability analysis   
## Call: psych::alpha(x = d[c("happy2", "happy3", "happy4", "happy5")])
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean  sd median_r
##       0.85      0.85    0.81      0.58 5.6 0.011  3.9 1.5     0.58
## 
##  lower alpha upper     95% confidence boundaries
## 0.83 0.85 0.87 
## 
##  Reliability if an item is dropped:
##        raw_alpha std.alpha G6(smc) average_r S/N alpha se   var.r med.r
## happy2      0.82      0.82    0.76      0.61 4.6    0.014 0.00283  0.64
## happy3      0.81      0.81    0.74      0.58 4.2    0.015 0.00371  0.59
## happy4      0.78      0.78    0.71      0.54 3.6    0.017 0.00061  0.55
## happy5      0.82      0.82    0.75      0.60 4.4    0.014 0.00120  0.59
## 
##  Item statistics 
##          n raw.r std.r r.cor r.drop mean  sd
## happy2 383  0.86  0.81  0.70   0.65  4.0 1.5
## happy3 369  0.88  0.83  0.75   0.69  3.9 1.6
## happy4 319  0.88  0.86  0.81   0.75  4.0 1.6
## happy5 147  0.88  0.82  0.72   0.67  4.1 1.7
## 
## Non missing response frequency for each item
##           0    1    2    3    4    5    6 miss
## happy2 0.05 0.02 0.08 0.16 0.27 0.26 0.15 0.22
## happy3 0.06 0.04 0.07 0.18 0.30 0.18 0.17 0.25
## happy4 0.07 0.03 0.07 0.14 0.26 0.25 0.18 0.35
## happy5 0.06 0.03 0.05 0.16 0.19 0.27 0.24 0.70
describeBy(d[c("happy2", "happy3", "happy4", "happy5")])
## Warning in describeBy(d[c("happy2", "happy3", "happy4", "happy5")]): no grouping
## variable requested

thankful

psych::alpha(d[c("thankful2", "thankful3", "thankful4", "thankful5")]) #.87
## 
## Reliability analysis   
## Call: psych::alpha(x = d[c("thankful2", "thankful3", "thankful4", "thankful5")])
## 
##   raw_alpha std.alpha G6(smc) average_r S/N    ase mean  sd median_r
##       0.87      0.87    0.85      0.63 6.8 0.0094  3.4 1.6     0.62
## 
##  lower alpha upper     95% confidence boundaries
## 0.85 0.87 0.89 
## 
##  Reliability if an item is dropped:
##           raw_alpha std.alpha G6(smc) average_r S/N alpha se  var.r med.r
## thankful2      0.87      0.87    0.82      0.68 6.5    0.010 0.0036  0.69
## thankful3      0.83      0.83    0.79      0.62 4.9    0.013 0.0141  0.62
## thankful4      0.80      0.80    0.74      0.57 4.0    0.015 0.0040  0.60
## thankful5      0.84      0.84    0.78      0.64 5.3    0.012 0.0023  0.62
## 
##  Item statistics 
##             n raw.r std.r r.cor r.drop mean  sd
## thankful2 380  0.85  0.80  0.69   0.65  3.5 1.8
## thankful3 371  0.89  0.86  0.79   0.74  3.4 1.8
## thankful4 319  0.89  0.90  0.87   0.81  3.5 1.9
## thankful5 147  0.89  0.84  0.78   0.72  3.7 1.8
## 
## Non missing response frequency for each item
##              0    1    2    3    4    5    6 miss
## thankful2 0.09 0.05 0.10 0.22 0.21 0.20 0.13 0.23
## thankful3 0.10 0.08 0.12 0.17 0.23 0.14 0.16 0.24
## thankful4 0.11 0.08 0.08 0.18 0.18 0.22 0.15 0.35
## thankful5 0.10 0.03 0.12 0.18 0.18 0.20 0.20 0.70
describeBy(d[c("thankful2", "thankful3", "thankful4", "thankful5")])
## Warning in describeBy(d[c("thankful2", "thankful3", "thankful4", "thankful5")]):
## no grouping variable requested

appreciative

psych::alpha(d[c("appreciative2", "appreciative3", "appreciative4", "appreciative5")]) #.87
## 
## Reliability analysis   
## Call: psych::alpha(x = d[c("appreciative2", "appreciative3", "appreciative4", 
##     "appreciative5")])
## 
##   raw_alpha std.alpha G6(smc) average_r S/N  ase mean  sd median_r
##       0.86      0.86    0.84      0.61 6.2 0.01  3.5 1.6     0.61
## 
##  lower alpha upper     95% confidence boundaries
## 0.84 0.86 0.88 
## 
##  Reliability if an item is dropped:
##               raw_alpha std.alpha G6(smc) average_r S/N alpha se  var.r med.r
## appreciative2      0.86      0.86    0.81      0.66 5.9    0.011 0.0088  0.68
## appreciative3      0.82      0.82    0.78      0.60 4.5    0.014 0.0219  0.60
## appreciative4      0.78      0.78    0.71      0.54 3.6    0.017 0.0070  0.56
## appreciative5      0.84      0.84    0.78      0.63 5.1    0.013 0.0019  0.62
## 
##  Item statistics 
##                 n raw.r std.r r.cor r.drop mean  sd
## appreciative2 385  0.85  0.79  0.68   0.63  3.7 1.7
## appreciative3 369  0.89  0.85  0.78   0.72  3.5 1.8
## appreciative4 319  0.88  0.90  0.88   0.81  3.5 1.9
## appreciative5 148  0.88  0.82  0.75   0.68  3.8 1.8
## 
## Non missing response frequency for each item
##                  0    1    2    3    4    5    6 miss
## appreciative2 0.08 0.06 0.07 0.21 0.24 0.20 0.15 0.22
## appreciative3 0.10 0.05 0.10 0.18 0.25 0.15 0.16 0.25
## appreciative4 0.11 0.08 0.08 0.18 0.18 0.22 0.15 0.35
## appreciative5 0.10 0.03 0.09 0.16 0.22 0.20 0.20 0.70
describeBy(d[c("appreciative2", "appreciative3", "appreciative4", "appreciative5")])
## Warning in describeBy(d[c("appreciative2", "appreciative3", "appreciative4", :
## no grouping variable requested

gratitude scale

psych::alpha(d[c("appreciative2", "appreciative3", "appreciative4", "appreciative5",
                 "thankful2", "thankful3", "thankful4", "thankful5",
                 "grat2", "grat3", "grat4", "grat5")]) #alpha = .96
## Warning in cor.smooth(r): Matrix was not positive definite, smoothing was done
## Warning in cor.smooth(R): Matrix was not positive definite, smoothing was done

## Warning in cor.smooth(R): Matrix was not positive definite, smoothing was done

## Warning in cor.smooth(R): Matrix was not positive definite, smoothing was done

## Warning in cor.smooth(R): Matrix was not positive definite, smoothing was done

## Warning in cor.smooth(R): Matrix was not positive definite, smoothing was done

## Warning in cor.smooth(R): Matrix was not positive definite, smoothing was done

## Warning in cor.smooth(R): Matrix was not positive definite, smoothing was done

## Warning in cor.smooth(R): Matrix was not positive definite, smoothing was done

## Warning in cor.smooth(R): Matrix was not positive definite, smoothing was done
## In smc, smcs < 0 were set to .0
## Warning in cor.smooth(R): Matrix was not positive definite, smoothing was done

## Warning in cor.smooth(R): Matrix was not positive definite, smoothing was done
## 
## Reliability analysis   
## Call: psych::alpha(x = d[c("appreciative2", "appreciative3", "appreciative4", 
##     "appreciative5", "thankful2", "thankful3", "thankful4", "thankful5", 
##     "grat2", "grat3", "grat4", "grat5")])
## 
##   raw_alpha std.alpha G6(smc) average_r S/N    ase mean  sd median_r
##       0.96      0.96    0.98      0.66  23 0.0029  3.5 1.6     0.62
## 
##  lower alpha upper     95% confidence boundaries
## 0.95 0.96 0.96 
## 
##  Reliability if an item is dropped:
##               raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## appreciative2      0.96      0.96    0.97      0.67  22   0.0030 0.020  0.67
## appreciative3      0.95      0.95    0.97      0.66  21   0.0032 0.022  0.62
## appreciative4      0.95      0.95    0.98      0.65  20   0.0034 0.022  0.62
## appreciative5      0.96      0.96    0.97      0.66  22   0.0031 0.020  0.62
## thankful2          0.96      0.96    0.97      0.67  22   0.0030 0.021  0.67
## thankful3          0.95      0.95    0.97      0.66  21   0.0032 0.022  0.62
## thankful4          0.95      0.95    0.98      0.65  20   0.0034 0.022  0.62
## thankful5          0.95      0.95    0.97      0.66  21   0.0032 0.021  0.62
## grat2              0.96      0.96    0.97      0.67  22   0.0030 0.021  0.67
## grat3              0.96      0.95    0.97      0.66  21   0.0032 0.023  0.62
## grat4              0.95      0.95    0.96      0.65  21   0.0033 0.023  0.62
## grat5              0.96      0.96    0.97      0.67  22   0.0030 0.018  0.62
## 
##  Item statistics 
##                 n raw.r std.r r.cor r.drop mean  sd
## appreciative2 385  0.82  0.77  0.77   0.72  3.7 1.7
## appreciative3 369  0.88  0.85  0.85   0.82  3.5 1.8
## appreciative4 319  0.88  0.90  0.85   0.88  3.5 1.9
## appreciative5 148  0.87  0.81  0.81   0.77  3.8 1.8
## thankful2     380  0.84  0.78  0.78   0.74  3.5 1.8
## thankful3     371  0.87  0.85  0.85   0.81  3.4 1.8
## thankful4     319  0.88  0.90  0.85   0.88  3.5 1.9
## thankful5     147  0.90  0.84  0.85   0.81  3.7 1.8
## grat2         383  0.82  0.77  0.76   0.72  3.5 1.8
## grat3         366  0.87  0.84  0.84   0.80  3.4 1.8
## grat4         320  0.86  0.88  0.87   0.85  3.5 1.9
## grat5         143  0.84  0.77  0.77   0.73  3.6 1.9
## 
## Non missing response frequency for each item
##                  0    1    2    3    4    5    6 miss
## appreciative2 0.08 0.06 0.07 0.21 0.24 0.20 0.15 0.22
## appreciative3 0.10 0.05 0.10 0.18 0.25 0.15 0.16 0.25
## appreciative4 0.11 0.08 0.08 0.18 0.18 0.22 0.15 0.35
## appreciative5 0.10 0.03 0.09 0.16 0.22 0.20 0.20 0.70
## thankful2     0.09 0.05 0.10 0.22 0.21 0.20 0.13 0.23
## thankful3     0.10 0.08 0.12 0.17 0.23 0.14 0.16 0.24
## thankful4     0.11 0.08 0.08 0.18 0.18 0.22 0.15 0.35
## thankful5     0.10 0.03 0.12 0.18 0.18 0.20 0.20 0.70
## grat2         0.09 0.07 0.10 0.22 0.21 0.16 0.14 0.22
## grat3         0.10 0.05 0.13 0.21 0.23 0.13 0.14 0.25
## grat4         0.11 0.05 0.10 0.14 0.25 0.18 0.16 0.35
## grat5         0.11 0.05 0.12 0.13 0.25 0.17 0.17 0.71
describeBy(d[c("appreciative2", "appreciative3", "appreciative4", "appreciative5",
                 "thankful2", "thankful3", "thankful4", "thankful5",
                 "grat2", "grat3", "grat4", "grat5")])
## Warning in describeBy(d[c("appreciative2", "appreciative3", "appreciative4", :
## no grouping variable requested

need 1-9 for week 1-5

psych::alpha(d[c("w1need1", 
                 "w1need2", 
                 "w1need3", 
                 "w1need4", 
                 "w1need5", 
                 "w1need6", 
                 "w1need7", 
                 "w1need8", 
                 "w1need9")]) #.56
## Warning in psych::alpha(d[c("w1need1", "w1need2", "w1need3", "w1need4", : Some items were negatively correlated with the total scale and probably 
## should be reversed.  
## To do this, run the function again with the 'check.keys=TRUE' option
## Some items ( w1need2 ) were negatively correlated with the total scale and 
## probably should be reversed.  
## To do this, run the function again with the 'check.keys=TRUE' option
## 
## Reliability analysis   
## Call: psych::alpha(x = d[c("w1need1", "w1need2", "w1need3", "w1need4", 
##     "w1need5", "w1need6", "w1need7", "w1need8", "w1need9")])
## 
##   raw_alpha std.alpha G6(smc) average_r  S/N   ase mean   sd median_r
##       0.56       0.5    0.61     0.098 0.98 0.028  3.4 0.84     0.14
## 
##  lower alpha upper     95% confidence boundaries
## 0.5 0.56 0.61 
## 
##  Reliability if an item is dropped:
##         raw_alpha std.alpha G6(smc) average_r  S/N alpha se var.r med.r
## w1need1      0.54      0.48    0.56     0.103 0.92    0.029 0.046  0.14
## w1need2      0.66      0.67    0.68     0.199 1.99    0.023 0.014  0.24
## w1need3      0.47      0.40    0.53     0.077 0.67    0.032 0.069  0.14
## w1need4      0.48      0.40    0.54     0.077 0.67    0.032 0.062  0.12
## w1need5      0.50      0.43    0.56     0.086 0.76    0.031 0.058  0.11
## w1need6      0.50      0.42    0.56     0.083 0.72    0.031 0.066  0.12
## w1need7      0.47      0.39    0.54     0.074 0.64    0.033 0.063  0.11
## w1need8      0.57      0.50    0.62     0.110 0.98    0.027 0.073  0.24
## w1need9      0.47      0.39    0.53     0.074 0.64    0.033 0.068  0.12
## 
##  Item statistics 
##           n raw.r std.r r.cor r.drop mean  sd
## w1need1 486  0.38  0.41  0.37   0.21  2.0 1.3
## w1need2 486 -0.28 -0.26 -0.48  -0.42  5.7 1.3
## w1need3 486  0.62  0.59  0.53   0.41  3.7 2.0
## w1need4 486  0.60  0.59  0.53   0.39  3.4 2.0
## w1need5 486  0.53  0.53  0.46   0.33  3.5 1.8
## w1need6 486  0.52  0.56  0.46   0.34  2.3 1.6
## w1need7 486  0.61  0.61  0.54   0.42  4.4 1.9
## w1need8 486  0.38  0.37  0.18   0.13  3.3 2.0
## w1need9 486  0.63  0.61  0.55   0.42  2.8 2.0
## 
## Non missing response frequency for each item
##            1    2    3    4    5    6    7 miss
## w1need1 0.51 0.27 0.06 0.08 0.05 0.01 0.01 0.01
## w1need2 0.01 0.02 0.07 0.05 0.17 0.41 0.27 0.01
## w1need3 0.19 0.21 0.08 0.07 0.24 0.12 0.09 0.01
## w1need4 0.25 0.18 0.07 0.06 0.28 0.11 0.04 0.01
## w1need5 0.17 0.23 0.08 0.16 0.19 0.12 0.04 0.01
## w1need6 0.43 0.30 0.04 0.09 0.09 0.04 0.02 0.01
## w1need7 0.12 0.10 0.08 0.07 0.31 0.20 0.12 0.01
## w1need8 0.27 0.19 0.07 0.12 0.17 0.13 0.04 0.01
## w1need9 0.42 0.18 0.09 0.09 0.06 0.08 0.08 0.01
psych::alpha(d[c("w2need1", 
                 "w2need2", 
                 "w2need3", 
                 "w2need4", 
                 "w2need5", 
                 "w2need6", 
                 "w2need7", 
                 "w2need8", 
                 "w2need9")]) #.62
## Warning in psych::alpha(d[c("w2need1", "w2need2", "w2need3", "w2need4", : Some items were negatively correlated with the total scale and probably 
## should be reversed.  
## To do this, run the function again with the 'check.keys=TRUE' option
## Some items ( w2need2 ) were negatively correlated with the total scale and 
## probably should be reversed.  
## To do this, run the function again with the 'check.keys=TRUE' option
## 
## Reliability analysis   
## Call: psych::alpha(x = d[c("w2need1", "w2need2", "w2need3", "w2need4", 
##     "w2need5", "w2need6", "w2need7", "w2need8", "w2need9")])
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean   sd median_r
##       0.62      0.57    0.67      0.13 1.3 0.024  3.6 0.91     0.18
## 
##  lower alpha upper     95% confidence boundaries
## 0.57 0.62 0.67 
## 
##  Reliability if an item is dropped:
##         raw_alpha std.alpha G6(smc) average_r  S/N alpha se var.r med.r
## w2need1      0.61      0.57    0.62      0.14 1.30    0.025 0.043  0.19
## w2need2      0.70      0.70    0.72      0.23 2.38    0.020 0.014  0.20
## w2need3      0.54      0.48    0.60      0.10 0.91    0.029 0.065  0.16
## w2need4      0.56      0.50    0.62      0.11 0.99    0.028 0.062  0.16
## w2need5      0.57      0.50    0.62      0.11 1.01    0.027 0.059  0.15
## w2need6      0.55      0.48    0.58      0.10 0.94    0.028 0.059  0.18
## w2need7      0.56      0.50    0.62      0.11 1.00    0.027 0.065  0.16
## w2need8      0.62      0.56    0.66      0.14 1.27    0.023 0.072  0.20
## w2need9      0.56      0.50    0.61      0.11 1.01    0.027 0.064  0.17
## 
##  Item statistics 
##           n raw.r std.r r.cor r.drop mean  sd
## w2need1 468  0.39  0.40  0.36   0.23  1.9 1.3
## w2need2 468 -0.21 -0.18 -0.37  -0.35  5.6 1.3
## w2need3 468  0.67  0.65  0.59   0.48  3.7 2.2
## w2need4 468  0.61  0.60  0.52   0.42  3.9 2.0
## w2need5 468  0.58  0.58  0.51   0.39  3.6 1.9
## w2need6 468  0.61  0.63  0.60   0.46  2.2 1.6
## w2need7 468  0.58  0.59  0.50   0.40  4.9 1.9
## w2need8 468  0.44  0.42  0.26   0.21  3.6 2.1
## w2need9 468  0.59  0.58  0.51   0.39  2.8 2.0
## 
## Non missing response frequency for each item
##            1    2    3    4    5    6    7 miss
## w2need1 0.52 0.27 0.08 0.03 0.07 0.03 0.00 0.05
## w2need2 0.00 0.05 0.03 0.07 0.22 0.37 0.26 0.05
## w2need3 0.26 0.16 0.05 0.06 0.21 0.14 0.11 0.05
## w2need4 0.18 0.19 0.05 0.09 0.22 0.20 0.07 0.05
## w2need5 0.17 0.21 0.09 0.08 0.27 0.14 0.04 0.05
## w2need6 0.47 0.25 0.09 0.05 0.06 0.05 0.02 0.05
## w2need7 0.07 0.11 0.05 0.05 0.27 0.25 0.19 0.05
## w2need8 0.24 0.18 0.05 0.14 0.18 0.12 0.10 0.05
## w2need9 0.44 0.12 0.07 0.10 0.15 0.10 0.03 0.05
psych::alpha(d[c("w3need1", 
                 "w3need2", 
                 "w3need3", 
                 "w3need4", 
                 "w3need5", 
                 "w3need6", 
                 "w3need7", 
                 "w3need8", 
                 "w3need9")]) #.60
## Warning in psych::alpha(d[c("w3need1", "w3need2", "w3need3", "w3need4", : Some items were negatively correlated with the total scale and probably 
## should be reversed.  
## To do this, run the function again with the 'check.keys=TRUE' option
## Some items ( w3need2 ) were negatively correlated with the total scale and 
## probably should be reversed.  
## To do this, run the function again with the 'check.keys=TRUE' option
## 
## Reliability analysis   
## Call: psych::alpha(x = d[c("w3need1", "w3need2", "w3need3", "w3need4", 
##     "w3need5", "w3need6", "w3need7", "w3need8", "w3need9")])
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean   sd median_r
##        0.6      0.56    0.68      0.12 1.3 0.024  3.4 0.88     0.24
## 
##  lower alpha upper     95% confidence boundaries
## 0.55 0.6 0.65 
## 
##  Reliability if an item is dropped:
##         raw_alpha std.alpha G6(smc) average_r  S/N alpha se var.r med.r
## w3need1      0.57      0.52    0.61     0.121 1.10    0.026 0.072  0.21
## w3need2      0.72      0.73    0.74     0.254 2.72    0.019 0.017  0.26
## w3need3      0.51      0.46    0.61     0.097 0.86    0.029 0.099  0.24
## w3need4      0.50      0.45    0.59     0.091 0.80    0.031 0.085  0.19
## w3need5      0.50      0.44    0.59     0.089 0.78    0.031 0.080  0.19
## w3need6      0.53      0.47    0.62     0.098 0.87    0.028 0.093  0.19
## w3need7      0.54      0.49    0.63     0.107 0.96    0.027 0.094  0.19
## w3need8      0.62      0.57    0.68     0.141 1.32    0.023 0.100  0.26
## w3need9      0.55      0.49    0.62     0.108 0.97    0.027 0.090  0.21
## 
##  Item statistics 
##           n raw.r std.r r.cor r.drop mean  sd
## w3need1 450  0.44  0.48  0.47   0.30  1.9 1.3
## w3need2 450 -0.39 -0.40 -0.59  -0.53  5.4 1.5
## w3need3 450  0.66  0.64  0.57   0.47  3.5 2.0
## w3need4 450  0.69  0.68  0.65   0.53  3.4 2.0
## w3need5 450  0.69  0.70  0.67   0.54  3.7 1.9
## w3need6 450  0.61  0.63  0.56   0.45  2.5 1.7
## w3need7 450  0.57  0.57  0.48   0.38  4.5 1.9
## w3need8 445  0.36  0.35  0.18   0.12  3.3 2.0
## w3need9 446  0.58  0.57  0.50   0.37  2.8 2.0
## 
## Non missing response frequency for each item
##            1    2    3    4    5    6    7 miss
## w3need1 0.51 0.27 0.09 0.05 0.07 0.01 0.00 0.08
## w3need2 0.00 0.08 0.08 0.04 0.21 0.36 0.24 0.08
## w3need3 0.22 0.20 0.09 0.07 0.22 0.10 0.09 0.08
## w3need4 0.24 0.23 0.05 0.06 0.28 0.06 0.08 0.08
## w3need5 0.18 0.19 0.05 0.15 0.26 0.14 0.04 0.08
## w3need6 0.40 0.25 0.10 0.09 0.08 0.07 0.01 0.08
## w3need7 0.09 0.12 0.10 0.08 0.21 0.29 0.12 0.08
## w3need8 0.26 0.22 0.04 0.17 0.13 0.14 0.04 0.09
## w3need9 0.40 0.23 0.03 0.07 0.11 0.12 0.04 0.09
psych::alpha(d[c("w4need1", 
                 "w4need2", 
                 "w4need3", 
                 "w4need4", 
                 "w4need5", 
                 "w4need6", 
                 "w4need7", 
                 "w4need8", 
                 "w4need9")]) #.66
## Warning in psych::alpha(d[c("w4need1", "w4need2", "w4need3", "w4need4", : Some items were negatively correlated with the total scale and probably 
## should be reversed.  
## To do this, run the function again with the 'check.keys=TRUE' option
## Some items ( w4need2 ) were negatively correlated with the total scale and 
## probably should be reversed.  
## To do this, run the function again with the 'check.keys=TRUE' option
## 
## Reliability analysis   
## Call: psych::alpha(x = d[c("w4need1", "w4need2", "w4need3", "w4need4", 
##     "w4need5", "w4need6", "w4need7", "w4need8", "w4need9")])
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean   sd median_r
##       0.66      0.63    0.73      0.16 1.7 0.021  3.3 0.93     0.25
## 
##  lower alpha upper     95% confidence boundaries
## 0.62 0.66 0.7 
## 
##  Reliability if an item is dropped:
##         raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## w4need1      0.65      0.62    0.69      0.17 1.6    0.022 0.065  0.26
## w4need2      0.75      0.76    0.76      0.28 3.1    0.017 0.015  0.29
## w4need3      0.56      0.52    0.64      0.12 1.1    0.027 0.080  0.21
## w4need4      0.61      0.58    0.70      0.14 1.4    0.023 0.083  0.21
## w4need5      0.58      0.54    0.67      0.13 1.2    0.025 0.079  0.19
## w4need6      0.58      0.53    0.65      0.12 1.1    0.026 0.072  0.21
## w4need7      0.62      0.58    0.70      0.15 1.4    0.023 0.086  0.26
## w4need8      0.66      0.62    0.72      0.17 1.7    0.021 0.089  0.29
## w4need9      0.59      0.55    0.67      0.13 1.2    0.025 0.084  0.25
## 
##  Item statistics 
##           n raw.r std.r r.cor r.drop mean  sd
## w4need1 401  0.38  0.42  0.38   0.24  1.9 1.3
## w4need2 401 -0.27 -0.27 -0.43  -0.42  5.5 1.5
## w4need3 401  0.74  0.73  0.71   0.59  3.5 2.1
## w4need4 401  0.59  0.58  0.49   0.40  3.5 2.0
## w4need5 401  0.68  0.69  0.64   0.54  3.0 1.7
## w4need6 401  0.69  0.71  0.69   0.57  2.2 1.6
## w4need7 401  0.57  0.56  0.46   0.38  4.5 1.9
## w4need8 401  0.45  0.42  0.29   0.23  3.3 2.1
## w4need9 401  0.67  0.67  0.62   0.51  2.6 1.9
## 
## Non missing response frequency for each item
##            1    2    3    4    5    6    7 miss
## w4need1 0.49 0.31 0.08 0.02 0.08 0.01 0.00 0.18
## w4need2 0.00 0.07 0.09 0.02 0.22 0.31 0.28 0.18
## w4need3 0.27 0.16 0.09 0.07 0.17 0.16 0.08 0.18
## w4need4 0.24 0.17 0.07 0.11 0.24 0.11 0.06 0.18
## w4need5 0.22 0.31 0.07 0.10 0.24 0.05 0.01 0.18
## w4need6 0.53 0.18 0.08 0.08 0.06 0.05 0.01 0.18
## w4need7 0.11 0.12 0.08 0.06 0.23 0.29 0.11 0.18
## w4need8 0.28 0.20 0.04 0.14 0.16 0.09 0.09 0.18
## w4need9 0.43 0.24 0.07 0.04 0.08 0.11 0.04 0.18
psych::alpha(d[c("w5need1", 
                 "w5need2", 
                 "w5need3", 
                 "w5need4", 
                 "w5need5", 
                 "w5need6", 
                 "w5need7", 
                 "w5need8", 
                 "w5need9")]) #.44
## Warning in psych::alpha(d[c("w5need1", "w5need2", "w5need3", "w5need4", : Some items were negatively correlated with the total scale and probably 
## should be reversed.  
## To do this, run the function again with the 'check.keys=TRUE' option
## Some items ( w5need2 ) were negatively correlated with the total scale and 
## probably should be reversed.  
## To do this, run the function again with the 'check.keys=TRUE' option
## 
## Reliability analysis   
## Call: psych::alpha(x = d[c("w5need1", "w5need2", "w5need3", "w5need4", 
##     "w5need5", "w5need6", "w5need7", "w5need8", "w5need9")])
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean   sd median_r
##       0.48      0.44     0.7     0.081 0.8 0.032  3.4 0.82      0.1
## 
##  lower alpha upper     95% confidence boundaries
## 0.42 0.48 0.55 
## 
##  Reliability if an item is dropped:
##         raw_alpha std.alpha G6(smc) average_r  S/N alpha se var.r med.r
## w5need1      0.43      0.37    0.62     0.068 0.59    0.036 0.078 0.078
## w5need2      0.65      0.67    0.76     0.201 2.01    0.024 0.042 0.217
## w5need3      0.40      0.36    0.61     0.065 0.55    0.036 0.122 0.114
## w5need4      0.46      0.41    0.64     0.080 0.70    0.034 0.111 0.078
## w5need5      0.38      0.31    0.64     0.052 0.44    0.039 0.116 0.058
## w5need6      0.31      0.25    0.58     0.039 0.33    0.044 0.086 0.058
## w5need7      0.39      0.33    0.63     0.058 0.49    0.038 0.110 0.078
## w5need8      0.48      0.44    0.69     0.088 0.77    0.031 0.127 0.159
## w5need9      0.47      0.41    0.68     0.080 0.70    0.033 0.115 0.130
## 
##  Item statistics 
##           n raw.r std.r r.cor r.drop mean  sd
## w5need1 194  0.48  0.52  0.55   0.33  1.8 1.3
## w5need2 194 -0.43 -0.44 -0.60  -0.58  5.5 1.5
## w5need3 194  0.59  0.55  0.50   0.35  3.5 2.1
## w5need4 190  0.46  0.44  0.37   0.20  3.5 1.9
## w5need5 194  0.61  0.64  0.55   0.43  3.0 1.7
## w5need6 194  0.72  0.73  0.75   0.54  2.7 2.0
## w5need7 194  0.59  0.60  0.54   0.38  4.5 1.8
## w5need8 194  0.40  0.38  0.23   0.13  3.4 2.0
## w5need9 194  0.43  0.44  0.32   0.18  2.8 2.0
## 
## Non missing response frequency for each item
##            1    2    3    4    5    6    7 miss
## w5need1 0.60 0.24 0.05 0.04 0.05 0.03 0.00 0.60
## w5need2 0.03 0.04 0.07 0.02 0.21 0.37 0.26 0.60
## w5need3 0.25 0.21 0.06 0.05 0.23 0.11 0.10 0.60
## w5need4 0.17 0.26 0.11 0.00 0.29 0.11 0.05 0.61
## w5need5 0.16 0.41 0.08 0.09 0.18 0.06 0.03 0.60
## w5need6 0.43 0.21 0.07 0.02 0.12 0.10 0.06 0.60
## w5need7 0.07 0.09 0.21 0.03 0.30 0.15 0.16 0.60
## w5need8 0.24 0.17 0.16 0.11 0.10 0.14 0.07 0.60
## w5need9 0.42 0.13 0.09 0.09 0.15 0.06 0.05 0.60
psych::alpha(d[c("w1needAvg", 
                 "w2needAvg", 
                 "w3needAvg", 
                 "w4needAvg", 
                 "w5needAvg")]) #.89
## Number of categories should be increased  in order to count frequencies.
## 
## Reliability analysis   
## Call: psych::alpha(x = d[c("w1needAvg", "w2needAvg", "w3needAvg", "w4needAvg", 
##     "w5needAvg")])
## 
##   raw_alpha std.alpha G6(smc) average_r S/N    ase mean   sd median_r
##       0.89      0.89    0.88      0.61 7.9 0.0078  3.6 0.76     0.64
## 
##  lower alpha upper     95% confidence boundaries
## 0.87 0.89 0.9 
## 
##  Reliability if an item is dropped:
##           raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## w1needAvg      0.85      0.85    0.83      0.59 5.6   0.0109 0.012  0.60
## w2needAvg      0.86      0.85    0.83      0.59 5.9   0.0105 0.020  0.61
## w3needAvg      0.85      0.85    0.83      0.59 5.7   0.0107 0.016  0.60
## w4needAvg      0.86      0.86    0.84      0.61 6.2   0.0100 0.011  0.61
## w5needAvg      0.90      0.90    0.88      0.69 9.0   0.0075 0.002  0.72
## 
##  Item statistics 
##             n raw.r std.r r.cor r.drop mean   sd
## w1needAvg 486  0.88  0.87  0.84   0.80  3.7 0.84
## w2needAvg 468  0.86  0.86  0.82   0.77  3.7 0.92
## w3needAvg 450  0.86  0.87  0.83   0.78  3.6 0.88
## w4needAvg 401  0.86  0.84  0.80   0.75  3.5 0.88
## w5needAvg 194  0.75  0.72  0.60   0.57  3.5 0.79

H1. Do friend ranks predict WTRs?

conclusion: yes, friend ranks predict WTR, B = -.07, t(96.27) = -10.22, p < .001

1. run model

h1 <- lmer(wtr ~ rank + (rank|subID), data = long_final)
summary(h1)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: wtr ~ rank + (rank | subID)
##    Data: long_final
## 
## REML criterion at convergence: -608.2
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.6748 -0.4594  0.0023  0.4245  5.5443 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr 
##  subID    (Intercept) 0.050945 0.2257        
##           rank        0.003025 0.0550   -0.24
##  Residual             0.027067 0.1645        
## Number of obs: 1349, groups:  subID, 99
## 
## Fixed effects:
##              Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)  0.791306   0.025422 95.509076   31.13   <2e-16 ***
## rank        -0.070829   0.006933 96.268621  -10.22   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##      (Intr)
## rank -0.415
tab_model(h1)
  wtr
Predictors Estimates CI p
(Intercept) 0.79 0.74 – 0.84 <0.001
rank -0.07 -0.08 – -0.06 <0.001
Random Effects
σ2 0.03
τ00 subID 0.05
τ11 subID.rank 0.00
ρ01 subID -0.24
ICC 0.68
N subID 99
Observations 1349
Marginal R2 / Conditional R2 0.068 / 0.706

2. plot

## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1106 rows containing non-finite values (stat_smooth).
## Warning: Removed 1106 rows containing missing values (geom_point).

H2. Do WTRs predict gratitude?

Level 1: grat = Bo + B1wtr + Eij Level 2: Bo = a00 + uoj

conclusion: yes, WTR predicts gratitude, B = 2.84, t(67.49) = 9.28, p < .001

1. run model

h2<- lmer(grat ~ wtr + (wtr|subID), data = long_final)
summary(h2)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: grat ~ wtr + (wtr | subID)
##    Data: long_final
## 
## REML criterion at convergence: 3965.8
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.5940 -0.5511  0.0469  0.6110  3.0688 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr 
##  subID    (Intercept) 1.847    1.359         
##           wtr         3.890    1.972    -0.60
##  Residual             1.573    1.254         
## Number of obs: 1118, groups:  subID, 99
## 
## Fixed effects:
##             Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)   1.8537     0.2009 66.9036   9.227 1.52e-13 ***
## wtr           2.8354     0.3056 67.4881   9.279 1.14e-13 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##     (Intr)
## wtr -0.779

2. plot

## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1326 rows containing non-finite values (stat_smooth).
## Warning: Removed 1326 rows containing missing values (geom_point).

H3. Do changes in WTRs predict gratitude each week?

conclusion: yes, change in WTR predicts gratitude at week 5, B = 1.07, t(106.31) = 2.05, p = .043

1. prep data

2. run model

h4 <- lmer(grat ~ wtrDiff + (1 | subID), data = WTR)
summary(h4)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: grat ~ wtrDiff + (1 | subID)
##    Data: WTR
## 
## REML criterion at convergence: 2597.3
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -3.00044 -0.52833  0.07145  0.58912  2.76486 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  subID    (Intercept) 1.083    1.041   
##  Residual             1.954    1.398   
## Number of obs: 699, groups:  subID, 93
## 
## Fixed effects:
##             Estimate Std. Error       df t value Pr(>|t|)    
## (Intercept)   3.5120     0.1235  90.1867   28.43   <2e-16 ***
## wtrDiff      -0.5104     0.2917 661.2395   -1.75   0.0806 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##         (Intr)
## wtrDiff 0.035

3. plot

## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1265 rows containing non-finite values (stat_smooth).
## Warning: Removed 1265 rows containing missing values (geom_point).