(35S) Statistical Distributions Functions
10-28-2015, 06:59 PM
Post: #28
 PedroLeiva Member Posts: 167 Joined: Jun 2014
RE: HP 35s Statistical Distributions Functions
(10-28-2015 12:34 PM)Dieter Wrote:
(10-28-2015 12:24 AM)PedroLeiva Wrote:  Dieter, the program works perfect!. Please include the function for the inverse, no mather how long it takes

OK, here is a first version with a rough initial guess. At the X=? prompt simply enter a negative value if you want to compute the quantile for that probabily. If you already have entered the previous C program, simply add lines C010 and C011 and continue with line C054.

Code:
C001  LBL C C002  INPUT J C003  e C004  IP C005  STO T C006  ÷ C007  ! C008  STO G C009  INPUT X C010  x<0? C011  GTO C054 C012  XEQ C015 C013  STOP C014  GTO C009 C015  RCL X C016  RCL÷ T C017  +/- C018  e^x C019  LASTx C020  +/- C021  RCL J C022  RCL÷ T C023  y^x C024  x C025  RCL÷ G C026  STO A C027  RCL J C028  STO B C029  SGN C030  ENTER C031  - C032  ENTER C033  ENTER C034  LASTx C035  RCLx X C036  RCL B C037  RCL+ T C038  STO B C039  ÷ C040  + C041  x≠y? C042  GTO C032 C043  RCL A C044  RCL X C045  x=0? C046  e^x C047  ÷ C048  RCLx J C049  RCL÷ T C050  x<>y C051  RCLx A C052  RCL+ A C053  RTN C054  +/- C055  STO P C056  RCLx J C057  RCL÷ T C058  RCLx G C059  RCL T C060  RCL÷ J C061  y^x C062  Pi C063  x C064  STO X C065  XEQ C015 C066  ENTER C067  RCL÷ P C068  LN C069  x C070  ENTER C071  ENTER C072  RCL J C073  RCL- X C074  RCL- T C075  RCL÷ X C076  RCL÷ T C077  RCL÷ T C078  x C079  R↑ C080  - C081  ÷ C082  RCL+ X C083  x<> X C084  RCL X C085  STOP C086  GTO C064

Usage: At the X=? prompt enter the negative probability for which you want the Chi² quantile. The program will then display two estimates in Y and X (the previous and the current), so that you can see the iteration converge. Pressing R/S yields the next approximation.

Code:
[XEQ] C [ENTER]             J=? Enter degrees of freedom     10  [R/S]               X=? Enter negative probability   -0,95 [R/S]               11,176989523                             15,310270784         [R/S]               15,310270784                             17,970799176         [R/S]               17,970799176                             18,305703292         [R/S]               18,305703292                             18,307038039

If 18,307 is sufficiently accurate you may stop here.
Otherwise continue:

Code:
        [R/S]               18,307038039                             18,307038054         [R/S]               18,307038054                             18,307038054

When the two approximations are displayed you may also enter your own guess before pressing R/S, and the approximation will continue with this value.

NB: This program is not very sophisticated, and it does not match what's inside the 34s. For instance, the latter evaluates CDFs for large x via P(x) = 1–Q(x), and also the quantile function has a much, much better initial guess. It took me quite a while to get the guess within <10% of the true value. ;-) For instance, the first guess for the case above is 18,2..., compared to the exact value 18,307...

Some time ago I wrote 35s/41C programs for the Normal distribution. They evaluate the PDF, one- and two-sided CDFs and also one- and two-sided quantiles with several tweaks to ensure best possible accuracy and efficiency. But these are about three times the size of the small Chi² progam posted above.

Dieter

