BIOS14:Statistic Exercise 1

这篇博客探讨了一位新手学生与经验丰富的学生在测量大象重量时是否存在显著差异。通过t检验发现,新手学生的测量结果与其他学生显著不同。接着,使用方差分析(ANOVA)测试测量者身份是否影响估计重量,结果显示只有两位学生的测量存在显著差异,但学生ID整体上并不影响测量误差。实验设计的问题在于缺乏大象的真实重量,可能导致所有测量结果都不准确,且应考虑采用不同的测量方法以减少误差。
摘要由CSDN通过智能技术生成

a) Student number 2 is a new student with little experience of elephants, and professor Elestat thus had a prior expectation that he might deviate from the others in his measurements. Does he? (4p)

I use one sample t.test here. Let other students as population, test if student 2’s measurement is different from others.

# data mport and check
eleweigh = read.csv('eleweigh.csv')
str(eleweigh)
stu2.mean = mean(subset(eleweigh, student == '2')$weight)
other = subset(eleweigh, student != '2')

# explore data
hist(other$weight)
boxplot(other$weight)

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-oChq87R6-1581449628684)(D:\MarkDownPicture\image-20200119154148693.png)]

Check assumption of t-test

#Normality of data
x = other$weight
h = hist(x)
xfit = seq(min(x, na.rm=TRUE),max(x, na.rm=TRUE),length=100)
yfit = dnorm(xfit,mean=mean(x, na.rm=TRUE),sd=sd(x, na.rm=TRUE))
yfit = yfit*max(h$counts)/max(yfit)
hist(other$weight, col="red")
lines(xfit, yfit, lwd=2)

> shapiro.test(other$weight)

	Shapiro-Wilk normality test

data:  other$weight
W = 0.96398, p-value = 0.761

> x = other$weight
> y = pnorm(summary(x), mean =mean(x, na.rm=TRUE), sd =sd(x, na.rm=TRUE))
> ks.test(x, y)

	Two-sample Kolmogorov-Smirnov test

data:  x and y
D = 1, p-value = 0.0003789
alternative hypothesis: two-sided
> qqnorm(other$weight)
> qqline(other$weight)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值