[R-meta] Error with rma.uni in a Monte Carlo simulation
Will Hopkins
w|||thek|w| @end|ng |rom gm@||@com
Wed Mar 6 06:58:26 CET 2024
Chat GPT helped me to write the code to analyze 5000 simulated datasets I
had created in SAS. It worked fine for a small number of simulations, but
when I ran it for 5000, I got an error and no results. See below for the
code, due mainly to ChatGPT (I added the control statement in a failed
attempt to get past the error, after I consulted the documentation),
followed by the error message. Can someone tell me how to get past the
error? When an analysis fails in SAS with "by Sim" processing, it simply
doesn't output that particular dataset. Thanks heaps.
Will
# Function to perform meta-analysis using rma.uni
perform_meta_analysis <- function(xxx) {
# Perform meta-analysis using rma.uni
meta_analysis <- rma.uni(yi = xxx$Ydelta, vi = xxx$YdeltaSEsq,
mods=xxx$Female01, control=list(maxiter=400))
# Return results
return(meta_analysis)
}
# List to store meta-analysis results
meta_results <- list()
# Perform meta-analysis for each dataset
for (i in 1:max(data$Sim)) {
# Subset data for the current meta-analysis
meta_data <- subset(data, Sim == i)
# Perform meta-analysis using rma.uni
result <- perform_meta_analysis(meta_data)
# Store result
meta_results[[i]] <- result
}
Here's the error:
Error in rma.uni(yi = xxx$Ydelta, vi = xxx$YdeltaSEsq, mods = xxx$Female01,
:
Fisher scoring algorithm did not converge. See 'help(rma)' for possible
remedies.
[[alternative HTML version deleted]]
More information about the R-sig-meta-analysis
mailing list