to do:

  1. model time as a fixed effect (try polynomial)
  2. fix all the NAs
names(d)[names(d) == 'irrirated5'] <- 'irritated5'
d$w1weight[d$w1weight == "175\n175"] <- 175
d$w1weight <- as.numeric(d$w1weight)

dem <- d[,c("subID", "w1weight", "w2weight", "w3weight", "w4weight", "w5weight", "height", "age", "sex", "class", "friend")]

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$grat1 <- NA
grat <- d[c("subID", "grat1", "grat2", "grat3", "grat4", "grat5")]

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

d$appreciative1 <- NA
appreciative <- d[c("subID", "appreciative1", "appreciative2", "appreciative3",  "appreciative4", "appreciative5")]

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$happy1 <- NA
happy <- d[c("subID", "happy1", "happy2", "happy3",  "happy4", "happy5")]

#create grat construct
x <- cbind(d$thankful2, d$grat2, d$appreciative2)
d$gratScale2 <- rowMeans(x, na.rm = T)

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

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

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")]

# change in WTR
wtrDiff <- data.frame(d$subID)
wtrDiff$wtrDiff10 <- NA
wtrDiff$wtrDiff21 <- d$wtr21diff
wtrDiff$wtrDiff32 <- d$wtr32diff
wtrDiff$wtrDiff43 <- d$wtr43diff
wtrDiff$wtrDiff54 <- d$wtr54diff

# 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")  
wtrDiff_long <- wtrDiff %>% pivot_longer(cols = contains("wtrDiff"), names_to = "delete", values_to = "wtrDiff") 

dem_long <- dem %>% pivot_longer(cols = contains("weight"), names_to = "delete", values_to = "weight")  

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")  
appreciative_long <- appreciative %>% pivot_longer(cols = contains("appreciative"), names_to = "delete", values_to = "appreciative")  
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")  

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")  
happy_long <- happy %>% pivot_longer(cols = contains("happy"), names_to = "delete", values_to = "happy")  

#append to single data frame
d1 <- data.frame(week_long$week)
names(d1)[names(d1) == 'week_long.week'] <- 'week'

d1$age <- dem_long$age
d1$sex <- dem_long$sex
d1$weight <- dem_long$weight
d1$class <- dem_long$class

d1$subID <- week_long$subID
d1$rank <- rank_long$rank
d1$friend <- dem_long$friend

d1$wtr <- wtr_long$wtr
d1$wtrDiff <- wtrDiff_long$wtrDiff

d1$gratScale <- gratScale_long$gratScale
d1$gratScale[d1$gratScale == "NaN"] <- NA
d1$grat <- grat_long$grat
d1$thankful <- thankful_long$thankful
d1$appreciative <- appreciative_long$appreciative

d1$close <- close_long$close
d1$commit <- commit_long$commit
d1$ios <- ios_long$ios

d1$happy <- happy_long$happy
d1$irritated <- irritated_long$irritated
d1$anger <- anger_long$anger

demographics

draw <- read.csv("C:/Users/Marri/Dropbox/graduate school records/research projects/longitudinal gratitude/data prep/long_grat_raw.csv", header = T)

describe(draw$age, na.rm = T)
table(draw$sex)
## 
## female   male 
##     81     34
table(draw$class)
## 
##  freshman    junior    senior sophomore 
##        72        10         5        28

descriptive stats

- close

How close is your friendship with this person? (0 = not at all close, 6 = extremely 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
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt      0.9  0.91  0.92
## Duhachek   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.0089 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 394  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.18
## 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.19
## w4closeAvg 0.02 0.02 0.04   0 0.17 0.26 0.27 0.22 0.31
## w5closeAvg 0.03 0.03 0.03   0 0.10 0.26 0.25 0.30 0.69
describe(d[c("w1close", "w2closeAvg", "w3closeAvg", "w4closeAvg", "w5closeAvg")])

- commit

How committed are you to your friendship with this person? (0 = not at all committed, 6 = extremely committed)

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
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt      0.9  0.91  0.92
## Duhachek   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.0127  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 398  0.90  0.87  0.82   0.79  4.3 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.18
## 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
describe(d[c("w1commit", "w2commitAvg", "w3commitAvg", "w4commitAvg", "w5commitAvg")])

- ios

Using the diagram below, please indicate which picture best described your relationship with this person by selecting a number: 1 = no overlap, 4 = half overlap, 7 = almost complete overlap)

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
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.91  0.92  0.93
## Duhachek  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 10.0   0.0068 0.0039  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.87  4.2 1.6
## w3iosAvg 400  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.18
## 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.30
## w5iosAvg 0.05 0.07 0.01 0.10 0.25 0.23   0 0.20 0.10 0.69
describe(d[c("w1ios", "w2iosAvg", "w3iosAvg", "w4iosAvg", "w5iosAvg")])

