seroanalytics / serosolver

Inference framework for serological data
https://seroanalytics.github.io/serosolver/
GNU General Public License v3.0
16 stars 7 forks source link

faceing error in MCMC trace on attack rates plot #55

Open anjY123 opened 7 months ago

anjY123 commented 7 months ago

Hello, I'm trying to run the code to generate Figure plots, Plot MCMC trace on attack rates you provided, but I'm encountering an error message: "Error in list_to_dataframe(res, attr(.data, "split_labels"), .id, id_as_factor) : Results do not have equal lengths."

Could you please share the specific code snippet that is causing this error? Additionally, if there are any specific input data or parameters used in the code, providing that information could be helpful in diagnosing and resolving the issue.

Thank you.

jameshay218 commented 7 months ago

Hi anjY123,

Thanks for your message. serosolver is back in development so first thing is to check that you are using the stable version, installed using devtools::install_github("seroanalytics/serosolver",ref="published").

If you are using the correct version and the error persists, please can you provide the line of code that causes the error? Is it from one of the vignettes? If so, which line?

Best, James

anjY123 commented 7 months ago

Figure plots ------------------------------------------------------------

Plot MCMC trace on attack rates

n_alive <- get_n_alive_group(titre_dat_unvac, seq_along(strain_isolation_times),melt_dat=TRUE) inf_chain <- all_chains$inf_chain indivs <-unique(titre_dat_unvac[titre_dat_unvac$samples %in% strain_isolation_times[length(strain_isolation_times)],"individual"])

pdf(paste0("plots/",filename,"_attack_rate_trace.pdf"))

plot_infection_history_chains_time(inf_chain,0,NULL,n_alive=n_alive,pad_chain=FALSE)[[1]]

dev.off()

MCMC trace plot on individual total infections

pdf(paste0("plots/",filename,"_indiv_hist_trace.pdf"))

plot_infection_history_chains_indiv(all_chains$inf_chain,burnin = 0,1:25,pad_chain=FALSE)[[1]]

dev.off()

exists("y")

Generate posterior distributions for infection histories

y <- generate_cumulative_inf_plots(all_chains$inf_chain,burnin = 0,1:12,nsamp=10, strain_isolation_times = strain_isolation_times, pad_chain = FALSE,number_col = 2,subset_years = NULL)

pdf(paste0("plots/",filename,"_cumu_infhist.pdf"))

plot(y[[1]])

dev.off()

pdf(paste0("plots/",filename,"_infhist.pdf"))

plot(y[[2]])

dev.off()

From the above code before this line '''## Generate posterior distributions for infection histories'' every thing runing good after when our i run this Y <- generate_cumulative_inf_plots there i'm getting error. i was using this devtools::install_github("seroanalytics/serosolver",ref="published") version.