Complete the following exercises using the code discussed during computer lab. Save your work in an R script as well as a Word document containing the necessary output and comments. Be sure to use notes in the script to justify any computations. If you have any questions, do not hesitate to ask
A rehabilitation study for cocaine users included administering two drugs and a placebo to determine effectiveness. There were 24 subjects in each group. Fourteen of the users given Desipramine relapsed, 18 of the uses given Lithium relapsed and 20 of the placebo group relapsed. Create two tables, one containing the counts and the other containing the marginal distributions for each drug. Print the tables and represent the data graphically. Use a bar graph with bars for both outcomes as well as two pie charts, one for each outcome.
Probability Distributions
1.?
Sample Size | ? | σ | s | |
---|---|---|---|---|
10 | 20 | 3.4641 | 20.5 | 3.6591 |
100 | 20 | 3.4641 | 20.24 | 3.5337 |
1000 | 20 | 3.4641 | 19.994 | 3.4912 |
10000 | 20 | 3.4641 | 20.0253 | 3.4795 |
?As n increases, the standard deviation approaches the true standard deviation.? The mean also approaches the true mean, but this happens with a much smaller sample size than what is needed for the standard deviation.
2.? The histograms appear to be approaching a normal distribution with mean 20.
3.???? Min. 1st Qu.? Median??? Mean 3rd Qu.??? Max. ?????????????? St. Dev
??????? ?0.7603? 4.8880? 7.4250? 7.9070 10.1300 26.2100???? 3.942555
The normal quantile plot is not linear, therefore, the data is not normal.
4.? The random numbers appear to be an F distribution with the exception of the 7 largest numbers.
5.???? a) 0.1009024
??????? b)? 0.8417877
??????? c)? 0.8686431
??????? d)? 0.5497382
??????? e)? 0.0001676192
??????? f)? 0.02527539
6.? a)? -0.5244005
??????? b)? 4.902398
??????? c)? 6.313752
??????? d)? 1.647907
??????? e)? 0.5291417, 0.9319332, 1.5853233
Representing Categorical Data
`1. ?????????? ??? Count Data
???????????????? Desipramine? Lithium Placebo??????????
???????????????? Yes????????? 14??? ??18? ??? ??20
???????????????? No?????????? 10??? ??????? ???6???? ???? ??4
Marginal Distributions
???????????????? ?Desipramine Lithium?? Placebo
???????????????? Yes?? 0.5833333??? 0.75 ??????? 0.8333333
???????????????? No??? 0.4166667??? 0.25 ?????? 0.1666667`
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。