library(metapsyData) library(metapsyTools) library(tidyverse) d <- getData("psychosis-psyctr", version = "23.0.4") dat <- d$data # Clear study labels, variable labels dat %>% mutate( study = recode(study, `Färdig 2011` = "Färdig 2011", `Jørgensen 2015` = "Jørgensen 2015", `Jørgensen 2015` = "Jørgensen 2015", `SaÌ<81>nchez 2013` = "Sánchez 2013"), stage = replace_na(stage, "Unspecified"), clinical_picture = replace_na(clinical_picture, "Unspecified") ) -> dat # Run combined MA for total symptom data filterPoolingData( dat, symptom_domain == "total") %>% runMetaAnalysis(which.run = "combined", rho.within.study = 0.5, which.combine = "arms") %>% {.$model.combined$data$N = .$model.combined$data$totaln_arm1 + .$model.combined$data$totaln_arm2; .$model.combined$data$rob = floor(.$model.combined$data$rob); .$model.combined$data} -> total # Run combined MA for positive data filterPoolingData( dat, symptom_domain == "positive") %>% runMetaAnalysis(which.run = "combined", rho.within.study = 0.5, which.combine = "arms") %>% {.$model.combined$data$N = .$model.combined$data$totaln_arm1 + .$model.combined$data$totaln_arm2; .$model.combined$data$rob = floor(.$model.combined$data$rob); .$model.combined$data} -> positive # Run combined MA for negative symptom data filterPoolingData( dat, symptom_domain == "negative") %>% runMetaAnalysis(which.run = "combined", rho.within.study = 0.5, which.combine = "arms") %>% {.$model.combined$data$N = .$model.combined$data$totaln_arm1 + .$model.combined$data$totaln_arm2; .$model.combined$data$rob = floor(.$model.combined$data$rob); .$model.combined$data} -> negative # Combine and save list(total = total, positive = positive, negative = negative, metadata = d$returnMetadata()) -> PsychosisPsyCtrDB save(PsychosisPsyCtrDB, file="www/data/PsychosisPsyCtrDB.rda")