yahdata<-scan("c:/SE/data1.txt")
yahdata<-matrix(data=yahdata,nrow=3762,ncol=3,byrow=TRUE)
k<-1
for(i in 1:57)
{
 temparray<-matrix(data=0,nrow=66,ncol=3,byrow=TRUE)
 uk<-k+65
 temparray<-yahdata[k:uk,];
 rm(uk)
 k<-k+66;
 temparray[,2]<-temparray[,2]/sum(temparray[,2])
 temparray[,3]<-temparray[,3]/sum(temparray[,3])
# temparray[,3]<-log(temparray[,3])
 temparrayreg<-lm(temparray[,1]~temparray[,2]+temparray[,3])
 temparray.frame<-data.frame(cbind(temparray[,2],temparray[,3]))
 foo1<-summary(temparrayreg)$coef
 foo1<-matrix(data=foo1,nrow=3,ncol=4,byrow=FALSE)
 write(foo1[1,],"c:/SE/stats.txt",ncolumns=4,append=TRUE)
 write(foo1[2,],"c:/SE/stats.txt",ncolumns=4,append=TRUE)
 write(foo1[3,],"c:/SE/stats.txt",ncolumns=4,append=TRUE)
 foo2<-predict(temparrayreg,temparray.frame,level=0.80,interval="confidence")[66,]
 foo2<-matrix(data=foo2,nrow=1,ncol=3,byrow=TRUE)
 write(foo2[1,1],"c:/SE/stats.txt",append=TRUE)
 write(foo2[1,2:3],"c:/SE/stats.txt",ncolumns=2,append=TRUE)
 foo3<-foo2[1,1]-temparray[66,1]
 write(foo3,"c:/SE/stats.txt",append=TRUE)
 foo4<-predict(temparrayreg,temparray.frame)
 foo5<-matrix(data=0,nrow=7,ncol=2,byrow=TRUE)
 foo5[,1]<-temparray[60:66,1]
 foo5[,2]<-foo4[60:66]
# foo5[,2]<-foo5[,1]+rnorm(7,0,4);
 write(foo5[1,],"c:/se/stats.txt",ncolumns=2,append=TRUE)
 write(foo5[2,],"c:/se/stats.txt",ncolumns=2,append=TRUE)
 write(foo5[3,],"c:/se/stats.txt",ncolumns=2,append=TRUE)
 write(foo5[4,],"c:/se/stats.txt",ncolumns=2,append=TRUE)
 write(foo5[5,],"c:/se/stats.txt",ncolumns=2,append=TRUE)
 write(foo5[6,],"c:/se/stats.txt",ncolumns=2,append=TRUE)
 write(foo5[7,],"c:/se/stats.txt",ncolumns=2,append=TRUE)
 rm(temparray,temparrayreg,temparray.frame,foo1,foo2,foo3,foo4,foo5)
 x<-matrix(data=rep(0,30),nrow=1,ncol=30,byrow=TRUE)
 write(x,"c:/se/stats.txt",ncolumns=30,append=TRUE)
 rm(x)
}