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

1. A random sample of 50 items gives the mean 6.

2 and variance
10.24 can it be regarded as drawn from a normal population with
5.4 mean at 5% level of significance?

Given: n=50 X¯=6.2 variance =10.24 S.D=Squareroot of


variance. §=3.2
Null hypothesis h0 : µ=5.4
Alternate hypothesis ha : µ ≠ 5.4

Test of Statistics:
Z=|X¯- µ/§/Squareroot of n|
=|6.2-5.4/3.2/squareroot of 50|

=1.77

Critical z-Calculated Value

Level of 10% 5% 1% 0.1%


Significance
One tailed 1.65 1.9 2.58 3.29
6
Two tailed 1.28 1.6 2.33 3.10
4

https://www.youtube.com/playlist?list...
Anova Example:

Problem-1
A=c(2,4,6)
B=c(3,5,7)
C=c(4,6,8)
combined_group <- data.frame(cbind(A,B,C)) #its is combining groups
combined_group
summary(combined_group)
stacked.group <- stack(combined_group)
stacked.group
result <- aov(values ~ind,data=stacked.group)
summary(result)
# it is one way anova

Problem 2
A=c(9,11,13,9,8)
B=c(13,12,10,15,5)
C=c(14,13,17,7,9)
combined_group <- data.frame(cbind(A,B,C))
combined_group
summary(combined_group)
stacked.group <- stack(combined_group)
stacked.group
Anova_result <- aov(values ~ind,data=stacked.group)
summary(Anova_result)
Problem-3
z_test<-function(x,mu,s,n,tailed)
{
z<-(x-mu)/(s/sqrt(n))
if(tailed == 1)return(cat('the value of Z=',z,'\np-value=',pnorm(-
abs(z))))
if(tailed==2)return(cat('z-score=',z,'\np-value=',2*pnorm(-abs(z))))
if(tailed!=1| tailed!=2)return('can only be 1 tailed or 2 tailed')
}
z_test(6,5,2,20,3)
z_test(6,5,2,20,1)
z_test(6,5,2,20,2)
z_test(6,5,2,20,4)
z_test(7,4,3,16,1)

Problem-4

help("t.test")
rm(list=ls())
x<- rnorm(100)
t.test(x,mu=5)

Problem-5

library(gapminder)
data("gapminder")
summary(gapminder)
mean(gapminder$gdpPercap)
median(gapminder$lifeExp)
attach (gapminder)
hist(lifeExp)
hist(log(pop))
boxplot(lifeExp ~ continent)
plot(lifeExp ~gdpPercap)
plot(lifeExp ~log(gdpPercap))

Problem-6

n=2000
x=1040
p=1/2
q=1/2
z=(x-n*p)/(sqrt(n*p*q))
z
2*pnorm(z)
pnorm(-abs(z))

Problem-7

x=c(19,21,25,16,17,14,21)
n=7
mean(x)
xbar=19
mu=20
s=3.7
t=(xbar-mu)/(s/sqrt(n))
Problem-8

mu=5
s=2
n=20
zbar=6
t=(zbar-mu)/(s/sqrt(n))
t
2*pt(-abs(t),df=n-1)
pt(-abs(t),df=n-1)

For Details of R programing related to hypothesis testing refer the site:

https://data-flair.training/blogs/t-tests-in-r/

it provides you examples + output for Anova,Linear regression also.

https://www.youtube.com/watch?v=gePqxb9Vxuo

https://www.youtube.com/watch?v=1bywo64eIC0

https://www.youtube.com/watch?v=ACWuV16tdhY

Anova Problems- https://www.youtube.com/watch?v=scWZA

t-test Problems -https://www.youtube.com/watch?v=5kPxi4tk6Ak

https://www.youtube.com/watch?v=pTmLQvMM-1M

You might also like