Dieter, all perfect. I got the same figures as you!. I will prepare a PDF with programme keytroke sequence, test cases and instructions for in and output data
 « Next Oldest | Next Newest »

 Messages In This Thread (35S) Statistical Distributions Functions - PedroLeiva - 10-25-2015, 12:19 AM RE: HP 35s Statistical Distributions Functions - Thomas Klemm - 10-25-2015, 01:29 PM RE: HP 35s Statistical Distributions Functions - SlideRule - 10-26-2015, 03:03 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-26-2015, 04:41 PM RE: HP 35s Statistical Distributions Functions - Dieter - 10-26-2015, 08:30 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-26-2015, 10:29 PM RE: HP 35s Statistical Distributions Functions - Dieter - 10-26-2015, 11:04 PM RE: HP 35s Statistical Distributions Functions - Thomas Klemm - 10-26-2015, 08:39 PM RE: HP 35s Statistical Distributions Functions - Dieter - 10-26-2015, 09:25 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-27-2015, 02:29 PM RE: HP 35s Statistical Distributions Functions - Thomas Klemm - 10-26-2015, 09:28 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-27-2015, 11:59 AM RE: HP 35s Statistical Distributions Functions - Thomas Klemm - 10-27-2015, 04:48 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-27-2015, 05:22 PM RE: HP 35s Statistical Distributions Functions - Dieter - 10-27-2015, 07:32 PM RE: HP 35s Statistical Distributions Functions - Dieter - 10-27-2015, 10:25 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-28-2015, 12:24 AM RE: HP 35s Statistical Distributions Functions - Dieter - 10-28-2015, 12:34 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-28-2015 06:59 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-27-2015, 11:48 PM RE: HP 35s Statistical Distributions Functions - Thomas Klemm - 10-27-2015, 10:29 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-27-2015, 11:41 PM RE: HP 35s Statistical Distributions Functions - Thomas Klemm - 10-28-2015, 12:11 AM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-28-2015, 12:36 AM RE: HP 35s Statistical Distributions Functions - Thomas Klemm - 10-28-2015, 01:05 AM RE: HP 35s Statistical Distributions Functions - Dieter - 10-28-2015, 11:55 AM RE: HP 35s Statistical Distributions Functions - Thomas Klemm - 10-28-2015, 01:40 AM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-28-2015, 06:21 PM RE: HP 35s Statistical Distributions Functions - Dieter - 10-28-2015, 07:54 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-28-2015, 10:34 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-30-2015, 02:36 AM RE: HP 35s Statistical Distributions Functions - Dieter - 10-30-2015, 01:56 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-30-2015, 05:20 PM RE: HP 35s Statistical Distributions Functions - Dieter - 10-30-2015, 07:16 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-30-2015, 07:43 PM RE: HP 35s Statistical Distributions Functions - Dieter - 10-30-2015, 11:08 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-30-2015, 11:16 PM RE: HP 35s Statistical Distributions Functions - rprosperi - 10-31-2015, 09:11 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-28-2015, 10:45 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 10-29-2015, 12:09 AM RE: HP 35s Statistical Distributions Functions - Dieter - 10-29-2015, 07:01 AM RE: HP 35s Statistical Distributions Functions - Dieter - 10-29-2015, 07:18 AM RE: HP 35s Statistical Distributions Functions - Dieter - 10-29-2015, 11:56 PM RE: HP 35s Statistical Distributions Functions - Dieter - 10-31-2015, 09:05 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 11-01-2015, 12:44 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-01-2015, 09:17 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-05-2015, 01:37 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 11-05-2015, 02:16 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-13-2015, 06:59 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 11-13-2015, 08:04 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-13-2015, 09:05 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-14-2015, 11:22 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 11-15-2015, 03:04 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-15-2015, 09:26 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 11-16-2015, 01:13 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-16-2015, 07:08 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-16-2015, 10:47 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 11-17-2015, 12:44 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-17-2015, 09:20 PM RE: HP 35s Statistical Distributions Functions - Gerald H - 11-19-2015, 09:24 AM RE: HP 35s Statistical Distributions Functions - Dieter - 11-19-2015, 01:00 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 11-19-2015, 01:17 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-19-2015, 08:31 PM RE: HP 35s Statistical Distributions Functions - Gerald H - 11-19-2015, 05:52 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 11-20-2015, 12:09 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-20-2015, 01:19 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 11-20-2015, 05:45 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-20-2015, 08:30 PM RE: HP 35s Statistical Distributions Functions - Marcio - 11-20-2015, 08:37 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-20-2015, 08:54 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-20-2015, 11:06 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-21-2015, 07:27 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-20-2015, 05:47 PM RE: HP 35s Statistical Distributions Functions - Marcio - 11-20-2015, 12:24 PM RE: HP 35s Statistical Distributions Functions - PedroLeiva - 11-26-2015, 11:07 PM RE: HP 35s Statistical Distributions Functions - Dieter - 11-27-2015, 06:41 AM RE: HP 35s Statistical Distributions Functions - Dieter - 11-29-2015, 06:50 PM

User(s) browsing this thread: 1 Guest(s)