Beruflich Dokumente
Kultur Dokumente
Embedded Lab–R
WINTER SEMESTER –2019∼2020
L57+L58 SLOT
E-RECORD
Submitted by
DEPARTMENT OF
MATHEMATICS SCHOOL OF
ADVANCED SCIENCES VIT
UNIVERSITY
VELLORE – 632
014 TAMIL NADU
INDIA
Date: 12/03/2020
Experiment No. –v
Z–Test for Single Mean and Difference of Means
1. A sample of 900 items is found to have a mean of 3.47 cm. Write down the
R programming code to test whether it can be reasonably regarded as a
simple sample from a population with mean 3.23 cm and SD 2.31 cm at 99%
level of confidence.
H0:muo=3.23
H1:muo!=3.23
INPUT:
> xbar=3.47
> mu0=3.23
> sigma=2.31
> n=900
> z=(xbar-mu0)/(sigma/sqrt(n))
> alpha=.01
> z.half.alpha=qnorm(1-alpha/2)
> c(z.h
llf.alp
ha) [1]
2.57582
9
OUTPUT:
> z
[1] 3.116883
CONCLUSION:
Here our value of Z is greater than zalpha, so H0 is rejected.
ASSUMPTIONS:
H0:mu1=mu0(performance of boys and girls is equal)
H1:mu1>mu0(boys perform better than girls)
INPUT:
> n1=32
> n2=36
> x1bar=72
> x2bar=70
> s1=8
> s2=6
> z=(x1bar-x2bar)/sqrt(s1^2/n1+s2^2/n2)
> zalpha=qnorm(1-alpha)
> zalpha
[1] 1.644854
OUTPUT:
> z
[1] 1.154701
CONCLUSION:
Here zalpha is greater than z, so our null hypothesis is accepted, that is Boys
do Perform better than girls.
:
OUTPUT:
Experiment No. –VI
AIM:-Z–Test for Single Proportion and Difference of Proportions
CONCLUSION:
Here our zalpha is less than our value of z, so our null hypothesis is rejected.
OUTPUT:
3. Before an increase in excise duty on tea, 800 people out of
a sample of 1000 were consumers of tea. After the increase in
duty, 800 people were consumers of tea in a sample of 1200
persons. Write down the R programming code to test whether
the significant decrease in the consumption of tea after the
increase in duty at 1 % level of significance.
AIM:TEST FOR DIFFERENCE OF
PROPORTIONS. ASSUMPTIONS:
H0:p1=p2
H1:p1>p2(Single tailed test)
INPUT:
> n1=1000
> n2=1200
> p1=800/n1
> p2=800/n2
> P=(n1*p1+n2*p2)/(n1+n2)
> q=1-P
> z=(p1-p2)/(sqrt(P*q*(1/n1+1/n2)))
> zalpha=qnorm(1-alpha)
> zalpha
[1] 2.326348
OUTPUT:
> z(test
statistic
) [1]
6.992059
CONCLUSION:
Our zalpha at 1% significance level is 2.326, so our z>zalpha, i.e. z>2.326,so Our
NULL HYPOTHESIS IS REJECTED.
THERE IS A DIFFERENCE IN THE CONSUMPTION OF TEA BEFORE AND AFTER THE
INCREASE IN EXCISE DUTY.
OUTPUT: