######### A1 n<-500 m<-1000 t<-seq(0,1,length.out=m+1) W<-matrix(0,n,m+1) # Fall II(a): immer die gleichen Messstellen, die dicht aneinander liegen for (i in 1:n){ Y<-rnorm(m) W[i,]<-1/sqrt(m)*c(0,cumsum(Y))} matplot(t,t(W),type="l",lty=1) mw<-apply(W,2,mean) lines(t,mw,lwd=2) #### 1a K<-cov(W) ei<-eigen(K/m,symmetric=TRUE) str(ei) ewe<-ei$values phi<- ei$vectors*sqrt(m) ### 1 b par(mfrow=c(1,3)) theoEV <- 4/(pi^2*(2*(1:100)-1)^2) plot(ewe[1:100]-theoEV[1:100],type="l") #ungefaehr 0 plot(ewe[1:100],theoEV[1:100]) #Steigung ungefaehr 1 abline(0,1,col=2) plot(ewe[1:100]/theoEV[1:100],type="b") #ca. 1 abline(h=1,col=2) ### 1c for (i in 1:10) { par(ask=TRUE) plot(t,phi[,i],type="l",ylim=c(-3,2),main=paste(i,"-te Eigenfunktion")) lines(t,sqrt(2)*sin((2*i-1)*pi/2*t),col=2) lines(t,-sqrt(2)*sin((2*i-1)*pi/2*t),col=3) legend("bottom",legend=c("geschätzt, ungeglättet","theo. mit pos. Vorzeichen","theo mit neg. Vorzeichen"),col=c(1:3),lty=1) } ### 1d xi <- W%*%phi/m dim(xi) plot(xi[,1]) qqnorm(xi[,1]) shapiro.test(xi[,1]) library(nortest) pearson.test(xi[,1])