The following questions are about this friend: For the questions on this page, please consider the interactions you have had with this person since the last time you filled out this questionnaire.

- gratitude

Over the past two weeks how grateful have you been toward this person?

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
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.82  0.85  0.87
## Duhachek  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 365  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.15 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
describe(d[c("grat2", "grat3", "grat4", "grat5")])

- anger

Over the past two weeks how angry have you been with this person?

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
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.78  0.81  0.83
## Duhachek  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.017 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.02629  0.56
## anger5      0.78      0.78    0.71      0.55 3.6    0.017 0.00137  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 368  0.89  0.84  0.78   0.70 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.22
## 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
describe(d[c("anger2", "anger3", "anger4", "anger5")])

- irritated

Over the past two weeks how irritated have you been with this person?

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.51 4.2 0.014  1.4 1.5     0.54
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.78  0.81  0.84
## Duhachek  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.01175  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 370  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
describe(d[c("irritated2", "irritated3", "irritated4", "irritated5")])

- happy

Over the past two weeks how happy have you been with this person?

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
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.83  0.85  0.87
## Duhachek  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.7    0.014 0.00282  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.55 3.6    0.017 0.00063  0.55
## happy5      0.82      0.82    0.75      0.60 4.5    0.014 0.00121  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 368  0.88  0.83  0.75   0.69  3.8 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
describe(d[c("happy2", "happy3", "happy4", "happy5")])

- thankful

Over the past two weeks how thankful have you been toward this person?

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
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.85  0.87  0.89
## Duhachek  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.0035  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.0041  0.60
## thankful5      0.84      0.84    0.78      0.64 5.3    0.012 0.0024  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 370  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.22
## 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
describe(d[c("thankful2", "thankful3", "thankful4", "thankful5")])

- appreciative

Over the past two weeks how appreciative have you been toward this person?

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.3 0.01  3.5 1.6     0.61
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.84  0.86  0.88
## Duhachek  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.72      0.54 3.6    0.017 0.0071  0.56
## appreciative5      0.84      0.84    0.78      0.63 5.2    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 368  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.21
## appreciative3 0.10 0.05 0.10 0.18 0.25 0.15 0.15 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
describe(d[c("appreciative2", "appreciative3", "appreciative4", "appreciative5")])

- 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
## In smc, smcs < 0 were set to .0
## 
## 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.4 1.6     0.62
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.95  0.96  0.96
## Duhachek  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 368  0.88  0.85  0.86   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     370  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         365  0.87  0.84  0.83   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.21
## appreciative3 0.10 0.05 0.10 0.18 0.25 0.15 0.15 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.22
## 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.15 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

describe(d[c("appreciative2", "appreciative3", "appreciative4", "appreciative5",
                 "thankful2", "thankful3", "thankful4", "thankful5",
                 "grat2", "grat3", "grat4", "grat5")])

- need

1. when I consider my life right now, I would say I am in a terrible place.

2. hen I consider my life right now, i would say I am in a really good place.

Please indicate how much you agree that each of the following are currently a cause of stress:

1. Financial problems (ex: a lack of money, owe someone money, etc.)

2. Health related issues (ex: poor sleep, sickness, injury, death of someone close, etc.)

3. Friend problems (ex: arguments, conflicts with roommate, not enough friends, etc.)

4. General life problems (ex: victim of a crime, car troubles, traffic ticket, etc.)

5. Academic issues (ex: did poorly on a test, a lot of deadlines, etc.)

6. Relationship issues (ex: breaking up with a boy/girlfriend, fights,long-distance relationship, etc.)

7. Family problems (ex: divorce, arguments, not enough support, etc.)

