mcp
mcp copied to clipboard
Coloring the posterior estimates by CP would make interpretation of plots easier
First, fantastic package! Thank you.
When plotting the results of the model fit it can often be challenging to determine which posterior cp estimates (blue lines at bottom) correspond to the visual change points shown in the upper model curves. This is particularly difficult when one or more of the posterior estimates are bimodal, and worse still if overlapping :-(

If the individual CP posterior estimates were color coded things would be easier. You will note in my graph an attempt to identify the CP range using shaded regions and lines for the mean value.
Thanks, Jim
Define the model with 3 CP
model = list( y ~ 1, # plateau (int_1) ~ 0 + x, # joined slope (time_2) at cp_1 ~ 1 + x, # disjoined slope (int_3, time_3) at cp_2 ~ 1 + x # disjoined slope (int_4, time_4) at cp_3 )
model.string <- paste(sapply(model, function(x) Reduce(paste, deparse(x))), collapse = ", ")
Add prior knowledge to improve model
prior = list( int_1 = 0, # Constant, not estimated cp_1 = "dunif( 0, 200)", # has to occur in this interval cp_3 = "dunif(300, 400)" # has to occur in this interval )
It's definitely a good idea to identify the change point number in addition to their location! Thanks for a great mock-up to make this more specific.
A minimal version would be coloring the posterior densities - either just the line or also using a shade for the area. I will likely be working a bit with colors for categorical predictors (#90) in the next release, so we'll have to figure out a way to do both without having multiple meanings of each color. An issue could also be over-crowding.
Perhaps there's no catch-all solution. So we could let the user choose between a few options. plot(..., cp_dens = x) where x could be FALSE (or c()), c("dens", "color"), c("dens", "band"), c("dens", "color", "band"). This may be overkill and too much code to support, though.
I like the idea of shading only. As far as I can see, it doesn't really matter what number chain you're talking about, so it doesn't really make sense to distinguish them.

Excuse me if my etiquette is inappropriate here, but I've produced this for my own dataset, let me know if the code would be useful for your needs

Not inappropriate at all, rather very thoughtful. Your extended graphics provide a variety of useful information. I would be happy to receive a copy of your code.
Thanks, Jim
On Mon, Aug 2, 2021 at 6:49 AM MDZelko @.***> wrote:
Excuse me if my etiquette is inappropriate here, but I've produced this for my own dataset, let me know if the code would be useful for your needs
[image: GGplotEx] https://user-images.githubusercontent.com/73236090/127872065-651bfb85-12e8-4ea2-8906-e1fea85fc8a3.png
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lindeloev/mcp/issues/102#issuecomment-891042970, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC4LRFC56I7KAEUE33JARDDT22O53ANCNFSM4WZY52PA .
Hey Jim,
Apologies for the delay here, I've been familiarising myself with the practice of sharing code as well as adding some comments to the function to make it more readable.
Here is a link to the script in my repository: https://github.com/MZelko82/mcp_scripts/blob/main/Predict_mcp_Graph.rmd
As it's my first one, I am very open to suggestions about how to improve it, etc.
Cheers,
Matt
Matt
Thanks. I'll take a look.
Jim
On Sat, Aug 21, 2021 at 3:12 AM MDZelko @.***> wrote:
Hey Jim,
Apologies for the delay here, I've been familiarising myself with the practice of sharing code as well as adding some comments to the function to make it more readable.
Here is a link to the script in my repository: https://github.com/MZelko82/mcp_scripts/blob/main/Predict_mcp_Graph.txt
As it's my first one, I am very open to suggestions about how to improve it, etc.
Cheers,
Matt
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lindeloev/mcp/issues/102#issuecomment-903094304, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC4LRFHJKNN6MGEYAUROEADT553XTANCNFSM4WZY52PA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .