Multiple KDE models in one plot

348 views
Skip to first unread message

Annapaola Passerini

unread,
Aug 20, 2021, 6:52:55 AM8/20/21
to OxCal

Hello,

I am new to using KDE models in OxCal and I am having some issues figuring out the correct syntax for what I would like to produce. I am trying to visualize the KDE model distribution of two different chronocultural groups in the same plot and color code them for comparison. What is the best way to do this? Should I treat these two groups as overlapping KDE models?

I am aware that this must be very basic, but any tip will be much appreciated.

Kind regards,
Anna


Erik Marsh

unread,
Aug 21, 2021, 7:54:54 AM8/21/21
to OxCal
Hi Anna,
Yes, you can do that by including both inside the same Plot(). No need to treat them as overlapping. You can specify a color for each. Once you've give it a try, post your code here and the forum will help you with it.
Erik

Annapaola Passerini

unread,
Aug 26, 2021, 7:38:51 AM8/26/21
to OxCal
Hi Erik,

Thank you for your reply. So below is the code I've used:

Plot()
 {
  KDE_Model("Group A", )
  {
   color="Red";
   R_Date("A1", 4040, 20);
   R_Date("A2", 4020, 20);
   R_Date("A3", 4045, 20);
   R_Date("A4", 4055, 15);
   R_Date("A5", 4200, 25);
   R_Date("A6", 4398, 28);
   R_Date("A7", 4215, 22);
   R_Date("A8", 4137, 22);
   R_Date("A9", 4272, 34);
   R_Date("A10", 4134, 22);
   R_Date("A11", 4161, 28);
   R_Date("A12", 4429, 30);
   R_Date("A13", 3900, 25);
   R_Date("A14", 4145, 35);
   R_Date("A15", 4140, 35);
   R_Date("A16", 4140, 35);
   R_Date("A17", 4210, 35);
   R_Date("A18", 4205, 35);
   R_Date("A19", 4160, 30);
   R_Date("A20", 4100, 35);
   R_Date("A21", 4100, 35);
   R_Date("A22", 4172, 25);
   R_Date("A23", 4166, 23);
   R_Date("A24", 4204, 26);
   R_Date("A25", 4176, 23);
   R_Date("A26", 4134, 24);
   R_Date("A27", 4142, 21);
   R_Date("A28", 4134, 21);
   R_Date("A29", 3870, 55);
   R_Date("A30", 3960, 55);
   R_Date("A31", 3330, 60);
   R_Date("A32", 3857, 25);
   R_Date("A33", 3872, 25);
   R_Date("A34", 3915, 25);
   R_Date("A35", 3975, 30);
   R_Date("A36", 3930, 30);
   R_Date("A37", 4035, 30);
   R_Date("A38", 3920, 30);
   R_Date("A39", 3970, 30);
   R_Date("A40", 3860, 35);
   R_Date("A41", 3830, 30);
   R_Date("A42", 3985, 35);
   R_Date("A43", 3880, 35);
   R_Date("A44", 3905, 25);
   R_Date("A45", 4020, 25);
   R_Date("A46", 3950, 20);
  };
  KDE_Model("Group B", )
  {
   color="Blue";
   R_Date("B1", 3802, 25);
   R_Date("B2", 3849, 40);
   R_Date("B3", 3742, 36);
   R_Date("B4", 3802, 25);
   R_Date("B5", 3800, 25);
   R_Date("B6", 3810, 27);
   R_Date("B7", 3808, 36);
   R_Date("B8", 3845, 23);
   R_Date("B9", 3840, 23);
   R_Date("B10", 3930, 26);
   R_Date("B11", 3854, 24);
   R_Date("B12", 3854, 23);
   R_Date("B13", 3896, 23);
   R_Date("B14", 3893, 23);
   R_Date("B15", 3925, 40);
   R_Date("B16", 3958, 30);
   R_Date("B17", 3930, 27);
   R_Date("B18", 3884, 27);
  };
 };
 
I am able to visualize the two groups with View-->Plot Stacks, but I still cannot see them as color coded separate groups in the main output with modeled date on the x axis and the probability on the y axis. I am probably missing something simple, but cannot figure out what it is.
KDE_stacks.png
KDE_groupA_B.png

Erik Marsh

unread,
Aug 28, 2021, 9:51:28 AM8/28/21
to OxCal
Hi Anna,
I ran your code and looked at the options, and actually, I couldn't find for what you're looking to do with the graphics.
I think for most cases, the stacked plots would show what you need to. But if you want the other image (the probability on the y-axis), I would export both as PDFs and then combine them in a graphics program like illustrator.
You may get different options if you model them with KDE_Plot between starting and ending boundaries, I'm not sure.
Maybe someone else knows the OxCal graphics options better.
Sorry I couldn't be of more help! Good luck,
Erik
Reply all
Reply to author
Forward
0 new messages