d$w1need2.R <- 8 - d$w1need2
d$w2need2.R <- 8 - d$w2need2
d$w3need2.R <- 8 - d$w3need2
d$w4need2.R <- 8 - d$w4need2
d$w5need2.R <- 8 - d$w5need2

### need 1-9 for week 1-5
psych::alpha(d[c("w1need1", 
                 "w1need2.R", 
                 "w1need3", 
                 "w1need4", 
                 "w1need5", 
                 "w1need6", 
                 "w1need7", 
                 "w1need8", 
                 "w1need9")], check.keys = TRUE) #.56
## 
## Reliability analysis   
## Call: psych::alpha(x = d[c("w1need1", "w1need2.R", "w1need3", "w1need4", 
##     "w1need5", "w1need6", "w1need7", "w1need8", "w1need9")], 
##     check.keys = TRUE)
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean   sd median_r
##       0.69      0.71    0.74      0.21 2.4 0.021  3.1 0.96     0.24
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.65  0.69  0.73
## Duhachek  0.65  0.69  0.73
## 
##  Reliability if an item is dropped:
##           raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## w1need1        0.66      0.67    0.68      0.20 2.0    0.023 0.015  0.23
## w1need2.R      0.66      0.66    0.68      0.20 2.0    0.023 0.014  0.23
## w1need3        0.68      0.70    0.72      0.23 2.3    0.022 0.021  0.25
## w1need4        0.65      0.67    0.70      0.20 2.0    0.024 0.025  0.23
## w1need5        0.65      0.66    0.70      0.20 2.0    0.024 0.025  0.24
## w1need6        0.66      0.68    0.72      0.21 2.1    0.023 0.027  0.23
## w1need7        0.65      0.67    0.71      0.20 2.0    0.024 0.027  0.19
## w1need8        0.71      0.72    0.75      0.24 2.6    0.020 0.023  0.27
## w1need9        0.67      0.69    0.72      0.22 2.2    0.023 0.024  0.25
## 
##  Item statistics 
##             n raw.r std.r r.cor r.drop mean  sd
## w1need1   484  0.53  0.60  0.58   0.40  2.0 1.3
## w1need2.R 484  0.54  0.62  0.61   0.42  2.3 1.3
## w1need3   484  0.52  0.46  0.36   0.32  3.7 2.0
## w1need4   484  0.61  0.60  0.53   0.44  3.5 2.0
## w1need5   484  0.61  0.62  0.56   0.45  3.5 1.8
## w1need6   484  0.53  0.56  0.46   0.38  2.3 1.6
## w1need7   484  0.61  0.60  0.52   0.45  4.4 1.9
## w1need8   484  0.38  0.36  0.20   0.17  3.3 2.0
## w1need9   484  0.55  0.50  0.40   0.35  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.R 0.27 0.41 0.17 0.05 0.07 0.02 0.01 0.01
## w1need3   0.19 0.21 0.08 0.06 0.24 0.12 0.09 0.01
## w1need4   0.25 0.18 0.07 0.06 0.29 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.11 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.10 0.06 0.08 0.08 0.01
psych::alpha(d[c("w2need1", 
                 "w2need2.R", 
                 "w2need3", 
                 "w2need4", 
                 "w2need5", 
                 "w2need6", 
                 "w2need7", 
                 "w2need8", 
                 "w2need9")], check.keys = TRUE) #.62
