Showing posts with label cdf. Show all posts
Showing posts with label cdf. Show all posts

Sunday, September 24, 2023

HP 15C: Error Function and Lower Tail Normal Cumulative Function

 HP 15C:   Error Function and Lower Tail Normal Cumulative Function






Formulas Used 



Error Function 


erf(x) = 2 ÷ √π * ∫( e^(-t^2) dt, t = 0 to t = x)




CDF (Cumulative Normal Distribution Function)


CDF(x) = 1 ÷ √(2 * π) * ∫( e^(-t^2) dt, t = -∞ to t = x)


We can use the error function to calculate CDF(x):


0.5 - erf(x), for x < 0


0.5 + erf(x), for x ≥ 0



This program uses the integration function inside the program.  We will need 23 free memory registers to run the program, which will be terminated at the end of program execution.



Labels used:


B:  erf function (error function)

C:  lower tail normal CDF 

4:  function used for integration


(Of course, feel free to use the labels you want, just be mindful to make the appropriate adjustments)




HP 15C Program Code:  Error Function and Lower Tail Normal Cumulative Function


Steps:  35

Bytes:  40



Step # :  Key Code :  Key


001 : 42,21,12:  LBL B

002 :  0  :   0

003 : 34 : x<>y

004 : 42,20, 4 : ∫_x_y 4

005 : 43, 32 : RTN


006 : 42,21,13 : LBL C

007 : 43,30, 2 :  TEST 2 (x<0)

008 : 43, 4, 0 : SF 0

009 : 43, 16 :  ABS

010 : 0   :   0

011 : 34 :  x<>y

012 : 2   :  2

013 : 11 :  √

014 : 10 :  ÷

015 : 42,20, 4 : ∫_y_x 4

016 : 2   :  2

017 : 10 :  ÷

018 : 48 :  .

019 : 5   :  5

020 : 34 :  x<>y

021 : 43, 6, 0 :  F?0

022 : 16  : CHS

023 : 40  :  +

024 : 43, 5, 0 : CF 0

025 : 43, 32 : RTN


026 : 42,21, 4 : LBL 4

027 : 43,11 : x^2

028 : 16 :  CHS

029 : 12 :  e^x

030 :  2  :  2

031 :  20  : ×

032 :  43,26 : π

033 :  11 :  √

034 :  10 :  ÷

035 :  43,32 : RTN




Examples


x = -0.7:  erf (N/A), CDF ≈ 0.2420


x = 0.7:  erf ≈ 0.6778, CDF ≈ 0.7580


x = 1:   erf ≈ 0.8427,  CDF ≈ 0.8413


x = 2.5  erf ≈ 0.9996,  CDF ≈ 0.9938



Eddie



All original content copyright, © 2011-2023.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Thursday, September 8, 2022

Casio fx-991EX Classwiz Tips: Normal Distribution

Casio fx-991EX Classwiz Tips:  Normal Distribution


This week I am going to show some things that can be done with the Casio fx-991EX Classwiz.  


The Normal Distribution 


The Classwiz's Distribution mode has calculations for the following probability distributions:


1.  Normal, f(x) = exp(-1/2 * ((x - μ) / σ)^2 ) / (σ * √(2 * π))

2.  Binomial

3.  Poisson


This is Mode 7.


Normal CD - Finding the Area


[ MENU ], 7: Distribution, 2: Normal CD


The CDF function calculates the area (probability) between two limits.   The lower and upper tail areas require the limits to be -∞ and +∞, respectively.  However, the Classwiz does not provide values for -∞ and +∞.  For the best estimate, I suggest using -7 and 7 are the limits.  The calculator calculates the probability from -7 to 7 to be 1.


Example:

(For all the examples, the standard values μ = 0, σ = 1)


Lower tail area to x = 3:  lower limit = -7, upper limit = 3; area:  0.9986501019


Lower limit = -2, upper limit = 2; area:  0.954499736


Upper tail from x = -1:  lower limit = 1, upper limit = 7; area:  0.1586552539


Inverse CD


[ MENU ], 7: Distribution, 3: Inverse Normal


This calculation gets the point value for a lower tail distribution (-∞ to x).


Example:

(For all the examples, the standard values μ = 0, σ = 1)


Area = 0.5; xInv:  0


Area = 0.6; xInv: 0.2533470931


Area = 0.7; xInv: 0.5244004382


Eddie


All original content copyright, © 2011-2022.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


HP 15C: The I Squared Rule and HHC 2026

HP 15C: The I Squared Rule and HHC 2026 HHC 2026 Videos Before we start, the videos for HHC 2026 are up! Please take a look, ev...