More than 1 year has passed since last update.
library(dplyr)
n=10000;c=2
samples=function(z){
return(sample(c(1,-1),z,prob=c(1/2,1/2),replace=T))
}
t=0.5
nt=round(t*n)
v=mean(samples(n)^2)
E_guzai_4=mean(samples(n)^4)
c=1/((v^2)/E_guzai_4)
X_mat=array(0,dim=c(nt,10000))
for(j in 1:ncol(X_mat)){
X=(1/sqrt(n*v))*((samples(nt)))
X[nt]=X[nt]+(n*t-nt)*samples(1)
X_mat[,j]=cumsum(X)
}
S_max=apply(X_mat,2,max)
hist(X_mat[nt,])
hist(S_max)
#t>s
s=0.3
nt1=round(n*t);ns1=round(n*s)
E_result=mean(abs(X_mat[nt1,]-X_mat[ns1,])^4)
3*c*abs(t-s)^2
Why not register and get more from Qiita?
- We will deliver articles that match you
By following users and tags, you can catch up information on technical fields that you are interested in as a whole
- you can read useful information later efficiently
By "stocking" the articles you like, you can search right away
Sign upLogin