Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1. Priors Shiny App #57

Merged
merged 64 commits into from
Aug 22, 2023
Merged

1. Priors Shiny App #57

merged 64 commits into from
Aug 22, 2023

Conversation

gareth-j
Copy link
Contributor

@gareth-j gareth-j commented Jun 26, 2023

This will add a new Shiny app for testing of different priors.

Interface

  • Store the result of each run to allow easy comparison graphically.
  • Add building SPDE section to vignette
  • Slider for modifying other priors

Plotting

  • Boxplot
  • AR(1)
  • Density
  • DIC

Export

  • Code
  • Priors
  • Plots?

Other

  • Tidy model output text
  • Add regex to do some checks on the string we're evaluating
  • Can we pipe the terminal output to the Shiny app? - low priority
  • Check for coordinates LAT LONG being set on data

Closes #54
Closes #70
Closes #46
Closes #76

@gareth-j gareth-j added the enhancement New feature or request label Jun 26, 2023
@gareth-j gareth-j self-assigned this Jun 26, 2023
@gareth-j gareth-j marked this pull request as ready for review June 29, 2023 08:47
Copy link
Contributor

@XueqingYin XueqingYin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @gareth-j ,

Thanks for the work. I’ve reviewed the vignette and the model running process and basic output look good to me. There are just two minor points to be noted.

  1. The vignette is missing a step for building SPDE model and then specifying priors for spatial range parameter and marginal standard deviation parameter, which is:

spde <- INLA::inla.spde2.pcmatern(
mesh = mesh,
prior.range = c(prior_spatial_range, prior_range_probability),
prior.sigma = c(prior_standard_deviation, prior_sd_probability)
)
The priors are specified by changing the values of “prior_spatial_range, prior_range_probability, prior_standard_deviation and prior_sd_probability” based on users’ knowledge, so there should be slider bars to change their values on the Prior ShinyApp. In addition, slide bars should also be included for the prior values of the temporal correlation parameter. The prior for temporal correlation parameter is specified by changing the values of “prior_alpha”, “pg_alpha” in the code below.
rhoprior <- list(theta = list(prior = "pccor1", param = c(prior_alpha, pg_alpha)))

  1. The vignette uses the Bristol COVID-19 data by directly filtering the entire COVID-19 data within Bristol. An issue of that is the temporal index does not start from 1 and is not continuous, which is not expected by INLA. So the time index needs to be reorganized into the correct format in the final version.

I’ve been working on space-time MCMC this week. Next week I will focus on the prior tutorial and preparing a Bristol dataset set that contains the expected time index, the response variable, and the selected covariates. The tutorial will explain the data, the priors, then run BHM based on different prior values, and finally compare the model outputs by plotting histograms / density curves.

Xueqing

@gareth-j
Copy link
Contributor Author

gareth-j commented Jul 3, 2023

It'd be nice to be able to compare the results of different priors.
Store the result of each run to allow easy comparison graphically.

Copy link
Contributor

@XueqingYin XueqingYin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @gareth-j . A minor suggestion on the text for temporal priors help in shiny_priors.R. I was wondering if you could replace the current symbol "a" with the symbol "α"
when referring to temporal autocorrelation parameter in the text, as "α" would align better with "alpha". Apart from this, all look good to me.

Xueqing

@gareth-j
Copy link
Contributor Author

Thank you @gareth-j . A minor suggestion on the text for temporal priors help in shiny_priors.R. I was wondering if you could replace the current symbol "a" with the symbol "α" when referring to temporal autocorrelation parameter in the text, as "α" would align better with "alpha". Apart from this, all look good to me.

Xueqing

OK great, thanks! I've made those changes now.

@gareth-j gareth-j merged commit de91a0d into main Aug 22, 2023
2 of 3 checks passed
@gareth-j gareth-j deleted the Iss54/ShinyPriors branch October 18, 2023 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants