In: Statistics and Probability
UTRGV spring 2019 Statistics Students are interested in understanding the education level (1 means having a higher education and 0 is the opposite) in RGV, they collected data from the population of RGV:
1 0 0 0 1 1 1 0 1 1 1 0 0 1 1 0
1 1 1 0 0 1 1 0 1 0 1 0 0 1 1 1
a. Use R to provide a frequency and relative frequency table.
b. Use prop.test to for the following hypothesis testing.
?0: ? = 0.6
?1: ? > 0.6
c. Determine the p-value.
d. Can you reject the null hypothesis, justify your answer?
e. Provide your R coding
frequency = total number of observations of type.
relative frequency = frequency / sample size
a)
> x<-c(1, 0 ,0 ,0, 1, 1 ,1 ,0, 1, 1, 1 ,0 ,0, 1 ,1, 0,1 ,1
,1 ,0 ,0 ,1 ,1 ,0 ,1 ,0 ,1 ,0 ,0 ,1 ,1 ,1)
> n<-length(x)
> freq<-table(x)
> freq
x
0 1
13 19
>
> relative.frequencies<-freq/n
> round(relative.frequencies,2)
x
0 1
0.41 0.59
b)
?0: ? = 0.6
?1: ? > 0.6
> p<-0.59 # relative freq corresponding to 1
> x<-n*p # number of observation corresponding to 1
> prop.test(x,n,p=0.60,alternative = "greater")
1-sample proportions test with continuity correction
data: x out of n, null probability 0.6
X-squared = 0, df = 1, p-value = 0.5
alternative hypothesis: true p is greater than 0.6
95 percent confidence interval:
0.4358169 1.0000000
sample estimates:
p
0.59
C. p-value = 0.5
(from above output)
D.Reject Ho.
If P- value < alpha=0.05
Here P-value = 0.5 > 0.05
So we fail to reject to Ho.
we may conclude that ? = 0.6.
E.
>x<-c(1, 0 ,0 ,0, 1, 1 ,1 ,0, 1, 1, 1 ,0 ,0, 1 ,1, 0,1 ,1
,1 ,0 ,0 ,1 ,1 ,0 ,1 ,0 ,1 ,0 ,0 ,1 ,1 ,1)
>n<-length(x)
>freq<-table(x)
>freq
>relative.frequencies<-freq/n
>round(relative.frequencies,2)
>p<-0.59 # relative freq corresponding to 1
>x<-n*p # number of observation corresponding to 1
>prop.test(x,n,p=0.60,alternative = "greater")