楼主: 霉菌-
1523 1

[作业] R语言问题求助 [推广有奖]

  • 1关注
  • 1粉丝

已卖:454份资源

硕士生

78%

还不是VIP/贵宾

-

威望
0
论坛币
6392 个
通用积分
85.9002
学术水平
5 点
热心指数
9 点
信用等级
5 点
经验
3153 点
帖子
68
精华
1
在线时间
152 小时
注册时间
2019-3-7
最后登录
2025-2-26

楼主
霉菌- 发表于 2022-5-24 20:49:22 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
QQ图片20220524204820.png

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:R语言问题 R语言

沙发
霉菌- 发表于 2022-5-25 15:56:44
1. A non-parametric analysis of real data. (The following sub-questions are based on Question 3 in the
first assignment.)
This question examines the bacteria levels from an animal experiment where each rat was given flesh
wounds in two locations. One location was randomly select for a topical treatment and the other was
left as a control. The bacteria level at each wound was measured a few days later to see if the
treatment had an effect on the bacteria level.
a) Create a vector named diff that is the treated bacteria level minus the control bacteria level.
b) Create a vector named boot.data that creates 1000 bootstrap samples from our vector diff. The
length of boot.data should be 1000 times n (where n is the sample size of diff).
c) Calculate the median of each of the 1000 bootstraps. You can do this by transforming the 1000*n
values into a structure where each row represents one bootstrap sample. Then you could calculate
the median for each row to return 1000 bootstrapped medians. Call the resulting vector
boot.medians.
d) Now estimate the bootstrap median with a non-parametric 95% confidence interval by using the
50th , 2.5th and 97.5th percentile of the sample of bootstrapped medians. (Hint: look up the
quantile() function)
e) Write an expression to perform a two-sided sign-test to test if there was a difference in the
bacterial levels between treated and control wound. This can be done by using binom.test() to
test if the proportion of positive values in diff is different than 0.5.
f) Create a vector W that contains the Wilcoxon singed-rank statistic (W) for diff. This is done by
ranking the absolute values and then summing the ranks that correspond to values that were
originally positive.
g) Under the null hypothesis that diff is centered at zero (i.e. the average of the positive and negative
rankings are equal), Z w
has an asymptotic normal distribution , where
Z w
is:
Find the probability that under the null hypothesis, the absolute value of
Z w
is greater than that
observed in our sample vector diff .
h) Search the help for a built in R function to perform the Wilcoxon signed-rank test. Return the
two-sided p-value from this function. Note: turn off the exact option and the continuity correction
so that this p-value matches the probability you calculated in g) (at least to a couple of significant
digits).
i) Now rather than relying on the central limit theorem to approximate
Z w
as N(0,1), use the same
built in R function to calculate the exact version of the test.
j) Perform the same exact calculation using the psignrank() function.

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-9 19:55