Adding and subtracting log normal distributions

211 views
Skip to first unread message

Zac McIvor

unread,
Apr 6, 2021, 11:12:06 AM4/6/21
to OxCal
Hi all,

What is the mathematical process (in lamens terms if possible) behind subtracting or adding log normal distributions in Oxcal? 

In the code below, I subtract the log normal function "a" from 1500, to equal "b". I then subtract the same log normal function from "b" to equal "c". The result is what I expect - "c" is an earlier and less precise probability distribution than b. However, I do not understand the process and therefore can not explain it in my writing.

Thank you,
Zac (example code below)

Plot()
{
a=LnN(ln(32),ln(1.4));
b=Date(1500)-a;
c=b-a;
};

Ray Kidd

unread,
Apr 6, 2021, 12:22:57 PM4/6/21
to ox...@googlegroups.com
Hello Zac,

If you rearrange c=b-a; with d=Date(1500)-2*a; Then you have the product of two Log Normals with a median twice the original.

 Plot()
 {
  a=LnN(ln(32),ln(1.4));
  b=Date(1500)-a;
  c=b-a;
  d=Date(1500)-2*a;
 };

Comparing the single Plots of c and d.  Perhaps sampling 'a' twice explains the msmc noise that makes for the differences.  We have seen earlier examples where mcmc sampling is to be treated with caution when manipulating distributions  A times B where A=B is not the same as A^2.




I hope this helps

regards

Ray


--
You received this message because you are subscribed to the Google Groups "OxCal" group.
To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/oxcal/3644babe-385c-44ab-a41a-b22db678e6e7n%40googlegroups.com.

Zac McIvor

unread,
Apr 6, 2021, 6:31:24 PM4/6/21
to ox...@googlegroups.com
Thank you again, Ray. This is very helpful!

In "Plot 1" below, "d" is what I expected to see (thanks for clarifying!). "c" had a slightly different shape, as you say. The MCMC noise is a little bit scary as my method relies on sampling from different MCMC-produced distributions. I can work around this in some cases by calling the log normal once (by using your method). However, there will be instances where I wish to call different log normals for the same equation. In Plot 2 below, "Ec" calls two log distributions separately. There may be equations where I call more than two. Is there a problem in doing this?

Plot("Plot 1")
 {
  a=LnN(ln(32),ln(1.4));
  b=Date(1500)-a;
  c=b-a;
  d=Date(1500)-2*a;
 };

Plot("Plot 2")
 {
  Loga=LnN(ln(32),ln(1.4));
  Logb=LnN(ln(27),ln(1.4));
  Ea=Date(1600)-Loga;
  Eb=Date(1600)-2*Loga;
  Ec=Date(1600)-2*Loga-Logb;
 };

You received this message because you are subscribed to a topic in the Google Groups "OxCal" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/oxcal/fFHc-m0SLZ8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to oxcal+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/oxcal/694317120.2554768.1617726174277%40mail.yahoo.com.

Christopher Ramsey

unread,
Apr 7, 2021, 4:49:06 AM4/7/21
to OxCal group
Zac

Yes - the MCMC noise is irritating - but in the end the power of the technique is in dealing with multi-parameter space. So it should not be a problem if you use many distributions. In general the MCMC processing time goes roughly in proportion to the number of parameters. So for n parameters for which you want a resolution set by M histogram bars the computation time goes roughly in proportion to (nM) if the mixing and convergence is good.

You can get over the MCMC noise by integrating either analytically or numerically over the space. For a few parameters this is feasible but the time taken goes as (M^n) so with large parameter spaces quickly becomes impossible. Ultimately this is why we use MCMC for the Bayesian models which frequently have 10s or 100s of parameters.

Best wishes

Christopher

