Skip to main content
1-Visitor
Aug 24, 2015 8:50 PM UTC
Solved

Define truncated normal distribution in MC15

Hi All,

I'd like to define and use a truncated normal distribution with both lower and upper limits.

I use the general Wikipedia discription for reference:

Truncated normal distribution - Wikipedia, the free encyclopedia

My xmcd file is attached.

I managed to define the PDF function with only lower limit, and check returns its ok (its integral on the lower bound - infinite range equals 1).

However, trying with two limits, the check integral has big values, way more than one.

Can anybody help me with this? I don't see where I made something wrong.

Thanks in advance.

Zsolt

23-Emerald V
Aug 24, 2015 10:00 PM UTC

Zsolt Roman wrote:

Hi All,

I'd like to define and u,se a truncated normal distribution with both lower and upper limits.

I use the general Wikipedia discription for reference:

Truncated normal distribution - Wikipedia, the free encyclopedia

My xmcd file is attached.

I managed to define the PDF function with only lower limit, and check returns its ok (its integral on the lower bound - infinite range equals 1).

However, trying with two limits, the check integral has big values, way more than one.

Can anybody help me with this? I don't see where I made something wrong.

I think you're double-booking b and a by putting B and A in the pnorm functions.

Stuart

4 replies

23-Emerald V
Aug 24, 2015 10:00 PM UTC

Zsolt Roman wrote:

Hi All,

I'd like to define and u,se a truncated normal distribution with both lower and upper limits.

I use the general Wikipedia discription for reference:

Truncated normal distribution - Wikipedia, the free encyclopedia

My xmcd file is attached.

I managed to define the PDF function with only lower limit, and check returns its ok (its integral on the lower bound - infinite range equals 1).

However, trying with two limits, the check integral has big values, way more than one.

Can anybody help me with this? I don't see where I made something wrong.

I think you're double-booking b and a by putting B and A in the pnorm functions.

Stuart

Translate
23-Emerald V
Aug 24, 2015 10:09 PM UTC

You don't need to define your own phi. You can just use:

Translate
1-Visitor
Aug 24, 2015 10:57 PM UTC

Apart from Stuarts and Lucs comments - you missed a sigma when you defined your Phi-function.

And of course you don't need to do so as we have dnorm in Mathcad as you can see:

And as Stuart already remarked, you should not "double normalize" a and b.

LT

Translate
zroman-21-VisitorAuthor
1-Visitor
Aug 25, 2015 6:44 AM UTC

Thank you for all your answers, issue got solved very quickly.

As for the missing sigma - it was defined out of the formula, in the trf(x) function, as 1/sigma. But anyways, using dnorm is obviously preferred.

Translate