## 
## Reliability analysis   
## Call: psych::alpha(x = d[c("w2need1", "w2need2.R", "w2need3", "w2need4", 
##     "w2need5", "w2need6", "w2need7", "w2need8", "w2need9")], 
##     check.keys = TRUE)
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean sd median_r
##       0.71      0.73    0.76      0.23 2.6 0.019  3.2  1     0.19
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.67  0.71  0.75
## Duhachek  0.68  0.71  0.75
## 
##  Reliability if an item is dropped:
##           raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## w2need1        0.69      0.69    0.70      0.22 2.2    0.021 0.014  0.20
## w2need2.R      0.70      0.70    0.72      0.23 2.4    0.021 0.014  0.20
## w2need3        0.68      0.70    0.74      0.23 2.3    0.022 0.022  0.19
## w2need4        0.68      0.69    0.73      0.22 2.2    0.022 0.025  0.18
## w2need5        0.67      0.68    0.73      0.21 2.2    0.022 0.024  0.17
## w2need6        0.68      0.70    0.72      0.22 2.3    0.022 0.019  0.19
## w2need7        0.69      0.70    0.74      0.23 2.3    0.021 0.024  0.19
## w2need8        0.73      0.74    0.77      0.26 2.9    0.018 0.019  0.24
## w2need9        0.69      0.70    0.73      0.23 2.3    0.021 0.023  0.19
## 
##  Item statistics 
##             n raw.r std.r r.cor r.drop mean  sd
## w2need1   466  0.55  0.62  0.61   0.43  2.0 1.4
## w2need2.R 466  0.47  0.55  0.52   0.35  2.4 1.3
## w2need3   466  0.62  0.57  0.49   0.43  3.7 2.2
## w2need4   466  0.62  0.60  0.52   0.45  3.9 2.0
## w2need5   466  0.62  0.63  0.56   0.46  3.7 1.9
## w2need6   466  0.58  0.58  0.53   0.44  2.2 1.6
## w2need7   466  0.57  0.56  0.46   0.40  4.9 1.9
## w2need8   466  0.40  0.36  0.21   0.18  3.6 2.1
## w2need9   466  0.58  0.56  0.48   0.40  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.R 0.26 0.37 0.22 0.07 0.03 0.05 0.00 0.05
## w2need3   0.26 0.16 0.05 0.06 0.21 0.14 0.11 0.05
## w2need4   0.17 0.19 0.05 0.09 0.23 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.17 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.R", 
                 "w3need3", 
                 "w3need4", 
                 "w3need5", 
                 "w3need6", 
                 "w3need7", 
                 "w3need8", 
                 "w3need9")], check.keys = TRUE) #.60
## 
## Reliability analysis   
## Call: psych::alpha(x = d[c("w3need1", "w3need2.R", "w3need3", "w3need4", 
##     "w3need5", "w3need6", "w3need7", "w3need8", "w3need9")], 
##     check.keys = TRUE)
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean  sd median_r
##       0.76      0.77     0.8      0.27 3.3 0.017  3.1 1.1     0.28
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.72  0.76  0.79
## Duhachek  0.72  0.76  0.79
## 
##  Reliability if an item is dropped:
##           raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## w3need1        0.73      0.73    0.74      0.26 2.7    0.018 0.018  0.27
## w3need2.R      0.72      0.73    0.73      0.25 2.7    0.019 0.017  0.26
## w3need3        0.74      0.76    0.78      0.28 3.1    0.018 0.025  0.29
## w3need4        0.71      0.73    0.76      0.25 2.7    0.020 0.026  0.26
## w3need5        0.70      0.72    0.75      0.24 2.6    0.020 0.025  0.26
## w3need6        0.73      0.75    0.78      0.27 2.9    0.018 0.027  0.27
## w3need7        0.74      0.75    0.78      0.28 3.0    0.018 0.026  0.30
## w3need8        0.78      0.79    0.80      0.32 3.7    0.015 0.016  0.31
## w3need9        0.74      0.75    0.77      0.27 3.0    0.018 0.022  0.28
## 
##  Item statistics 
##             n raw.r std.r r.cor r.drop mean  sd
## w3need1   448  0.60  0.66  0.65   0.51  1.9 1.3
## w3need2.R 448  0.64  0.69  0.69   0.54  2.6 1.5
## w3need3   448  0.57  0.53  0.44   0.39  3.5 2.0
## w3need4   448  0.69  0.67  0.62   0.56  3.4 2.0
## w3need5   448  0.72  0.72  0.68   0.60  3.7 1.8
## w3need6   448  0.59  0.60  0.51   0.46  2.5 1.7
## w3need7   448  0.56  0.56  0.46   0.40  4.5 1.9
## w3need8   443  0.35  0.34  0.20   0.16  3.3 2.0
## w3need9   444  0.57  0.56  0.48   0.40  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.R 0.24 0.36 0.21 0.04 0.08 0.08 0.00 0.08
## w3need3   0.22 0.21 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.13 0.04 0.08
## w3need6   0.40 0.25 0.10 0.09 0.08 0.06 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.23 0.04 0.17 0.13 0.14 0.05 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.R", 
                 "w4need3", 
                 "w4need4", 
                 "w4need5", 
                 "w4need6", 
                 "w4need7", 
                 "w4need8", 
                 "w4need9")], check.keys = TRUE) #.66
