Stats 201 R
Autor: Maryam • January 29, 2018 • 792 Words (4 Pages) • 548 Views
...
7) > samplebmi1
> samplebmi1
[1] 22.61519 30.68702 27.99801 24.86513 24.74188 27.86049 26.45994 28.09394
[9] 24.90291 24.92058 19.23282 28.64422 29.32497 21.41803 21.89220 32.72707
[17] 23.71241 27.39722 22.11940 21.41484 25.52571 21.85916 24.13166 26.23878
[25] 22.98395 24.16282 26.22704 28.38939 35.18590 24.64068 20.07044 26.90325
[33] 28.49141 26.86607 25.92871 25.20929 23.10816 32.24865 21.46042 24.39974
[41] 25.73905 31.21014 20.74159 29.64699 22.79580 29.83458 30.42022 22.72962
[49] 38.57049 27.88062 27.09845 34.45011 21.62722 30.22772 25.39119 25.38602
[57] 23.19926 20.11476 18.18159 29.87958 23.90303 28.89880 28.30629 25.52927
[65] 26.06227 17.92705 27.24941 27.34853 23.72921 19.09993 21.62604 25.10457
[73] 20.21998 26.09249 26.40898 21.35310 30.23275 24.59962 27.16169 25.27255
[81] 22.97916 26.52632 23.15445 29.13450 32.18537 24.13060 28.50459 26.17230
[89] 23.37700 20.54472 31.03960 20.97464 19.71637 23.76860 22.73930 32.84538
[97] 29.77436 31.93939 26.20482 20.17837
> mean(samplebmi1)
[1] 25.722
> sd(samplebmi1)
[1] 3.983918
(yes it does have the mean of the population)
Null Hypothesis
- H0 = there is no difference between the mean of samplebmi1 and the meanbmi
- Research Hypothesis
H1 = there is a difference between the mean of samplebmi1 and the meanbmi
> t.test(samplebmi1,conf.level=0.95)
One Sample t-test
data: samplebmi1
t = 64.565, df = 99, p-value
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
24.93150 26.51249
sample estimates:
mean of x
25.722
> t.test(samplebmi1,mu=bmimean,conf.level=0.95)
One Sample t-test
data: samplebmi1
t = 1.8513, df = 99, p-value = 0.06711
alternative hypothesis: true mean is not equal to 24.98446
95 percent confidence interval:
24.93150 26.51249
sample estimates:
mean of x
25.722
Therefore H0 = there is no difference between the mean of samplebmi1 and the meanbmi
8a) > pnorm(38,agemean,agesd)-pnorm(32,agemean,agesd)
[1] 0.5262774
b) > qnorm(0.9,agemean,agesd)
[1] 40.34255
9a) > pfemale.hat
> pfemale.hat
[1] 0.50032
b) > pfemale.hat-1.96*sqrt(pfemale.hat*(1-pfemale.hat)/n)
[1] 0.497221
> pfemale.hat+1.96*sqrt(pfemale.hat*(1-pfemale.hat)/n)
[1] 0.503419
Confidence level is between 0.497221 to 0.503419
10) pnormal.hat
> pnormal.hat-1.96*sqrt(pnormal.hat *(1- pnormal.hat)/n)
[1] 0.6736907
> pnormal.hat+1.96*sqrt(pnormal.hat *(1- pnormal.hat)/n)
[1] 0.6794893
Confidence level is between 0.6736907 to 0.6794893
11) a) > systolic
> group
> tapply(systolic,group,mean)
HIGH LOW NORMAL
139.5428 101.0527 120.4786
b)> diastolic
> tapply(diastolic,group,mean)
HIGH LOW NORMAL
97.66724 55.35062 76.66577
c)> tapply(systolic,group,sd)
HIGH LOW NORMAL
7.868794 4.574340 7.710230
b)> tapply(diastolic,group,sd)
HIGH LOW NORMAL
7.278075 4.021760 7.489079
...