In: Math
I'm doing a stats project on the correlation between the amount of hours a person sleeps and their weight; proving there is no correlation between sleep and weight gain. I have voluntary samples of people's weight and the hours they slept, and I need to list if the level of measurement is nominal or ordinal, confidence interval, and linear correlation test. how do I do this?
Sol:
label x as hours slep
y as weight
perform cor.test in R(which tests whethe the relationship is significant or not)
if p>0.05
relationship i s significant.
ex: i am taking hours as
2,3,4,5,7
weight as
54,45,67,78.34
my null hypothesis:
THere is no relationship between hours slept and weight
alternative hypothesis:
There is a negative relationship between hours slept and weight.
Rcode is:
hourssslept <- c(2,3,4,5,7)
weight <- c(54,45,67,78,34)
cor.test(hourssslept,weight)
ouptut:
Pearson's product-moment correlation
data: hourssslept and weight
t = -0.3784, df = 3, p-value = 0.7303
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
-0.9220699 0.8239945
sample estimates:
cor
-0.2134366
here corr coefficient is r=-0.2134366
p=0.7303
p>0.05
Fail to reject H0.
Accept H0
THere is no relationship
to find confidenc einterval in R
Rcode is
t.test(hourssslept,weight)
Welch Two Sample t-test
data: hourssslept and weight
t = -6.5596, df = 4.0976, p-value = 0.002567
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval 95 percent confidence interval::
-72.9529 -29.8471
sample estimates:
mean of x mean of y
4.2 55.6
output:
95 percent confidence interval: s from 4.2 to 55.6