Life Testing
Chapter 14 Life Testing
Scilab code Exa 14.3a Lifetime of a transistor
1 t o t a l =50;
5 val1 = cdfchi ( ”X” , 2 failure , a l p h a 2 , 1 -( a l p h a 2) )
6 val2 = cdfchi ( ”X” , 2 failure , 1 - a l p h a 2 , ( a l p h a 2) )
8 int1 = 2 t val1 ;
9 int2 = 2 t val2 ;
10 disp ( ” The 9 5 c o n f i d e n c e interval is”);
11 disp ( int2 ) ;
12 disp ( int1 , ” t o ” ) ;
14 The c o n f i d e n c e interval is from22.35to62.17
w h e r e a s my s o l u t i o n in Scilab is 22.35to62.53
15 b e c a u s e of the d i f f e r e n c e in the v a l u e of chi - square
(0.975 , 30) . The t e x t b o o k says the v a l u e is 1 6 . 8 9
16 w h e r e a s s c i l a b c a l c u l a t e s its v a l u e as 1 6 . 7 9
Scilab code Exa 14.3b Lifetime of Battery
1 t=1800;
2 t h e t a = 150;
3 r =20;
4 pvalue= cdfchi ( ”PQ” ,2 t theta , 2 r ) ;
5 disp ( pvalue , ”P−v a l u e is”)
Scilab code Exa 14.3c One at a time sequential test
4 val1 = cdfchi ( ”X” , 2 r , 1 - a l p h a 2 , a l p h a 2) ;
5 val2 = cdfchi ( ”X” , 2 r , a l p h a 2 , 1 - a l p h a 2) ;
6 int1 = 2 T val1 ;
7 int2 = 2 T val2 ;
8 disp ( ” The 9 5 c o n f i d e n c e interval is”);
9 disp ( int1 ) ;
10 disp ( int2 , ” t o ” ) ;
12 The c o n f i d e n c e interval is from29.27to103.52
w h e r e a s my s o l u t i o n in Scilab is 29.265774to
13 1 0 4 . 2 6 6 8 3 b e c a u s e of the d i f f e r e n c e in the v a l u e of
chi - square (0.975 , 30) . The t e x t b o o k says the v a l u e is
14 9.66 w h e r e a s s c i l a b c a l c u l a t e s its v a l u e as 9.5907774.
Scilab code Exa 14.3d Lifetime of semiconductors
4 val1 = cdfchi ( ”PQ” , 2 T theta , 2 r ) ;
5 val2 = 1 - cdfchi ( ”PQ” , 2 T theta , 2( r +1) ) ;
6 pvalue= min ( val1 , val2 ) ;
7 disp ( pvalue , ” The p v a l u e is”);
8 disp ( ”H0 w o u l d b e
a c c e p t e d when t h e significance
level is 0.10”);
Scilab code Exa 14.3e Bayes estimator
1 X = [5 7 6.2 8.1 7.9 15 18 3.9 4.6 5 . 8 ] ;
2 Y = [3 3.2 4.1 1.8 1.6 2.7 1.2 5.4 10.3 1 . 5 ] ;
3 t= sum (X)+ sum (Y);
8 disp ( estimate , ” B a y e s estimate o f lambda is”);
Scilab code Exa 14.4a Lifetime of items produced by two plants
1 X l i f e = 420;
2 Y l i f e = 510;
3 Xnum = 10;
4 Ynum =15;
5 ts = X l i f e Ynum ( Y l i f e Xnum ) ;
6 disp ( ts , ” The v a l u e of the test statistic is”);
7 val = cdff ( ”PQ” , ts , Xnum , Ynum ) ;
8 p v a l u e = 2(1 - val ) ;
9 disp ( pvalue , ” The p−v a l u e is”);
10 disp ( ”We c a n n o t r e j e c t H0” ) ;