## 
## Reliability analysis   
## Call: psych::alpha(x = d[c("w4need1", "w4need2.R", "w4need3", "w4need4", 
##     "w4need5", "w4need6", "w4need7", "w4need8", "w4need9")], 
##     check.keys = TRUE)
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean  sd median_r
##       0.77      0.78    0.81      0.28 3.5 0.016    3 1.1     0.28
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.74  0.77   0.8
## Duhachek  0.74  0.77   0.8
## 
##  Reliability if an item is dropped:
##           raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## w4need1        0.75      0.76    0.77      0.28 3.1    0.017 0.014  0.28
## w4need2.R      0.75      0.76    0.76      0.28 3.1    0.017 0.015  0.29
## w4need3        0.73      0.75    0.77      0.27 3.0    0.018 0.018  0.28
## w4need4        0.75      0.76    0.79      0.28 3.1    0.017 0.022  0.27
## w4need5        0.73      0.74    0.78      0.27 2.9    0.018 0.022  0.25
## w4need6        0.73      0.74    0.77      0.26 2.8    0.019 0.018  0.26
## w4need7        0.75      0.76    0.80      0.29 3.3    0.017 0.022  0.30
## w4need8        0.78      0.78    0.81      0.31 3.6    0.015 0.017  0.31
## w4need9        0.75      0.76    0.79      0.28 3.2    0.017 0.018  0.28
## 
##  Item statistics 
##             n raw.r std.r r.cor r.drop mean  sd
## w4need1   400  0.54  0.61  0.58   0.44  1.9 1.3
## w4need2.R 400  0.54  0.60  0.57   0.42  2.5 1.5
## w4need3   400  0.68  0.64  0.60   0.53  3.5 2.1
## w4need4   400  0.61  0.60  0.51   0.45  3.5 2.0
## w4need5   400  0.67  0.68  0.62   0.56  3.0 1.7
## w4need6   400  0.70  0.70  0.68   0.60  2.2 1.6
## w4need7   400  0.57  0.56  0.46   0.42  4.5 1.9
## w4need8   400  0.47  0.44  0.32   0.28  3.3 2.1
## w4need9   400  0.60  0.59  0.52   0.45  2.6 1.9
## 
## Non missing response frequency for each item
##              1    2    3    4    5    6    7 miss
## w4need1   0.50 0.31 0.08 0.03 0.08 0.01 0.00 0.18
## w4need2.R 0.28 0.31 0.22 0.03 0.09 0.07 0.00 0.18
## w4need3   0.27 0.16 0.09 0.07 0.17 0.16 0.09 0.18
## w4need4   0.24 0.17 0.07 0.11 0.24 0.11 0.06 0.18
## w4need5   0.22 0.30 0.07 0.10 0.24 0.05 0.01 0.18
## w4need6   0.54 0.18 0.08 0.09 0.06 0.05 0.01 0.18
## w4need7   0.11 0.12 0.08 0.06 0.23 0.30 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.R", 
                 "w5need3", 
                 "w5need4", 
                 "w5need5", 
                 "w5need6", 
                 "w5need7", 
                 "w5need8", 
                 "w5need9")], check.keys = TRUE) #.44