> On 6 Apr 2021, at 23:31, 'Zac McIvor' via OxCal <ox...@googlegroups.com> wrote:
>
> Thank you again, Ray. This is very helpful!
>
> In "Plot 1" below, "d" is what I expected to see (thanks for clarifying!). "c" had a slightly different shape, as you say. The MCMC noise is a little bit scary as my method relies on sampling from different MCMC-produced distributions. I can work around this in some cases by calling the log normal once (by using your method). However, there will be instances where I wish to call different log normals for the same equation. In Plot 2 below, "Ec" calls two log distributions separately. There may be equations where I call more than two. Is there a problem in doing this?
>
> Plot("Plot 1")
> {
> a=LnN(ln(32),ln(1.4));
> b=Date(1500)-a;
> c=b-a;
> d=Date(1500)-2*a;
> };
>
> Plot("Plot 2")
> {
> Loga=LnN(ln(32),ln(1.4));
> Logb=LnN(ln(27),ln(1.4));
> Ea=Date(1600)-Loga;
> Eb=Date(1600)-2*Loga;
> Ec=Date(1600)-2*Loga-Logb;
> };
>
> On Wed, 7 Apr 2021 at 04:23, 'Ray Kidd' via OxCal <ox...@googlegroups.com> wrote:
> Hello Zac,
>
> If you rearrange c=b-a; with d=Date(1500)-2*a; Then you have the product of two Log Normals with a median twice the original.
>
> Plot()
> {
> a=LnN(ln(32),ln(1.4));
> b=Date(1500)-a;
> c=b-a;
> d=Date(1500)-2*a;
> };
>
> Comparing the single Plots of c and d. Perhaps sampling 'a' twice explains the msmc noise that makes for the differences. We have seen earlier examples where mcmc sampling is to be treated with caution when manipulating distributions A times B where A=B is not the same as A^2.
>
>
>
>
> To view this discussion on the web visit https://groups.google.com/d/msgid/oxcal/CALM3LYoewTR9WJfWA4CnH1G7p%3DV7EdkpB-%3DfNL%3DRosKSEMmeKQ%40mail.gmail.com.

Ray Kidd

unread,
Apr 7, 2021, 6:32:52 AM4/7/21
to ox...@googlegroups.com
Hi Zac,

I am a bit puzzled by the subtraction of a LogNormal curve from a Date(1500) as this reverses the skew of the Log Normal.  If the intent is to move the median along the x-axis but not changing the shape, then the subtraction is only applied to the location term, not the shape, or just use the new location

So your original 

