[R] Hotteling Test

MarcioRibeiro mestat at pop.com.br
Tue Mar 24 16:04:16 CET 2009


Hi listers,
I would like to do a graphic of the power function of the Hotteling test
(T2).
T2~F(p,n-p;lambda), lambda is my paremeter of non-centrality.
So I would like to do a graphic of the power of the test as a function of
the parameter lambda. I also would like to define lambda varying between
0.05 and 1.
I am really not sure if the way that I am doing the graphic is the best
methodology.
I am working on this code...
N<-20
p<-3
alpha<-0.05
mean0<-matrix(c(0,0,0),nrow=3,ncol=1,byrow=TRUE)
mean1<-matrix(c(0,1,0),nrow=3,ncol=1,byrow=TRUE)
sigma<-matrix(c(1,0.2,-0.8,0.2,1,0.4,-0.8,0.4,1),nrow=3,ncol=3,byrow=TRUE)
T2<-N*(t((mean1-mean0))%*%solve(sigma)%*%(mean1-mean0))
lambda<-N*(t((mean1-mean0))%*%solve(sigma)%*%(mean1-mean0))/2
critique<-qf(1-alpha,3,17)        #critique ~ Fp,n-p(α)
beta<-1-pf(critique,p,n-p,ncp=lambda)
beta

beta1<-c(rep(0,112))
lambda1<-c(1:112)
for (i in 1:112){
beta1[i]<-1-pf(critique,p,N-p,ncp=lambda1[i])
}
if (0.05<beta1<1){
plot(beta1,pch=".")
}

Thanks,
Marcio
-- 
View this message in context: http://www.nabble.com/Hotteling-Test-tp22682412p22682412.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list