## 
## Reliability analysis   
## Call: psych::alpha(x = d[c("w5need1", "w5need2.R", "w5need3", "w5need4", 
##     "w5need5", "w5need6", "w5need7", "w5need8", "w5need9")], 
##     check.keys = TRUE)
## 
##   raw_alpha std.alpha G6(smc) average_r S/N  ase mean sd median_r
##       0.71      0.73    0.83      0.23 2.7 0.02  3.1  1     0.26
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.67  0.71  0.74
## Duhachek  0.67  0.71  0.75
## 
##  Reliability if an item is dropped:
##           raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## w5need1        0.66      0.67    0.77      0.20 2.0    0.024 0.040  0.21
## w5need2.R      0.65      0.67    0.76      0.20 2.0    0.024 0.042  0.22
## w5need3        0.71      0.74    0.80      0.26 2.8    0.020 0.056  0.27
## w5need4        0.69      0.72    0.79      0.24 2.6    0.021 0.056  0.26
## w5need5        0.67      0.70    0.81      0.23 2.4    0.023 0.065  0.27
## w5need6        0.62      0.65    0.77      0.19 1.9    0.027 0.050  0.21
## w5need7        0.67      0.69    0.80      0.22 2.3    0.023 0.062  0.21
## w5need8        0.74      0.76    0.83      0.28 3.2    0.018 0.052  0.31
## w5need9        0.71      0.73    0.82      0.25 2.7    0.020 0.056  0.27
## 
##  Item statistics 
##             n raw.r std.r r.cor r.drop mean  sd
## w5need1   194  0.67  0.73  0.75  0.583  1.8 1.3
## w5need2.R 194  0.68  0.73  0.76  0.575  2.5 1.5
## w5need3   194  0.46  0.40  0.33  0.247  3.5 2.1
## w5need4   190  0.51  0.49  0.44  0.316  3.5 1.9
## w5need5   194  0.57  0.58  0.49  0.427  3.0 1.7
## w5need6   194  0.78  0.79  0.79  0.674  2.7 2.0
## w5need7   194  0.61  0.62  0.55  0.459  4.5 1.8
## w5need8   194  0.31  0.27  0.14  0.092  3.4 2.0
## w5need9   194  0.45  0.45  0.35  0.249  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.R 0.26 0.37 0.21 0.02 0.07 0.04 0.03 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
x <- d[c("w1need2.R", "w2need2.R", "w3need2.R", "w4need2.R", "w5need2.R")]
d$w2needAvg <- rowMeans(x)

psych::alpha(d[c("w1needAvg", 
                 "w2needAvg", 
                 "w3needAvg", 
                 "w4needAvg", 
                 "w5needAvg")], check.keys = TRUE) #.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")], check.keys = TRUE)
## 
##   raw_alpha std.alpha G6(smc) average_r S/N    ase mean   sd median_r
##       0.89      0.91     0.9      0.66 9.6 0.0083  3.4 0.79     0.68
## 
##     95% confidence boundaries 
##          lower alpha upper
## Feldt     0.87  0.89   0.9
## Duhachek  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.88    0.86      0.64  7.2   0.0108 0.011  0.62
## w2needAvg      0.91      0.92    0.90      0.73 10.9   0.0064 0.003  0.73
## w3needAvg      0.84      0.87    0.85      0.63  6.8   0.0115 0.013  0.62
## w4needAvg      0.85      0.88    0.86      0.64  7.2   0.0115 0.016  0.64
## w5needAvg      0.85      0.88    0.86      0.64  7.2   0.0108 0.011  0.65
## 
##  Item statistics 
##             n raw.r std.r r.cor r.drop mean   sd
## w1needAvg 484  0.88  0.87  0.85   0.78  3.5 0.84
## w2needAvg 167  0.79  0.75  0.64   0.61  2.5 1.32
## w3needAvg 448  0.87  0.89  0.87   0.81  3.4 0.88
## w4needAvg 400  0.90  0.87  0.84   0.79  3.3 0.93
## w5needAvg 194  0.87  0.87  0.85   0.78  3.4 0.82

- weight (NA)

Please enter your current weight (pounds/kilograms)

- height (NA)

Please enter your height

head(d1, 10)

graphs: friendship/time

i = 1
for(i in unique(d1$subID)){
  print(ggplot(data = d1[d1$subID == i,], aes(x = week, y = rank, color = friend)) + 
          theme_minimal() +
          ylab("rank") +
          geom_point() + 
          geom_line() +
          ggtitle(paste0("participant ", i)) + 
          scale_x_continuous(breaks = c(1, 2, 3, 4, 5),
                     limits = c(1, 5)))
  }

H1. Do friend ranks predict WTRs?

1. run model

h1 <- lmer(wtr ~ rank + (rank | subID) + (1 | week), data = d1)
## boundary (singular) fit: see help('isSingular')
tab_model(h1, 
          show.df = T, 
          show.ci = .95,
          show.se = T,
          show.stat = T,
          string.stat = "t",
          string.se="SE",
          string.est = "Est",
          digits = 3)
  wtr
