1. Trang chủ
  2. » Công Nghệ Thông Tin

A textbook of Computer Based Numerical and Statiscal Techniques part 57 pps

10 223 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 162,32 KB

Nội dung

Since the tabulated value of F is less than the calculated value, H0 is accepted i.e., there is no significant difference between the variance i.e., the samples have been drawn from the

Trang 1

Under the null hypothesis H0, (i) σx2 = σy2 = σ2 i.e., the population variances are equal or (ii) two independent estimates of the population variances are homogeneous, then the statistic

F is given by

F = S S

x y

2 2

1 1

n – i x i x

n

d i2 1

1

=

S y2 = 1

1 2

n –

y i y

j

n

d i2 1

2

=

It follows Snedecor’s F-distribution with d.f ν1 = n1 –1 and ν2 = n2 –1 Also greater of two

variances S x2 and S y2 is to be taken in the numerator and n1 corresponds to the greater variance

The critical values of F for left tail test H0: σ12 = σ22 against H1: σ12 < σ22 are given by

F < F n

1–1, n2 –1 (1–α)

and for the two tailed test, H0: σ12 = σ22 against H1: σ12 ≠ σ22 are given by

F<F n1−1 ,n2−2 2FH IK

α and F<F n1−1,n2−2FH IK1− 2

α

12.7.4 Fisher’s Z-test

To test the significance of an observed sample correlation coefficient from an uncorrelated bivariate

normal population, t-test is used But in random sample of size n i from a normal bivariate

population in which P ≠ 0 it is proved that the distribution of ‘r’ is by no means normal and in

the neighbourhood of ρ = ± 1, its probability curve is extremely skewed even for large n If

ρ ≠ 0 Fisher’s suggested the transformation

Z = 1

2 loge

1 1

+r r

= tanh–1 r

and proved that for small samples, the distribution of Z is approximately normal with mean

ζn = 1

2 loge

1 1

+ ρ ρ

= tanh–1 ρ

and variance 1/(n – 3) and for large values of n, (n > 50) the approximation is very good Example 21 Two independent sample of sizes 7 and 6 had the following values:

Examine whether the samples have been drawn from normal populations having the same variance.

Sol H0: The variance are equal i.e., σ2

1 = σ2

2 .

i.e., the samples have been drawn from normal populations with same variance.

H1: σ12 ≠ σ22

Trang 2

Under null hypothesis, the test statistic F = s 1 2

s22 (s1

2 > s22) Computations for s12 and s22

2 –

2 –

X1 = 31, n1 = 7; Σ X1 X1

2 –

d i = 28

X2 = 28, n2 = 6; Σ X2 X2

2 –

s12 = Σ X X

n

2

1 1

– –

d i = 28

6 = 4.666; s22 = ΣX X

n

2

2 1

– –

d i = 26

5 = 5.2

F = s s

22

12

= 52

4 666 = 1.1158. (3 s22 > s12)

Conclusion: The tabulated value of F at ν1 = 6 –1 and ν2 = 7 –1 d.f for 5% level of significance

is 4.39 Since the tabulated value of F is less than the calculated value, H0 is accepted i.e., there

is no significant difference between the variance i.e., the samples have been drawn from the

normal population with same variance

Example 22 The two random samples reveal the following data:

Sample no Size Mean Variance

Test whether the samples come from the same normal population.

Sol A normal population has two parameters namely the mean µ and the variance σ2 To test whether the two independent samples have been drawn from the same normal population,

we have to test

(i) the equality of means (ii) the equality of variance.

Since the t-test assumes that the sample variance are equal, we first apply F-test.

F-test: Null hypothesis: σ12 = σ22

The population variance do not differ significantly

Trang 3

Alternative hypothesis: σ12 ≠ σ22

Under the null hypothesis, the test statistic is given by F = s

s

12 2

2 , (s12 > s22) Given: n1 = 16, n2 = 25; s12 = 40, s22 = 42

s

12

22 =

n s n

n s n

1 12 1

2 22 2

1 1

– –

= 16 40 15

×

× 24

25×42 = 0.9752.

