HP-19C & 29C Solutions Statistics 1977 B&W

download HP-19C & 29C Solutions Statistics 1977 B&W

of 41

Transcript of HP-19C & 29C Solutions Statistics 1977 B&W

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    1/41

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    2/41

    INTRODUCTION

    This HP-19C/HP-29C Solutions book was written to help you get the most from your calculator.The programs were chosen to provide useful calculations for many of the common problemsencountered.They will provide you with immediate capabilities in your everyday calculations and you willfind them useful as guides to programming techniques for writing your own customized software.The comments on each program listing describe the approach used to reach the solution andhelp you follow the programmer's logic as you become an expert on your HP calculator.You will find general information on how to key in and run programs under "A Word about ProgramUsage" in the Applications book you received with your calculator.We hope that this Solutions book will be a valuable tool in your work and would appreciate yourcomments about it.

    The program material contained herein is supplied without representation or warranty of any kind.Hewlett-Packard Company therefore assumes no responsibility and shall have no liability,consequential or otherwise, of any kind arising from the use of this program material or any partthereof.

    HEWLETTPACKARD COMPANY 1977

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    3/41

    TABLE OF CONTENTS

    1. ARITHMETIC J GEOMETRIC J HARMONIC J AND GENERALIZED MEANS This program calculates the arithmetic, geometric, harmonic, andgeneralized means given a se t of numbers.2. BASIC STATISTICS (TWO VARIABLES) .

    I This program calculates the means, standard deviations, covariance, andcorrelation coefficient given a se t of number pairs.

    1

    4

    3. ANALYSIS OF VARIANCE (ONE WAY) . 7This program performs a one way analysis of variance (ANOVA) for ktreatment groups containing an equal or unequal number of observations.4. CHI-SQUARE DISTRIBUTION . . . . . . . . . . . . . . . . 11This program evaluates the chi-square density function and the cumulativedistribution for given values of x with v degrees of freedom.5. t-DISTRIBUTION . 14This program evaluates the integral of the t-distribution with v degreesof freedom for given values of x.6. F-DISTRIBUTION " 17This program evaluates the integral of the F-distribution with degrees offreedom VI, V2 for given values of x.7. POISSON DISTRIBUTION . 20This program evaluates the Poisson density function and cumulative distribution for given values of x (positive integers) with mean = variance = A.8. PARABOLIC CURVE FIT I This program fits a parabola to a set of number pairs such that the sum ofthe squares of the errors is minimized. 239. PAIRED t-STATISTIC . . 26This program calculates the test statistic, t , and the number of degreesof freedom given a set of paired observations from two normal populationswith unknown means.10. t-STATISTIC FOR TWO MEANS I I I I I This program calculates the test statistic, t , and the number of degreesof freedom given two independent sets of observations from two normal

    populations having unknown means and the same unknown variance, and givenHO:lJI - lJ2 =D.11. CHI-SQUARE EVALUATION I I I I I IThis program calculates x2 given a set of paired observed and expectedfrequencies or if the expected values are equal, just the set of observedfrequencies.12. 2 X K CONTINGENCY TABLE This program calculates X2 , the number of degrees of freedom, andPearson's coefficient of contingency given a 2 x k contingency table.

    I

    29

    32

    35

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    4/41

    A R I T H M E T I C ~ G E O M E T R I C ~ HARMONICAND GENERALIZED MEANS

    Arithmeti c meanA= al +

    n

    Geometric mean

    Harmonic meanH=

    Generalized mean

    + an

    n

    NOTES: 1. ak>O, k= 1, 2, .. , n2. M(l )=A

    M (-l)=H

    EXAMPLES:Find A, G, H &M (1) for the se t ofnumbers

    {2, 3.4, 3.41, 7, 11, 23}

    SOLUTION: GSBl1.88 ST092.88 (;SB23.48 GSB23.41 GSB27.88 GSB211.88 GSB223.88 GSB2GSB38.38 *uR/S

    4.48 .UR/S5.87 u*R.'S8.38 f t .

    1

    AHGM(t)

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    5/41

    2 User InstructionsINSTRUCTIONS INPUT KEYS OUTPUTSTEP DATA/UNITS DATA/UNITS

    1 Key in the program I 102 Initialize ~ [ I J 1.003 If M(t) is desired t QJCO t4 Perform step 4 for k = 1, 2, . . . n ak ~ I 2 I ak5 Compute A IGSB II 3 I A6 Compute H [BLUO H7 Compute G IR/S ILJ G8 Compute M(t) I /S II I M(t)

    ~ 0 0I II I0 00 1 I0 1 I

    L ~ I I0 00 1 I0 00 1 I0 01 II I0 0

    f - - - - ~ - _. 1 II I0 0C ~ O- - - - ~ -- LJO --1-------- 1---- L ~ I I1 11 1

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    6/41

    ProgralD Listings 3el ~ : L P L 182 [LPG initial izeeJ84 STfJ2es R.'S136 ~ : L P L 287 STx288 1/?139 LSr?18 1+11 , C:T12 LSTX13 PCL914 }Ix1S ST+S16 PJ17 p ..s18 tLBLJ19 x28 PS ***A21 IN.... 1/,\'2? R. .S ***H24 RCL225 PC.S26 1 Vi,27 ~ 1 ) r28 p .s ***G29 RCL838 pC.e"'1" PCL9. L.7"'1 l . X. ",,'34 \/X35 p.S ***M(t)

    ***"Printx" may replace "R/S" ,

    REGISTERS0 2 'ITa 3 4 56 7 8 La t 9 t .0 .1n La.2 .3 l/a .4 .5 16 17L18 19 20 21 22 2324 25 26 27 28 29

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    7/41

    4

    BASIC STATISTICS (TWO VARIABLES)

    This program calculates means, standarddeviations, covariance and correlationcoefficient derived from a set of datapoints{(x., y. ) , i=l, 2, . . . , n}, ,

    means

    standard deviations=j l: x. 2 - nXLs = ,x ----n - 1

    _ 1 ny = - L y.n . 1 '=

    (or ax = - ,= - - - - x nj ~ X . 2 - nx 2 = s J n - l )ns =y n -

    (or a =jl:Y. 2 - ny2y = ,- ~ n - -covariance

    s jn-l )y nsxy= n 1 (l: xiYi - ~ l: x l: Yi )

    (or s 1 [l: x.y. - 1 l: X.l: YJy n ' ,n , ,correlation coefficient~ ~rXY= s sx y axayNOTE: n is a positive integer and

    n> 1.

    EXAMPLE:x. 26 30 44 50 62 68 74,y. 92 85 78 81 54 51 40,SOLUTION:

    I;SBl92.88 ENH26.88 I+85.68 EUHJ8.e8 I+78.813 ENTt44.88 I+81.88 ENTt58.88 1+54.88 EflTt62.88 I+51.813 ENTt68.88 I+48.88 ENTt74.88 I+

    p. . S58.57 ***'/S68.71 ***/S18.58 t t l .R/S28.ee t.u

    . C'0" "_,-354.14 ***( . S-8.96 HII;S82f., 1"l'.i.l .... ",' ..,....

    P."'-S18.51 HI/.'R. .S

    - J 8 J . 5 ~ .:!f:J#:R. .S-8.96 .. **

    xYsxsysxyrxyaXaySxyr xy

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    8/41

    5User InstruetionsINPUT KEYS OUTPUTSTEP INSTRUCTIONS DATA/UNITS DATA/UNITS

    l . Key in the program I 102. Initialize ~ L L J3. Perform steps 3-4 for i-l,2, . . . n Yi IENTtIO4. xi ~ I 1

    (correct erroneous data) Yk I ENTt II 1xk wCU

    5. Calculate means: I R/S II I -xI P.LS II I y6a. Calculate sample standard deviations: [MJO SI R/S II I Sv7a. Calculate sample covarience I RLS 10 S "'J8a. Calculate correlation coefficient I RLS 10 rV\lAND OR: GiJ[LJ 'J6b. Calculate populations standard deviations: cry

    L ~ I I crv7b. Calculate population covarience ~ O Sxy8b. Calculate correlation coefficient ~ L ~ rxy0 0

    I I L ~0 0I II 1O L ~D L ~ - - ~ - ~ - -[ = ~ [ = ~ f - - ~ - - - - - - - - - -

    - - [ = ~ [ = = J ------f------ f----- ----- - - - ~ - - - - --------- --------- 1----- - - - - L ~ [ = - J f---------- - - - - 1-- - - - - - - - - - - - - - - - - - - - ----- ---------- - - - - - - -- ------ 1--------- [ ~ ~ ~ L = J I - - ~ - - - ----r---l r---l

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    9/41

    6 PrograDl Listings81 tLBLl Initialize82 CL!83 R.'S84 RC.e8S f..86 - n-l87 ST!)l88 RC.138918 [1:11 ST0212 x13 R,'S *** -x14 \;..v11..-'IS R.'S *** Y16 S17 R.. S *** Sx18 x:v19 R.'S *** Sy21321 tLBL822 RC.523 RC.!24 RC.J25 x26 RC.82728 -29 RCU n-l or n38::'1 R..rS *** Sxy or Sxy I32 Xty SxSy or oxoyJJ34 R."S ** rxy3S tLBL236 SJ7 RCL238 x ** "Printx" may b inserted before "R S".39 R.'S ***ox *** "Printx" may inserted48 y ..... before or in p ace of "RIS".I+-.41 RCL242 x43 R.'S ***0Y44 ..4S RC.e46 STOI xOy4" N148 GTOB

    0 1 n-l 2 ~ REGISTERS-n- 3 4 56 7 8 9 .0 n .1 l:x.2 l:x 2 .3 l:y .4 l:y2 .5 l:xy 16 1718 19 20 21 22 2324 25 26 27 28 29

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    10/41

    7

    ANALYSIS OF VARIANCE (ONE WAY)

    The one-way analysis of variance teststhe differences between the populationmeans of k treatment groups. Group i(i= 1, 2, . . . , k) has ni observations(treatment group may have equal or unequal number of observations).sum i = sum of observations in treat-ment group in.1L: x.j=l 1J

    Total SS=

    Treat SS=

    k niL: L:i =1 j=l

    k

    X 2 -1J

    X ) 21J

    L: n.1i=l

    n.1k (L: x . )j=l 1JL: n.i=l 1k n.1(L: L: x . )i=l j=l 1J

    kL: n.i=l 1

    Error SS = Total SS - Treat SSdf 1 = Treat df = k-l

    kdf 2 = Error df = L: ni - ki=lTreat SSTreat MS = Treat df

    Error MS = Error SSError dfF = Treat MS (with k - 1 and

    Error MSkL: n. - k degrees of freedom). 1 11=Total SS, Treat SS, Error SS are inregisters R1 , R2 , R3

    REFERENCE: Mathematical Statistics,J.E. Freund, Prentice Hall, 1962

    EXAMPLE:j 2 3 4 5 6

    10 8 5 12 14 11Treatment 2 698 13

    3 14 13 10 17 16

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    11/41

    8SOLUTION:

    18.88 1+8.88 1+5.88 1+12.88 1+14.88 1+11.88 1+

    t;SBl68.88***

    Suml6.88 !+9.88 1+8.88 1+13.88 1+I;S8136.88***

    Sum214.88 1+13.88 1+18.88 1+17.88 1+16.88 1+

    t;S8178.88 Ut Sum3P/S2.88***

    dflp/S2.88 t** df2

    Po'S7 "Q",'. i ... t** F

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    12/41

    User Instruetions 9INSTRUCTIONS INPUT KEYS OUTPUTSTEP DATA/UNITS DATA/UNITS

    1 Key in the program 0 02 Initialize [ I J ~3 Perform 3-5 for i= 1, 2, k 0 04 Perform 4 for j= 1, 2, . . . n; X;; ~ O j'v(correct erroneous data, Xim X;m I f II E- I5 Calculate Sum ~ ~ Sum;6 Calculate Treat df IRIS 1 0 df,7 Calculate Error df IRIS II I df?8 Calculate F LBLLJO F9 (optional) Total SS IRCL II 1 I Total SS10 (optional) Treat SS WG] Treat SS11 (optional) Error SS wCL ] Error SS12 For a new case, go to step 2 0 0I II I0 0

    0 1 I0 00 1 I0 00 00 0I II I0 0C ~ O0 0L ~ L ~1 11 1

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    13/41

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    14/41

    11

    CHI-SQUARE DISTRIBUTION

    This program evaluates the chi-squaredensityv X-1 -"2""f(x)= --- X2 evi2r

    where x ~ 0v is the degrees of freedom.fIx)

    o xSeries approximation is used to evaluatethe cumulative distributionP(x)= fX f(t) dto

    . . . 1+ f xkk-lt -- (V+2l(V+4l ... (V+2klJThe program computes successive partialsums of the above series. When twoconsecutive partial sums are equal, thevalue is used as the sum of the series.

    If v is even,

    If v is odd,r = ( ~ - l ) ( f -2) . . . ~ ) r ( ~ )

    1r ("2) = ; ;

    REFERENCE: Handbook of MathematicalFunctions. Abramowitz and Stegun,National Bureau of Standards, 1968NOTES: 1. Program requires v ~ 1 4 1 .

    2. If both x and v are large,f(x) may overflow the machine.EXAMPLES:1. v= 20,

    x= 9.591;x= 15.

    SOLUTION:28.80 ENH9.591 GS81

    8.82 *** f(x)R.'S8.83 *** P(x)15.88 ST02

    GS828.86 *** f(x)p..'s13.22 u* P(x)

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    15/41

    12EXAMPLE:2. v= 3,

    x= 7.82.

    SOLUTION:J. 00 E N T ' ~7.82 fSBl8. 02 *11:* f (x )

    R.S8.95 lH ' p(x)

    User InstructionsSTEP INSTRUCTIONS INPUT KEYSDATA/UNITS

    1 Key in the program DD2 Enter degrees of freedom v IENTt ID3 Enter x x DD4 Compute f(x) ~ u = J5 Compute P(x) IRIS II I6 For a different x: x ~ [ L J7 Calculate f(x) and go to step 5 IGSB I L L J8 For a new case, go to step 2 I II I

    DDI II IDDDDDDL ~ I IDDDDDDD L ~DDLJI I

    L __ - - L ~ L ~

    OUTPUTDATA/UNITS

    f(x)P(x)

    f(x)

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    16/41

    PrograDl Listings 1381 ~ : L 8 L 1 4882 ST02 x 49 CHSB3 PJ 58 eY.84 1 r ,,.; 1 x135 STOJ 52 286 Voot",.'i i

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    17/41

    14

    t-DISTRIBUTION

    This program evaluates the integralfor t distribution

    v+lx r ( ~ ) ( H ~ ) - -2 -I(x,v) = v dy-x vrn r(2")

    where x>O.v is the degrees of freedom.

    EQUATIONS:(1) v even

    ( ) {l 1 2 13 IJ1 x,v =sinS ~ cos S+2.4 cos e+ . . .+ 135 . . . (v-3) v- 2 .l2.4.6 . . . (v_2)cOS SJ

    (2) v odd

    - 1 v=7f

    {2S of 1

    I(x,v)= 22: + TI coss{sine[l + ~ C O S 2 S + . . .+ 24 . . . (v-3) COSV- 3 S]}if v>l13 . . . (v-2)-1 ( X )where e = tan Tv

    REFERENCE: Handbook of MathematicalFunctions, Abramowitz andStegun, National Bureauof Standards, 1968.EXAMPLE:

    1(2.201,11)1(2.75,30)

    SOLUTIONS:2.281 EHTt11. 88 (;5818.95 Ut 1(2.201,11)2.75 EHH38.88 t;S818.99 t.H: 1(2.75,30)

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    18/41

    15User InstructionsINPUT KEYS OUTPUTSTEP INSTRUCTIONS DATA/UNITS DATA/UNITS

    l . Key in the program 0 1 I2. Enter x x IENT t lO3. Enter degrees of freedom v 0 04. Calculate I(x,v) ~ I T J I(x,v)

    I II I0 0I II II II I00I II I0 00 1 I0 0I II I0 00 1 I0 0I II I0 00 1 I0 0I II I0 00 00 0

    L ~ I II II I

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    19/41

    16 PrograDl Listings81 fLBU 4882 S1O! 49 ST+683 RAP 58 DSZ84 IX 51 (;1078S 52 RCL686 TAH-I S3 RCL487 5102 e 54 x88 RCLl 55 RTH89 2 56 fLBL818 57 RCL211 IHT 58 ...12 LSTX 59 x13 xn? v even or odd? 68 Pi14 (;T08 odd 6115 8 62 STO? 2e/rr16 STOS 63 RCLl17 (;SB9 64 118 R/S '** I(x,v) 65 STOS19 fLBL9 66 ST-l28 RCL2 67 x=y" 1?=21 COS 68 (;T0622 x'Z 69 GSB92J ST03 cos 2 e 78 RCL224 RCL2 71 COS25 SIH 72 x26 ST04 sine TJ 227 RCLl 74 x28 2 75 Pi29 x=y? v=2? 7638 GTOB ?7 RCL?31 78 +32 1 7Q R/S I(x,v)_' **33 - 88 fLBL834 STfJ8 i=INT (I - 1) 81 RCL435 1 82 R/S ** I(x,v)36 ST06 83 *LBL63? fLBL? 84 RCL?38 RCL3' 8S R/S ** I(x,v)39 x48 RCL541 142 +43 x44 LST>? Rs + 1 ** "Printx" may before"45 1 pe inserted /S".46 +47 STaS

    REGISTERS0 i 1 V or v-l 2 e 3 cos 2 e 4 sine 5 Used6 Used 7 2e/rr 8 9 ,0 .1.2 .3 .4 .5 16 1718 19 20 21 22 2324 25 26 27 28 29

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    20/41

    F DISTRIBUTION

    This program evaluates the integral ofthe F distribution

    for given values of x(>O), degrees offreedom vI'v2, provided either vI or v2is even.

    The integral is evaluated by means ofthe following series:( 1 ) v I even

    (2) V2 evenQ(x)= 1- ( l - t )?- ~ + t+

    VI(vI+2) . . . (v2+vl-4)+ ~ ~ - - ~ ~ ~ ~ ~2'4 . . . (V2-2)

    where t= v2

    EXAMPLE:

    1. vI=7, v2=6, x=4.21SOLUTION:

    EXAMPLE:

    4.21 fliTt7.88 fNTt6.88 I;SBl8.85 u* Q(4.21)

    2. vI=4, v2=20, x=2.25

    SOLUTION:2.25 fNTt4.88 fliTt28.88 ~ S B l8.1e *** Q(2.25)

    17

    ~ 2 J

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    21/41

    18

    STEP

    12345

    User InstructionsINPUT KEYSNSTRUCTIONS DATA/UNITS

    Key in the program 0 0Enter x x IENIt 10Enter v I VI IENIt 10Enter v2 v2 0 1 1Calculate Q (x) 1SB 1 1 11 01 1 11 1 I

    0 01 /I 10 00 1 10 0I II I0 00 1 10 0O L ~0 01 /I I0 01 /I IC ~ O0 0C ~ O

    L ~ I 1I " I

    OUTPUTDATA/UNITS

    Q(x)

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    22/41

    PrograDl Listings 1981 tLBL1 48 ,LBL782 ENTt 49 283 RJ. 58 ST+284 5T02 v2 51 ST+785 RJ. 52 RJ.86 5T01 VI 53 RCL287 x 54 RCL788 + S5 -89 56 RCL318 ST03 t 57 .l(11 RCLt 58 x12 2 59 ST+513 68 DSZ14 FRC 61 GTD715 Xl8'? vI even or odd? 62 ,lBL616 bTD9 VI odd 63 RCl517 bSB8 VI even 64 RCL418 R/S **Q(x) 65 x19 ,lBL8 66 RTH28 RCLJ 67 tlBL9 V2 even21 RCl2 68 RCL122 2 69 RCL223 5T07 78 ST0124 - 71 Xty25 yx 72 STD226 ST04 73 127 PCL1 74 RCn28 ., 75 - 1-t'-29 - 76 ST0338 2 77 GSB831 78 132 ST08 - vx-2 79 XtY1= --33 X=8'? 2 88 -34 (;TOB 81 R..S **Q(x)35 1 82 ,lElS36 ST05 83 RCL437 RCL3 84 R/S **Q(x)3S -39 5T03 1-t (or t)48 RCL241 24243 x **"Printx" may be inserted before "R/ "44 ST+545 DSZ46 GTO?47 bro6

    REGISTERS t? -0 i 1 V, or V? 2 V2 or VI 3 t , 1-t 4 or 5 used6 7 used 8 9 (l-t)?- .1.2 .3 .4 .5 16 1718 19 20 21 22 2324 25 26 27 28 29

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    23/41

    20

    POISSON DISTRIBUTION

    This program evaluates f(x) and P(x)fo r a given A using the recursiverelationAf(x+1) = ---::-- f(x)x+l

    Density functionf(x) =

    Cumulative distributionx

    P(x)= L: f(k)k=O

    wheremean = variance = AA is positive

    andx is a positive integer

    EXAMPLE:A = 3.2, x = 7

    SOLUTION:

    3.28 I;S817.88 R.'S8.83 *** f(7)

    R/S8.98 ut. P(7)

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    24/41

    User Instructions 21INPUT KEYS OUTPUTSTEP INSTRUCTIONS DATA/UNITS DATA/UNITS

    1 Key in the program DD~ u = J

    t(U)=PlU)=2 Enter A A .04f - - - - - - - - - ' - - - - -3 Enter x x DD4 Calculate f{x) ~ D f{x)5 Calculate P{x) IR/S II I P{x)6 For a new x, go to step 3 DDI IDI II I

    DDI II IDDI IDDD

    L ~ I IDD

    D L ~DDD L ~DDI II IL ~ [ ~ -------C = . J L ~ ------

    -- [ = ~ [ ~ - - - - - - - - - ---------------- [ - - ~ [---]~ - ---- ------

    I - - - - - - - - - - - --------- --- -------- L = ~ [ ~ = = J ------- ------1------ f - - - - - - - - - - - - - - - - - - ----------- -- ----- - - - - - - - - - - - - - - - - -

    [--] [--]--- -- ----- ----- - - - -- - --1----] r----]

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    25/41

    22 PrograDl Listings81 tLBLt82 STOI A83 CHS84 eX8S ST0286 R . ~ S f(O)87 STOS x88 889 STa818 RCL211 ST0312 ST0413 tLBLI314 RCLt15 ISZ16 RCL817 -18 RCL319 x28 5T0321 ST+422 RCL823 ReLS24 '!.n'?25 GT0826 RCL:?27 R/S ***f(x)28 129 RCL438 x . > ~ ' ?31 ' ! . : ~ }32 R/S ***P(x)

    ***"Printx" may be inserted before orin place of "Ri S".REGISTERS

    0 i 1 A 2 f(O) 3 f(x) 4 P(x) 5 X6 7 8 9 .0 .1.2 .3 .4 .5 16 1718 19 20 21 22 2324 25 26 27 28 29

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    26/41

    PARABOLIC CURVE FIT

    For a set of data points {(xi'Yi)' i =1,2, .. ,n! this program fits a parabola

    Y = azx z + al x + aowith the sum of the squares of theerrors minimized.EQUATIONS: The normal equations are

    ~ x z Y = z ~ x 4 + alEx 3 + aoExzExy = azEx 3 + alEx z + aoExEy = azExz + alEx + aon,where the summations are from 1 to n.

    NOTE: If Ex 3 = 0, an error will occur.- - Replace it with 10- 49 REFERENCE: "Applications Programs,Volume 1, I Adams, Ed. Int 11.Software Clearinghouse,Estacada, Oregon 1976.pp. 15-18.EXAMPLE:Xi I 0 1 1.5 3 5-5 -24.5 -80Ex. 3 = 156.38, EXiYi = -479.00,

    EX.Zy., , = -2229.75EX.4, = 712.06, n = 5.00, EX/ = 37.25Ex. = 10.50, EYi = -105.40

    SOLUTION:

    23

    CLRG2.18 EHTt8.88 GS81

    28.88 EHTt1.88 GS8128.88 EHTt Correct erroneous1.88 (;584 da ta2.88 EHTt1.88 GS81

    -5.88 EHTt1.58 (;S81-24.58 EHTt3.B8 GSBI

    -88.88 EHTt5.88 GSBI

    GSB2-3.66 *uR/S1.85 ***IUSa2al

    2.28 u* ao4.88 GSB3A

    -48.83 U I Y

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    27/41

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    28/41

    ProgralD Listings 25fLBU 58 RCL881 x Y 51 ST-782 1+ 52 RC.583 LSTX 53 ST-984 LSTX 54 fLBU85 3 X3 55 RCL?86 yx

    56 SH987 ST+8 57 RCL988 x 58 RCL889 ST+7 X4 59 x18 IX 68 S-.5If. x 61 RCL912 5T+9 x2y ..t>.!: R/S *** a213 RC.8 n 63 RCL614 R/S 64 x15 fLBL2 Solve 3 simultan- 65 S-.316 RCL8 eous equations 66 RC.517 RC.2 67 R/S *** al18 ST06 68 RC.119 ST-:-7 69 x78 S-.328 SH9 71 RC.321 72 R/S *** ao22 RC.1 73 fLBL323 5-:-.2 74 EHTt x24 ST.;8 75 X225 5.;.5 76 RCL926 RC.B 77 x27 c 78 )i"V"":" .L __ .... pi28 ST.;6 7(/1_ RC.529 S';.3 88 x38 IU- 81 +31 Ri 82 RC.3'32 RC.1 83 + '"JJ S-.2 84 R/S Ymanual "Printx" optional34 - 85 fLBL4 Correction routine- 86 ! - ..36 RCL6 87 LSTX-':7 ST-7 88 LSTX38 ST-8 89 339 RC.3 98 yx48 ST-9 91 ST-841 S-.5 92 x42 RC.2 93 ST-743 SHB 94 oj ..44 S.;.5 95 x45 LSTX 96 ST-9(/ 7 RC.846 X=8? .147 GT08 98 R.-S n48 ST-:-?49 ST.;9 *** "Printx" may replace "RIS".

    REGISTERS0 1 2 3 4 56 Used 7 LX 4 8 LX 3 9 Lx 2y,a2 .0 n .1 LX.2 LX 2 .3 LY,ao .4 Used .5 Lxy,al 16 1718 19 20 21 22 2324 25 26 27 28 29

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    29/41

    26

    PAIRED t-STATISTIC

    Given a set of paired observations fromtwo normal populations with means(unknown)

    Yilet

    X2

    i = xi - Yi1 nIT = n.L 0i1=1LO. 2 _ 1 {LO.)21 n 1n-l

    The test statistic

    t = owhich has n-l degrees of freedom (df) ccan be used to test the null hypothesis

    Ho: =1 2REFERENCE: Statistics in Research,B. Ostle, Iowa StateUniversity Press, 1963

    EXAMPLE:

    x.1y.1

    SOLUTION:

    14 17.5 17 17.5 15.417 20.7 21.6 20.9 17.2

    eLI14.88 ENTt17.88 bSBl17.58 ENTt28.78 bSBl17.88 E!-ITt21.68 bSBl17.58 ENTt28.98 bSB115.48 ENTt17.28 GSBl

    GSB2-3.28 ftt ITR/S1.88 U t SoR. .S-7.16 ttl;: tR..S4.88 ft t df

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    30/41

    STEP

    l .2.3.4.

    5.

    --

    f------

    User InstructionsINSTRUCTIONS INPUT KEYSDATA/UNITS

    Key in the program DDInitialize ~ [ DPerform 3-4 for i - 1,2, . . . ,n xi IENTtlD

    Yi ~ I 1 I(correct erroneous data) xk I ENTt II I

    Yk ~ [ 2 JCompute statistics: IGSB II 2 IIR/S II I

    ~ DIR/S II IDDDDDDI II IDDL ~ DDDD L ~DDDI I

    L = ~ L ~C ~ C JL = = J L = ~

    - - - - - - - - L==J [ ~ ~ ~ = J-- ------------_ .- -- - -------- [--] 1---]- - - - - - -- - - - -- -

    f------------------------ --- -------- -- - ------- - - - - - - - - -- - [- - -- - ] [---- ]- - -- - - - - ._._---I ----1 [----1

    27

    OUTPUTDATA/UNITS

    i

    -DSot

    df

    - -

    ----------------

    ------------ - - - - - - - -

    ------- -- ----------"-- -- -

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    31/41

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    32/41

    t-STATISTIC FOR TWO MEANS

    Suppose Xl, X2, . xnl andYl, Y2, .. , Yn2 are independentrandom samples from two normal populations having means ~ 1 , ~ 2 (unknown) andthe same unknown variance 0 2We want to test the null hypothesis

    Ho: - = DDefine

    EXAMPLE:x: 79,

    122,y: 91,

    100,n1 = 8n2 = 10

    84, 108, 114,120

    103, 90, 113,80, 99, 54

    D = O{i.e.,H o: = Jl2)

    t = x- Y - D~ I + I~ n2

    1

    * ...

    / 2 -2 2 -2EXi -nIX +EYi -n2ynl+n2-2We can use this t statistic which hasthe t distribution with nl + n2 -2degrees of freedom (df) to test thenull hypothesis Ho.REFERENCE: Statistical Theory andMethodology in Science andEngineering,K.A. Brownlee,John Wiley &Sons, 1965.

    SOLUTION:CLRb79.88 1+84.88 1+188.88 1+114.88 1+128.88 1+183.88 1+122.88 1+128.88 1+bS8191.88 1+183.88 !+98.88 1+

    113. ee 1+188.88 1+87.88 1+188.88 1+88.88 1+99.88 1+54.88 1+(;58216.88 u* df8.88 R/S D1.73 u* t

    29

    120, 103,

    108, 87,

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    33/41

    30 User InstructionsSTEP INSTRUCTIONS INPUT KEYS OUTPUTDATA/UNITS DATA/UNITS

    1. Key in the program DD2. Initialize ~ ~3. Perform 3 for i = 1, 2, ... nl xi 0D i

    (correct erroneous data) xk ~ C 84. Reinitialize GSB II 1 I5. Perform 5 for i - 1, 2, ... n2 Yj I+ ID i

    (correct erroneous data) Yh f II I - I6. Calculate statistics: II I6a. Degrees of freedom ~ [ I J df6b. Enter D and calculate t statistic D 1 R/S II I t7. For a different D D ~ [ i ] t

    DI IDDI II II IDDI IDDD L ~DD1 II IDDI II IC ~ D

    - DDDD--- I - - - L ~ I II II I

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    34/41

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    35/41

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    36/41

    EXAMPLE:2. The following table shows theobserved frequencies in tossing a die120 times. X2 can be used to test ifthe die is fair.Note: Assume that the expected fre-quencies are equal.number 2 3 4 5 6frequency O. 25 17 15 23 24 161

    SOLUTION:CLRt;25.88 G5Bl17.8e (;5B115.88 t;5Bl

    23.88 (;58124.88 (;SBIIf.B8 (;SBl

    33

    9.88 (;SBl Correct erroneous data9.88 (;SB2(;5845.88 *u X2R'S

    21f. ":U: E

    User InstructionsSTEP INSTRUCTIONS INPUT KEYS OUTPUTDATA/UNITS DATA/UNITS

    1 Key in the program DD2 Initialize [ U ~3 For equal expected values: DD3a Perform 3a for i= 1, 2, . . . n O.1 I G S ~ ~ i

    (Correct erroneous data, 0; ) OJ LciJl 2 I iv3b Calculate X2 ~ [ L J X23c Calculate E I R/S ILJ E4 When expected values are unequal: I II I4a Perform 4a-4b for i= 1. 2, . . . n O. IENT t l D4b E. IGSB II 1 I i . -

    (Correct erroneous data, O. , E.) OJ I ENT t lDJ J Ej GiJ[LJ i4c Ca 1cu 1ate X 2 GiJD y25 For a new case 00 to steo 2 C ~ I I

    [ = ~ [ = J- - - - ~ ' - - - - - - - - - - - - - - - - - - - - - ~ - - - - - - ------- [ ~ = J [ ~ -----

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    37/41

    34 PrograUl Listings131 *LBLIe2 srOJ E. or 0.133 1 1-134 X2135 , ,1 '17l \ t . i . . . ~ 'e.6137 ST+288 FCLJ89 1+113 IVS i11 tLBL2 correction routine12 STOJf 7 -""14 X2IS ReLJ1617 ST-218 PCLJ19 1-28 p/s21 *LBLJ22 PCL223 p,'s ** X 224 fL8L42S PC.2 E 0i 226 PC.B n27 x28 PC.1 EO.12938 LSTX.j l -, p.s *** X233 .x34 p.'s *** E

    ** "Printx" may bE inserted before "R/ 5".***"Printx" may b inserted before orin place of "RI 5".REGISTERS

    0 1 2 x 2 3 used 4 56 7 8 9 .0 .1n EX.2 LX 2 .3 .4 .5 16 1718 19 20 21 22 2324 25 26 27 28 29

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    38/41

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    39/41

    36 User InstructionsSTEP INSTRUCTIONS INPUTDATA/UNITS KEYS

    OUTPUTDATA/UNITS

    1 Key in the program CC2 Initialize Q J ~3 Perform 3-4 for i= 1, 2, . k a.1 IENTt ICb.4 1 @OI 1 I i(correct erroneous data ai' bi ) aj ENTt I Ib. GSB [CJ i

    5 Calculate degreesof freedom R/S I 1 df6 Calculate x2 R/S 1 I x27 Calculate Pearson's coefficient of ~ C Ccontingency I II 1

    CI ICCCC

    L ~ I ICCCI ICCCI ICCI II ICCI II 1CC

    I- C ~ CI- - - - - CC1----f-- L ~ I 1

    1 11 1

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    40/41

    PrograDl Listings 3781 .LBLl b a82 I+83 LSTX b a84 tLBLBBS + N.186 + same in last x87 RC.2 b288 LST,x8918 ST+l11 RC.4 a212 LSTX13 .14 ST+2IS 816 ST.217 5T.418 RC.B i19 R/S28 121 -22 R/S ***df23 RC.l NB24 RC.3 NA2S + N26 EHTt27 STx128 STx229 CHS3B RCLl31 RC.l3233 +34 RCL23S RC.336 .37 +38 R,"S ***x 239 +48 LSTX41 \ : ' ~ ~ "II+-l -4243 IX44 R."S ***C

    ***"Pri ntx.1I be inserted45 tLBL2 correction routine may46 1- before or in place of "RIS".47 LSTX b a48 bTDBb. 2 ai 2 REGISTERS0 1 1 2 3 4 5E N i E N. 9 .0 i .1 NB

    .2 b2 .3 NA .4 a2 .5 16 1718 19 20 21 22 2324 25 26 27 28 29

  • 7/29/2019 HP-19C & 29C Solutions Statistics 1977 B&W

    41/41