Predictors Est SE CI t p df
(Intercept) 0.789 0.026 0.738 – 0.840 30.468 <0.001 1561.000
rank -0.071 0.007 -0.085 – -0.058 -10.508 <0.001 1561.000
Random Effects
σ2 0.03
τ00 subID 0.06
τ00 week 0.00
τ11 subID.rank 0.00
ρ01 subID -0.32
N subID 99
N week 5
Observations 1568
Marginal R2 / Conditional R2 0.213 / NA
plot_model(h1, type = "pred", terms = c("rank")) +
  ggtitle("") + 
  ylab("WTR") +
  xlab("Friend Ranking") +
  theme_minimal() +
  theme(panel.grid.major = element_blank(), 
        panel.grid.minor = element_blank(),
        panel.background = element_blank(), 
        axis.line = element_line(colour = "black"),
        legend.position = "none", 
        legend.background = element_rect(fill = "white", color = "white"),
        legend.title = element_blank())

H2. Do WTRs predict gratitude?

1. run model

h2<- lmer(gratScale ~ wtr + (wtr | subID) + (1 | week), data = d1)
## boundary (singular) fit: see help('isSingular')
tab_model(h2, 
          show.df = T, 
          show.ci = .95,
          show.se = T,
          show.stat = T,
          string.stat = "t",
          string.se="SE",
          string.est = "Est",
          digits = 3)
  gratScale
Predictors Est SE CI t p df
(Intercept) 1.895 0.198 1.507 – 2.284 9.575 <0.001 1121.000
wtr 2.853 0.294 2.277 – 3.429 9.714 <0.001 1121.000
Random Effects
σ2 1.35
τ00 subID 1.92
τ00 week 0.00
τ11 subID.wtr 3.72
ρ01 subID -0.60
N subID 99
N week 4
Observations 1128
Marginal R2 / Conditional R2 0.376 / NA
plot_model(h2, type = "pred", terms = c("wtr")) +
  ggtitle("") + 
  ylab("Gratitude Scale") +
  xlab("WTR") +
  theme_minimal() +
  theme(panel.grid.major = element_blank(), 
        panel.grid.minor = element_blank(),
        panel.background = element_blank(), 
        axis.line = element_line(colour = "black"),
        legend.position = "none", 
        legend.background = element_rect(fill = "white", color = "white"),
        legend.title = element_blank()) +
  scale_x_continuous(breaks = c(0, .25, .5, .75, 1, 1.25), 
                     limits = c(0, 1.25))

H3. Do changes in WTRs predict gratitude each week?

2. run model

originally included random int for week but was singular

summary(h3 <- lmer(gratScale ~ wtrDiff + (wtrDiff | subID), data = d1))
## Linear mixed model fit by REML ['lmerMod']
## Formula: gratScale ~ wtrDiff + (wtrDiff | subID)
##    Data: d1
## 
## REML criterion at convergence: 3738.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.7791 -0.5352  0.0773  0.6280  2.9205 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev. Corr 
##  subID    (Intercept) 1.263    1.124         
##           wtrDiff     0.252    0.502    -0.05
##  Residual             1.731    1.316         
## Number of obs: 1042, groups:  subID, 98
## 
## Fixed effects:
##             Estimate Std. Error t value
## (Intercept)   3.5088     0.1228   28.58
## wtrDiff       1.3747     0.2420    5.68
## 
## Correlation of Fixed Effects:
##         (Intr)
## wtrDiff 0.003
tab_model(h3, 
          show.df = T, 
          show.ci = .95,
          show.se = T,
          show.stat = T,
          string.stat = "t",
          string.se="SE",
          string.est = "Est",
          digits = 3)
  gratScale
Predictors Est SE CI t p df
(Intercept) 3.509 0.123 3.268 – 3.750 28.578 <0.001 1036.000
wtrDiff 1.375 0.242 0.900 – 1.850 5.680 <0.001 1036.000
Random Effects
σ2 1.73
τ00 subID 1.26
τ11 subID.wtrDiff 0.25
ρ01 subID -0.05
ICC 0.42
N subID 98
Observations 1042
Marginal R2 / Conditional R2 0.023 / 0.437
plot_model(h3, type = "pred", terms = c("wtrDiff")) +
  ggtitle("") + 
  ylab("Gratitude Scale") +
  xlab("Change in WTR") +
  theme_minimal() +
  theme(panel.grid.major = element_blank(), 
        panel.grid.minor = element_blank(),
        panel.background = element_blank(), 
        axis.line = element_line(colour = "black"),
        legend.position = "none", 
        legend.background = element_rect(fill = "white", color = "white"),
        legend.title = element_blank())