Conclusion: The calculated value of F is 0.9752 The tabulated value of F at 16 –1, 25 –1 d.f.

for 5% level of significance is 2.11

Since the calculated value is less than that of the tabulated value, H0 is accepted, i.e., the

population variance are equal

t-test: Null hypothesis: H0 ; µ1 = µ2 i.e., the population means are equal.

Alternative hypothesis: H1: µ1 ≠ µ2

Given: n1 = 16, n2 = 25, X1 = 440, X2 = 460

s2 = n s n s

1 12 2 22

+ + – =

16 40 25 42

16 25 2

× + × + – = 43.333 ∴ s = 6.582

s

+

= 440 460

6 582 1 16

1 25

= – 9.490 for (n1 + n2 – 2) d.f.

Conclusion: The calculated value of t is 9.490 The tabulated value of t at 39 d.f for 5%

level of significance is 1.96

Since the calculated value is greater than the tabulated value, H0 is rejected

i.e., there is significant difference between means, i.e., µ1 ≠ µ2

Since there is significant difference between means, and no significant difference between variance, we conclude that the samples do not come from the same normal population

PROBLEM SET 12.2

1 The following table gives the number of accidents that took place in an industry during various days of the week Test if accidents are uniformly distributed over the week

[Ans H0 is accepted]

Trang 4

2 Verify whether Poisson distribution can be assumed from the data given below:

No of defects

Frequency

[Ans H0 is accepted; Poisson distribution provides a good fit to the given data]

3 A survey of 320 families with 5 children shows the following distribution

No of girls

Families

Given that values of χ2 of 5 d.f are 11.1 and 15.1 at 0.05 and 0.01 significance level

respectively, test the hypothesis that male and female births are equally probable [Ans H0 is accepted at 1% level of significance and rejected at 5% level of significance]

4 The following table gives the frequency of occupance of the digits 0, 1, , 9 in the last place in four logarithm of numbers 10-99 Examine if there is any peculiarity

Digits

Frequency

[Ans No]

5 The sales in a supermarket during a week are given below Test the hypothesis that the sales do not depend on the day of the week, using a significant level of 0.05

[Ans Accepted at 0.05 significant level]

6 A die is thrown 90 times with the following results:

Use χ2-test to test whether these data are consistent with the hypothesis that die is unbiased Given χ2

0.05 = 11.07 for 5 degrees of freedom

[Ans Accepted at 0.05 significant level]

7 4 coins were tossed at a time and this operation is repeated 160 times It is found that

4 heads occur 6 times, 3 heads occur 43 times, 2 heads occur 69 times, one head occur

34 times Discuss whether the coin may be regarded as unbiased [Ans Unbiased]

8 A sample analysis of examination results of 500 students, it was found that 280 students have failed, 170 have secured a third class, 90 have secured a second class and the rest,

a first class Do these figures support the general belief that above categories are in the ratio 4 : 3 : 2 : 1 respectively? [Ans Yes, these figures support]

Trang 5

9 In the accounting department of bank, 100 accounts are selected at random and estimated for errors The following results were obtained:

Does this information verify that the errors are distributed according to the Poisson

10 Fit a Poisson distribution to the following data and best the goodness of fit:

[Ans Poisson lawfits the data]

11 What are the expected frequencies of 2 × 2 contigency tables given below

(ii) 2 10

6 6

+ + + + + +

+ + + + + +

(ii) 4 8

12 In a locality 100 persons were randomly selected and asked about their educational achievements The results are given below:

Education Middle High school College

Based on this information can you say the education depends on sex [Ans Yes]

Trang 6

13 The following data is collected on two characters:

Smokers Non smokers

Based on this information can you say that there is no relation between habit of smoking

14 In an experiment on the immunisation of goats from anthrax, the following results were obtained Derive your inferences on the efficiency of the vaccine

Died anthrax Survived

[Ans No]

15 The lifetime of electric bulbs for a random sample of 10 from a large consignment gave the following data:

4 2 4 6 3 9 4 1 5 2 3 8 3 9 4 3 4 4 5 6

