我期望我可以通过酒店测试证明,如果一个p-变量正态随机向量的样本具有理论平均值。但是如果来自HottelingsT2函数的分布与由HottelingsT2-Test使用的测试统计量的分布匹配失败,则使用ks.test进行交叉检查。这意味着模拟实验的平均值不是0,但显然它们有。所以在上下文中应该有些问题。有一些错误吗?Hotellings统计
require(mvtnorm)
require(ICSNP)
subject<-50
treatment<-4
V<-matrix(c(644.03100226056, 184.319025225855, 572.5312199559, 143.106678641056, 184.319025225855, 73.5310268006399, 230.838267981476, 130.977532385651, 572.5312199559, 230.838267981476, 736.378779002912, 429.445506266528, 143.106678641056, 130.977532385651, 429.445506266528, 435.124191935888),treatment,treatment)
experiment<-list()
R<-3000
seed<-split(1:(R*subject),1:R)
for(i in 1:R){
e<-c()
for(j in 1:subject){
set.seed(seed[[i]][j])
e<-c(e,rmvnorm(mean=rep(0,treatment),sigma=V,n=1,method="chol"))
}
experiment<-c(experiment,list(matrix(e,subject,treatment,byrow=T)))
}
p.values<-c()
for(e in experiment){
fit<-lm(e~1)
p.values<-c(p.values,HotellingsT2(e, mu=rep(0,treatment))[["p.value"]])
}
ks.test(p.values, punif,alternative = "two.sided")
属于交叉验证而非SO。 http://stats.stackexchange.com/ –
thx的链接,我无法找到一个相关的职位,我的问题。你在模拟中看到一些错误吗? – Klaus
另一方面,我只比较检验统计量的ecdf与ANOVA框架给出的理论F分布。我无法看到这个简单的蒙特卡洛研究中的错误。 – Klaus