Open juandelacruz1611 opened 3 years ago
Thank you for taking the time to share a reproducible example. This problem is due to two of your arms having #events = sample size which causes a log(0) calculation in the deviance. Maybe in the future I can work on a fix for this but for now, I suggest reverting your definition of an event, since we have implemented handling of zero cells in BUGSnet. You just have to be careful interpreting the results now as everything is reversed (e.g. if your event was mortality now it is survival).
library(BUGSnet)
library(readxl)
antipyreticsdataset<-read_excel("FeverSF.xlsx")##add the path to the file
antipyreticsdataset$events.rev <- antipyreticsdataset$total - antipyreticsdataset$events #change to the reversed definition
## prepare the data for use in bugsnet
antipyretics.data <- data.prep(arm.data = antipyreticsdataset,
varname.t = "interventionname",
varname.s = "study")
## network Plot
net.plot(antipyretics.data, node.scale = , edge.scale=1)
##Network characteristics
network.char <- net.tab(data = antipyretics.data,
outcome = "events.rev", #change to the reversed definition
N = "total",
type.outcome = "binomial",
time = NULL)
##Main analysis
#fixed model
fixed_effects_model <- nma.model(data=antipyretics.data,
outcome="events.rev", #change to the reversed definition
N="total",
reference="Acetaminophen",
family="binomial",
link="log",
effects="fixed")
##random model
random_effects_model <- nma.model(data=antipyretics.data,
outcome="events.rev", #change to the reversed definition
N="total",
reference="Acetaminophen",
family="binomial",
link="log",
effects="random")
set.seed(20190829)
fixed_effects_results <- nma.run(fixed_effects_model,
n.adapt=1000,
n.burnin=1000,
n.iter=10000)
random_effects_results <- nma.run(random_effects_model,
n.adapt=1000,
n.burnin=1000,
n.iter=10000)
I don´t know how to describe how grateful I am. Thank you very much 💯 :)
Hi! I am running into what looks like the same issue but is maybe a little different since the reverse solution didn't work for me.
random_effects_model <- nma.model(data=dat, outcome="X50_rev", N="n", reference="PLCBO", family="binomial", link="cloglog", time = "followup", effects= "random")
fixed_effects_model <- nma.model(data=dat, outcome="X50_rev", N="n", reference="PLCBO", family="binomial", link="cloglog", time = "followup", effects= "fixed")
set.seed(20190829) random_effects_results <- nma.run(random_effects_model, n.adapt=1000, n.burnin=1000, n.iter=10000)
fixed_effects_results <- nma.run(fixed_effects_model, n.adapt=1000, n.burnin=1000, n.iter=10000)
Attached is the data file I am using. exampledata.csv
The 50_reduction endpoint represents a proportion of patients who at the end of the study have a 50% reduction in an outcome.
The error I'm getting exactly when I try to run the model is Compiling model graph Resolving undeclared variables Allocating nodes Graph information: Observed stochastic nodes: 14 Unobserved stochastic nodes: 22 Total graph size: 369
Initializing model Deleting model
Error in jags.model(textConnection(model$bugs), model$data, n.chains = n.chains, : Error in node (log((n[1,1]-r[1,1]))) Invalid parent values
I am hoping for the 50_reduction outcome in the NMA but also tried the reverse! I thought maybe the 0% in Study A PLCBO was causing the issue, but now don't think so.
Thanks in advance for the help!
Hi ! everyone, I´m running a network metanalysis using BUGSnet an R package relied in JAGS. I´m a physician ("medical doctor")and an epidemiology student , so i´m not an expert in programing or R.
When I´m using nma.run() , a function of of BUGSnet, says this
Error in update.jags(model, n.iter, ...) : Error in node (log((n[2,2]-rhat[2,2]))) Invalid parent values
Anyone could help me ?
This is the code and i´m attaching the dataset in xlsx.
at this moment appear "Error in update.jags(model, n.iter, ...) : Error in node (log((n[2,2]-rhat[2,2]))) Invalid parent values"
I would thank you FeverSF.xlsx