Plot("Plot 1")
 {
  a=LnN(ln(32),ln(1.4));
  b=Date(1500)-a;
  c=b-a;

becomes:

 Plot("Plot 1")
 {
  a=LnN(ln(32),ln(1.4));
  b=LnN(ln(1500-32),ln(1.4));
  c=b-a;
 };




In General:

 Plot()
 {
  //ln(a) is the location parameter and sets the place of the median on the horizontal axis.
  //ln(b) is the shape parameter
  var(a);
  // the location parameter
  var(b);
  //ln(b) is the shape parameter
  var(c);
  //set up the LogNormal curve
  a=1500;
  b=1.4;
  c=LnN(ln(a),ln(b));
 };

Hope this helps

Best wishes

Ray

Zac McIvor

unread,
Apr 8, 2021, 1:06:08 AM4/8/21
to ox...@googlegroups.com
Thank you for your responses. I really appreciate this assistance!

Chris, could you please elaborate a little more on what you mean by working around "the MCMC noise by integrating either analytically or numerically over the space"?

Ray, the left-skewed log-normal curve is exactly what I want. The purpose of subtracting the curves repeatedly is to simulate birthdate ages of ancestors based on their descendants' known birthdate. In my earlier examples, 1500 represents a child's birthdate. I estimate the parent's birthdate by subtracting the lognormal distribution from the child's birthdate (assuming pdfs maternal and paternal ages have a mean of late 20s to early 30s and a long tail). Similarly, I estimate the grandparent's birthdate by subtracting the lognormal distribution again from the parent's birthdate estimation and so on. 

The result should simulate how the higher number of generations into the past we go, the less certain we are about when an ancestor was born. At the same time, I wanted to represent the weighted probability of paternal and maternal ages being earlier in life, which the lognormal distribution provides. It might be easier to just use uniform distributions of max and min paternal and maternal ages. However, I would lose some precision this way.

Let's set aside the limitations of developing an accurate baseline pdf of maternal and paternal ages for one generation. Do you think subtracting log-normal distributions over and over again with each generation is a fair representation of reality?

Thanks again for your time and thoughts,
Zac

Christopher Ramsey

unread,
Apr 8, 2021, 4:45:12 AM4/8/21
to OxCal group
Zac

If a ~ g(a) and b ~ h(b) etc then the distribution f(c) for c=a+b can be derived by considering the possible values of a and b that give rise to a specific value of c:

f(c) ~ \int_\infty^\infty g(a)h(c-a) da

sometimes (as with Normal distributions) you can solve this analytically - other times (eg calibrated radiocarbon distributions) you can do it numerically by stepping through in small increments over the values where the functions are non-zero. OxCal does this numerical integration if you just enter two distributions as in:

LnN(ln(32),ln(1.4))+LnN(ln(1500-32),ln(1.4));

but you can also just use MCMC to sample over a and b and then collect the samples for c=a+b. The advantage of this is that you can include other constraints/information in a larger model.

Best wishes

Christopher

> On 8 Apr 2021, at 06:06, 'Zac McIvor' via OxCal <ox...@googlegroups.com> wrote:
>
> Thank you for your responses. I really appreciate this assistance!
>
> Chris, could you please elaborate a little more on what you mean by working around "the MCMC noise by integrating either analytically or numerically over the space"?
>
> Ray, the left-skewed log-normal curve is exactly what I want. The purpose of subtracting the curves repeatedly is to simulate birthdate ages of ancestors based on their descendants' known birthdate. In my earlier examples, 1500 represents a child's birthdate. I estimate the parent's birthdate by subtracting the lognormal distribution from the child's birthdate (assuming pdfs maternal and paternal ages have a mean of late 20s to early 30s and a long tail). Similarly, I estimate the grandparent's birthdate by subtracting the lognormal distribution again from the parent's birthdate estimation and so on.
>
> The result should simulate how the higher number of generations into the past we go, the less certain we are about when an ancestor was born. At the same time, I wanted to represent the weighted probability of paternal and maternal ages being earlier in life, which the lognormal distribution provides. It might be easier to just use uniform distributions of max and min paternal and maternal ages. However, I would lose some precision this way.
>
> Let's set aside the limitations of developing an accurate baseline pdf of maternal and paternal ages for one generation. Do you think subtracting log-normal distributions over and over again with each generation is a fair representation of reality?
>
> Thanks again for your time and thoughts,
> Zac
>
> On Wed, 7 Apr 2021 at 22:32, 'Ray Kidd' via OxCal <ox...@googlegroups.com> wrote:
> Hi Zac,
>
> I am a bit puzzled by the subtraction of a LogNormal curve from a Date(1500) as this reverses the skew of the Log Normal. If the intent is to move the median along the x-axis but not changing the shape, then the subtraction is only applied to the location term, not the shape, or just use the new location
>
> So your original
>
> Plot("Plot 1")
> {
> a=LnN(ln(32),ln(1.4));
> b=Date(1500)-a;
> c=b-a;
>
> becomes:
>
> Plot("Plot 1")
> {
> a=LnN(ln(32),ln(1.4));
> b=LnN(ln(1500-32),ln(1.4));
> c=b-a;
> };
>
>
>
>
> To view this discussion on the web visit https://groups.google.com/d/msgid/oxcal/CALM3LYpPCfnOpnxC-6vr8fQO-4h4o1zQz5mhjHn%2BXMucEVFQVQ%40mail.gmail.com.

Ray Kidd

unread,
Apr 8, 2021, 12:37:56 PM4/8/21
to ox...@googlegroups.com
Hi Zac,


The term Ec in the following
  Ea=Date(1600)-Loga;
  Eb=Date(1600)-2*Loga;
  Ec=Date(1600)-2*Loga-Logb;
 
Has an interpretation in OxCal

 
Whereas the term Ec=Date(1600)-(2*Loga+Logb);

This second interpretation seems closer to the correct median (1600 -32-32-27) = 1509.  This implies that the syntax of the input expression must be clearly understood if false results are to be avoided.The term Ec in the following
  Ea=Date(1600)-Loga;
  Eb=Date(1600)-2*Loga;
  Ec=Date(1600)-2*Loga-Logb;
 
Has an interpretation in OxCal


 
Whereas the term Ec=Date(1600)-(2*Loga+Logb);


This second interpretation seems closer to the correct median (1600 -32-32-27) = 1509.  This implies that the syntax of the input expression must be clearly understood if false results are to be avoided.

The attachment expands on this.

I hope it helps
Best wishes

Ray

Zac The term Ec in the following.pdf

Christopher Ramsey

unread,
Apr 12, 2021, 3:08:18 PM4/12/21
to OxCal group
Yes - use brackets with repeated - operators. I will log this as a bug and try to ensure it performs as expected without brackets.

Best wishes

Christopher

> On 8 Apr 2021, at 17:37, 'Ray Kidd' via OxCal <ox...@googlegroups.com> wrote:
>
> Hi Zac,
>
>
> The term Ec in the following
> Ea=Date(1600)-Loga;
> Eb=Date(1600)-2*Loga;
> Ec=Date(1600)-2*Loga-Logb;
>
> Has an interpretation in OxCal
>
>
> Whereas the term Ec=Date(1600)-(2*Loga+Logb);
>
> This second interpretation seems closer to the correct median (1600 -32-32-27) = 1509. This implies that the syntax of the input expression must be clearly understood if false results are to be avoided.The term Ec in the following
> Ea=Date(1600)-Loga;
> Eb=Date(1600)-2*Loga;
> Ec=Date(1600)-2*Loga-Logb;
>
> Has an interpretation in OxCal
>
>
>
> Whereas the term Ec=Date(1600)-(2*Loga+Logb);
>
>
> This second interpretation seems closer to the correct median (1600 -32-32-27) = 1509. This implies that the syntax of the input expression must be clearly understood if false results are to be avoided.
> To view this discussion on the web visit https://groups.google.com/d/msgid/oxcal/423541968.527267.1617899870554%40mail.yahoo.com.
> <Zac The term Ec in the following.pdf>

Ray Kidd

unread,
Apr 12, 2021, 3:51:39 PM4/12/21
to ox...@googlegroups.com
Hi  Chistopher and Zac,

I have I have tried a few more N(m,s) examples and find that my assumption that only checking for  the correct Mean is not sufficient.  The correct sigma should also be achieved  using each subtracted (summed) distribution  -(dist1 + dist2 + dist3) etc.  But  (- dist1 - dist2 - dist3) give the correct sigma but the wrong Mean (see ENaNANb below.

For -(dist1 + dist 1) then -(2*dist1) can not be used  as the resultant sigma introduces 2^2 * the variance which results in the new sigma being too large.  Using N(m,s) makes for easier checking.  I am not convinced that Log Normals can be treated the same way.

 Plot("Plot 2")
 {
  Nora=N(32,6);
  Norb=N(2,5);
  Sum=Nora+Norb+Nora;
  ENa=Date(1600)-Nora;
  ENaNa=Date(1600)-Nora-Nora;  //wrong mean, right sigma
  ENaNa2=Date(1600)-(Nora+Nora);  //right mean, right sigma
  E2Na=Date(1600)-2*Nora;  // right mean, wrong sigma
  ENaNaNb=Date(1600)-Nora-Nora-Norb;  //wrong mean, right sigma
  ENaNaNbS=Date(1600)-(Nora+Nora+Norb);  //right mean, right sigma
  E2NaNb=Date(1600)-(2*Nora+Norb);  //right mean, wrong sigma.
 };

resulting in:

E2Na and E2NaNb sigmas are too large and should be 8 and 10 respectively, not 12 and 13.  (I think)

Best wishes

Ray


> To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+unsub...@googlegroups.com.
> --
> You received this message because you are subscribed to a topic in the Google Groups "OxCal" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/oxcal/fFHc-m0SLZ8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to oxcal+unsub...@googlegroups.com.
> --
> You received this message because you are subscribed to the Google Groups "OxCal" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+unsub...@googlegroups.com.
> --
> You received this message because you are subscribed to a topic in the Google Groups "OxCal" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/oxcal/fFHc-m0SLZ8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to oxcal+unsub...@googlegroups.com.
> --
> You received this message because you are subscribed to the Google Groups "OxCal" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+unsub...@googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups "OxCal" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+unsub...@googlegroups.com.
> <Zac The term Ec in the following.pdf>

--
You received this message because you are subscribed to the Google Groups "OxCal" group.
To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+unsub...@googlegroups.com.

Christopher Ramsey

unread,
Apr 12, 2021, 6:42:27 PM4/12/21
to OxCal group
Ray

If you expand the table or look at the plots you can see how each has been interpreted:

Plot("Plot 2")
{
Nora=N(32,6);
Norb=N(2,5);
Sum=Nora+Norb+Nora;
ENa=Date(1600)-Nora;
ENaNa=Date(1600)-(Nora-Nora); //wrong mean, right sigma - which explains the mean
ENaNa2=Date(1600)-(Nora+Nora); //right mean, right sigma
E2Na=Date(1600)-2*Nora; // right mean, wrong sigma *
ENaNaNb=Date(1600)-(Nora-(Nora-Norb)); //wrong mean, right sigma - which explains the mean
ENaNaNbS=Date(1600)-(Nora+Nora+Norb); //right mean, right sigma
E2NaNb=Date(1600)-(2*Nora+Norb); //right mean, wrong sigma. *
};

I think the sigma is right in the cases where you flag it as wrong. In fact it is the other cases where the fact that the sigma is correlated between the Nora distributions is ignored. This is because in this calculation mode it is just doing the numerical integrations one at a time. When it comes to the MCMC the correlation is accounted for as there is only one Nora parameter.

Anyway I will look into this because the order of calculation is not what would normally be assumed without the brackets - and it should be.

Best wishes

Christopher

> On 12 Apr 2021, at 20:51, 'Ray Kidd' via OxCal <ox...@googlegroups.com> wrote:
>
> Hi Chistopher and Zac,
>
> I have I have tried a few more N(m,s) examples and find that my assumption that only checking for the correct Mean is not sufficient. The correct sigma should also be achieved using each subtracted (summed) distribution -(dist1 + dist2 + dist3) etc. But (- dist1 - dist2 - dist3) give the correct sigma but the wrong Mean (see ENaNANb below.
>
> For -(dist1 + dist 1) then -(2*dist1) can not be used as the resultant sigma introduces 2^2 * the variance which results in the new sigma being too large. Using N(m,s) makes for easier checking. I am not convinced that Log Normals can be treated the same way.
>
> Plot("Plot 2")
> {
> Nora=N(32,6);
> Norb=N(2,5);
> Sum=Nora+Norb+Nora;
> ENa=Date(1600)-Nora;
> ENaNa=Date(1600)-Nora-Nora; //wrong mean, right sigma
> ENaNa2=Date(1600)-(Nora+Nora); //right mean, right sigma
> E2Na=Date(1600)-2*Nora; // right mean, wrong sigma
> ENaNaNb=Date(1600)-Nora-Nora-Norb; //wrong mean, right sigma
> ENaNaNbS=Date(1600)-(Nora+Nora+Norb); //right mean, right sigma
> E2NaNb=Date(1600)-(2*Nora+Norb); //right mean, wrong sigma.
> };
>
> resulting in:
>
> > To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+un...@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/oxcal/3644babe-385c-44ab-a41a-b22db678e6e7n%40googlegroups.com.
> > --
> > You received this message because you are subscribed to a topic in the Google Groups "OxCal" group.
> > To unsubscribe from this topic, visit https://groups.google.com/d/topic/oxcal/fFHc-m0SLZ8/unsubscribe.
> > To unsubscribe from this group and all its topics, send an email to oxcal+un...@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/oxcal/694317120.2554768.1617726174277%40mail.yahoo.com.
> > --
> > You received this message because you are subscribed to the Google Groups "OxCal" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+un...@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/oxcal/CALM3LYoewTR9WJfWA4CnH1G7p%3DV7EdkpB-%3DfNL%3DRosKSEMmeKQ%40mail.gmail.com.
> > --
> > You received this message because you are subscribed to a topic in the Google Groups "OxCal" group.
> > To unsubscribe from this topic, visit https://groups.google.com/d/topic/oxcal/fFHc-m0SLZ8/unsubscribe.
> > To unsubscribe from this group and all its topics, send an email to oxcal+un...@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/oxcal/1561702087.156132.1617791566504%40mail.yahoo.com.
> > --
> > You received this message because you are subscribed to the Google Groups "OxCal" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+un...@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/oxcal/CALM3LYpPCfnOpnxC-6vr8fQO-4h4o1zQz5mhjHn%2BXMucEVFQVQ%40mail.gmail.com.
> >
> > --
> > You received this message because you are subscribed to the Google Groups "OxCal" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+un...@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/oxcal/423541968.527267.1617899870554%40mail.yahoo.com.
> > <Zac The term Ec in the following.pdf>
>
> --
> You received this message because you are subscribed to the Google Groups "OxCal" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+un...@googlegroups.com.
> --
> You received this message because you are subscribed to the Google Groups "OxCal" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/oxcal/803684471.696711.1618257096966%40mail.yahoo.com.

Zac McIvor

unread,
Apr 12, 2021, 7:07:35 PM4/12/21
to ox...@googlegroups.com
Hi Ray and Christopher,

Following your experiments, Ray, I have played around with the formula Date-(dist1+dist2+dist3) using lognormals. I find that the expected mean and sigma are achieved with this method if only one LN pdf is used. I should also note that I position the LN distribution within a Sequence with a Before and After to make it impossible for a birth to occur before 15 and after 70 for males, and before 15 and after 50 for females. 

In the below example G# defines the Generation Number before the descendant with a known birthdate (G0=1600). The mean and sigma of G1LN and G2LN are calculated as expected (mean should be subtracted by the mean of Male/Female each generation; sigma = the sigma of Male/Female should be added with each generation). G3LN introduces a Female LN. The formula results in the expected G3LN mean, but an unexpected sigma. Perhaps this is a result of different pdf shapes interacting with one another (see table below). 

The same pattern occurs with normal distributions it does. The G3N (Generation 3 pdf calculate from male and female Normal Distributions) has a different sigma when two different normal distributions (MaleN and FemaleN) are included in the formula. Perhaps this means that the results are both reliable... or both unreliable? I am now a little confused about which formula I should use going forward.

Thank you both for your continued engagement and expertise.

Kind regards
Zac

Output results:
  Min Max Expected mean Expected sigma Calculated mean Calculated sigma
G0LN 1600 1600        
G1LN 1530 1585 1566 11 1566 11
G2LN 1460 1570 1533 21 1533 21
G3LN 1410 1555 1504 29 1505 (probably down to rounding) 23
 
G1N 1530 1585 1567 8 1568 8
G2N 1460 1570 1535 16 1535 16
G3N 1410 1555 1508 22 1508 17

Plot()
 {
  Sequence()
  {
   After(15);
     MaleLN=LnN(ln(32),ln(1.4));
   Before(70);
  };
  Sequence()
  {
  After(15);
  FemaleLN=LnN(ln(27),ln(1.4));
  Before(50);
  };
  
  G0=Date(1600);
  G1LN=G0-MaleLN;
  G2LN=G0-(MaleLN+MaleLN);
  G3LN=G0-(MaleLN+MaleLN+FemaleLN);
  
  Sequence()
  {
   After(15);
     MaleN=N(32,8.5);
   Before(70);
  };
  Sequence()
  {
   After(15);
    FemaleN=N(27,6);
   Before(50);
  };

  G1N=G0-MaleN;
  G2N=G0-(MaleN+MaleN);
  G3N=G0-(MaleN+MaleN+FemaleN);
 };

To unsubscribe from this group and all its topics, send an email to oxcal+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/oxcal/803684471.696711.1618257096966%40mail.yahoo.com.

Ray Kidd

unread,
Apr 13, 2021, 7:04:25 AM4/13/21
to ox...@googlegroups.com
Hello Christopher,

Thanks, I think I follow.  The syntax applied by the program delivers the correct result for that syntax, but the syntax applied by the program may not be the one input by the user.

Reminds me of Eric Morecambe's  sketch "I'm playing all the right notes, but not necessarily in the right order".

best wishes

Ray


> > To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+unsub...@googlegroups.com.
> > --
> > You received this message because you are subscribed to a topic in the Google Groups "OxCal" group.
> > To unsubscribe from this topic, visit https://groups.google.com/d/topic/oxcal/fFHc-m0SLZ8/unsubscribe.
> > To unsubscribe from this group and all its topics, send an email to oxcal+unsub...@googlegroups.com.
> > --
> > You received this message because you are subscribed to the Google Groups "OxCal" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+unsub...@googlegroups.com.
> > --
> > You received this message because you are subscribed to a topic in the Google Groups "OxCal" group.
> > To unsubscribe from this topic, visit https://groups.google.com/d/topic/oxcal/fFHc-m0SLZ8/unsubscribe.
> > To unsubscribe from this group and all its topics, send an email to oxcal+unsub...@googlegroups.com.
> > --
> > You received this message because you are subscribed to the Google Groups "OxCal" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+unsub...@googlegroups.com.
> >
> > --
> > You received this message because you are subscribed to the Google Groups "OxCal" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+unsub...@googlegroups.com.
> > <Zac The term Ec in the following.pdf>
>
> --
> You received this message because you are subscribed to the Google Groups "OxCal" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+unsub...@googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups "OxCal" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+unsub...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "OxCal" group.
To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+unsub...@googlegroups.com.

Christopher Ramsey

unread,
Apr 15, 2021, 6:29:15 AM4/15/21
to OxCal group
Ray & Zac

You are quite right the order should be correct.  I have just released a new version 4.4.4 which deals with this issue.  If you use your code I think it now behaves as it should.  I have only modified it to make clear that the overall result is a Date - otherwise it interprets some as intervals, and forced it also to run MCMC:

 Plot("Plot 2")
 {
  Nora=N(32,6);
  Norb=N(2,5);
  Sum=Nora+Norb+Nora;
  ENa=Date(1600-Nora);
  ENaNa=Date(1600-Nora-Nora);  //wrong mean, right sigma
  ENaNa2=Date(1600-(Nora+Nora));  //right mean, right sigma
  E2Na=Date(1600-2*Nora);  // right mean, wrong sigma
  ENaNaNb=Date(1600-Nora-Nora-Norb);  //wrong mean, right sigma
  ENaNaNbS=Date(1600-(Nora+Nora+Norb));  //right mean, right sigma
  E2NaNb=Date(1600-(2*Nora+Norb));  //right mean, wrong sigma.
  MCMC_Sample();
 };

The output is then:


You will see that with the MCMC all three formulations give the same result.  

With the calculation note that Na + Na assumes that each distribution is independent - this gives a smaller uncertainty.  The correlation is taken into account in the MCMC as that knows the two parameters are the same.

If you want the Na distributions to be treated as separate variables just enter them directly rather than as a shared variable as in:

 Plot("Plot 2")
 {
  Sum=N(32,6)+N(2,5)+N(32,6);
  ENa=Date(1600-N(32,6));
  ENaNa=Date(1600-N(32,6)-N(32,6));  //wrong mean, right sigma
  ENaNa2=Date(1600-(N(32,6)+N(32,6)));  //right mean, right sigma
  E2Na=Date(1600-2*N(32,6));  // right mean, wrong sigma
  ENaNaNb=Date(1600-N(32,6)-N(32,6)-N(2,5));  //wrong mean, right sigma
  ENaNaNbS=Date(1600-(N(32,6)+N(32,6)+N(2,5)));  //right mean, right sigma
  E2NaNb=Date(1600-(2*N(32,6)+N(2,5)));  //right mean, wrong sigma.
  MCMC_Sample();
 };

which gives:


which apart from some rounding errors gives the same answer in the calculation and MCMC.

Best wishes

Christopher

> > To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+un...@googlegroups.com.

> > To view this discussion on the web visit https://groups.google.com/d/msgid/oxcal/3644babe-385c-44ab-a41a-b22db678e6e7n%40googlegroups.com.
> > -- 
> > You received this message because you are subscribed to a topic in the Google Groups "OxCal" group.
> > To unsubscribe from this topic, visit https://groups.google.com/d/topic/oxcal/fFHc-m0SLZ8/unsubscribe.
> > To unsubscribe from this group and all its topics, send an email to oxcal+un...@googlegroups.com.

> > To view this discussion on the web visit https://groups.google.com/d/msgid/oxcal/694317120.2554768.1617726174277%40mail.yahoo.com.
> > -- 
> > You received this message because you are subscribed to the Google Groups "OxCal" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+un...@googlegroups.com.

> > To view this discussion on the web visit https://groups.google.com/d/msgid/oxcal/CALM3LYoewTR9WJfWA4CnH1G7p%3DV7EdkpB-%3DfNL%3DRosKSEMmeKQ%40mail.gmail.com.
> > -- 
> > You received this message because you are subscribed to a topic in the Google Groups "OxCal" group.
> > To unsubscribe from this topic, visit https://groups.google.com/d/topic/oxcal/fFHc-m0SLZ8/unsubscribe.
> > To unsubscribe from this group and all its topics, send an email to oxcal+un...@googlegroups.com.

> > To view this discussion on the web visit https://groups.google.com/d/msgid/oxcal/1561702087.156132.1617791566504%40mail.yahoo.com.
> > -- 
> > You received this message because you are subscribed to the Google Groups "OxCal" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+un...@googlegroups.com.

> > To view this discussion on the web visit https://groups.google.com/d/msgid/oxcal/CALM3LYpPCfnOpnxC-6vr8fQO-4h4o1zQz5mhjHn%2BXMucEVFQVQ%40mail.gmail.com.
> > 
> > -- 
> > You received this message because you are subscribed to the Google Groups "OxCal" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+un...@googlegroups.com.

> > To view this discussion on the web visit https://groups.google.com/d/msgid/oxcal/423541968.527267.1617899870554%40mail.yahoo.com.
> > <Zac The term Ec in the following.pdf>

> -- 
> You received this message because you are subscribed to the Google Groups "OxCal" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+un...@googlegroups.com.

> To view this discussion on the web visit https://groups.google.com/d/msgid/oxcal/B49E9C3F-2991-415E-A019-DE4818935F3F%40arch.ox.ac.uk.

> -- 
> You received this message because you are subscribed to the Google Groups "OxCal" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+un...@googlegroups.com.

> To view this discussion on the web visit https://groups.google.com/d/msgid/oxcal/803684471.696711.1618257096966%40mail.yahoo.com.

-- 
You received this message because you are subscribed to the Google Groups "OxCal" group.
To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+un...@googlegroups.com.
-- 
You received this message because you are subscribed to the Google Groups "OxCal" group.
To unsubscribe from this group and stop receiving emails from it, send an email to oxcal+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/oxcal/1425994005.828481.1618311856538%40mail.yahoo.com.

Reply all
Reply to author
Forward
0 new messages