Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Reg No: 18BCB0081

PRATEEK SINHA

NAME : PRATEEK
SINHA
REG.NO : 18BCB0081
SUBJECT CODE :
MAT2001
SUBJECT TITLE : STATISTICS FOR
ENGINEERS
LAB SLOT : L15+16
GUIDED BY :Dr. MANIMARAN.A
Aim:
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.

Code:
Print(“H0=x0=Mu”)
Print(“H1=x0!=Mu”)
Alpha=0.05
Mn=100
n=10
x=c(70,120,110,101,88,83,95,98,107,100)
x0=mean(x)
s=sqrt(var(x))
tTab=qt((1-alpha),(n-1))
tTab
tCal=(x0-Mn)/(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,mn=Mn}
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.

Code:
print(“H0
:=x1=x2”)
print(“H1
:=x1=x2”)
alpha=0.01
n1=0
n2=6
x1=166.9
x2=170.3
n1=8.29
n2=8.50
sigma=sqrt((n1*n1^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”)]
Code:
print(“H0 :=x1-x2”)
print(“H1 :=x1=!x2”)
alpha=0.05
S1=(19,23,16,24,17,18,20,18,21,19,20)
S2=(17,24,20,24,20,22,20,20,18,22,19)
D=S1-S2
d=mean(D)
n=length(D)
s=sqrt(var(D))
tTab=qt(1-aplha),(n-1))
tTab
tCal=d/(s/sqrt(n-1))
tCal
if(abs(tCal)<abs(tCal))[
print (“H0 is accepted and H1 is accepted”)]
else[
print(“H0 is rejected and H1 is accepted”)]
Code:
S1=c(21,24,25,26,27)
S2=c(22,27,28,30,31,36)
n1=length(S1)
n2=length(S2)
x1=mean(S1)
x2=mean(S2)
n1=sqrt(var(S1))
n2=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/Va
r1
]
FCal
If(abs(FCal)<abs(FTab))[
Print(“H0 is accepted and H1 is rejected”)]
else[
print(“H0 is rejected and H1 is accepted”)]
var.test(S1,S2)

You might also like