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. Adds map plot of model output to priors app #147

Merged
merged 19 commits into from
Oct 9, 2023
Merged

1. Adds map plot of model output to priors app #147

merged 19 commits into from
Oct 9, 2023

Conversation

gareth-j
Copy link
Contributor

@gareth-j gareth-j commented Sep 28, 2023

  • Summary of changes
    Adds ability to plot predictions data onto a leaflet map.

  • Please check if the PR fulfills these requirements

@gareth-j gareth-j added the enhancement New feature or request label Sep 28, 2023
@gareth-j gareth-j self-assigned this Sep 28, 2023
@gareth-j gareth-j changed the base branch from main to devel September 28, 2023 15:24
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.

Here are a few changes that need to be made.

  1. In my opinion, only the plot of “mean_post + fixed_mean” and the plot of “mean_post” hold statistical significance.
  • The plot of “mean_post + fixed_mean” means we are plotting the predicted mean fields on the raw data scale. It corresponds to the code:
    z <- base::exp(base::as.numeric(A_proj %*% var_a[1:mesh$n]) + base::sum(var_b))

  • The plot of “mean_post ” means we are plotting the random effect fields. It corresponds to the code: z <- var_a[1:mesh$n]
    After computing “z” properly, we can then plot using create_raster()

  1. It would be helpful to provide explanations for the variables "mean_post" and "fixed_mean" respectively, maybe under the "Help" tab:
  • “mean_post” represents the random effect values at mesh nodes

  • “fixed_mean” denotes the fixed effects values, i.e., the regression parameters values

  1. Depending on the data type, the calculation of z is a bit different. If plotting “mean_post + fixed_mean”, then it should be
    z <- base::exp(base::as.numeric(A_proj %*% var_a[1:mesh$n]) + base::sum(var_b)) for Poisson data.
    z <- base::as.numeric(A_proj %*% var_a[1:mesh$n]) + base::sum(var_b) for Gaussian data
    If plotting “mean_post”, it should be z <- var_a[1:mesh$n] for both Poisson and Gaussian data

@gareth-j gareth-j requested review from XueqingYin and removed request for mnky9800n and XueqingYin October 6, 2023 15:53
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.

It looks great, thank you @gareth-j. Is it possible to add a legend to the outputs map? Currently, the raster image doesn't have a legend, so we can't know which colors represent high values, which represents low values. Function leaflet::addLegend(pal = , values =, title = " ") should help with that.

@gareth-j gareth-j changed the title Adds map plot of model output to priors app 1. Adds map plot of model output to priors app Oct 8, 2023
@gareth-j gareth-j linked an issue Oct 8, 2023 that may be closed by this pull request
@gareth-j gareth-j linked an issue Oct 8, 2023 that may be closed by this pull request
@XueqingYin XueqingYin self-requested a review October 9, 2023 07:17
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.

The legend looks good, thanks.

@gareth-j gareth-j merged commit b4300b2 into devel Oct 9, 2023
5 checks passed
@gareth-j gareth-j deleted the modelParse branch October 18, 2023 10:30
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
2 participants