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

Highlight extreme points in NPDE plots #31

Open
timwaterhouse opened this issue Jun 28, 2021 · 0 comments
Open

Highlight extreme points in NPDE plots #31

timwaterhouse opened this issue Jun 28, 2021 · 0 comments

Comments

@timwaterhouse
Copy link

Since NPDEs are constrained to be within a certain range (depending on the number of simulation replicates), it would be nice to be able to highlight the points that are sitting on the edges of that range.

For k replicates, I believe the extreme situations (i.e., simulated values are either all above or all below observed) are handled by setting NPDE to qnorm(1/(2*k)) or qnorm(1 - 1/(2*K)). It could be helpful to identify which points correspond to those values in the plots. I'm thinking the output could look something like this:

library(pmplots)
#> Loading required package: ggplot2
df <- pmplots_data_obs()
p <- npde_time(df)
k <- 150
df_extreme <- dplyr::filter(
  df,
  abs(round(NPDE, 3)) == round(qnorm(1 - 1/(2*k)), 3)
)
p + geom_point(data = df_extreme, fill = "red", pch = 23, cex = 2)
#> `geom_smooth()` using formula 'y ~ x'

Created on 2021-06-28 by the reprex package (v2.0.0)

Unfortunately it would mean having to supply the value of k, so the user would need to be careful about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant