John,

I stand corrected.  I really guess I misunderstood what Mark wanted.

I now realize he is an experienced programmer.  I'm sure that the correct 
BASIC routines can be found in a number of books on programming.  It seems to 
me I remember that Apple produced a book quite some time ago and it had in it 
the method of determining the probability of a Z value.

I looked back at some programming I did quite a while back and came up with 
the following code.  I hop that Mark can use it.  I know it works in my 
software but it is only one of about six or seven things the user might want 
to know when dealing with Z values.

Depending on the actual basic language that is used (GWBASIC, QUICKBasic, 
TurboBasic) this routine should find the probability of a given Z value to at 
least the fourth decimal place.

Of course Mark could scan a copy of the Z table and then put it into a Word 
document and load that onto the PalmPilot.  That way he could quickly refer 
to the table at any time.

I assume Mark can write the code for entering the values.

Here is the code, I hope it helps.

ZOnly:
  Mean=0
  St.Dev=1
  PROMPT$=" Enter the Z value to compare to the MEAN    "
  X$="C"
  PROMPT$=PROMPT$+PAD$ : PROMPT$=LEFT$(PROMPT$,57)
  print PROMPT$;
  input " ",X$
  if X$="" OR X$=" " then X$="0"
  IF X$="-" OR ASC(X$)<45 OR ASC(X$)>57 THEN
    beep
    print
    print " Improper entry.  Please try again."
    print
    goto GeneralMenu
  END IF
  XX=VAL(X$)
  Y=XX : Y=ABS(Y)
  
  IF Y=0 THEN
    beep : print
    print "  Your entered value must not be zero.  Please try again."
    print
    input "  Depress <Enter> to continue ",rck$
    goto GeneralMenu:
  END IF

  Y=ABS((Y-Mean)/St.Dev)
  StandDevAway=Y
  R=EXP(-(Y^2)/2)/2.5066282746
  goto DoCalc

ZRawData:
  print
  PROMPT$=" Enter the POPULATION MEAN value           "
  X$="C"
  PROMPT$=PROMPT$+PAD$ : PROMPT$=LEFT$(PROMPT$,57)
  print PROMPT$;
  input " ",X$
  if X$="" OR X$=" " then X$="0"
  IF X$="-" OR ASC(X$)<45 OR ASC(X$)>57 THEN
    beep
    print
    print " Improper entry.  Please try again."
    print
    goto GeneralMenu
  END IF
  XX=VAL(X$)
  Mean=XX

  St.Dev=-1
  WHILE St.Dev<=0
    PROMPT$=" Enter the POPULATION STANDARD DEVIATION   "
    X$="C"
    PROMPT$=PROMPT$+PAD$ : PROMPT$=LEFT$(PROMPT$,57)
    print PROMPT$;
    input " ",X$
    if VAL(X$)=-999 then goto OnToMenu
    if X$="" or X$=" " then X$="0"
    if X$="-" then X$="0"
    if ASC(X$)<45 or ASC(X$)>57 then X$="0"
    XX=VAL(X$)
    IF XX<=0 THEN
      beep
      print
      print " The Standard Deviation must be a positive number."
      input " Please try again.  Depress <Enter> to continue ",rck$
    END IF
    St.Dev=XX
  WEND
AskStxx:
  St.Dev=St.Dev/(SQR(SSize))
  print
  print "  Remember if you are comparing a value to the Mean you may want"
  print " to enter lower class limit of that value.  For instance, if you"
  print " are interested in a value of 13 you might want to enter 12.5."
  print
  PROMPT$=" Enter the value to compare to the MEAN    "
  X$="C"
  PROMPT$=PROMPT$+PAD$ : PROMPT$=LEFT$(PROMPT$,57)
  print PROMPT$;
  input " ",X$
  if VAL(X$)=-999 then goto OnToMenu
  if X$="" or X$=" " then X$=STR$(Mean)
  if ASC(X$)<45 or ASC(X$)>57 then X$=STR$(Mean)
  XX=VAL(X$)
  Y=XX ': Y=ABS(Y)
  IF Y=Mean THEN
    beep : print
    print "  Your entered a value that is equal to the Mean.  This results"
    print " in a Z value of 0.
    goto DoneShowing
  END IF
  Interest=Y
  Y=ABS((Y-Mean)/St.Dev)
  Top=Interest-Mean
  StandDevAway=Y
  R=EXP(-(StandDevAway^2)/2)/2.5066282746

DoCalc:
  cls : locate 4,1

  if Top<0 then
    StandDevAway=StandDevAway*(-1)
    if SSize=1 then
        kk=abs(Top)
        print " The score entered is ";
        print using fnform$(kk);abs(Top);
        print " less than the Mean."
    end if
  end if

  print " For a Z value of "; : print using FORM14$;StandDevAway
  print
  print " (y Ordinate at Z) FREQUENCY          = ";
  print using FORM14$; R
  Z=Y
  Y=1/(1+.33267*ABS(Y))
  T=1-R*(.4361836*Y-.1201676*Y^2+.937298*Y^3)
  if Z<0 then T=1-T
  print
  print " (Area in Larger Portion) PROBABILITY = ";

  print using FORM14$; T
  print " (Area in Smaller Portion  one-tail   = ";
  print using FORM14$; 1-T
  print " (Area from Z to Mean      one-tail   = ";
  print using FORM14$; .5-(1-T)

  print " (Area in Smaller Portions two-tail   = ";
  print using FORM14$; (1-T)*2
  print
 
DoneShowing:


Seems as though this is like re-inventing the wheel and I'm not sure if he 
helps to understand Z values or probability.

GOD BLESS AMERICA

Dr. Robert C. Knodt
4949 Samish Way, #31
Bellingham, WA 98226
[EMAIL PROTECTED]

"The vocation of every man and woman is to serve other people." -- Tolstoy


=================================================================
Instructions for joining and leaving this list and remarks about
the problem of INAPPROPRIATE MESSAGES are available at
                  http://jse.stat.ncsu.edu/
=================================================================

Reply via email to