Import data
library(readr)
## Warning: package 'readr' was built under R version 4.2.3
data <- read_csv("C:/Users/CURRANT/Dropbox/Work/Research Students/Ethan/data.csv")
## New names:
## Rows: 200 Columns: 75
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (14): StartDate, EndDate, RecordedDate, ResponseId, DistributionChannel,... dbl
## (60): Status, Progress, Duration (in seconds), Finished, Q_RecaptchaScor... lgl
## (1): Q64...12
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `Q64` -> `Q64...12`
## • `Q64` -> `Q64...74`
View(data)
Calculate Variables
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.2.3
## Warning: package 'ggplot2' was built under R version 4.2.3
## Warning: package 'tibble' was built under R version 4.2.3
## Warning: package 'tidyr' was built under R version 4.2.3
## Warning: package 'purrr' was built under R version 4.2.3
## Warning: package 'dplyr' was built under R version 4.2.3
## Warning: package 'stringr' was built under R version 4.2.3
## Warning: package 'forcats' was built under R version 4.2.3
## Warning: package 'lubridate' was built under R version 4.2.3
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ purrr 1.0.2
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.4.4 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
data$Q8 <- car::recode(data$Q8, "2=0; 1=1")
data$Q9 <- car::recode(data$Q9, "2=0; 1=1")
data$Q10 <- car::recode(data$Q10, "2=0; 1=1")
data$Q11 <- car::recode(data$Q11, "2=0; 1=1")
data$Q12 <- car::recode(data$Q12, "2=0; 1=1")
data$Q13 <- car::recode(data$Q13, "2=0; 1=1")
data$Q14 <- car::recode(data$Q14, "2=0; 1=1")
data$Q15 <- car::recode(data$Q15, "2=0; 1=1")
data$Q16 <- car::recode(data$Q16, "2=0; 1=1")
# SMPAQ
data <- data %>%
mutate(post_anx = (Q26 + Q27 + Q28 + Q29 + Q30 + Q31)/6)
data <- data %>%
mutate(disord = (Q8 + Q9 + Q10 + Q11 + Q12 + Q13 + Q14 + Q15 + Q16))
data <- data %>%
mutate(compare = (Q17_1 + Q17_2 + Q17_3 + Q17_4 + Q17_5)/5)
data <- data %>%
mutate(intense = (Q22 + Q23 + Q24 + Q25)/4)
data <- data %>%
mutate(body_sat = (Q34 + Q35 + Q36 + Q37)/4)
data <- data %>%
mutate(worry = (Q38_1 + Q38_2 + Q38_3 + Q38_4 + Q38_5)/5)
data <- data %>%
mutate(rum = (Q39 + Q40 + Q41 + Q42 + Q43)/5)
data <- data %>%
mutate(sop = (Q44 + Q47 + Q49 + Q57 + Q56)/5)
data <- data %>%
mutate(spp = (Q46 + Q50 + Q51 + Q53 + Q54)/5)
Alpha
library(psych)
##
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
post_anx <- select(data, Q26 , Q27 , Q28 , Q29 , Q30 , Q31)
compare <- select(data, Q17_1 , Q17_2 , Q17_3 , Q17_4 , Q17_5)
intense <- select(data, Q22 , Q23 , Q24 , Q25)
body_sat <- select(data, Q34 , Q35 , Q36 , Q37)
worry <- select(data, Q38_1 , Q38_2 , Q38_3 , Q38_4 , Q38_5)
rum <- select(data, Q39 , Q40 , Q41 , Q42 , Q43)
sop <- select(data, Q44 , Q47 , Q49 ,Q57 , Q56)
spp <- select(data, Q46 , Q50 , Q51 , Q53 , Q54)
alpha(post_anx)
##
## Reliability analysis
## Call: alpha(x = post_anx)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.91 0.91 0.9 0.63 10 0.0099 2.9 1.1 0.61
##
## 95% confidence boundaries
## lower alpha upper
## Feldt 0.89 0.91 0.93
## Duhachek 0.89 0.91 0.93
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## Q26 0.90 0.90 0.89 0.64 9.0 0.011 0.0051 0.62
## Q27 0.90 0.90 0.89 0.64 8.8 0.011 0.0062 0.63
## Q28 0.90 0.90 0.89 0.64 8.9 0.011 0.0053 0.63
## Q29 0.89 0.89 0.87 0.61 7.9 0.013 0.0043 0.59
## Q30 0.89 0.89 0.88 0.62 8.1 0.012 0.0036 0.62
## Q31 0.88 0.88 0.87 0.61 7.7 0.013 0.0029 0.59
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## Q26 200 0.80 0.80 0.74 0.70 2.9 1.3
## Q27 197 0.80 0.81 0.75 0.71 2.7 1.3
## Q28 200 0.80 0.80 0.74 0.71 3.0 1.3
## Q29 200 0.86 0.86 0.83 0.79 2.9 1.4
## Q30 200 0.85 0.85 0.82 0.78 3.0 1.3
## Q31 200 0.88 0.87 0.85 0.81 3.1 1.4
##
## Non missing response frequency for each item
## 1 2 3 4 5 miss
## Q26 0.20 0.24 0.12 0.36 0.09 0.00
## Q27 0.26 0.23 0.13 0.31 0.06 0.02
## Q28 0.17 0.22 0.21 0.27 0.13 0.00
## Q29 0.20 0.25 0.14 0.28 0.13 0.00
## Q30 0.21 0.17 0.16 0.35 0.10 0.00
## Q31 0.20 0.18 0.14 0.32 0.16 0.00
alpha(compare)
##
## Reliability analysis
## Call: alpha(x = compare)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.9 0.9 0.89 0.65 9.3 0.011 3.1 1.3 0.66
##
## 95% confidence boundaries
## lower alpha upper
## Feldt 0.88 0.9 0.92
## Duhachek 0.88 0.9 0.92
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## Q17_1 0.88 0.88 0.85 0.65 7.3 0.014 0.00237 0.65
## Q17_2 0.88 0.88 0.85 0.65 7.3 0.014 0.00229 0.64
## Q17_3 0.88 0.88 0.85 0.65 7.3 0.014 0.00073 0.64
## Q17_4 0.88 0.88 0.85 0.64 7.2 0.014 0.00159 0.66
## Q17_5 0.89 0.89 0.86 0.67 8.0 0.013 0.00076 0.66
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## Q17_1 200 0.84 0.85 0.81 0.76 3.1 1.3
## Q17_2 200 0.85 0.85 0.80 0.76 3.1 1.5
## Q17_3 200 0.86 0.85 0.81 0.76 3.0 1.6
## Q17_4 199 0.86 0.86 0.81 0.77 3.1 1.6
## Q17_5 200 0.82 0.83 0.76 0.72 3.0 1.5
##
## Non missing response frequency for each item
## 0 1 2 3 4 5 miss
## Q17_1 0.06 0.07 0.14 0.22 0.44 0.07 0.00
## Q17_2 0.09 0.06 0.10 0.26 0.30 0.18 0.00
## Q17_3 0.10 0.10 0.10 0.20 0.32 0.17 0.00
## Q17_4 0.10 0.11 0.11 0.18 0.31 0.20 0.01
## Q17_5 0.08 0.10 0.15 0.23 0.30 0.15 0.00
alpha(intense)
##
## Reliability analysis
## Call: alpha(x = intense)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.84 0.84 0.81 0.57 5.4 0.018 2.7 1 0.59
##
## 95% confidence boundaries
## lower alpha upper
## Feldt 0.80 0.84 0.88
## Duhachek 0.81 0.84 0.88
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## Q22 0.82 0.82 0.75 0.60 4.5 0.022 0.00258 0.62
## Q23 0.79 0.79 0.73 0.56 3.8 0.026 0.00711 0.56
## Q24 0.78 0.78 0.71 0.54 3.5 0.027 0.00502 0.54
## Q25 0.82 0.82 0.75 0.60 4.5 0.022 0.00096 0.61
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## Q22 200 0.80 0.80 0.70 0.64 2.9 1.3
## Q23 199 0.84 0.84 0.77 0.71 2.7 1.2
## Q24 199 0.85 0.86 0.80 0.73 2.5 1.3
## Q25 200 0.80 0.80 0.71 0.64 2.6 1.2
##
## Non missing response frequency for each item
## 1 2 3 4 5 6 7 miss
## Q22 0.02 0.51 0.24 0.14 0.04 0.02 0.04 0.00
## Q23 0.09 0.47 0.23 0.13 0.07 0.01 0.02 0.01
## Q24 0.16 0.52 0.16 0.09 0.05 0.02 0.02 0.01
## Q25 0.12 0.50 0.21 0.08 0.07 0.01 0.01 0.00
alpha(body_sat)
##
## Reliability analysis
## Call: alpha(x = body_sat)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.89 0.9 0.88 0.68 8.6 0.012 4.6 1.3 0.69
##
## 95% confidence boundaries
## lower alpha upper
## Feldt 0.87 0.89 0.92
## Duhachek 0.87 0.89 0.92
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## Q34 0.87 0.87 0.81 0.68 6.5 0.017 0.0010 0.69
## Q35 0.89 0.89 0.85 0.73 8.1 0.014 0.0029 0.71
## Q36 0.84 0.84 0.78 0.64 5.2 0.020 0.0036 0.65
## Q37 0.86 0.87 0.83 0.68 6.5 0.017 0.0122 0.69
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## Q34 200 0.86 0.87 0.83 0.76 4.8 1.4
## Q35 200 0.84 0.83 0.75 0.70 4.5 1.6
## Q36 200 0.91 0.91 0.89 0.84 4.7 1.5
## Q37 200 0.87 0.87 0.81 0.77 4.3 1.5
##
## Non missing response frequency for each item
## 1 2 3 4 5 6 7 miss
## Q34 0.04 0.04 0.08 0.18 0.33 0.26 0.06 0
## Q35 0.06 0.08 0.13 0.17 0.22 0.24 0.09 0
## Q36 0.04 0.06 0.12 0.14 0.32 0.26 0.07 0
## Q37 0.04 0.09 0.17 0.17 0.26 0.21 0.05 0
alpha(worry)
##
## Reliability analysis
## Call: alpha(x = worry)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.87 0.87 0.86 0.58 7 0.015 3.2 1 0.65
##
## 95% confidence boundaries
## lower alpha upper
## Feldt 0.84 0.87 0.9
## Duhachek 0.84 0.87 0.9
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## Q38_1 0.83 0.83 0.81 0.55 4.9 0.021 0.0289 0.57
## Q38_2 0.83 0.83 0.81 0.55 4.8 0.021 0.0281 0.56
## Q38_3 0.85 0.85 0.83 0.58 5.6 0.018 0.0274 0.60
## Q38_4 0.90 0.90 0.88 0.70 9.3 0.011 0.0017 0.70
## Q38_5 0.81 0.82 0.79 0.53 4.5 0.022 0.0274 0.53
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## Q38_1 200 0.86 0.86 0.83 0.77 3.2 1.2
## Q38_2 199 0.86 0.87 0.83 0.77 3.2 1.2
## Q38_3 200 0.81 0.81 0.75 0.69 3.3 1.2
## Q38_4 200 0.66 0.64 0.49 0.46 3.1 1.3
## Q38_5 198 0.90 0.89 0.88 0.82 3.1 1.2
##
## Non missing response frequency for each item
## 1 2 3 4 5 miss
## Q38_1 0.08 0.23 0.26 0.30 0.13 0.00
## Q38_2 0.10 0.22 0.24 0.28 0.16 0.01
## Q38_3 0.10 0.16 0.26 0.31 0.17 0.00
## Q38_4 0.14 0.18 0.28 0.22 0.17 0.00
## Q38_5 0.12 0.20 0.26 0.29 0.14 0.01
alpha(rum)
##
## Reliability analysis
## Call: alpha(x = rum)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.85 0.85 0.83 0.53 5.7 0.016 2.2 0.7 0.53
##
## 95% confidence boundaries
## lower alpha upper
## Feldt 0.82 0.85 0.88
## Duhachek 0.82 0.85 0.88
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## Q39 0.83 0.83 0.78 0.55 4.8 0.020 0.00085 0.54
## Q40 0.84 0.84 0.80 0.56 5.1 0.019 0.00303 0.55
## Q41 0.80 0.80 0.76 0.50 4.1 0.023 0.00258 0.51
## Q42 0.82 0.82 0.79 0.53 4.6 0.020 0.00702 0.53
## Q43 0.82 0.82 0.78 0.53 4.4 0.021 0.00620 0.52
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## Q39 199 0.78 0.78 0.70 0.64 2.1 0.86
## Q40 198 0.74 0.75 0.65 0.60 2.2 0.82
## Q41 200 0.84 0.84 0.80 0.73 2.1 0.94
## Q42 198 0.79 0.79 0.71 0.66 2.3 0.89
## Q43 200 0.81 0.80 0.73 0.68 2.0 0.92
##
## Non missing response frequency for each item
## 1 2 3 4 miss
## Q39 0.24 0.51 0.16 0.09 0.01
## Q40 0.17 0.51 0.25 0.08 0.01
## Q41 0.28 0.46 0.16 0.12 0.00
## Q42 0.16 0.45 0.27 0.12 0.01
## Q43 0.31 0.42 0.18 0.09 0.00
alpha(sop)
##
## Reliability analysis
## Call: alpha(x = sop)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.93 0.93 0.91 0.71 12 0.0083 4.8 1.6 0.68
##
## 95% confidence boundaries
## lower alpha upper
## Feldt 0.91 0.93 0.94
## Duhachek 0.91 0.93 0.94
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## Q44 0.90 0.90 0.88 0.70 9.3 0.0112 0.0022 0.68
## Q47 0.90 0.90 0.89 0.70 9.5 0.0110 0.0030 0.68
## Q49 0.90 0.90 0.88 0.69 9.1 0.0115 0.0013 0.68
## Q57 0.92 0.92 0.90 0.73 10.9 0.0096 0.0044 0.72
## Q56 0.92 0.92 0.90 0.73 11.1 0.0094 0.0039 0.72
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## Q44 200 0.90 0.90 0.87 0.83 4.5 1.9
## Q47 200 0.89 0.89 0.86 0.83 4.8 1.7
## Q49 200 0.91 0.90 0.88 0.85 4.6 1.8
## Q57 200 0.85 0.85 0.79 0.76 5.1 1.6
## Q56 200 0.84 0.85 0.79 0.76 5.0 1.7
##
## Non missing response frequency for each item
## 1 2 3 4 5 6 7 miss
## Q44 0.12 0.10 0.06 0.12 0.20 0.28 0.11 0
## Q47 0.07 0.07 0.06 0.16 0.20 0.30 0.15 0
## Q49 0.09 0.09 0.09 0.13 0.23 0.23 0.14 0
## Q57 0.05 0.07 0.04 0.10 0.22 0.34 0.16 0
## Q56 0.06 0.05 0.07 0.10 0.20 0.36 0.16 0
alpha(spp)
##
## Reliability analysis
## Call: alpha(x = spp)
##
## raw_alpha std.alpha G6(smc) average_r S/N ase mean sd median_r
## 0.9 0.9 0.88 0.63 8.6 0.012 4.1 1.6 0.62
##
## 95% confidence boundaries
## lower alpha upper
## Feldt 0.87 0.9 0.92
## Duhachek 0.87 0.9 0.92
##
## Reliability if an item is dropped:
## raw_alpha std.alpha G6(smc) average_r S/N alpha se var.r med.r
## Q46 0.89 0.89 0.86 0.66 7.7 0.013 0.00414 0.65
## Q50 0.88 0.88 0.85 0.64 7.0 0.014 0.00534 0.62
## Q51 0.88 0.88 0.85 0.65 7.3 0.014 0.00555 0.63
## Q53 0.87 0.87 0.83 0.62 6.5 0.015 0.00095 0.61
## Q54 0.86 0.86 0.82 0.61 6.2 0.016 0.00076 0.61
##
## Item statistics
## n raw.r std.r r.cor r.drop mean sd
## Q46 200 0.80 0.80 0.73 0.69 3.9 1.8
## Q50 200 0.83 0.84 0.78 0.74 4.0 1.8
## Q51 199 0.82 0.82 0.76 0.72 4.0 1.9
## Q53 200 0.87 0.86 0.83 0.78 4.6 2.0
## Q54 200 0.88 0.88 0.86 0.80 4.1 1.9
##
## Non missing response frequency for each item
## 1 2 3 4 5 6 7 miss
## Q46 0.14 0.10 0.12 0.23 0.20 0.14 0.06 0.00
## Q50 0.10 0.14 0.12 0.24 0.14 0.17 0.08 0.00
## Q51 0.12 0.16 0.10 0.13 0.25 0.17 0.08 0.01
## Q53 0.11 0.11 0.06 0.10 0.18 0.28 0.15 0.00
## Q54 0.13 0.13 0.09 0.17 0.20 0.17 0.10 0.00
descriptives <- spp <- select(data, sop,spp, rum, worry, body_sat, intense, compare, post_anx, disord, Q32, Q33, Q22)
describe(descriptives)
correlation matrix
library(Hmisc)
## Warning: package 'Hmisc' was built under R version 4.2.3
##
## Attaching package: 'Hmisc'
## The following object is masked from 'package:psych':
##
## describe
## The following objects are masked from 'package:dplyr':
##
## src, summarize
## The following objects are masked from 'package:base':
##
## format.pval, units
rcorr(as.matrix(data[,c("sop","spp", "rum", "worry", "body_sat", "intense", "compare", "post_anx", "disord")], type="pearson"))
## sop spp rum worry body_sat intense compare post_anx disord
## sop 1.00 0.71 0.23 0.18 0.46 0.26 0.44 0.29 0.36
## spp 0.71 1.00 0.49 0.42 0.30 0.30 0.42 0.54 0.50
## rum 0.23 0.49 1.00 0.56 -0.07 0.30 0.32 0.41 0.35
## worry 0.18 0.42 0.56 1.00 -0.09 0.14 0.47 0.48 0.27
## body_sat 0.46 0.30 -0.07 -0.09 1.00 0.19 0.10 0.13 0.20
## intense 0.26 0.30 0.30 0.14 0.19 1.00 0.27 0.13 0.46
## compare 0.44 0.42 0.32 0.47 0.10 0.27 1.00 0.44 0.39
## post_anx 0.29 0.54 0.41 0.48 0.13 0.13 0.44 1.00 0.37
## disord 0.36 0.50 0.35 0.27 0.20 0.46 0.39 0.37 1.00
##
## n
## sop spp rum worry body_sat intense compare post_anx disord
## sop 200 199 196 197 200 198 199 197 194
## spp 199 199 195 196 199 197 198 196 193
## rum 196 195 196 193 196 194 195 194 191
## worry 197 196 193 197 197 195 196 194 191
## body_sat 200 199 196 197 200 198 199 197 194
## intense 198 197 194 195 198 198 197 195 192
## compare 199 198 195 196 199 197 199 196 193
## post_anx 197 196 194 194 197 195 196 197 192
## disord 194 193 191 191 194 192 193 192 194
##
## P
## sop spp rum worry body_sat intense compare post_anx disord
## sop 0.0000 0.0013 0.0135 0.0000 0.0002 0.0000 0.0000 0.0000
## spp 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
## rum 0.0013 0.0000 0.0000 0.3359 0.0000 0.0000 0.0000 0.0000
## worry 0.0135 0.0000 0.0000 0.2284 0.0479 0.0000 0.0000 0.0001
## body_sat 0.0000 0.0000 0.3359 0.2284 0.0060 0.1421 0.0676 0.0054
## intense 0.0002 0.0000 0.0000 0.0479 0.0060 0.0000 0.0652 0.0000
## compare 0.0000 0.0000 0.0000 0.0000 0.1421 0.0000 0.0000 0.0000
## post_anx 0.0000 0.0000 0.0000 0.0000 0.0676 0.0652 0.0000 0.0000
## disord 0.0000 0.0000 0.0000 0.0001 0.0054 0.0000 0.0000 0.0000
library(tidyverse)
library(apaTables)
## Warning: package 'apaTables' was built under R version 4.2.3
data1 <-
data %>%
select("sop","spp", "rum", "worry", "body_sat", "intense", "compare", "post_anx", "disord")
table1 <- apa.cor.table(data1,
table.number=1, filename = "C:/Users/CURRANT/Dropbox/Work/Research Students/Ethan/table1.doc")
print(table1)
##
##
## Table 1
##
## Means, standard deviations, and correlations with confidence intervals
##
##
## Variable M SD 1 2 3 4
## 1. sop 4.80 1.55
##
## 2. spp 4.13 1.55 .71**
## [.64, .77]
##
## 3. rum 2.16 0.70 .23** .49**
## [.09, .36] [.37, .59]
##
## 4. worry 3.19 0.99 .18* .42** .56**
## [.04, .31] [.29, .53] [.46, .65]
##
## 5. body_sat 4.58 1.33 .46** .30** -.07 -.09
## [.35, .57] [.17, .43] [-.21, .07] [-.22, .05]
##
## 6. intense 2.66 1.03 .26** .30** .30** .14*
## [.12, .38] [.17, .42] [.17, .42] [.00, .28]
##
## 7. compare 3.09 1.26 .44** .42** .32** .47**
## [.32, .54] [.30, .53] [.19, .44] [.35, .57]
##
## 8. post_anx 2.90 1.11 .29** .54** .41** .48**
## [.15, .41] [.43, .63] [.28, .52] [.37, .58]
##
## 9. disord 3.35 3.03 .36** .50** .35** .27**
## [.23, .47] [.39, .60] [.21, .46] [.14, .40]
##
## 5 6 7 8
##
##
##
##
##
##
##
##
##
##
##
##
##
##
## .19**
## [.06, .33]
##
## .10 .27**
## [-.04, .24] [.14, .40]
##
## .13 .13 .44**
## [-.01, .27] [-.01, .27] [.32, .55]
##
## .20** .46** .39** .37**
## [.06, .33] [.35, .57] [.26, .50] [.24, .48]
##
##
## Note. M and SD are used to represent mean and standard deviation, respectively.
## Values in square brackets indicate the 95% confidence interval.
## The confidence interval is a plausible range of population correlations
## that could have caused the sample correlation (Cumming, 2014).
## * indicates p < .05. ** indicates p < .01.
##
path analysis
library(lavaan)
## This is lavaan 0.6-13
## lavaan is FREE software! Please report any bugs.
##
## Attaching package: 'lavaan'
## The following object is masked from 'package:psych':
##
## cor2cov
med.model <- "
# the c and b paths
post_anx ~ b1 * compare + c1 * sop + c2 * spp
# the a path
compare ~ a3 * sop + a4 * spp
# indirect and total effects
a3b1 := a3*b1
a4b1 := a4*b1
"
med.model <- sem(med.model, data = data, se = "bootstrap", bootstrap = 1000)
summary(med.model, fit.measures=TRUE, standardized=TRUE, ci=TRUE)
## lavaan 0.6.13 ended normally after 1 iteration
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 7
##
## Used Total
## Number of observations 195 200
##
## Model Test User Model:
##
## Test statistic 0.000
## Degrees of freedom 0
##
## Model Test Baseline Model:
##
## Test statistic 142.938
## Degrees of freedom 5
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.000
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -548.344
## Loglikelihood unrestricted model (H1) -548.344
##
## Akaike (AIC) 1110.687
## Bayesian (BIC) 1133.598
## Sample-size adjusted Bayesian (SABIC) 1111.423
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value H_0: RMSEA <= 0.050 NA
## P-value H_0: RMSEA >= 0.080 NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.000
##
## Parameter Estimates:
##
## Standard errors Bootstrap
## Number of requested bootstrap draws 1000
## Number of successful bootstrap draws 1000
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## post_anx ~
## compare (b1) 0.276 0.062 4.458 0.000 0.148 0.396
## sop (c1) -0.208 0.075 -2.770 0.006 -0.358 -0.059
## spp (c2) 0.440 0.077 5.747 0.000 0.290 0.587
## compare ~
## sop (a3) 0.227 0.098 2.320 0.020 0.028 0.419
## spp (a4) 0.178 0.087 2.036 0.042 0.013 0.356
## Std.lv Std.all
##
## 0.276 0.314
## -0.208 -0.293
## 0.440 0.615
##
## 0.227 0.281
## 0.178 0.219
##
## Variances:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## .post_anx 0.758 0.080 9.413 0.000 0.589 0.903
## .compare 1.253 0.125 10.063 0.000 0.975 1.469
## Std.lv Std.all
## 0.758 0.612
## 1.253 0.785
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## a3b1 0.063 0.029 2.162 0.031 0.007 0.121
## a4b1 0.049 0.027 1.848 0.065 0.003 0.110
## Std.lv Std.all
## 0.063 0.088
## 0.049 0.069
parameterestimates(med.model, boot.ci.type = "perc", standardized = TRUE)
lavInspect(med.model, what = "rsquare")
## post_anx compare
## 0.388 0.215