# ここにメタ解析コードを入れる
library(tidyverse)
#> ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
#> ✔ dplyr 1.1.4 ✔ readr 2.1.5
#> ✔ forcats 1.0.0 ✔ stringr 1.5.1
#> ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
#> ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
#> ✔ purrr 1.0.2
#> ── 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
library(metafor)
#> Warning: package 'metafor' was built under R version 4.4.1
#> Loading required package: Matrix
#>
#> Attaching package: 'Matrix'
#>
#> The following objects are masked from 'package:tidyr':
#>
#> expand, pack, unpack
#>
#> Loading required package: metadat
#> Loading required package: numDeriv
#>
#> Loading the 'metafor' package (version 4.8-0). For an
#> introduction to the package please type: help(metafor)
Analysis <- read_csv("Analysis.csv")
#> Rows: 105 Columns: 10
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (9): StudyID, Outcome, ES, Variance, ES_Type, Country, Region, PA_Measur...
#> dbl (1): Year
#>
#> ℹ 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.
dat_use <- Analysis %>%
filter(
ES_Type == "SMCC",
Outcome %in% c("LifeSat", "LifeSatisfaction", "SWLS",
"SWB", "SWB_Total", "LifeSat_Self")
) %>%
mutate(
ES = as.numeric(ES),
Variance = as.numeric(Variance),
Region = ifelse(Region == "Asia", "Asia", "NonAsia")
)
dat_clean <- dat_use %>%
filter(!is.na(ES), !is.na(Variance), Variance > 0)
res_overall <- rma(
yi = dat_clean$ES,
vi = dat_clean$Variance,
data = dat_clean,
method = "REML"
)
summary(res_overall)
#>
#> Random-Effects Model (k = 27; tau^2 estimator: REML)
#>
#> logLik deviance AIC BIC AICc
#> 3.7450 -7.4899 -3.4899 -0.9737 -2.9682
#>
#> tau^2 (estimated amount of total heterogeneity): 0.0389 (SE = 0.0116)
#> tau (square root of estimated tau^2 value): 0.1971
#> I^2 (total heterogeneity / total variability): 94.09%
#> H^2 (total variability / sampling variability): 16.93
#>
#> Test for Heterogeneity:
#> Q(df = 26) = 423.2473, p-val < .0001
#>
#> Model Results:
#>
#> estimate se zval pval ci.lb ci.ub
#> 0.1275 0.0395 3.2250 0.0013 0.0500 0.2049 **
#>
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
forest(res_overall, slab = dat_clean$StudyID)