# Q1. How do relationships change over time?

2. run model

# make codes for weeks
d1$lin <- NA
d1$lin[d1$week == 1] <- -2
d1$lin[d1$week == 2] <- -1
d1$lin[d1$week == 3] <- 0
d1$lin[d1$week == 4] <- 1
d1$lin[d1$week == 5] <- 2

d1$quad <- NA
d1$quad[d1$week == 1] <- 2
d1$quad[d1$week == 2] <- -1
d1$quad[d1$week == 3] <- -2
d1$quad[d1$week == 4] <- -1
d1$quad[d1$week == 5] <- 2
  
d1$cubic <- NA
d1$cubic[d1$week == 1] <- -1
d1$cubic[d1$week == 2] <- 2
d1$cubic[d1$week == 3] <- 0
d1$cubic[d1$week == 4] <- -2
d1$cubic[d1$week == 5] <- 1

d1$quart <- NA
d1$quart[d1$week == 1] <- 1
d1$quart[d1$week == 2] <- -4
d1$quart[d1$week == 3] <- 6
d1$quart[d1$week == 4] <- -4
d1$quart[d1$week == 5] <- 1

summary(h3 <- lmer(rank ~ wtrDiff + (lin + quad + cubic + quart) + (1 | subID) + (1|week), data = d1))
## fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
## Warning in optwrap(optimizer, devfun, getStart(start, rho$pp), lower =
## rho$lower, : convergence code -4 from nloptwrap: NLOPT_ROUNDOFF_LIMITED:
## Roundoff errors led to a breakdown of the optimization algorithm. In this case,
## the returned minimum may still be useful. (e.g. this error occurs in NEWUOA if
## one tries to achieve a tolerance too close to machine precision.)
## boundary (singular) fit: see help('isSingular')
## Linear mixed model fit by REML ['lmerMod']
## Formula: rank ~ wtrDiff + (lin + quad + cubic + quart) + (1 | subID) +  
##     (1 | week)
##    Data: d1
## 
## REML criterion at convergence: 3450.1
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.5485 -0.6126  0.2266  1.0531  1.9933 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  subID    (Intercept) 0.000000 0.00000 
##  week     (Intercept) 0.002407 0.04907 
##  Residual             1.573993 1.25459 
## Number of obs: 1044, groups:  subID, 98; week, 4
## 
## Fixed effects:
##             Estimate Std. Error t value
## (Intercept)  2.67686    0.15054  17.782
## wtrDiff     -0.33658    0.20065  -1.677
## lin         -0.08428    0.15178  -0.555
## quad         0.02149    0.10639   0.202
## cubic       -0.04990    0.08077  -0.618
## 
## Correlation of Fixed Effects:
##         (Intr) wtrDff lin    quad  
## wtrDiff -0.038                     
## lin     -0.921  0.050              
## quad     0.943 -0.055 -0.932       
## cubic   -0.886  0.050  0.925 -0.890
## fit warnings:
## fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
## optimizer (nloptwrap) convergence code: -4 (NLOPT_ROUNDOFF_LIMITED: Roundoff errors led to a breakdown of the optimization algorithm. In this case, the returned minimum may still be useful. (e.g. this error occurs in NEWUOA if one tries to achieve a tolerance too close to machine precision.))
## boundary (singular) fit: see help('isSingular')
tab_model(h3, 
          show.df = T, 
          show.ci = .95,
          show.se = T,
          show.stat = T,
          string.stat = "t",
          string.se="SE",
          string.est = "Est",
          digits = 3)
  rank
Predictors Est SE CI t p df
(Intercept) 2.677 0.151 2.381 – 2.972 17.782 <0.001 1036.000
wtrDiff -0.337 0.201 -0.730 – 0.057 -1.677 0.094 1036.000
lin -0.084 0.152 -0.382 – 0.214 -0.555 0.579 1036.000
quad 0.021 0.106 -0.187 – 0.230 0.202 0.840 1036.000
cubic -0.050 0.081 -0.208 – 0.109 -0.618 0.537 1036.000
Random Effects
σ2 1.57
τ00 subID 0.00
τ00 week 0.00
N subID 98
N week 4
Observations 1044
Marginal R2 / Conditional R2 0.004 / NA