0% found this document useful (0 votes)
29 views10 pages

Statistics EXP-5

Uploaded by

Abhishek Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views10 pages

Statistics EXP-5

Uploaded by

Abhishek Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

ABHISHEK KUMAR, 20BCE0210

SCHOOL OF ADVANCED SCIENCE


DEPARTMENT OF MATHEMATICS
VELLORE INSTITUTE OF TECHNOLOGY

MAT-2001

“STATISTICS FOR ENGINEERS”

WINTER SEMESTER – 2021~2022

SLOT: L7+L8

EXPERIMENT NO. -5

Submitted By:-
ABHISHEK KUMAR
REG. NO: 20BCE0210

Faculty:
DR. EASWARAMOORTHY

Date of Submission: 14/04/2022

B.Tech - (Computer Science and Engineering)

ABHISHEK KUMAR; 20BCE0210 Page 1


ABHISHEK KUMAR, 20BCE0210

Sample Techniques – II

t−Test, paired t- Test and F- Test

Problem Statement:
1. A random sample of 10 boys with the following IQs: 70, 120, 110, 101, 88,
83, 95, 98, 107, and 100. Write down the R programming code to test
whether the data support the assumption of a population mean IQ of 100 at 5
% level of significance.

**************R- Code for Statistical Data**************

Input in R-Console:

> # Inputs in R- software:


> alpha=0.05
> Mu=100
> n=10
> x=c(70,120,110,101,88,83,95,98,107,100)

> print(" H0 :=x0=Mu ")


> print(" H1 :=x0!=Mu ")
> x0=mean(x)
> x0
> s=sqrt(var(x))
> tTab=qt((1-alpha),(n-1))
> tTab
> tCal=(x0-Mu)/(s/sqrt(n-1))
> tCal
> if(abs(tCal)<abs(tTab)) {
+ print(" H0 is accepted and H1 is rejected ")
+ } else {
+ print(" H0 is rejected and H1 is accepted ")
+}
> t.test(x,mu=Mu)

ABHISHEK KUMAR; 20BCE0210 Page 2


ABHISHEK KUMAR, 20BCE0210

Output in R-Console:

One Sample t-test

data: x

t = -0.62034, df = 9, p-value = 0.5504

alternative hypothesis: true mean is not equal to 100

95 percent confidence interval:

86.98934 107.41066

sample estimates:

mean of x

97.2

OUTPUT SCREENSHOT

ABHISHEK KUMAR; 20BCE0210 Page 3


ABHISHEK KUMAR, 20BCE0210

Problem Statement:
2. The mean height and the standard deviation height of 8 randomly chosen
soldiers are 166.9 cm and 8.29 cm respectively. The corresponding values of
6 randomly chosen sailors are 170.3 cm and 8.50 cm respectively. Write
down the R programming code to test whether the soldiers are shorter than
the sailors on the basis of average height.

**************R- Code for Statistical Data**************

Input in R-Console:

> alpha=0.01
> n1=8
> n2=6
> x1=166.9
> x2=170.3
> s1=8.29
> s2=8.50

> print(" H0 := x1=x2 ")


> print(" H1 := x1!=x2 ")
> Sigma=sqrt(((n1*s1^2)+(n2*s2^2))/(n1+n2-2))
> tTab=qt((1-alpha),(n1+n2-2))
> tTab
> tCal=(x1-x2)/(Sigma*sqrt((1/n1)+(1/n2)))
> tCal
> if(abs(tCal)<abs(tTab)) {
+ print("H0 is accepted and H1 is rejected")
+ } else {
+ print("H0 is rejected and H1 is accepted")
+}

Output in R-Console:

> tTab
[1] 2.680998
> tCal
[1] -0.6954801

"H0 is accepted and H1 is rejected"

ABHISHEK KUMAR; 20BCE0210 Page 4


ABHISHEK KUMAR, 20BCE0210

OUTPUT SCREENSHOT

ABHISHEK KUMAR; 20BCE0210 Page 5


ABHISHEK KUMAR, 20BCE0210

Problem Statement:
3. The following data related to the marks obtained by 11 students in two
sets, one held at the beginning of a year and the other at the end of the
year after intensive coaching. Write down the R programming code to test
whether the data indicate that the students have benefited by coaching at 5
% level of significance?

**************R- Code for Statistical Data**************

Input in R-Console:

> # Inputs in R-software:


> alpha=0.05
> S1=c(19, 23, 16, 24, 17, 18, 20, 18, 21, 19, 20)
> S2=c(17, 24, 20, 24, 20, 22, 20, 20, 18, 22, 19)

> print(" H0 := x1=x2 ")


> print(" H1 := x1!=x2 ")
> D=S1-S2
> d=mean(D)
> n=length(D)
> s=sqrt(var(D))
> tTab=qt((1-alpha),(n-1))
> tTab
> tCal=d/(s/sqrt(n-1))
> tCal
> if(abs(tCal)<abs(tTab)) {
+ print("H0 is accepted and H1 is rejected")
+ } else {
+ print("H0 is rejected and H1 is accepted")
+}

Output in R-Console:

> tTab
[1] 1.812461
> tCal
[1] -1.313064

"H0 is accepted and H1 is rejected

ABHISHEK KUMAR; 20BCE0210 Page 6


ABHISHEK KUMAR, 20BCE0210

OUTPUT SCREENSHOT

ABHISHEK KUMAR; 20BCE0210 Page 7


ABHISHEK KUMAR, 20BCE0210

Problem Statement:
4. Two random samples drawn from two normal populations with the following
observations.

Write down the R programming code to test whether the two populations have
the same variance at 5 % level of significance.

**************R- Code for Statistical Data**************

Input in R-Console:

> # Inputs in R-software:


> alpha=0.05
> S1=c(21, 24, 25, 26, 27)
> S2=c(22, 27, 28, 30, 31, 36)
> print(" H0 := s1=s2 ")
> print(" H1 := s1!=s2 ")
> n1=length(S1)
> n2=length(S2)
> x1=mean(S1)
> x2=mean(S2)
> s1=sqrt(var(S1))
> s2=sqrt(var(S2))
> Var1=(n1/(n1-1))*(s1^2)
> Var2=(n2/(n2-1))*(s2^2)
> FTab=qf((1-alpha),(n1-1),(n2-1))
> FTab
> if(Var1>Var2) {
+ FCal=Var1/Var2
+ } else {
+ FCal=Var2/Var1
+}
> FCal
> if(abs(FCal)<abs(FTab)) {
+ print("H0 is accepted and H1 is rejected")
+ } else {
+ print("H0 is rejected and H1 is accepted")
+}

[1] "H0 is accepted and H1 is rejected"


> var.test(S1,S2)

ABHISHEK KUMAR; 20BCE0210 Page 8


ABHISHEK KUMAR, 20BCE0210

Output in R-Console:

> FTab
[1] 5.192168
> FCal
[1] 3.912453

"H0 is accepted and H1 is rejected"

F test to compare two variances

data: S1 and S2

F = 0.24537, num df = 4, denom df = 5, p-value = 0.1981

alternative hypothesis: true ratio of variances is not equal to 1

95 percent confidence interval:

0.03321253 2.29776367

sample estimates:

ratio of variances

0.2453704

ABHISHEK KUMAR; 20BCE0210 Page 9


ABHISHEK KUMAR, 20BCE0210

OUTPUT SCREENSHOT

THANK YOU!!!

************************
ABHISHEK KUMAR; 20BCE0210 Page 10

You might also like