Can we accept the hypothesis that the average lifetime of bulb is 4000 hrs ?

[Ans Accepted]

16 A sample of 20 items has mean 42 units and S.D 5 units Test the hypothesis that it

is a random sample from a normal population with mean 45 units [Ans H0 is rejected]

17 The following values gives the lengths of 12 samples of Egyptian cotton taken from a consignment: 48, 46, 49, 46, 52, 45, 43, 47, 47, 46, 45, 50 Test if the mean length of the

18 A sample of 18 items has a mean 24 units and standard deviation 3 units Test the hypothesis that it is a random sample from a normal population with mean 27 units

[Ans Rejected]

19 A filling machine is expected to fill 5 kg of powder into bags A sample of 10 bags gave the following weights: 4.7, 4.9, 5.0, 5.1, 5.4, 5.2, 4.6, 5.1, 4.6 and 4.7 Test whether the

20 Memory capacity of 9 students was tested before and after a course of meditation for

a month State whether the course was effective or not from the data given below

Before

After

[Ans H0 is accepted]

Trang 7

21 A certain stimulus administered to each of 12 patients resulted in the following increase

of blood pressure: 5, 2, 8, – 1, 3, 0, – 2, 1, 5, 0, 4, 6 Can it be concluded that the stimulus will in general be accompanied by an increase in blood pressure?

[Ans H0 is rejected]

22 The mean life of 10 electric motors was found to be 1450 hrs with S.D of 423 hrs A second sample of 17 motors chosen from a different batch showed a mean life of 1280 hrs with a S.D of 398 hrs Is there a significant difference between means of the two

23 The height of 6 randomly chosen sailors in inches are 63, 65, 68, 69, 71 and 72 Those

of 9 randomly chosen soldiers are 61, 62, 65, 66, 69, 70, 71, 72 and 73 Test whether the sailors are on the average taller than soldiers [Ans H0 is accepted]

GGG

Trang 8

Computer Programming

in ‘C’ Language

13.1 INTRODUCTION

At its most basic level, programming a computer simply means telling it what to do, and this vapid-sounding definition is not even a joke There are no other truly fundamental aspects of computer programming; everything else we talk about will simply be the details of a particular, usually artificial, mechanism for telling a computer what to do Sometimes these mechanisms are chosen because they have been found to be convenient for programmers (people) to use; other times they have been chosen because they’re easy for the computer to understand The first hard thing about programming is to learn, become comfortable with, and accept these artificial mechanisms, whether they make ‘sense’ to you or not

Many computer programming mechanisms are quite arbitrary, and were chosen not because

of any theoretical motivation but simply because we needed an unambiguous way to say something

to a computer C is sometimes referred to as a “high-level assembly language”

Elements of Real Programming Languages

There are several elements which programming languages, and programs written in them, typically contain These elements are found in all languages, not just C

1 There are variables or objects, in which you can store the pieces of data that a program

is working on Variables are the way we talk about memory locations (data) Variables may be global (that is, accessible anywhere in a program) or local (that is, private to certain parts of a program)

2 There are expressions, which compute new values from old ones

3 There are assignments which store values (of expressions, or other variables) into variables

4 There are conditionals which can be used to determine whether some condition is true, such as whether one number is greater than another In some languages, including C, conditionals are actually expressions which compare two values and compute a ‘true’

or ‘false’ value

5 Variables and expressions may have types, indicating the nature of the expected values

6 There are statements which contain instructions describing what a program actually does Statements may compute expressions, perform assignments, or call functions

7 There are control flow constructs which determine what order statements are performed

in A certain statement might be performed only if a condition is true A sequence of several statements might be repeated over and over, until some condition is met; this

is called a loop

553

Trang 9

8 An entire set of statements, declarations, and control flow constructs can be lumped

together into a function (also called routine, subroutine, or procedure) which another piece

of code can then call as a unit.

9 A set of functions, global variables, and other elements makes up a program.

10 In the process of specifying a program in a form suitable for a compiler, there are usually a few logistical details to keep track of These details may involve the specification

of compiler parameters or interdependencies between different functions and other parts of the program

Computer Representation of Numbers

Most computers represent integers as binary numbers with a certain number of bits A computer with 16-bit integers can represent integers from 0 to 65,535 or if it chooses to make half of them negative, from –32,767 to 32,767 A 32-bit integer can represent values from 0 to 4,294,967,295, or

+ –2,147,483,647 Most of today’s computers represent real (i.e., fractional) numbers using

exponential notation The advantage of using exponential notation for real numbers is that it lets you trade off the range and precision of values in a useful way Since there’s an infinitely large number of real numbers, it will never be possible to represent

Characters, Strings, and Numbers

One fundamental component of a computer’s handling of alphanumeric data is its character set.

A character set is, not surprisingly, the set of all the characters that the computer can process and display (Each character generally has a key on the keyboard to enter it and a bitmap on the screen which displays it.) A character set consists of letters, numbers, and punctuation

A character is, well, a single character If we have a variable which contains a character value,

it might contain the letter ‘A’, or the digit ‘2’, or the symbol ‘&’ A string is a set of zero or more

characters For example, the string “and” consists of the characters ‘a’, ‘n’, and ‘d’

Compiler Terminology

C is a compiled language This means that the programs we write are translated, by a program

called a compiler, into executable machine-language programs which we can actually run Executable machine-language programs are self-contained and run very quickly A compiler is a special kind of progam: it is a program that builds other programs The main alternative to a compiled computer language or program is an interpreted one, such as BASIC In other words, for each statement that you write, a compiler translates into a sequence of machine language instructions which does the same thing, while an interpreter simply does it

Example

Program to print “hello, world” or display a simple string, and exit

# include < stdio.h>

main()

{

printf (“Hello, word!\n”);

return 0;

}

Trang 10

Printf is a library function which prints formatted output The parentheses surround printf’s argument list: the information which is handed to it which it should act on The semicolon at the end of the line terminates the statement

The second line in the main function is

return 0;

In general, a function may return a value to its caller, and main is no exception When main returns (that is, reaches its end and stops functioning), the program is at its end, and the return value from main tells the operating system whether it succeeded or not By convention, a return value of 0 indicates success

Basic Data Types and Operators

The type of a variable determines what kinds of values it may take on An operator computes new values out of old ones An expression consists of variables, constants, and operators combined to

perform some useful computation

There are only a few basic data types in C

l char a character

l int an integer, in the range – 32,767 to 32,767

l long int a larger integer (up to +–2,147,483,647)

l float a floating-point number

double a floating-point number, with more precision and perhaps greater range than float Constant: A constant is just an immediate, absolute value found in an expression The

simplest constants are decimal integers e.g., 0, 1, 2, 123 Occasionally it is useful to specify

con-stants in base 8 or base 16 (octal or hexadecimal)

A constant can be forced to be of type long int by suffixing it with the letter L A constant that contains a decimal point or the letter e (or both) is a floating-point constant: 3 14, 01, 123e4, 123.456e7 The e indicates multiplication by a power of 10; 123.456e7 is 123.456 times 10 to the 7th, or 1,234, 560,000

A character constant is simply a single character between single quotes: ‘A’, ‘.’, ‘%’ The numeric value of a character constant is, naturally enough, that character’s value in the machine’s character set Characters enclosed in double quotes: “apple”, “hello, world”, “this is a test” Within character and string constants, the backslash character \ is special, and is used to represent characters not easily typed on the keyboard or for various reasons not easily typed in constants The most common of these “character escapes” are:

\n a “newline” character

\b a backspace

\r a carriage return (without a line feed)

\‘ a single quote (e.g., in a character constant)

\” a double quote (e.g., in a string constant)

\\ a single backslash

Declarations: Informally, a variable (also called an object) is a place where computer can store a value So that they can refer to it unambiguously, a variable needs a name A declaration tells the compiler the name and type of a variable we’ll be using in our program In its simplest form, a declaration consists of the type, the name of the variable, and a terminating semicolon:

Ngày đăng: 04/07/2014, 15:20

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w